The BepInEx console will not appear when launching like it does for other games on Thunderstore (you can turn it back on in your BepInEx.cfg file). If your PEAK crashes on startup, add -dx12 to your launch parameters.
Decompiled source of ThumbnailCinematicPack v1.0.0
mods/com.github.chrispavs.BetterRagdoll2.dll
Decompiled 2 weeks agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using Microsoft.CodeAnalysis; using Photon.Pun; using UnityEngine; using UnityEngine.InputSystem; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("com.github.chrispavs.BetterRagdoll2")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.1.0")] [assembly: AssemblyInformationalVersion("1.0.1+28715304957ade6c75933dac4ea6e47f28121c7f")] [assembly: AssemblyProduct("com.github.chrispavs.BetterRagdoll2")] [assembly: AssemblyTitle("BetterRagdoll2")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.1.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 BepInEx { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class BepInAutoPluginAttribute : Attribute { public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace BepInEx.Preloader.Core.Patching { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class PatcherAutoPluginAttribute : Attribute { public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace BetterRagdoll2 { [BepInPlugin("com.github.chrispavs.BetterRagdoll2", "BetterRagdoll2", "1.0.1")] public class Plugin : BaseUnityPlugin { private ConfigEntry<float>? forceConfig; public const string Id = "com.github.chrispavs.BetterRagdoll2"; internal static ManualLogSource Log { get; private set; } public static string Name => "BetterRagdoll2"; public static string Version => "1.0.1"; private void Awake() { Log = ((BaseUnityPlugin)this).Logger; Log.LogInfo((object)("Plugin " + Name + " is loaded!")); forceConfig = ((BaseUnityPlugin)this).Config.Bind<float>("Settings", "Ragdoll Force", 322f, "Force applied to the character when triggering ragdoll."); } private void Update() { //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Character.localCharacter == (Object)null || !Application.isFocused || forceConfig == null) { return; } if (Input.GetKeyDown((KeyCode)289)) { ConfigEntry<float>? obj = forceConfig; obj.Value -= 10f; Debug.Log((object)$"Force decreased to {forceConfig.Value}"); } if (Input.GetKeyDown((KeyCode)290)) { ConfigEntry<float>? obj2 = forceConfig; obj2.Value += 10f; Debug.Log((object)$"Force increased to {forceConfig.Value}"); } if (!Input.GetKeyDown((KeyCode)120) && (Gamepad.current == null || !Gamepad.current.leftShoulder.wasPressedThisFrame)) { return; } Character localCharacter = Character.localCharacter; if (localCharacter.data.fallSeconds > 0f) { Debug.Log((object)"Already in ragdoll – skipping."); return; } Debug.Log((object)"Ragdoll Key pressed"); ((MonoBehaviourPun)localCharacter).photonView.RPC("RPCA_Fall", (RpcTarget)0, new object[1] { 0.5f }); Vector3 avarageVelocity = localCharacter.data.avarageVelocity; if (((Vector3)(ref avarageVelocity)).magnitude < 0.1f) { Debug.Log((object)"Movement too small, no force applied."); return; } Vector3 val = ((Vector3)(ref avarageVelocity)).normalized * forceConfig.Value; localCharacter.AddForce(val, 1f, 1f); Debug.Log((object)$"Force applied: {val}"); } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }
mods/com.github.megalon.peakcinema.dll
Decompiled 2 weeks agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.InputSystem; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("com.github.megalon.peakcinema")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.3.2.0")] [assembly: AssemblyInformationalVersion("0.3.2+457d01ee296d440060b705e16f2198faf0130a4b")] [assembly: AssemblyProduct("com.github.megalon.peakcinema")] [assembly: AssemblyTitle("PeakCinema")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.3.2.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 BepInEx { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class BepInAutoPluginAttribute : Attribute { public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace BepInEx.Preloader.Core.Patching { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class PatcherAutoPluginAttribute : Attribute { public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace PeakCinema { [BepInPlugin("com.github.megalon.peakcinema", "PeakCinema", "0.3.2")] public class Plugin : BaseUnityPlugin { public class PluginModConfig { public readonly ConfigEntry<KeyCode> toggleCinemaCamControlKey; public readonly ConfigEntry<KeyCode> exitCinemaCamKey; public readonly ConfigEntry<KeyCode> keyMoveForward; public readonly ConfigEntry<KeyCode> keyMoveBackward; public readonly ConfigEntry<KeyCode> keyMoveLeft; public readonly ConfigEntry<KeyCode> keyMoveRight; public readonly ConfigEntry<KeyCode> keyMoveUp; public readonly ConfigEntry<KeyCode> keyMoveDown; public readonly ConfigEntry<KeyCode> keyMoveFaster; public readonly ConfigEntry<KeyCode> keySmoothToggle; public PluginModConfig(ConfigFile config) { toggleCinemaCamControlKey = config.Bind<KeyCode>("Keybinds", "Toggle Cinema Cam Control", (KeyCode)284, ""); exitCinemaCamKey = config.Bind<KeyCode>("Keybinds", "Exit Cinema Cam", (KeyCode)27, ""); keyMoveForward = config.Bind<KeyCode>("Keybinds", "Move Forward", (KeyCode)119, ""); keyMoveBackward = config.Bind<KeyCode>("Keybinds", "Move Backward", (KeyCode)115, ""); keyMoveLeft = config.Bind<KeyCode>("Keybinds", "Move Left", (KeyCode)97, ""); keyMoveRight = config.Bind<KeyCode>("Keybinds", "Move Right", (KeyCode)100, ""); keyMoveUp = config.Bind<KeyCode>("Keybinds", "Move Up", (KeyCode)32, ""); keyMoveDown = config.Bind<KeyCode>("Keybinds", "Move Down", (KeyCode)306, ""); keyMoveFaster = config.Bind<KeyCode>("Keybinds", "Move Faster", (KeyCode)304, ""); keySmoothToggle = config.Bind<KeyCode>("Keybinds", "Toggle Camera Smoothing", (KeyCode)301, ""); } } internal static GameObject HUD = null; internal static List<VoiceObscuranceFilter> VoiceFilters = new List<VoiceObscuranceFilter>(); public const string Id = "com.github.megalon.peakcinema"; internal static ManualLogSource Log { get; private set; } = null; internal static PluginModConfig ModConfig { get; private set; } = null; internal static bool CinemaCamActive { get; private set; } internal static Transform? CamTransform { get; private set; } internal static bool CameraWasSpawned { get; private set; } internal static bool Smoothing { get; private set; } = true; internal static float HoldTimer { get; private set; } internal static float InitHoldTimer { get; private set; } = 3f; internal static Vector3 DeathLocation { get; private set; } public static string Name => "PeakCinema"; public static string Version => "0.3.2"; private void Awake() { Log = ((BaseUnityPlugin)this).Logger; Log.LogInfo((object)("Plugin " + Name + " is loaded!")); Harmony.CreateAndPatchAll(typeof(Plugin), (string)null); ModConfig = new PluginModConfig(((BaseUnityPlugin)this).Config); HoldTimer = InitHoldTimer; } [HarmonyPatch(typeof(VoiceObscuranceFilter), "Start")] [HarmonyPostfix] private static void VoiceObscuranceFilter_Start(VoiceObscuranceFilter __instance) { if (CinemaCamActive) { SetVoiceFilterToCinemaCam(__instance); } VoiceFilters.Add(__instance); } [HarmonyPatch(typeof(CinemaCamera), "Start")] [HarmonyPostfix] private static void CinemaCamera_Start(CinemaCamera __instance) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) CamTransform = __instance.cam; CameraWasSpawned = false; HoldTimer = InitHoldTimer; DeathLocation = Vector3.zero; } [HarmonyPatch(typeof(CinemaCamera), "Update")] [HarmonyPrefix] private static bool CinemaCameraFix(CinemaCamera __instance) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0312: 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_031d: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Unknown result type (might be due to invalid IL or missing references) //IL_0331: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_039e: Unknown result type (might be due to invalid IL or missing references) //IL_03d6: Unknown result type (might be due to invalid IL or missing references) //IL_040f: Unknown result type (might be due to invalid IL or missing references) //IL_0447: Unknown result type (might be due to invalid IL or missing references) //IL_0480: Unknown result type (might be due to invalid IL or missing references) //IL_04b8: Unknown result type (might be due to invalid IL or missing references) //IL_04f2: Unknown result type (might be due to invalid IL or missing references) //IL_0502: Unknown result type (might be due to invalid IL or missing references) //IL_051e: Unknown result type (might be due to invalid IL or missing references) //IL_0534: Unknown result type (might be due to invalid IL or missing references) //IL_0549: Unknown result type (might be due to invalid IL or missing references) //IL_0559: Unknown result type (might be due to invalid IL or missing references) //IL_056f: Unknown result type (might be due to invalid IL or missing references) //IL_057f: Unknown result type (might be due to invalid IL or missing references) //IL_0595: Unknown result type (might be due to invalid IL or missing references) //IL_05a5: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)HUD == (Object)null) { HUD = GameObject.Find("Canvas_HUD"); } if (Input.GetKeyDown(ModConfig.exitCinemaCamKey.Value)) { CinemaCamActive = false; __instance.on = false; GameObject hUD = HUD; if (hUD != null) { hUD.SetActive(true); } ((Component)__instance.cam).gameObject.SetActive(false); if ((Object)(object)__instance.fog != (Object)null) { ((Component)__instance.fog).gameObject.SetActive(true); } if ((Object)(object)__instance.oldCam != (Object)null) { ((Component)__instance.oldCam).gameObject.SetActive(true); } foreach (VoiceObscuranceFilter voiceFilter in VoiceFilters) { if (!((Object)(object)voiceFilter == (Object)null)) { voiceFilter.head = ((Component)MainCamera.instance).transform; } } } else if (Input.GetKey(ModConfig.toggleCinemaCamControlKey.Value)) { HoldTimer -= Time.deltaTime; if (HoldTimer <= 0f) { MoveCameraToPlayerPosition(__instance); if (!__instance.on) { __instance.on = true; } HoldTimer = -1f; } } else if (Input.GetKeyUp(ModConfig.toggleCinemaCamControlKey.Value)) { if (!CinemaCamActive) { CinemaCamActive = true; HandleVoiceFilters(); } if (HoldTimer > -1f) { __instance.on = !__instance.on; } HoldTimer = InitHoldTimer; } if (__instance.on) { InputSystem.actions.Disable(); GameObject hUD2 = HUD; if (hUD2 != null) { hUD2.SetActive(false); } __instance.ambience.parent = ((Component)__instance).transform; if (Object.op_Implicit((Object)(object)__instance.fog)) { ((Component)__instance.fog).gameObject.SetActive(false); } if (Object.op_Implicit((Object)(object)__instance.oldCam)) { ((Component)__instance.oldCam).gameObject.SetActive(false); } ((Component)__instance).transform.parent = null; __instance.cam.parent = null; if (!CameraWasSpawned) { MoveCameraToPlayerPosition(__instance); } ((Component)__instance.cam).gameObject.SetActive(true); if (Input.GetKeyDown(ModConfig.keySmoothToggle.Value)) { Smoothing = !Smoothing; } float num = 0f; if (Smoothing) { __instance.vel = Vector3.Lerp(__instance.vel, Vector3.zero, 1f * Time.deltaTime); __instance.rot = Vector3.Lerp(__instance.rot, Vector3.zero, 2.5f * Time.deltaTime); num = (Input.GetKey(ModConfig.keyMoveFaster.Value) ? 0.2f : 0.05f); __instance.rot.y += Input.GetAxis("Mouse X") * num * 0.05f; __instance.rot.x += Input.GetAxis("Mouse Y") * num * 0.05f; } else { __instance.vel = Vector3.zero; __instance.rot = Vector3.zero; num = (Input.GetKey(ModConfig.keyMoveFaster.Value) ? 10f : 5f); __instance.rot.y += Input.GetAxis("Mouse X") * num * 0.1f; __instance.rot.x += Input.GetAxis("Mouse Y") * num * 0.1f; } float num2 = num * Time.deltaTime; if (Input.GetKey(ModConfig.keyMoveRight.Value)) { __instance.vel.x = (Smoothing ? (__instance.vel.x + num2) : num2); } if (Input.GetKey(ModConfig.keyMoveLeft.Value)) { __instance.vel.x = (Smoothing ? (__instance.vel.x - num2) : (0f - num2)); } if (Input.GetKey(ModConfig.keyMoveForward.Value)) { __instance.vel.z = (Smoothing ? (__instance.vel.z + num2) : num2); } if (Input.GetKey(ModConfig.keyMoveBackward.Value)) { __instance.vel.z = (Smoothing ? (__instance.vel.z - num2) : (0f - num2)); } if (Input.GetKey(ModConfig.keyMoveUp.Value)) { __instance.vel.y = (Smoothing ? (__instance.vel.y + num2) : num2); } if (Input.GetKey(ModConfig.keyMoveDown.Value)) { __instance.vel.y = (Smoothing ? (__instance.vel.y - num2) : (0f - num2)); } ((Component)__instance.cam).transform.Rotate(Vector3.up * __instance.rot.y, (Space)0); ((Component)__instance.cam).transform.Rotate(((Component)__instance).transform.right * (0f - __instance.rot.x)); ((Component)__instance.cam).transform.Translate(Vector3.right * __instance.vel.x, (Space)1); ((Component)__instance.cam).transform.Translate(Vector3.forward * __instance.vel.z, (Space)1); ((Component)__instance.cam).transform.Translate(Vector3.up * __instance.vel.y, (Space)0); __instance.t = true; CameraWasSpawned = true; } else { InputSystem.actions.Enable(); } return false; } private static void MoveCameraToPlayerPosition(CinemaCamera __instance) { //IL_006d: 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) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) Character val = Character.AllCharacters.First((Character c) => c.IsLocal); if ((Object)(object)val != (Object)null) { if (val.data.dead) { ((Component)__instance.cam).transform.position = DeathLocation; } else { ((Component)__instance.cam).transform.position = val.refs.animationPositionTransform.position; } Transform transform = ((Component)__instance.cam).transform; transform.position += new Vector3(0f, 1.5f, -2f); } } private static void HandleVoiceFilters() { for (int num = VoiceFilters.Count - 1; num >= 0; num--) { VoiceObscuranceFilter val = VoiceFilters[num]; if ((Object)(object)val == (Object)null) { VoiceFilters.RemoveAt(num); } } foreach (VoiceObscuranceFilter voiceFilter in VoiceFilters) { if (!((Object)(object)voiceFilter == (Object)null)) { SetVoiceFilterToCinemaCam(voiceFilter); } } Log.LogInfo((object)$"Adjusted {VoiceFilters.Count} voice filters!"); } private static void SetVoiceFilterToCinemaCam(VoiceObscuranceFilter filter) { if (!((Object)(object)CamTransform == (Object)null) && !((Object)(object)filter == (Object)null)) { filter.head = CamTransform; } } [HarmonyPatch(typeof(AmbienceAudio), "FixedUpdate")] private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Expected O, but got Unknown //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Expected O, but got Unknown //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(instructions); MethodInfo methodInfo = AccessTools.Method(typeof(Component), "GetComponent", (Type[])null, (Type[])null).MakeGenericMethod(typeof(CharacterData)); for (int i = 0; i < list.Count - 4; i++) { if (list[i].opcode == OpCodes.Ldarg_0 && CodeInstructionExtensions.Calls(list[i + 1], AccessTools.PropertyGetter(typeof(Component), "transform")) && CodeInstructionExtensions.Calls(list[i + 2], AccessTools.PropertyGetter(typeof(Transform), "root")) && CodeInstructionExtensions.Calls(list[i + 3], methodInfo) && list[i + 4].opcode == OpCodes.Stloc_0) { list.RemoveRange(i, 5); list.InsertRange(i, new <>z__ReadOnlyArray<CodeInstruction>((CodeInstruction[])(object)new CodeInstruction[3] { new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(Character), "localCharacter")), new CodeInstruction(OpCodes.Ldfld, (object)AccessTools.Field(typeof(Character), "data")), new CodeInstruction(OpCodes.Stloc_0, (object)null) })); break; } } return list; } [HarmonyPatch(typeof(Character), "RPCA_Die")] [HarmonyPrefix] private static bool Character_RPCA_Die(Character __instance) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (!__instance.IsLocal) { return true; } DeathLocation = __instance.refs.animationPositionTransform.position; return true; } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } } [CompilerGenerated] internal sealed class <>z__ReadOnlyArray<T> : IEnumerable, ICollection, IList, IEnumerable<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection<T>, IList<T> { int ICollection.Count => _items.Length; bool ICollection.IsSynchronized => false; object ICollection.SyncRoot => this; object IList.this[int index] { get { return _items[index]; } set { throw new NotSupportedException(); } } bool IList.IsFixedSize => true; bool IList.IsReadOnly => true; int IReadOnlyCollection<T>.Count => _items.Length; T IReadOnlyList<T>.this[int index] => _items[index]; int ICollection<T>.Count => _items.Length; bool ICollection<T>.IsReadOnly => true; T IList<T>.this[int index] { get { return _items[index]; } set { throw new NotSupportedException(); } } public <>z__ReadOnlyArray(T[] items) { _items = items; } IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)_items).GetEnumerator(); } void ICollection.CopyTo(Array array, int index) { ((ICollection)_items).CopyTo(array, index); } int IList.Add(object value) { throw new NotSupportedException(); } void IList.Clear() { throw new NotSupportedException(); } bool IList.Contains(object value) { return ((IList)_items).Contains(value); } int IList.IndexOf(object value) { return ((IList)_items).IndexOf(value); } void IList.Insert(int index, object value) { throw new NotSupportedException(); } void IList.Remove(object value) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } IEnumerator<T> IEnumerable<T>.GetEnumerator() { return ((IEnumerable<T>)_items).GetEnumerator(); } void ICollection<T>.Add(T item) { throw new NotSupportedException(); } void ICollection<T>.Clear() { throw new NotSupportedException(); } bool ICollection<T>.Contains(T item) { return ((ICollection<T>)_items).Contains(item); } void ICollection<T>.CopyTo(T[] array, int arrayIndex) { ((ICollection<T>)_items).CopyTo(array, arrayIndex); } bool ICollection<T>.Remove(T item) { throw new NotSupportedException(); } int IList<T>.IndexOf(T item) { return ((IList<T>)_items).IndexOf(item); } void IList<T>.Insert(int index, T item) { throw new NotSupportedException(); } void IList<T>.RemoveAt(int index) { throw new NotSupportedException(); } }
mods/com.github.PEAKModding.PEAKLib.Core.dll
Decompiled 2 weeks agousing System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; 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 BepInEx; using BepInEx.Bootstrap; using BepInEx.Logging; using Microsoft.CodeAnalysis; using MonoDetour; using MonoDetour.Cil; using MonoDetour.DetourTypes; using MonoDetour.HookGen; using MonoDetour.Reflection.Unspeakable; using MonoMod.Utils; using On.GameHandler; using On.LoadingScreenHandler; using PEAKLib.Core.Extensions; using PEAKLib.Core.UnityEditor; using Photon.Pun; using Photon.Realtime; using TMPro; using UnityEngine; using Zorro.Core; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("PEAKModding, Hamunii, Boxofbiscuits97")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Core module of the PEAKLib community API for the game PEAK.")] [assembly: AssemblyFileVersion("1.2.0.0")] [assembly: AssemblyInformationalVersion("1.2.0+e6bed058b9a578ac961d3a9b39267b30fb94048e")] [assembly: AssemblyProduct("com.github.PEAKModding.PEAKLib.Core")] [assembly: AssemblyTitle("PEAKLib.Core")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.2.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 On.LoadingScreenHandler { internal static class Awake { public delegate void PrefixSignature(LoadingScreenHandler self); public delegate ReturnFlow ControlFlowPrefixSignature(LoadingScreenHandler self); public delegate void PostfixSignature(LoadingScreenHandler self); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook ControlFlowPrefix(ControlFlowPrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(LoadingScreenHandler); MethodInfo method = typeFromHandle.GetMethod("Awake", (BindingFlags)(-1), null, Array.Empty<Type>(), null); if ((object)method == null) { throw new MissingMethodException("LoadingScreenHandler", "Awake"); } return method; } } internal static class LoadSceneProcess { public delegate void PrefixSignature(LoadingScreenHandler self, ref string sceneName, ref bool networked, ref bool yieldForCharacterSpawn, ref float extraYieldTimeOnEnd); public delegate ReturnFlow ControlFlowPrefixSignature(LoadingScreenHandler self, ref string sceneName, ref bool networked, ref bool yieldForCharacterSpawn, ref float extraYieldTimeOnEnd, ref IEnumerator returnValue); public delegate void PostfixSignature(LoadingScreenHandler self, ref string sceneName, ref bool networked, ref bool yieldForCharacterSpawn, ref float extraYieldTimeOnEnd, ref IEnumerator returnValue); public delegate void PrefixMoveNextSignature(SpeakableEnumerator<object, LoadingScreenHandler> self); public delegate ReturnFlow ControlFlowPrefixMoveNextSignature(SpeakableEnumerator<object, LoadingScreenHandler> self, ref bool continueEnumeration); public delegate void PostfixMoveNextSignature(SpeakableEnumerator<object, LoadingScreenHandler> self, ref bool continueEnumeration); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook ControlFlowPrefix(ControlFlowPrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MonoDetourHook PrefixMoveNext(PrefixMoveNextSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>((MethodBase)StateMachineTarget(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook ControlFlowPrefixMoveNext(ControlFlowPrefixMoveNextSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>((MethodBase)StateMachineTarget(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook PostfixMoveNext(PostfixMoveNextSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>((MethodBase)StateMachineTarget(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook ILHookMoveNext(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook((MethodBase)StateMachineTarget(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(LoadingScreenHandler); MethodInfo method = typeFromHandle.GetMethod("LoadSceneProcess", (BindingFlags)(-1), null, new Type[4] { typeof(string), typeof(bool), typeof(bool), typeof(float) }, null); if ((object)method == null) { throw new MissingMethodException("LoadingScreenHandler", "LoadSceneProcess"); } return method; } public static MethodInfo StateMachineTarget() { return Extensions.GetStateMachineTarget((MethodInfo)Target()); } } internal static class get_loading { } internal static class set_loading { } internal static class GetLoadingScreenPrefab { } internal static class Load { } internal static class LoadingRoutine { } internal static class LoadSceneProcessNetworked { } internal static class LoadSceneProcessOffline { } internal static class _ctor { } internal static class _LoadSceneProcess_d__11 { internal static class _ctor { } internal static class System_IDisposable_Dispose { } internal static class MoveNext { } internal static class System_Collections_Generic_IEnumerator_System_Object__get_Current { } internal static class System_Collections_IEnumerator_Reset { } internal static class System_Collections_IEnumerator_get_Current { } } internal static class _LoadSceneProcessNetworked_d__12 { internal static class _ctor { } internal static class System_IDisposable_Dispose { } internal static class MoveNext { } internal static class System_Collections_Generic_IEnumerator_System_Object__get_Current { } internal static class System_Collections_IEnumerator_Reset { } internal static class System_Collections_IEnumerator_get_Current { } } internal static class _LoadSceneProcessOffline_d__13 { internal static class _ctor { } internal static class System_IDisposable_Dispose { } internal static class MoveNext { } internal static class System_Collections_Generic_IEnumerator_System_Object__get_Current { } internal static class System_Collections_IEnumerator_Reset { } internal static class System_Collections_IEnumerator_get_Current { } } internal static class _LoadingRoutine_d__10 { internal static class _ctor { } internal static class System_IDisposable_Dispose { } internal static class MoveNext { } internal static class System_Collections_Generic_IEnumerator_System_Object__get_Current { } internal static class System_Collections_IEnumerator_Reset { } internal static class System_Collections_IEnumerator_get_Current { } } } namespace On.GameHandler { internal static class Awake { public delegate void PrefixSignature(GameHandler self); public delegate void PostfixSignature(GameHandler self); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(GameHandler); MethodInfo method = typeFromHandle.GetMethod("Awake", (BindingFlags)(-1), null, Array.Empty<Type>(), null); if ((object)method == null) { throw new MissingMethodException("GameHandler", "Awake"); } return method; } } internal static class Initialize { public delegate void PrefixSignature(GameHandler self); public delegate void PostfixSignature(GameHandler self); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(GameHandler); MethodInfo method = typeFromHandle.GetMethod("Initialize", (BindingFlags)(-1), null, Array.Empty<Type>(), null); if ((object)method == null) { throw new MissingMethodException("GameHandler", "Initialize"); } return method; } } internal static class get_Instance { } internal static class get_SettingsHandler { } internal static class set_SettingsHandler { } internal static class get_Initialized { } internal static class OnDestroy { } internal static class WaitForInitialization { } internal static class ClearAllStatuses { } internal static class Update { } internal static class _ctor { } internal static class __c { internal static class _ctor { } } internal static class __c__DisplayClass14_0 { internal static class _ctor { } } internal static class _Awake_d__14 { internal static class _ctor { } internal static class MoveNext { } internal static class SetStateMachine { } } internal static class _WaitForInitialization_d__17 { internal static class _ctor { } internal static class MoveNext { } internal static class SetStateMachine { } } } namespace MonoDetour.HookGen { internal static class DefaultMonoDetourManager { internal static MonoDetourManager Instance { get; } = New(); internal static MonoDetourManager New() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown return new MonoDetourManager(typeof(DefaultMonoDetourManager).Assembly.GetName().Name); } } [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class, AllowMultiple = true, Inherited = false)] internal class MonoDetourTargetsAttribute : Attribute, IMonoDetourTargets { public Type? TargetType { get; } public bool IncludeNestedTypes { get; set; } public bool DistinguishOverloadsByName { get; set; } public string[]? Members { get; set; } public string[]? MemberNamePrefixes { get; set; } public string[]? MemberNameSuffixes { get; set; } public bool GenerateControlFlowVariants { get; set; } public MonoDetourTargetsAttribute(Type? targetType = null) { TargetType = targetType; IncludeNestedTypes = true; base..ctor(); } } } namespace BepInEx { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class BepInAutoPluginAttribute : Attribute { public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace BepInEx.Preloader.Core.Patching { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class PatcherAutoPluginAttribute : Attribute { public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace PEAKLib.Core { public static class BundleLoader { private class LoadOperation { public enum State { LoadingBundle, LoadingContent } public string Path { get; } public DateTime StartTime { get; } = DateTime.Now; public State CurrentState { get; set; } public bool LoadContents { get; } public ModDefinition? ModDefinition { get; } public Action<PeakBundle>? OnBundleLoaded { get; } public AssetBundleCreateRequest BundleRequest { get; } public TimeSpan ElapsedTime => DateTime.Now - StartTime; public string FileName => System.IO.Path.GetFileNameWithoutExtension(Path); internal LoadOperation(string path, Action<PeakBundle>? onBundleLoaded = null, bool loadContents = true, ModDefinition? modDefinition = null) { Path = path; OnBundleLoaded = onBundleLoaded; LoadContents = loadContents; ModDefinition = modDefinition; BundleRequest = AssetBundle.LoadFromFileAsync(path); ((AsyncOperation)BundleRequest).completed += OnLoaded; } private void OnLoaded(AsyncOperation operation) { ((MonoBehaviour)CorePlugin.Instance).StartCoroutine(FinishLoadOperation(this)); } private static IEnumerator FinishLoadOperation(LoadOperation operation) { LoadOperation operation2 = operation; AssetBundle bundle = operation2.BundleRequest.assetBundle; if ((Object)(object)bundle == (Object)null) { CorePlugin.Log.LogError((object)("Failed to load bundle " + operation2.FileName + "!")); Finish(); yield break; } operation2.CurrentState = State.LoadingContent; AssetBundleRequest assetRequest = bundle.LoadAllAssetsAsync<ScriptableObject>(); yield return assetRequest; Object[] allAssets = assetRequest.allAssets; List<ModDefinition> list; try { list = (from x in allAssets.OfType<UnityModDefinition>() select x.Resolve()).ToList(); } catch (Exception arg) { CorePlugin.Log.LogError((object)$"Failed to Resolve ModDefinition: {arg}"); Finish(); yield break; } ModDefinition modDefinition = operation2.ModDefinition; if (modDefinition != null) { list.Add(modDefinition); } int count = list.Count; if (count <= 1) { if (count == 0) { CorePlugin.Log.LogError((object)("Bundle " + operation2.FileName + " contains no mods!")); Finish(); yield break; } ModDefinition modDefinition2 = list[0]; IEnumerable<IContent> enumerable = allAssets.OfType<IContent>(); foreach (IContent item in enumerable) { modDefinition2.Content.Add(item); } if (operation2.LoadContents) { foreach (IContent item2 in enumerable) { try { modDefinition2.Register(item2); } catch (Exception ex) { try { CorePlugin.Log.LogError((object)$"Failed to register '{item2.Name}' ({item2.GetType().Name}) from bundle '{operation2.FileName}' ({modDefinition2.Id}): {ex}"); } catch (Exception arg2) { CorePlugin.Log.LogError((object)$"Failed to print error message. This should NOT throw. {arg2}"); } } } } PeakBundle t = new PeakBundle(bundle, modDefinition2); operation2.OnBundleLoaded?.SafeInvoke(t); BundleLoader.OnBundleLoaded?.SafeInvoke(t); CorePlugin.Log.LogInfo((object)$"Loaded bundle {operation2.FileName} in {operation2.ElapsedTime.TotalSeconds:N1}s"); Finish(); } else { CorePlugin.Log.LogError((object)("Bundle " + operation2.FileName + " contains more than one mod!")); Finish(); } void Finish() { _operations.Remove(operation2); InvokeOnAllBundlesLoadedIfShould(); } } } private static bool calledOnBundleLoaded; private static bool bundleLoadingWindowClosed; private static readonly List<LoadOperation> _operations = new List<LoadOperation>(); public static event Action? OnAllBundlesLoaded; public static event Action<PeakBundle>? OnBundleLoaded; private static void InvokeOnAllBundlesLoadedIfShould() { if (_operations.Count == 0 && bundleLoadingWindowClosed && !calledOnBundleLoaded) { calledOnBundleLoaded = true; BundleLoader.OnAllBundlesLoaded?.SafeInvoke(); } } internal static void CloseBundleLoadingWindow() { bundleLoadingWindowClosed = true; InvokeOnAllBundlesLoadedIfShould(); } private static void AddOperation(LoadOperation operation) { CorePlugin.Log.LogInfo((object)("Loading bundle at '" + operation.Path + "'...")); if (bundleLoadingWindowClosed) { CorePlugin.Log.LogWarning((object)("The bundle loading window has passed. Set your asset bundle to load in your plugin's Awake method " + $"for the best chances of everything working properly.\n{new StackTrace()}")); } _operations.Add(operation); } internal static void LoadAllBundles(string root, string withExtension) { CorePlugin.Log.LogInfo((object)("Loading all bundles with extension " + withExtension + " from root " + root)); string[] files = Directory.GetFiles(root, "*" + withExtension, SearchOption.AllDirectories); string[] array = files; foreach (string path in array) { LoadBundleAndContentsFromPath(path); } } public static void LoadBundleWithName(this BaseUnityPlugin baseUnityPlugin, string fileName, Action<PeakBundle> onLoaded) { baseUnityPlugin.LoadBundleWithNameInternal(fileName, onLoaded, loadContents: false); } public static void LoadBundleAndContentsWithName(this BaseUnityPlugin baseUnityPlugin, string fileName, Action<PeakBundle> onLoaded) { baseUnityPlugin.LoadBundleWithNameInternal(fileName, onLoaded, loadContents: true); } private static void LoadBundleWithNameInternal(this BaseUnityPlugin baseUnityPlugin, string fileName, Action<PeakBundle> onLoaded, bool loadContents) { ThrowHelper.ThrowIfArgumentNull<BaseUnityPlugin>(baseUnityPlugin, "baseUnityPlugin"); ThrowHelper.ThrowIfArgumentNullOrWhiteSpace(fileName, "fileName"); ThrowHelper.ThrowIfArgumentNull(onLoaded, "onLoaded"); string directoryName = Path.GetDirectoryName(baseUnityPlugin.Info.Location); string[] files = Directory.GetFiles(directoryName, fileName, SearchOption.AllDirectories); ModDefinition orCreate = ModDefinition.GetOrCreate(baseUnityPlugin.Info); string[] array = files; foreach (string path in array) { AddOperation(new LoadOperation(path, onLoaded, loadContents, orCreate)); } } public static void LoadBundleFromPath(string path, Action<PeakBundle> onLoaded, ModDefinition? mod = null) { ThrowHelper.ThrowIfArgumentNullOrWhiteSpace(path, "path"); ThrowHelper.ThrowIfArgumentNull(onLoaded, "onLoaded"); AddOperation(new LoadOperation(path, onLoaded, loadContents: false, mod)); } public static void LoadBundleAndContentsFromPath(string path, Action<PeakBundle>? onLoaded = null, ModDefinition? mod = null) { ThrowHelper.ThrowIfArgumentNullOrWhiteSpace(path, "path"); AddOperation(new LoadOperation(path, onLoaded, loadContents: true, mod)); } internal static IEnumerator LoadOperationsDeadlineWait(MonoBehaviour behaviour) { (TMP_Text, Action)? tuple = SetupLoadingUI(); if (tuple.HasValue) { (TMP_Text, Action) valueOrDefault = tuple.GetValueOrDefault(); (TMP_Text, Action) tuple2 = valueOrDefault; TMP_Text text = tuple2.Item1; Action disableLoadingUI = tuple2.Item2; float startTime = Time.time; float lastUpdate = Time.time; while (_operations.Count > 0) { if (Time.time - lastUpdate <= 1f) { yield return null; } if (Time.time - startTime > 3f) { ((Component)text).gameObject.SetActive(true); } lastUpdate = Time.time; string arg = ((_operations.Count == 1) ? "bundle" : "bundles"); text.text = $"PEAKLib: Waiting for {_operations.Count} {arg} to load..."; foreach (LoadOperation operation in _operations) { string text2 = $"Loading {operation.FileName}: {operation.CurrentState}"; float? num = ((operation.CurrentState != 0) ? null : new float?(((AsyncOperation)operation.BundleRequest).progress)); float? num2 = num; if (num2.HasValue) { text2 += $" {num2.Value:P0}"; } CorePlugin.Log.LogDebug((object)text2); } yield return null; } disableLoadingUI(); CorePlugin.Log.LogInfo((object)"Bundle loading screen finished."); } else { CorePlugin.Log.LogError((object)"Loading UI failed!"); while (_operations.Count > 0) { yield return null; } } } private static (TMP_Text, Action)? SetupLoadingUI() { //IL_00d5: 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) GameObject obj = GameObject.Find("LoadingScreenSimple(Clone)"); Canvas val = ((obj != null) ? obj.GetComponent<Canvas>() : null); if ((Object)(object)val == (Object)null) { CorePlugin.Log.LogError((object)"Loading UI Canvas not found!"); return null; } Transform val2 = TransformExtensions.FindChildRecursive(((Component)val).transform, "LoadingText"); if ((Object)(object)val2 == (Object)null) { CorePlugin.Log.LogError((object)"Loading UI 'LoadingText' transform not found!"); return null; } GameObject gameObject = ((Component)val2).gameObject; GameObject textObj = Object.Instantiate<GameObject>(gameObject, gameObject.transform.parent, true); ((Object)textObj).name = "PEAKLib Loading Text"; TextMeshProUGUI text = textObj.GetComponent<TextMeshProUGUI>(); ((TMP_Text)text).text = ""; RectTransform component = textObj.GetComponent<RectTransform>(); component.anchoredPosition = new Vector2(component.anchoredPosition.x, 300f); textObj.SetActive(false); (TextMeshProUGUI, Action) tuple = (text, delegate { ((TMP_Text)text).text = "PEAKLib: All bundles loaded!"; ((MonoBehaviour)CorePlugin.Instance).StartCoroutine(WaitAndDisableText(textObj)); }); return ((TMP_Text)(object)tuple.Item1, tuple.Item2); } private static IEnumerator WaitAndDisableText(GameObject textObj) { yield return (object)new WaitForSeconds(1f); if (!((Object)(object)textObj == (Object)null)) { textObj.SetActive(false); } } } public static class ContentRegistry { internal static readonly Dictionary<IContent, IRegisteredContent> s_RegisteredContent = new Dictionary<IContent, IRegisteredContent>(); public static RegisteredContent<T> Register<T>(T modContent, ModDefinition owner) where T : IContent<T> { return new RegisteredContent<T>(modContent, owner); } public static bool IsRegistered(this IContent modContent) { return s_RegisteredContent.ContainsKey(modContent.Resolve()); } public static bool TryGetRegisteredContent<T>(this T modContent, [NotNullWhen(true)] out RegisteredContent<T>? registeredContent) where T : IContent<T> { registeredContent = null; if (!s_RegisteredContent.TryGetValue(modContent, out IRegisteredContent value)) { return false; } registeredContent = (RegisteredContent<T>)value; return true; } public static bool TryResolveAndGetRegisteredContent<T>(this T modContent, [NotNullWhen(true)] out IRegisteredContent? registeredContent) where T : IContent { registeredContent = null; if (!s_RegisteredContent.TryGetValue(modContent.Resolve(), out IRegisteredContent value)) { return false; } registeredContent = value; return true; } } internal class CustomPrefabPool : IPunPrefabPool { internal readonly Dictionary<string, GameObject> idToGameObject = new Dictionary<string, GameObject>(); internal readonly Dictionary<GameObject, string> gameObjectToId = new Dictionary<GameObject, string>(); private DefaultPool? _defaultPool; public DefaultPool DefaultPool { get { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown if (_defaultPool == null) { _defaultPool = new DefaultPool(); } return _defaultPool; } set { if (value != null) { _defaultPool = value; } } } internal CustomPrefabPool() { } public bool TryRegisterPrefab(string prefabId, GameObject prefab) { prefabId = ThrowHelper.ThrowIfArgumentNullOrWhiteSpace(prefabId, "prefabId"); prefab = ThrowHelper.ThrowIfArgumentNull<GameObject>(prefab, "prefab"); if (HasPrefab(prefabId)) { CorePlugin.Log.LogError((object)("CustomPrefabPool: failed to register network prefab \"" + prefabId + "\". Prefab already exists in Resources with the same prefab id.")); return false; } if (idToGameObject.ContainsKey(prefabId)) { CorePlugin.Log.LogError((object)("CustomPrefabPool: failed to register network prefab \"" + prefabId + "\". There is already a prefab registered with the same prefab id.")); return false; } idToGameObject.Add(prefabId, prefab); gameObjectToId.Add(prefab, prefabId); CorePlugin.Log.LogDebug((object)("CustomPrefabPool: registered network prefab \"" + prefabId + "\"")); return true; } public bool HasPrefab(GameObject prefab) { return idToGameObject.ContainsValue(prefab); } public bool HasPrefab(string prefabId) { GameObject prefab; return TryGetPrefab(prefabId, out prefab); } public bool TryGetPrefabId(GameObject prefab, [NotNullWhen(true)] out string? id) { return gameObjectToId.TryGetValue(prefab, out id); } public bool TryGetPrefab(string prefabId, [NotNullWhen(true)] out GameObject? prefab) { prefabId = ThrowHelper.ThrowIfArgumentNullOrWhiteSpace(prefabId, "prefabId"); if (idToGameObject.TryGetValue(prefabId, out prefab)) { return true; } prefab = Resources.Load<GameObject>(prefabId); return (Object)(object)prefab != (Object)null; } public GameObject? Instantiate(string prefabId, Vector3 position, Quaternion rotation) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) prefabId = ThrowHelper.ThrowIfArgumentNullOrWhiteSpace(prefabId, "prefabId"); GameObject val; if (!idToGameObject.TryGetValue(prefabId, out GameObject value)) { val = DefaultPool.Instantiate(prefabId, position, rotation); if ((Object)(object)val == (Object)null) { CorePlugin.Log.LogError((object)("CustomPrefabPool: failed to spawn network prefab \"" + prefabId + "\". GameObject is null.")); } return val; } bool activeSelf = value.activeSelf; if (activeSelf) { value.SetActive(false); } val = Object.Instantiate<GameObject>(value, position, rotation); if (activeSelf) { value.SetActive(true); } CorePlugin.Log.LogInfo((object)$"CustomPrefabPool: spawned network prefab \"{prefabId}\" at position {position}, rotation {((Quaternion)(ref rotation)).eulerAngles}"); return val; } public void Destroy(GameObject gameObject) { Object.Destroy((Object)(object)gameObject); } } public interface IContent<T> : IContent where T : IContent<T> { new RegisteredContent<T> Register(ModDefinition owner); } public interface IContent { string Name { get; } IRegisteredContent Register(ModDefinition owner); IContent Resolve(); } public interface IModDefinitionResolvable { ModDefinition Resolve(); } public class ModDefinition : IModDefinitionResolvable { internal HashSet<IRegisteredContent> registeredContent = new HashSet<IRegisteredContent>(); private static readonly Dictionary<string, ModDefinition> s_guidToMod = new Dictionary<string, ModDefinition>(); public string Id { get; } public string Name { get; } public Version Version { get; } public HashSet<IContent> Content { get; } = new HashSet<IContent>(); public IEnumerable<IRegisteredContent> RegisteredContent => registeredContent; private ModDefinition(string id, string name, Version version) { Id = ThrowHelper.ThrowIfArgumentNull(id, "id"); Name = ThrowHelper.ThrowIfArgumentNull(name, "name"); Version = ThrowHelper.ThrowIfArgumentNull(version, "version"); } public static ModDefinition GetOrCreate(PluginInfo pluginInfo) { return GetOrCreate(pluginInfo.Metadata); } public static ModDefinition GetOrCreate(BepInPlugin bepInPlugin) { return GetOrCreate(bepInPlugin.GUID, bepInPlugin.Name, bepInPlugin.Version); } public static ModDefinition GetOrCreate(string id, string name, Version version) { if (s_guidToMod.TryGetValue(id, out ModDefinition value)) { return value; } value = new ModDefinition(id, name, version); s_guidToMod.Add(id, value); return value; } public static bool TryGetMod(string id, [NotNullWhen(true)] out ModDefinition? modDefinition) { return s_guidToMod.TryGetValue(id, out modDefinition); } public void RegisterContent() { foreach (IContent item in Content) { if (!item.IsRegistered()) { try { item.Register(this); } catch (Exception ex) { CorePlugin.Log.LogError((object)ex); } } } } public RegisteredContent<T> Register<T>(T content) where T : IContent<T> { return content.Register(this); } public IRegisteredContent Register(IContent content) { return content.Register(this); } public ModDefinition Resolve() { return this; } public override int GetHashCode() { return Id.GetHashCode(); } } public static class Networking { internal static readonly HashSet<string> hostPluginGuids = new HashSet<string>(); private static readonly Dictionary<string, (Action HasPlugin, Action NoPlugin)> s_OnHasPluginCallbacks = new Dictionary<string, (Action, Action)>(); internal static NetworkManager? s_NetworkManager; public static IReadOnlyCollection<string> HostPluginGuids => hostPluginGuids; public static void AddHostHasPluginListeners(string pluginGuid, Action onHasPlugin, Action onNoPlugin) { ThrowHelper.ThrowIfArgumentNull(pluginGuid, "pluginGuid"); ThrowHelper.ThrowIfArgumentNull(onHasPlugin, "onHasPlugin"); ThrowHelper.ThrowIfArgumentNull(onNoPlugin, "onNoPlugin"); if (s_OnHasPluginCallbacks.TryGetValue(pluginGuid, out (Action, Action) value)) { ref Action item = ref value.Item1; item = (Action)Delegate.Combine(item, onHasPlugin); ref Action item2 = ref value.Item2; item2 = (Action)Delegate.Combine(item2, onNoPlugin); } else { s_OnHasPluginCallbacks.Add(pluginGuid, (onHasPlugin, onNoPlugin)); } } internal static void InvokeGuidCallbacks() { foreach (KeyValuePair<string, (Action, Action)> s_OnHasPluginCallback in s_OnHasPluginCallbacks) { if (hostPluginGuids.Contains(s_OnHasPluginCallback.Key)) { CorePlugin.Log.LogDebug((object)$"Host has plugin with guid: {s_OnHasPluginCallback}"); s_OnHasPluginCallback.Value.Item1.SafeInvoke(); } else { CorePlugin.Log.LogDebug((object)$"Host does not have plugin with guid: {s_OnHasPluginCallback}"); s_OnHasPluginCallback.Value.Item2.SafeInvoke(); } } } } internal class NetworkManager : MonoBehaviourPunCallbacks { private Character? character; private void Awake() { CorePlugin.Log.LogDebug((object)"Loaded Network Component"); character = ((Component)this).GetComponent<Character>(); if ((Object)(object)character == (Object)null) { CorePlugin.Log.LogError((object)"Could not find reference to local character!"); } else { CallRPC("GetHostPluginsRPC", (RpcTarget)2); } } [PunRPC] private void GetHostPluginsRPC() { if (PhotonNetwork.IsMasterClient) { List<string> list = new List<string>(); list.AddRange(Chainloader.PluginInfos.Select((KeyValuePair<string, PluginInfo> x) => x.Value.Metadata.GUID)); string[] array = list.ToArray(); object[] parameters = array; CallRPC("ReceivePluginsFromHostRPC", (RpcTarget)0, parameters); } } [PunRPC] private void ReceivePluginsFromHostRPC(string[] guids) { CorePlugin.Log.LogDebug((object)"Received new Plugin guid list from host"); Networking.hostPluginGuids.Clear(); foreach (string text in guids) { CorePlugin.Log.LogDebug((object)("Received Plugin guid from host: " + text)); Networking.hostPluginGuids.Add(text); } Networking.InvokeGuidCallbacks(); } private void CallRPC(string methodName, RpcTarget target, params object[] parameters) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)character == (Object)null) { CorePlugin.Log.LogError((object)"Could not find reference to local character!"); } else { character.view.RPC(methodName, target, parameters); } } public override void OnMasterClientSwitched(Player newMasterClient) { CorePlugin.Log.LogDebug((object)("Master Client Switched to player: " + newMasterClient.NickName)); if (PhotonNetwork.IsMasterClient) { CallRPC("ReceivePluginsFromHostRPC", (RpcTarget)2); } } } public static class NetworkPrefabManager { private static CustomPrefabPool? _customPrefabPool; internal static CustomPrefabPool PEAKLibPrefabPool { get { if (_customPrefabPool == null) { _customPrefabPool = new CustomPrefabPool(); } return _customPrefabPool; } private set { _customPrefabPool = value; } } internal static void Initialize() { if (PhotonNetwork.PrefabPool is CustomPrefabPool) { CorePlugin.Log.LogWarning((object)"NetworkPrefabs failed to initialize. PhotonNetwork.PrefabPool is already a CustomPrefabPool."); return; } CorePlugin.Log.LogInfo((object)"Initializing NetworkPrefabs."); CorePlugin.Log.LogDebug((object)$"PhotonNetwork.PrefabPool = {((object)PhotonNetwork.PrefabPool).GetType()}"); IPunPrefabPool prefabPool = PhotonNetwork.PrefabPool; DefaultPool val = (DefaultPool)(object)((prefabPool is DefaultPool) ? prefabPool : null); if (val != null) { PEAKLibPrefabPool.DefaultPool = val; } else if (!(PhotonNetwork.PrefabPool is CustomPrefabPool)) { CorePlugin.Log.LogWarning((object)$"PhotonNetwork has an unknown prefab pool assigned. PhotonNetwork.PrefabPool = {((object)PhotonNetwork.PrefabPool).GetType()}"); } PhotonNetwork.PrefabPool = (IPunPrefabPool)(object)PEAKLibPrefabPool; CorePlugin.Log.LogInfo((object)"Replaced PhotonNetwork.PrefabPool with CustomPrefabPool."); CorePlugin.Log.LogDebug((object)$"PhotonNetwork.PrefabPool = {((object)PhotonNetwork.PrefabPool).GetType()}"); CorePlugin.Log.LogInfo((object)"Finished initializing NetworkPrefabs."); } public static void RegisterNetworkPrefab(ModDefinition mod, GameObject prefab) { RegisterNetworkPrefab(mod, "", prefab); } public static void RegisterNetworkPrefab(ModDefinition mod, string folder, GameObject prefab) { ThrowHelper.ThrowIfArgumentNull(mod, "mod"); ((Object)prefab).name = mod.Id + ":" + ((Object)prefab).name; RegisterNetworkPrefab(folder + ((Object)prefab).name, prefab); } public static void RegisterNetworkPrefab(string prefabId, GameObject prefab) { if (PEAKLibPrefabPool.TryRegisterPrefab(prefabId, prefab)) { return; } throw new Exception("Failed to register network prefab!"); } public static bool TryRegisterNetworkPrefab(string prefabId, GameObject prefab) { return PEAKLibPrefabPool.TryRegisterPrefab(prefabId, prefab); } public static bool HasNetworkPrefab(string prefabId) { return PEAKLibPrefabPool.HasPrefab(prefabId); } public static bool TryGetNetworkPrefab(string prefabId, [NotNullWhen(true)] out GameObject? prefab) { return PEAKLibPrefabPool.TryGetPrefab(prefabId, out prefab); } public static GameObject SpawnNetworkPrefab(string prefabId, Vector3 position, Quaternion rotation, byte group = 0, object[]? data = null) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) ThrowHelper.ThrowIfArgumentNullOrWhiteSpace(prefabId, "prefabId"); if (!HasNetworkPrefab(prefabId)) { throw new Exception("Failed to spawn network prefab \"" + prefabId + "\". PrefabId is not registered as a network prefab."); } if (!PhotonNetwork.IsMasterClient) { throw new Exception("Failed to spawn network prefab \"" + prefabId + "\". You are not the host."); } return PhotonNetwork.InstantiateRoomObject(prefabId, position, rotation, group, data); } } public sealed class PeakBundle { private readonly AssetBundle bundle; public ModDefinition Mod { get; } internal PeakBundle(AssetBundle assetBundle, ModDefinition modDefinition) { bundle = ThrowHelper.ThrowIfArgumentNull<AssetBundle>(assetBundle, "assetBundle"); Mod = ThrowHelper.ThrowIfArgumentNull(modDefinition, "modDefinition"); } public bool Contains(string name) { return bundle.Contains(name); } public Object LoadAsset(string name) { return bundle.LoadAsset(name); } public T LoadAsset<T>(string name) where T : Object { return bundle.LoadAsset<T>(name); } public AssetBundleRequest LoadAssetAsync(string name) { return bundle.LoadAssetAsync(name); } public AssetBundleRequest LoadAssetAsync<T>(string name) { return bundle.LoadAssetAsync<T>(name); } public Object[] LoadAssetWithSubAssets(string name) { return bundle.LoadAssetWithSubAssets(name); } public T[] LoadAssetWithSubAssets<T>(string name) where T : Object { return bundle.LoadAssetWithSubAssets<T>(name); } public AssetBundleRequest LoadAssetWithSubAssetsAsync(string name) { return bundle.LoadAssetWithSubAssetsAsync(name); } public AssetBundleRequest LoadAssetWithSubAssetsAsync<T>(string name) { return bundle.LoadAssetWithSubAssetsAsync<T>(name); } public Object[] LoadAllAssets() { return bundle.LoadAllAssets(); } public T[] LoadAllAssets<T>() where T : Object { return bundle.LoadAllAssets<T>(); } public AssetBundleRequest LoadAllAssetsAsync() { return bundle.LoadAllAssetsAsync(); } public AssetBundleRequest LoadAllAssetsAsync<T>() { return bundle.LoadAllAssetsAsync<T>(); } public string[] GetAllAssetNames() { return bundle.GetAllAssetNames(); } public string[] GetAllScenePaths() { return bundle.GetAllScenePaths(); } } [BepInPlugin("com.github.PEAKModding.PEAKLib.Core", "PEAKLib.Core", "1.2.0")] public class CorePlugin : BaseUnityPlugin { private static CorePlugin? _instance = null; public const string Id = "com.github.PEAKModding.PEAKLib.Core"; internal static ManualLogSource Log { get; } = Logger.CreateLogSource(Name); internal static CorePlugin Instance => _instance ?? throw new NullReferenceException("PEAKLib.Core hasn't been initialized yet! Please depend on it with [BepInDependency(CorePlugin.Id)]"); public static string Name => "PEAKLib.Core"; public static string Version => "1.2.0"; private void Awake() { _instance = this; MonoDetourManager.InvokeHookInitializers(typeof(CorePlugin).Assembly); PlayerHandler.OnCharacterRegistered = (Action<Character>)Delegate.Combine(PlayerHandler.OnCharacterRegistered, (Action<Character>)delegate(Character character) { Networking.s_NetworkManager = ((Component)character).gameObject.AddComponent<NetworkManager>(); }); BundleLoader.LoadAllBundles(Paths.PluginPath, ".autoload.peakbundle"); Log.LogInfo((object)("Plugin " + Name + " is loaded!")); } private void Start() { BundleLoader.CloseBundleLoadingWindow(); } } public class RegisteredContent<T> : IRegisteredContent where T : IContent { public T Content { get; } IContent IRegisteredContent.Content => Content; public ModDefinition Mod { get; } internal RegisteredContent(T content, ModDefinition mod) { Content = ThrowHelper.ThrowIfArgumentNull(content, "content"); Mod = ThrowHelper.ThrowIfArgumentNull(mod, "mod"); if (!ContentRegistry.s_RegisteredContent.TryAdd(content, this)) { throw new Exception($"This Content has been registered already: '{content}'"); } mod.registeredContent.Add(this); } } public interface IRegisteredContent { IContent Content { get; } ModDefinition Mod { get; } } public static class ThrowHelper { [MethodImpl(MethodImplOptions.AggressiveInlining)] public static string ThrowIfFieldNullOrWhiteSpace([NotNull] string? field, [CallerArgumentExpression("field")] string name = "") { if (string.IsNullOrWhiteSpace(field)) { throw new NullReferenceException("Field or property '" + name + "' must not be null or whitespace."); } return field; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static T ThrowIfFieldNull<T>([NotNull] T? field, [CallerArgumentExpression("field")] string name = "") { if (field == null) { throw new NullReferenceException("Field or property '" + name + "' must not be null."); } return field; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static string ThrowIfArgumentNullOrWhiteSpace([NotNull] string? argument, [CallerArgumentExpression("argument")] string name = "") { if (string.IsNullOrWhiteSpace(argument)) { throw new ArgumentException("'" + name + "' must not be null or whitespace."); } return argument; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static T ThrowIfArgumentNull<T>([NotNull] T? argument, [CallerArgumentExpression("argument")] string name = "") { if (argument == null) { ThrowArgumentNull(name); } return argument; } [DoesNotReturn] private static void ThrowArgumentNull(string argName) { throw new ArgumentNullException(argName); } } } namespace PEAKLib.Core.UnityEditor { [CreateAssetMenu(fileName = "ModDefinition", menuName = "PEAKLib/ModDefinition", order = 0)] public class UnityModDefinition : ScriptableObject, IModDefinitionResolvable { [SerializeField] private string modId = ""; [SerializeField] private string modName = ""; [SerializeField] private string modVersion = ""; public ModDefinition Resolve() { ThrowHelper.ThrowIfFieldNullOrWhiteSpace(modId, "modId"); ThrowHelper.ThrowIfFieldNullOrWhiteSpace(modName, "modName"); ThrowHelper.ThrowIfFieldNullOrWhiteSpace(modVersion, "modVersion"); Version version; try { version = new Version(modVersion); } catch (FormatException ex) { throw new FormatException("Version of the mod is not in a valid format!\n" + ex.Message, ex); } return ModDefinition.GetOrCreate(modId, modName, version); } } } namespace PEAKLib.Core.Hooks { [MonoDetourTargets(typeof(GameHandler))] internal static class GameHandlerHooks { private static bool patchedAwake; [MonoDetourHookInitialize] private static void Init() { On.GameHandler.Awake.Postfix(Postfix_Awake); } private static void Postfix_Awake(GameHandler self) { if (!patchedAwake) { patchedAwake = true; NetworkPrefabManager.Initialize(); } } } [MonoDetourTargets(typeof(LoadingScreenHandler), GenerateControlFlowVariants = true)] internal static class LoadingScreenHandlerHooks { private static bool loadBundlesStepInjected; private static readonly EnumeratorFieldReferenceGetter<string> sceneName = EnumeratorReflection.EnumeratorFastFieldReference<string>(LoadSceneProcess.StateMachineTarget(), "sceneName"); [MonoDetourHookInitialize] private static void Init() { LoadSceneProcess.ControlFlowPrefixMoveNext(Prefix_LoadSceneProcess_MoveNext); } private static ReturnFlow Prefix_LoadSceneProcess_MoveNext(SpeakableEnumerator<object, LoadingScreenHandler> self, ref bool continueEnumeration) { if (self.State == 0) { if (!loadBundlesStepInjected) { if (sceneName.Invoke((IEnumerator)self.Enumerator) == "Airport") { self.Current = BundleLoader.LoadOperationsDeadlineWait((MonoBehaviour)(object)self.This); loadBundlesStepInjected = true; continueEnumeration = true; return (ReturnFlow)2; } return (ReturnFlow)0; } return (ReturnFlow)0; } return (ReturnFlow)0; } } } namespace PEAKLib.Core.Extensions { internal static class ActionExtensions { public static void SafeInvoke(this Action @delegate) { foreach (Action item in @delegate.GetInvocationList().Cast<Action>()) { try { item(); } catch (Exception arg) { CorePlugin.Log.LogError((object)$"Unhandled exception in callback: {arg}"); } } } public static void SafeInvoke<T1>(this Action<T1> @delegate, T1 t1) { foreach (Action<T1> item in @delegate.GetInvocationList().Cast<Action<T1>>()) { try { item(t1); } catch (Exception arg) { CorePlugin.Log.LogError((object)$"Unhandled exception in callback: {arg}"); } } } } } namespace System.Diagnostics.CodeAnalysis { [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class ConstantExpectedAttribute : Attribute { public object? Min { get; set; } public object? Max { get; set; } } [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class ExperimentalAttribute : Attribute { public string DiagnosticId { get; } public string? UrlFormat { get; set; } public ExperimentalAttribute(string diagnosticId) { DiagnosticId = diagnosticId; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] internal sealed class MemberNotNullAttribute : Attribute { public string[] Members { get; } public MemberNotNullAttribute(string member) { Members = new string[1] { member }; } public MemberNotNullAttribute(params string[] members) { Members = members; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] internal sealed class MemberNotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public string[] Members { get; } public MemberNotNullWhenAttribute(bool returnValue, string member) { ReturnValue = returnValue; Members = new string[1] { member }; } public MemberNotNullWhenAttribute(bool returnValue, params string[] members) { ReturnValue = returnValue; Members = members; } } [AttributeUsage(AttributeTargets.Constructor, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class SetsRequiredMembersAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class StringSyntaxAttribute : Attribute { public const string CompositeFormat = "CompositeFormat"; public const string DateOnlyFormat = "DateOnlyFormat"; public const string DateTimeFormat = "DateTimeFormat"; public const string EnumFormat = "EnumFormat"; public const string GuidFormat = "GuidFormat"; public const string Json = "Json"; public const string NumericFormat = "NumericFormat"; public const string Regex = "Regex"; public const string TimeOnlyFormat = "TimeOnlyFormat"; public const string TimeSpanFormat = "TimeSpanFormat"; public const string Uri = "Uri"; public const string Xml = "Xml"; public string Syntax { get; } public object?[] Arguments { get; } public StringSyntaxAttribute(string syntax) { Syntax = syntax; Arguments = new object[0]; } public StringSyntaxAttribute(string syntax, params object?[] arguments) { Syntax = syntax; Arguments = arguments; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class UnscopedRefAttribute : Attribute { } } namespace System.Runtime.Versioning { [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class RequiresPreviewFeaturesAttribute : Attribute { public string? Message { get; } public string? Url { get; set; } public RequiresPreviewFeaturesAttribute() { } public RequiresPreviewFeaturesAttribute(string? message) { Message = message; } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class CallerArgumentExpressionAttribute : Attribute { public string ParameterName { get; } public CallerArgumentExpressionAttribute(string parameterName) { ParameterName = parameterName; } } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class CollectionBuilderAttribute : Attribute { public Type BuilderType { get; } public string MethodName { get; } public CollectionBuilderAttribute(Type builderType, string methodName) { BuilderType = builderType; MethodName = methodName; } } [AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class CompilerFeatureRequiredAttribute : Attribute { public const string RefStructs = "RefStructs"; public const string RequiredMembers = "RequiredMembers"; public string FeatureName { get; } public bool IsOptional { get; set; } public CompilerFeatureRequiredAttribute(string featureName) { FeatureName = featureName; } } [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class InterpolatedStringHandlerArgumentAttribute : Attribute { public string[] Arguments { get; } public InterpolatedStringHandlerArgumentAttribute(string argument) { Arguments = new string[1] { argument }; } public InterpolatedStringHandlerArgumentAttribute(params string[] arguments) { Arguments = arguments; } } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class InterpolatedStringHandlerAttribute : Attribute { } [EditorBrowsable(EditorBrowsableState.Never)] [ExcludeFromCodeCoverage] internal static class IsExternalInit { } [AttributeUsage(AttributeTargets.Method, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class ModuleInitializerAttribute : Attribute { } [AttributeUsage(AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class OverloadResolutionPriorityAttribute : Attribute { public int Priority { get; } public OverloadResolutionPriorityAttribute(int priority) { Priority = priority; } } [AttributeUsage(AttributeTargets.Parameter, Inherited = true, AllowMultiple = false)] [ExcludeFromCodeCoverage] internal sealed class ParamCollectionAttribute : Attribute { } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class RequiredMemberAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [EditorBrowsable(EditorBrowsableState.Never)] [ExcludeFromCodeCoverage] internal sealed class RequiresLocationAttribute : Attribute { } [AttributeUsage(AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Event | AttributeTargets.Interface, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class SkipLocalsInitAttribute : Attribute { } }
mods/com.github.PEAKModding.PEAKLib.ModConfig.dll
Decompiled 2 weeks agousing System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; 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.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using Microsoft.CodeAnalysis; using MonoDetour; using MonoDetour.Cil; using MonoDetour.DetourTypes; using MonoDetour.HookGen; using On.MenuWindow; using PEAKLib.Core; using PEAKLib.ModConfig.Components; using PEAKLib.ModConfig.Hooks; using PEAKLib.ModConfig.SettingOptions; using PEAKLib.ModConfig.SettingOptions.SettingUI; using PEAKLib.UI; using PEAKLib.UI.Elements; using TMPro; using Unity.Mathematics; using UnityEngine; using UnityEngine.Events; using UnityEngine.Localization; using UnityEngine.SceneManagement; using UnityEngine.UI; using Zorro.Core; using Zorro.Settings; using Zorro.Settings.DebugUI; using Zorro.Settings.UI; using Zorro.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("PEAKModding")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.3.0.0")] [assembly: AssemblyInformationalVersion("1.3.0+9f92ed4622ec2139755c37f9193f7cc77e010734")] [assembly: AssemblyProduct("com.github.PEAKModding.PEAKLib.ModConfig")] [assembly: AssemblyTitle("PEAKLib.ModConfig")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.3.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 On.MenuWindow { internal static class Start { public delegate void PrefixSignature(MenuWindow self); public delegate void PostfixSignature(MenuWindow self); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(MenuWindow); MethodInfo method = typeFromHandle.GetMethod("Start", (BindingFlags)(-1), null, Array.Empty<Type>(), null); if ((object)method == null) { throw new MissingMethodException("MenuWindow", "Start"); } return method; } } internal static class Open { public delegate void PrefixSignature(MenuWindow self); public delegate void PostfixSignature(MenuWindow self); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(MenuWindow); MethodInfo method = typeFromHandle.GetMethod("Open", (BindingFlags)(-1), null, Array.Empty<Type>(), null); if ((object)method == null) { throw new MissingMethodException("MenuWindow", "Open"); } return method; } } internal static class Close { public delegate void PrefixSignature(MenuWindow self); public delegate void PostfixSignature(MenuWindow self); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(MenuWindow); MethodInfo method = typeFromHandle.GetMethod("Close", (BindingFlags)(-1), null, Array.Empty<Type>(), null); if ((object)method == null) { throw new MissingMethodException("MenuWindow", "Close"); } return method; } } internal static class get_openOnStart { } internal static class get_selectOnOpen { } internal static class get_objectToSelectOnOpen { } internal static class get_closeOnPause { } internal static class get_closeOnUICancel { } internal static class get_blocksPlayerInput { } internal static class get_showCursorWhileOpen { } internal static class get_autoHideOnClose { } internal static class get_isOpen { } internal static class set_isOpen { } internal static class get_inputActive { } internal static class set_inputActive { } internal static class get_initialized { } internal static class set_initialized { } internal static class get_panel { } internal static class Update { } internal static class TestCloseViaInput { } internal static class Initialize { } internal static class OnOpen { } internal static class OnDestroy { } internal static class CloseAllWindows { } internal static class StartClosed { } internal static class ForceClose { } internal static class OnClose { } internal static class Show { } internal static class Hide { } internal static class SetInputActive { } internal static class SelectStartingElement { } internal static class _ctor { } internal static class _cctor { } } namespace MonoDetour.HookGen { internal static class DefaultMonoDetourManager { internal static MonoDetourManager Instance { get; } = New(); internal static MonoDetourManager New() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown return new MonoDetourManager(typeof(DefaultMonoDetourManager).Assembly.GetName().Name); } } [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class, AllowMultiple = true, Inherited = false)] internal class MonoDetourTargetsAttribute : Attribute, IMonoDetourTargets { public Type? TargetType { get; } public bool IncludeNestedTypes { get; set; } public bool DistinguishOverloadsByName { get; set; } public string[]? Members { get; set; } public string[]? MemberNamePrefixes { get; set; } public string[]? MemberNameSuffixes { get; set; } public bool GenerateControlFlowVariants { get; set; } public MonoDetourTargetsAttribute(Type? targetType = null) { TargetType = targetType; IncludeNestedTypes = true; base..ctor(); } } } namespace BepInEx { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class BepInAutoPluginAttribute : Attribute { public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace BepInEx.Preloader.Core.Patching { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class PatcherAutoPluginAttribute : Attribute { public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace PEAKLib.ModConfig { internal interface IBepInExProperty { } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.github.PEAKModding.PEAKLib.ModConfig", "PEAKLib.ModConfig", "1.3.0")] public class ModConfigPlugin : BaseUnityPlugin { private static bool modSettingsLoaded = false; public const string Id = "com.github.PEAKModding.PEAKLib.ModConfig"; internal static ManualLogSource Log { get; } = Logger.CreateLogSource(Name); public static string Name => "PEAKLib.ModConfig"; public static string Version => "1.3.0"; private void Awake() { MonoDetourManager.InvokeHookInitializers(typeof(ModConfigPlugin).Assembly); Log.LogInfo((object)("Plugin " + Name + " is loaded!")); } private void Start() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown LoadModSettings(); MenuAPI.AddToSettingsMenu(new BuilderDelegate(builderDelegate)); static void builderDelegate(Transform parent) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Expected O, but got Unknown //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Expected O, but got Unknown //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Expected O, but got Unknown //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: Unknown result type (might be due to invalid IL or missing references) //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_031a: Unknown result type (might be due to invalid IL or missing references) //IL_0353: Unknown result type (might be due to invalid IL or missing references) //IL_0367: Unknown result type (might be due to invalid IL or missing references) //IL_0394: Unknown result type (might be due to invalid IL or missing references) //IL_03a0: Expected O, but got Unknown //IL_03de: Unknown result type (might be due to invalid IL or missing references) //IL_04ab: Unknown result type (might be due to invalid IL or missing references) //IL_04c3: Unknown result type (might be due to invalid IL or missing references) //IL_04cd: Expected O, but got Unknown //IL_04e5: Unknown result type (might be due to invalid IL or missing references) Scene activeScene = SceneManager.GetActiveScene(); bool isTitleScreen = ((Scene)(ref activeScene)).name == "Title"; MenuWindow settingMenu = (MenuWindow)(isTitleScreen ? ((object)((Component)parent).GetComponentInParent<PauseMainMenu>()) : ((object)((Component)parent).GetComponentInParent<PauseSettingsMenu>())); PeakCustomPage obj = MenuAPI.CreatePage("ModSettings").CreateBackground(isTitleScreen ? new Color?(new Color(0f, 0f, 0f, 0.8667f)) : null); MenuWindow obj2 = settingMenu; PeakCustomPage modSettingsPage = obj.SetOnClose(new UnityAction(obj2.Open)); TranslationKey val = MenuAPI.CreateLocalization("MOD SETTINGS").AddLocalization("MOD SETTINGS", (Language)0).AddLocalization("PARAMÈTRES DU MOD", (Language)1) .AddLocalization("IMPOSTAZIONI MOD", (Language)2) .AddLocalization("MOD-EINSTELLUNGEN", (Language)3) .AddLocalization("AJUSTES DEL MOD", (Language)4) .AddLocalization("CONFIGURACIONES DEL MOD", (Language)5) .AddLocalization("CONFIGURAÇÕES DE MOD", (Language)6) .AddLocalization("НАСТРОЙКИ МОДА", (Language)7) .AddLocalization("НАЛАШТУВАННЯ МОДА", (Language)8) .AddLocalization("模组设置", (Language)9) .AddLocalization("模組設定", (Language)10) .AddLocalization("MOD設定", (Language)11) .AddLocalization("모드 설정", (Language)12); PeakElement val2 = ElementExtensions.SetSize<PeakElement>(ElementExtensions.SetPivot<PeakElement>(ElementExtensions.SetPosition<PeakElement>(ElementExtensions.SetAnchorMinMax<PeakElement>(ElementExtensions.ParentTo(new GameObject("Header"), (Component)(object)modSettingsPage).AddComponent<PeakElement>(), new Vector2(0f, 1f)), new Vector2(40f, -40f)), new Vector2(0f, 1f)), new Vector2(360f, 100f)); PeakText val3 = ElementExtensions.SetLocalizationIndex<PeakText>(ElementExtensions.ExpandToParent<PeakText>(ElementExtensions.ParentTo<PeakText>(MenuAPI.CreateText("Mod Settings", "HeaderText").SetFontSize(48f), (Component)(object)val2)), val); ((PeakLocalizableElement)val3).Text.fontSizeMax = 48f; ((PeakLocalizableElement)val3).Text.fontSizeMin = 24f; ((PeakLocalizableElement)val3).Text.enableAutoSizing = true; ((PeakLocalizableElement)val3).Text.alignment = (TextAlignmentOptions)514; ElementExtensions.SetPosition<PeakMenuButton>(ElementExtensions.ParentTo<PeakMenuButton>(ElementExtensions.SetLocalizationIndex<PeakMenuButton>(MenuAPI.CreateMenuButton("Back"), "BACK").SetColor(new Color(1f, 0.5f, 0.2f), true), (Component)(object)modSettingsPage), new Vector2(225f, -180f)).SetWidth(200f).OnClick(new UnityAction(((MenuWindow)modSettingsPage).Close)); ElementExtensions.SetPosition<PeakText>(ElementExtensions.ParentTo<PeakText>(MenuAPI.CreateText("Search"), (Component)(object)modSettingsPage), new Vector2(90f, -210f)); PeakElement val4 = ElementExtensions.SetSize<PeakElement>(ElementExtensions.SetPosition<PeakElement>(ElementExtensions.SetAnchorMax<PeakElement>(ElementExtensions.SetAnchorMin<PeakElement>(ElementExtensions.SetPivot<PeakElement>(ElementExtensions.ParentTo<PeakElement>(new GameObject("Content").AddComponent<PeakElement>(), (Component)(object)modSettingsPage), new Vector2(0f, 1f)), new Vector2(0f, 1f)), new Vector2(0f, 1f)), new Vector2(428f, -70f)), new Vector2(1360f, 980f)); ModdedSettingsMenu moddedSettingsMenu = ((Component)val4).gameObject.AddComponent<ModdedSettingsMenu>(); PeakTextInput val5 = ElementExtensions.SetPosition<PeakTextInput>(ElementExtensions.SetSize<PeakTextInput>(ElementExtensions.ParentTo<PeakTextInput>(MenuAPI.CreateTextInput("SearchInput"), (Component)(object)modSettingsPage), new Vector2(300f, 70f)), new Vector2(230f, -300f)).SetPlaceholder("Search here").OnValueChanged((UnityAction<string>)moddedSettingsMenu.SetSearch); PeakHorizontalTabs val6 = ElementExtensions.ParentTo(new GameObject("TABS"), (Component)(object)val4).AddComponent<PeakHorizontalTabs>(); ModdedSettingsTABS moddedSettingsTABS = ((Component)val6).gameObject.AddComponent<ModdedSettingsTABS>(); moddedSettingsTABS.SettingsMenu = moddedSettingsMenu; PeakScrollableContent val7 = ElementExtensions.SetOffsetMax<PeakScrollableContent>(ElementExtensions.ExpandToParent<PeakScrollableContent>(ElementExtensions.ParentTo<PeakScrollableContent>(MenuAPI.CreateScrollableContent("TabContent"), (Component)(object)val4)), new Vector2(0f, -60f)); moddedSettingsMenu.Content = (Transform)(object)val7.Content; moddedSettingsMenu.Tabs = moddedSettingsTABS; foreach (KeyValuePair<string, ConfigEntryBase[]> modConfigEntry in GetModConfigEntries()) { modConfigEntry.Deconstruct(out var key, out var value); string text = key; ConfigEntryBase[] array = value; GameObject val8 = val6.AddTab(text); ModdedTABSButton moddedTABSButton = val8.AddComponent<ModdedTABSButton>(); moddedTABSButton.category = text; ((TAB_Button)moddedTABSButton).text = val8.GetComponentInChildren<TextMeshProUGUI>(); moddedTABSButton.SelectedGraphic = ((Component)val8.transform.Find("Selected")).gameObject; } PeakMenuButton val9 = ElementExtensions.ParentTo<PeakMenuButton>(ElementExtensions.SetLocalizationIndex<PeakMenuButton>(MenuAPI.CreatePauseMenuButton("MOD SETTINGS"), val).SetColor(new Color(0.15f, 0.75f, 0.85f), true), parent).OnClick((UnityAction)delegate { UIInputHandler.SetSelectedObject((GameObject)null); MenuWindow obj3 = settingMenu; if (obj3 != null) { obj3.Close(); } if (!isTitleScreen) { MenuWindow obj4 = settingMenu; PauseSettingsMenu val10 = (PauseSettingsMenu)(object)((obj4 is PauseSettingsMenu) ? obj4 : null); if (val10 != null) { MenuWindow optionsMenu = val10.optionsMenu; if (optionsMenu != null) { optionsMenu.Close(); } } } ((MenuWindow)modSettingsPage).Open(); }); if ((Object)(object)val9 != (Object)null) { ElementExtensions.SetPosition<PeakMenuButton>(val9, new Vector2(171f, -230f)).SetWidth(220f); } } } private static void LoadModSettings() { //IL_0338: Unknown result type (might be due to invalid IL or missing references) //IL_033d: Unknown result type (might be due to invalid IL or missing references) //IL_0346: Unknown result type (might be due to invalid IL or missing references) //IL_0344: Unknown result type (might be due to invalid IL or missing references) //IL_0361: Unknown result type (might be due to invalid IL or missing references) //IL_0366: Unknown result type (might be due to invalid IL or missing references) //IL_036f: Unknown result type (might be due to invalid IL or missing references) //IL_0382: Unknown result type (might be due to invalid IL or missing references) //IL_0385: Unknown result type (might be due to invalid IL or missing references) //IL_036d: Unknown result type (might be due to invalid IL or missing references) if (modSettingsLoaded) { return; } modSettingsLoaded = true; bool flag = default(bool); bool flag2 = default(bool); foreach (KeyValuePair<string, ConfigEntryBase[]> modConfigEntry in GetModConfigEntries()) { modConfigEntry.Deconstruct(out var key, out var value); string text = key; ConfigEntryBase[] array = value; ConfigEntryBase[] array2 = array; foreach (ConfigEntryBase configEntry in array2) { try { if (configEntry.SettingType == typeof(bool)) { object defaultValue = configEntry.DefaultValue; int num; if (defaultValue is bool) { flag = (bool)defaultValue; num = 1; } else { num = 0; } bool defaultValue2 = (byte)((uint)num & (flag ? 1u : 0u)) != 0; defaultValue = configEntry.BoxedValue; int num2; if (defaultValue is bool) { flag2 = (bool)defaultValue; num2 = 1; } else { num2 = 0; } bool currentValue = (byte)((uint)num2 & (flag2 ? 1u : 0u)) != 0; SettingsHandlerUtility.AddBoolToTab(configEntry.Definition.Key, defaultValue2, text, currentValue, delegate(bool newVal) { configEntry.BoxedValue = newVal; }); } else if (configEntry.SettingType == typeof(float)) { float defaultValue3 = ((configEntry.DefaultValue is float num3) ? num3 : 0f); float currentValue2 = ((configEntry.BoxedValue is float num4) ? num4 : 0f); float minValue = 0f; float maxValue = 1000f; if (configEntry.Description.AcceptableValues is AcceptableValueRange<float> val) { minValue = val.MinValue; maxValue = val.MaxValue; } SettingsHandlerUtility.AddFloatToTab(configEntry.Definition.Key, defaultValue3, text, minValue, maxValue, currentValue2, delegate(float newVal) { configEntry.BoxedValue = newVal; }); } else if (configEntry.SettingType == typeof(int)) { int defaultValue4 = ((configEntry.DefaultValue is int num5) ? num5 : 0); int currentValue3 = ((configEntry.BoxedValue is int num6) ? num6 : 0); SettingsHandlerUtility.AddIntToTab(configEntry.Definition.Key, defaultValue4, text, currentValue3, delegate(int newVal) { configEntry.BoxedValue = newVal; }); } else if (configEntry.SettingType == typeof(string)) { string defaultValue5 = ((configEntry.DefaultValue is string text2) ? text2 : ""); string currentValue4 = ((configEntry.BoxedValue is string text3) ? text3 : ""); SettingsHandlerUtility.AddStringToTab(configEntry.Definition.Key, defaultValue5, text, currentValue4, delegate(string newVal) { configEntry.BoxedValue = newVal; }); } else if (configEntry.SettingType == typeof(KeyCode)) { KeyCode defaultValue6 = (KeyCode)((configEntry.DefaultValue is KeyCode val2) ? ((int)val2) : 0); KeyCode currentValue5 = (KeyCode)((configEntry.BoxedValue is KeyCode val3) ? ((int)val3) : 0); SettingsHandlerUtility.AddKeybindToTab(configEntry.Definition.Key, defaultValue6, text, currentValue5, delegate(KeyCode newVal) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) configEntry.BoxedValue = newVal; }); } else if (configEntry.SettingType.IsEnum) { object defaultValue7 = configEntry.DefaultValue; object value2 = ((defaultValue7 != null) ? defaultValue7 : Enum.ToObject(configEntry.SettingType, 0)); object boxedValue = configEntry.BoxedValue; object value3 = ((boxedValue != null) ? boxedValue : Enum.ToObject(configEntry.SettingType, 0)); string name = Enum.GetName(configEntry.SettingType, value2); string name2 = Enum.GetName(configEntry.SettingType, value3); List<string> options = new List<string>(Enum.GetNames(configEntry.SettingType)); SettingsHandlerUtility.AddEnumToTab(configEntry.Definition.Key, options, text, name2, delegate(string newVal) { if (Enum.TryParse(configEntry.SettingType, newVal, out object result)) { configEntry.BoxedValue = result; } }); } else { Log.LogWarning((object)$"Missing SettingType: [Mod: {text}] {configEntry.Definition.Key} (Type: {configEntry.SettingType})"); } } catch (Exception ex) { Log.LogError((object)ex); } } } } private static Dictionary<string, ConfigEntryBase[]> GetModConfigEntries() { Dictionary<string, ConfigEntryBase[]> dictionary = new Dictionary<string, ConfigEntryBase[]>(); foreach (PluginInfo item in Chainloader.PluginInfos.Values.OrderBy((PluginInfo p) => p.Metadata.Name)) { List<ConfigEntryBase> list = new List<ConfigEntryBase>(); foreach (ConfigEntryBase item2 in ((IEnumerable<KeyValuePair<ConfigDefinition, ConfigEntryBase>>)item.Instance.Config).Select((KeyValuePair<ConfigDefinition, ConfigEntryBase> configEntry) => configEntry.Value)) { ConfigDescription description = item2.Description; object[] array = ((description != null) ? description.Tags : null); if (array == null || !array.Contains("Hidden")) { list.Add(item2); } } if (list.Count > 0) { dictionary.TryAdd(FixNaming(item.Metadata.Name), list.ToArray()); } } return dictionary; } private static string FixNaming(string input) { input = Regex.Replace(input, "([a-z])([A-Z])", "$1 $2"); input = Regex.Replace(input, "([A-Z])([A-Z][a-z])", "$1 $2"); input = Regex.Replace(input, "\\s+", " "); input = Regex.Replace(input, "([A-Z]\\.)\\s([A-Z]\\.)", "$1$2"); return input.Trim(); } } internal static class SettingsHandlerUtility { internal static void AddBoolToTab(string displayName, bool defaultValue, string tabName, bool currentValue = false, Action<bool>? saveCallback = null) { if (SettingsHandler.Instance == null) { throw new Exception("You're registering options too early! Use the Start() function to create new options!"); } SettingsHandler.Instance.AddSetting((Setting)(object)new BepInExOffOn(displayName, defaultValue, tabName, currentValue, saveCallback)); } internal static void AddFloatToTab(string displayName, float defaultValue, string tabName, float minValue = 0f, float maxValue = 1f, float currentValue = 0f, Action<float>? applyCallback = null) { if (SettingsHandler.Instance == null) { throw new Exception("You're registering options too early! Use the Start() function to create new options!"); } SettingsHandler.Instance.AddSetting((Setting)(object)new BepInExFloat(displayName, defaultValue, tabName, minValue, maxValue, currentValue, applyCallback)); } internal static void AddIntToTab(string displayName, int defaultValue, string tabName, int currentValue = 0, Action<int>? saveCallback = null) { if (SettingsHandler.Instance == null) { throw new Exception("You're registering options too early! Use the Start() function to create new options!"); } SettingsHandler.Instance.AddSetting((Setting)(object)new BepInExInt(displayName, tabName, defaultValue, currentValue, saveCallback)); } internal static void AddStringToTab(string displayName, string defaultValue, string tabName, string currentValue = "", Action<string>? saveCallback = null) { if (SettingsHandler.Instance == null) { throw new Exception("You're registering options too early! Use the Start() function to create new options!"); } SettingsHandler.Instance.AddSetting((Setting)(object)new BepInExString(displayName, tabName, defaultValue, currentValue, saveCallback)); } internal static void AddKeybindToTab(string displayName, KeyCode defaultValue, string tabName, KeyCode currentValue, Action<KeyCode>? saveCallback) { //IL_0019: 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) if (SettingsHandler.Instance == null) { throw new Exception("You're registering options too early! Use the Start() function to create new options!"); } SettingsHandler.Instance.AddSetting((Setting)(object)new BepInExKeyCode(displayName, tabName, defaultValue, currentValue, saveCallback)); } internal static void AddEnumToTab(string displayName, List<string> options, string tabName, string currentValue, Action<string>? saveCallback) { if (SettingsHandler.Instance == null) { throw new Exception("You're registering options too early! Use the Start() function to create new options!"); } SettingsHandler.Instance.AddSetting((Setting)(object)new BepInExEnum(displayName, options, currentValue, tabName, saveCallback)); } } } namespace PEAKLib.ModConfig.SettingOptions { internal class BepInExEnum : Setting, IEnumSetting, IExposedSetting, IBepInExProperty { [CompilerGenerated] private string <displayName>P; [CompilerGenerated] private List<string> <options>P; [CompilerGenerated] private string <currentValue>P; [CompilerGenerated] private string <category>P; [CompilerGenerated] private Action<string>? <saveCallback>P; [CompilerGenerated] private Action<BepInExEnum>? <onApply>P; public string Value { get; protected set; } public BepInExEnum(string displayName, List<string> options, string currentValue, string category = "Mods", Action<string>? saveCallback = null, Action<BepInExEnum>? onApply = null) { <displayName>P = displayName; <options>P = options; <currentValue>P = currentValue; <category>P = category; <saveCallback>P = saveCallback; <onApply>P = onApply; Value = ""; ((Setting)this)..ctor(); } public string GetDisplayName() { return <displayName>P; } public string GetCategory() { return <category>P; } public override void Load(ISettingsSaveLoad loader) { Value = <currentValue>P; } public override void Save(ISettingsSaveLoad saver) { <saveCallback>P?.Invoke(Value); } public override GameObject GetSettingUICell() { return SingletonAsset<InputCellMapper>.Instance.EnumSettingCell; } public virtual List<string> GetUnlocalizedChoices() { return <options>P; } public List<LocalizedString> GetLocalizedChoices() { return null; } public int GetValue() { return <options>P.IndexOf(Value); } public void SetValue(int v, ISettingHandler settingHandler, bool fromUI) { Value = <options>P[v]; ((Setting)this).ApplyValue(); settingHandler.SaveSetting((Setting)(object)this); if (!fromUI) { ((Setting)this).OnSettingChangedExternal(); } ((Setting)this).OnSettingChanged(); } public override void ApplyValue() { <onApply>P?.Invoke(this); } public override SettingUI GetDebugUI(ISettingHandler settingHandler) { return null; } } internal class BepInExFloat : FloatSetting, IBepInExProperty, IExposedSetting { [CompilerGenerated] private string <displayName>P; [CompilerGenerated] private float <defaultValue>P; [CompilerGenerated] private string <categoryName>P; [CompilerGenerated] private float <minValue>P; [CompilerGenerated] private float <maxValue>P; [CompilerGenerated] private float <currentValue>P; [CompilerGenerated] private Action<float>? <saveCallback>P; [CompilerGenerated] private Action<BepInExFloat>? <onApply>P; public BepInExFloat(string displayName, float defaultValue = 0f, string categoryName = "Mods", float minValue = 0f, float maxValue = 1f, float currentValue = 0f, Action<float>? saveCallback = null, Action<BepInExFloat>? onApply = null) { <displayName>P = displayName; <defaultValue>P = defaultValue; <categoryName>P = categoryName; <minValue>P = minValue; <maxValue>P = maxValue; <currentValue>P = currentValue; <saveCallback>P = saveCallback; <onApply>P = onApply; ((FloatSetting)this)..ctor(); } public override void Load(ISettingsSaveLoad loader) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) ((FloatSetting)this).Value = <currentValue>P; float2 minMaxValue = ((FloatSetting)this).GetMinMaxValue(); ((FloatSetting)this).MinValue = minMaxValue.x; ((FloatSetting)this).MaxValue = minMaxValue.y; } public override void Save(ISettingsSaveLoad saver) { <saveCallback>P?.Invoke(((FloatSetting)this).Value); } public override void ApplyValue() { <onApply>P?.Invoke(this); } public string GetDisplayName() { return <displayName>P; } public string GetCategory() { return <categoryName>P; } protected override float GetDefaultValue() { return <defaultValue>P; } protected override float2 GetMinMaxValue() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) return new float2(<minValue>P, <maxValue>P); } } internal class BepInExInt : IntSetting, IBepInExProperty, IExposedSetting { [CompilerGenerated] private string <displayName>P; [CompilerGenerated] private string <category>P; [CompilerGenerated] private int <defaultValue>P; [CompilerGenerated] private int <currentValue>P; [CompilerGenerated] private Action<int>? <saveCallback>P; [CompilerGenerated] private Action<BepInExInt>? <onApply>P; private static GameObject? _settingUICell; public static GameObject? SettingUICell { get { //IL_00af: 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_00d9: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_settingUICell == (Object)null) { if ((Object)(object)SingletonAsset<InputCellMapper>.Instance == (Object)null || (Object)(object)SingletonAsset<InputCellMapper>.Instance.FloatSettingCell == (Object)null) { return null; } _settingUICell = Object.Instantiate<GameObject>(SingletonAsset<InputCellMapper>.Instance.FloatSettingCell); ((Object)_settingUICell).name = "BepInExIntCell"; FloatSettingUI component = _settingUICell.GetComponent<FloatSettingUI>(); BepInExInt_SettingUI bepInExInt_SettingUI = _settingUICell.AddComponent<BepInExInt_SettingUI>(); bepInExInt_SettingUI.inputField = component.inputField; Object.DestroyImmediate((Object)(object)((Component)component.slider).gameObject); Object.DestroyImmediate((Object)(object)component); bepInExInt_SettingUI.inputField.characterValidation = (CharacterValidation)2; RectTransform component2 = ((Component)bepInExInt_SettingUI.inputField).GetComponent<RectTransform>(); component2.pivot = new Vector2(0.5f, 0.5f); component2.offsetMin = new Vector2(20f, -25f); component2.offsetMax = new Vector2(380f, 25f); Object.DontDestroyOnLoad((Object)(object)_settingUICell); } return _settingUICell; } } public BepInExInt(string displayName, string category, int defaultValue = 0, int currentValue = 0, Action<int>? saveCallback = null, Action<BepInExInt>? onApply = null) { <displayName>P = displayName; <category>P = category; <defaultValue>P = defaultValue; <currentValue>P = currentValue; <saveCallback>P = saveCallback; <onApply>P = onApply; ((IntSetting)this)..ctor(); } public override void Load(ISettingsSaveLoad loader) { ((IntSetting)this).Value = <currentValue>P; } public override void Save(ISettingsSaveLoad saver) { <saveCallback>P?.Invoke(((IntSetting)this).Value); } public override void ApplyValue() { <onApply>P?.Invoke(this); } public override GameObject? GetSettingUICell() { return SettingUICell; } public string GetCategory() { return <category>P; } public string GetDisplayName() { return <displayName>P; } protected override int GetDefaultValue() { return <defaultValue>P; } } internal class BepInExKeyCode : Setting, IBepInExProperty, IExposedSetting { [CompilerGenerated] private string <displayName>P; [CompilerGenerated] private string <category>P; [CompilerGenerated] private KeyCode <defaultValue>P; [CompilerGenerated] private KeyCode <currentValue>P; [CompilerGenerated] private Action<KeyCode>? <saveCallback>P; [CompilerGenerated] private Action<BepInExKeyCode>? <onApply>P; private static GameObject? _settingUICell; public KeyCode Value { get; set; } public static GameObject? SettingUICell { get { //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_settingUICell == (Object)null) { if ((Object)(object)SingletonAsset<InputCellMapper>.Instance == (Object)null || (Object)(object)SingletonAsset<InputCellMapper>.Instance.FloatSettingCell == (Object)null) { return null; } _settingUICell = Object.Instantiate<GameObject>(SingletonAsset<InputCellMapper>.Instance.FloatSettingCell); ((Object)_settingUICell).name = "BepInExKeyCodeCell"; FloatSettingUI component = _settingUICell.GetComponent<FloatSettingUI>(); BepInExKeyCode_SettingUI bepInExKeyCode_SettingUI = _settingUICell.AddComponent<BepInExKeyCode_SettingUI>(); RectTransform component2 = ((Component)component.inputField).GetComponent<RectTransform>(); component2.pivot = new Vector2(0.5f, 0.5f); component2.offsetMin = new Vector2(20f, -25f); component2.offsetMax = new Vector2(380f, 25f); bepInExKeyCode_SettingUI.button = _settingUICell.AddComponent<Button>(); ((Object)component.inputField).name = "Button"; Object.DestroyImmediate((Object)(object)((Component)component.inputField.placeholder).gameObject); Object.Destroy((Object)(object)component.inputField); Object.DestroyImmediate((Object)(object)((Component)component.slider).gameObject); Object.DestroyImmediate((Object)(object)component); TextMeshProUGUI componentInChildren = ((Component)bepInExKeyCode_SettingUI.button).GetComponentInChildren<TextMeshProUGUI>(); float num2 = (((TMP_Text)componentInChildren).fontSizeMax = 22f); float fontSize = (((TMP_Text)componentInChildren).fontSizeMin = num2); ((TMP_Text)componentInChildren).fontSize = fontSize; ((TMP_Text)componentInChildren).alignment = (TextAlignmentOptions)514; bepInExKeyCode_SettingUI.text = componentInChildren; Object.DontDestroyOnLoad((Object)(object)_settingUICell); } return _settingUICell; } } public BepInExKeyCode(string displayName, string category, KeyCode defaultValue = 0, KeyCode currentValue = 0, Action<KeyCode>? saveCallback = null, Action<BepInExKeyCode>? onApply = null) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) <displayName>P = displayName; <category>P = category; <defaultValue>P = defaultValue; <currentValue>P = currentValue; <saveCallback>P = saveCallback; <onApply>P = onApply; ((Setting)this)..ctor(); } public override void Load(ISettingsSaveLoad loader) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) Value = <currentValue>P; } public override void Save(ISettingsSaveLoad saver) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) <saveCallback>P?.Invoke(Value); } public override void ApplyValue() { <onApply>P?.Invoke(this); } public override GameObject? GetSettingUICell() { return SettingUICell; } public string GetCategory() { return <category>P; } public string GetDisplayName() { return <displayName>P; } protected KeyCode GetDefaultValue() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return <defaultValue>P; } public override SettingUI GetDebugUI(ISettingHandler settingHandler) { return null; } public void SetValue(KeyCode newValue, ISettingHandler settingHandler) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) Value = newValue; ((Setting)this).ApplyValue(); settingHandler.SaveSetting((Setting)(object)this); } } internal class BepInExOffOn : OffOnSetting, IBepInExProperty, IExposedSetting { [CompilerGenerated] private string <displayName>P; [CompilerGenerated] private bool <defaultValue>P; [CompilerGenerated] private string <category>P; [CompilerGenerated] private bool <currentValue>P; [CompilerGenerated] private Action<bool>? <saveCallback>P; [CompilerGenerated] private Action<BepInExOffOn>? <onApply>P; public BepInExOffOn(string displayName, bool defaultValue = false, string category = "Mods", bool currentValue = false, Action<bool>? saveCallback = null, Action<BepInExOffOn>? onApply = null) { <displayName>P = displayName; <defaultValue>P = defaultValue; <category>P = category; <currentValue>P = currentValue; <saveCallback>P = saveCallback; <onApply>P = onApply; ((OffOnSetting)this)..ctor(); } public override void Load(ISettingsSaveLoad loader) { ((EnumSetting<OffOnMode>)this).Value = (OffOnMode)(<currentValue>P ? 1 : 0); } public override void Save(ISettingsSaveLoad saver) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Invalid comparison between Unknown and I4 <saveCallback>P?.Invoke((int)((EnumSetting<OffOnMode>)this).Value == 1); } public override void ApplyValue() { <onApply>P?.Invoke(this); } protected override OffOnMode GetDefaultValue() { if (<defaultValue>P) { return (OffOnMode)1; } return (OffOnMode)0; } public string GetDisplayName() { return <displayName>P; } public string GetCategory() { return <category>P; } public override List<LocalizedString>? GetLocalizedChoices() { return null; } } internal class BepInExString : StringSetting, IBepInExProperty, IExposedSetting { [CompilerGenerated] private string <displayName>P; [CompilerGenerated] private string <category>P; [CompilerGenerated] private string <defaultValue>P; [CompilerGenerated] private string <currentValue>P; [CompilerGenerated] private Action<string>? <saveCallback>P; [CompilerGenerated] private Action<BepInExString>? <onApply>P; private static GameObject? _settingUICell; public string PlaceholderText { get; set; } public static GameObject? SettingUICell { get { //IL_00af: 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_00d9: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_settingUICell == (Object)null) { if ((Object)(object)SingletonAsset<InputCellMapper>.Instance == (Object)null || (Object)(object)SingletonAsset<InputCellMapper>.Instance.FloatSettingCell == (Object)null) { return null; } _settingUICell = Object.Instantiate<GameObject>(SingletonAsset<InputCellMapper>.Instance.FloatSettingCell); ((Object)_settingUICell).name = "BepInExStringCell"; FloatSettingUI component = _settingUICell.GetComponent<FloatSettingUI>(); StringSettingUI stringSettingUI = _settingUICell.AddComponent<StringSettingUI>(); stringSettingUI.inputField = component.inputField; Object.DestroyImmediate((Object)(object)((Component)component.slider).gameObject); Object.DestroyImmediate((Object)(object)component); stringSettingUI.inputField.characterValidation = (CharacterValidation)0; RectTransform component2 = ((Component)stringSettingUI.inputField).GetComponent<RectTransform>(); component2.pivot = new Vector2(0.5f, 0.5f); component2.offsetMin = new Vector2(20f, -25f); component2.offsetMax = new Vector2(380f, 25f); TextMeshProUGUI[] componentsInChildren = ((Component)stringSettingUI.inputField).GetComponentsInChildren<TextMeshProUGUI>(); TextMeshProUGUI[] array = componentsInChildren; foreach (TextMeshProUGUI val in array) { float num2 = (((TMP_Text)val).fontSizeMax = 22f); float fontSize = (((TMP_Text)val).fontSizeMin = num2); ((TMP_Text)val).fontSize = fontSize; ((TMP_Text)val).alignment = (TextAlignmentOptions)4097; } Object.DontDestroyOnLoad((Object)(object)_settingUICell); } return _settingUICell; } } public BepInExString(string displayName, string category, string defaultValue = "", string currentValue = "", Action<string>? saveCallback = null, Action<BepInExString>? onApply = null) { <displayName>P = displayName; <category>P = category; <defaultValue>P = defaultValue; <currentValue>P = currentValue; <saveCallback>P = saveCallback; <onApply>P = onApply; PlaceholderText = <defaultValue>P ?? ""; ((StringSetting)this)..ctor(); } public override void Load(ISettingsSaveLoad loader) { ((StringSetting)this).Value = <currentValue>P; } public override void Save(ISettingsSaveLoad saver) { <saveCallback>P?.Invoke(((StringSetting)this).Value); } public override void ApplyValue() { <onApply>P?.Invoke(this); } public override GameObject? GetSettingUICell() { return SettingUICell; } public string GetCategory() { return <category>P; } public string GetDisplayName() { return <displayName>P; } protected override string GetDefaultValue() { return <defaultValue>P; } } public class StringSettingUI : SettingInputUICell { public TMP_InputField? inputField; public override void Setup(Setting setting, ISettingHandler settingHandler) { ISettingHandler settingHandler2 = settingHandler; if (setting == null) { return; } BepInExString stringSetting = setting as BepInExString; if (stringSetting == null) { return; } ((SettingInputUICell)this).RegisterSettingListener(setting); if ((Object)(object)inputField == (Object)null) { return; } inputField.SetTextWithoutNotify(((StringSetting)stringSetting).Value); ((UnityEvent<string>)(object)inputField.onValueChanged).AddListener((UnityAction<string>)OnChanged); TextMeshProUGUI[] componentsInChildren = ((Component)inputField).GetComponentsInChildren<TextMeshProUGUI>(); TextMeshProUGUI[] array = componentsInChildren; foreach (TextMeshProUGUI val in array) { if (((Object)val).name == "Placeholder") { ((TMP_Text)val).text = stringSetting.PlaceholderText; } } void OnChanged(string str) { inputField.SetTextWithoutNotify(str); ((StringSetting)stringSetting).SetValue(str, settingHandler2); } } protected override void OnSettingChangedExternal(Setting setting) { ((SettingInputUICell)this).OnSettingChangedExternal(setting); if ((Object)(object)inputField != (Object)null && setting is BepInExString bepInExString) { inputField.SetTextWithoutNotify(((StringSetting)bepInExString).Value); } } } } namespace PEAKLib.ModConfig.SettingOptions.SettingUI { internal class BepInExInt_SettingUI : SettingInputUICell { public TMP_InputField? inputField; public override void Setup(Setting setting, ISettingHandler settingHandler) { ISettingHandler settingHandler2 = settingHandler; BepInExInt intSetting; if (!((Object)(object)inputField == (Object)null) && setting != null) { intSetting = setting as BepInExInt; if (intSetting != null) { ((SettingInputUICell)this).RegisterSettingListener(setting); inputField.SetTextWithoutNotify(((IntSetting)intSetting).Expose(((IntSetting)intSetting).Value)); ((UnityEvent<string>)(object)inputField.onValueChanged).AddListener((UnityAction<string>)OnChanged); } } void OnChanged(string str) { if (int.TryParse(str, out var result)) { inputField.SetTextWithoutNotify(((IntSetting)intSetting).Expose(result)); ((IntSetting)intSetting).SetValue(result, settingHandler2); } } } protected override void OnSettingChangedExternal(Setting setting) { ((SettingInputUICell)this).OnSettingChangedExternal(setting); if ((Object)(object)inputField != (Object)null && setting is BepInExInt bepInExInt) { inputField.SetTextWithoutNotify(((IntSetting)bepInExInt).Expose(((IntSetting)bepInExInt).Value)); } } } internal class BepInExKeyCode_SettingUI : SettingInputUICell { public Button? button; public TextMeshProUGUI? text; private static BepInExKeyCode_SettingUI? detectingKey = null; internal static KeyCode[] BlackListed = (KeyCode[])(object)new KeyCode[1] { (KeyCode)27 }; public override void Setup(Setting setting, ISettingHandler settingHandler) { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Expected O, but got Unknown ISettingHandler settingHandler2 = settingHandler; ThrowHelper.ThrowIfFieldNull<Button>(button, "button"); ThrowHelper.ThrowIfFieldNull<TextMeshProUGUI>(text, "text"); if (setting == null) { return; } BepInExKeyCode keyCodeSetting = setting as BepInExKeyCode; if (keyCodeSetting != null) { ((SettingInputUICell)this).RegisterSettingListener(setting); TextMeshProUGUI? obj = text; KeyCode value = keyCodeSetting.Value; ((TMP_Text)obj).text = ((object)(KeyCode)(ref value)).ToString(); ((UnityEvent)button.onClick).AddListener((UnityAction)delegate { StartKeybindCapture(keyCodeSetting, settingHandler2); }); } } protected override void OnSettingChangedExternal(Setting setting) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) ((SettingInputUICell)this).OnSettingChangedExternal(setting); if ((Object)(object)text != (Object)null && setting is BepInExKeyCode bepInExKeyCode) { TextMeshProUGUI? obj = text; KeyCode value = bepInExKeyCode.Value; ((TMP_Text)obj).text = ((object)(KeyCode)(ref value)).ToString(); } } protected override void OnDestroy() { if ((Object)(object)detectingKey == (Object)(object)this) { detectingKey = null; } } private static IEnumerator WaitForKey(Action<KeyCode> onKeyDetected) { while ((Object)(object)detectingKey != (Object)null) { foreach (KeyCode value in Enum.GetValues(typeof(KeyCode))) { if (Input.GetKeyDown(value)) { onKeyDetected?.Invoke(value); yield break; } } yield return null; } } private void StartKeybindCapture(BepInExKeyCode setting, ISettingHandler settingHandler) { BepInExKeyCode setting2 = setting; ISettingHandler settingHandler2 = settingHandler; if ((Object)(object)detectingKey != (Object)null) { return; } detectingKey = this; if ((Object)(object)text != (Object)null) { ((TMP_Text)text).text = "SELECT A KEY"; } ((MonoBehaviour)this).StartCoroutine(WaitForKey(delegate(KeyCode key) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) if (!BlackListed.Contains(key)) { setting2.SetValue(key, settingHandler2); } ((SettingInputUICell)this).OnSettingChangedExternal((Setting)(object)setting2); detectingKey = null; })); } } } namespace PEAKLib.ModConfig.Hooks { [MonoDetourTargets(typeof(MenuWindow))] internal static class MenuWindowHooks { public static GameObject? SettingsCellPrefab { get; internal set; } [MonoDetourHookInitialize] private static void Init() { Start.Prefix(Prefix_Start); } private static void Prefix_Start(MenuWindow self) { MainMenu val = (MainMenu)(object)((self is MainMenu) ? self : null); if (val == null) { return; } MenuWindow settingsMenu = val.settingsMenu; PauseMainMenu val2 = (PauseMainMenu)(object)((settingsMenu is PauseMainMenu) ? settingsMenu : null); if (val2 != null) { SharedSettingsMenu componentInChildren = ((Component)val2).GetComponentInChildren<SharedSettingsMenu>(); if ((Object)(object)componentInChildren != (Object)null) { SettingsCellPrefab = componentInChildren.m_settingsCellPrefab; } } } } } namespace PEAKLib.ModConfig.Components { internal class ModdedSettingsTABS : TABS<ModdedTABSButton> { public ModdedSettingsMenu? SettingsMenu; public override void OnSelected(ModdedTABSButton button) { ThrowHelper.ThrowIfFieldNull<ModdedSettingsMenu>(SettingsMenu, "SettingsMenu"); SettingsMenu.ShowSettings(button.category); } } internal class ModdedTABSButton : TAB_Button { public string category = ""; public GameObject? SelectedGraphic; private void Update() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) ((Graphic)base.text).color = Color.Lerp(((Graphic)base.text).color, ((TAB_Button)this).Selected ? Color.black : Color.white, Time.unscaledDeltaTime * 7f); if ((Object)(object)SelectedGraphic != (Object)null) { SelectedGraphic.gameObject.SetActive(((TAB_Button)this).Selected); } } } internal class ModdedSettingsMenu : MonoBehaviour { private List<IExposedSetting>? settings; private readonly List<SettingsUICell> m_spawnedCells = new List<SettingsUICell>(); private Coroutine? m_fadeInCoroutine; private string search = ""; public ModdedSettingsTABS Tabs { get; set; } public Transform Content { get; set; } private void OnEnable() { RefreshSettings(); if ((Object)(object)Tabs != (Object)null && (Object)(object)((TABS<ModdedTABSButton>)(object)Tabs).selectedButton != (Object)null) { ((TABS<ModdedTABSButton>)(object)Tabs).Select(((TABS<ModdedTABSButton>)(object)Tabs).selectedButton); } } public void SetSearch(string search) { this.search = search.ToLower(); ShowSettings(((TABS<ModdedTABSButton>)(object)Tabs).selectedButton.category); } public void ShowSettings(string category) { string category2 = category; if (m_fadeInCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(m_fadeInCoroutine); m_fadeInCoroutine = null; } foreach (SettingsUICell spawnedCell in m_spawnedCells) { Object.Destroy((Object)(object)((Component)spawnedCell).gameObject); } m_spawnedCells.Clear(); RefreshSettings(); if (settings == null) { return; } bool isSearching = !string.IsNullOrEmpty(search); foreach (IExposedSetting item in from <>h__TransparentIdentifier1 in (from <>h__TransparentIdentifier0 in settings.Where((IExposedSetting setting) => setting != null && setting is IBepInExProperty).Select(delegate(IExposedSetting setting) { int searchCheck; if (isSearching) { string displayName = setting.GetDisplayName(); searchCheck = ((displayName != null && (displayName.ToLower()?.Contains(search)).GetValueOrDefault()) ? 1 : 0); } else { searchCheck = 0; } return new { setting = setting, searchCheck = ((byte)searchCheck != 0) }; }) let notSearching = !isSearching && setting.GetCategory() == category2.ToString() where searchCheck || notSearching select <>h__TransparentIdentifier1).Where(<>h__TransparentIdentifier1 => { IExposedSetting setting2 = <>h__TransparentIdentifier1.<>h__TransparentIdentifier0.setting; IConditionalSetting val2 = (IConditionalSetting)(object)((setting2 is IConditionalSetting) ? setting2 : null); return val2 == null || val2.ShouldShow(); }) select <>h__TransparentIdentifier1.<>h__TransparentIdentifier0.setting) { if ((Object)(object)MenuWindowHooks.SettingsCellPrefab == (Object)null) { ModConfigPlugin.Log.LogError((object)"SettingsCellPrefab has not been loaded."); return; } Setting val = (Setting)(object)((item is Setting) ? item : null); if (val == null) { ModConfigPlugin.Log.LogError((object)"Invalid IExposedSetting"); return; } SettingsUICell component = Object.Instantiate<GameObject>(MenuWindowHooks.SettingsCellPrefab, Content).GetComponent<SettingsUICell>(); m_spawnedCells.Add(component); ((TMP_Text)component.m_text).text = item.GetDisplayName(); component.m_canvasGroup = ((Component)component).GetComponent<CanvasGroup>(); component.m_canvasGroup.alpha = 0f; Object.Instantiate<GameObject>(val.GetSettingUICell(), component.m_settingsContentParent).GetComponent<SettingInputUICell>().Setup(val, (ISettingHandler)(object)GameHandler.Instance.SettingsHandler); } m_fadeInCoroutine = ((MonoBehaviour)this).StartCoroutine(FadeInCells()); } public void RefreshSettings() { if ((Object)(object)GameHandler.Instance != (Object)null) { settings = ISettingsHandlerExtensions.GetSettingsThatImplements<IExposedSetting>((ISettingHandler)(object)GameHandler.Instance.SettingsHandler); } } private IEnumerator FadeInCells() { int i = 0; foreach (SettingsUICell spawnedCell in m_spawnedCells) { spawnedCell.FadeIn(); yield return (object)new WaitForSecondsRealtime(0.05f); i++; } m_fadeInCoroutine = null; } } } namespace System.Diagnostics.CodeAnalysis { [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class ConstantExpectedAttribute : Attribute { public object? Min { get; set; } public object? Max { get; set; } } [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class ExperimentalAttribute : Attribute { public string DiagnosticId { get; } public string? UrlFormat { get; set; } public ExperimentalAttribute(string diagnosticId) { DiagnosticId = diagnosticId; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] internal sealed class MemberNotNullAttribute : Attribute { public string[] Members { get; } public MemberNotNullAttribute(string member) { Members = new string[1] { member }; } public MemberNotNullAttribute(params string[] members) { Members = members; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] internal sealed class MemberNotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public string[] Members { get; } public MemberNotNullWhenAttribute(bool returnValue, string member) { ReturnValue = returnValue; Members = new string[1] { member }; } public MemberNotNullWhenAttribute(bool returnValue, params string[] members) { ReturnValue = returnValue; Members = members; } } [AttributeUsage(AttributeTargets.Constructor, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class SetsRequiredMembersAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class StringSyntaxAttribute : Attribute { public const string CompositeFormat = "CompositeFormat"; public const string DateOnlyFormat = "DateOnlyFormat"; public const string DateTimeFormat = "DateTimeFormat"; public const string EnumFormat = "EnumFormat"; public const string GuidFormat = "GuidFormat"; public const string Json = "Json"; public const string NumericFormat = "NumericFormat"; public const string Regex = "Regex"; public const string TimeOnlyFormat = "TimeOnlyFormat"; public const string TimeSpanFormat = "TimeSpanFormat"; public const string Uri = "Uri"; public const string Xml = "Xml"; public string Syntax { get; } public object?[] Arguments { get; } public StringSyntaxAttribute(string syntax) { Syntax = syntax; Arguments = new object[0]; } public StringSyntaxAttribute(string syntax, params object?[] arguments) { Syntax = syntax; Arguments = arguments; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class UnscopedRefAttribute : Attribute { } } namespace System.Runtime.Versioning { [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class RequiresPreviewFeaturesAttribute : Attribute { public string? Message { get; } public string? Url { get; set; } public RequiresPreviewFeaturesAttribute() { } public RequiresPreviewFeaturesAttribute(string? message) { Message = message; } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class CallerArgumentExpressionAttribute : Attribute { public string ParameterName { get; } public CallerArgumentExpressionAttribute(string parameterName) { ParameterName = parameterName; } } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class CollectionBuilderAttribute : Attribute { public Type BuilderType { get; } public string MethodName { get; } public CollectionBuilderAttribute(Type builderType, string methodName) { BuilderType = builderType; MethodName = methodName; } } [AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class CompilerFeatureRequiredAttribute : Attribute { public const string RefStructs = "RefStructs"; public const string RequiredMembers = "RequiredMembers"; public string FeatureName { get; } public bool IsOptional { get; set; } public CompilerFeatureRequiredAttribute(string featureName) { FeatureName = featureName; } } [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class InterpolatedStringHandlerArgumentAttribute : Attribute { public string[] Arguments { get; } public InterpolatedStringHandlerArgumentAttribute(string argument) { Arguments = new string[1] { argument }; } public InterpolatedStringHandlerArgumentAttribute(params string[] arguments) { Arguments = arguments; } } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class InterpolatedStringHandlerAttribute : Attribute { } [EditorBrowsable(EditorBrowsableState.Never)] [ExcludeFromCodeCoverage] internal static class IsExternalInit { } [AttributeUsage(AttributeTargets.Method, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class ModuleInitializerAttribute : Attribute { } [AttributeUsage(AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class OverloadResolutionPriorityAttribute : Attribute { public int Priority { get; } public OverloadResolutionPriorityAttribute(int priority) { Priority = priority; } } [AttributeUsage(AttributeTargets.Parameter, Inherited = true, AllowMultiple = false)] [ExcludeFromCodeCoverage] internal sealed class ParamCollectionAttribute : Attribute { } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class RequiredMemberAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [EditorBrowsable(EditorBrowsableState.Never)] [ExcludeFromCodeCoverage] internal sealed class RequiresLocationAttribute : Attribute { } [AttributeUsage(AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Event | AttributeTargets.Interface, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class SkipLocalsInitAttribute : Attribute { } }
mods/com.github.PEAKModding.PEAKLib.UI.dll
Decompiled 2 weeks agousing System; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using Microsoft.CodeAnalysis; using MonoDetour; using MonoDetour.Cil; using MonoDetour.DetourTypes; using MonoDetour.HookGen; using On.MenuWindow; using On.PauseOptionsMenu; using PEAKLib.Core; using PEAKLib.UI.Elements; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.TextCore; using UnityEngine.UI; using Zorro.Core; using Zorro.Settings; using Zorro.Settings.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("PEAKModding, Rafa")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("UI module of the PEAKLib community API for the game PEAK.")] [assembly: AssemblyFileVersion("1.3.0.0")] [assembly: AssemblyInformationalVersion("1.3.0+9f92ed4622ec2139755c37f9193f7cc77e010734")] [assembly: AssemblyProduct("com.github.PEAKModding.PEAKLib.UI")] [assembly: AssemblyTitle("PEAKLib.UI")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.3.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 On.PauseOptionsMenu { internal static class Initialize { public delegate void PrefixSignature(PauseOptionsMenu self); public delegate void PostfixSignature(PauseOptionsMenu self); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(PauseOptionsMenu); MethodInfo method = typeFromHandle.GetMethod("Initialize", (BindingFlags)(-1), null, Array.Empty<Type>(), null); if ((object)method == null) { throw new MissingMethodException("PauseOptionsMenu", "Initialize"); } return method; } } internal static class get_openOnStart { } internal static class get_selectOnOpen { } internal static class get_objectToSelectOnOpen { } internal static class get_closeOnPause { } internal static class get_closeOnUICancel { } internal static class InviteFriends { } internal static class OnOpen { } internal static class OnClose { } internal static class OpenBadgeMenu { } internal static class OpenSettingsMenu { } internal static class OpenControlsMenu { } internal static class _ctor { } } namespace On.MenuWindow { internal static class Start { public delegate void PrefixSignature(MenuWindow self); public delegate void PostfixSignature(MenuWindow self); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(MenuWindow); MethodInfo method = typeFromHandle.GetMethod("Start", (BindingFlags)(-1), null, Array.Empty<Type>(), null); if ((object)method == null) { throw new MissingMethodException("MenuWindow", "Start"); } return method; } } internal static class Initialize { public delegate void PrefixSignature(MenuWindow self); public delegate void PostfixSignature(MenuWindow self); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(MenuWindow); MethodInfo method = typeFromHandle.GetMethod("Initialize", (BindingFlags)(-1), null, Array.Empty<Type>(), null); if ((object)method == null) { throw new MissingMethodException("MenuWindow", "Initialize"); } return method; } } internal static class get_openOnStart { } internal static class get_selectOnOpen { } internal static class get_objectToSelectOnOpen { } internal static class get_closeOnPause { } internal static class get_closeOnUICancel { } internal static class get_blocksPlayerInput { } internal static class get_showCursorWhileOpen { } internal static class get_autoHideOnClose { } internal static class get_isOpen { } internal static class set_isOpen { } internal static class get_inputActive { } internal static class set_inputActive { } internal static class get_initialized { } internal static class set_initialized { } internal static class get_panel { } internal static class Update { } internal static class TestCloseViaInput { } internal static class Open { } internal static class OnOpen { } internal static class OnDestroy { } internal static class CloseAllWindows { } internal static class StartClosed { } internal static class Close { } internal static class ForceClose { } internal static class OnClose { } internal static class Show { } internal static class Hide { } internal static class SetInputActive { } internal static class SelectStartingElement { } internal static class _ctor { } internal static class _cctor { } } namespace MonoDetour.HookGen { internal static class DefaultMonoDetourManager { internal static MonoDetourManager Instance { get; } = New(); internal static MonoDetourManager New() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown return new MonoDetourManager(typeof(DefaultMonoDetourManager).Assembly.GetName().Name); } } [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class, AllowMultiple = true, Inherited = false)] internal class MonoDetourTargetsAttribute : Attribute, IMonoDetourTargets { public Type? TargetType { get; } public bool IncludeNestedTypes { get; set; } public bool DistinguishOverloadsByName { get; set; } public string[]? Members { get; set; } public string[]? MemberNamePrefixes { get; set; } public string[]? MemberNameSuffixes { get; set; } public bool GenerateControlFlowVariants { get; set; } public MonoDetourTargetsAttribute(Type? targetType = null) { TargetType = targetType; IncludeNestedTypes = true; base..ctor(); } } } namespace BepInEx { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class BepInAutoPluginAttribute : Attribute { public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace BepInEx.Preloader.Core.Patching { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class PatcherAutoPluginAttribute : Attribute { public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace PEAKLib.UI { public static class ElementExtensions { public static T ParentTo<T>(this T instance, Transform transform) where T : PeakElement { ThrowHelper.ThrowIfArgumentNull<T>(instance, "instance"); ThrowHelper.ThrowIfArgumentNull<Transform>(transform, "transform"); ((Component)instance).transform.SetParent(transform, false); return instance; } public static T ParentTo<T>(this T instance, Component component) where T : PeakElement { ThrowHelper.ThrowIfArgumentNull<T>(instance, "instance"); ThrowHelper.ThrowIfArgumentNull<Component>(component, "component"); Transform val = ThrowHelper.ThrowIfFieldNull<Transform>(component.transform, "component.transform"); ((Component)instance).transform.SetParent(val, false); return instance; } public static GameObject ParentTo(this GameObject instance, Transform transform) { ThrowHelper.ThrowIfArgumentNull<GameObject>(instance, "instance"); ThrowHelper.ThrowIfArgumentNull<Transform>(transform, "transform"); instance.transform.SetParent(transform, false); return instance; } public static GameObject ParentTo(this GameObject instance, Component component) { ThrowHelper.ThrowIfArgumentNull<GameObject>(instance, "instance"); ThrowHelper.ThrowIfArgumentNull<Component>(component, "component"); Transform val = ThrowHelper.ThrowIfFieldNull<Transform>(component.transform, "component.transform"); instance.transform.SetParent(val, false); return instance; } public static T SetSiblingIndex<T>(this T instance, int index) where T : PeakElement { ThrowHelper.ThrowIfArgumentNull<T>(instance, "instance"); ((Component)instance).transform.SetSiblingIndex(index); return instance; } public static GameObject SetSiblingIndex(this GameObject instance, int index) { ThrowHelper.ThrowIfArgumentNull<GameObject>(instance, "instance"); instance.transform.SetSiblingIndex(index); return instance; } public static T SetPosition<T>(this T instance, Vector2 position) where T : PeakElement { //IL_0017: Unknown result type (might be due to invalid IL or missing references) ThrowHelper.ThrowIfArgumentNull<T>(instance, "instance"); instance.RectTransform.anchoredPosition = position; return instance; } public static T SetSize<T>(this T instance, Vector2 size) where T : PeakElement { //IL_0017: Unknown result type (might be due to invalid IL or missing references) ThrowHelper.ThrowIfArgumentNull<T>(instance, "instance"); instance.RectTransform.sizeDelta = size; return instance; } public static T SetOffsetMin<T>(this T instance, Vector2 offsetMin) where T : PeakElement { //IL_0017: Unknown result type (might be due to invalid IL or missing references) ThrowHelper.ThrowIfArgumentNull<T>(instance, "instance"); instance.RectTransform.offsetMin = offsetMin; return instance; } public static T SetOffsetMax<T>(this T instance, Vector2 offsetMax) where T : PeakElement { //IL_0017: Unknown result type (might be due to invalid IL or missing references) ThrowHelper.ThrowIfArgumentNull<T>(instance, "instance"); instance.RectTransform.offsetMax = offsetMax; return instance; } public static T SetAnchorMin<T>(this T instance, Vector2 anchorMin) where T : PeakElement { //IL_0017: Unknown result type (might be due to invalid IL or missing references) ThrowHelper.ThrowIfArgumentNull<T>(instance, "instance"); instance.RectTransform.anchorMin = anchorMin; return instance; } public static T SetAnchorMax<T>(this T instance, Vector2 anchorMax) where T : PeakElement { //IL_0017: Unknown result type (might be due to invalid IL or missing references) ThrowHelper.ThrowIfArgumentNull<T>(instance, "instance"); instance.RectTransform.anchorMax = anchorMax; return instance; } public static T SetAnchorMinMax<T>(this T instance, Vector2 anchorValue) where T : PeakElement { //IL_0017: 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) ThrowHelper.ThrowIfArgumentNull<T>(instance, "instance"); instance.RectTransform.anchorMin = anchorValue; instance.RectTransform.anchorMax = anchorValue; return instance; } public static T SetPivot<T>(this T instance, Vector2 pivot) where T : PeakElement { //IL_0017: Unknown result type (might be due to invalid IL or missing references) ThrowHelper.ThrowIfArgumentNull<T>(instance, "instance"); instance.RectTransform.pivot = pivot; return instance; } public static T AlignToParent<T>(this T instance, UIAlignment alignment) where T : PeakElement { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0066: 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_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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_00c3: 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_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0119: 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_00f4: Unknown result type (might be due to invalid IL or missing references) ThrowHelper.ThrowIfArgumentNull<T>(instance, "instance"); ThrowHelper.ThrowIfArgumentNull<UIAlignment>(alignment, "alignment"); Vector2 val = (Vector2)(alignment switch { UIAlignment.TopLeft => new Vector2(0f, 1f), UIAlignment.TopCenter => new Vector2(0.5f, 1f), UIAlignment.TopRight => new Vector2(1f, 1f), UIAlignment.MiddleLeft => new Vector2(0f, 0.5f), UIAlignment.MiddleCenter => new Vector2(0.5f, 0.5f), UIAlignment.MiddleRight => new Vector2(1f, 0.5f), UIAlignment.BottomLeft => new Vector2(0f, 0f), UIAlignment.BottomCenter => new Vector2(0.5f, 0f), UIAlignment.BottomRight => new Vector2(1f, 0f), _ => Vector2.zero, }); RectTransform rectTransform = instance.RectTransform; rectTransform.anchorMin = val; rectTransform.anchorMax = val; rectTransform.pivot = val; rectTransform.anchoredPosition = Vector2.zero; return instance; } public static T ExpandToParent<T>(this T instance) where T : PeakElement { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) ThrowHelper.ThrowIfArgumentNull<T>(instance, "instance"); RectTransform rectTransform = instance.RectTransform; rectTransform.anchorMin = Vector2.zero; rectTransform.anchorMax = Vector2.one; rectTransform.offsetMin = Vector2.zero; rectTransform.offsetMax = Vector2.zero; return instance; } public static GameObject ExpandToParent(this GameObject instance) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) ThrowHelper.ThrowIfArgumentNull<GameObject>(instance, "instance"); Transform transform = instance.transform; RectTransform val = (RectTransform)(object)((transform is RectTransform) ? transform : null); if (val == null) { throw new Exception("[" + ((Object)instance).name + "] does not contain a RectTransform"); } val.anchorMin = Vector2.zero; val.anchorMax = Vector2.one; val.offsetMin = Vector2.zero; val.offsetMax = Vector2.zero; return instance; } public static T AddLocalization<T>(this T instance, string text, Language language) where T : PeakLocalizableElement { //IL_00ba: Unknown result type (might be due to invalid IL or missing references) ThrowHelper.ThrowIfArgumentNull<T>(instance, "instance"); if (((Object)instance).name == "UI_PeakText") { throw new Exception("You need to use a unique name to use localization. E.g. MenuAPI.CreateText(\"my cool text\", \"mymod_my_unique_name\")"); } TMP_Text val = ThrowHelper.ThrowIfFieldNull<TMP_Text>(instance.Text, "instance.Text"); string index = ((Object)instance).name.ToUpperInvariant(); LocalizedText val2 = instance.localizedText; if ((Object)(object)val2 == (Object)null) { val2 = ((Component)val).gameObject.AddComponent<LocalizedText>(); val2.index = index; val2.tmp = instance.Text; instance.localizedText = val2; } if (string.IsNullOrEmpty(instance.unlocalizedText)) { instance.unlocalizedText = text; } MenuAPI.CreateLocalizationInternal(index, text, language); val.text = val2.GetText(); return instance; } public static T SetLocalizationIndex<T>(this T instance, string index) where T : PeakLocalizableElement { ThrowHelper.ThrowIfArgumentNull<T>(instance, "instance"); TMP_Text val = ThrowHelper.ThrowIfFieldNull<TMP_Text>(instance.Text, "instance.Text"); LocalizedText val2 = instance.localizedText; if ((Object)(object)val2 == (Object)null) { val2 = ((Component)val).gameObject.AddComponent<LocalizedText>(); val2.tmp = instance.Text; instance.localizedText = val2; } val2.index = index; val.text = val2.GetText(); return instance; } public static T SetLocalizationIndex<T>(this T instance, TranslationKey translationKey) where T : PeakLocalizableElement { ThrowHelper.ThrowIfArgumentNull<T>(instance, "instance"); ThrowHelper.ThrowIfArgumentNull<TranslationKey>(translationKey, "translationKey"); instance.SetLocalizationIndex(translationKey.Index); return instance; } } public static class MenuAPI { public delegate void BuilderDelegate(Transform transform); internal static BuilderDelegate? pauseMenuBuilderDelegate; internal static BuilderDelegate? mainMenuBuilderDelegate; internal static BuilderDelegate? settingsMenuBuilderDelegate; public const float OPTIONS_WIDTH = 277f; public static void AddToMainMenu(BuilderDelegate builderDelegate) { mainMenuBuilderDelegate = (BuilderDelegate)Delegate.Combine(mainMenuBuilderDelegate, builderDelegate); } public static void AddToPauseMenu(BuilderDelegate builderDelegate) { pauseMenuBuilderDelegate = (BuilderDelegate)Delegate.Combine(pauseMenuBuilderDelegate, builderDelegate); } public static void AddToSettingsMenu(BuilderDelegate builderDelegate) { settingsMenuBuilderDelegate = (BuilderDelegate)Delegate.Combine(settingsMenuBuilderDelegate, builderDelegate); } public static PeakCustomPage CreatePage(string pageName) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) ThrowHelper.ThrowIfArgumentNullOrWhiteSpace(pageName, "pageName"); return new GameObject(pageName).AddComponent<PeakCustomPage>(); } public static PeakCustomPage CreatePageWithBackground(string pageName) { return CreatePage(pageName).CreateBackground(); } public static PeakMenuButton CreateMenuButton(string buttonName) { ThrowHelper.ThrowIfFieldNull<string>(buttonName, "buttonName"); if ((Object)(object)Templates.ButtonTemplate == (Object)null) { throw new Exception("You're creating MenuButton too early! Prefab hasn't been loaded yet."); } GameObject val = Object.Instantiate<GameObject>(Templates.ButtonTemplate); ((Object)val).name = "UI_MainMenuButton_" + buttonName; PeakMenuButton peakMenuButton = val.AddComponent<PeakMenuButton>(); return peakMenuButton.SetText(buttonName); } public static PeakMenuButton CreatePauseMenuButton(string buttonName) { return CreateMenuButton(buttonName).SetWidth(277f); } public static PeakText CreateText(string displayText) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown GameObject val = new GameObject("UI_PeakText", new Type[1] { typeof(PeakText) }); return val.GetComponent<PeakText>().SetText(displayText); } public static PeakText CreateText(string displayText, string objectName = "UI_PeakText") { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown ThrowHelper.ThrowIfArgumentNull<string>(displayText, "displayText"); ThrowHelper.ThrowIfArgumentNullOrWhiteSpace(objectName, "objectName"); GameObject val = new GameObject(objectName, new Type[1] { typeof(PeakText) }); return val.GetComponent<PeakText>().SetText(displayText); } public static PeakButton CreateButton(string buttonName) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown ThrowHelper.ThrowIfFieldNullOrWhiteSpace(buttonName, "buttonName"); GameObject val = new GameObject(buttonName); return val.AddComponent<PeakButton>(); } public static PeakScrollableContent CreateScrollableContent(string scrollableName) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return new GameObject(scrollableName).AddComponent<PeakScrollableContent>(); } public static PeakTextInput CreateTextInput(string inputName) { PeakTextInput peakTextInput = PeakTextInput.Create(); ((Object)peakTextInput).name = inputName; return peakTextInput; } internal static void CreateLocalizationInternal(string index, string translation, Language language) { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected I4, but got Unknown string translation2 = translation; index = index.ToUpperInvariant(); if (!LocalizedText.MAIN_TABLE.TryGetValue(index, out var value)) { value = new List<string>(); value.AddRange(from Language _ in Enum.GetValues(typeof(Language)) select translation2); LocalizedText.MAIN_TABLE.Add(index, value); } else { value[(int)language] = translation2; } } public static TranslationKey CreateLocalization(string index) { if (string.IsNullOrEmpty(index)) { throw new ArgumentNullException("index"); } return new TranslationKey(index); } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.github.PEAKModding.PEAKLib.UI", "PEAKLib.UI", "1.3.0")] public class UIPlugin : BaseUnityPlugin { public const string Id = "com.github.PEAKModding.PEAKLib.UI"; internal static ManualLogSource Log { get; } = Logger.CreateLogSource(Name); public static string Name => "PEAKLib.UI"; public static string Version => "1.3.0"; private void Awake() { MonoDetourManager.InvokeHookInitializers(typeof(UIPlugin).Assembly); Log.LogInfo((object)("Plugin " + Name + " is loaded!")); } } public record TranslationKey(string Index) { public TranslationKey AddLocalization(string text, Language language) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) MenuAPI.CreateLocalizationInternal(Index, text, language); return this; } } public enum UIAlignment { TopLeft, TopCenter, TopRight, MiddleLeft, MiddleCenter, MiddleRight, BottomLeft, BottomCenter, BottomRight } public static class Utilities { public static Color GetContrastingColor(Color input, float shiftAmount = 0.2f) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) float num = default(float); float num2 = default(float); float num3 = default(float); Color.RGBToHSV(input, ref num, ref num2, ref num3); num3 = ((!(num3 > 0.5f)) ? Mathf.Clamp01(num3 + shiftAmount) : Mathf.Clamp01(num3 - shiftAmount)); return Color.HSVToRGB(num, num2, num3); } public static void ExpandToParent(RectTransform target) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) ThrowHelper.ThrowIfArgumentNull<RectTransform>(target, "target"); if ((Object)(object)((Transform)target).parent == (Object)null) { throw new NullReferenceException("field target.parent is null!"); } target.anchorMin = Vector2.zero; target.anchorMax = Vector2.one; target.offsetMin = Vector2.zero; target.offsetMax = Vector2.zero; } } } namespace PEAKLib.UI.Hooks { [MonoDetourTargets(typeof(MenuWindow))] internal static class MenuWindowHooks { [MonoDetourHookInitialize] private static void Init() { Start.Prefix(Prefix_Start); } private static void Prefix_Start(MenuWindow self) { PauseMainMenu val = (PauseMainMenu)(object)((self is PauseMainMenu) ? self : null); if (val != null) { SharedSettingsMenu componentInChildren = ((Component)val).GetComponentInChildren<SharedSettingsMenu>(); if ((Object)(object)componentInChildren != (Object)null) { MenuAPI.settingsMenuBuilderDelegate?.Invoke(((Component)componentInChildren).transform); } } else { PauseSettingsMenu val2 = (PauseSettingsMenu)(object)((self is PauseSettingsMenu) ? self : null); if (val2 != null) { SharedSettingsMenu componentInChildren2 = ((Component)val2).GetComponentInChildren<SharedSettingsMenu>(); if ((Object)(object)componentInChildren2 != (Object)null) { MenuAPI.settingsMenuBuilderDelegate?.Invoke(((Component)componentInChildren2).transform); } } } MainMenu val3 = (MainMenu)(object)((self is MainMenu) ? self : null); if (val3 == null) { return; } MenuWindow settingsMenu = val3.settingsMenu; PauseMainMenu val4 = (PauseMainMenu)(object)((settingsMenu is PauseMainMenu) ? settingsMenu : null); if (val4 == null) { return; } SharedSettingsMenu componentInChildren3 = ((Component)val4).GetComponentInChildren<SharedSettingsMenu>(); if ((Object)(object)componentInChildren3 != (Object)null) { Templates.SettingsCellPrefab = componentInChildren3.m_settingsCellPrefab; } else { UIPlugin.Log.LogError((object)"Failed to find SharedSettingsMenu in MenuWindowHooks.Prefix_Start. This should not occur, please report it on PeakLib GitHub."); } if ((Object)(object)Templates.ButtonTemplate == (Object)null) { Templates.ButtonTemplate = Object.Instantiate<GameObject>(((Component)val4.backButton).gameObject); ((Object)Templates.ButtonTemplate).name = "PeakUIButton"; LocalizedText componentInChildren4 = Templates.ButtonTemplate.GetComponentInChildren<LocalizedText>(); if ((Object)(object)componentInChildren4 != (Object)null) { Object.DestroyImmediate((Object)(object)componentInChildren4); } Object.DontDestroyOnLoad((Object)(object)Templates.ButtonTemplate); } MenuAPI.mainMenuBuilderDelegate?.Invoke(((Component)val3.playWithFriendsButton).transform.parent); } } [MonoDetourTargets(typeof(PauseOptionsMenu))] internal static class PauseMenuHooks { [MonoDetourHookInitialize] private static void Init() { On.PauseOptionsMenu.Initialize.Prefix(Prefix_Initialize); } private static void Prefix_Initialize(PauseOptionsMenu self) { Transform val = ((Component)self).transform.Find("MainPage/Options"); if ((Object)(object)val != (Object)null) { MenuAPI.pauseMenuBuilderDelegate?.Invoke(val); } else { UIPlugin.Log.LogError((object)"Failed to find \"MainPage/Options\" in PauseMenuHooks.Prefix_Initialize. This should not occur, please report it on PeakLib GitHub."); } } } } namespace PEAKLib.UI.Elements { [RequireComponent(typeof(Button))] public class PeakButton : PeakElement { public Button Button { get; set; } public PeakText Text { get; set; } private void Awake() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) base.RectTransform = ((Component)this).GetComponent<RectTransform>(); Image component = ElementExtensions.ParentTo(new GameObject("Image", new Type[1] { typeof(Image) }), ((Component)this).transform).ExpandToParent().GetComponent<Image>(); ((Graphic)component).color = new Color(0.1792453f, 0.1253449f, 0.09046815f, 62f / 85f); Text = MenuAPI.CreateText(((Object)this).name, "Text (TMP)").ParentTo(((Component)this).transform).ExpandToParent() .SetPosition(Vector2.zero); Button = ((Component)this).GetComponent<Button>(); ((Selectable)Button).image = component; TextMeshProUGUI textMesh = Text.TextMesh; ((TMP_Text)textMesh).enableAutoSizing = true; ((TMP_Text)textMesh).fontSizeMin = 18f; ((TMP_Text)textMesh).fontSizeMax = 22f; ((TMP_Text)textMesh).fontSize = 22f; ((TMP_Text)textMesh).fontStyle = (FontStyles)16; ((TMP_Text)textMesh).alignment = (TextAlignmentOptions)514; } public PeakButton SetWidth(float width) { //IL_001e: 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) ThrowHelper.ThrowIfFieldNull<RectTransform>(base.RectTransform, "RectTransform"); base.RectTransform.sizeDelta = new Vector2(width, base.RectTransform.sizeDelta.y); return this; } public PeakButton SetHeight(float height) { //IL_001d: 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) ThrowHelper.ThrowIfFieldNull<RectTransform>(base.RectTransform, "RectTransform"); base.RectTransform.sizeDelta = new Vector2(base.RectTransform.sizeDelta.x, height); return this; } public PeakButton OnClick(UnityAction onClickEvent) { ThrowHelper.ThrowIfArgumentNull<UnityAction>(onClickEvent, "onClickEvent"); ((UnityEvent)Button.onClick).AddListener(onClickEvent); return this; } } [RequireComponent(typeof(RectTransform))] [RequireComponent(typeof(Canvas))] [RequireComponent(typeof(CanvasScaler))] [RequireComponent(typeof(GraphicRaycaster))] public class PeakCustomPage : MenuWindow { public static readonly Color DEFAULT_BACKGROUND_COLOR = new Color(0f, 0f, 0f, 0.9569f); private UnityAction? onCloseAction; private UnityAction? onOpenAction; private Canvas Canvas { get; set; } private CanvasScaler Scaler { get; set; } private Image? Background { get; set; } public override bool openOnStart => OpenOnStart; public override bool selectOnOpen => SelectOnOpen; public override bool closeOnPause => CloseOnPause; public override bool closeOnUICancel => CloseOnUICancel; public override bool autoHideOnClose => AutoHideOnClose; public override bool blocksPlayerInput => BlocksPlayerInput; public override bool showCursorWhileOpen => ShowCursorWhileOpen; public bool OpenOnStart { get; set; } public bool SelectOnOpen { get; set; } = true; public bool CloseOnPause { get; set; } = true; public bool CloseOnUICancel { get; set; } = true; public bool AutoHideOnClose { get; set; } = true; public bool BlocksPlayerInput { get; set; } = true; public bool ShowCursorWhileOpen { get; set; } = true; private void Awake() { //IL_0059: Unknown result type (might be due to invalid IL or missing references) Canvas = ((Component)this).GetComponent<Canvas>(); Canvas.renderMode = (RenderMode)0; Canvas.additionalShaderChannels = (AdditionalCanvasShaderChannels)31; Canvas.sortingOrder = 1; Scaler = ((Component)this).GetComponent<CanvasScaler>(); Scaler.uiScaleMode = (ScaleMode)1; Scaler.referenceResolution = new Vector2(1920f, 1080f); Scaler.matchWidthOrHeight = 1f; } public PeakCustomPage CreateBackground(Color? backgroundColor = null) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_0067: 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_007e: 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_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Background == (Object)null) { GameObject val = new GameObject("Background", new Type[2] { typeof(CanvasRenderer), typeof(Image) }); val.transform.SetParent(((Component)this).transform, false); Background = val.GetComponent<Image>(); RectTransform rectTransform = ((Graphic)Background).rectTransform; rectTransform.anchorMin = Vector2.zero; rectTransform.anchorMax = Vector2.one; Vector2 offsetMin = (rectTransform.offsetMax = Vector2.zero); rectTransform.offsetMin = offsetMin; if (!backgroundColor.HasValue) { backgroundColor = DEFAULT_BACKGROUND_COLOR; } ((Graphic)Background).color = backgroundColor.Value; } return this; } public override void OnClose() { UnityAction? obj = onCloseAction; if (obj != null) { obj.Invoke(); } } public override void OnOpen() { UnityAction? obj = onOpenAction; if (obj != null) { obj.Invoke(); } } public PeakCustomPage SetOnClose(UnityAction onCloseEvent) { onCloseAction = onCloseEvent; return this; } public PeakCustomPage SetOnOpen(UnityAction onOpenEvent) { onOpenAction = onOpenEvent; return this; } } [RequireComponent(typeof(RectTransform))] public class PeakElement : MonoBehaviour { public RectTransform RectTransform { get; internal set; } private void Awake() { RectTransform = ((Component)this).GetComponent<RectTransform>(); } } [RequireComponent(typeof(ScrollRect))] [RequireComponent(typeof(RectMask2D))] public class PeakHorizontalTabs : PeakElement { private RectTransform Content { get; set; } private void Awake() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_006a: 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_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Expected O, but got Unknown //IL_00f1: Unknown result type (might be due to invalid IL or missing references) base.RectTransform = ((Component)this).GetComponent<RectTransform>(); base.RectTransform.anchoredPosition = new Vector2(0f, 0f); base.RectTransform.sizeDelta = new Vector2(0f, 40f); base.RectTransform.pivot = new Vector2(0.5f, 1f); base.RectTransform.anchorMin = new Vector2(0f, 1f); base.RectTransform.anchorMax = new Vector2(1f, 1f); ScrollRect component = ((Component)this).GetComponent<ScrollRect>(); GameObject val = new GameObject("Content", new Type[3] { typeof(RectTransform), typeof(HorizontalLayoutGroup), typeof(ContentSizeFitter) }); Content = val.GetComponent<RectTransform>(); ((Transform)Content).SetParent(((Component)this).transform, false); Content.pivot = Vector2.zero; Utilities.ExpandToParent(Content); component.content = Content; component.scrollSensitivity = 50f; component.elasticity = 0f; component.vertical = false; component.horizontal = true; component.movementType = (MovementType)2; HorizontalLayoutGroup component2 = ((Component)Content).GetComponent<HorizontalLayoutGroup>(); ((HorizontalOrVerticalLayoutGroup)component2).spacing = 20f; ((HorizontalOrVerticalLayoutGroup)component2).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)component2).childForceExpandWidth = true; ((HorizontalOrVerticalLayoutGroup)component2).childForceExpandHeight = true; ((HorizontalOrVerticalLayoutGroup)component2).childControlHeight = true; ContentSizeFitter component3 = ((Component)Content).GetComponent<ContentSizeFitter>(); component3.horizontalFit = (FitMode)2; } public GameObject AddTab(string tabName) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Expected O, but got Unknown //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Expected O, but got Unknown //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(tabName, new Type[3] { typeof(RectTransform), typeof(Button), typeof(LayoutElement) }); val.transform.SetParent((Transform)(object)Content, false); LayoutElement component = val.GetComponent<LayoutElement>(); component.minWidth = 220f; component.flexibleWidth = 1f; component.preferredHeight = 40f; RectTransform component2 = ElementExtensions.ParentTo(new GameObject("Image", new Type[2] { typeof(RectTransform), typeof(Image) }), val.transform).GetComponent<RectTransform>(); Utilities.ExpandToParent(component2); Image component3 = ((Component)component2).GetComponent<Image>(); ((Graphic)component3).color = new Color(0.1792453f, 0.1253449f, 0.09046815f, 62f / 85f); RectTransform component4 = ElementExtensions.ParentTo(new GameObject("Selected", new Type[2] { typeof(RectTransform), typeof(Image) }), val.transform).GetComponent<RectTransform>(); Utilities.ExpandToParent(component4); PeakText peakText = new GameObject("Text (TMP)", new Type[1] { typeof(PeakText) }).GetComponent<PeakText>().ParentTo(val.transform); RectTransform component5 = ((Component)peakText).GetComponent<RectTransform>(); component5.anchorMin = Vector2.zero; component5.anchorMax = Vector2.one; component5.pivot = Vector2.zero; component5.anchoredPosition = Vector2.zero; ((TMP_Text)peakText.TextMesh).enableAutoSizing = true; ((TMP_Text)peakText.TextMesh).fontSizeMin = 18f; ((TMP_Text)peakText.TextMesh).fontSizeMax = 22f; ((TMP_Text)peakText.TextMesh).fontSize = 22f; ((TMP_Text)peakText.TextMesh).fontStyle = (FontStyles)16; ((TMP_Text)peakText.TextMesh).alignment = (TextAlignmentOptions)514; ((TMP_Text)peakText.TextMesh).text = tabName; return val; } } [RequireComponent(typeof(RectTransform))] public class PeakLocalizableElement : PeakElement { internal string unlocalizedText = ""; internal LocalizedText? localizedText; public TMP_Text Text { get; internal set; } internal void SetTextInternal(string text) { ThrowHelper.ThrowIfFieldNull<TMP_Text>(Text, "Text").text = text; unlocalizedText = text; } } public class PeakMenuButton : PeakLocalizableElement { public Button Button { get; private set; } public Image Panel { get; private set; } public Image BorderTop { get; private set; } public Image BorderBottom { get; private set; } private void Awake() { base.RectTransform = ((Component)this).GetComponent<RectTransform>(); Button = ((Component)this).GetComponent<Button>(); Panel = ((Component)((Component)this).transform.Find("Panel")).GetComponent<Image>(); base.Text = (TMP_Text)(object)((Component)((Component)this).transform.Find("Text")).GetComponent<TextMeshProUGUI>(); BorderTop = ((Component)((Component)this).transform.Find("Border")).GetComponent<Image>(); BorderBottom = ((Component)((Component)this).transform.GetChild(((Component)BorderTop).transform.GetSiblingIndex() + 1)).GetComponent<Image>(); } public PeakMenuButton SetText(string text) { SetTextInternal(text); return this; } public PeakMenuButton SetColor(Color color, bool automaticBorderColor = true) { //IL_0010: 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_0020: Unknown result type (might be due to invalid IL or missing references) ((Graphic)ThrowHelper.ThrowIfFieldNull<Image>(Panel, "Panel")).color = color; if (automaticBorderColor) { SetBorderColor(Utilities.GetContrastingColor(color)); } return this; } public PeakMenuButton SetBorderColor(Color color) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) ((Graphic)ThrowHelper.ThrowIfFieldNull<Image>(BorderTop, "BorderTop")).color = color; ((Graphic)ThrowHelper.ThrowIfFieldNull<Image>(BorderBottom, "BorderBottom")).color = color; return this; } public PeakMenuButton SetWidth(float width) { //IL_001e: 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) ThrowHelper.ThrowIfFieldNull<RectTransform>(base.RectTransform, "RectTransform"); base.RectTransform.sizeDelta = new Vector2(width, base.RectTransform.sizeDelta.y); return this; } public PeakMenuButton OnClick(UnityAction onClickEvent) { ThrowHelper.ThrowIfArgumentNull<UnityAction>(onClickEvent, "onClickEvent"); ((UnityEvent)Button.onClick).AddListener(onClickEvent); return this; } } [RequireComponent(typeof(RectTransform))] [RequireComponent(typeof(RectMask2D))] [RequireComponent(typeof(ScrollRect))] public class PeakScrollableContent : PeakElement { public RectTransform Content { get; private set; } private void Awake() { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Expected O, but got Unknown //IL_00a4: Unknown result type (might be due to invalid IL or missing references) base.RectTransform = ((Component)this).GetComponent<RectTransform>(); ScrollRect component = ((Component)this).GetComponent<ScrollRect>(); component.scrollSensitivity = 50f; component.elasticity = 0f; component.vertical = true; component.horizontal = false; component.movementType = (MovementType)2; GameObject val = new GameObject("Content", new Type[3] { typeof(RectTransform), typeof(VerticalLayoutGroup), typeof(ContentSizeFitter) }); Content = val.GetComponent<RectTransform>(); ((Transform)Content).SetParent(((Component)this).transform, false); Content.pivot = new Vector2(0.5f, 1f); VerticalLayoutGroup component2 = val.GetComponent<VerticalLayoutGroup>(); ((HorizontalOrVerticalLayoutGroup)component2).childControlHeight = false; ((HorizontalOrVerticalLayoutGroup)component2).childForceExpandHeight = false; Utilities.ExpandToParent(Content); ContentSizeFitter component3 = val.GetComponent<ContentSizeFitter>(); component3.verticalFit = (FitMode)2; component.content = Content; } } [RequireComponent(typeof(CanvasRenderer))] [RequireComponent(typeof(TextMeshProUGUI))] public class PeakText : PeakLocalizableElement { private static TMP_FontAsset? _darumaFontAsset; private static TMP_FontAsset DarumaDropOne { get { if ((Object)(object)_darumaFontAsset == (Object)null) { TMP_FontAsset[] source = Resources.FindObjectsOfTypeAll<TMP_FontAsset>(); _darumaFontAsset = ((IEnumerable<TMP_FontAsset>)source).FirstOrDefault((Func<TMP_FontAsset, bool>)delegate(TMP_FontAsset fontAsset) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) FaceInfo faceInfo = ((TMP_Asset)fontAsset).faceInfo; return ((FaceInfo)(ref faceInfo)).familyName == "Daruma Drop One"; }); } return _darumaFontAsset; } } public TextMeshProUGUI TextMesh => (TextMeshProUGUI)base.Text; private void Awake() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: 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_0087: Unknown result type (might be due to invalid IL or missing references) base.RectTransform = ((Component)this).GetComponent<RectTransform>(); base.Text = (TMP_Text)(object)((Component)this).GetComponent<TextMeshProUGUI>(); RectTransform rectTransform = base.RectTransform; RectTransform rectTransform2 = base.RectTransform; Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(0f, 1f); rectTransform2.anchorMax = val; rectTransform.anchorMin = val; base.RectTransform.pivot = new Vector2(0f, 1f); ((TMP_Text)TextMesh).font = DarumaDropOne; ((Graphic)TextMesh).color = Color.white; base.RectTransform.sizeDelta = ((TMP_Text)TextMesh).GetPreferredValues(); } public PeakText SetText(string text) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) SetTextInternal(text); ThrowHelper.ThrowIfFieldNull<RectTransform>(base.RectTransform, "RectTransform").sizeDelta = ((TMP_Text)TextMesh).GetPreferredValues(); return this; } public PeakText SetFontSize(float size) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) ((TMP_Text)ThrowHelper.ThrowIfFieldNull<TextMeshProUGUI>(TextMesh, "TextMesh")).fontSize = size; ThrowHelper.ThrowIfFieldNull<RectTransform>(base.RectTransform, "RectTransform").sizeDelta = ((TMP_Text)TextMesh).GetPreferredValues(); return this; } public PeakText SetColor(Color color) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) ((Graphic)ThrowHelper.ThrowIfFieldNull<TextMeshProUGUI>(TextMesh, "TextMesh")).color = color; return this; } } public class PeakTextInput : PeakElement { private static GameObject? _textInputPrefab; internal static GameObject TextInputPrefab { get { //IL_011b: 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_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: 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) if ((Object)(object)_textInputPrefab == (Object)null) { if ((Object)(object)SingletonAsset<InputCellMapper>.Instance == (Object)null || (Object)(object)SingletonAsset<InputCellMapper>.Instance.FloatSettingCell == (Object)null) { throw new Exception("Tried to create a TextInput but prefab was not found. Please wait until the game fully loads to create UI elements."); } _textInputPrefab = Object.Instantiate<GameObject>(SingletonAsset<InputCellMapper>.Instance.FloatSettingCell); ((Object)_textInputPrefab).name = "PeakTextInput"; Transform transform = _textInputPrefab.transform; RectTransform val = (RectTransform)(object)((transform is RectTransform) ? transform : null); if (val != null) { val.anchorMin = new Vector2(0f, 1f); val.anchorMax = new Vector2(0f, 1f); val.offsetMin = Vector2.zero; val.offsetMax = Vector2.zero; val.pivot = new Vector2(0.5f, 0.5f); val.sizeDelta = new Vector2(200f, 80f); } FloatSettingUI component = _textInputPrefab.GetComponent<FloatSettingUI>(); TMP_InputField inputField = component.inputField; Object.DestroyImmediate((Object)(object)((Component)component.slider).gameObject); Object.DestroyImmediate((Object)(object)component); inputField.characterValidation = (CharacterValidation)0; RectTransform component2 = ((Component)inputField).GetComponent<RectTransform>(); component2.pivot = new Vector2(0.5f, 0.5f); Utilities.ExpandToParent(component2); TextMeshProUGUI[] componentsInChildren = ((Component)inputField).GetComponentsInChildren<TextMeshProUGUI>(); TextMeshProUGUI[] array = componentsInChildren; foreach (TextMeshProUGUI val2 in array) { float num2 = (((TMP_Text)val2).fontSizeMax = 22f); float fontSize = (((TMP_Text)val2).fontSizeMin = num2); ((TMP_Text)val2).fontSize = fontSize; ((TMP_Text)val2).alignment = (TextAlignmentOptions)4097; } Object.DontDestroyOnLoad((Object)(object)_textInputPrefab); } return _textInputPrefab; } } public TMP_InputField InputField { get; private set; } private TextMeshProUGUI Placeholder { get; set; } internal static PeakTextInput Create() { return Object.Instantiate<GameObject>(TextInputPrefab).AddComponent<PeakTextInput>(); } private void Awake() { base.RectTransform = ((Component)this).GetComponent<RectTransform>(); InputField = ((Component)this).GetComponentInChildren<TMP_InputField>(); Placeholder = ((Component)InputField.placeholder).GetComponent<TextMeshProUGUI>(); ((TMP_Text)Placeholder).text = ""; } public PeakTextInput OnValueChanged(UnityAction<string> onValueChanged) { ThrowHelper.ThrowIfArgumentNull<UnityAction<string>>(onValueChanged, "onValueChanged"); ((UnityEvent<string>)(object)InputField.onValueChanged).AddListener(onValueChanged); return this; } public PeakTextInput SetPlaceholder(string placeholder) { ((TMP_Text)Placeholder).text = placeholder; return this; } } internal static class Templates { internal static GameObject? ButtonTemplate { get; set; } internal static GameObject? SettingsCellPrefab { get; set; } } } namespace System.Diagnostics.CodeAnalysis { [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class ConstantExpectedAttribute : Attribute { public object? Min { get; set; } public object? Max { get; set; } } [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class ExperimentalAttribute : Attribute { public string DiagnosticId { get; } public string? UrlFormat { get; set; } public ExperimentalAttribute(string diagnosticId) { DiagnosticId = diagnosticId; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] internal sealed class MemberNotNullAttribute : Attribute { public string[] Members { get; } public MemberNotNullAttribute(string member) { Members = new string[1] { member }; } public MemberNotNullAttribute(params string[] members) { Members = members; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] internal sealed class MemberNotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public string[] Members { get; } public MemberNotNullWhenAttribute(bool returnValue, string member) { ReturnValue = returnValue; Members = new string[1] { member }; } public MemberNotNullWhenAttribute(bool returnValue, params string[] members) { ReturnValue = returnValue; Members = members; } } [AttributeUsage(AttributeTargets.Constructor, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class SetsRequiredMembersAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class StringSyntaxAttribute : Attribute { public const string CompositeFormat = "CompositeFormat"; public const string DateOnlyFormat = "DateOnlyFormat"; public const string DateTimeFormat = "DateTimeFormat"; public const string EnumFormat = "EnumFormat"; public const string GuidFormat = "GuidFormat"; public const string Json = "Json"; public const string NumericFormat = "NumericFormat"; public const string Regex = "Regex"; public const string TimeOnlyFormat = "TimeOnlyFormat"; public const string TimeSpanFormat = "TimeSpanFormat"; public const string Uri = "Uri"; public const string Xml = "Xml"; public string Syntax { get; } public object?[] Arguments { get; } public StringSyntaxAttribute(string syntax) { Syntax = syntax; Arguments = new object[0]; } public StringSyntaxAttribute(string syntax, params object?[] arguments) { Syntax = syntax; Arguments = arguments; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class UnscopedRefAttribute : Attribute { } } namespace System.Runtime.Versioning { [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class RequiresPreviewFeaturesAttribute : Attribute { public string? Message { get; } public string? Url { get; set; } public RequiresPreviewFeaturesAttribute() { } public RequiresPreviewFeaturesAttribute(string? message) { Message = message; } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class CallerArgumentExpressionAttribute : Attribute { public string ParameterName { get; } public CallerArgumentExpressionAttribute(string parameterName) { ParameterName = parameterName; } } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class CollectionBuilderAttribute : Attribute { public Type BuilderType { get; } public string MethodName { get; } public CollectionBuilderAttribute(Type builderType, string methodName) { BuilderType = builderType; MethodName = methodName; } } [AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class CompilerFeatureRequiredAttribute : Attribute { public const string RefStructs = "RefStructs"; public const string RequiredMembers = "RequiredMembers"; public string FeatureName { get; } public bool IsOptional { get; set; } public CompilerFeatureRequiredAttribute(string featureName) { FeatureName = featureName; } } [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class InterpolatedStringHandlerArgumentAttribute : Attribute { public string[] Arguments { get; } public InterpolatedStringHandlerArgumentAttribute(string argument) { Arguments = new string[1] { argument }; } public InterpolatedStringHandlerArgumentAttribute(params string[] arguments) { Arguments = arguments; } } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class InterpolatedStringHandlerAttribute : Attribute { } [EditorBrowsable(EditorBrowsableState.Never)] [ExcludeFromCodeCoverage] internal static class IsExternalInit { } [AttributeUsage(AttributeTargets.Method, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class ModuleInitializerAttribute : Attribute { } [AttributeUsage(AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class OverloadResolutionPriorityAttribute : Attribute { public int Priority { get; } public OverloadResolutionPriorityAttribute(int priority) { Priority = priority; } } [AttributeUsage(AttributeTargets.Parameter, Inherited = true, AllowMultiple = false)] [ExcludeFromCodeCoverage] internal sealed class ParamCollectionAttribute : Attribute { } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class RequiredMemberAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [EditorBrowsable(EditorBrowsableState.Never)] [ExcludeFromCodeCoverage] internal sealed class RequiresLocationAttribute : Attribute { } [AttributeUsage(AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Event | AttributeTargets.Interface, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class SkipLocalsInitAttribute : Attribute { } }
mods/com.github.PEAKModding.SoftDependencyFix.dll
Decompiled 2 weeks agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoDetour; using MonoDetour.Cil; using MonoDetour.HookGen; using MonoMod.Cil; using Zorro.Core; using Zorro.Core.CLI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("com.github.PEAKModding.SoftDependencyFix")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+ee09ae38ab0d2f0cd373140fafd8d926693d9b2e")] [assembly: AssemblyProduct("com.github.PEAKModding.SoftDependencyFix")] [assembly: AssemblyTitle("SoftDependencyFix")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.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 MonoDetour.HookGen { internal static class DefaultMonoDetourManager { internal static MonoDetourManager Instance { get; } = New(); internal static MonoDetourManager New() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown return new MonoDetourManager(typeof(DefaultMonoDetourManager).Assembly.GetName().Name); } } [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class, AllowMultiple = true, Inherited = false)] internal class MonoDetourTargetsAttribute : Attribute, IMonoDetourTargets { public Type? TargetType { get; } public bool IncludeNestedTypes { get; set; } public bool DistinguishOverloadsByName { get; set; } public string[]? Members { get; set; } public string[]? MemberNamePrefixes { get; set; } public string[]? MemberNameSuffixes { get; set; } public bool GenerateControlFlowVariants { get; set; } public MonoDetourTargetsAttribute(Type? targetType = null) { TargetType = targetType; IncludeNestedTypes = true; base..ctor(); } } } namespace BepInEx { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class BepInAutoPluginAttribute : Attribute { public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace BepInEx.Preloader.Core.Patching { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class PatcherAutoPluginAttribute : Attribute { public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace SoftDependencyFix { [BepInPlugin("com.github.PEAKModding.SoftDependencyFix", "SoftDependencyFix", "1.0.0")] public class Plugin : BaseUnityPlugin { public const string Id = "com.github.PEAKModding.SoftDependencyFix"; internal static ManualLogSource Log { get; private set; } public static string Name => "SoftDependencyFix"; public static string Version => "1.0.0"; private void Awake() { Log = ((BaseUnityPlugin)this).Logger; ReflectionUtilityHooks.Init(); Log.LogInfo((object)("Plugin " + Name + " is loaded!")); } } internal static class ReflectionUtilityHooks { [CompilerGenerated] private static class <>O { public static Func<(MethodInfo, ConsoleCommandAttribute)[]> <0>__GetMethodsWithAttribute; public static Manipulator <1>__WrapTryCatch; public static Func<ReflectionTypeLoadException, Type[]> <2>__GetTypesFromException; } internal static void Init() { //IL_0030: 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_003b: Expected O, but got Unknown //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Expected O, but got Unknown MonoDetourManager instance = DefaultMonoDetourManager.Instance; Func<(MethodInfo, ConsoleCommandAttribute)[]> func = ReflectionUtility.GetMethodsWithAttribute<ConsoleCommandAttribute>; object obj = <>O.<1>__WrapTryCatch; if (obj == null) { Manipulator val = WrapTryCatch; <>O.<1>__WrapTryCatch = val; obj = (object)val; } instance.ILHook((Delegate)func, (Manipulator)obj, (MonoDetourConfig)null, true); MonoDetourManager instance2 = DefaultMonoDetourManager.Instance; MethodInfo methodInfo = typeof(ReflectionUtility).GetMethod("GetClassesWithAttribute", Array.Empty<Type>()).MakeGenericMethod(typeof(TypeParserAttribute)); object obj2 = <>O.<1>__WrapTryCatch; if (obj2 == null) { Manipulator val2 = WrapTryCatch; <>O.<1>__WrapTryCatch = val2; obj2 = (object)val2; } instance2.ILHook((MethodBase)methodInfo, (Manipulator)obj2, (MonoDetourConfig)null, true); } private static void WrapTryCatch(ILManipulationInfo info) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_00b0: Unknown result type (might be due to invalid IL or missing references) ILWeaver w = new ILWeaver(info); int locAssemblyTypes = 0; ILWeaverResult val = default(ILWeaverResult); w.MatchRelaxed(new Predicate<Instruction>[2] { (Instruction x) => ILPatternMatchingExt.MatchCallvirt<Assembly>(x, "GetTypes") && w.SetCurrentTo(x), (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref locAssemblyTypes) }).Extract(ref val); if (!val.IsValid) { Plugin.Log.LogError((object)val.FailureMessage); return; } w.HandlerWrapTryCatchStackSizeNonZeroOnCurrent(typeof(ReflectionTypeLoadException), (IEnumerable<Instruction>)new <>z__ReadOnlyArray<Instruction>((Instruction[])(object)new Instruction[2] { w.CreateCall((Delegate)new Func<ReflectionTypeLoadException, Type[]>(GetTypesFromException)), w.Create(OpCodes.Stloc, locAssemblyTypes) })); } private static Type[] GetTypesFromException(ReflectionTypeLoadException ex) { List<Type> list = new List<Type>(); list.AddRange(ex.Types.Where((Type type) => (object)type != null)); return list.ToArray(); } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } } [CompilerGenerated] internal sealed class <>z__ReadOnlyArray<T> : IEnumerable, ICollection, IList, IEnumerable<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection<T>, IList<T> { int ICollection.Count => _items.Length; bool ICollection.IsSynchronized => false; object ICollection.SyncRoot => this; object IList.this[int index] { get { return _items[index]; } set { throw new NotSupportedException(); } } bool IList.IsFixedSize => true; bool IList.IsReadOnly => true; int IReadOnlyCollection<T>.Count => _items.Length; T IReadOnlyList<T>.this[int index] => _items[index]; int ICollection<T>.Count => _items.Length; bool ICollection<T>.IsReadOnly => true; T IList<T>.this[int index] { get { return _items[index]; } set { throw new NotSupportedException(); } } public <>z__ReadOnlyArray(T[] items) { _items = items; } IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)_items).GetEnumerator(); } void ICollection.CopyTo(Array array, int index) { ((ICollection)_items).CopyTo(array, index); } int IList.Add(object value) { throw new NotSupportedException(); } void IList.Clear() { throw new NotSupportedException(); } bool IList.Contains(object value) { return ((IList)_items).Contains(value); } int IList.IndexOf(object value) { return ((IList)_items).IndexOf(value); } void IList.Insert(int index, object value) { throw new NotSupportedException(); } void IList.Remove(object value) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } IEnumerator<T> IEnumerable<T>.GetEnumerator() { return ((IEnumerable<T>)_items).GetEnumerator(); } void ICollection<T>.Add(T item) { throw new NotSupportedException(); } void ICollection<T>.Clear() { throw new NotSupportedException(); } bool ICollection<T>.Contains(T item) { return ((ICollection<T>)_items).Contains(item); } void ICollection<T>.CopyTo(T[] array, int arrayIndex) { ((ICollection<T>)_items).CopyTo(array, arrayIndex); } bool ICollection<T>.Remove(T item) { throw new NotSupportedException(); } int IList<T>.IndexOf(T item) { return ((IList<T>)_items).IndexOf(item); } void IList<T>.Insert(int index, T item) { throw new NotSupportedException(); } void IList<T>.RemoveAt(int index) { throw new NotSupportedException(); } }
mods/Fly Mod.dll
Decompiled 2 weeks agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Photon.Pun; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("Fly Mod")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Fly Mod")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("7dfa9d89-00a3-42d6-aa91-7d70ee301435")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] [BepInPlugin("com.lamia.flymod", "FlyMod", "1.2.1")] public class FlyMod : BaseUnityPlugin { internal static ConfigEntry<float> BaseForce; internal static ConfigEntry<float> VerticalForce; internal static ConfigEntry<float> SprintMultiplier; internal static ConfigEntry<float> GravityPull; internal static ConfigEntry<float> MaxClamp; internal static ConfigEntry<KeyCode> FlyKey; internal static ConfigEntry<bool> ToggleFly; internal static ConfigEntry<bool> CreativeFlyMode; internal static ManualLogSource Log; private void Awake() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; Log.LogInfo((object)"FlyMod loaded."); Harmony val = new Harmony("com.lamia.flymod"); val.PatchAll(); CreativeFlyMode = ((BaseUnityPlugin)this).Config.Bind<bool>("FlyMod", "CreativeFlyMode", true, "If true, flying feels more like noclipping in Garry's Mod or manuevering a 3d environment. Setting this to false makes flying feel more like a superhero or being boosted by a Jetpack."); FlyKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("FlyMod", "FlyKey", (KeyCode)118, "Key to activate flying (default: Mouse3/Middle mouse button)."); ToggleFly = ((BaseUnityPlugin)this).Config.Bind<bool>("FlyMod", "ToggleFly", true, "If true, fly is toggled on/off with the key instead of holding."); BaseForce = ((BaseUnityPlugin)this).Config.Bind<float>("FlyMod", "BaseForce", 800f, "Base force applied when flying forward/backward/sideways."); VerticalForce = ((BaseUnityPlugin)this).Config.Bind<float>("FlyMod", "VerticalForce", 800f, "Force applied when flying up or down."); SprintMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("FlyMod", "SprintMultiplier", 4f, "Multiplier when holding shift."); MaxClamp = ((BaseUnityPlugin)this).Config.Bind<float>("FlyMod", "MaxClamp", 4000f, "Clamp for maximum fly speed in any direction."); } } [HarmonyPatch(typeof(Character), "Awake")] public static class PalThrow { [HarmonyPostfix] public static void AwakePatch(Character __instance) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown if (__instance.IsLocal && (Object)((Component)__instance).GetComponent<FlyModPatch>() == (Object)null) { ((Component)__instance).gameObject.AddComponent<FlyModPatch>(); FlyMod.Log.LogInfo((object)("FlyModPatch added to: " + ((Object)__instance).name)); } } } public class FlyModPatch : MonoBehaviourPun { private Character character; private CharacterMovement charMovement; private bool flyActive = false; private void Start() { character = ((Component)this).GetComponent<Character>(); charMovement = ((Component)this).GetComponent<CharacterMovement>(); } private void Update() { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_011a: 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_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_0271: 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_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_02fb: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_02ff: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Unknown result type (might be due to invalid IL or missing references) //IL_034f: Unknown result type (might be due to invalid IL or missing references) //IL_03b4: Unknown result type (might be due to invalid IL or missing references) //IL_0428: Unknown result type (might be due to invalid IL or missing references) //IL_042f: Unknown result type (might be due to invalid IL or missing references) if (!character.IsLocal) { return; } if (FlyMod.ToggleFly.Value && Input.GetKeyDown(FlyMod.FlyKey.Value)) { flyActive = !flyActive; } if (!Input.GetKey(FlyMod.FlyKey.Value) && !flyActive) { return; } if (FlyMod.CreativeFlyMode.Value) { character.data.isGrounded = true; } else { character.data.sinceGrounded = 0.5f; } Vector3 val = character.data.lookDirection; if (Input.GetKey((KeyCode)119) || !FlyMod.CreativeFlyMode.Value) { val *= FlyMod.VerticalForce.Value; } else if (Input.GetKey((KeyCode)115) && FlyMod.CreativeFlyMode.Value) { val *= 0f - FlyMod.VerticalForce.Value; } Vector3 val2 = Vector3.Cross(Vector3.up, character.data.lookDirection); Vector3 val3 = ((Vector3)(ref val2)).normalized * FlyMod.VerticalForce.Value; if (Input.GetKey((KeyCode)100)) { val = ((!FlyMod.CreativeFlyMode.Value) ? (val + val3 / 8f) : (val + val3)); } if (Input.GetKey((KeyCode)97)) { val = ((!FlyMod.CreativeFlyMode.Value) ? (val - val3 / 8f) : (val - val3)); } if (Input.GetKey((KeyCode)32)) { val = ((!FlyMod.CreativeFlyMode.Value) ? (val + Vector3.up * (FlyMod.VerticalForce.Value / 8f)) : (val + Vector3.up * FlyMod.VerticalForce.Value)); } else if (Input.GetKey((KeyCode)306) && FlyMod.CreativeFlyMode.Value) { val += Vector3.down * FlyMod.VerticalForce.Value; } if (Input.GetKey((KeyCode)304)) { character.AddStamina(charMovement.sprintStaminaUsage * Time.deltaTime); val *= FlyMod.SprintMultiplier.Value; } val = ((!FlyMod.CreativeFlyMode.Value) ? (val + Vector3.up * 240f) : (val + Vector3.down * 100f)); val.x = Mathf.Clamp(val.x, 0f - FlyMod.MaxClamp.Value, FlyMod.MaxClamp.Value); val.y = Mathf.Clamp(val.y, 0f - FlyMod.MaxClamp.Value, FlyMod.MaxClamp.Value); val.z = Mathf.Clamp(val.z, 0f - FlyMod.MaxClamp.Value, FlyMod.MaxClamp.Value); foreach (Bodypart part in character.refs.ragdoll.partList) { if (FlyMod.CreativeFlyMode.Value) { part.AddForce(val, (ForceMode)0); } else if (!((object)(BodypartType)(ref part.partType)).ToString().Contains("Leg") && !((object)(BodypartType)(ref part.partType)).ToString().Contains("Knee") && !((object)(BodypartType)(ref part.partType)).ToString().Contains("Foot")) { part.AddForce(val / 7f, (ForceMode)5); } } } }
mods/PEAK-AIO.dll
Decompiled 2 weeks agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Numerics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Threading.Tasks; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using DearImGuiInjection; using DearImGuiInjection.BepInEx; using HarmonyLib; using ImGuiNET; using Photon.Pun; using Photon.Realtime; using UnityEngine; using UnityEngine.SceneManagement; using Zorro.Core.Serizalization; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("PEAK-AIO")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("PEAK-AIO")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("0e070e16-c355-4db0-804c-0510a5aa436e")] [assembly: AssemblyFileVersion("1.0.2.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.2.0")] public static class ConfigManager { public static ManualLogSource Logger; public static ConfigEntry<bool> InfiniteStamina; public static ConfigEntry<bool> FlyMod; public static ConfigEntry<float> FlySpeed; public static ConfigEntry<float> FlyAcceleration; public static ConfigEntry<bool> LockStatus; public static ConfigEntry<bool> NoWeight; public static ConfigEntry<bool> SpeedMod; public static ConfigEntry<bool> JumpMod; public static ConfigEntry<bool> NoFallDmg; public static ConfigEntry<bool> ClimbMod; public static ConfigEntry<bool> VineClimbMod; public static ConfigEntry<bool> RopeClimbMod; public static ConfigEntry<float> SpeedAmount; public static ConfigEntry<float> JumpAmount; public static ConfigEntry<float> ClimbAmount; public static ConfigEntry<float> VineClimbAmount; public static ConfigEntry<float> RopeClimbAmount; public static ConfigEntry<float> RechargeAmountSlot1; public static ConfigEntry<float> RechargeAmountSlot2; public static ConfigEntry<float> RechargeAmountSlot3; public static ConfigEntry<bool> TeleportToPing; public static void Init(ConfigFile config, ManualLogSource logger) { //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Expected O, but got Unknown //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Expected O, but got Unknown //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Expected O, but got Unknown Logger = logger; InfiniteStamina = config.Bind<bool>("Cheats", "InfiniteStamina", false, "Enable infinite stamina"); TeleportToPing = config.Bind<bool>("Cheats", "TeleportToPing", false, "Automatically teleport to ping location"); FlyMod = config.Bind<bool>("Cheats", "Fly Mod", false, "Enables fly mode when checked."); FlySpeed = config.Bind<float>("Cheats", "Fly Speed", 100f, "Speed used when flying."); FlyAcceleration = config.Bind<float>("Cheats", "Fly Acceleration", 300f, "Acceleration used when flying."); LockStatus = config.Bind<bool>("Afflictions", "LockStatus", false, (ConfigDescription)null); NoWeight = config.Bind<bool>("Afflictions", "NoWeight", false, (ConfigDescription)null); SpeedMod = config.Bind<bool>("Character", "SpeedMod", false, (ConfigDescription)null); JumpMod = config.Bind<bool>("Character", "JumpMod", false, (ConfigDescription)null); NoFallDmg = config.Bind<bool>("Character", "NoFallDmg", false, (ConfigDescription)null); ClimbMod = config.Bind<bool>("Character", "ClimbMod", false, (ConfigDescription)null); VineClimbMod = config.Bind<bool>("Character", "VineClimbMod", false, (ConfigDescription)null); RopeClimbMod = config.Bind<bool>("Character", "RopeClimbMod", false, (ConfigDescription)null); SpeedAmount = config.Bind<float>("Character", "SpeedAmount", 1f, (ConfigDescription)null); JumpAmount = config.Bind<float>("Character", "JumpAmount", 10f, (ConfigDescription)null); ClimbAmount = config.Bind<float>("Character", "ClimbAmount", 1f, (ConfigDescription)null); VineClimbAmount = config.Bind<float>("Character", "VineClimbAmount", 1f, (ConfigDescription)null); RopeClimbAmount = config.Bind<float>("Character", "RopeClimbAmount", 1f, (ConfigDescription)null); RechargeAmountSlot1 = config.Bind<float>("Inventory", "RechargeAmountSlot1", 100f, new ConfigDescription("Recharge amount for slot 1", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 999f), Array.Empty<object>())); RechargeAmountSlot2 = config.Bind<float>("Inventory", "RechargeAmountSlot2", 100f, new ConfigDescription("Recharge amount for slot 2", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 999f), Array.Empty<object>())); RechargeAmountSlot3 = config.Bind<float>("Inventory", "RechargeAmountSlot3", 100f, new ConfigDescription("Recharge amount for slot 3", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 999f), Array.Empty<object>())); Logger.LogInfo((object)"[PEAK AIO][ConfigManager] Config Loaded."); } } internal static class ConstantFields { private static PropertyInfo infiniteStaminaProp; private static PropertyInfo statusLockProp; private static FieldInfo fallDamageTimeField; private static FieldInfo staminaField; private static FieldInfo movementModifierField; private static FieldInfo jumpGravityField; private static FieldInfo climbSpeedModField; private static FieldInfo vineClimbSpeedModField; private static FieldInfo ropeClimbSpeedModField; private static MethodInfo setStatusMethod; private static Array statusEnumValues; public static PropertyInfo GetInfiniteStaminaProperty() { if (infiniteStaminaProp == null) { infiniteStaminaProp = typeof(Character).GetProperty("infiniteStam", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } return infiniteStaminaProp; } public static PropertyInfo GetStatusLockProperty() { if (statusLockProp == null) { statusLockProp = typeof(Character).GetProperty("statusesLocked", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } return statusLockProp; } public static FieldInfo GetFallDamageTimeField() { if (fallDamageTimeField == null) { fallDamageTimeField = typeof(CharacterMovement).GetField("fallDamageTime", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } return fallDamageTimeField; } public static FieldInfo GetStaminaField() { if (staminaField == null) { staminaField = typeof(CharacterData).GetField("_stam", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } return staminaField; } public static FieldInfo GetMovementModifierField() { if (movementModifierField == null) { movementModifierField = typeof(CharacterMovement).GetField("movementModifier", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } return movementModifierField; } public static FieldInfo GetJumpGravityField() { if (jumpGravityField == null) { jumpGravityField = typeof(CharacterMovement).GetField("jumpGravity", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } return jumpGravityField; } public static FieldInfo GetClimbSpeedModField() { if (climbSpeedModField == null) { climbSpeedModField = typeof(CharacterClimbing).GetField("climbSpeedMod", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } return climbSpeedModField; } public static FieldInfo GetVineClimbSpeedModField() { if (vineClimbSpeedModField == null) { vineClimbSpeedModField = typeof(CharacterVineClimbing).GetField("climbSpeedMod", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } return vineClimbSpeedModField; } public static FieldInfo GetRopeClimbSpeedModField() { if (ropeClimbSpeedModField == null) { ropeClimbSpeedModField = typeof(CharacterRopeHandling).GetField("climbSpeedMod", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } return ropeClimbSpeedModField; } public static MethodInfo GetSetStatusMethod() { if (setStatusMethod == null) { setStatusMethod = typeof(CharacterAfflictions).GetMethod("SetStatus", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } return setStatusMethod; } public static Array GetStatusEnumValues() { if (statusEnumValues == null) { statusEnumValues = Enum.GetValues(typeof(STATUSTYPE)); } return statusEnumValues; } public static void RefreshAll() { infiniteStaminaProp = null; statusLockProp = null; fallDamageTimeField = null; staminaField = null; movementModifierField = null; jumpGravityField = null; climbSpeedModField = null; vineClimbSpeedModField = null; ropeClimbSpeedModField = null; setStatusMethod = null; statusEnumValues = null; } } public class EventComponent : MonoBehaviour { private void Update() { CharacterMovement movementComponent = GameHelpers.GetMovementComponent(); if ((Object)(object)movementComponent != (Object)null) { if (ConfigManager.SpeedMod.Value) { ConstantFields.GetMovementModifierField()?.SetValue(movementComponent, ConfigManager.SpeedAmount.Value); } if (ConfigManager.JumpMod.Value) { ConstantFields.GetJumpGravityField()?.SetValue(movementComponent, ConfigManager.JumpAmount.Value); if (ConfigManager.NoFallDmg.Value) { ConstantFields.GetFallDamageTimeField()?.SetValue(movementComponent, 999f); } } } Character characterComponent = GameHelpers.GetCharacterComponent(); if ((Object)(object)characterComponent != (Object)null) { if (ConfigManager.InfiniteStamina.Value) { ConstantFields.GetInfiniteStaminaProperty()?.SetValue(characterComponent, true); } if (ConfigManager.LockStatus.Value) { ConstantFields.GetStatusLockProperty()?.SetValue(characterComponent, true); } } CharacterClimbing climbingComponent = GameHelpers.GetClimbingComponent(); if ((Object)(object)climbingComponent != (Object)null && ConfigManager.ClimbMod.Value) { ConstantFields.GetClimbSpeedModField()?.SetValue(climbingComponent, ConfigManager.ClimbAmount.Value); } CharacterVineClimbing vineClimbComponent = GameHelpers.GetVineClimbComponent(); if ((Object)(object)vineClimbComponent != (Object)null && ConfigManager.VineClimbMod.Value) { ConstantFields.GetVineClimbSpeedModField()?.SetValue(vineClimbComponent, ConfigManager.VineClimbAmount.Value); } CharacterRopeHandling ropeClimbComponent = GameHelpers.GetRopeClimbComponent(); if ((Object)(object)ropeClimbComponent != (Object)null && ConfigManager.RopeClimbMod.Value) { ConstantFields.GetRopeClimbSpeedModField()?.SetValue(ropeClimbComponent, ConfigManager.RopeClimbAmount.Value); } } } internal static class GameHelpers { private static Character character; private static CharacterData characterData; private static CharacterMovement movementComponent; private static CharacterAfflictions afflictionsComponent; private static CharacterClimbing climbingComponent; private static CharacterVineClimbing vineClimbingComponent; private static CharacterRopeHandling ropeClimbingComponent; public static Character GetCharacterComponent() { if ((Object)(object)character == (Object)null || !((Behaviour)character).isActiveAndEnabled) { character = Character.localCharacter; } return character; } public static CharacterData GetCharacterData() { if ((Object)(object)characterData == (Object)null || !((Behaviour)characterData).isActiveAndEnabled) { characterData = Object.FindFirstObjectByType<CharacterData>(); } return characterData; } public static CharacterMovement GetMovementComponent() { if ((Object)(object)movementComponent == (Object)null || !((Behaviour)movementComponent).isActiveAndEnabled) { Character characterComponent = GetCharacterComponent(); movementComponent = ((characterComponent != null) ? ((Component)characterComponent).GetComponent<CharacterMovement>() : null); } return movementComponent; } public static CharacterAfflictions GetAfflictionsComponent() { if ((Object)(object)afflictionsComponent == (Object)null || !((Behaviour)afflictionsComponent).isActiveAndEnabled) { Character characterComponent = GetCharacterComponent(); afflictionsComponent = ((characterComponent != null) ? ((Component)characterComponent).GetComponent<CharacterAfflictions>() : null); } return afflictionsComponent; } public static CharacterClimbing GetClimbingComponent() { if ((Object)(object)climbingComponent == (Object)null || !((Behaviour)climbingComponent).isActiveAndEnabled) { Character characterComponent = GetCharacterComponent(); climbingComponent = ((characterComponent != null) ? ((Component)characterComponent).GetComponent<CharacterClimbing>() : null); } return climbingComponent; } public static CharacterVineClimbing GetVineClimbComponent() { if ((Object)(object)vineClimbingComponent == (Object)null || !((Behaviour)vineClimbingComponent).isActiveAndEnabled) { Character characterComponent = GetCharacterComponent(); vineClimbingComponent = ((characterComponent != null) ? ((Component)characterComponent).GetComponent<CharacterVineClimbing>() : null); } return vineClimbingComponent; } public static CharacterRopeHandling GetRopeClimbComponent() { if ((Object)(object)ropeClimbingComponent == (Object)null || !((Behaviour)ropeClimbingComponent).isActiveAndEnabled) { Character characterComponent = GetCharacterComponent(); ropeClimbingComponent = ((characterComponent != null) ? ((Component)characterComponent).GetComponent<CharacterRopeHandling>() : null); } return ropeClimbingComponent; } public static void Refresh() { character = null; characterData = null; movementComponent = null; afflictionsComponent = null; climbingComponent = null; vineClimbingComponent = null; ropeClimbingComponent = null; } } public static class Globals { public static bool anyAfflictionEnabled; public static Character character; public static CharacterData characterData; public static FieldInfo staminaField; public static PropertyInfo infiniteStamProp; public static FieldInfo sinceFallSlideField; public static FieldInfo sinceGroundedField; public static object movementComp; public static FieldInfo movementModifierField; public static FieldInfo jumpGravityField; public static FieldInfo fallDamageTimeField; public static object characterClimb; public static FieldInfo climbSpeedModifierField; public static object characterVineClimb; public static FieldInfo vineClimbSpeedModifierField; public static object characterRopeHandling; public static FieldInfo ropeClimbSpeedModifierField; public static object afflictionsObj; public static MethodInfo setStatusMethod; public static object weightEnumValue; public static object poisonEnumValue; public static object hotEnumValue; public static object coldEnumValue; public static object curseEnumValue; public static object injuryEnumValue; public static object drowsyEnumValue; public static object hungerEnumValue; public static List<Item> items = new List<Item>(); public static List<string> itemNames = new List<string>(); public static int[] selectedItems = new int[3] { -1, -1, -1 }; public static string[] itemDisplayNames = new string[3] { "None", "None", "None" }; public static string[] itemSearchBuffers = new string[3]; public static Player playerObj; public static List<Character> allPlayers = new List<Character>(); public static List<string> playerNames = new List<string>(); public static int selectedPlayer = -1; public static bool excludeSelfFromAllActions = true; public static bool teleportToPingEnabled = false; public static float teleportX = 0f; public static float teleportY = 0f; public static float teleportZ = 0f; public static int selectedLuggageIndex = -1; public static List<string> luggageLabels = new List<string>(); public static List<Luggage> luggageObject = new List<Luggage>(); public static List<Luggage> allOpenedLuggage = new List<Luggage>(); } [HarmonyPatch(typeof(PointPinger), "ReceivePoint_Rpc")] public class PointPingPatch { private static void Postfix(Vector3 point, Vector3 hitNormal, PointPinger __instance) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) try { if (ConfigManager.TeleportToPing.Value) { Character character = __instance.character; object obj; if (character == null) { obj = null; } else { PhotonView photonView = ((MonoBehaviourPun)character).photonView; obj = ((photonView != null) ? photonView.Owner : null); } Player val = (Player)obj; if (val != null && val == PhotonNetwork.LocalPlayer && (Object)(object)Character.localCharacter != (Object)null && !Character.localCharacter.data.dead) { Vector3 val2 = point + Vector3.up; ((MonoBehaviourPun)Character.localCharacter).photonView.RPC("WarpPlayerRPC", (RpcTarget)0, new object[2] { val2, true }); ConfigManager.Logger.LogInfo((object)"[Patch] Teleported to ping!"); } } } catch (Exception ex) { ConfigManager.Logger.LogError((object)("[Patch] Exception: " + ex)); } } } [HarmonyPatch(typeof(Character), "Update")] public class FlyPatch { private static bool isFlying = false; private static Vector3 flyVelocity = Vector3.zero; public static bool IsFlying => isFlying; public static void SetFlying(bool enable) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) isFlying = enable; flyVelocity = Vector3.zero; ConfigManager.Logger.LogInfo((object)("[FlyMod] Flight " + (enable ? "enabled" : "disabled") + ".")); } private static void Postfix(Character __instance) { //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: 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_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: 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_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_0123: 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_0131: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) if (!__instance.IsLocal) { return; } if (!ConfigManager.FlyMod.Value) { if (isFlying) { isFlying = false; flyVelocity = Vector3.zero; ConfigManager.Logger.LogInfo((object)"[FlyMod] Flight disabled."); } return; } if (!isFlying) { isFlying = true; ConfigManager.Logger.LogInfo((object)"[FlyMod] Flight enabled."); } __instance.data.isGrounded = true; __instance.data.sinceGrounded = 0f; __instance.data.sinceJump = 0f; Vector3 val = Vector2.op_Implicit(__instance.input.movementInput); Vector3 normalized = ((Vector3)(ref __instance.data.lookDirection_Flat)).normalized; Vector3 val2 = Vector3.Cross(Vector3.up, normalized); Vector3 normalized2 = ((Vector3)(ref val2)).normalized; Vector3 val3 = normalized * val.y + normalized2 * val.x; if (__instance.input.jumpIsPressed) { val3 += Vector3.up; } if (__instance.input.crouchIsPressed) { val3 += Vector3.down; } float value = ConfigManager.FlySpeed.Value; float value2 = ConfigManager.FlyAcceleration.Value; flyVelocity = Vector3.Lerp(flyVelocity, ((Vector3)(ref val3)).normalized * value, Time.deltaTime * value2); foreach (Bodypart part in __instance.refs.ragdoll.partList) { if ((Object)(object)((part != null) ? part.Rig : null) != (Object)null) { part.Rig.linearVelocity = flyVelocity; } } } } [HarmonyPatch(typeof(CharacterAfflictions), "UpdateWeight")] public class Patch_UpdateWeight { private static void Postfix(CharacterAfflictions __instance) { if (ConfigManager.NoWeight.Value) { __instance.SetStatus((STATUSTYPE)7, 0f); } } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.onigremlin.peakaio", "PEAK AIO Mod", "1.0.2")] public class PeakMod : BaseUnityPlugin { private bool styleApplied; private int selectedTab = 1; private void ApplyCustomStyle() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) ImGuiStylePtr style = ImGui.GetStyle(); RangeAccessor<Vector4> colors = ((ImGuiStylePtr)(ref style)).Colors; Vector4 vector = new Vector4(0.953f, 0.941f, 0.902f, 1f); Vector4 vector2 = new Vector4(0.361f, 0.294f, 0.231f, 1f); Vector4 vector3 = new Vector4(0.18f, 0.18f, 0.18f, 1f); Vector4 vector4 = new Vector4(0.18f, 0.28f, 0.22f, 1f); Vector4 vector5 = new Vector4(0.866f, 0.827f, 0.741f, 1f); Vector4 vector6 = new Vector4(0.8f, 0.78f, 0.65f, 1f); Vector4 vector7 = new Vector4(0.75f, 0.72f, 0.61f, 1f); Vector4 vector8 = new Vector4(0.55f, 0.42f, 0.28f, 1f); new Vector4(0.75f, 0.6f, 0.5f, 1f); new Vector4(0.76f, 0.44f, 0.39f, 1f); Vector4 vector9 = new Vector4(0.318f, 0.569f, 0.384f, 1f); colors[2] = vector; colors[5] = vector3; colors[10] = vector9; colors[11] = vector9; colors[0] = vector3; colors[1] = vector8; colors[18] = vector4; colors[7] = vector5; colors[8] = vector6; colors[9] = vector7; colors[5] = vector8; colors[4] = vector; colors[44] = vector9; colors[45] = vector8; colors[46] = vector8; colors[3] = vector5; colors[21] = vector5; colors[22] = vector6; colors[23] = vector7; colors[24] = vector5; colors[25] = vector5; colors[26] = vector5; colors[27] = vector8; colors[14] = vector2; colors[15] = vector4; colors[16] = new Vector4(vector4.X + 0.1f, vector4.Y + 0.1f, vector4.Z + 0.1f, 1f); colors[17] = new Vector4(vector4.X - 0.05f, vector4.Y - 0.05f, vector4.Z - 0.05f, 1f); colors[19] = vector4; colors[20] = new Vector4(vector4.X - 0.05f, vector4.Y - 0.05f, vector4.Z - 0.05f, 1f); ((ImGuiStylePtr)(ref style)).WindowRounding = 6f; ((ImGuiStylePtr)(ref style)).FrameRounding = 4f; ((ImGuiStylePtr)(ref style)).ChildRounding = 4f; ((ImGuiStylePtr)(ref style)).FrameBorderSize = 1f; ((ImGuiStylePtr)(ref style)).GrabRounding = 4f; ((ImGuiStylePtr)(ref style)).WindowPadding = new Vector2(4f, 4f); ((ImGuiStylePtr)(ref style)).CellPadding = new Vector2(4f, 4f); ((ImGuiStylePtr)(ref style)).FrameBorderSize = 1f; ((ImGuiStylePtr)(ref style)).ItemSpacing = new Vector2(2f, 4f); } private void Awake() { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Mod Initialized"); ((Component)this).gameObject.AddComponent<EventComponent>(); } private void OnEnable() { //IL_005a: Unknown result type (might be due to invalid IL or missing references) ((BaseUnityPlugin)this).Logger.LogInfo((object)"[PEAK AIO] OnEnable called"); Globals.itemSearchBuffers = new string[3] { "", "", "" }; ConfigManager.Init(((BaseUnityPlugin)this).Config, ((BaseUnityPlugin)this).Logger); DearImGuiInjection.Render += MyUI; new Harmony("com.onigremlin.peakaio").PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Harmony patches applied."); } private void OnDisable() { ((BaseUnityPlugin)this).Logger.LogInfo((object)"[PEAK AIO] OnDisable called"); DearImGuiInjection.Render -= MyUI; } private void DrawCheckbox(ConfigEntry<bool> config, string label, Action<bool> mainThreadAction = null) { bool value = config.Value; if (!ImGui.Checkbox(label, ref value)) { return; } config.Value = value; ((BaseUnityPlugin)this).Logger.LogInfo((object)("[Menu] " + label + " toggled to " + (value ? "ON" : "OFF"))); if (mainThreadAction != null) { UnityMainThreadDispatcher.Enqueue((Action)delegate { mainThreadAction(value); }); } } private void DrawSliderFloat(ConfigEntry<float> config, string label, float min, float max, string format = "%.2f") { float value = config.Value; if (ImGui.SliderFloat(label, ref value, min, max, format)) { config.Value = value; } } private bool DrawSearchableCombo(string label, ref int selectedIndex, List<string> items, ref string searchBuffer) { bool result = false; string text = "Search##" + label; ImGui.PushItemWidth(ImGui.GetContentRegionAvail().X - 4f); ImGui.InputText("##" + text, ref searchBuffer, 100u); ImGui.PopItemWidth(); if (string.IsNullOrEmpty(searchBuffer) && !ImGui.IsItemActive()) { Vector2 itemRectMin = ImGui.GetItemRectMin(); ImGui.SameLine(); ImGui.SetCursorScreenPos(itemRectMin + new Vector2(4f, 2f)); ImGui.PushStyleColor((ImGuiCol)0, new Vector4(0.18f, 0.18f, 0.18f, 1f)); ImGui.TextUnformatted("Search items..."); ImGui.PopStyleColor(); } if (ImGui.BeginCombo(label, (selectedIndex >= 0 && selectedIndex < items.Count) ? items[selectedIndex] : "None")) { for (int i = 0; i < items.Count; i++) { if (string.IsNullOrEmpty(searchBuffer) || items[i].ToLower().Contains(searchBuffer.ToLower())) { bool flag = selectedIndex == i; if (ImGui.Selectable($"{items[i]}##{i}", flag)) { selectedIndex = i; result = true; } if (flag) { ImGui.SetItemDefaultFocus(); } } } ImGui.EndCombo(); } return result; } private void DrawToolTip(string text) { ImGui.SameLine(); ImGui.TextDisabled("(?)"); if (ImGui.IsItemHovered()) { ImGui.PushStyleColor((ImGuiCol)4, new Vector4(0.89f, 0.82f, 0.7f, 1f)); ImGui.PushStyleColor((ImGuiCol)0, new Vector4(0.18f, 0.18f, 0.18f, 1f)); ImGui.PushStyleVar((ImGuiStyleVar)4, 1f); ImGui.BeginTooltip(); ImGui.PushTextWrapPos(450f); ImGui.TextUnformatted(text); ImGui.PopTextWrapPos(); ImGui.EndTooltip(); ImGui.PopStyleVar(); ImGui.PopStyleColor(2); } } private void MyUI() { //IL_0f5c: Unknown result type (might be due to invalid IL or missing references) //IL_0f61: Unknown result type (might be due to invalid IL or missing references) //IL_0f73: Unknown result type (might be due to invalid IL or missing references) //IL_0f7a: Unknown result type (might be due to invalid IL or missing references) //IL_0f81: Unknown result type (might be due to invalid IL or missing references) try { if (!DearImGuiInjection.IsCursorVisible) { return; } if (!styleApplied) { ApplyCustomStyle(); styleApplied = true; } ImGui.SetNextWindowPos(new Vector2(20f, 20f), (ImGuiCond)2); ImGui.SetNextWindowSize(new Vector2(500f, 300f), (ImGuiCond)2); if (ImGui.Begin("PEAK AIO##Main", (ImGuiWindowFlags)32)) { ImGui.BeginChild("Sidebar", new Vector2(85f, 0f), true); ImGui.Dummy(new Vector2(4f, 2f)); string[] array = new string[5] { "PLAYER", "ITEMS", "LOBBY", "WORLD", "ABOUT" }; for (int i = 0; i < array.Length; i++) { bool flag = selectedTab == i + 1; string obj = array[i]; Vector4 vector = (flag ? new Vector4(0.318f, 0.569f, 0.384f, 1f) : new Vector4(0.18f, 0.18f, 0.18f, 1f)); ImGui.PushStyleColor((ImGuiCol)0, vector); float x = ImGui.CalcTextSize(obj).X; ImGui.SetCursorPosX((ImGui.GetContentRegionAvail().X - x) * 0.5f); if (ImGui.Selectable(obj, flag)) { selectedTab = i + 1; } ImGui.PopStyleColor(); } ImGui.EndChild(); ImGui.SameLine(); ImGui.BeginChild("MainArea"); if (selectedTab == 1) { float num = ImGui.GetContentRegionAvail().X / 2f; ImGui.BeginChild("PlayerColumn", new Vector2(num, 0f), true); ImGui.Indent(4f); ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X - 4f); ImGui.Dummy(new Vector2(4f, 2f)); if (ImGui.CollapsingHeader("Self Mods##SelfMods", (ImGuiTreeNodeFlags)32)) { DrawCheckbox(ConfigManager.InfiniteStamina, "Infinite Stamina", delegate(bool val) { Character characterComponent2 = GameHelpers.GetCharacterComponent(); PropertyInfo infiniteStaminaProperty = ConstantFields.GetInfiniteStaminaProperty(); if ((Object)(object)characterComponent2 != (Object)null && infiniteStaminaProperty != null) { infiniteStaminaProperty.SetValue(characterComponent2, val); } }); ImGui.SameLine(); DrawToolTip("Prevents stamina from decreasing, allowing unlimited sprinting and actions."); DrawCheckbox(ConfigManager.LockStatus, "Freeze Afflictions", delegate(bool val) { Character characterComponent = GameHelpers.GetCharacterComponent(); PropertyInfo statusLockProperty = ConstantFields.GetStatusLockProperty(); if ((Object)(object)characterComponent != (Object)null && statusLockProperty != null) { statusLockProperty.SetValue(characterComponent, val); } }); ImGui.SameLine(); DrawToolTip("Prevents your statuses from changing."); DrawCheckbox(ConfigManager.NoWeight, "No Weight"); ImGui.SameLine(); DrawToolTip("Disables weight penalties from carried items and backpack."); DrawCheckbox(ConfigManager.SpeedMod, "Change Speed", delegate { CharacterMovement movementComponent2 = GameHelpers.GetMovementComponent(); FieldInfo movementModifierField = ConstantFields.GetMovementModifierField(); if ((Object)(object)movementComponent2 != (Object)null && movementModifierField != null) { movementModifierField.SetValue(movementComponent2, ConfigManager.SpeedAmount.Value); } }); ImGui.SameLine(); DrawToolTip("Overrides your character's movement speed with a custom multiplier."); DrawCheckbox(ConfigManager.JumpMod, "Change Jump", delegate { CharacterMovement movementComponent = GameHelpers.GetMovementComponent(); FieldInfo jumpGravityField = ConstantFields.GetJumpGravityField(); FieldInfo fallDamageTimeField = ConstantFields.GetFallDamageTimeField(); if ((Object)(object)movementComponent != (Object)null && jumpGravityField != null) { jumpGravityField.SetValue(movementComponent, ConfigManager.JumpAmount.Value); } if ((Object)(object)movementComponent != (Object)null && fallDamageTimeField != null) { fallDamageTimeField.SetValue(movementComponent, ConfigManager.NoFallDmg.Value ? 999f : 1.5f); } }); ImGui.SameLine(); DrawToolTip("Modifies jump height, allowing higher or lower jumps depending on your settings."); DrawCheckbox(ConfigManager.ClimbMod, "Change Climb", delegate { CharacterClimbing climbingComponent = GameHelpers.GetClimbingComponent(); FieldInfo climbSpeedModField = ConstantFields.GetClimbSpeedModField(); if ((Object)(object)climbingComponent != (Object)null && climbSpeedModField != null) { climbSpeedModField.SetValue(climbingComponent, ConfigManager.ClimbAmount.Value); } }); ImGui.SameLine(); DrawToolTip("Adjusts the speed at which you climb ladders and surfaces."); DrawCheckbox(ConfigManager.VineClimbMod, "Change Vine Climb", delegate { CharacterVineClimbing vineClimbComponent = GameHelpers.GetVineClimbComponent(); FieldInfo vineClimbSpeedModField = ConstantFields.GetVineClimbSpeedModField(); if ((Object)(object)vineClimbComponent != (Object)null && vineClimbSpeedModField != null) { vineClimbSpeedModField.SetValue(vineClimbComponent, ConfigManager.VineClimbAmount.Value); } }); ImGui.SameLine(); DrawToolTip("Changes climbing speed specifically for vines."); DrawCheckbox(ConfigManager.RopeClimbMod, "Change Rope Climb", delegate { CharacterRopeHandling ropeClimbComponent = GameHelpers.GetRopeClimbComponent(); FieldInfo ropeClimbSpeedModField = ConstantFields.GetRopeClimbSpeedModField(); if ((Object)(object)ropeClimbComponent != (Object)null && ropeClimbSpeedModField != null) { ropeClimbSpeedModField.SetValue(ropeClimbComponent, ConfigManager.RopeClimbAmount.Value); } }); ImGui.SameLine(); DrawToolTip("Modifies climbing speed when using ropes or rope-based obstacles."); DrawCheckbox(ConfigManager.TeleportToPing, "Teleport to Ping"); ImGui.SameLine(); DrawToolTip("Teleports your character to the pinged location on the map."); DrawCheckbox(ConfigManager.FlyMod, "Fly Mode", FlyPatch.SetFlying); ImGui.SameLine(); DrawToolTip("Allows free movement in all directions while ignoring gravity."); } ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X - 4f); if (ImGui.CollapsingHeader("Teleport##PlayerTeleport", (ImGuiTreeNodeFlags)32)) { ImGui.InputFloat("X", ref Globals.teleportX); ImGui.InputFloat("Y", ref Globals.teleportY); ImGui.InputFloat("Z", ref Globals.teleportZ); if (ImGui.Button("Teleport to coords")) { ((BaseUnityPlugin)this).Logger.LogInfo((object)$"[Teleport] Requested to X:{Globals.teleportX} Y:{Globals.teleportY} Z:{Globals.teleportZ}"); Utilities.TeleportToCoords(Globals.teleportX, Globals.teleportY, Globals.teleportZ); } } ImGui.EndChild(); ImGui.Unindent(); ImGui.SameLine(); ImGui.BeginChild("PlayerDetailsColumn", new Vector2(num - 10f, 0f), true); ImGui.Indent(4f); ImGui.Dummy(new Vector2(4f, 2f)); if (ImGui.CollapsingHeader("Details", (ImGuiTreeNodeFlags)32)) { if (ConfigManager.JumpMod.Value) { ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X - 4f); DrawCheckbox(ConfigManager.NoFallDmg, "No Fall Dmg"); DrawSliderFloat(ConfigManager.JumpAmount, "##jump_amt", 10f, 500f, "Jump Mult: %.2f"); } if (ConfigManager.SpeedMod.Value) { ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X - 4f); DrawSliderFloat(ConfigManager.SpeedAmount, "##speed_amt", 1f, 20f, "Move Speed: %.2f"); } if (ConfigManager.ClimbMod.Value) { ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X - 4f); DrawSliderFloat(ConfigManager.ClimbAmount, "##climb_amt", 1f, 20f, "Climb Speed: %.2f"); } if (ConfigManager.VineClimbMod.Value) { ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X - 4f); DrawSliderFloat(ConfigManager.VineClimbAmount, "##vine_climb_amt", 1f, 20f, "Vine Speed: %.2f"); } if (ConfigManager.RopeClimbMod.Value) { ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X - 4f); DrawSliderFloat(ConfigManager.RopeClimbAmount, "##rope_climb_amt", 1f, 20f, "Rope Speed: %.2f"); } if (ConfigManager.FlyMod.Value) { ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X - 4f); DrawSliderFloat(ConfigManager.FlySpeed, "##fly_speed", 10f, 100f, "Fly Speed: %.2f"); ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X - 4f); DrawSliderFloat(ConfigManager.FlyAcceleration, "##fly_acceleration", 10f, 300f, "Fly Acceleration: %.2f"); } } ImGui.Unindent(); ImGui.EndChild(); } else if (selectedTab == 2) { if (Globals.itemNames.Count == 0) { Utilities.UpdateItems(); } List<(int, int)> list = new List<(int, int)>(); ImGui.Indent(4f); ImGui.Dummy(new Vector2(4f, 2f)); ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X - 4f); if (ImGui.BeginTable("InventorySlots", 3, (ImGuiTableFlags)1984)) { ImGui.TableSetupColumn("Slot 1"); ImGui.TableSetupColumn("Slot 2"); ImGui.TableSetupColumn("Slot 3"); ImGui.TableHeadersRow(); ImGui.TableNextRow(); for (int j = 0; j < 3; j++) { ImGui.TableSetColumnIndex(j); ImGui.PushID(j); string text = "None"; if (Player.localPlayer?.itemSlots != null && Player.localPlayer.itemSlots.Length > j && (Object)(object)Player.localPlayer.itemSlots[j]?.prefab != (Object)null) { text = Player.localPlayer.itemSlots[j].prefab.GetName(); } ImGui.Text($"Item {j + 1}:"); ImGui.SameLine(); ImGui.Text(text); ImGui.Spacing(); ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X - 4f); int selectedIndex = Globals.selectedItems[j]; if (DrawSearchableCombo($"##Combo{j}", ref selectedIndex, Globals.itemNames, ref Globals.itemSearchBuffers[j])) { Globals.selectedItems[j] = selectedIndex; list.Add((j, selectedIndex)); } ImGui.SameLine(); DrawToolTip("Search and assign any available item to this slot."); ImGui.Spacing(); ConfigEntry<float> val2 = (ConfigEntry<float>)(j switch { 0 => ConfigManager.RechargeAmountSlot1, 1 => ConfigManager.RechargeAmountSlot2, 2 => ConfigManager.RechargeAmountSlot3, _ => ConfigManager.RechargeAmountSlot1, }); ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X - 4f); DrawSliderFloat(val2, $"##recharge_mount##{j}", 0f, 100f, "Charge: %.1f"); if (ImGui.Button($"Recharge##{j}")) { Utilities.RechargeInventorySlot(j, val2.Value); } ImGui.SameLine(); DrawToolTip("Set how much to recharge the item’s charges when clicking 'Recharge'."); ImGui.PopID(); } ImGui.EndTable(); } foreach (var (slot, itemIndex) in list) { Utilities.AssignInventoryItem(slot, itemIndex); } ImGui.Dummy(new Vector2(4f, 2f)); if (ImGui.Button("Refresh Item List")) { Utilities.UpdateItems(); } ImGui.SameLine(); DrawToolTip("Reloads the list of available items in case something was missed or updated."); ImGui.Unindent(); } else if (selectedTab == 3) { float num2 = ImGui.GetContentRegionAvail().X / 2f; if (Globals.allPlayers.Count == 0) { Utilities.RefreshPlayerList(); } ImGui.BeginChild("Lobby_PlayerList", new Vector2(num2, 0f), true); ImGui.Indent(4f); ImGui.Dummy(new Vector2(4f, 2f)); if (ImGui.CollapsingHeader("Lobby Players", (ImGuiTreeNodeFlags)32)) { ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X - 4f); ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X - 4f); if (ImGui.BeginCombo("Select Player", (Globals.selectedPlayer >= 0 && Globals.selectedPlayer < Globals.playerNames.Count) ? Globals.playerNames[Globals.selectedPlayer] : "None")) { for (int k = 0; k < Globals.playerNames.Count; k++) { bool flag2 = Globals.selectedPlayer == k; if (ImGui.Selectable($"{Globals.playerNames[k]}##{k}", flag2)) { Globals.selectedPlayer = k; } if (flag2) { ImGui.SetItemDefaultFocus(); } } ImGui.EndCombo(); } ImGui.Dummy(new Vector2(4f, 4f)); ImGui.Separator(); ImGui.Text("All Players"); if (ImGui.Button("Revive All")) { Utilities.ReviveAllPlayers(); } ImGui.SameLine(); if (ImGui.Button("Kill All")) { Utilities.KillAllPlayers(); } bool excludeSelfFromAllActions = Globals.excludeSelfFromAllActions; if (ImGui.Checkbox("Exclude Self from Kill All##KillAll", ref excludeSelfFromAllActions)) { Globals.excludeSelfFromAllActions = excludeSelfFromAllActions; } if (ImGui.Button("Warp All To Me")) { Utilities.WarpAllPlayersToMe(); } } ImGui.Dummy(new Vector2(4f, 2f)); if (ImGui.Button("Refresh Players List")) { Utilities.RefreshPlayerList(); } ImGui.SameLine(); DrawToolTip("Manually reloads the list of players in case it didn’t update automatically."); ImGui.Unindent(); ImGui.EndChild(); ImGui.SameLine(); ImGui.BeginChild("Lobby_PlayerActions", new Vector2(num2 - 10f, 0f), true); ImGui.Indent(4f); ImGui.Dummy(new Vector2(0f, 4f)); if (ImGui.CollapsingHeader("Actions", (ImGuiTreeNodeFlags)32)) { if (Globals.selectedPlayer >= 0 && Globals.selectedPlayer < Globals.allPlayers.Count) { if (ImGui.Button("Revive")) { Utilities.ReviveSelectedPlayer(); } ImGui.SameLine(); if (ImGui.Button("Kill")) { Utilities.KillSelectedPlayer(); } if (ImGui.Button("Warp To")) { Utilities.WarpToSelectedPlayer(); } ImGui.SameLine(); if (ImGui.Button("Warp To Me")) { Utilities.WarpSelectedPlayerToMe(); } ImGui.Dummy(new Vector2(4f, 2f)); ImGui.Separator(); ImGui.Text("Special Actions"); if (ImGui.Button("Spawn Scoutmaster")) { Utilities.SpawnScoutmasterForPlayer(Globals.selectedPlayer); } ImGui.SameLine(); DrawToolTip("Spawns a Scoutmaster near the selected player. Only works for host. Forces aggro."); } else { ImGui.Text("No player selected."); } } ImGui.Unindent(); ImGui.EndChild(); } else if (selectedTab == 4) { float num3 = ImGui.GetContentRegionAvail().X / 2f; Utilities.EnsureLuggageListInitialized(); ImGui.BeginChild("World_LuggageList", new Vector2(num3, 0f), true); ImGui.Indent(4f); ImGui.Dummy(new Vector2(4f, 2f)); if (ImGui.CollapsingHeader("Containers", (ImGuiTreeNodeFlags)32)) { ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X - 4f); string text2 = ((Globals.selectedLuggageIndex >= 0 && Globals.selectedLuggageIndex < Globals.luggageLabels.Count) ? Globals.luggageLabels[Globals.selectedLuggageIndex] : "None"); if (ImGui.BeginCombo("Select Container", text2)) { if (Globals.luggageLabels.Count > 0) { for (int l = 0; l < Globals.luggageLabels.Count; l++) { bool flag3 = Globals.selectedLuggageIndex == l; if (ImGui.Selectable($"{Globals.luggageLabels[l]}##{l}", flag3)) { Globals.selectedLuggageIndex = l; } if (flag3) { ImGui.SetItemDefaultFocus(); } } } else { ImGui.TextDisabled("No containers found."); } ImGui.EndCombo(); } ImGui.Dummy(new Vector2(4f, 2f)); if (ImGui.Button("Refresh Luggage List")) { Utilities.hasInitializedLuggageList = false; Utilities.RefreshLuggageList(); } ImGui.SameLine(); DrawToolTip("Reloads the list of luggage within 300m of your position."); ImGui.Dummy(new Vector2(4f, 4f)); ImGui.Separator(); ImGui.Text("All Nearby Containers"); if (ImGui.Button("Open All Nearby")) { Utilities.OpenAllNearbyLuggage(); } } ImGui.Unindent(); ImGui.EndChild(); ImGui.SameLine(); ImGui.BeginChild("World_LuggageActions", new Vector2(num3 - 10f, 0f), true); ImGui.Indent(4f); ImGui.Dummy(new Vector2(0f, 4f)); if (ImGui.CollapsingHeader("Actions", (ImGuiTreeNodeFlags)32)) { if (Globals.selectedLuggageIndex >= 0 && Globals.selectedLuggageIndex < Globals.luggageLabels.Count) { string arg = Globals.luggageLabels[Globals.selectedLuggageIndex]; if (ImGui.Button("Warp To Luggage")) { ((BaseUnityPlugin)this).Logger.LogInfo((object)$"[UI] Warp requested for index {Globals.selectedLuggageIndex} - {arg}"); Vector3 val3 = Globals.luggageObject[Globals.selectedLuggageIndex].Center(); val3.y += 1.5f; Utilities.TeleportToCoords(val3.x, val3.y, val3.z); } if (ImGui.Button("Open Luggage")) { Utilities.OpenLuggage(Globals.selectedLuggageIndex); } } else { ImGui.Text("No luggage selected."); } } ImGui.Unindent(); ImGui.EndChild(); } else if (selectedTab == 5) { ImGui.Indent(4f); ImGui.Dummy(new Vector2(4f, 2f)); ImGui.Text("PEAK AIO Mod"); ImGui.Separator(); ImGui.Text("Version: 1.0.2"); ImGui.Text("Author: OniGremlin"); ImGui.Spacing(); ImGui.TextWrapped("PEAK AIO is a quality-of-life and utility mod designed for the game PEAK. It brings together a wide range of player enhancements, inventory tools, world manipulation, and lobby control features in one sleek ImGui-powered interface."); ImGui.Spacing(); ImGui.Text("Key Features:"); ImGui.BulletText("Infinite stamina and affliction immunity"); ImGui.BulletText("Adjustable movement: speed, jump, and climb mods"); ImGui.BulletText("Real-time inventory editing and recharge"); ImGui.BulletText("Player-to-player warp, revive, and kill tools"); ImGui.BulletText("Custom teleportation and ping-based movement"); ImGui.BulletText("Stylized UI with tabbed interface"); ImGui.Spacing(); ImGui.Text("Special Thanks:"); ImGui.BulletText("Penswer for insight, and guidance"); ImGui.BulletText("BepInEx team for the modding framework"); ImGui.BulletText("DearImGuiInjection for seamless UI integration"); ImGui.BulletText("HarmonyX for runtime patching support"); ImGui.Spacing(); ImGui.Separator(); ImGui.TextWrapped("This mod is provided as-is for educational and personal use. Not affiliated with or endorsed by the developers of PEAK. Use responsibly."); ImGui.Unindent(); } ImGui.EndChild(); } ImGui.End(); } catch (Exception ex) { ConfigManager.Logger.LogError((object)("[UI ERROR] Exception in MyUI: " + ex)); } } } public static class Utilities { public static ManualLogSource Logger; public static bool hasInitializedLuggageList; public static void GetPlayer() { if ((Object)(object)Globals.playerObj == (Object)null) { Globals.playerObj = Player.localPlayer; } } public static void UpdateItems() { UnityMainThreadDispatcher.Enqueue((Action)delegate { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_006a: 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) Globals.items.Clear(); Globals.itemNames.Clear(); for (int i = 0; i < 3; i++) { Globals.selectedItems[i] = -1; } Object[] array = Resources.FindObjectsOfTypeAll(typeof(Item)); foreach (Object obj in array) { Item val = (Item)(object)((obj is Item) ? obj : null); if ((Object)(object)val != (Object)null) { Scene scene = ((Component)val).gameObject.scene; if (((Scene)(ref scene)).handle == 0) { scene = ((Component)val).gameObject.scene; if (string.IsNullOrEmpty(((Scene)(ref scene)).name)) { Globals.items.Add(val); Globals.itemNames.Add(val.GetName()); } } } } }); } public static void AssignInventoryItem(int slot, int itemIndex) { GetPlayer(); if ((Object)(object)Globals.playerObj == (Object)null) { Logger.LogError((object)"[PEAK AIO] Player is null during inventory operation"); } else if ((Object)(object)Globals.playerObj != (Object)null && Globals.playerObj.itemSlots != null && Globals.playerObj.itemSlots.Length > slot && itemIndex >= 0 && itemIndex < Globals.items.Count) { UnityMainThreadDispatcher.Enqueue((Action)delegate { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown //IL_005f: Unknown result type (might be due to invalid IL or missing references) ItemSlot obj = Globals.playerObj.itemSlots[slot]; obj.prefab = Globals.items[itemIndex]; obj.data = new ItemInstanceData(Guid.NewGuid()); ItemInstanceDataHandler.AddInstanceData(obj.data); byte[] array = IBinarySerializable.ToManagedArray<InventorySyncData>(new InventorySyncData(Globals.playerObj.itemSlots, Globals.playerObj.backpackSlot, Globals.playerObj.tempFullSlot)); ((MonoBehaviourPun)Globals.playerObj).photonView.RPC("SyncInventoryRPC", (RpcTarget)1, new object[2] { array, true }); }); Logger.LogInfo((object)$"[Inventory] Assigned {Globals.itemNames[itemIndex]} to slot {slot}"); } } public static void RechargeInventorySlot(int slot, float rechargeValue) { GetPlayer(); if ((Object)(object)Globals.playerObj == (Object)null) { Logger.LogError((object)"[PEAK AIO] Player is null during inventory operation"); } else { if (!((Object)(object)Globals.playerObj != (Object)null) || Globals.playerObj.itemSlots == null || Globals.playerObj.itemSlots.Length <= slot) { return; } UnityMainThreadDispatcher.Enqueue((Action)delegate { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Invalid comparison between Unknown and I4 //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Invalid comparison between Unknown and I4 //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Invalid comparison between Unknown and I4 //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Invalid comparison between Unknown and I4 ItemSlot val = Globals.playerObj.itemSlots[slot]; if (val?.data?.data != null) { foreach (KeyValuePair<DataEntryKey, DataEntryValue> datum in val.data.data) { if ((int)datum.Key == 12) { DataEntryValue value = datum.Value; IntItemData val2 = (IntItemData)(object)((value is IntItemData) ? value : null); if (val2 != null) { val2.Value = (int)rechargeValue; } } else if ((int)datum.Key == 10) { DataEntryValue value2 = datum.Value; FloatItemData val3 = (FloatItemData)(object)((value2 is FloatItemData) ? value2 : null); if (val3 != null) { val3.Value = rechargeValue; } } else if ((int)datum.Key == 11) { DataEntryValue value3 = datum.Value; FloatItemData val4 = (FloatItemData)(object)((value3 is FloatItemData) ? value3 : null); if (val4 != null) { val4.Value = rechargeValue; } } else if ((int)datum.Key == 2) { DataEntryValue value4 = datum.Value; OptionableIntItemData val5 = (OptionableIntItemData)(object)((value4 is OptionableIntItemData) ? value4 : null); if (val5 != null) { val5.Value = (int)rechargeValue; } } } } }); Logger.LogInfo((object)$"[Inventory] Recharged slot {slot} to {rechargeValue}"); } } public static void RefreshPlayerList() { UnityMainThreadDispatcher.Enqueue((Action)delegate { try { Globals.allPlayers.Clear(); Globals.playerNames.Clear(); Globals.selectedPlayer = -1; foreach (Character allCharacter in Character.AllCharacters) { Globals.allPlayers.Add(allCharacter); Globals.playerNames.Add(allCharacter.characterName); } Logger.LogInfo((object)$"[PlayerList] Found {Globals.allPlayers.Count} players."); } catch (Exception ex) { ConfigManager.Logger.LogError((object)ex); } }); } public static void ReviveAllPlayers() { UnityMainThreadDispatcher.Enqueue((Action)delegate { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) foreach (Character allCharacter in Character.AllCharacters) { Vector3 val = (((Object)(object)allCharacter.Ghost != (Object)null) ? ((Component)allCharacter.Ghost).transform.position : allCharacter.Head); ((MonoBehaviourPun)allCharacter).photonView.RPC("RPCA_ReviveAtPosition", (RpcTarget)0, new object[2] { val + new Vector3(0f, 4f, 0f), false }); } Logger.LogInfo((object)"[Lobby] Revive All triggered."); }); } public static void KillAllPlayers() { UnityMainThreadDispatcher.Enqueue((Action)delegate { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) foreach (Character allCharacter in Character.AllCharacters) { if (!Globals.excludeSelfFromAllActions || !allCharacter.IsLocal) { Vector3 position = ((Component)allCharacter).transform.position; ((MonoBehaviourPun)allCharacter).photonView.RPC("RPCA_Die", (RpcTarget)0, new object[1] { position }); } } Logger.LogInfo((object)$"[Lobby] Kill All triggered. ExcludeSelf: {Globals.excludeSelfFromAllActions}"); }); } public static void WarpAllPlayersToMe() { UnityMainThreadDispatcher.Enqueue((Action)delegate { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: 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) Vector3 val = Character.localCharacter.Head + new Vector3(0f, 4f, 0f); foreach (Character allCharacter in Character.AllCharacters) { ((MonoBehaviourPun)allCharacter).photonView.RPC("WarpPlayerRPC", (RpcTarget)0, new object[2] { val, true }); } Logger.LogInfo((object)"[Lobby] Warp All To Me triggered."); }); } public static void ReviveSelectedPlayer() { if (Globals.selectedPlayer < 0 || Globals.selectedPlayer >= Globals.allPlayers.Count) { return; } UnityMainThreadDispatcher.Enqueue((Action)delegate { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) try { Character val = Globals.allPlayers[Globals.selectedPlayer]; Vector3 val2 = (((Object)(object)val.Ghost != (Object)null) ? ((Component)val.Ghost).transform.position : val.Head); ((MonoBehaviourPun)val).photonView.RPC("RPCA_ReviveAtPosition", (RpcTarget)0, new object[2] { val2 + new Vector3(0f, 4f, 0f), false }); Logger.LogInfo((object)$"[Lobby] Revive requested for player index {Globals.selectedPlayer}"); } catch (Exception ex) { ConfigManager.Logger.LogError((object)ex); } }); } public static void KillSelectedPlayer() { if (Globals.selectedPlayer < 0 || Globals.selectedPlayer >= Globals.allPlayers.Count) { return; } UnityMainThreadDispatcher.Enqueue((Action)delegate { //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_002e: Unknown result type (might be due to invalid IL or missing references) try { Character obj = Globals.allPlayers[Globals.selectedPlayer]; Vector3 position = ((Component)obj).transform.position; ((MonoBehaviourPun)obj).photonView.RPC("RPCA_Die", (RpcTarget)0, new object[1] { position }); Logger.LogInfo((object)$"[Lobby] Kill requested for player index {Globals.selectedPlayer}"); } catch (Exception ex) { ConfigManager.Logger.LogError((object)ex); } }); } public static void WarpToSelectedPlayer() { if (Globals.selectedPlayer < 0 || Globals.selectedPlayer >= Globals.allPlayers.Count) { return; } UnityMainThreadDispatcher.Enqueue((Action)delegate { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //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_002d: 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) try { Vector3 val = Globals.allPlayers[Globals.selectedPlayer].Head + new Vector3(0f, 4f, 0f); ((MonoBehaviourPun)Character.localCharacter).photonView.RPC("WarpPlayerRPC", (RpcTarget)0, new object[2] { val, true }); Logger.LogInfo((object)$"[Lobby] Warp to requested for player index {Globals.selectedPlayer}"); } catch (Exception ex) { ConfigManager.Logger.LogError((object)ex); } }); } public static void WarpSelectedPlayerToMe() { if (Globals.selectedPlayer < 0 || Globals.selectedPlayer >= Globals.allPlayers.Count) { return; } UnityMainThreadDispatcher.Enqueue((Action)delegate { //IL_0014: 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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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) try { Character obj = Globals.allPlayers[Globals.selectedPlayer]; Vector3 val = Character.localCharacter.Head + new Vector3(0f, 4f, 0f); ((MonoBehaviourPun)obj).photonView.RPC("WarpPlayerRPC", (RpcTarget)0, new object[2] { val, true }); Logger.LogInfo((object)$"[Lobby] Warp to me requested for player index {Globals.selectedPlayer}"); } catch (Exception ex) { ConfigManager.Logger.LogError((object)ex); } }); } public static void TeleportToCoords(float x, float y, float z) { UnityMainThreadDispatcher.Enqueue((Action)delegate { //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) try { Character localCharacter = Character.localCharacter; if ((Object)(object)localCharacter == (Object)null || localCharacter.data.dead) { Logger.LogWarning((object)"[Teleport] Local character is null or dead. Aborting teleport."); } else { PhotonView photonView = ((MonoBehaviourPun)localCharacter).photonView; if (!((Object)(object)photonView == (Object)null)) { Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(x, y, z); photonView.RPC("WarpPlayerRPC", (RpcTarget)0, new object[2] { val, true }); ConfigManager.Logger.LogInfo((object)$"[Teleport] Teleported to {val}"); } } } catch (Exception ex) { ConfigManager.Logger.LogError((object)("[Teleport] Exception: " + ex)); } }); } public static void EnsureLuggageListInitialized() { if (!hasInitializedLuggageList) { hasInitializedLuggageList = true; RefreshLuggageList(); } } public static void RefreshLuggageList() { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) Globals.luggageLabels.Clear(); Globals.luggageObject.Clear(); Globals.selectedLuggageIndex = -1; List<(Luggage, float)> list = new List<(Luggage, float)>(); foreach (Luggage item3 in Luggage.ALL_LUGGAGE) { if (!((Object)(object)item3 == (Object)null)) { float num = Vector3.Distance(Character.localCharacter.Head, item3.Center()); if (num <= 300f) { list.Add((item3, num)); } } } list.Sort(((Luggage lug, float distance) a, (Luggage lug, float distance) b) => a.distance.CompareTo(b.distance)); foreach (var item4 in list) { Luggage item = item4.Item1; float item2 = item4.Item2; string arg = item.displayName ?? "Unnamed"; Globals.luggageLabels.Add($"{arg} [{item2:F1}m]"); Globals.luggageObject.Add(item); } Logger.LogInfo((object)$"[Luggage] Refreshed. Found {Globals.luggageLabels.Count} nearby."); } public static void OpenAllNearbyLuggage() { UnityMainThreadDispatcher.Enqueue((Action)delegate { int num = 0; for (int i = 0; i < Globals.luggageObject.Count; i++) { Luggage val = Globals.luggageObject[i]; if (!((Object)(object)val == (Object)null)) { PhotonView component = ((Component)val).GetComponent<PhotonView>(); if ((Object)(object)component != (Object)null) { component.RPC("OpenLuggageRPC", (RpcTarget)0, new object[1] { true }); num++; } } } Logger.LogInfo((object)$"[Luggage] Requested open for {num} nearby containers."); }); } public static void OpenLuggage(int index) { if (index < 0 || index >= Globals.luggageObject.Count) { return; } Luggage luggage = Globals.luggageObject[index]; if ((Object)(object)luggage == (Object)null) { return; } UnityMainThreadDispatcher.Enqueue((Action)delegate { try { PhotonView component = ((Component)luggage).GetComponent<PhotonView>(); if ((Object)(object)component != (Object)null) { component.RPC("OpenLuggageRPC", (RpcTarget)0, new object[1] { true }); Logger.LogInfo((object)("[Luggage] Sent OpenLuggageRPC for: " + luggage.displayName)); } } catch (Exception arg) { Logger.LogError((object)$"[Luggage] Open failed: {arg}"); } }); } public static void SpawnScoutmasterForPlayer(int playerIndex) { UnityMainThreadDispatcher.Enqueue((Action)async delegate { if (!PhotonNetwork.IsMasterClient) { Logger.LogWarning((object)"[Scoutmaster] Only the MasterClient can spawn the Scoutmaster."); } else if (playerIndex < 0 || playerIndex >= Character.AllCharacters.Count) { Logger.LogWarning((object)"[Scoutmaster] Invalid player index."); } else { Character targetCharacter = Character.AllCharacters[playerIndex]; Vector3 val = ((Component)targetCharacter).transform.position + new Vector3(Random.Range(-10f, 10f), 25f, Random.Range(-10f, 10f)); Vector3 down = Vector3.down; RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(val, down, ref val2, 100f, -1)) { Vector3 val3 = ((RaycastHit)(ref val2)).point + Vector3.up * 1f; Quaternion identity = Quaternion.identity; GameObject scoutObj = PhotonNetwork.InstantiateRoomObject("Character_Scoutmaster", val3, identity, (byte)0, (object[])null); Character component = scoutObj.GetComponent<Character>(); if ((Object)(object)component != (Object)null) { component.data.spawnPoint = ((Component)component).transform; } await Task.Delay(100); Scoutmaster component2 = scoutObj.GetComponent<Scoutmaster>(); if ((Object)(object)component2 != (Object)null) { try { MethodInfo method = typeof(Scoutmaster).GetMethod("SetCurrentTarget", BindingFlags.Instance | BindingFlags.NonPublic); if (method != null) { method.Invoke(component2, new object[2] { targetCharacter, 15f }); Logger.LogInfo((object)("[Scoutmaster] Target set to " + targetCharacter.characterName)); } else { Logger.LogWarning((object)"[Scoutmaster] Reflection failed — method not found."); } } catch (Exception ex) { Logger.LogError((object)("[Scoutmaster] Reflection error: " + ex)); } } } else { Logger.LogWarning((object)"[Scoutmaster] No valid ground to spawn."); } } }); } }