using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Net; using System.Net.Sockets; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Threading; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.SceneManagement; using UnityEngine.UI; [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("GlitnirMenu")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("GlitnirMenu")] [assembly: AssemblyTitle("GlitnirMenu")] [assembly: AssemblyVersion("1.0.0.0")] [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 GlitnirMenu { internal static class TransformHelper { internal static Transform FindChild(Transform parent, string name) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown if ((Object)(object)parent == (Object)null) { return null; } foreach (Transform item in parent) { Transform val = item; if (((Object)val).name == name) { return val; } Transform val2 = FindChild(val, name); if ((Object)(object)val2 != (Object)null) { return val2; } } return null; } } [BepInPlugin("Padilha.GlitnirMenu", "GlitnirMenu", "1.2.0")] public class GlitnirMenuPlugin : BaseUnityPlugin { public enum Toggle { On = 1, Off = 0 } private const string ModGUID = "Padilha.GlitnirMenu"; private static readonly string ConfigFileFullPath; public static readonly string AssetRoot; public static readonly string LoadingArtFolder; public static readonly string TeleportArtFolder; private readonly Harmony _harmony = new Harmony("Padilha.GlitnirMenu"); internal static TMP_FontAsset CapturedMenuFont; private static ConfigEntry _modEnabled; private static ConfigEntry _mainLogoFile; public static ConfigEntry MainLogoWidth; public static ConfigEntry MainLogoHeight; public static ConfigEntry MainLogoOffsetY; private static Sprite _mainLogoSprite; public static ConfigEntry DiscordInviteUrl; public static ConfigEntry DiscordPanelEnabled; public static ConfigEntry DiscordLogoWidth; public static ConfigEntry DiscordLogoHeight; public static ConfigEntry DiscordPosX; public static ConfigEntry DiscordPosY; private static GameObject _discordPanel; private static Image _discordLogoImage; public static ConfigEntry LoadingScreenEnabled; public static ConfigEntry SlideshowEnabled; public static ConfigEntry SlideshowInterval; public static ConfigEntry TeleportScreenEnabled; public static ConfigEntry HideChangelog; public static ConfigEntry HideMerchStore; public static ConfigEntry HideModdedWarning; public static ConfigEntry WelcomePanelTitle; public static ConfigEntry WelcomePanelMessage; public static ConfigEntry WelcomeServerMaxPlayers; public static ConfigEntry WelcomeServerIP; public static ConfigEntry WelcomeServerQueryPort; public static ConfigEntry WelcomePanelEnabled; public static ConfigEntry WelcomePanelWidth; public static ConfigEntry WelcomePanelHeight; public static ConfigEntry WelcomePanelPosX; public static ConfigEntry WelcomePanelPosY; public static ConfigEntry UsePreset; public static ConfigEntry UseVanilla; public static ConfigEntry CharacterCameraMarker_Position; public static ConfigEntry CreditsCameraMarker_Position; public static ConfigEntry GameCameraMarker_Position; public static ConfigEntry MainCameraMarker_Position; public static ConfigEntry StartCameraMarker_Position; public static ConfigEntry SavesCameraMarker_Position; public static ConfigEntry CharacterCameraMarker_Rotation; public static ConfigEntry CreditsCameraMarker_Rotation; public static ConfigEntry GameCameraMarker_Rotation; public static ConfigEntry MainCameraMarker_Rotation; public static ConfigEntry StartCameraMarker_Rotation; public static ConfigEntry SavesCameraMarker_Rotation; public static ConfigEntry MPlayerPosition; public static ConfigEntry MPlayerRotation; public static ConfigEntry MFirePosition; internal static Vector3 DefaultCharPos; internal static Vector3 DefaultCredPos; internal static Vector3 DefaultGamePos; internal static Vector3 DefaultMainPos; internal static Vector3 DefaultStartPos; internal static Vector3 DefaultSavesPos; internal static Vector3 DefaultCharRot; internal static Vector3 DefaultCredRot; internal static Vector3 DefaultGameRot; internal static Vector3 DefaultMainRot; internal static Vector3 DefaultStartRot; internal static Vector3 DefaultSavesRot; internal static Transform DefaultPlayerPreviewPoint; internal static Vector3 DefaultPlayerPos; internal static Vector3 DefaultPlayerRot; private static readonly Vector3 PresetCharPos; private static readonly Vector3 PresetCharRot; private static readonly Vector3 PresetCredPos; private static readonly Vector3 PresetCredRot; private static readonly Vector3 PresetMainPos; private static readonly Vector3 PresetMainRot; private static readonly Vector3 PresetGamePos; private static readonly Vector3 PresetGameRot; private static readonly Vector3 PresetSavesPos; private static readonly Vector3 PresetSavesRot; private static readonly Vector3 PresetPlayerPos; private static ConfigFile _cfg; private static GameObject _welcomePanel; private static TextMeshProUGUI _welcomePlayersText; private static TextMeshProUGUI _welcomeStatusText; private static int _cachedPlayerCount; internal static GameObject _overlayRoot; private static Image _wolfFillImage; private static Text _progressLegacyText; private static TextMeshProUGUI _progressTmpText; internal static float _progressValue; private static RawImage _overlayRawImage; private static CanvasGroup _overlayGroup; private static CanvasCoroutineRunner _overlayRunner; private static Texture2D _overlayTexture; internal static float TargetProgress; private static readonly (float threshold, string message)[] LoadingMessages; private static readonly (float threshold, string message)[] TeleportMessages; internal static bool DeathRespawnHappened; public static ManualLogSource Log { get; private set; } public static GlitnirMenuPlugin Instance { get; private set; } internal static bool IsTeleportOverlay { get { if ((Object)(object)_overlayRoot != (Object)null) { return ((Object)_overlayRoot).name == "GlitnirMenu_TeleportOverlay"; } return false; } } public void Awake() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_0542: Unknown result type (might be due to invalid IL or missing references) //IL_0570: Unknown result type (might be due to invalid IL or missing references) //IL_059e: Unknown result type (might be due to invalid IL or missing references) //IL_05cc: Unknown result type (might be due to invalid IL or missing references) //IL_05fa: Unknown result type (might be due to invalid IL or missing references) //IL_0628: Unknown result type (might be due to invalid IL or missing references) //IL_0656: Unknown result type (might be due to invalid IL or missing references) //IL_0684: Unknown result type (might be due to invalid IL or missing references) //IL_06b2: Unknown result type (might be due to invalid IL or missing references) //IL_06e0: Unknown result type (might be due to invalid IL or missing references) //IL_070e: Unknown result type (might be due to invalid IL or missing references) //IL_073c: Unknown result type (might be due to invalid IL or missing references) //IL_0897: Unknown result type (might be due to invalid IL or missing references) //IL_08c5: Unknown result type (might be due to invalid IL or missing references) //IL_08f3: Unknown result type (might be due to invalid IL or missing references) Instance = this; Log = ((BaseUnityPlugin)this).Logger; EnsureFolders(); _cfg = new ConfigFile(ConfigFileFullPath, true); _modEnabled = Cfg("1 - Geral", "Mod Ativado", Toggle.On, "Ativa ou desativa o GlitnirMenu."); _mainLogoFile = Cfg("2 - Logo", "Logo Principal", "GlitnirMenu_Logo.png", "Nome do arquivo PNG da logo. Coloque em BepInEx/config/GlitnirMenu/images/menu/"); MainLogoWidth = Cfg("2 - Logo", "Logo Largura", 700f, "Largura em pixels da logo no menu principal. 0 = tamanho original."); MainLogoHeight = Cfg("2 - Logo", "Logo Altura", 700f, "Altura em pixels da logo no menu principal. 0 = tamanho original."); MainLogoOffsetY = Cfg("2 - Logo", "Logo Posicao Y", 550f, "Desloca a logo verticalmente em pixels. Positivo = sobe, negativo = desce."); _modEnabled.SettingChanged += delegate { TryReloadLogos(); }; MainLogoWidth.SettingChanged += delegate { TryReloadLogos(); }; MainLogoHeight.SettingChanged += delegate { TryReloadLogos(); }; MainLogoOffsetY.SettingChanged += delegate { TryReloadLogos(); }; DiscordPanelEnabled = Cfg("4 - Discord", "Painel Ativado", Toggle.On, "Mostra o painel do Discord no menu principal."); DiscordInviteUrl = Cfg("4 - Discord", "Link do Servidor", "", "Link de convite do Discord (https://discord.gg/...). Deixe vazio para desativar o botão."); DiscordLogoWidth = Cfg("4 - Discord", "Logo Largura", 400f, "Largura em pixels da imagem do Discord no menu."); DiscordLogoHeight = Cfg("4 - Discord", "Logo Altura", 200f, "Altura em pixels da imagem do Discord no menu."); DiscordPosX = Cfg("4 - Discord", "Posicao X", 50f, "Posição horizontal (negativo = da borda direita)."); DiscordPosY = Cfg("4 - Discord", "Posicao Y", 50f, "Posição vertical (positivo = sobe da base)."); Action rebuildDiscord = delegate { if ((Object)(object)_discordPanel != (Object)null) { Object.Destroy((Object)(object)_discordPanel); _discordPanel = null; } if ((Object)(object)FejdStartup.instance != (Object)null) { CreateOrRefreshDiscordPanel(FejdStartup.instance); } }; DiscordLogoWidth.SettingChanged += delegate { rebuildDiscord(); }; DiscordLogoHeight.SettingChanged += delegate { rebuildDiscord(); }; DiscordPanelEnabled.SettingChanged += delegate { rebuildDiscord(); }; DiscordPosX.SettingChanged += delegate { rebuildDiscord(); }; DiscordPosY.SettingChanged += delegate { rebuildDiscord(); }; LoadingScreenEnabled = Cfg("3 - Loading Screen", "Ativado", Toggle.On, "Exibe uma imagem personalizada durante o carregamento do mundo. Coloque PNGs em BepInEx/config/GlitnirMenu/images/loading/"); TeleportScreenEnabled = Cfg("3 - Loading Screen", "Tela de Teleporte", Toggle.On, "Exibe uma imagem personalizada durante o teleporte. Coloque PNGs em BepInEx/config/GlitnirMenu/images/teleport/"); SlideshowEnabled = Cfg("3 - Loading Screen", "Slideshow Ativado", Toggle.On, "Troca as imagens automaticamente durante o carregamento."); SlideshowInterval = Cfg("3 - Loading Screen", "Slideshow Intervalo", 4f, "Segundos entre cada troca de imagem no slideshow."); HideChangelog = Cfg("5 - Esconder", "Esconder Changelog", Toggle.On, "Esconde o painel de notas de atualização do menu."); HideMerchStore = Cfg("5 - Esconder", "Esconder Merch Store", Toggle.On, "Esconde o link da loja de produtos oficiais."); HideModdedWarning = Cfg("5 - Esconder", "Esconder Aviso de Mod", Toggle.On, "Esconde o aviso 'Você está jogando uma versão modificada'."); WelcomePanelTitle = Cfg("11 - Painel Boas-vindas", "Titulo", "⚔ GLITNIR FANTASY ⚔", "Título exibido no painel de boas-vindas."); WelcomePanelMessage = Cfg("11 - Painel Boas-vindas", "Mensagem", "O eco das trombetas de guerra ressoa e os corvos de Odin trazem a notícia: sua jornada em Valheim começou! Você acaba de atracar em Glitnir, um reino moldado pelo aço, pela magia e pela glória. Aqui, não somos apenas sobreviventes; somos construtores de impérios, caçadores de feras lendárias e irmãos de armas. Seja você um mestre construtor que ergue fortalezas impenetráveis, um guerreiro implacável pronto para encarar os piores perigos dos biomas mais sombrios, ou um alquimista focado em poções e estratégias avançadas, o seu lugar é aqui", "Mensagem de boas-vindas."); WelcomeServerMaxPlayers = Cfg("11 - Painel Boas-vindas", "Max Players", 100, "Capacidade máxima do servidor."); WelcomeServerIP = Cfg("11 - Painel Boas-vindas", "Servidor IP", "177.54.147.114", "IP do servidor Valheim."); WelcomeServerQueryPort = Cfg("11 - Painel Boas-vindas", "Servidor Porta Query", 24445, "Porta de query Steam (geralmente porta do jogo + 1)."); WelcomePanelEnabled = Cfg("11 - Painel Boas-vindas", "Ativado", Toggle.On, "Ativa ou desativa o painel de boas-vindas."); WelcomePanelWidth = Cfg("11 - Painel Boas-vindas", "Largura", 320f, "Largura do painel em pixels."); WelcomePanelHeight = Cfg("11 - Painel Boas-vindas", "Altura", 500f, "Altura do painel em pixels."); WelcomePanelPosX = Cfg("11 - Painel Boas-vindas", "Posicao X", 5f, "Posição horizontal do painel (pixels da borda esquerda)."); WelcomePanelPosY = Cfg("11 - Painel Boas-vindas", "Posicao Y", 130f, "Posição vertical do painel (pixels da base da tela)."); UsePreset = Cfg("6 - Presets", "Usar Preset", Toggle.On, "Usa as posições de câmera do preset Glitnir."); UseVanilla = Cfg("6 - Presets", "Usar Vanilla", Toggle.Off, "Usa as posições de câmera originais do Valheim."); UsePreset.SettingChanged += delegate { if (UsePreset.Value == Toggle.On) { UseVanilla.Value = Toggle.Off; } SceneFunctions.UpdateAndSet(); }; UseVanilla.SettingChanged += delegate { if (UseVanilla.Value == Toggle.On) { UsePreset.Value = Toggle.Off; } SceneFunctions.UpdateAndSet(); }; CharacterCameraMarker_Position = Cfg("7 - Câmeras Posição", "Character", new Vector3(-161.89f, 55.97f, 230.13f), ""); CreditsCameraMarker_Position = Cfg("7 - Câmeras Posição", "Credits", new Vector3(-156.86f, 78.89f, 225.68f), ""); GameCameraMarker_Position = Cfg("7 - Câmeras Posição", "Game", new Vector3(-157.85f, 56.59f, 229.93f), ""); MainCameraMarker_Position = Cfg("7 - Câmeras Posição", "Main", new Vector3(-142.53f, 59f, 227.72f), ""); StartCameraMarker_Position = Cfg("7 - Câmeras Posição", "Start", new Vector3(-137.63f, 54.78f, 227.44f), ""); SavesCameraMarker_Position = Cfg("7 - Câmeras Posição", "Saves", new Vector3(-163.02f, 60.34f, 228.74f), ""); CharacterCameraMarker_Rotation = Cfg("8 - Câmeras Rotação", "Character", new Vector3(13.79f, -84.748f, 0f), ""); CreditsCameraMarker_Rotation = Cfg("8 - Câmeras Rotação", "Credits", new Vector3(-2.197f, -48.48f, 0f), ""); GameCameraMarker_Rotation = Cfg("8 - Câmeras Rotação", "Game", new Vector3(-187.257f, 77.72f, 180f), ""); MainCameraMarker_Rotation = Cfg("8 - Câmeras Rotação", "Main", new Vector3(1.241f, -84.232f, 0f), ""); StartCameraMarker_Rotation = Cfg("8 - Câmeras Rotação", "Start", new Vector3(41.028f, -84.232f, 0f), ""); SavesCameraMarker_Rotation = Cfg("8 - Câmeras Rotação", "Saves", new Vector3(185.79f, 81.743f, -180f), ""); Action onCamChange = delegate { SceneFunctions.UpdateCameraValues(); }; CharacterCameraMarker_Position.SettingChanged += delegate { onCamChange(); }; CreditsCameraMarker_Position.SettingChanged += delegate { onCamChange(); }; GameCameraMarker_Position.SettingChanged += delegate { onCamChange(); }; MainCameraMarker_Position.SettingChanged += delegate { onCamChange(); }; StartCameraMarker_Position.SettingChanged += delegate { onCamChange(); }; SavesCameraMarker_Position.SettingChanged += delegate { onCamChange(); }; CharacterCameraMarker_Rotation.SettingChanged += delegate { onCamChange(); }; CreditsCameraMarker_Rotation.SettingChanged += delegate { onCamChange(); }; GameCameraMarker_Rotation.SettingChanged += delegate { onCamChange(); }; MainCameraMarker_Rotation.SettingChanged += delegate { onCamChange(); }; StartCameraMarker_Rotation.SettingChanged += delegate { onCamChange(); }; SavesCameraMarker_Rotation.SettingChanged += delegate { onCamChange(); }; MPlayerPosition = Cfg("9 - Player", "Posição", new Vector3(-204.51f, 36.5f, 157.53f), ""); MPlayerRotation = Cfg("9 - Player", "Rotação", new Vector3(13.79f, -84.748f, 0f), ""); MFirePosition = Cfg("10 - Fogo", "Posição", new Vector3(-203.51f, 36.5f, 158.53f), ""); MPlayerPosition.SettingChanged += delegate { SceneFunctions.UpdatePlayerValues(); }; MPlayerRotation.SettingChanged += delegate { SceneFunctions.UpdatePlayerValues(); }; MFirePosition.SettingChanged += delegate { SceneFunctions.UpdateFirePosition(); }; WolfBarAssets.Load(); TryReloadLogos(); _harmony.PatchAll(Assembly.GetExecutingAssembly()); SetupWatcher(); } private void OnDestroy() { _cfg.Save(); } private ConfigEntry Cfg(string group, string name, T value, string desc) { return _cfg.Bind(group, name, value, desc); } private static void EnsureFolders() { Directory.CreateDirectory(AssetRoot); Directory.CreateDirectory(LoadingArtFolder); Directory.CreateDirectory(Path.Combine(AssetRoot, "discord")); Directory.CreateDirectory(TeleportArtFolder); Directory.CreateDirectory(Path.Combine(AssetRoot, "menu")); } internal static void TryReloadLogos() { if (IsStartScene() && _modEnabled.Value == Toggle.On) { _mainLogoSprite = LoadSprite(_mainLogoFile.Value); ApplyLogos(); } } private static Sprite LoadSprite(string filename) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) Texture2D val = LoadTexture(filename); if ((Object)(object)val == (Object)null) { return null; } return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), Vector2.zero); } private static Texture2D LoadTexture(string filename) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Expected O, but got Unknown Texture2D val = new Texture2D(0, 0); try { string path = Path.Combine(AssetRoot, "menu"); List list = Directory.GetFiles(path, "*.png", SearchOption.AllDirectories).OrderBy(Path.GetFileName).ToList(); string text = list.Find((string f) => Path.GetFileName(f) == filename); if (text == null) { Log.LogWarning((object)("[GlitnirMenu] Imagem não encontrada: " + filename)); return null; } ImageConversion.LoadImage(val, File.ReadAllBytes(text)); return val; } catch (Exception ex) { Log.LogWarning((object)("[GlitnirMenu] Erro ao carregar " + filename + ": " + ex.Message)); return null; } } internal static Sprite LoadSpriteFromPath(string fullPath) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) try { Texture2D val = new Texture2D(2, 2); ImageConversion.LoadImage(val, File.ReadAllBytes(fullPath)); return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), 100f); } catch (Exception ex) { Log.LogWarning((object)("[GlitnirMenu] Erro ao carregar sprite: " + ex.Message)); return null; } } internal static void ApplyLogos() { //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: 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_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_mainLogoSprite == (Object)null || (Object)(object)FejdStartup.instance == (Object)null) { return; } try { Transform val = TransformHelper.FindChild(FejdStartup.instance.m_mainMenu.transform, "Logo"); if ((Object)(object)val == (Object)null) { Log.LogError((object)"[GlitnirMenu] Transform 'Logo' não encontrado."); return; } Transform val2 = TransformHelper.FindChild(val, "LOGO"); if ((Object)(object)val2 != (Object)null) { ((Component)val2).GetComponent().sprite = _mainLogoSprite; RectTransform component = ((Component)val2).GetComponent(); if ((Object)(object)component != (Object)null) { float value = MainLogoWidth.Value; float value2 = MainLogoHeight.Value; component.anchorMin = new Vector2(0.5f, 0.5f); component.anchorMax = new Vector2(0.5f, 0.5f); if (value > 0f || value2 > 0f) { component.sizeDelta = new Vector2((value > 0f) ? value : component.sizeDelta.x, (value2 > 0f) ? value2 : component.sizeDelta.y); } component.anchoredPosition = new Vector2(component.anchoredPosition.x, MainLogoOffsetY.Value); } } string[] array = new string[9] { "Ashlands", "AshlandsLogo", "Heat Distortion", "AshlandsLogo_Glow", "Embers", "Embers (1)", "Embers (2)", "Embers (3)", "Ash" }; string[] array2 = array; foreach (string name in array2) { Transform obj = TransformHelper.FindChild(val, name); if (obj != null) { ((Component)obj).gameObject.SetActive(false); } } Log.LogInfo((object)"[GlitnirMenu] Logo aplicada."); } catch (Exception ex) { Log.LogError((object)("[GlitnirMenu] Erro ao aplicar logo: " + ex.Message)); } } internal static TMP_FontAsset GetMenuFont() { TextMeshProUGUI val = Object.FindFirstObjectByType(); if ((Object)(object)val != (Object)null && (Object)(object)((TMP_Text)val).font != (Object)null) { return ((TMP_Text)val).font; } TMP_FontAsset val2 = Resources.Load("Fonts & Materials/LiberationSans SDF"); if ((Object)(object)val2 != (Object)null) { return val2; } TMP_FontAsset[] array = Resources.FindObjectsOfTypeAll(); if (array != null && array.Length != 0) { return array[0]; } return null; } internal static void CreateOrRefreshDiscordPanel(FejdStartup fejd) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Expected O, but got Unknown //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Expected O, but got Unknown //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) if (DiscordPanelEnabled.Value != Toggle.On || (Object)(object)fejd == (Object)null) { return; } if ((Object)(object)_discordPanel != (Object)null) { RefreshDiscordPanelVisibility(fejd); return; } try { Canvas val = Object.FindFirstObjectByType(); if ((Object)(object)val == (Object)null) { return; } _discordPanel = new GameObject("GlitnirDiscordPanel"); _discordPanel.transform.SetParent(((Component)val).transform, false); RectTransform val2 = _discordPanel.AddComponent(); val2.anchorMin = new Vector2(1f, 0f); val2.anchorMax = new Vector2(1f, 0f); val2.pivot = new Vector2(1f, 0f); val2.anchoredPosition = new Vector2(DiscordPosX.Value, DiscordPosY.Value); val2.sizeDelta = new Vector2(DiscordLogoWidth.Value + 20f, DiscordLogoHeight.Value + 20f); GameObject val3 = new GameObject("DiscordLogo"); val3.transform.SetParent(_discordPanel.transform, false); RectTransform val4 = val3.AddComponent(); val4.anchorMin = new Vector2(0f, 0f); val4.anchorMax = new Vector2(1f, 1f); val4.offsetMin = Vector2.zero; val4.offsetMax = Vector2.zero; _discordLogoImage = val3.AddComponent(); _discordLogoImage.preserveAspect = true; ((Graphic)_discordLogoImage).color = Color.white; string text = Path.Combine(AssetRoot, "discord", "discord_logo.png"); if (File.Exists(text)) { Sprite val5 = LoadSpriteFromPath(text); if ((Object)(object)val5 != (Object)null) { _discordLogoImage.sprite = val5; } } if (!string.IsNullOrWhiteSpace(DiscordInviteUrl.Value)) { Button val6 = val3.AddComponent