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 FastTeleport v1.1.0
ValheimFastTeleport.dll
Decompiled 2 years agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("ValheimFastTeleport")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ValheimFastTeleport")] [assembly: AssemblyCopyright("Copyright © 2022")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("e2c5c2e4-fd8b-4cc7-a69b-4700da29b66f")] [assembly: AssemblyFileVersion("1.1.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = ".NET Framework 4.6")] [assembly: AssemblyVersion("1.1.0.0")] namespace ValheimFastTeleport; [DefaultExecutionOrder(100)] [BepInProcess("valheim.exe")] [BepInPlugin("GemHunter1.FastTeleport", "FastTeleport", "1.1.0")] public class FastTeleportMod : BaseUnityPlugin { [HarmonyPatch(typeof(Player), "TeleportTo")] private class PlayerTeleportTo { public static void Postfix(ref float ___m_teleportTimer, ref bool ___m_distantTeleport) { if (modEnabled.Value) { ___m_teleportTimer = timerStartTime; logger.Log((LogLevel)16, (object)("Set teleport timer to " + timerStartTime)); } } } [HarmonyPatch(typeof(Hud), "Awake")] private class HudAwake { public static void Postfix(ref Hud __instance) { ShowSleepingProgressInstead_SettingChanged(null, null); } } private readonly Harmony harmony = new Harmony("GemHunter1.FastTeleport"); public static ManualLogSource logger; private static float timerStartTime = 8f; private static ConfigEntry<bool> modEnabled; private static ConfigEntry<bool> hideTeleportSwirl; private static ConfigEntry<bool> doNotBlackOut; private void Awake() { logger = ((BaseUnityPlugin)this).Logger; harmony.PatchAll(); modEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "_ModEnabled", true, "Mod is enabled"); doNotBlackOut = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "DoNotBlackOutCamera", false, "Turns off blacking out the camera when teleporting"); hideTeleportSwirl = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "HideTeleportSwirl", false, "Changes the Saurons Butthole to small loading indicator"); hideTeleportSwirl.SettingChanged += ShowSleepingProgressInstead_SettingChanged; } private static void ShowSleepingProgressInstead_SettingChanged(object sender, EventArgs e) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)Hud.instance)) { return; } foreach (Transform item in Hud.instance.m_teleportingProgress.transform) { Transform val = item; if (((Object)val).name == "loading") { ((Component)val).gameObject.SetActive(hideTeleportSwirl.Value); } else if (((Object)val).name == "Swirl") { ((Component)val).gameObject.SetActive(!hideTeleportSwirl.Value); } } } private void OnDestroy() { harmony.UnpatchSelf(); } private void LateUpdate() { if (Object.op_Implicit((Object)(object)Player.m_localPlayer) && Object.op_Implicit((Object)(object)Hud.instance) && ((Character)Player.m_localPlayer).IsTeleporting()) { Hud.instance.m_loadingScreen.alpha = ((!doNotBlackOut.Value) ? 1 : 0); } } }