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 TeleportEverything v3.0.11
TeleportEverything.dll
Decompiled 2 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Concurrent; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.IO; using System.Linq; using System.Linq.Expressions; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Serialization; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using System.Threading; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using HarmonyLib; using JetBrains.Annotations; using LocalizationManager; using Microsoft.CodeAnalysis; using Odinplus.Shared.ConfigurationUi; using Odinplus.Shared.Input; using Odinplus.Shared.Unity; using Odinplus.Shared.YamlEditor; using TMPro; using TeleportEverything.ConfigurationUi; using TeleportEverything.Patches; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.SceneManagement; using UnityEngine.UI; using YamlDotNet.Core; using YamlDotNet.Core.Events; using YamlDotNet.Core.ObjectPool; using YamlDotNet.Core.Tokens; using YamlDotNet.Helpers; using YamlDotNet.RepresentationModel; using YamlDotNet.Serialization; using YamlDotNet.Serialization.BufferedDeserialization; using YamlDotNet.Serialization.BufferedDeserialization.TypeDiscriminators; using YamlDotNet.Serialization.Callbacks; using YamlDotNet.Serialization.Converters; using YamlDotNet.Serialization.EventEmitters; using YamlDotNet.Serialization.NamingConventions; using YamlDotNet.Serialization.NodeDeserializers; using YamlDotNet.Serialization.NodeTypeResolvers; using YamlDotNet.Serialization.ObjectFactories; using YamlDotNet.Serialization.ObjectGraphTraversalStrategies; using YamlDotNet.Serialization.ObjectGraphVisitors; using YamlDotNet.Serialization.Schemas; using YamlDotNet.Serialization.TypeInspectors; using YamlDotNet.Serialization.TypeResolvers; using YamlDotNet.Serialization.Utilities; using YamlDotNet.Serialization.ValueDeserializers; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("TeleportEverything")] [assembly: AssemblyDescription("https://valheim.hexium.gg/mods/OdinPlus/TeleportEverything")] [assembly: AssemblyCompany("odinplus")] [assembly: AssemblyProduct("TeleportEverything")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyFileVersion("3.0.11")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("3.0.11.0")] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace TeleportEverything { [BepInPlugin("odinplus.TeleportEverything", "TeleportEverything", "3.0.11")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public sealed class TeleportEverythingPlugin : BaseUnityPlugin { private static TeleportEverythingPlugin? _instance; internal const string Author = "odinplus"; internal const string ModGuid = "odinplus.TeleportEverything"; internal const string ModName = "TeleportEverything"; internal const string ModVersion = "3.0.11"; private ConfigEntry<bool> _enableMod; private bool _wasEnabled; private ConfigEntry<KeyboardShortcut> _openUi; private ConfigEntry<float> _uiScale; private ConfigEntry<bool> _showWelcome; private ConfigurationPanel? _panel; private bool _inputPatched; private bool _uiDisabled; private readonly Harmony _harmony = new Harmony("odinplus.TeleportEverything"); private readonly Harmony _portalActivationHarmony = new Harmony("odinplus.TeleportEverything.PortalActivation"); private readonly Harmony _portalHoverHarmony = new Harmony("odinplus.TeleportEverything.PortalHover"); private readonly Harmony _dungeonHoverHarmony = new Harmony("odinplus.TeleportEverything.DungeonHover"); private readonly Harmony _portalSoundHarmony = new Harmony("odinplus.TeleportEverything.PortalSound"); private readonly HashSet<string> _portalErrors = new HashSet<string>(); private Coroutine? _configSave; public bool IsConfigurationUiOpen => ConfigurationPanel.IsOpen; internal static bool IsEnabled { get { TeleportEverythingPlugin? instance = _instance; if (instance == null) { return false; } return instance._enableMod?.Value == true; } } internal static ConfigEntry<float> PortalTargetDetectionRadius { get; private set; } internal static ConfigEntry<float> PortalSoundVolume { get; private set; } internal static ConfigEntry<float> PortalInteractionDistanceBonus { get; private set; } internal static ConfigEntry<float> DungeonInteractionDistanceBonus { get; private set; } private void Awake() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Expected O, but got Unknown //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Expected O, but got Unknown //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Expected O, but got Unknown //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Expected O, but got Unknown //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Expected O, but got Unknown //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Expected O, but got Unknown _instance = this; _enableMod = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enable Mod", true, new ConfigDescription("Enables the TeleportEverything configuration panel and its local portal and dungeon adjustments on this client. Turning this off does not disable TeleportCreatures, TeleportCarts, TeleportBoats, QuickTeleport, or other installed modules; those modules have their own enable controls.", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Order = int.MaxValue } })); _wasEnabled = IsEnabled; _openUi = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("UI", "Open Configuration Hotkey", new KeyboardShortcut((KeyCode)273, (KeyCode[])(object)new KeyCode[1] { (KeyCode)304 }), "Opens the configuration panel with this hotkey. This setting applies to this client only."); _uiScale = ((BaseUnityPlugin)this).Config.Bind<float>("UI", "Panel Scale", 0.8f, new ConfigDescription("Changes the panel size on this client only. Allowed range: 0.7 to 1.1.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.7f, 1.1f), Array.Empty<object>())); _showWelcome = ((BaseUnityPlugin)this).Config.Bind<bool>("UI", "Show Welcome Message", true, "Shows the welcome message once per world session. Opening settings with the configured hotkey from the welcome also disables future welcome messages. This setting applies to this client only."); PortalTargetDetectionRadius = ((BaseUnityPlugin)this).Config.Bind<float>("Portal", "Portal Activation Distance", 5f, new ConfigDescription("Sets how far from the portal you can be to activate its target-found signal. Default: 5 m. Range: 0 to 10 m. Applies on this client only.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>())); PortalSoundVolume = ((BaseUnityPlugin)this).Config.Bind<float>("Portal", "Sound Volume", 1f, new ConfigDescription("Local portal sound volume relative to Valheim's original per-effect volume. 100 percent is the game default; applies on this client only.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); PortalInteractionDistanceBonus = ((BaseUnityPlugin)this).Config.Bind<float>("Portal", "Increase interaction hover distance by", 0f, new ConfigDescription("Adds the selected amount, up to 2 m, to Valheim's normal portal interaction reach. Applies on this client only.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 2f), Array.Empty<object>())); DungeonInteractionDistanceBonus = ((BaseUnityPlugin)this).Config.Bind<float>("Dungeon", "Increase interaction hover distance by", 0f, new ConfigDescription("Adds the selected amount, up to 2 m, to Valheim's normal dungeon entrance interaction reach. Applies on this client only.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 2f), Array.Empty<object>())); TryPortalPatch("activation range", _portalActivationHarmony, typeof(PortalActivationPatches)); TryPortalPatch("portal interaction reach", _portalHoverHarmony, typeof(PortalHoverPatches)); TryPortalPatch("dungeon interaction reach", _dungeonHoverHarmony, typeof(TeleportPatches)); TryPortalPatch("portal sound volume", _portalSoundHarmony, typeof(PortalSoundPatches)); ((BaseUnityPlugin)this).Config.Bind<string>("UI", "Open Configuration", string.Empty, new ConfigDescription("Opens the panel when you are in a loaded game world. Unavailable on dedicated servers.", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { CustomDrawer = delegate { bool enabled = GUI.enabled; GUI.enabled = enabled && IsEnabled && !_uiDisabled && (Object)(object)Player.m_localPlayer != (Object)null && (Object)(object)ZNet.instance != (Object)null && !ZNet.instance.IsDedicated(); if (GUILayout.Button(UiText.Get("Open TeleportEverything Configuration"), Array.Empty<GUILayoutOption>())) { OpenPanel(); } GUI.enabled = enabled; } } })); Localizer.Load(); } private void Update() { //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) if (_wasEnabled != IsEnabled) { _wasEnabled = IsEnabled; if (!_wasEnabled) { try { _panel?.Dispose(); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Could not fully close TeleportEverything after disabling it. " + ex)); _panel?.Abort(); } try { PortalActivationPatches.RestoreAll(); } catch (Exception ex2) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Could not restore portal activation distances after disabling TeleportEverything. " + ex2)); } } } if (_uiDisabled) { return; } if (!IsEnabled) { try { _panel?.Tick(); return; } catch (Exception error) { DisableUi(error); return; } } try { if ((Object)(object)ZNet.instance != (Object)null && ZNet.instance.IsDedicated()) { return; } if ((Object)(object)ZNet.instance == (Object)null) { _panel?.Tick(); ConfigurationPanel? panel = _panel; if (panel != null && panel.IsFaulted) { DisableUi(); } return; } EnsureClientUi(); bool isCapturingHotkey = _panel.IsCapturingHotkey; _panel.Tick(); if (_panel.IsFaulted) { DisableUi(); } else { if (_panel.TryShowWelcome(_showWelcome.Value)) { return; } if (!isCapturingHotkey && !ConfigurationPanel.IsTyping) { KeyboardShortcut value = _openUi.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { if (_panel.IsWelcomeView) { _panel.OpenSettings(learnedShortcut: true); } else { _panel.Toggle(); } } } if (_panel.IsFaulted) { DisableUi(); } } } catch (Exception error2) { DisableUi(error2); } } private void EnsureClientUi() { if (!_inputPatched) { _harmony.PatchAll(typeof(ZInputPatches)); _harmony.PatchAll(typeof(ZInputButtonDownPatches)); _harmony.PatchAll(typeof(PlayerControllerPatches)); _harmony.PatchAll(typeof(MenuPatches)); _harmony.PatchAll(typeof(GameCameraPatches)); _harmony.PatchAll(typeof(CharacterPatches)); _inputPatched = true; } if (_panel != null) { return; } _panel = new ConfigurationPanel(_uiScale, delegate(string message) { ((BaseUnityPlugin)this).Logger.LogWarning((object)message); }, () => ShortcutHoverText.Format(_openUi.Value, (string text) => (Localization.instance != null) ? Localization.instance.Localize(text) : text), delegate { _showWelcome.Value = false; ((BaseUnityPlugin)this).Config.Save(); }, new ConfigEntry<float>[4] { PortalTargetDetectionRadius, PortalSoundVolume, PortalInteractionDistanceBonus, DungeonInteractionDistanceBonus }, SetLocalSetting); } private void OpenPanel() { if (!IsEnabled || _uiDisabled || (Object)(object)ZNet.instance == (Object)null || ZNet.instance.IsDedicated() || (Object)(object)Player.m_localPlayer == (Object)null) { return; } try { EnsureClientUi(); _panel.OpenSettings(); if (_panel.IsFaulted) { DisableUi(); } } catch (Exception error) { DisableUi(error); } } private void LateUpdate() { if (!IsEnabled || _uiDisabled) { return; } try { ConfigurationPanel.Capture(); } catch (Exception error) { DisableUi(error); } } private void DisableUi(Exception? error = null) { if (!_uiDisabled) { _uiDisabled = true; if (error != null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Configuration UI failed and was disabled for this session; teleport modules remain independent. " + error)); } try { _panel?.Abort(); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Configuration UI cleanup failed; input guards are disabled. " + ex)); } try { _harmony.UnpatchSelf(); } catch (Exception ex2) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Configuration UI input hooks could not be removed; panel input is disabled. " + ex2)); } _inputPatched = false; } } private void OnDestroy() { if (_configSave != null) { ((MonoBehaviour)this).StopCoroutine(_configSave); } ((BaseUnityPlugin)this).Config.Save(); try { _panel?.Dispose(); } catch { _panel?.Abort(); } finally { try { PortalActivationPatches.RestoreAll(); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Could not restore portal activation distances during unload. " + ex)); } _harmony.UnpatchSelf(); _portalActivationHarmony.UnpatchSelf(); _portalHoverHarmony.UnpatchSelf(); _dungeonHoverHarmony.UnpatchSelf(); _portalSoundHarmony.UnpatchSelf(); } } private void SetLocalSetting(ConfigEntry<float> setting, float value) { bool saveOnConfigSet = ((BaseUnityPlugin)this).Config.SaveOnConfigSet; ((BaseUnityPlugin)this).Config.SaveOnConfigSet = false; try { setting.Value = value; } finally { ((BaseUnityPlugin)this).Config.SaveOnConfigSet = saveOnConfigSet; } if (_configSave != null) { ((MonoBehaviour)this).StopCoroutine(_configSave); } _configSave = ((MonoBehaviour)this).StartCoroutine(SaveConfigAfterEdit()); } private IEnumerator SaveConfigAfterEdit() { yield return (object)new WaitForSecondsRealtime(0.5f); ((BaseUnityPlugin)this).Config.Save(); _configSave = null; } private bool TryPortalPatch(string setting, Harmony harmony, Type patchType) { try { harmony.PatchAll(patchType); return true; } catch (Exception error) { SafeUnpatch(harmony); LogPortalError(setting, error); return false; } } internal static void LogPortalFailure(string setting, Exception error) { _instance?.DisablePortalSetting(setting, error); } private void DisablePortalSetting(string setting, Exception error) { if (_portalErrors.Add(setting)) { switch (setting) { case "activation range": SafeUnpatch(_portalActivationHarmony); break; case "portal interaction reach": SafeUnpatch(_portalHoverHarmony); break; case "dungeon interaction reach": SafeUnpatch(_dungeonHoverHarmony); break; case "portal sound volume": SafeUnpatch(_portalSoundHarmony); break; } ((BaseUnityPlugin)this).Logger.LogError((object)$"Portal setting patch '{setting}' was disabled after an error; the configuration UI remains available. {error}"); } } private void LogPortalError(string setting, Exception error) { if (_portalErrors.Add(setting)) { ((BaseUnityPlugin)this).Logger.LogError((object)$"Portal setting patch '{setting}' could not be installed; the configuration UI remains available. {error}"); } } private void SafeUnpatch(Harmony harmony) { try { harmony.UnpatchSelf(); } catch (Exception arg) { ((BaseUnityPlugin)this).Logger.LogError((object)$"Could not remove a failed portal setting patch. {arg}"); } } private void Start() { FindIncompatibleMods(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"TeleportEverything 3.0.11 loaded."); } private void FindIncompatibleMods() { string[] array = new string[2] { "com.kpro.TeleportEverything", "zenox.teleporteverything" }; foreach (string text in array) { if (Chainloader.PluginInfos.TryGetValue(text, out var value)) { ((BaseUnityPlugin)this).Logger.LogWarning((object)($"Incompatible mod detected: {value.Metadata.Name} ({value.Metadata.Version}, GUID: {text}).\n" + "This mod can conflict with the TeleportEverything suite (TeleportEverything, TeleportCreatures, TeleportCarts...).\nTo avoid issues, please either:\n- Uninstall the detected mod, or\n- Disable the conflicting features in one of the mods.")); } } } } } namespace TeleportEverything.Patches { [HarmonyPatch(typeof(Character), "TakeInput")] internal static class CharacterPatches { [HarmonyPostfix] private static void Postfix(Character __instance, ref bool __result) { if (TeleportEverythingPlugin.IsEnabled && ConfigurationPanel.IsOpen && (Object)(object)__instance == (Object)(object)Player.m_localPlayer) { __result = false; } } } [HarmonyPatch(typeof(GameCamera), "UpdateMouseCapture")] internal static class GameCameraPatches { [HarmonyPrefix] private static bool Prefix() { if (!TeleportEverythingPlugin.IsEnabled || !ConfigurationPanel.IsOpen) { return true; } ConfigurationPanel.Capture(); return false; } } [HarmonyPatch(typeof(Menu), "Show")] internal static class MenuPatches { [HarmonyPrefix] private static bool Prefix() { if (TeleportEverythingPlugin.IsEnabled) { return !ConfigurationPanel.BlocksPauseMenu; } return true; } } [HarmonyPatch(typeof(PlayerController), "TakeInput", new Type[] { typeof(bool) })] internal static class PlayerControllerPatches { [HarmonyPostfix] private static void Postfix(PlayerController __instance, ref bool __result) { if (TeleportEverythingPlugin.IsEnabled && ConfigurationPanel.IsOpen && (Object)(object)Player.m_localPlayer != (Object)null && (Object)(object)((Component)__instance).gameObject == (Object)(object)((Component)Player.m_localPlayer).gameObject) { __result = false; } } } [HarmonyPatch] internal static class PortalActivationPatches { private sealed class ChangedPortal { internal readonly float OriginalRange; internal float AppliedRange; internal ChangedPortal(float originalRange, float appliedRange) { OriginalRange = originalRange; AppliedRange = appliedRange; } } private static readonly ConditionalWeakTable<TeleportWorld, ChangedPortal> OriginalRanges = new ConditionalWeakTable<TeleportWorld, ChangedPortal>(); private static readonly List<WeakReference<TeleportWorld>> ChangedPortals = new List<WeakReference<TeleportWorld>>(); internal static void RestoreAll() { foreach (WeakReference<TeleportWorld> changedPortal in ChangedPortals) { if (changedPortal.TryGetTarget(out var target) && !((Object)(object)target == (Object)null)) { if (OriginalRanges.TryGetValue(target, out ChangedPortal value) && Mathf.Approximately(target.m_activationRange, value.AppliedRange)) { target.m_activationRange = value.OriginalRange; } OriginalRanges.Remove(target); } } ChangedPortals.Clear(); } [HarmonyPostfix] [HarmonyPatch(typeof(TeleportWorld), "Awake")] private static void AwakePostfix(TeleportWorld __instance) { Apply(__instance); } [HarmonyPrefix] [HarmonyPriority(0)] [HarmonyPatch(typeof(TeleportWorld), "UpdatePortal")] private static void UpdatePortalPrefix(TeleportWorld __instance) { Apply(__instance); } private static void Apply(TeleportWorld portal) { try { if (!TeleportEverythingPlugin.IsEnabled || (Object)(object)ZNet.instance == (Object)null || ZNet.instance.IsDedicated() || (Object)(object)Player.m_localPlayer == (Object)null) { return; } float value = TeleportEverythingPlugin.PortalTargetDetectionRadius.Value; if (Mathf.Approximately(portal.m_activationRange, value)) { return; } if (!OriginalRanges.TryGetValue(portal, out ChangedPortal value2)) { ChangedPortals.RemoveAll((WeakReference<TeleportWorld> reference) => !reference.TryGetTarget(out TeleportWorld target) || (Object)(object)target == (Object)null); value2 = new ChangedPortal(portal.m_activationRange, value); OriginalRanges.Add(portal, value2); ChangedPortals.Add(new WeakReference<TeleportWorld>(portal)); } else { value2.AppliedRange = value; } portal.m_activationRange = value; } catch (Exception error) { TeleportEverythingPlugin.LogPortalFailure("activation range", error); } } } [HarmonyPatch(typeof(TeleportWorld), "GetHoverOffset")] internal static class PortalHoverPatches { [HarmonyPostfix] private static void GetHoverOffsetPostfix(ref float __result) { try { if (TeleportEverythingPlugin.IsEnabled && !((Object)(object)ZNet.instance == (Object)null) && !ZNet.instance.IsDedicated() && !((Object)(object)Player.m_localPlayer == (Object)null)) { __result += TeleportEverythingPlugin.PortalInteractionDistanceBonus.Value; } } catch (Exception error) { TeleportEverythingPlugin.LogPortalFailure("portal interaction reach", error); } } } [HarmonyPatch] internal static class PortalSoundPatches { private sealed class OriginalVolume { internal float Value { get; } internal OriginalVolume(float value) { Value = value; } } private static readonly ConditionalWeakTable<EffectFade, OriginalVolume> OriginalVolumes = new ConditionalWeakTable<EffectFade, OriginalVolume>(); [HarmonyPostfix] [HarmonyPatch(typeof(EffectFade), "Awake")] private static void AwakePostfix(EffectFade __instance, float ___m_baseVolume) { try { if (IsPortalEffect(__instance)) { OriginalVolumes.Remove(__instance); OriginalVolumes.Add(__instance, new OriginalVolume(___m_baseVolume)); } } catch (Exception error) { TeleportEverythingPlugin.LogPortalFailure("portal sound volume", error); } } [HarmonyPostfix] [HarmonyPriority(0)] [HarmonyPatch(typeof(EffectFade), "Update")] private static void UpdatePostfix(EffectFade __instance, AudioSource ___m_audioSource, ref float ___m_intensity) { try { if (!TeleportEverythingPlugin.IsEnabled || (Object)(object)ZNet.instance == (Object)null || ZNet.instance.IsDedicated() || (Object)(object)Player.m_localPlayer == (Object)null || !IsPortalEffect(__instance) || (Object)(object)___m_audioSource == (Object)null) { return; } if (!OriginalVolumes.TryGetValue(__instance, out OriginalVolume value)) { TeleportEverythingPlugin.LogPortalFailure("portal sound volume", new InvalidOperationException("The original portal sound volume was not captured during EffectFade.Awake.")); return; } float num = Mathf.Clamp01(TeleportEverythingPlugin.PortalSoundVolume.Value); float num2 = value.Value * num * Mathf.Clamp01(___m_intensity); if (!Mathf.Approximately(___m_audioSource.volume, num2)) { ___m_audioSource.volume = num2; } } catch (Exception error) { TeleportEverythingPlugin.LogPortalFailure("portal sound volume", error); } } private static bool IsPortalEffect(EffectFade effect) { if ((Object)(object)effect != (Object)null) { return ((Object)effect).name.StartsWith("_target_found_red", StringComparison.Ordinal); } return false; } } [HarmonyPatch(typeof(Teleport), "GetHoverOffset")] internal static class TeleportPatches { [HarmonyPostfix] private static void GetHoverOffsetPostfix(ref float __result) { try { if (TeleportEverythingPlugin.IsEnabled && !((Object)(object)ZNet.instance == (Object)null) && !ZNet.instance.IsDedicated() && !((Object)(object)Player.m_localPlayer == (Object)null)) { __result += TeleportEverythingPlugin.DungeonInteractionDistanceBonus.Value; } } catch (Exception error) { TeleportEverythingPlugin.LogPortalFailure("dungeon interaction reach", error); } } } [HarmonyPatch(typeof(ZInput), "GetMouseScrollWheel")] internal static class ZInputPatches { [HarmonyPrefix] private static bool Prefix(ref float __result) { if (!TeleportEverythingPlugin.IsEnabled || !ConfigurationPanel.IsOpen) { return true; } __result = 0f; return false; } } [HarmonyPatch(typeof(ZInput), "GetButtonDown", new Type[] { typeof(string) })] internal static class ZInputButtonDownPatches { [HarmonyPrefix] private static bool Prefix(ref bool __result) { if (!TeleportEverythingPlugin.IsEnabled || !ConfigurationPanel.IsCapturingShortcut) { return true; } __result = false; return false; } } } namespace TeleportEverything.ConfigurationUi { internal static class ClosedPanelWorkState { internal static bool NeedsTick(bool savePending, bool wasPending, int pendingReads, int delayedRefreshes, bool comparing) { return savePending || wasPending || pendingReads != 0 || delayedRefreshes != 0 || comparing; } } internal sealed class ConfigurationPanel : IDisposable { private sealed class Draft { public ModuleEndpoint Module = new ModuleEndpoint(); public string Scope = "Player"; public string Revision = ""; public string Error = ""; public bool Loaded; public bool Poll; public ModuleConfigurationView View = new ModuleConfigurationView(); public ModuleConfigurationCandidate Baseline = new ModuleConfigurationCandidate(); public ModuleConfigurationCandidate Candidate = new ModuleConfigurationCandidate(); public UiConfigRequest? Request; public DateTime Deadline; public DateTime NextPoll; public bool CompareRead; public bool PreserveDraftOnRead; public bool ReopenRead; public bool ExternalCompareRead; public ModuleConfigurationView? Compared; public ModuleConfigurationView? ExternalView; public string ComparedRevision = ""; public DraftOwnerReadResult<ModuleConfigurationCandidate>? OwnerRead; public bool Dirty { get { if (Loaded) { return ModuleConfigProtocolV1.SerializePayload(Candidate) != ModuleConfigProtocolV1.SerializePayload(Baseline); } return false; } } } private static bool _captureActive; private static int _captureSuppressThroughFrame = -1; private static int _closedFrame = -1; private const float PageScrollHeight = 483f; private static readonly string[] ModuleTabs = new string[7] { "Overview", "Creatures", "Carts", "Boats", "Items", "Portal", "QuickTeleport" }; private const string Support = "TeleportEverything and every mod in this pack are completely free.\nIf you’d like to support maintenance and speed up development, you can leave an optional tip on Ko-fi."; private readonly Dictionary<string, ModuleEndpoint> _modules; private readonly Dictionary<string, Draft> _drafts = new Dictionary<string, Draft>(); private readonly HashSet<Draft> _refreshReads = new HashSet<Draft>(); private readonly Dictionary<string, TMP_Text> _tabLabels = new Dictionary<string, TMP_Text>(); private Button? _saveModuleButton; private Button? _saveAllButton; private TMP_Text? _saveAllLabel; private bool _indicatorsDirty; private bool _focusOnLayoutRefresh; private int _layoutFrame = -1; private SaveCoordinator _save; private bool _comparing; private readonly Dictionary<string, ModuleConfigurationCandidate> _saving = new Dictionary<string, ModuleConfigurationCandidate>(); private readonly Dictionary<string, DateTime> _pendingPlayerRefresh = new Dictionary<string, DateTime>(); private string _savingScope = ""; private readonly ConfigEntry<float> _scale; private readonly Action<string> _log; private readonly Func<string> _welcomeHotkey; private readonly Action _hideWelcome; private readonly ConfigEntry<float>[] _portalSettings; private readonly Action<ConfigEntry<float>, float> _setLocalSetting; private GameObject? _canvas; private GameObject? _modal; private RectTransform? _window; private RectTransform? _body; private RectTransform? _content; private TMP_FontAsset? _font; private NativeUiTheme _theme; private TMP_Text? _status; private CanvasGroup? _bodyGroup; private CanvasGroup? _windowGroup; private bool _focusModal; private Action? _cancelModal; private string _tab = "Overview"; private string _scope = "Player"; private string _creaturePage = "Allies"; private string _message = ""; private const string RefreshingSavedSettings = "Refreshing saved settings…"; private bool _redraw; private bool _contentRedraw; private bool _wasPending; private bool _faulted; private bool _hasCursorState; private CursorLockMode _previousLock; private bool _previousVisible; private int _rows; private float _contentExtent; private ZNet? _session; private bool _welcomeDismissed; private bool _welcomeView; private bool _missingFontLogged; private bool _invalidFontLogged; private Draft? _capturingDraft; private ConfigurationDescriptor? _capturingRow; private int _captureStartFrame = -1; private KeyCode? _pendingModifier; public static bool IsOpen { get; private set; } public static bool IsTyping { get { if (!IsOpen) { return false; } EventSystem current = EventSystem.current; if ((Object)(object)current == (Object)null) { return false; } GameObject currentSelectedGameObject = current.currentSelectedGameObject; if ((Object)(object)currentSelectedGameObject == (Object)null) { return false; } TMP_InputField component = currentSelectedGameObject.GetComponent<TMP_InputField>(); if ((Object)(object)component != (Object)null) { return component.isFocused; } return false; } } public static bool BlocksPauseMenu { get { if (!IsOpen) { return _closedFrame == Time.frameCount; } return true; } } private bool Locked { get { if (!_save.IsPending) { return _save.RequiresReconciliation; } return true; } } internal bool IsCapturingHotkey => _capturingDraft != null; internal bool IsWelcomeView { get { if (IsOpen) { return _welcomeView; } return false; } } internal static bool IsCapturingShortcut { get { if (IsOpen) { if (!_captureActive) { return Time.frameCount == _captureSuppressThroughFrame; } return true; } return false; } } internal bool IsFaulted => _faulted; private string Key => _tab + "/" + _scope; private Draft? Current { get { if (!_drafts.TryGetValue(Key, out Draft value)) { return null; } return value; } } private static string? SelectedControlName() { EventSystem current = EventSystem.current; if ((Object)(object)current == (Object)null) { return null; } GameObject currentSelectedGameObject = current.currentSelectedGameObject; if (!((Object)(object)currentSelectedGameObject == (Object)null)) { return ((Object)currentSelectedGameObject).name; } return null; } public ConfigurationPanel(ConfigEntry<float> scale, Action<string> log, Func<string> welcomeHotkey, Action hideWelcome, ConfigEntry<float>[] portalSettings, Action<ConfigEntry<float>, float> setLocalSetting) { _scale = scale; _log = log; _welcomeHotkey = welcomeHotkey; _hideWelcome = hideWelcome; _portalSettings = portalSettings; _setLocalSetting = setLocalSetting; _modules = ModuleDiscovery.Discover(); _save = new SaveCoordinator(_modules.Values.Where((ModuleEndpoint m) => m.Exchange != null).ToDictionary((ModuleEndpoint m) => m.Guid, (ModuleEndpoint m) => m.Exchange)); } private static T Clone<T>(T obj) { return ModuleConfigProtocolV1.DeserializePayload<T>(ModuleConfigProtocolV1.SerializePayload(obj)); } public void Toggle() { if (IsOpen) { RequestClose(); } else { Open(); } } public bool TryShowWelcome(bool enabled) { Player localPlayer = Player.m_localPlayer; if (!enabled || _welcomeDismissed || IsOpen || _faulted || (Object)(object)localPlayer == (Object)null || ((Character)localPlayer).IsDead() || ((Character)localPlayer).IsTeleporting() || (Object)(object)ZNet.instance == (Object)null || ZNet.instance.IsDedicated() || (Object)(object)Hud.instance == (Object)null || Menu.IsVisible()) { return false; } if ((Object)(object)Hud.instance.m_loadingScreen == (Object)null || Hud.instance.m_loadingScreen.alpha > 0.001f || (Object)(object)Game.instance == (Object)null || Game.instance.InIntro(true)) { return false; } if (InventoryGui.IsVisible() || Minimap.IsOpen() || Console.IsVisible() || TextInput.IsVisible() || StoreGui.IsVisible() || ((Object)(object)Chat.instance != (Object)null && Chat.instance.IsChatDialogWindowVisible())) { return false; } OpenView(welcome: true); return IsOpen; } public void OpenSettings(bool learnedShortcut = false) { bool flag = _welcomeView && IsOpen; if (flag) { _welcomeDismissed = true; Close(); } Open(); if (IsOpen) { _welcomeDismissed = true; } if (learnedShortcut && flag && IsOpen) { _hideWelcome(); } } public void Open() { OpenView(welcome: false); } private void OpenView(bool welcome) { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Expected O, but got Unknown //IL_01e4: 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_024a: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Unknown result type (might be due to invalid IL or missing references) if (_faulted || IsOpen || (Object)(object)Player.m_localPlayer == (Object)null || (Object)(object)ZNet.instance == (Object)null || ZNet.instance.IsDedicated()) { return; } if ((Object)(object)_session != (Object)null && (Object)(object)_session != (Object)(object)ZNet.instance) { ObserveSession(ZNet.instance); } _session = ZNet.instance; _previousLock = ZCursor.LockState; _previousVisible = ZCursor.IsVisible; _hasCursorState = true; _theme = NativeUiTheme.Discover(); _font = _theme.Font; if ((Object)(object)_font == (Object)null) { _theme.Dispose(); _hasCursorState = false; if (!_missingFontLogged) { _log("Configuration UI font unavailable; wait until the world has loaded."); _missingFontLogged = true; } return; } _missingFontLogged = false; if (_theme.InvalidVikingFontFound && !_invalidFontLogged) { _log("Valheim Norse font asset has no usable atlas; using the validated game font."); _invalidFontLogged = true; } _canvas = new GameObject("TeleportEverything configuration", new Type[1] { typeof(RectTransform) }); _canvas.SetActive(false); _canvas.AddComponent<Canvas>(); _canvas.AddComponent<CanvasScaler>(); _canvas.AddComponent<GraphicRaycaster>(); Object.DontDestroyOnLoad((Object)(object)_canvas); Canvas component = _canvas.GetComponent<Canvas>(); component.renderMode = (RenderMode)0; component.sortingOrder = 30000; InventoryGui instance = InventoryGui.instance; object obj; if (instance == null) { obj = null; } else { Transform inventoryRoot = instance.m_inventoryRoot; obj = ((inventoryRoot != null) ? ((Component)inventoryRoot).GetComponentInParent<Canvas>() : null); } Canvas val = (Canvas)obj; if ((Object)(object)val != (Object)null) { component.sortingLayerID = val.sortingLayerID; } CanvasScaler component2 = _canvas.GetComponent<CanvasScaler>(); component2.uiScaleMode = (ScaleMode)1; component2.referenceResolution = new Vector2(1920f, 1080f); component2.matchWidthOrHeight = 0.5f; RectTransform val2 = Box(_canvas.transform, "Shade", new Color(0f, 0f, 0f, 0.42f)); Stretch(val2); _window = Box((Transform)(object)val2, "Window", new Color(0.15f, 0.13f, 0.1f, 0.98f)); RectTransform? window = _window; RectTransform? window2 = _window; Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(0.5f, 0.5f); window2.anchorMax = val3; window.anchorMin = val3; _window.pivot = new Vector2(0.5f, 0.5f); _window.sizeDelta = (welcome ? new Vector2(760f, 430f) : new Vector2(1180f, 860f)); ((Transform)_window).localScale = Vector3.one * _scale.Value; _theme.Panel(((Component)_window).GetComponent<Image>()); _windowGroup = ((Component)_window).gameObject.AddComponent<CanvasGroup>(); IsOpen = true; _welcomeView = welcome; _redraw = false; if (!welcome && !Locked) { foreach (Draft item in _drafts.Values.Where((Draft d) => d.Loaded && d.Request == null)) { item.ExternalView = null; item.ReopenRead = true; BeginRead(item, "Read"); } } Capture(); if (DrawSafely()) { _canvas.SetActive(true); _welcomeDismissed = true; } } public void Tick() { if ((Object)(object)_session != (Object)(object)ZNet.instance) { ObserveSession(ZNet.instance); } if (!IsOpen && !HasClosedWork()) { return; } Draft[] array = _drafts.Values.ToArray(); foreach (Draft draft in array) { if (draft.Request != null) { AdvanceRead(draft); } } if (_comparing && _drafts.Values.All((Draft d) => d.Request == null)) { _comparing = false; ShowComparison(); } _save.Tick(DateTime.UtcNow); foreach (ModuleApplyResult result in _save.CurrentResult.Modules.Where((ModuleApplyResult r) => r.Status == "Applied")) { if (_saving.TryGetValue(result.ModuleGuid, out ModuleConfigurationCandidate value)) { Draft draft2 = _drafts.Values.FirstOrDefault((Draft x) => x.Module.Guid == result.ModuleGuid && x.Scope == _savingScope); if (draft2 != null) { draft2.Baseline = Clone(value); draft2.Candidate = Clone(value); draft2.Revision = result.Revision; BeginRead(draft2, "Read"); } if (_savingScope == "Server") { _pendingPlayerRefresh[result.ModuleGuid] = DateTime.UtcNow.AddSeconds(1.0); } _saving.Remove(result.ModuleGuid); _redraw = true; } } KeyValuePair<string, DateTime>[] array2 = _pendingPlayerRefresh.ToArray(); for (int i = 0; i < array2.Length; i++) { KeyValuePair<string, DateTime> pending = array2[i]; if (!(DateTime.UtcNow < pending.Value)) { Draft draft3 = _drafts.Values.FirstOrDefault((Draft x) => x.Module.Guid == pending.Key && x.Scope == "Player"); if (draft3 == null) { _pendingPlayerRefresh.Remove(pending.Key); } else if (draft3.Request == null) { draft3.PreserveDraftOnRead = draft3.Dirty; BeginRead(draft3, "Read"); _pendingPlayerRefresh.Remove(pending.Key); } } } if (_wasPending && !_save.IsPending) { _message = UiText.Get(_save.CurrentResult.State.ToString()) + ": " + string.Join("; ", _save.CurrentResult.Modules.Select((ModuleApplyResult r) => UiText.Get(_modules.Values.First((ModuleEndpoint m) => m.Guid == r.ModuleGuid).Name) + " " + UiText.Get(r.Status.ToString()) + ((r.Message == "") ? "" : (" — " + UiText.Get(r.Message))))); _redraw = true; } _wasPending = _save.IsPending; if (!IsOpen) { return; } Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null || ((Character)localPlayer).IsDead() || ((Character)localPlayer).IsTeleporting()) { Close(); return; } if (Input.GetKeyDown((KeyCode)27)) { if (_capturingDraft != null) { CancelHotkeyCapture(); _message = "Hotkey capture cancelled."; _contentRedraw = true; } else if ((Object)(object)_modal != (Object)null) { Action? cancelModal = _cancelModal; CloseModal(); cancelModal?.Invoke(); } else { RequestClose(); } } if (!IsOpen) { return; } ProcessHotkeyCapture(); Capture(); if (_indicatorsDirty) { RefreshDirtyIndicators(); } if (_layoutFrame >= 0 && Time.frameCount > _layoutFrame) { RefreshGeometry(); } if (_focusModal && (Object)(object)_modal != (Object)null && (Object)(object)EventSystem.current != (Object)null) { _focusModal = false; Selectable val = ((IEnumerable<Selectable>)_modal.GetComponentsInChildren<Selectable>()).FirstOrDefault((Func<Selectable, bool>)((Selectable b) => b.interactable)); if ((Object)(object)val != (Object)null) { EventSystem.current.SetSelectedGameObject(((Component)val).gameObject); } } EventSystem current = EventSystem.current; GameObject val2 = ((current != null) ? current.currentSelectedGameObject : null); int num; if ((Object)(object)val2 != (Object)null) { TMP_InputField component = val2.GetComponent<TMP_InputField>(); num = (((component != null && component.isFocused) || ((Object)(object)val2.GetComponent<Slider>() != (Object)null && Input.GetMouseButton(0))) ? 1 : 0); } else { num = 0; } bool flag = (byte)num != 0; if ((Object)(object)_status != (Object)null) { _status.text = (_save.IsPending ? UiText.Format("Saving: {0}", UiText.Get(_save.CurrentResult.State.ToString())) : UiText.Get(_message)); } if (_redraw && !flag) { _redraw = false; _contentRedraw = false; DrawSafely(); } else if (_contentRedraw && !flag && (Object)(object)_modal == (Object)null) { _contentRedraw = false; RedrawPageSafely(); } } private bool HasClosedWork() { int num = 0; foreach (Draft value in _drafts.Values) { if (value.Request != null) { num++; } } return ClosedPanelWorkState.NeedsTick(_save.IsPending, _wasPending, num + _refreshReads.Count, _pendingPlayerRefresh.Count, _comparing); } private void ObserveSession(ZNet? session) { _refreshReads.Clear(); _pendingPlayerRefresh.Clear(); if (_message == "Refreshing saved settings…") { _message = ""; } _session = session; Close(); _welcomeDismissed = false; if (!Locked) { _drafts.Clear(); } else { _message = "Server connection changed. Reconcile or compare saved settings before retrying."; } } public static void Capture() { if (IsOpen) { ZCursor.LockState = (CursorLockMode)0; ZCursor.Show(); } } private void RequestClose() { CancelHotkeyCapture(); if (IsTyping) { EventSystem.current.SetSelectedGameObject((GameObject)null); } if (Locked) { _message = "Save is pending. The result will continue to be checked while the panel is closed."; Close(); } else if (_drafts.Values.Any((Draft d) => d.Dirty)) { RectTransform parent = Modal("Unsaved changes", 520f, 220f, 28f, 20f); Label((Transform)(object)parent, "You have unsaved changes. Keep them for later or discard them before closing.", 28f, 66f, 464f, 50f); Button((Transform)(object)parent, "Keep changes", 28f, 140f, 220f, delegate { Close(); }); Button((Transform)(object)parent, "Discard changes", 272f, 140f, 220f, delegate { foreach (Draft value in _drafts.Values) { value.Candidate = Clone(value.Baseline); } Close(); }); } else { Close(); } } private void Close() { //IL_0131: Unknown result type (might be due to invalid IL or missing references) if (!IsOpen) { return; } CancelHotkeyCapture(); _closedFrame = Time.frameCount; if ((Object)(object)_canvas != (Object)null) { RetireInputs(_canvas.transform); EventSystem current = EventSystem.current; GameObject val = ((current != null) ? current.currentSelectedGameObject : null); if ((Object)(object)val != (Object)null && val.transform.IsChildOf(_canvas.transform)) { EventSystem.current.SetSelectedGameObject((GameObject)null); } _canvas.SetActive(false); } IsOpen = false; CloseModal(); if ((Object)(object)_canvas != (Object)null) { Object.Destroy((Object)(object)_canvas); } _canvas = null; _window = (_body = (_content = null)); _status = null; _windowGroup = (_bodyGroup = null); _tabLabels.Clear(); _saveModuleButton = (_saveAllButton = null); _saveAllLabel = null; _layoutFrame = -1; _redraw = (_contentRedraw = false); _focusModal = false; _welcomeView = false; _theme.Dispose(); ZCursor.LockState = _previousLock; if (_previousVisible) { ZCursor.Show(); } else { ZCursor.Hide(); } _hasCursorState = false; } private static void RetireInputs(Transform root) { TMP_InputField[] componentsInChildren = ((Component)root).GetComponentsInChildren<TMP_InputField>(true); foreach (TMP_InputField obj in componentsInChildren) { ((UnityEventBase)obj.onEndEdit).RemoveAllListeners(); ((UnityEventBase)obj.onValueChanged).RemoveAllListeners(); } } private void RefreshGeometry() { _layoutFrame = -1; if (!IsOpen || (Object)(object)_canvas == (Object)null || (Object)(object)_window == (Object)null) { return; } Canvas.ForceUpdateCanvases(); LayoutRebuilder.ForceRebuildLayoutImmediate(_window); bool flag = false; TMP_Text[] componentsInChildren = _canvas.GetComponentsInChildren<TMP_Text>(true); foreach (TMP_Text val in componentsInChildren) { if (!NativeUiTheme.IsUsableFont(val.font)) { val.font = _font; flag = true; } if (NativeUiTheme.IsUsableFont(val.font)) { val.ForceMeshUpdate(false, false); } } TMP_InputField[] componentsInChildren2 = _canvas.GetComponentsInChildren<TMP_InputField>(true); foreach (TMP_InputField val2 in componentsInChildren2) { if (!NativeUiTheme.IsUsableFont(val2.fontAsset)) { val2.fontAsset = _font; flag = true; } if ((Object)(object)val2.textComponent != (Object)null && !NativeUiTheme.IsUsableFont(val2.textComponent.font)) { val2.textComponent.font = _font; flag = true; } if (NativeUiTheme.IsUsableFont(val2.fontAsset)) { val2.ForceLabelUpdate(); } } if (flag && !_invalidFontLogged) { _log("A panel font had no usable atlas; replaced it with the game font."); _invalidFontLogged = true; } Canvas.ForceUpdateCanvases(); if (_focusOnLayoutRefresh && (Object)(object)EventSystem.current != (Object)null && (Object)(object)EventSystem.current.currentSelectedGameObject == (Object)null) { Selectable val3 = ((IEnumerable<Selectable>)((GameObject)(((Object)(object)_modal != (Object)null) ? ((object)_modal) : ((object)((Component)_window).gameObject))).GetComponentsInChildren<Selectable>()).FirstOrDefault((Func<Selectable, bool>)((Selectable b) => b.IsInteractable() && (_welcomeView || ((Object)((Component)b).gameObject).name == _scope + " Settings"))); if ((Object)(object)val3 != (Object)null) { EventSystem.current.SetSelectedGameObject(((Component)val3).gameObject); } } _focusOnLayoutRefresh = false; } private void RefreshDirtyIndicators() { _indicatorsDirty = false; foreach (KeyValuePair<string, TMP_Text> tabLabel in _tabLabels) { if ((Object)(object)tabLabel.Value != (Object)null) { tabLabel.Value.text = UiText.Get(tabLabel.Key) + ((_drafts.TryGetValue(tabLabel.Key + "/" + _scope, out Draft value) && value.Dirty) ? " *" : ""); } } } public void Dispose() { Close(); } public void Abort() { //IL_0149: Unknown result type (might be due to invalid IL or missing references) _faulted = true; IsOpen = false; _closedFrame = -1; CancelHotkeyCapture(); if ((Object)(object)_canvas != (Object)null) { try { RetireInputs(_canvas.transform); EventSystem current = EventSystem.current; GameObject val = (((Object)(object)current != (Object)null) ? current.currentSelectedGameObject : null); if ((Object)(object)val != (Object)null && val.transform.IsChildOf(_canvas.transform)) { current.SetSelectedGameObject((GameObject)null); } } catch { } try { _canvas.SetActive(false); } catch { } try { Object.Destroy((Object)(object)_canvas); } catch { } } _canvas = null; _window = (_body = (_content = null)); _modal = null; _cancelModal = null; _focusModal = false; _status = null; _windowGroup = (_bodyGroup = null); _saveModuleButton = (_saveAllButton = null); _saveAllLabel = null; _tabLabels.Clear(); _layoutFrame = -1; _redraw = (_contentRedraw = false); try { _theme?.Dispose(); } catch { } try { if (_hasCursorState) { ZCursor.LockState = _previousLock; if (_previousVisible) { ZCursor.Show(); } else { ZCursor.Hide(); } } } catch { } _hasCursorState = false; } private bool DrawSafely() { try { Draw(); return true; } catch (Exception ex) { Abort(); _log("Configuration UI failed and was disabled for this session; input released. " + ex); return false; } } private void Draw() { //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Expected O, but got Unknown //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_040b: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_079b: Unknown result type (might be due to invalid IL or missing references) //IL_07f7: Unknown result type (might be due to invalid IL or missing references) //IL_083b: Unknown result type (might be due to invalid IL or missing references) //IL_085d: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Expected O, but got Unknown //IL_03cf: Unknown result type (might be due to invalid IL or missing references) if (!IsOpen || (Object)(object)_window == (Object)null) { return; } if (_welcomeView) { DrawWelcome(); return; } bool focusOnLayoutRefresh = (Object)(object)_canvas != (Object)null && !_canvas.activeSelf; _theme.ScopePanel(((Component)_window).GetComponent<Image>(), _scope == "Server"); string focused = SelectedControlName(); float scrollPosition = (((Object)(object)_content != (Object)null) ? _content.anchoredPosition.y : 0f); foreach (Transform item in (Transform)_window) { RetireInputs(item); ((Component)item).gameObject.SetActive(false); Object.Destroy((Object)(object)((Component)item).gameObject); } _tabLabels.Clear(); HeaderTitle(); Button((Transform)(object)_window, "Close", 1050f, 20f, 105f, RequestClose); Button val2 = Button((Transform)(object)_window, "", 984f, 20f, 52f, Refresh, _tab != "Portal" && !Locked && Current?.Request == null); ((Object)((Component)val2).gameObject).name = "Refresh"; if (_tab == "Portal") { ((Component)val2).gameObject.SetActive(false); } RefreshIcon(((Component)val2).transform); if (_tab != "Portal") { ScopeTab("Player", "My Settings", 24f); ScopeTab("Server", "Server Settings", 188f); } string[] moduleTabs = ModuleTabs; float w = ((moduleTabs.Length > 6) ? 156 : 178); float num = ((moduleTabs.Length > 6) ? 162 : 187); for (int i = 0; i < moduleTabs.Length; i++) { string tab = moduleTabs[i]; Button val3 = Button((Transform)(object)_window, tab, 24f + (float)i * num, 120f, w, delegate { CancelHotkeyCapture(); _tab = tab; if (tab == "Portal") { _scope = "Player"; } _redraw = true; }, !Locked || tab == "Portal", tab == _tab); Place((RectTransform)((Component)val3).transform, 24f + (float)i * num, (tab == _tab) ? 119 : 125, w, (tab == _tab) ? 54 : 42); ((Object)((Component)val3).gameObject).name = tab; _tabLabels[tab] = ((Component)val3).GetComponentInChildren<TMP_Text>(true); _theme.StyleModuleTab(val3, tab == _tab); if (ModuleHasIssue(tab)) { TMP_Text obj = Label(((Component)val3).transform, "!", 154f, 4f, 18f, 30f, 22f); obj.alignment = (TextAlignmentOptions)514; obj.fontStyle = (FontStyles)1; ((Graphic)obj).color = new Color(1f, 0.78f, 0.22f); } } _body = Box((Transform)(object)_window, "Body", new Color(0f, 0f, 0f, 0.22f)); Place(_body, 24f, 172f, 1132f, 581f); _theme.ScopeSurface(((Component)_body).GetComponent<Image>(), _scope == "Server"); _bodyGroup = ((Component)_body).gameObject.AddComponent<CanvasGroup>(); _bodyGroup.interactable = _tab == "Portal" || !Locked; PageHeader(); _content = Scroll((Transform)(object)_body, 0f, 98f, 1132f, 483f); DrawPageContents(scrollPosition); int num2 = _drafts.Values.Count((Draft d) => d.Scope == _scope && d.Dirty); int num3; if (!Locked) { Draft? current = Current; if (current != null && current.Dirty && Current.View.CanEdit && Current.Request == null) { num3 = ((!BlocksSave(Current)) ? 1 : 0); goto IL_053b; } } num3 = 0; goto IL_053b; IL_053b: bool enabled = (byte)num3 != 0; _saveModuleButton = (_saveAllButton = null); _saveAllLabel = null; if (!(_tab == "Portal")) { if (_save.RequiresReconciliation) { Button((Transform)(object)_window, "Check save status", 220f, 760f, 740f, Reconcile, !_save.IsPending); } else if (_tab == "Overview") { _saveAllButton = Button((Transform)(object)_window, UiText.Get("Save all drafts") + " (" + num2 + ")", 450f, 760f, 280f, delegate { Save(all: true); }, !Locked && num2 > 0 && !_drafts.Values.Any((Draft d) => d.Scope == _scope && d.Dirty && BlocksSave(d))); _saveAllLabel = ((Component)_saveAllButton).GetComponentInChildren<TMP_Text>(true); AddActionTip(_saveAllButton, "Save All", "Overview save all help", 432f); } else { _saveModuleButton = Button((Transform)(object)_window, "Save module", 399f, 760f, 170f, delegate { Save(all: false); }, enabled); AddActionTip(_saveModuleButton, "Save module", "Module save tooltip", 360f); _saveAllButton = Button((Transform)(object)_window, UiText.Get("Save All") + " (" + num2 + ")", 581f, 760f, 200f, delegate { Save(all: true); }, !Locked && num2 > 0 && !_drafts.Values.Any((Draft d) => d.Scope == _scope && d.Dirty && BlocksSave(d))); _saveAllLabel = ((Component)_saveAllButton).GetComponentInChildren<TMP_Text>(true); AddActionTip(_saveAllButton, "Save All", "Overview save all help", 432f); } } RectTransform val4 = Box((Transform)(object)_window, "Refresh tip", new Color(0.015f, 0.015f, 0.015f, 0.91f)); Place(val4, 834f, 67f, 320f, 80f); ((Graphic)Heading((Transform)(object)val4, "Refresh saved settings", 12f, 8f, 296f, 22f, 17f)).color = new Color(0.98f, 0.96f, 0.9f); TMP_Text val5 = Label((Transform)(object)val4, "Reads this page's saved settings. If its draft changed, confirm before replacing it. Nothing is saved.", 12f, 33f, 296f, 90f, 14f); ((Graphic)val5).color = new Color(0.94f, 0.92f, 0.87f); float num4 = Mathf.Max(20f, val5.GetPreferredValues(val5.text, 296f, float.PositiveInfinity).y); Place(val5.rectTransform, 12f, 33f, 296f, num4 + 2f); Place(val4, 834f, 67f, 320f, num4 + 45f); Image[] componentsInChildren = ((Component)val4).GetComponentsInChildren<Image>(); for (int num5 = 0; num5 < componentsInChildren.Length; num5++) { ((Graphic)componentsInChildren[num5]).raycastTarget = false; } ((Component)val4).gameObject.SetActive(false); ((Component)val2).gameObject.AddComponent<ControlTip>().Target = ((Component)val4).gameObject; RefreshDirtyIndicators(); _layoutFrame = Time.frameCount; _focusOnLayoutRefresh = focusOnLayoutRefresh; _status = Label((Transform)(object)_window, _save.IsPending ? UiText.Format("Saving: {0}", UiText.Get(_save.CurrentResult.State.ToString())) : UiText.Get(_message), 24f, (_tab == "Overview") ? 824 : 812, 1132f, (_tab == "Overview") ? 36 : 38, 16f); if (focused != null && (Object)(object)EventSystem.current != (Object)null && (Object)(object)_modal == (Object)null) { Selectable val6 = ((IEnumerable<Selectable>)((Component)_window).GetComponentsInChildren<Selectable>()).FirstOrDefault((Func<Selectable, bool>)((Selectable b) => b.IsInteractable() && ((Object)((Component)b).gameObject).name == focused)); if ((Object)(object)val6 != (Object)null) { EventSystem.current.SetSelectedGameObject(((Component)val6).gameObject); } } } private void DrawWelcome() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_window == (Object)null) { return; } foreach (Transform item in (Transform)_window) { RetireInputs(item); ((Component)item).gameObject.SetActive(false); Object.Destroy((Object)(object)((Component)item).gameObject); } _theme.ScopePanel(((Component)_window).GetComponent<Image>(), serverScope: false); Label((Transform)(object)_window, "Welcome to TeleportEverything", 30f, 52f, 700f, 54f, 30f).alignment = (TextAlignmentOptions)514; Label((Transform)(object)_window, "Configure your teleport settings while you play. Open Configuration Hotkey is currently set to:", 60f, 132f, 640f, 66f).alignment = (TextAlignmentOptions)514; string text = _welcomeHotkey(); TMP_Text obj = Label((Transform)(object)_window, text, 60f, 205f, 640f, 44f, 24f); obj.alignment = (TextAlignmentOptions)514; ((Graphic)obj).color = Color.yellow; Label((Transform)(object)_window, "You can also open settings from ConfigurationManager. If the hotkey is unbound, use that button to open settings.", 60f, 268f, 640f, 64f, 16f).alignment = (TextAlignmentOptions)514; Button((Transform)(object)_window, "OK", 140f, 350f, 220f, delegate { _welcomeDismissed = true; Close(); }); Button((Transform)(object)_window, "Don't show again", 400f, 350f, 250f, delegate { _welcomeDismissed = true; _hideWelcome(); Close(); }); _layoutFrame = Time.frameCount; _focusOnLayoutRefresh = true; } private void ScopeTab(string scope, string label, float x) { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Expected O, but got Unknown //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Expected O, but got Unknown bool flag = _scope == scope; Button val = Button((Transform)(object)_window, flag ? (UiText.Get(label) + " ✓") : label, x, 23f, 160f, delegate { Scope(scope); }, !Locked, flag, !flag); Place((RectTransform)((Component)val).transform, x, 23f, 160f, 60f); Place((RectTransform)((Component)val).GetComponentInChildren<TMP_Text>(true).transform, 10f, 11f, 140f, 38f); ((Object)((Component)val).gameObject).name = scope + " Settings"; _theme.StyleScopeTab(val, scope == "Server", flag); } private void HeaderTitle() { //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) TMP_Text val = Heading((Transform)(object)_window, "Teleport Everything", 350f, 26f, 480f, 52f, 40f); val.textWrappingMode = (TextWrappingModes)0; if ((Object)(object)_theme.VikingFont != (Object)null) { val.font = _theme.VikingFont; } val.alignment = (TextAlignmentOptions)514; val.fontStyle = (FontStyles)((!((Object)(object)_theme.VikingFont != (Object)null) || ((Object)_theme.VikingFont).name.IndexOf("norsebold", StringComparison.OrdinalIgnoreCase) < 0) ? 1 : 0); ((Graphic)val).color = new Color(1f, 0.72f, 0.22f, 1f); Outline obj = ((Component)val).gameObject.AddComponent<Outline>(); ((Shadow)obj).effectColor = new Color(0.24f, 0.12f, 0.045f, 1f); ((Shadow)obj).effectDistance = new Vector2(1.7f, -1.7f); TMP_Text obj2 = Label((Transform)(object)_window, "Configuration Panel", 350f, 80f, 480f, 26f); obj2.alignment = (TextAlignmentOptions)514; obj2.textWrappingMode = (TextWrappingModes)0; obj2.enableAutoSizing = true; obj2.fontSizeMin = 16f; obj2.fontSizeMax = 18f; ((Graphic)obj2).color = new Color(1f, 0.72f, 0.22f, 1f); } private void DrawPageContents(float scrollPosition) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown //IL_002e: 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_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_content == (Object)null) { return; } foreach (Transform item in (Transform)_content) { RetireInputs(item); ((Component)item).gameObject.SetActive(false); Object.Destroy((Object)(object)((Component)item).gameObject); } _rows = 0; _contentExtent = 483f; ModuleEndpoint value; if (_tab == "Portal") { PortalSettings(); } else if (_tab == "Overview") { Overview(); } else if (_tab == "Items") { Development(); } else if (_tab == "QuickTeleport" && (!_modules.TryGetValue(_tab, out value) || value.Exchange == null)) { QuickTeleport(); } else { EditModule(); } _content.sizeDelta = new Vector2(1100f, Math.Max(_contentExtent, _rows * 76 + 20)); RectTransform? content = _content; Rect rect = _content.rect; content.anchoredPosition = new Vector2(0f, Mathf.Clamp(scrollPosition, 0f, Mathf.Max(0f, ((Rect)(ref rect)).height - 483f))); } private void PortalSettings() { GroupRow("Portal detection"); PortalSetting(_portalSettings[0], "Portal Activation Distance", "Sets how far from the portal you can be to activate its target-found signal. Default: 5 m. Range: 0 to 10 m.", 0f, 10f, 0.25f, "m"); GroupRow("Portal sound"); PortalSetting(_portalSettings[1], "Portal sound volume", "Volume relative to Valheim's original portal sound: 100% is the game default and 0% is muted.", 0f, 1f, 0.05f, "%"); GroupRow("Portal interaction reach"); PortalSetting(_portalSettings[2], "Increase interaction hover distance by", "Adds the selected amount, up to 2 m, to Valheim's normal portal interaction reach.", 0f, 2f, 0.05f, "m"); GroupRow("Dungeon entrances"); PortalSetting(_portalSettings[3], "Increase interaction hover distance by", "Adds the selected amount, up to 2 m, to Valheim's normal dungeon entrance interaction reach.", 0f, 2f, 0.05f, "m"); TextBlockRow("These controls affect only this client. Portal and dungeon destinations, teleport timing, and arrival behavior stay unchanged.", 1); _contentExtent = Math.Max(_contentExtent, _rows * 76 + 20); } private Slider PortalSetting(ConfigEntry<float> entry, string label, string help, float minimum, float maximum, float step, string unit) { int num = _rows++ * 76; Label((Transform)(object)_content, label, 16f, num + 2, 680f, 28f, 19f); TMP_Text valueText = Label((Transform)(object)_content, FormatPortalValue(entry.Value, unit), 840f, num + 2, 232f, 28f); valueText.alignment = (TextAlignmentOptions)516; Label((Transform)(object)_content, help, 16f, num + 33, 690f, 38f, 15f); Slider slider = null; slider = NumberSlider((Transform)(object)_content, 725f, num + 16, 350f, minimum, maximum, entry.Value, delegate(float value) { float num2 = Mathf.Clamp(Mathf.Round(value / step) * step, minimum, maximum); _setLocalSetting(entry, num2); valueText.text = FormatPortalValue(num2, unit); if ((Object)(object)slider != (Object)null && !Mathf.Approximately(slider.value, num2)) { slider.SetValueWithoutNotify(num2); } }); ((Object)((Component)slider).gameObject).name = ((ConfigEntryBase)entry).Definition.Key; _contentExtent = Math.Max(_contentExtent, num + 76 + 12); return slider; } private static string FormatPortalValue(float value, string unit) { if (!(unit == "%")) { return value.ToString("0.00", CultureInfo.InvariantCulture) + " " + unit; } return Mathf.RoundToInt(value * 100f).ToString(CultureInfo.InvariantCulture) + "%"; } private void RedrawPageSafely() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) try { if ((Object)(object)_content == (Object)null) { return; } string focused = SelectedControlName(); float y = _content.anchoredPosition.y; DrawPageContents(y); UpdateFooterState(); if (focused != null && (Object)(object)EventSystem.current != (Object)null) { Selectable val = ((IEnumerable<Selectable>)((Component)_content).GetComponentsInChildren<Selectable>(true)).FirstOrDefault((Func<Selectable, bool>)((Selectable c) => ((Object)((Component)c).gameObject).name == focused)); if (val != null) { EventSystem.current.SetSelectedGameObject(((Component)val).gameObject); } } _layoutFrame = Time.frameCount; } catch (Exception ex) { Abort(); _log("Configuration UI failed and was disabled for this session; input released. " + ex); } } private void UpdateFooterState() { int num = _drafts.Values.Count((Draft d) => d.Scope == _scope && d.Dirty); if ((Object)(object)_saveAllButton != (Object)null) { bool enabled = !Locked && num > 0 && !_drafts.Values.Any((Draft d) => d.Scope == _scope && d.Dirty && BlocksSave(d)); if ((Object)(object)_saveAllLabel != (Object)null) { _saveAllLabel.text = ((_tab == "Overview") ? (UiText.Get("Save all drafts") + " (" + num + ")") : (UiText.Get("Save All") + " (" + num + ")")); } RefreshSaveButton(_saveAllButton, enabled); } if (!((Object)(object)_saveModuleButton != (Object)null)) { return; } int num2; if (!Locked) { Draft? current = Current; if (current != null && current.Dirty && Current.View.CanEdit && Current.Request == null) { num2 = ((!BlocksSave(Current)) ? 1 : 0); goto IL_0131; } } num2 = 0; goto IL_0131; IL_0131: bool enabled2 = (byte)num2 != 0; RefreshSaveButton(_saveModuleButton, enabled2); } private void RefreshSaveButton(Button button, bool enabled) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: 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) //IL_00c8: 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) _theme.StyleButton(button); ((Selectable)button).transition = (Transition)1; ColorBlock colors = ((Selectable)button).colors; ((ColorBlock)(ref colors)).normalColor = Color.white; ((ColorBlock)(ref colors)).selectedColor = Color.white; ((ColorBlock)(ref colors)).disabledColor = Color.white; Color highlightedColor = ((ColorBlock)(ref colors)).highlightedColor; highlightedColor.a = 1f; ((ColorBlock)(ref colors)).highlightedColor = highlightedColor; Color pressedColor = ((ColorBlock)(ref colors)).pressedColor; pressedColor.a = 1f; ((ColorBlock)(ref colors)).pressedColor = pressedColor; ((ColorBlock)(ref colors)).colorMultiplier = 1f; ((ColorBlock)(ref colors)).fadeDuration = 0f; ((Selectable)button).colors = colors; FieldState((Selectable)(object)button, enabled); Graphic targetGraphic = ((Selectable)button).targetGraphic; Image val = (Image)(object)((targetGraphic is Image) ? targetGraphic : null); if (val != null) { val.overrideSprite = null; Color color = ((Graphic)val).color; color.a = 1f; ((Graphic)val).color = color; ((Graphic)val).CrossFadeColor(Color.white, 0f, true, true); } } private void PageHeader() { //IL_000c: 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_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0374: Unknown result type (might be due to invalid IL or missing references) //IL_0402: Unknown result type (might be due to invalid IL or missing references) RectTransform val = Box((Transform)(object)_body, "Paper page", Color.white); Place(val, 0f, 0f, 1132f, 88f); _theme.Paper(((Component)val).GetComponent<Image>()); string text = ((_tab == "Overview") ? "Teleport Everything settings" : ((_tab == "Items") ? UiText.Format("{0} — In development", UiText.Get(_tab)) : ((_tab == "Portal") ? UiText.Get("Portal settings") : UiText.Format("{0} settings", UiText.Get(_tab))))); Heading((Transform)(object)val, text, 20f, 15f, 1092f, 30f).alignment = (TextAlignmentOptions)514; ModuleEndpoint value; if (_tab == "Overview") { TMP_Text obj = Label((Transform)(object)val, "TeleportEverything 3.0.11", 832f, 15f, 280f, 30f); obj.alignment = (TextAlignmentOptions)516; ((Graphic)obj).color = new Color(0.22f, 0.45f, 0.2f); } else if (_modules.TryGetValue(_tab, out value) && value.Version.Length > 0) { string text2 = ((value.Name == "QuickTeleport") ? value.Name : ("Teleport" + value.Name)); TMP_Text obj2 = Label((Transform)(object)val, text2 + " " + value.Version, 832f, 15f, 280f, 30f); obj2.alignment = (TextAlignmentOptions)516; ((Graphic)obj2).color = new Color(0.22f, 0.45f, 0.2f); } _modules.TryGetValue("QuickTeleport", out ModuleEndpoint value2); bool flag = _tab == "QuickTeleport" && value2?.Exchange != null; string text3 = ((_tab == "Portal") ? "Local only • Changes apply immediately and save automatically to this client." : ((_tab == "Overview") ? "Choose a module to view its settings. Your edits stay as drafts until you save them." : ((_tab == "Items") ? "This module is still in development. Its settings are not available yet." : ((!(_tab == "QuickTeleport" && flag)) ? ((!(_tab == "QuickTeleport")) ? ((_scope == "Player") ? "My Settings • Your choices can only narrow the server's rules. Save module or Save All to keep your changes." : "Server Settings • Everyone can view these rules. Only the host or server admin can save them; the module verifies permission.") : ((value2 != null && value2.Version.Length > 0) ? UiText.Get("QuickTeleport settings are unavailable because the installed version does not expose panel settings. Press F1 with ConfigurationManager installed, or edit elg.QuickTeleport.cfg.") : UiText.Get("QuickTeleport is not installed. Install it to use these settings; once installed, configure through ConfigurationManager or elg.QuickTeleport.cfg unless its panel adapter is available."))) : ((_scope == "Player") ? UiText.Get("My Settings • Adjust local fade times, loading delays, arrival safety and diagnostics. Save module or Save All to apply.") : UiText.Get("Server Settings • Control QuickTeleport, faster portals and faster dungeons for everyone. Only the host or server admin can save changes.")))))); Label((Transform)(object)val, text3, 20f, 50f, 1092f, 34f, 15f).alignment = (TextAlignmentOptions)514; RectTransform obj3 = Box((Transform)(object)_body, "Page border", new Color(0.62f, 0.44f, 0.19f)); Place(obj3, 0f, 0f, 1132f, 2f); ((Graphic)((Component)obj3).GetComponent<Image>()).raycastTarget = false; int num = Array.IndexOf(ModuleTabs, _tab); float num2 = ((ModuleTabs.Length > 6) ? 162 : 187); float w = ((ModuleTabs.Length > 6) ? 152 : 174); RectTransform obj4 = Box((Transform)(object)_body, "Active tab connection", new Color(0.9f, 0.79f, 0.56f)); Place(obj4, (float)num * num2 + 2f, -1f, w, 4f); ((Graphic)((Component)obj4).GetComponent<Image>()).raycastTarget = false; } private void Scope(string value) { CancelHotkeyCapture(); _scope = value; _message = ""; _redraw = true; } private void TextRow(string text) { Label((Transform)(object)_content, text, 16f, _rows++ * 76 + 8, 1056f, 68f); } private void TextBlockRow(string text, int rows, int offset = 0) { int num = _rows * 76 + offset; Label((Transform)(object)_content, text, 16f, num + 4, 1056f, rows * 76 - 8, 16f); _rows += rows; } private void WarningRow(string text, bool conflict) { //IL_0061: 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) ((Graphic)Label((Transform)(object)_content, text, 16f, _rows++ * 76 + 8, 1056f, 68f)).color = (conflict ? new Color(1f, 0.48f, 0.4f) : new Color(1f, 0.78f, 0.25f)); } private void QuickTeleportRiskWarningRows(IReadOnlyList<(string Setting, string Message)> warnings) { //IL_0083: 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_00cd: Expected O, but got Unknown if (warnings.Count == 0) { return; } float num = _rows * 76 + 8; float num2 = num; foreach (var warning in warnings) { TMP_Text val = Label((Transform)(object)_content, UiText.Get(warning.Setting) + ": " + UiText.Get(warning.Message), 16f, num2, 1056f, 200f); ((Graphic)val).color = new Color(1f, 0.78f, 0.25f); val.ForceMeshUpdate(false, false); float num3 = Math.Max(36f, val.preferredHeight + 8f); Place((RectTransform)val.transform, 16f, num2, 1056f, num3); num2 += num3 + 4f; } float num4 = num2 - num - 4f; _rows += Math.Max(1, (int)Math.Ceiling(num4 / 76f)); } private bool ModuleHasIssue(string tab) { if (_modules.TryGetValue(tab, out ModuleEndpoint value) && value.Version.Length > 0) { if (!ModuleDiscovery.HasKnownConflict(tab)) { return _drafts.Values.Any((Draft d) => d.Module.Name == tab && (d.Error.Length > 0 || (d.Loaded && (d.View.CompatibilityWarnings.Count > 0 || d.View.Warnings.Any((string w) => w.IndexOf("migrat", StringComparison.OrdinalIgnoreCase) >= 0))))); } return true; } return false; } private TMP_Text Heading(Transform parent, string text, float x, float y, float w, float h, float size = 24f) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) TMP_Text val = Label(parent, text, x, y, w, h, size); _theme.StyleLabel(val, heading: true); if (_theme.IsPaper(parent)) { ((Graphic)val).color = new Color(0.26f, 0.17f, 0.08f); } return val; } private void GroupRow(string title, int offset = 0) { //IL_008d: Unknown result type (might be due to invalid IL or missing references) int num = _rows++ * 76 + offset; Heading((Transform)(object)_content, string.Join(" / ", title.Split(new string[1] { " / " }, StringSplitOptions.None).Select(UiText.Get)), 16f, num + 10, 1056f, 36f); Place(Box((Transform)(object)_content, "Section divider", new Color(0.72f, 0.51f, 0.22f, 0.7f)), 16f, num + 55, 1056f, 1f); } private RectTransform Card(string name, float x, float y, float w, float h) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) RectTransform val = Box((Transform)(object)_content, "Paper " + name, Color.white); Place(val, x, y, w, h); _theme.Paper(((Component)val).GetComponent<Image>()); return val; } private void AddActionTip(Button button, string title, string help, float width) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Expected O, but got Unknown RectTransform val = Box((Transform)(object)_window, "Action tip", new Color(0.015f, 0.015f, 0.015f, 0.93f)); Place(val, 0f, 0f, width, 88f); ((Graphic)Heading((Transform)(object)val, title, 12f, 8f, width - 24f, 22f, 17f)).color = new Color(0.98f, 0.96f, 0.9f); TMP_Text val2 = Label((Transform)(object)val, UiText.Get(help), 12f, 34f, width - 24f, 46f, 14f); ((Graphic)val2).color = new Color(0.94f, 0.92f, 0.87f); float num = Mathf.Max(20f, val2.GetPreferredValues(val2.text, width - 24f, float.PositiveInfinity).y); Place(val2.rectTransform, 12f, 34f, width - 24f, num + 2f); Place(val, 0f, 0f, width, num + 46f); Graphic[] componentsInChildren = ((Component)val).GetComponentsInChildren<Graphic>(true); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].raycastTarget = false; } ((Component)val).gameObject.SetActive(false); ControlTip controlTip = ((Component)button).gameObject.AddComponent<ControlTip>(); controlTip.Target = ((Component)val).gameObject; controlTip.Bounds = _window; controlTip.Owner = (RectTransform)((Component)button).transform; controlTip.FollowPointer = true; controlTip.DismissOnActivate = true; } private void SupportCard(float x, float y, float height) { RectTransform parent = Card("Optional support", x, y, 395f, height); Heading((Transform)(object)parent, "Support development", 20f, 14f, 355f, 34f, 22f); Label((Transform)(object)parent, "TeleportEverything and every mod in this pack are completely free.\nIf you’d like to support maintenance and speed up development, you can leave an optional tip on Ko-fi.", 20f, 55f, 355f, 104f, 16f); Label((Transform)(object)parent, UiText.Get("Follow project updates on Ko-fi for development news."), 20f, 164f, 355f, 42f, 15f); Button((Transform)(object)parent, "Optional Ko-fi tip", 20f, 216f, 355f, delegate { OpenLink("https://ko-fi.com/C0C6S21AN"); }); Button((Transform)(object)parent, "View project updates", 20f, 264f, 355f, delegate { OpenLink("https://ko-fi.com/C0C6S21AN"); }); } private void Overview() { //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_032d: Unknown result type (might be due to invalid IL or missing references) //IL_0317: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_039c: Unknown result type (might be due to invalid IL or missing references) CompatibilityWarning[] array = (from w in ModuleDiscovery.QuickTeleportWarnings().Concat(ModuleDiscovery.LegacyTransportWarnings()).Concat(_drafts.Values.Where((Draft d) => d.Loaded).SelectMany((Draft d) => d.View.CompatibilityWarnings)) group w by w.ModName into g select g.First()).ToArray(); float num = 12f; CompatibilityWarning[] array2 = array; for (int num2 = 0; num2 < array2.Length; num2++) { string text = ModuleDiscovery.FormatWarning(array2[num2]); TMP_Text val = Label((Transform)(object)_content, text, 16f, num, 1056f, 68f, 16f); ((Graphic)val).color = new Color(1f, 0.48f, 0.4f); float num3 = Mathf.Max(40f, val.GetPreferredValues(val.text, 1056f, float.PositiveInfinity).y + 8f); Place(val.rectTransform, 16f, num, 1056f, num3); num += num3 + 12f; } if (array.Length != 0) { num += 4f; } int num4 = 0; foreach (ModuleEndpoint item in _modules.Values.OrderBy((ModuleEndpoint module) => Array.IndexOf(ModuleTabs, module.Name))) { string tab = item.Name; RectTransform parent = Card(item.Name, 16f, num + (float)(num4 * 88), 645f, 84f); string text2 = ((item.Name == "QuickTeleport") ? item.Name : ("Teleport" + item.Name)); bool flag = item.Version.Length > 0; bool flag2 = item.IsEnabled == false; string text3 = ((!flag) ? "Not installed" : (flag2 ? "Disabled" : "Installed")); TMP_Text obj = Heading((Transform)(object)parent, text2, 18f, 14f, 250f, 29f, (text2.Length > 24) ? 18 : 21); obj.textWrappingMode = (TextWrappingModes)0; obj.overflowMode = (TextOverflowModes)1; ((Graphic)Label((Transform)(object)parent, text3, 278f, 16f, 96f, 26f, 12f)).color = (flag2 ? new Color(0.38f, 0.38f, 0.37f) : (flag ? new Color(0.22f, 0.45f, 0.2f) : new Color(0.72f, 0.2f, 0.16f))); if (item.Version.Length > 0) { TMP_Text obj2 = Label((Transform)(object)parent, UiText.Format("Version {0}", item.Version), 382f, 16f, 108f, 26f, 15f); obj2.alignment = (TextAlignmentOptions)516; ((Graphic)obj2).color = new Color(0.22f, 0.45f, 0.2f); } string text4 = ((item.Name == "QuickTeleport") ? ((item.Exchange != null) ? "Configuration available" : (flag ? "Installed version does not expose panel settings" : "Optional module; install QuickTeleport to use its settings")) : ((item.Exchange != null) ? "Configuration available" : ((item.Name == "Items") ? "In development" : item.Unavailable))); Label((Transform)(object)parent, text4, 18f, 47f, 472f, 32f, 15f); Button((Transform)(object)parent, "Open", 507f, 21f, 120f, delegate { _tab = tab; _redraw = true; }); num4++; } SupportCard(681f, num, 316f); float num5 = num + (float)(num4 * 88) - 4f; _contentExtent = Math.Max(_contentExtent, num5 + 6f); _rows = 0; } private void Development() { _ = _modules[_tab]; RectTransform parent = Card("Development status", 16f, 16f, 645f, 180f); Heading((Transform)(object)parent, "Development progress", 22f, 12f, 600f, 36f); Label((Transform)(object)parent, "Development status", 22f, 52f, 600f, 26f, 16f); Label((Transform)(object)parent, "Item transport is being developed. Settings are not available yet.", 22f, 91f, 600f, 76f); SupportCard(681f, 16f, 316f); _contentExtent = Math.Max(_contentExtent, 348f); _rows = 0; } private void QuickTeleport() { //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0309: Unknown result type (might be due to invalid IL or missing references) //IL_033c: Unknown result type (might be due to invalid IL or missing references) //IL_0354: Expected O, but got Unknown ModuleEndpoint moduleEndpoint = _modules[_tab]; string[] array = ModuleDiscovery.QuickTeleportWarnings().Select(ModuleDiscovery.FormatWarning).ToArray(); RectTransform val = Card("QuickTeleport status", 16f, 16f, 645f, 483f); Heading((Transform)(object)val, UiText.Get("QuickTeleport status"), 18f, 12f, 609f, 34f, 23f); string text = ((array.Length != 0) ? "Conflicts" : ((moduleEndpoint.Version.Length == 0) ? "Not Installed" : ((moduleEndpoint.IsEnabled == false) ? "Disabled" : "Enabled"))); TMP_Text obj = Label((Transform)(object)val, text, 18f, 52f, 609f, 30f); obj.fontStyle = (FontStyles)1; ((Graphic)obj).color = ((array.Length != 0) ? new Color(0.72f, 0.18f, 0.12f) : ((moduleEndpoint.Version.Length == 0) ? new Color(0.88f, 0.47f, 0.12f) : ((moduleEndpoint.IsEnabled == false) ? new Color(0.38f, 0.38f, 0.37f) : new Color(0.22f, 0.45f, 0.2f)))); string text2 = ((moduleEndpoint.Version.Length > 0) ? UiText.Get("QuickTeleport settings are unavailable because the installed version does not expose panel settings. Press F1 with ConfigurationManager installed, or edit elg.QuickTeleport.cfg.") : UiText.Get("QuickTeleport is not installed. Install it to use these settings; once installed, configure through ConfigurationManager or elg.QuickTeleport.cfg unless its panel adapter is available.")); Label((Transform)(object)val, text2, 18f, 90f, 609f, 78f, 16f); float num = 178f; if (moduleEndpoint.Version.Length == 0) { Label((Transform)(object)val, "Download QuickTeleport from the stores:", 18f, num, 609f, 30f, 16f); num += 34f; Button((Transform)(object)val, "Hexium", 18f, num, 194f, delegate { Application.OpenURL("https://valheim.hexium.gg/mods/OdinPlus/QuickTeleport"); }); Button((Transform)(object)val, "Thunderstore", 224f, num, 194f, delegate { Application.OpenURL("https://thunderstore.io/c/valheim/p/OdinPlus/QuickTeleport/"); }); Button((Transform)(object)val, "Nexus Mods", 430f, num, 194f, delegate { Application.OpenURL("https://www.nexusmods.com/valheim/mods/2291"); }); num += 54f; } string[] array2 = array; foreach (string text3 in array2) { TMP_Text val2 = Label((Transform)(object)val, text3, 18f, num, 609f, 200f, 16f); ((Graphic)val2).color = new Color(0.72f, 0.18f, 0.12f); val2.ForceMeshUpdate(false, false); float num3 = Math.Max(36f, val2.preferredHeight + 10f); Place((RectTransform)val2.transform, 18f, num, 609f, num3); num += num3 + 8f; } Place(val, 16f, 16f, 645f, num + 12f); SupportCard(681f, 16f, 316f); _contentExtent = Math.Max(_contentExtent, Math.Max(num + 40f, 348f)); _rows = 0; } private void EditModule() { //IL_0617: Unknown result type (might be due to invalid IL or missing references) //IL_0669: Unknown result type (might be due to invalid IL or missing references) ModuleEndpoint moduleEndpoint = _modules[_tab]; if (moduleEndpoint.Exchange == null) { RectTransform parent = Card("Configuration unavailable", 16f, 16f, 645f, 230f); Heading((Transform)(object)parent, UiText.Format("{0} configuration", UiText.Get(moduleEndpoint.Name)), 20f, 14f, 605f, 36f, 23f); Label((Transform)(object)parent, moduleEndpoint.Unavailable, 20f, 58f, 605f, 75f, 17f); Label((Transform)(object)parent, UiText.Get("Install a compatible module version to edit these settings. The panel cannot open settings that the module does not expose."), 20f, 145f, 605f, 64f, 16f); SupportCard(681f, 16f, 316f); _contentExtent = Math.Max(_contentExtent, 348f); _rows = 0; return; } if (!_drafts.TryGetValue(Key, out Draft draft)) { draft = new Draft { Module = moduleEndpoint, Scope = _scope }; _drafts.Add(Key, draft); BeginRead(draft, "Read"); } if (_tab == "QuickTeleport") { foreach (CompatibilityWarning item in ModuleDiscovery.QuickTeleportWarnings()) { WarningRow(ModuleDiscovery.FormatWarning(item), conflict: true); } } if (draft.Request != null) { TextRow("Loading saved settings…"); return; } if (!draft.Loaded) { TextRow(draft.Error); return; } if (!draft.View.CanEdit) { TextRow(UiText.Format("View only: {0}", UiText.Get(draft.View.ReadOnlyReason))); } DraftOwnerReadResult<ModuleConfigurationCandidate>? ownerRead = draft.OwnerRead; if (ownerRead != null && ownerRead.Decision == DraftOwnerReadDecision.ExternalChange) { WarningRow(UiText.Get("Current settings changed while this draft was closed. Your draft is kept until you compare changes."), conflict: true); Button((Transform)(object)_content, UiText.Get("Compare changes"), 16f, _rows++ * 76 + 8, 360f, delegate { CompareOwnerChanges(draft); }); } else { DraftOwnerReadResult<ModuleConfigurationCandidate>? ownerRead2 = draft.OwnerRead; if (ownerRead2 != null && ownerRead2.Decision == DraftOwnerReadDecision.ReadFailed) { WarningRow(UiText.Get("Could not check current settings after reopening. Your draft is safe; compare changes before saving."), conflict: true); Button((Transform)(object)_content, UiText.Get("Compare changes"), 16f, _rows++ * 76 + 8, 360f, delegate { CompareOwnerChanges(draft); }); } } foreach (CompatibilityWarning compatibilityWarning in draft.View.CompatibilityWarnings) { WarningRow(ModuleDiscovery.FormatWarning(compatibilityWarning), conflict: true); } foreach (string item2 in draft.View.Warnings.Where((string w) => !w.StartsWith("TE_ENEMY_SERVER_SETTINGS|", StringComparison.Ordinal))) { bool flag = item2.StartsWith("Player filters only restrict", StringComparison.OrdinalIgnoreCase); WarningRow(flag ? UiText.Get(item2) : (UiText.Get("Warning") + ": " + UiText.Get(item2.StartsWith("Warning:", StringComparison.OrdinalIgnoreCase) ? item2.Substring("Warning:".Length).TrimStart(Array.Empty<char>()) : item2)), conflict: false); } if (_tab == "QuickTeleport" && _scope == "Player") { QuickTeleportRiskWarningRows(QuickTeleportRiskWarnings.Select(draft.Candidate.Cfg)); } string text = ""; IOrderedEnumerable<ConfigurationDescriptor> orderedEnumerable = draft.View.Descriptors.OrderBy((ConfigurationDescriptor configurationDescriptor3) => (!(_scope == "Server") || !string.Equals(configurationDescriptor3.Group, "General", StringComparison.OrdinalIgnoreCase)) ? ((!string.Equals(configurationDescriptor3.Group, "Diagnostics", StringComparison.OrdinalIgnoreCase)) ? 1 : 2) : 0).ThenBy(delegate(ConfigurationDescriptor configurationDescriptor3) { if (!(_scope == "Server") || !string.Equals(configurationDescriptor3.Group, "General", StringComparison.OrdinalIgnoreCase)) { return 0; } return (!configurationDescriptor3.StableId.Equals("cfg:General/Enable Mod", StringComparison.OrdinalIgnoreCase) && !configurationDescriptor3.StableId.Equals("cfg:General/Enable Quick Teleport", StringComparison.OrdinalIgnoreCase)) ? (configurationDescriptor3.StableId.Equals("cfg:General/Force Server Config", StringComparison.OrdinalIgnoreCase) ? 1 : 2) : 0; }); Dictionary<string, string> settings; if (_tab == "Creatures") { ConfigurationDescriptor[] array = orderedEnumerable.Where((ConfigurationDescriptor configurationDescriptor3) => string.Equals(configurationDescriptor3.Group, "General", StringComparison.OrdinalIgnoreCase) && (!(_scope == "Player") || !(_creaturePage == "Enemies") || (!configurationDescriptor3.StableId.Equals("cfg:Controls/Previous Allies Mode Hotkey", StringComparison.OrdinalIgnoreCase) && !configurationDescriptor3.StableId.Equals("cfg:Controls/Next Allies Mode Hotkey", StringComparison.OrdinalIgnoreCase)))).ToArray(); foreach (ConfigurationDescriptor configurationDescriptor in array) { string text2 = (configurationDescriptor.StableId.StartsWith("cfg:") ? configurationDescriptor.Group : string.Join(" / ", configurationDescriptor.StableId.Split(new char[1] { '.' }).Reverse().Skip(1) .Reverse())); if (text2 != text) { GroupRow(text2); text = text2; } DrawField(draft, configurationDescriptor); } ConfigurationDescriptor[] array2 = orderedEnumerable.Where((ConfigurationDescriptor configurationDescriptor3) => !string.Equals(configurationDescriptor3.Group, "General", StringComparison.OrdinalIgnoreCase) && !string.Equals(configurationDescriptor3.Group, "Diagnostics", StringComparison.OrdinalIgnoreCase) && (!(_scope == "Player") || !(_creaturePage == "Enemies") || (!configurationDescriptor3.StableId.Equals("cfg:Controls/Previous Allies Mode Hotkey", StringComparison.OrdinalIgnoreCase) && !configurationDescriptor3.StableId.Equals("cfg:Controls/Next Allies Mode Hotkey", StringComparison.OrdinalIgnoreCase))) && ((!(configurationDescriptor3.Group == "Allies") && !(configurationDescriptor3.Group == "Allies Display")) || !(_creaturePage != "Allies")) && ((!(configurationDescriptor3.Group == "Enemies") && !(configurationDescriptor3.Group == "Enemies Display")) || !(_creaturePage != "Enemies"))).ToArray(); int rows = _rows; bool flag2 = _scope == "Player" && draft.View.Warnings.Any((string w) => w.StartsWith("Player filters only restrict", StringComparison.OrdinalIgnoreCase)); float num2 = rows * 76 - (flag2 ? 34 : 0); int num3 = (int)num2 + 51; RectTransform val = Box((Transform)(object)_content, "Creature tab page", new Color(0.025f, 0.02f, 0.015f, 0.88f)); Place(val, 4f, num3, 1092f, 0f); ((Graphic)((Component)val).GetComponent<Image>()).raycastTarget = false; RectTransform val2 = Box((Transform)(object)_content, "Creature tab page edge", new Color(0.72f, 0.51f, 0.22f, 0.7f)); Place(val2, 4f, num3, 2f, 0f); ((Graphic)((Component)val2).GetComponent<Image>()).raycastTarget = false; _rows++; Button((Transform)(object)_content, "Allies", 20f, num2 + 9f, 220f, delegate { CancelHotkeyCapture(); _creaturePage = "Allies"; _redraw = true; }, enabled: true, _creaturePage == "Allies"); Button((Transform)(object)_content, "Enemies", 240f, num2 + 9f, 220f, delegate { CancelHotkeyCapture(); _creaturePage = "Enemies"; _redraw = true; }, enabled: true, _creaturePage == "Enemies"); int num4 = ((_scope == "Player" && _creaturePage == "Allies") ? (-56) : (-32)); if (_scope == "Player" && _creaturePage == "Enemies") { string text3 = draft.View.Warnings.FirstOrDefault((string w) => w.StartsWith("TE_ENEMY_SERVER_SETTINGS|", StringComparison.Ordinal)); settings = (from part in (text3 ?? string.Empty).Split(new char[1] { '|' }).Skip(1) select part.Split(new char[1] { '=' }, 2) into parts where parts.Length == 2 select parts).ToDictionary<string[], string, string>((string[] parts) => parts[0], (string[] parts) => parts[1], StringComparer.Ordinal); string fallback = ((get("Enabled") == "True") ? "Enabled" : ((get("Enabled") == "False") ? "Disabled" : get("Enabled"))); string text4; int rows2; if (get("Mode") == "TakeThemWithYou") { text4 = UiText.Format("{0}\nEnemy transport: {1}", UiText.Get("Take Them With You"), UiText.Get(fallback)); rows2 = 1; if (get("Enabled") == "True") { text4 += UiText.Format("\n- Portals: {0}\n- Dungeons: {1}\n- Basements: {2}", UiText.Get(transition("Portals")), UiText.Get(transition("Dungeons")), UiText.Get(transition("Basements"))); rows2 = 2; } } else if (get("Mode") == "VikingsDontRun") { text4 = UiText.Format("{0}\nNearby enemies block portal use when this behavior is enabled.", UiText.Get("Vikings Don't Run")); rows2 = 1; } else { text4 = UiText.Format("{0}\nThe current server rule could not be read.", UiText.Get("Unknown")); rows2 = 1; } int num5 = _rows++ * 76 + num4; Heading((Transform)(object)_content, "Server Portal Behavior", 16f, num5 + 13, 680f, 48f); Button((Transform)(object)_content, "View Server Settings", 725f, num5 + 16, 350f, delegate { Scope("Server"); }); TextBlockRow(text4, rows2, num4); } text = ""; array = array2; foreach (ConfigurationDescriptor configurationDescriptor2 in array) { string text5 = (configurationDescriptor2.StableId.StartsWith("cfg:") ? configurationDescriptor2.Group : string.Join(" / ", configurationDescriptor2.StableId.Split(new char[1] { '.' }).Reverse().Skip(1) .Reverse())); if (text5 != text) { GroupRow(text5, num4); text = text5; } DrawField(draft, configurationDescriptor2, num4); } float h = _rows * 76 + num4 - num3; Place(val, 4f, num3, 1092f, h); Place(val2, 4f, num3, 2f, h); ConfigurationDescriptor[] array3 = orderedEnumerable.Where((ConfigurationDescriptor configurationDescriptor3) => string.Equals(configurationDescriptor3.Group, "Diagnostics", StringComparison.OrdinalIgnoreCase)).ToArray(); if (array3.Length != 0) { GroupRow("Diagnostics", num4); array = array3; foreach (ConfigurationDescriptor row in array) { DrawField(draft, row, num4); } } } else { foreach (ConfigurationDescriptor item3 in orderedEnumerable) { string text6 = (item3.StableId.StartsWith("cfg:") ? item3.Group : string.Join(" / ", item3.StableId.Split(new char[1] { '.' }).Reverse().Skip(1) .Reverse())); if (text6 != text) { GroupRow(text6); text = text6; } DrawField(draft, item3); } } if (draft.View.CanEdit) { int num6 = ((_tab == "Creatures") ? ((_scope =