using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using BepInEx; using BepInEx.Logging; using Dropper; using ExitGames.Client.Photon; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using Photon.Realtime; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyVersion("0.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace DropperPeakLevelSelectSwitcher { [BepInPlugin("com.github.Beast.Dropper.PeakLevelSelectSwitcher", "Dropper PeakLevelSelect Switcher", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public sealed class SwitcherPlugin : BaseUnityPlugin { public const string PluginGuid = "com.github.Beast.Dropper.PeakLevelSelectSwitcher"; public const string PluginName = "Dropper PeakLevelSelect Switcher"; public const string PluginVersion = "1.0.0"; internal static ManualLogSource Log; private void Awake() { Log = ((BaseUnityPlugin)this).Logger; DropperText.Install(); Harmony.CreateAndPatchAll(typeof(BoardingPassSwitcher), "com.github.Beast.Dropper.PeakLevelSelectSwitcher"); Log.LogInfo((object)"Dropper/PeakLevelSelect boarding pass switcher loaded."); } } internal static class DropperText { private const int ChineseLanguageIndex = 9; public static bool IsChinese { get { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Invalid comparison between Unknown and I4 try { return (int)LocalizedText.CURRENT_LANGUAGE == 9; } catch { return false; } } } public static string Choose(string english, string chinese) { return IsChinese ? chinese : english; } public static void Install() { Set("Name_Reset", "Resetter", "重置器"); Set("Force reset on #targetchar", "force reset #targetchar", "强制重置 #targetchar"); Set("Name_Instant Health I", "Instant Health I", "瞬间治疗 I"); Set("administer #targetchar", "administer #targetchar", "使用于 #targetchar"); Set("Dropper", "Dropper", "坠落挑战"); Set("Immense dread", "Immense dread", "无尽恐惧"); Set("Desc_Dropper", "Does falling from 50 meters and crushing all your bones hurt? YES! But the adrenaline keeps you alive and ready to hit the portal next time!", "从 50 米高空坠落并摔碎全身骨头会痛吗?当然会!但肾上腺素会让你活下来,准备好下一次冲进传送门!"); Set("Dropper - Descend", "Dropper - Descent", "坠落挑战 - 下降"); Set("Desc_Dropper - Descend", "Instead of doing it all in one jump, how about we mix it up with some parkour to climb down. Why would you do that? Well let's finish the first map an you will see why", "不再一次跳到底,而是加入一些跑酷向下推进。为什么要这样做?先完成第一张地图,你就会明白。"); } private static void Set(string key, string english, string chinese) { List list = new List(); for (int i = 0; i < 15; i++) { list.Add(english); } list[9] = chinese; LocalizedText.mainTable[key.ToUpperInvariant()] = list; } } [HarmonyAfter(new string[] { "PeakLevelSelect", "com.github.Beast.Dropper" })] internal static class BoardingPassSwitcher { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static UnityAction <>9__39_0; public static UnityAction <>9__39_1; internal void b__39_0() { useDropperControls = !useDropperControls; SwitcherPlugin.Log.LogInfo((object)("Dropper feature switch clicked. Dropper controls: " + useDropperControls)); if ((Object)(object)GUIManager.instance != (Object)null && (Object)(object)GUIManager.instance.boardingPass != (Object)null) { InvokeUpdateAscent(GUIManager.instance.boardingPass); } } internal void b__39_1() { dropperMode = ((dropperMode == 0) ? 1 : 0); SwitcherPlugin.Log.LogInfo((object)("Dropper mode switch clicked. Mode: " + dropperMode)); if ((Object)(object)GUIManager.instance != (Object)null && (Object)(object)GUIManager.instance.boardingPass != (Object)null) { InvokeUpdateAscent(GUIManager.instance.boardingPass); } } } private const int OffSentinel = -1; private const int DropperSentinel = -101; private const int DescendSentinel = -102; private const string RoomDropperModeKey = "DropperFix.Mode"; private const string RoomPeakLevelKey = "DropperFix.PeakLevel"; private const string RoomPeakAscentKey = "DropperFix.PeakAscent"; private static bool useDropperControls; private static int dropperMode; private static GameObject switchButton; private static GameObject dropperModeButton; private static TextMeshProUGUI switchButtonText; private static TextMeshProUGUI dropperModeButtonText; private static bool checkedPeakLevelSelect; private static Type peakLevelSelectPatchType; private static bool dropperUiApplied; private static bool capturedDescLayout; private static bool defaultDescAutoSizing; private static float defaultDescLineSpacing; private static float defaultDescParagraphSpacing; private static Vector4 defaultDescMargin; private static float defaultDescFontSizeMin; private static float defaultDescFontSizeMax; private static RectTransform ascentTitleRect; private static Vector2 defaultAscentTitleAnchoredPosition; private static Vector2 defaultAscentTitleSizeDelta; private static bool capturedTitleLayout; private static bool capturedRewardState; private static bool defaultRewardActive; private static bool capturedCustomOptionsState; private static bool defaultCustomOptionsActive; private static bool peakLevelSelectHiddenByDropper; private static readonly Color Blue = new Color(0.1922f, 0.2941f, 0.9804f, 1f); private static readonly Color Yellow = new Color(0.9804f, 0.8075f, 0.1922f, 1f); private static readonly MethodInfo UpdateAscentMethod = typeof(BoardingPass).GetMethod("UpdateAscent", BindingFlags.Instance | BindingFlags.NonPublic); [HarmonyPatch(typeof(AirportCheckInKiosk), "BeginIslandLoadRPC")] [HarmonyPrefix] private static void AirportCheckInKiosk_BeginIslandLoadRPC_Prefix() { ApplyRoomSelection("BeginIslandLoadRPC"); } [HarmonyPatch(typeof(AirportCheckInKiosk), "LoadIslandMaster")] [HarmonyPrefix] private static void AirportCheckInKiosk_LoadIslandMaster_Prefix() { ApplyRoomSelection("LoadIslandMaster"); } [HarmonyPatch(typeof(GUIManager), "Start")] [HarmonyPostfix] private static void GUIManager_Start_Postfix() { if ((Object)(object)GUIManager.instance != (Object)null && (Object)(object)GUIManager.instance.boardingPass != (Object)null) { EnsureButtons(GUIManager.instance.boardingPass); Refresh(GUIManager.instance.boardingPass); } } [HarmonyPatch(typeof(BoardingPass), "UpdateAscent")] [HarmonyPostfix] private static void BoardingPass_UpdateAscent_Postfix(BoardingPass __instance) { EnsureButtons(__instance); Refresh(__instance); } [HarmonyPatch(typeof(BoardingPass), "StartGame")] [HarmonyPrefix] private static bool BoardingPass_StartGame_Prefix(BoardingPass __instance) { if ((Object)(object)__instance == (Object)null || LoadingScreenHandler.loading) { return true; } if (RunSettings.IsCustomRun || !useDropperControls) { PublishRoomSelection(-1); return true; } RunSettings.IsCustomRun = false; int mode = ((dropperMode == 0) ? (-101) : (-102)); PublishRoomSelection(mode); SendDropperMode(__instance, mode); return true; } private static void EnsureButtons(BoardingPass pass) { //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Expected O, but got Unknown //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Expected O, but got Unknown if ((Object)(object)pass == (Object)null || (Object)(object)switchButton != (Object)null) { return; } Transform val = ((Component)pass).transform.Find("BoardingPass/Panel"); if ((Object)(object)val == (Object)null) { val = ((Component)pass).transform.Find("Panel"); } if ((Object)(object)val == (Object)null || (Object)(object)pass.incrementAscentButton == (Object)null) { SwitcherPlugin.Log.LogWarning((object)"Could not find boarding pass panel/reference button for Dropper switcher."); return; } GameObject gameObject = ((Component)pass.incrementAscentButton).gameObject; Transform parent = val; Vector2 position = new Vector2(545f, 405f); Vector2 size = new Vector2(120f, 30f); object obj = <>c.<>9__39_0; if (obj == null) { UnityAction val2 = delegate { useDropperControls = !useDropperControls; SwitcherPlugin.Log.LogInfo((object)("Dropper feature switch clicked. Dropper controls: " + useDropperControls)); if ((Object)(object)GUIManager.instance != (Object)null && (Object)(object)GUIManager.instance.boardingPass != (Object)null) { InvokeUpdateAscent(GUIManager.instance.boardingPass); } }; <>c.<>9__39_0 = val2; obj = (object)val2; } switchButton = CreateButton(pass, gameObject, parent, "DropperFeatureSwitch", position, size, (UnityAction)obj, out switchButtonText); GameObject gameObject2 = ((Component)pass.incrementAscentButton).gameObject; Transform parent2 = val; Vector2 position2 = new Vector2(690f, 405f); Vector2 size2 = new Vector2(135f, 30f); object obj2 = <>c.<>9__39_1; if (obj2 == null) { UnityAction val3 = delegate { dropperMode = ((dropperMode == 0) ? 1 : 0); SwitcherPlugin.Log.LogInfo((object)("Dropper mode switch clicked. Mode: " + dropperMode)); if ((Object)(object)GUIManager.instance != (Object)null && (Object)(object)GUIManager.instance.boardingPass != (Object)null) { InvokeUpdateAscent(GUIManager.instance.boardingPass); } }; <>c.<>9__39_1 = val3; obj2 = (object)val3; } dropperModeButton = CreateButton(pass, gameObject2, parent2, "DropperModeSwitch", position2, size2, (UnityAction)obj2, out dropperModeButtonText); SwitcherPlugin.Log.LogInfo((object)"Created Dropper switcher buttons on boarding pass."); } private static GameObject CreateButton(BoardingPass pass, GameObject referenceButton, Transform parent, string name, Vector2 position, Vector2 size, UnityAction onClick, out TextMeshProUGUI label) { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0087: 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_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Expected O, but got Unknown //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate(referenceButton, parent, false); ((Object)val).name = name; Animator component = val.GetComponent(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } Transform val2 = val.transform.Find("Image"); if ((Object)(object)val2 != (Object)null) { Object.Destroy((Object)(object)((Component)val2).gameObject); } RectTransform component2 = val.GetComponent(); component2.anchorMin = Vector2.zero; component2.anchorMax = Vector2.zero; component2.pivot = Vector2.zero; component2.anchoredPosition = position; component2.sizeDelta = size; Button component3 = val.GetComponent