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 CameraManager { private static Vector3 _defaultCharPos; private static Vector3 _defaultCredPos; private static Vector3 _defaultGamePos; private static Vector3 _defaultMainPos; private static Vector3 _defaultStartPos; private static Vector3 _defaultSavesPos; private static Vector3 _defaultCharRot; private static Vector3 _defaultCredRot; private static Vector3 _defaultGameRot; private static Vector3 _defaultMainRot; private static Vector3 _defaultStartRot; private static Vector3 _defaultSavesRot; private static readonly Vector3 PresetCharPos = new Vector3(-206.2f, 39.34f, 162.26f); private static readonly Vector3 PresetCharRot = new Vector3(19.6f, -211f, 0f); private static readonly Vector3 PresetCredPos = new Vector3(-205.3f, 34.29f, 132.06f); private static readonly Vector3 PresetCredRot = new Vector3(19.6f, -211f, 0f); private static readonly Vector3 PresetMainPos = new Vector3(-208.54f, 32.2f, 131.38f); private static readonly Vector3 PresetMainRot = new Vector3(0.72f, -211f, 0f); private static readonly Vector3 PresetGamePos = new Vector3(-204.55f, 38f, 158.8f); private static readonly Vector3 PresetGameRot = new Vector3(-181.447f, -48.532f, -180f); private static readonly Vector3 PresetSavesPos = new Vector3(-208.45f, 45.76f, 131.23f); private static readonly Vector3 PresetSavesRot = new Vector3(0.72f, -211f, 131.23f); private static readonly Vector3 PresetPlayerPos = new Vector3(-204.51f, 36.5f, 157.53f); internal static void GatherDefaults(FejdStartup startup) { //IL_0006: 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_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: 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) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) _defaultCharPos = startup.m_cameraMarkerCharacter.position; _defaultCredPos = startup.m_cameraMarkerCredits.position; _defaultGamePos = startup.m_cameraMarkerGame.position; _defaultMainPos = startup.m_cameraMarkerMain.position; _defaultStartPos = startup.m_cameraMarkerStart.position; _defaultSavesPos = startup.m_cameraMarkerSaves.position; Quaternion rotation = startup.m_cameraMarkerCharacter.rotation; _defaultCharRot = ((Quaternion)(ref rotation)).eulerAngles; rotation = startup.m_cameraMarkerCredits.rotation; _defaultCredRot = ((Quaternion)(ref rotation)).eulerAngles; rotation = startup.m_cameraMarkerGame.rotation; _defaultGameRot = ((Quaternion)(ref rotation)).eulerAngles; rotation = startup.m_cameraMarkerMain.rotation; _defaultMainRot = ((Quaternion)(ref rotation)).eulerAngles; rotation = startup.m_cameraMarkerStart.rotation; _defaultStartRot = ((Quaternion)(ref rotation)).eulerAngles; rotation = startup.m_cameraMarkerSaves.rotation; _defaultSavesRot = ((Quaternion)(ref rotation)).eulerAngles; } internal static void ApplyConfigValues() { //IL_001f: 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_0049: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: 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_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)FejdStartup.instance == (Object)null)) { FejdStartup instance = FejdStartup.instance; instance.m_cameraMarkerCharacter.position = GlitnirMenuPlugin.CharacterCameraMarker_Position.Value; instance.m_cameraMarkerCredits.position = GlitnirMenuPlugin.CreditsCameraMarker_Position.Value; instance.m_cameraMarkerGame.position = GlitnirMenuPlugin.GameCameraMarker_Position.Value; instance.m_cameraMarkerMain.position = GlitnirMenuPlugin.MainCameraMarker_Position.Value; instance.m_cameraMarkerStart.position = GlitnirMenuPlugin.StartCameraMarker_Position.Value; instance.m_cameraMarkerSaves.position = GlitnirMenuPlugin.SavesCameraMarker_Position.Value; instance.m_cameraMarkerCharacter.rotation = Quaternion.Euler(GlitnirMenuPlugin.CharacterCameraMarker_Rotation.Value); instance.m_cameraMarkerCredits.rotation = Quaternion.Euler(GlitnirMenuPlugin.CreditsCameraMarker_Rotation.Value); instance.m_cameraMarkerGame.rotation = Quaternion.Euler(GlitnirMenuPlugin.GameCameraMarker_Rotation.Value); instance.m_cameraMarkerMain.rotation = Quaternion.Euler(GlitnirMenuPlugin.MainCameraMarker_Rotation.Value); instance.m_cameraMarkerStart.rotation = Quaternion.Euler(GlitnirMenuPlugin.StartCameraMarker_Rotation.Value); instance.m_cameraMarkerSaves.rotation = Quaternion.Euler(GlitnirMenuPlugin.SavesCameraMarker_Rotation.Value); } } internal static void ApplyPlayerValues() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)FejdStartup.instance == (Object)null)) { FejdStartup.instance.m_characterPreviewPoint.position = GlitnirMenuPlugin.MPlayerPosition.Value; FejdStartup.instance.m_characterPreviewPoint.rotation = Quaternion.Euler(GlitnirMenuPlugin.MPlayerRotation.Value); } } internal static void ApplyAndSync() { bool flag = GlitnirMenuPlugin.UsePreset.Value == GlitnirMenuPlugin.Toggle.On; bool flag2 = GlitnirMenuPlugin.UseVanilla.Value == GlitnirMenuPlugin.Toggle.On; if (flag && !flag2) { ApplyPreset(); } else if (flag2 && !flag) { ApplyVanilla(); } ApplyConfigValues(); ApplyPlayerValues(); } internal static void ApplyPreset() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005f: 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) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: 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) GlitnirMenuPlugin.CharacterCameraMarker_Position.Value = PresetCharPos; GlitnirMenuPlugin.CreditsCameraMarker_Position.Value = PresetCredPos; GlitnirMenuPlugin.GameCameraMarker_Position.Value = PresetGamePos; GlitnirMenuPlugin.MainCameraMarker_Position.Value = PresetMainPos; GlitnirMenuPlugin.StartCameraMarker_Position.Value = PresetMainPos; GlitnirMenuPlugin.SavesCameraMarker_Position.Value = PresetSavesPos; GlitnirMenuPlugin.CharacterCameraMarker_Rotation.Value = PresetCharRot; GlitnirMenuPlugin.CreditsCameraMarker_Rotation.Value = PresetCredRot; GlitnirMenuPlugin.GameCameraMarker_Rotation.Value = PresetGameRot; GlitnirMenuPlugin.MainCameraMarker_Rotation.Value = PresetMainRot; GlitnirMenuPlugin.StartCameraMarker_Rotation.Value = PresetMainRot; GlitnirMenuPlugin.SavesCameraMarker_Rotation.Value = PresetSavesRot; GlitnirMenuPlugin.MPlayerPosition.Value = PresetPlayerPos; } internal static void ApplyVanilla() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005f: 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) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) GlitnirMenuPlugin.CharacterCameraMarker_Position.Value = _defaultCharPos; GlitnirMenuPlugin.CreditsCameraMarker_Position.Value = _defaultCredPos; GlitnirMenuPlugin.GameCameraMarker_Position.Value = _defaultGamePos; GlitnirMenuPlugin.MainCameraMarker_Position.Value = _defaultMainPos; GlitnirMenuPlugin.StartCameraMarker_Position.Value = _defaultStartPos; GlitnirMenuPlugin.SavesCameraMarker_Position.Value = _defaultSavesPos; GlitnirMenuPlugin.CharacterCameraMarker_Rotation.Value = _defaultCharRot; GlitnirMenuPlugin.CreditsCameraMarker_Rotation.Value = _defaultCredRot; GlitnirMenuPlugin.GameCameraMarker_Rotation.Value = _defaultGameRot; GlitnirMenuPlugin.MainCameraMarker_Rotation.Value = _defaultMainRot; GlitnirMenuPlugin.StartCameraMarker_Rotation.Value = _defaultStartRot; GlitnirMenuPlugin.SavesCameraMarker_Rotation.Value = _defaultSavesRot; } internal static bool HandleCameraLock(FejdStartup instance) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: 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) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) if (GlitnirMenuPlugin.CameraLockEnabled.Value != GlitnirMenuPlugin.Toggle.On) { return true; } Scene activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name != "start") { return true; } Camera val = Camera.main ?? ((Camera.allCameras.Length != 0) ? Camera.allCameras[0] : null); if ((Object)(object)val == (Object)null) { return true; } Transform cameraMarkerCharacter = instance.m_cameraMarkerCharacter; if ((Object)(object)cameraMarkerCharacter == (Object)null) { return true; } Vector3 val2 = cameraMarkerCharacter.position + GlitnirMenuPlugin.CameraLockOffset.Value; Quaternion rotation = cameraMarkerCharacter.rotation; float value = GlitnirMenuPlugin.CameraLockBackOffset.Value; if (!Mathf.Approximately(value, 0f)) { val2 -= cameraMarkerCharacter.forward * value; } float value2 = GlitnirMenuPlugin.CameraLockSmoothing.Value; if (value2 > 0f) { ((Component)val).transform.position = Vector3.Lerp(((Component)val).transform.position, val2, Time.deltaTime / value2); ((Component)val).transform.rotation = Quaternion.Slerp(((Component)val).transform.rotation, rotation, Time.deltaTime / value2); } else { ((Component)val).transform.position = val2; ((Component)val).transform.rotation = rotation; } return GlitnirMenuPlugin.CameraLockAllScreens.Value != GlitnirMenuPlugin.Toggle.On; } } internal static class DiscordPanel { private static GameObject _panel; private static Image _logoImage; private static Texture2D _logoTexture; private static Sprite _logoSprite; internal static void BuildOrRefresh(FejdStartup fejd) { if (!((Object)(object)fejd == (Object)null)) { if (GlitnirMenuPlugin.DiscordPanelEnabled.Value != GlitnirMenuPlugin.Toggle.On) { Destroy(); } else if ((Object)(object)_panel != (Object)null) { Refresh(fejd); } else { Build(fejd); } } } internal static void Rebuild(FejdStartup fejd) { Destroy(); BuildOrRefresh(fejd); } internal static void Refresh(FejdStartup fejd) { if (!((Object)(object)_panel == (Object)null)) { bool active = (Object)(object)fejd != (Object)null && (Object)(object)fejd.m_mainMenu != (Object)null && fejd.m_mainMenu.activeInHierarchy; _panel.SetActive(active); } } internal static void Destroy() { if ((Object)(object)_panel != (Object)null) { Object.Destroy((Object)(object)_panel); _panel = null; } if ((Object)(object)_logoSprite != (Object)null) { Object.Destroy((Object)(object)_logoSprite); _logoSprite = null; } if ((Object)(object)_logoTexture != (Object)null) { Object.Destroy((Object)(object)_logoTexture); _logoTexture = null; } _logoImage = null; } private static void Build(FejdStartup fejd) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Expected O, but got Unknown //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Expected O, but got Unknown //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) try { Canvas val = Object.FindFirstObjectByType(); if ((Object)(object)val == (Object)null) { return; } _panel = new GameObject("GlitnirDiscordPanel"); _panel.transform.SetParent(((Component)val).transform, false); RectTransform val2 = _panel.AddComponent(); val2.anchorMin = new Vector2(1f, 0f); val2.anchorMax = new Vector2(1f, 0f); val2.pivot = new Vector2(1f, 0f); val2.anchoredPosition = new Vector2(GlitnirMenuPlugin.DiscordPosX.Value, GlitnirMenuPlugin.DiscordPosY.Value); val2.sizeDelta = new Vector2(GlitnirMenuPlugin.DiscordLogoWidth.Value + 20f, GlitnirMenuPlugin.DiscordLogoHeight.Value + 20f); GameObject val3 = new GameObject("DiscordLogo"); val3.transform.SetParent(_panel.transform, false); RectTransform val4 = val3.AddComponent(); val4.anchorMin = Vector2.zero; val4.anchorMax = Vector2.one; val4.offsetMin = Vector2.zero; val4.offsetMax = Vector2.zero; _logoImage = val3.AddComponent(); _logoImage.preserveAspect = true; ((Graphic)_logoImage).color = Color.white; LoadLogoSprite(); string url = GlitnirMenuPlugin.DiscordInviteUrl.Value; if (!string.IsNullOrWhiteSpace(url)) { Button val5 = val3.AddComponent