using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Logging; using ExitGames.Client.Photon; using HarmonyLib; using Microsoft.CodeAnalysis; using PEAKLib.Core; using PEAKLib.UI; using PEAKLib.UI.Elements; using Photon.Pun; using Photon.Realtime; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.Rendering; using UnityEngine.SceneManagement; using UnityEngine.UI; using Zorro.Core; using Zorro.Settings; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("NanJu.LevelMOD")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("0.1.0.0")] [assembly: AssemblyInformationalVersion("0.1.0")] [assembly: AssemblyProduct("MyStaff")] [assembly: AssemblyTitle("NanJu.LevelMOD")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.1.0.0")] [module: UnverifiableCode] [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.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] [Microsoft.CodeAnalysis.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; } } [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 MyStaff { public static class SwitcherConfig { public const string RoomSelectionKey = "MyStaff.Selection"; public const int ModeOff = -1; public const int ModeCustomLevel = 0; public static Vector2 ToggleButtonPosition = new Vector2(545f, 405f); public static Vector2 ToggleButtonSize = new Vector2(120f, 30f); public static Color ColorActive = new Color(0.9804f, 0.8075f, 0.1922f, 1f); public static Color ColorInactive = new Color(0.1922f, 0.2941f, 0.9804f, 1f); } public static class LocalizationHelper { 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() { SetText("MyStaffToggleOn", "Custom Level", "自定义关卡"); SetText("MyStaffToggleOff", "Default", "原版"); SetText("MyStaffTitle", "Custom Level: Only Up", "自定义关卡_攀爬"); SetText("MyStaffDesc", "Play your custom level. Press F3 to select save points.", "进入关卡可以通过F3选择保存点"); SetText("MyMenuTitle", "Custom Level Menu", "自定义关卡菜单"); SetText("MyMenuLoading", "Loading...", "等待加载..."); SetText("MyMenuClose", "Close", "关闭"); SetText("MyMenuSelectSave", "Select Save Point", "选择保存点"); SetText("MyMenuTeleport", "Teleport to Save Point", "传送到保存点"); SetText("MyMenuAuthor", "Author: NanJu", "作者:楠橘"); SetText("MyMenuAuthorTip", "(Click name if you have questions)", "(如果问题可以点击名字)"); SetText("MyMenuLoadedSave", "{0} save points loaded", "已加载 {0} 个保存点"); SetText("MyMenuNoSaveModeOn", "No Save Point Mode: ON", "无保存点模式:开启"); SetText("MyMenuNoSaveModeOff", "No Save Point Mode: OFF", "无保存点模式:关闭"); SetText("MyMenuTeleportStart", "Teleport to start", "传送到起点"); SetText("MyMenuSavePointDisabled", "Save point selection disabled", "保存点选择已禁用"); SetText("MyMenuNightModeOn", "Night Mode: ON", "黑夜模式:开启"); SetText("MyMenuNightModeOff", "Night Mode: OFF", "黑夜模式:关闭"); } private static void SetText(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; } } [HarmonyPatch] public static class BoardingPassHandler { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static UnityAction <>9__20_0; internal void b__20_0() { useCustomMode = !useCustomMode; CustomLevelManager.SetEnabled(useCustomMode); if (!useCustomMode) { PublishSelectionToRoom(-1); } if ((Object)(object)GUIManager.instance?.boardingPass != (Object)null) { if (useCustomMode) { GUIManager.instance.boardingPass.ascentIndex = 0; } RefreshUI(GUIManager.instance.boardingPass); } } } private static bool useCustomMode; private static bool uiApplied; private static GameObject? toggleButton; private static TextMeshProUGUI? toggleButtonText; private static bool capturedOriginalState; private static string? originalTitleText; private static Color originalTitleColor; private static string? originalDescText; private static bool originalRewardActive; private static bool originalCustomOptionsActive; private static float originalDescLineSpacing; private static float originalDescParagraphSpacing; private static Vector4 originalDescMargin; private static bool originalDescAutoSizing; private static float originalDescFontSizeMin; private static float originalDescFontSizeMax; [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); RefreshUI(GUIManager.instance.boardingPass); } } [HarmonyPatch(typeof(BoardingPass), "UpdateAscent")] [HarmonyPostfix] private static void BoardingPass_UpdateAscent_Postfix(BoardingPass __instance) { EnsureButtons(__instance); RefreshUI(__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 || !useCustomMode) { DisableCustomMode(__instance); return true; } RunSettings.IsCustomRun = false; __instance.ascentIndex = 0; PublishSelectionToRoom(0); ApplyCustomMode(__instance); return false; } [HarmonyPatch(typeof(AirportCheckInKiosk), "BeginIslandLoadRPC")] [HarmonyPrefix] private static void AirportCheckInKiosk_BeginIslandLoadRPC_Prefix() { ApplyRoomSelection("BeginIslandLoadRPC"); } private static void EnsureButtons(BoardingPass pass) { //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown if ((Object)(object)pass == (Object)null || (Object)(object)toggleButton != (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) { return; } GameObject gameObject = ((Component)pass.incrementAscentButton).gameObject; Transform parent = val; Vector2 toggleButtonPosition = SwitcherConfig.ToggleButtonPosition; Vector2 toggleButtonSize = SwitcherConfig.ToggleButtonSize; object obj = <>c.<>9__20_0; if (obj == null) { UnityAction val2 = delegate { useCustomMode = !useCustomMode; CustomLevelManager.SetEnabled(useCustomMode); if (!useCustomMode) { PublishSelectionToRoom(-1); } if ((Object)(object)GUIManager.instance?.boardingPass != (Object)null) { if (useCustomMode) { GUIManager.instance.boardingPass.ascentIndex = 0; } RefreshUI(GUIManager.instance.boardingPass); } }; <>c.<>9__20_0 = val2; obj = (object)val2; } toggleButton = CreateButton(pass, gameObject, parent, "MyStaffToggle", toggleButtonPosition, toggleButtonSize, (UnityAction)obj, out toggleButtonText); } private static GameObject CreateButton(BoardingPass pass, GameObject referenceButton, Transform parent, string name, Vector2 position, Vector2 size, UnityAction onClick, out TextMeshProUGUI label) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Expected O, but got Unknown //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_01de: 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