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 QuickPlay v1.1.0
QuickPlay.dll
Decompiled 2 weeks agousing System; using System.Collections; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [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: AssemblyCompany("QuickPlay")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("QuickPlay")] [assembly: AssemblyTitle("QuickPlay")] [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 QuickPlay { [BepInPlugin("quickplay", "QuickPlay", "1.1.0")] public class Plugin : BaseUnityPlugin { public const string Guid = "quickplay"; public const string Name = "QuickPlay"; public const string Version = "1.1.0"; internal static Plugin Instance; internal static ConfigEntry<bool> SkipLogos; internal static ConfigEntry<bool> SkipNotices; internal static ConfigEntry<bool> SkipStartupIntro; internal static ConfigEntry<bool> SkipNewWorldIntro; internal static ConfigEntry<bool> SkipValkyrie; internal static ConfigEntry<bool> SkipPopups; internal static ConfigEntry<bool> AutoContinue; internal static ConfigEntry<float> AutoContinueDelay; private void Awake() { //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Expected O, but got Unknown //IL_0128: Unknown result type (might be due to invalid IL or missing references) Instance = this; SkipLogos = ((BaseUnityPlugin)this).Config.Bind<bool>("Startup", "SkipLogos", true, "Skip the Iron Gate / Coffee Stain / Valheim logos at launch."); SkipNotices = ((BaseUnityPlugin)this).Config.Bind<bool>("Startup", "SkipNotices", true, "Skip the health warning and the autosave notice at launch."); SkipStartupIntro = ((BaseUnityPlugin)this).Config.Bind<bool>("Startup", "SkipStartupIntro", true, "Skip the animated intro video before the main menu."); SkipPopups = ((BaseUnityPlugin)this).Config.Bind<bool>("Startup", "SkipPopups", true, "No 'new changelog' notice and no startup warning popups in the main menu."); AutoContinue = ((BaseUnityPlugin)this).Config.Bind<bool>("Continue", "AutoContinue", true, "After launch, load your last character into your last world. Hold Shift, press Esc or click to stay in the menu."); AutoContinueDelay = ((BaseUnityPlugin)this).Config.Bind<float>("Continue", "Delay", 10f, new ConfigDescription("Seconds to cancel before auto continue starts.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>())); SkipNewWorldIntro = ((BaseUnityPlugin)this).Config.Bind<bool>("World", "SkipNewWorldIntro", true, "Skip the intro video when entering a brand new world."); SkipValkyrie = ((BaseUnityPlugin)this).Config.Bind<bool>("World", "SkipValkyrie", true, "New characters appear at the spawn stones instead of riding in on the valkyrie."); new Harmony("quickplay").PatchAll(typeof(Plugin).Assembly); ((BaseUnityPlugin)this).Logger.LogInfo((object)"QuickPlay 1.1.0 loaded"); } private void OnGUI() { AutoContinueRunner.DrawHint(); } internal static void Log(string text) { Plugin instance = Instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogInfo((object)text); } } } [HarmonyPatch(typeof(SceneLoader))] internal static class SplashPatch { [HarmonyPrefix] [HarmonyPatch("Awake")] private static void BeforeAwake(SceneLoader __instance) { Apply(__instance); } [HarmonyPrefix] [HarmonyPatch("Start")] private static void BeforeStart(SceneLoader __instance) { Apply(__instance); } private static void Apply(SceneLoader loader) { Traverse val = Traverse.Create((object)loader); if (Plugin.SkipLogos.Value) { val.Field("_showLogos").SetValue((object)false); } if (Plugin.SkipNotices.Value) { val.Field("_showHealthWarning").SetValue((object)false); val.Field("_showSaveNotification").SetValue((object)false); } } } [HarmonyPatch] internal static class IntroPatch { [HarmonyPrefix] [HarmonyPatch(typeof(FejdStartup), "TryPlayIntroCinematic")] private static bool QuickPlayCoroutine(ref IEnumerator __result) { if (!Plugin.SkipStartupIntro.Value) { return true; } __result = Nothing(); return false; } [HarmonyPostfix] [HarmonyPatch(typeof(CinematicsManager), "Awake")] private static void DisableIntroFlags(CinematicsManager __instance) { Traverse val = Traverse.Create((object)__instance); if (Plugin.SkipStartupIntro.Value) { val.Field("m_introOnStartup").SetValue((object)false); } if (Plugin.SkipNewWorldIntro.Value) { val.Field("m_introOnNewWorld").SetValue((object)false); } } private static IEnumerator Nothing() { yield break; } } [HarmonyPatch] internal static class PopupPatch { [HarmonyPrefix] [HarmonyPatch(typeof(FejdStartup), "CheckShowChangelogNotice")] private static bool NoChangelogNotice(FejdStartup __instance) { if (!Plugin.SkipPopups.Value) { return true; } GameObject value = Traverse.Create((object)__instance).Field("m_changeLogNotice").GetValue<GameObject>(); if (Object.op_Implicit((Object)(object)value)) { value.SetActive(false); } return false; } [HarmonyPrefix] [HarmonyPatch(typeof(StartupMessages), "DisplayStartupMessages")] private static bool NoStartupMessages() { return !Plugin.SkipPopups.Value; } } [HarmonyPatch(typeof(Game), "SpawnPlayer")] internal static class ValkyriePatch { private static void Prefix(Game __instance) { if (!Plugin.SkipValkyrie.Value) { return; } Traverse val = Traverse.Create((object)__instance); if (val.Field("m_firstSpawn").GetValue<bool>()) { val.Field("m_firstSpawn").SetValue((object)false); PlayerProfile playerProfile = __instance.GetPlayerProfile(); if (playerProfile != null) { Traverse.Create((object)playerProfile).Field("m_firstSpawn").SetValue((object)false); } Plugin.Log("Valkyrie ride skipped"); } } } [HarmonyPatch(typeof(FejdStartup), "Start")] internal static class AutoContinuePatch { private static void Postfix(FejdStartup __instance) { if (Plugin.AutoContinue.Value && !AutoContinueRunner.Used) { AutoContinueRunner.Used = true; ((MonoBehaviour)__instance).StartCoroutine(AutoContinueRunner.Run(__instance)); } } } internal static class AutoContinueRunner { internal static bool Used; private static float _until; private static bool _showing; private static GUIStyle _style; internal static IEnumerator Run(FejdStartup menu) { if (menu.HasServerToJoin()) { yield break; } Traverse t = Traverse.Create((object)menu); GameObject mainMenu = t.Field("m_mainMenu").GetValue<GameObject>(); yield return WaitFor(() => Object.op_Implicit((Object)(object)mainMenu) && mainMenu.activeInHierarchy, 15f); if (!Object.op_Implicit((Object)(object)mainMenu) || !mainMenu.activeInHierarchy) { yield break; } _until = Time.realtimeSinceStartup + Plugin.AutoContinueDelay.Value; _showing = true; while (Time.realtimeSinceStartup < _until) { if (Cancelled()) { _showing = false; Plugin.Log("Auto continue cancelled"); yield break; } yield return null; } _showing = false; t.Method("OnStartGame", Array.Empty<object>()).GetValue(); GameObject charSelect = t.Field("m_characterSelectScreen").GetValue<GameObject>(); yield return WaitFor(() => Object.op_Implicit((Object)(object)charSelect) && charSelect.activeInHierarchy, 5f); yield return null; IList value = t.Field("m_profiles").GetValue<IList>(); if (value == null || value.Count == 0) { Plugin.Log("Auto continue: no character yet, staying in the menu"); yield break; } t.Method("OnCharacterStart", Array.Empty<object>()).GetValue(); GameObject startPanel = t.Field("m_startGamePanel").GetValue<GameObject>(); yield return WaitFor(() => Object.op_Implicit((Object)(object)startPanel) && startPanel.activeInHierarchy, 5f); yield return null; if (t.Field("m_world").GetValue() == null) { Plugin.Log("Auto continue: no world selected, staying in the menu"); yield break; } t.Method("OnWorldStart", Array.Empty<object>()).GetValue(); Plugin.Log("Auto continue: starting last world"); } private static IEnumerator WaitFor(Func<bool> ready, float seconds) { float until = Time.realtimeSinceStartup + seconds; while (!ready() && Time.realtimeSinceStartup < until) { yield return null; } } private static bool Cancelled() { if (!Input.GetKey((KeyCode)304) && !Input.GetKey((KeyCode)303) && !Input.GetKeyDown((KeyCode)27)) { return Input.GetMouseButtonDown(0); } return true; } internal static void DrawHint() { //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: 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_002d: 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_0040: Expected O, but got Unknown //IL_0045: Expected O, but got Unknown //IL_004f: Unknown result type (might be due to invalid IL or missing references) if (_showing) { if (_style == null) { _style = new GUIStyle(GUI.skin.box) { fontSize = 18, alignment = (TextAnchor)4, padding = new RectOffset(16, 16, 10, 10) }; _style.normal.textColor = Color.white; } string text = "Continuing your last game in " + Mathf.CeilToInt(Mathf.Max(0f, _until - Time.realtimeSinceStartup)) + "... Esc / Shift / click = stay in menu"; GUI.Box(new Rect((float)Screen.width * 0.5f - 330f, (float)Screen.height - 110f, 660f, 44f), text, _style); } } } }