Decompiled source of PeakTuner v0.1.5
plugins/PeakTuner/PeakTuner.dll
Decompiled 2 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; 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 HarmonyLib; using Microsoft.CodeAnalysis; using PEAKLib.UI; using PEAKLib.UI.Elements; using PeakTuner.Cheats; using PeakTuner.UI; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.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("PeakTuner")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.1.5")] [assembly: AssemblyInformationalVersion("0.1.5+029d865737c354ab85dcaa916ce81b7379421984")] [assembly: AssemblyProduct("PeakTuner")] [assembly: AssemblyTitle("PeakTuner")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.1.5.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 PeakTuner { public sealed class ModConfig { public ConfigEntry<bool> InfiniteStamina { get; } public ConfigEntry<bool> NoFallDamage { get; } public ConfigEntry<bool> DisableCold { get; } public ConfigEntry<bool> DisablePoison { get; } public ConfigEntry<bool> DisableHot { get; } public ConfigEntry<bool> DisableHunger { get; } public ConfigEntry<bool> GodMode { get; } public ConfigEntry<bool> MinimapEnabled { get; } public ConfigEntry<float> SpeedMultiplier { get; } public ModConfig(ConfigFile cfg) { //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Expected O, but got Unknown InfiniteStamina = cfg.Bind<bool>("Cheats", "InfiniteStamina", false, "Prevents stamina from decreasing."); NoFallDamage = cfg.Bind<bool>("Cheats", "NoFallDamage", false, "Disables fall damage."); DisableCold = cfg.Bind<bool>("Cheats", "DisableCold", false, "Continuously clears Cold if present."); DisablePoison = cfg.Bind<bool>("Cheats", "DisablePoison", false, "Continuously clears Poison if present."); DisableHot = cfg.Bind<bool>("Cheats", "DisableHot", false, "Continuously clears Hot if present."); DisableHunger = cfg.Bind<bool>("Cheats", "DisableHunger", false, "Continuously clears Hunger if present."); GodMode = cfg.Bind<bool>("Cheats", "GodMode", false, "Invincible while enabled."); MinimapEnabled = cfg.Bind<bool>("UI", "MinimapEnabled", false, "Show the minimap."); SpeedMultiplier = cfg.Bind<float>("Cheats", "SpeedMultiplier", 1f, new ConfigDescription("Movement speed multiplier (1, 2, or 4).", (AcceptableValueBase)(object)new AcceptableValueList<float>(new float[6] { 1f, 2f, 4f, 8f, 16f, 32f }), Array.Empty<object>())); } } [BepInPlugin("com.cbein.peaktuner", "PeakTuner", "0.1.5")] public class Plugin : BaseUnityPlugin { private ModConfig _cfg; private CheatsService _cheats; private float _nextApplyTime; private DebugOverlay? _overlay; internal static ManualLogSource Log { get; private set; } private void Awake() { Log = ((BaseUnityPlugin)this).Logger; _cfg = new ModConfig(((BaseUnityPlugin)this).Config); ResetCheatsToDefaults(); ReflectionCache r = new ReflectionCache(Log); StatusApi status = new StatusApi(Log, r); _cheats = new CheatsService(Log, r, status, _cfg); _overlay = new DebugOverlay("PeakTuner", "0.1.5"); SpeedController.Install(Log, _cfg); PauseMenuCheatsUi.Install(Log, _cfg, _cheats); MinimapUi.Install(Log); _cfg.MinimapEnabled.Value = false; MinimapUi.SetEnabled(_cfg.MinimapEnabled.Value); Log.LogInfo((object)"[PeakTuner] Loaded v0.1.5 (pause menu integration)."); } private void Update() { if (Input.GetKeyDown((KeyCode)289)) { _overlay?.Toggle(); Log.LogInfo((object)"[PeakTuner] Debug overlay toggled (F8)."); } _overlay?.Update(); if (IsGameplayReady() && Time.time >= _nextApplyTime) { _nextApplyTime = Time.time + 0.1f; _cheats.ApplyCheats(); } } private void OnGUI() { _overlay?.OnGUI(); } private static bool IsGameplayReady() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown Character localCharacter = Character.localCharacter; return (Object)localCharacter != (Object)null; } private void ResetCheatsToDefaults() { _cfg.InfiniteStamina.Value = false; _cfg.NoFallDamage.Value = false; _cfg.DisableCold.Value = false; _cfg.DisablePoison.Value = false; _cfg.DisableHot.Value = false; _cfg.DisableHunger.Value = false; _cfg.GodMode.Value = false; _cfg.SpeedMultiplier.Value = 1f; } } internal static class VersionInfo { public const string Guid = "com.cbein.peaktuner"; public const string Name = "PeakTuner"; public const string Version = "0.1.5"; } } namespace PeakTuner.UI { public sealed class CursorController { private bool _prevVisible; private CursorLockMode _prevLock; public bool IsCaptured { get; private set; } public void Capture() { //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) if (!IsCaptured) { _prevVisible = Cursor.visible; _prevLock = Cursor.lockState; ForceUnlockedCursor(); IsCaptured = true; } } public void CaptureFrame() { if (!IsCaptured) { Capture(); } else { ForceUnlockedCursor(); } } public void Release() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (IsCaptured) { Cursor.visible = _prevVisible; Cursor.lockState = _prevLock; IsCaptured = false; } } private static void ForceUnlockedCursor() { Cursor.visible = true; Cursor.lockState = (CursorLockMode)0; } } public sealed class DebugOverlay { private readonly string _modName; private readonly string _version; private bool _visible = true; private readonly float _startTime; private float _fps; private float _fpsAccum; private int _fpsFrames; private float _fpsNextTime; private GUIStyle? _style; public DebugOverlay(string modName, string version) { _modName = modName; _version = version; _startTime = Time.unscaledTime; _fpsNextTime = Time.unscaledTime + 0.5f; } public void Toggle() { _visible = !_visible; } public void Update() { float unscaledTime = Time.unscaledTime; _fpsAccum += Time.unscaledDeltaTime; _fpsFrames++; if (unscaledTime >= _fpsNextTime) { float num = ((_fpsFrames > 0) ? (_fpsAccum / (float)_fpsFrames) : 0f); _fps = ((num > 1E-06f) ? (1f / num) : 0f); _fpsAccum = 0f; _fpsFrames = 0; _fpsNextTime = unscaledTime + 0.5f; } } public void OnGUI() { //IL_00f6: Unknown result type (might be due to invalid IL or missing references) if (_visible) { EnsureStyle(); float num = Mathf.Max(0f, Time.unscaledTime - _startTime); TimeSpan timeSpan = TimeSpan.FromSeconds(num); string text = ((timeSpan.TotalHours >= 1.0) ? $"{(int)timeSpan.TotalHours:00}:{timeSpan.Minutes:00}:{timeSpan.Seconds:00}" : $"{timeSpan.Minutes:00}:{timeSpan.Seconds:00}"); string text2 = $"{_modName} v{_version} | FPS: {_fps:0} | Up: {text}"; float num2 = 520f; float num3 = 22f; Rect val = default(Rect); ((Rect)(ref val))..ctor((float)Screen.width - num2 - 10f, 10f, num2, num3); GUI.Label(val, text2, _style); } } private void EnsureStyle() { //IL_0014: 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_0021: 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_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_0046: Unknown result type (might be due to invalid IL or missing references) if (_style == null) { _style = new GUIStyle(GUI.skin.label) { fontSize = 13, alignment = (TextAnchor)2, richText = false, wordWrap = false }; _style.normal.textColor = Color.white; } } } public static class MinimapUi { private sealed class MinimapController : MonoBehaviour { private const int MinimapTextureSize = 256; private const float MinimapWorldHeight = 80f; private const float MinimapUiSize = 220f; private const float MinimapMargin = 18f; private const float HudWidth = 120f; private Camera? _cam; private RenderTexture? _rt; private RawImage? _mapImage; private RectTransform? _mapRoot; private TMP_Text? _debugText; private bool _enabled; public void Initialize(ManualLogSource log) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Expected O, but got Unknown GameObject val = new GameObject("MinimapCamera"); val.transform.SetParent(((Component)this).transform, false); _cam = val.AddComponent<Camera>(); _cam.orthographic = true; _cam.orthographicSize = Zoom; _cam.nearClipPlane = 0.1f; _cam.farClipPlane = 500f; _cam.clearFlags = (CameraClearFlags)2; _cam.backgroundColor = new Color(0f, 0f, 0f, 0f); _cam.cullingMask = -1; _rt = new RenderTexture(256, 256, 16, (RenderTextureFormat)0); ((Object)_rt).name = "PeakTuner_MinimapRT"; _rt.Create(); _cam.targetTexture = _rt; BuildUi(); SetEnabled(Enabled); } public void SetEnabled(bool enabled) { _enabled = enabled; if ((Object)(object)_mapRoot != (Object)null) { ((Component)_mapRoot).gameObject.SetActive(_enabled); } } private void BuildUi() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown //IL_007a: 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_00ae: 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_00e2: 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_00f8: Expected O, but got Unknown //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_014c: 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_016e: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Expected O, but got Unknown //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Expected O, but got Unknown //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02f0: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Unknown result type (might be due to invalid IL or missing references) //IL_0339: Unknown result type (might be due to invalid IL or missing references) //IL_0340: Expected O, but got Unknown //IL_0368: Unknown result type (might be due to invalid IL or missing references) //IL_037e: 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_03aa: Unknown result type (might be due to invalid IL or missing references) //IL_03c0: Unknown result type (might be due to invalid IL or missing references) //IL_03cf: Unknown result type (might be due to invalid IL or missing references) //IL_03d6: Expected O, but got Unknown //IL_040b: Unknown result type (might be due to invalid IL or missing references) //IL_0421: Unknown result type (might be due to invalid IL or missing references) //IL_042d: Unknown result type (might be due to invalid IL or missing references) //IL_0439: Unknown result type (might be due to invalid IL or missing references) //IL_047e: Unknown result type (might be due to invalid IL or missing references) //IL_04bf: Unknown result type (might be due to invalid IL or missing references) //IL_051b: Unknown result type (might be due to invalid IL or missing references) //IL_0520: 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_055f: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("MinimapCanvas"); val.transform.SetParent(((Component)this).transform, false); Canvas val2 = val.AddComponent<Canvas>(); val2.renderMode = (RenderMode)0; val2.sortingOrder = 50; CanvasScaler val3 = val.AddComponent<CanvasScaler>(); val3.uiScaleMode = (ScaleMode)0; GameObject val4 = new GameObject("MinimapRoot"); val4.transform.SetParent(val.transform, false); _mapRoot = val4.AddComponent<RectTransform>(); _mapRoot.anchorMin = new Vector2(0f, 1f); _mapRoot.anchorMax = new Vector2(0f, 1f); _mapRoot.pivot = new Vector2(0f, 1f); _mapRoot.anchoredPosition = new Vector2(18f, -18f); _mapRoot.sizeDelta = new Vector2(340f, 220f); GameObject val5 = new GameObject("MinimapMask"); val5.transform.SetParent(val4.transform, false); RectTransform val6 = val5.AddComponent<RectTransform>(); val6.anchorMin = new Vector2(0f, 1f); val6.anchorMax = new Vector2(0f, 1f); val6.pivot = new Vector2(0f, 1f); val6.anchoredPosition = Vector2.zero; val6.sizeDelta = new Vector2(210f, 210f); Image val7 = val5.AddComponent<Image>(); val7.sprite = GetCircleSprite(); val7.type = (Type)1; ((Graphic)val7).color = new Color(0f, 0f, 0f, 0.35f); GameObject val8 = new GameObject("MinimapBorder"); val8.transform.SetParent(val4.transform, false); val8.transform.SetAsLastSibling(); RectTransform val9 = val8.AddComponent<RectTransform>(); val9.anchorMin = new Vector2(0f, 1f); val9.anchorMax = new Vector2(0f, 1f); val9.pivot = new Vector2(0f, 1f); val9.anchoredPosition = new Vector2(-10f, 10f); val9.sizeDelta = new Vector2(232f, 232f); Image val10 = val8.AddComponent<Image>(); val10.sprite = GetCircleRingSprite(); val10.type = (Type)0; ((Graphic)val10).raycastTarget = false; ((Graphic)val10).color = Color.white; Mask val11 = val5.AddComponent<Mask>(); val11.showMaskGraphic = true; GameObject val12 = new GameObject("MinimapImage"); val12.transform.SetParent(val5.transform, false); RectTransform val13 = val12.AddComponent<RectTransform>(); val13.anchorMin = new Vector2(0f, 0f); val13.anchorMax = new Vector2(1f, 1f); val13.offsetMin = Vector2.zero; val13.offsetMax = Vector2.zero; _mapImage = val12.AddComponent<RawImage>(); _mapImage.texture = (Texture)(object)_rt; ((Graphic)_mapImage).color = Color.white; GameObject val14 = new GameObject("MinimapDebugText"); val14.transform.SetParent(val4.transform, false); RectTransform val15 = val14.AddComponent<RectTransform>(); val15.anchorMin = new Vector2(0f, 0f); val15.anchorMax = new Vector2(0f, 0f); val15.pivot = new Vector2(0f, 0f); val15.anchoredPosition = new Vector2(0f, -34f); val15.sizeDelta = new Vector2(220f, 30f); GameObject val16 = new GameObject("MinimapDebugBg"); val16.transform.SetParent(val14.transform, false); val16.transform.SetAsFirstSibling(); RectTransform val17 = val16.AddComponent<RectTransform>(); val17.anchorMin = new Vector2(0f, 0f); val17.anchorMax = new Vector2(1f, 1f); val17.offsetMin = Vector2.zero; val17.offsetMax = Vector2.zero; Image val18 = val16.AddComponent<Image>(); val18.sprite = GetSolidSprite(); val18.type = (Type)1; ((Graphic)val18).raycastTarget = false; ((Graphic)val18).color = new Color(0f, 0f, 0f, 0f); _debugText = (TMP_Text?)(object)val14.AddComponent<TextMeshProUGUI>(); _debugText.fontSize = 15f; ((Graphic)_debugText).color = new Color(1f, 1f, 1f, 0.95f); _debugText.alignment = (TextAlignmentOptions)514; ((Graphic)_debugText).raycastTarget = false; _debugText.enableWordWrapping = false; _debugText.outlineWidth = 0.18f; _debugText.outlineColor = Color32.op_Implicit(new Color(0f, 0f, 0f, 0.75f)); Shadow val19 = val14.AddComponent<Shadow>(); val19.effectColor = new Color(0f, 0f, 0f, 0.55f); val19.effectDistance = new Vector2(1f, -1f); } private void LateUpdate() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_007a: 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_008c: 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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_0107: 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_011d: Unknown result type (might be due to invalid IL or missing references) if (!_enabled) { SetVisible(visible: false); return; } Character localCharacter = Character.localCharacter; if ((Object)localCharacter == (Object)null) { SetVisible(visible: false); return; } SetVisible(visible: true); Transform transform = ((Component)localCharacter).transform; Vector3 playerPosition = GetPlayerPosition(localCharacter); if ((Object)(object)_cam != (Object)null) { ((Component)_cam).gameObject.SetActive(true); ((Behaviour)_cam).enabled = true; ((Component)_cam).transform.position = new Vector3(playerPosition.x, playerPosition.y + 80f, playerPosition.z); ((Component)_cam).transform.rotation = Quaternion.Euler(90f, 0f, 0f); _cam.orthographicSize = Mathf.Max(1f, Zoom * 0.5f); } if ((Object)(object)_debugText != (Object)null && (Object)(object)_cam != (Object)null) { _debugText.text = $"{playerPosition.x:0.0}, {playerPosition.y:0.0}, {playerPosition.z:0.0}"; ((Component)_debugText).gameObject.SetActive(true); } if (Input.GetKeyDown((KeyCode)91)) { Zoom = Mathf.Max(5f, Zoom - 5f); } if (Input.GetKeyDown((KeyCode)93)) { Zoom = Mathf.Min(200f, Zoom + 5f); } } private static Vector3 GetPlayerPosition(Character player) { //IL_0011: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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) //IL_0047: Unknown result type (might be due to invalid IL or missing references) Rigidbody component = ((Component)player).GetComponent<Rigidbody>(); if ((Object)(object)component != (Object)null) { return component.position; } component = ((Component)player).GetComponentInChildren<Rigidbody>(); if ((Object)(object)component != (Object)null) { return component.position; } Renderer componentInChildren = ((Component)player).GetComponentInChildren<Renderer>(); if ((Object)(object)componentInChildren != (Object)null) { Bounds bounds = componentInChildren.bounds; return ((Bounds)(ref bounds)).center; } return ((Component)player).transform.position; } private void SetVisible(bool visible) { if ((Object)(object)_mapRoot != (Object)null) { ((Component)_mapRoot).gameObject.SetActive(visible); } } } private static ManualLogSource _log = null; private static MinimapController? _controller; public static float Zoom = 25f; private static Sprite? _solidSprite; private static Sprite? _circleSprite; private static Sprite? _circleRingSprite; public static bool Enabled { get; private set; } = false; public static void Install(ManualLogSource log) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown _log = log; if (!((Object)(object)_controller != (Object)null)) { GameObject val = new GameObject("PeakTuner_Minimap"); Object.DontDestroyOnLoad((Object)(object)val); _controller = val.AddComponent<MinimapController>(); _controller.Initialize(_log); _log.LogInfo((object)"[PeakTuner] Minimap initialized."); } } public static void SetEnabled(bool enabled) { Enabled = enabled; _controller?.SetEnabled(enabled); } private static Sprite GetSolidSprite() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown //IL_0020: 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) //IL_0056: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_solidSprite != (Object)null) { return _solidSprite; } Texture2D val = new Texture2D(1, 1, (TextureFormat)4, false); val.SetPixel(0, 0, Color.white); val.Apply(false, true); _solidSprite = Sprite.Create(val, new Rect(0f, 0f, 1f, 1f), new Vector2(0.5f, 0.5f), 100f); return _solidSprite; } private static Sprite GetCircleSprite() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_00d7: 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_0092: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_circleSprite != (Object)null) { return _circleSprite; } Texture2D val = new Texture2D(128, 128, (TextureFormat)4, false); ((Texture)val).wrapMode = (TextureWrapMode)1; float num = 63f; float num2 = 63.5f; float num3 = 63.5f; float num4 = num * num; for (int i = 0; i < 128; i++) { for (int j = 0; j < 128; j++) { float num5 = (float)j - num2; float num6 = (float)i - num3; float num7 = num5 * num5 + num6 * num6; float num8 = ((num7 <= num4) ? 1f : 0f); val.SetPixel(j, i, new Color(1f, 1f, 1f, num8)); } } val.Apply(false, true); _circleSprite = Sprite.Create(val, new Rect(0f, 0f, 128f, 128f), new Vector2(0.5f, 0.5f), 100f); return _circleSprite; } private static Sprite GetCircleRingSprite() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_00e5: 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) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_circleRingSprite != (Object)null) { return _circleRingSprite; } Texture2D val = new Texture2D(128, 128, (TextureFormat)4, false); ((Texture)val).wrapMode = (TextureWrapMode)1; float num = 63f; float num2 = num - 8f; float num3 = 63.5f; float num4 = 63.5f; for (int i = 0; i < 128; i++) { for (int j = 0; j < 128; j++) { float num5 = (float)j - num3; float num6 = (float)i - num4; float num7 = Mathf.Sqrt(num5 * num5 + num6 * num6); float num8 = ((num7 <= num && num7 >= num2) ? 1f : 0f); val.SetPixel(j, i, new Color(1f, 1f, 1f, num8)); } } val.Apply(false, true); _circleRingSprite = Sprite.Create(val, new Rect(0f, 0f, 128f, 128f), new Vector2(0.5f, 0.5f), 100f); return _circleRingSprite; } } public static class PauseMenuCheatsUi { private sealed class UiHost : MonoBehaviour { } private sealed class ToggleRow { public string Label { get; } public ConfigEntry<bool> Entry { get; } public PeakMenuButton Button { get; } public Color BaseTint { get; } public ToggleRow(string label, ConfigEntry<bool> entry, PeakMenuButton button, Color baseTint) { //IL_001c: 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) Label = label; Entry = entry; Button = button; BaseTint = baseTint; } } private static class CheatColor { public static readonly Color StaminaGreen = new Color(0.2f, 0.7f, 0.2f, 1f); public static readonly Color FallPink = new Color(0.9f, 0.35f, 0.7f, 1f); public static readonly Color ColdBlue = new Color(0.2f, 0.55f, 0.95f, 1f); public static readonly Color PoisonPurple = new Color(0.6f, 0.3f, 0.85f, 1f); public static readonly Color HotRed = new Color(0.9f, 0.25f, 0.25f, 1f); public static readonly Color HungerYellow = new Color(0.95f, 0.8f, 0.2f, 1f); public static readonly Color GodOrange = new Color(0.95f, 0.55f, 0.15f, 1f); public static readonly Color UiTeal = new Color(0.25f, 0.75f, 0.75f, 1f); public static readonly Color NeutralClose = new Color(0.55f, 0.55f, 0.55f, 1f); public static readonly Color SpeedSelected = new Color(0.2f, 0.85f, 0.55f, 1f); public static readonly Color SpeedUnselected = new Color(0.35f, 0.35f, 0.4f, 1f); } [CompilerGenerated] private static class <>O { public static BuilderDelegate <0>__BuildIntoPauseMenu; } [CompilerGenerated] private sealed class <BuildCheatContentNextFrame>d__29 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public PeakScrollableContent scrollContent; public GameObject panelGo; public RectTransform panelRt; public GameObject scrollGo; public ScrollRect scrollRect; public PeakMenuButton openBtn; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <BuildCheatContentNextFrame>d__29(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = null; <>1__state = 1; return true; case 1: <>1__state = -1; if ((Object)(object)scrollContent.Content == (Object)null) { <>2__current = null; <>1__state = 2; return true; } goto IL_0067; case 2: <>1__state = -1; goto IL_0067; case 3: { <>1__state = -1; break; } IL_0067: if ((Object)(object)scrollContent.Content == (Object)null) { <>2__current = null; <>1__state = 3; return true; } break; } if ((Object)(object)scrollContent.Content == (Object)null) { _log.LogError((object)"[PeakTuner] Scroll content was not initialized. Cheats panel build aborted."); return false; } BuildCheatContent(panelGo, panelRt, scrollGo, scrollContent, scrollRect, openBtn); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <RunUiActionNextFrame>d__11 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Action action; public string name; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <RunUiActionNextFrame>d__11(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = null; <>1__state = 1; return true; case 1: <>1__state = -1; try { action(); } catch (Exception arg) { _log.LogError((object)$"[PeakTuner] UI action '{name}' crashed: {arg}"); } finally { _uiBusy = false; } return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <SyncRowHeightsNextFrame>d__39 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public PeakMenuButton reference; public List<PeakMenuButton> rows; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <SyncRowHeightsNextFrame>d__39(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = null; <>1__state = 1; return true; case 1: <>1__state = -1; <>2__current = null; <>1__state = 2; return true; case 2: { <>1__state = -1; RectTransform component = ((Component)reference.Button).GetComponent<RectTransform>(); Rect rect = component.rect; float height = ((Rect)(ref rect)).height; if (height <= 0.1f) { return false; } for (int i = 0; i < rows.Count; i++) { SetRowHeight(rows[i], height); } return false; } } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private static ManualLogSource _log = null; private static ModConfig _cfg = null; private static CheatsService _cheats = null; private static bool _registered; private static Sprite? _solidSprite; private static UiHost? _uiHost; private static bool _uiBusy; private static float _nextAllowedClickTime; private const float PanelWidth = 780f; private const float PanelHeight = 840f; private const float PanelSpacing = 6f; private const float RowHeight = 44f; private const float HeaderFontSize = 38f; private const float SectionFontSize = 26f; private const int ScrollbarRightPadding = 24; private const float CloseBarHeight = 52f; private const float CloseBarTopGap = 10f; private const float CloseTextFontSize = 28f; private static readonly Color CloseBarNormal = new Color(0.09f, 0.09f, 0.11f, 0.96f); private static readonly Color CloseBarHover = new Color(0.12f, 0.12f, 0.15f, 0.96f); private static readonly Color CloseBarPress = new Color(0.07f, 0.07f, 0.09f, 0.96f); private static readonly Color CloseBarText = Color.white; private static readonly Color PanelBgColor = new Color(0.08f, 0.08f, 0.1f, 0.98f); private static UiHost EnsureUiHost() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown if ((Object)(object)_uiHost != (Object)null) { return _uiHost; } GameObject val = new GameObject("PeakTuner_UiHost"); Object.DontDestroyOnLoad((Object)(object)val); _uiHost = val.AddComponent<UiHost>(); return _uiHost; } private static void RunUiActionThrottled(string name, Action action, float cooldownSeconds = 0.2f) { if (!_uiBusy && !(Time.unscaledTime < _nextAllowedClickTime)) { _uiBusy = true; _nextAllowedClickTime = Time.unscaledTime + cooldownSeconds; ((MonoBehaviour)EnsureUiHost()).StartCoroutine(RunUiActionNextFrame(name, action)); } } [IteratorStateMachine(typeof(<RunUiActionNextFrame>d__11))] private static IEnumerator RunUiActionNextFrame(string name, Action action) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <RunUiActionNextFrame>d__11(0) { name = name, action = action }; } public static void Install(ManualLogSource log, ModConfig cfg, CheatsService cheats) { //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 _log = log; _cfg = cfg; _cheats = cheats; if (!_registered) { _registered = true; object obj = <>O.<0>__BuildIntoPauseMenu; if (obj == null) { BuilderDelegate val = BuildIntoPauseMenu; <>O.<0>__BuildIntoPauseMenu = val; obj = (object)val; } MenuAPI.AddToPauseMenu((BuilderDelegate)obj); _log.LogInfo((object)"[PeakTuner] Registered pause-menu UI builder."); } } private static void BuildIntoPauseMenu(Transform pauseMenuMainPageTransform) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Expected O, but got Unknown //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Expected O, but got Unknown //IL_021b: 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_0247: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) try { if (!IsGameplayReady() || (Object)(object)pauseMenuMainPageTransform.Find("PeakTuner_CheatsPanel") != (Object)null) { return; } Transform val = FindPauseMenuButtonListParent(pauseMenuMainPageTransform); PeakMenuButton val2 = MenuAPI.CreatePauseMenuButton("Cheats"); ElementExtensions.ParentTo<PeakMenuButton>(val2, val); SetButtonText(val2, "Cheats"); ((Component)val2.Button).transform.SetSiblingIndex(0); GameObject val3 = new GameObject("PeakTuner_CheatsPanel"); val3.transform.SetParent(pauseMenuMainPageTransform, false); CanvasGroup val4 = val3.AddComponent<CanvasGroup>(); val4.alpha = 0f; val4.interactable = false; val4.blocksRaycasts = false; _log.LogInfo((object)"[PeakTuner] Cheats panel created."); RectTransform val5 = val3.AddComponent<RectTransform>(); val5.anchorMin = new Vector2(0.5f, 0.5f); val5.anchorMax = new Vector2(0.5f, 0.5f); val5.pivot = new Vector2(0.5f, 0.5f); val5.sizeDelta = new Vector2(780f, 840f); val5.anchoredPosition = Vector2.zero; Image bg = val3.AddComponent<Image>(); ApplySolidPanelBackground(bg); VerticalLayoutGroup val6 = val3.AddComponent<VerticalLayoutGroup>(); ((LayoutGroup)val6).childAlignment = (TextAnchor)1; ((HorizontalOrVerticalLayoutGroup)val6).spacing = 6f; ((LayoutGroup)val6).padding = new RectOffset(18, 18, 18, 18); ((HorizontalOrVerticalLayoutGroup)val6).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)val6).childControlHeight = true; ((HorizontalOrVerticalLayoutGroup)val6).childForceExpandWidth = true; ((HorizontalOrVerticalLayoutGroup)val6).childForceExpandHeight = false; AddPlainHeaderText("CHEATS", val3.transform, 38f); ScrollRect val7 = null; GameObject val8 = new GameObject("PeakTuner_CheatsScroll"); val8.transform.SetParent(val3.transform, false); LayoutElement val9 = val8.AddComponent<LayoutElement>(); val9.flexibleWidth = 1f; val9.flexibleHeight = 1f; val9.minHeight = 320f; val9.preferredHeight = 0f; RectTransform val10 = val8.GetComponent<RectTransform>() ?? val8.AddComponent<RectTransform>(); if ((Object)(object)val10 == (Object)null) { _log.LogError((object)"[PeakTuner] Failed to create ScrollRect RectTransform."); return; } val10.anchorMin = new Vector2(0f, 0f); val10.anchorMax = new Vector2(1f, 1f); val10.pivot = new Vector2(0.5f, 0.5f); val10.offsetMin = Vector2.zero; val10.offsetMax = Vector2.zero; PeakScrollableContent scrollContent = val8.AddComponent<PeakScrollableContent>(); val7 = val8.GetComponent<ScrollRect>(); if ((Object)(object)val7 != (Object)null) { AddScrollBar(val8, val7); } ((MonoBehaviour)EnsureUiHost()).StartCoroutine(BuildCheatContentNextFrame(val3, val5, val8, scrollContent, val7, val2)); val3.SetActive(false); } catch (Exception arg) { _log.LogError((object)$"[PeakTuner] BuildIntoPauseMenu failed: {arg}"); } } [IteratorStateMachine(typeof(<BuildCheatContentNextFrame>d__29))] private static IEnumerator BuildCheatContentNextFrame(GameObject panelGo, RectTransform panelRt, GameObject scrollGo, PeakScrollableContent scrollContent, ScrollRect? scrollRect, PeakMenuButton openBtn) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <BuildCheatContentNextFrame>d__29(0) { panelGo = panelGo, panelRt = panelRt, scrollGo = scrollGo, scrollContent = scrollContent, scrollRect = scrollRect, openBtn = openBtn }; } private static void BuildCheatContent(GameObject panelGo, RectTransform panelRt, GameObject scrollGo, PeakScrollableContent scrollContent, ScrollRect? scrollRect, PeakMenuButton openBtn) { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Expected O, but got Unknown //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Expected O, but got Unknown //IL_03e5: Unknown result type (might be due to invalid IL or missing references) //IL_03ef: Expected O, but got Unknown //IL_0406: Unknown result type (might be due to invalid IL or missing references) //IL_0410: Expected O, but got Unknown //IL_0427: Unknown result type (might be due to invalid IL or missing references) //IL_0431: Expected O, but got Unknown //IL_0448: Unknown result type (might be due to invalid IL or missing references) //IL_0452: Expected O, but got Unknown //IL_0469: Unknown result type (might be due to invalid IL or missing references) //IL_0473: Expected O, but got Unknown //IL_048a: Unknown result type (might be due to invalid IL or missing references) //IL_0494: Expected O, but got Unknown //IL_04c1: Unknown result type (might be due to invalid IL or missing references) //IL_04e8: Unknown result type (might be due to invalid IL or missing references) //IL_050f: Unknown result type (might be due to invalid IL or missing references) //IL_0536: Unknown result type (might be due to invalid IL or missing references) //IL_057d: Unknown result type (might be due to invalid IL or missing references) //IL_05b2: Unknown result type (might be due to invalid IL or missing references) //IL_05e7: Unknown result type (might be due to invalid IL or missing references) //IL_061c: Unknown result type (might be due to invalid IL or missing references) //IL_0653: Unknown result type (might be due to invalid IL or missing references) //IL_06c0: Unknown result type (might be due to invalid IL or missing references) //IL_06ca: Expected O, but got Unknown GameObject panelGo2 = panelGo; PeakMenuButton openBtn2 = openBtn; ScrollRect scrollRect2 = scrollRect; RectTransform panelRt2 = panelRt; GameObject scrollGo2 = scrollGo; PeakScrollableContent scrollContent2 = scrollContent; Transform transform = ((Component)scrollContent2.Content).transform; VerticalLayoutGroup component = ((Component)scrollContent2.Content).GetComponent<VerticalLayoutGroup>(); ((LayoutGroup)component).childAlignment = (TextAnchor)1; ((HorizontalOrVerticalLayoutGroup)component).spacing = 6f; ((LayoutGroup)component).padding = new RectOffset(24, 24, 0, 0); ((HorizontalOrVerticalLayoutGroup)component).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)component).childControlHeight = true; ((HorizontalOrVerticalLayoutGroup)component).childForceExpandWidth = true; ((HorizontalOrVerticalLayoutGroup)component).childForceExpandHeight = false; List<ToggleRow> toggles = new List<ToggleRow>(); List<PeakMenuButton> panelRows = new List<PeakMenuButton>(); AddPlainHeaderText("GAMEPLAY", transform, 26f); AddCheatToggleButton("Infinite Stamina", _cfg.InfiniteStamina, transform, toggles, panelRows, CheatColor.StaminaGreen); AddCheatToggleButton("No Fall Damage", _cfg.NoFallDamage, transform, toggles, panelRows, CheatColor.FallPink); AddCheatToggleButton("God Mode", _cfg.GodMode, transform, toggles, panelRows, CheatColor.GodOrange); AddPlainHeaderText("SPEED", transform, 26f); GameObject val = new GameObject("PeakTuner_SpeedRow"); val.transform.SetParent(transform, false); LayoutElement val2 = val.AddComponent<LayoutElement>(); val2.flexibleWidth = 1f; val2.minHeight = 44f; val2.preferredHeight = 44f; val2.flexibleHeight = 0f; HorizontalLayoutGroup val3 = val.AddComponent<HorizontalLayoutGroup>(); ((LayoutGroup)val3).childAlignment = (TextAnchor)4; ((HorizontalOrVerticalLayoutGroup)val3).spacing = 6f; ((LayoutGroup)val3).padding = new RectOffset(0, 0, 0, 0); ((HorizontalOrVerticalLayoutGroup)val3).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)val3).childControlHeight = true; ((HorizontalOrVerticalLayoutGroup)val3).childForceExpandWidth = true; ((HorizontalOrVerticalLayoutGroup)val3).childForceExpandHeight = false; PeakMenuButton b1 = MenuAPI.CreatePauseMenuButton("1x"); ElementExtensions.ParentTo<PeakMenuButton>(b1, val.transform); SetButtonText(b1, "1x"); MakePanelRow(b1, 44f); panelRows.Add(b1); PeakMenuButton b3 = MenuAPI.CreatePauseMenuButton("2x"); ElementExtensions.ParentTo<PeakMenuButton>(b3, val.transform); SetButtonText(b3, "2x"); MakePanelRow(b3, 44f); panelRows.Add(b3); PeakMenuButton b5 = MenuAPI.CreatePauseMenuButton("4x"); ElementExtensions.ParentTo<PeakMenuButton>(b5, val.transform); SetButtonText(b5, "4x"); MakePanelRow(b5, 44f); panelRows.Add(b5); PeakMenuButton b6 = MenuAPI.CreatePauseMenuButton("8x"); ElementExtensions.ParentTo<PeakMenuButton>(b6, val.transform); SetButtonText(b6, "8x"); MakePanelRow(b6, 44f); panelRows.Add(b6); PeakMenuButton b2 = MenuAPI.CreatePauseMenuButton("16x"); ElementExtensions.ParentTo<PeakMenuButton>(b2, val.transform); SetButtonText(b2, "16x"); MakePanelRow(b2, 44f); panelRows.Add(b2); PeakMenuButton b4 = MenuAPI.CreatePauseMenuButton("32x"); ElementExtensions.ParentTo<PeakMenuButton>(b4, val.transform); SetButtonText(b4, "32x"); MakePanelRow(b4, 44f); panelRows.Add(b4); ((UnityEvent)b1.Button.onClick).AddListener((UnityAction)delegate { RunUiActionThrottled("Speed 1x", delegate { _cfg.SpeedMultiplier.Value = 1f; RefreshSpeedButtonTints(); }); }); ((UnityEvent)b3.Button.onClick).AddListener((UnityAction)delegate { RunUiActionThrottled("Speed 2x", delegate { _cfg.SpeedMultiplier.Value = 2f; RefreshSpeedButtonTints(); }); }); ((UnityEvent)b5.Button.onClick).AddListener((UnityAction)delegate { RunUiActionThrottled("Speed 4x", delegate { _cfg.SpeedMultiplier.Value = 4f; RefreshSpeedButtonTints(); }); }); ((UnityEvent)b6.Button.onClick).AddListener((UnityAction)delegate { RunUiActionThrottled("Speed 8x", delegate { _cfg.SpeedMultiplier.Value = 8f; RefreshSpeedButtonTints(); }); }); ((UnityEvent)b2.Button.onClick).AddListener((UnityAction)delegate { RunUiActionThrottled("Speed 16x", delegate { _cfg.SpeedMultiplier.Value = 16f; RefreshSpeedButtonTints(); }); }); ((UnityEvent)b4.Button.onClick).AddListener((UnityAction)delegate { RunUiActionThrottled("Speed 32x", delegate { _cfg.SpeedMultiplier.Value = 32f; RefreshSpeedButtonTints(); }); }); AddPlainHeaderText("STATUS TOGGLES", transform, 26f); AddCheatToggleButton("Disable Poison", _cfg.DisablePoison, transform, toggles, panelRows, CheatColor.PoisonPurple); AddCheatToggleButton("Disable Cold", _cfg.DisableCold, transform, toggles, panelRows, CheatColor.ColdBlue); AddCheatToggleButton("Disable Hot", _cfg.DisableHot, transform, toggles, panelRows, CheatColor.HotRed); AddCheatToggleButton("Disable Hunger", _cfg.DisableHunger, transform, toggles, panelRows, CheatColor.HungerYellow); AddPlainHeaderText("STATUS APPLY", transform, 26f); AddActionButton("Apply Poison", transform, panelRows, delegate { _cheats.ApplyStatus(PeakStatus.Poison, 1f); }, CheatColor.PoisonPurple); AddActionButton("Apply Cold", transform, panelRows, delegate { _cheats.ApplyStatus(PeakStatus.Cold, 1f); }, CheatColor.ColdBlue); AddActionButton("Apply Hot", transform, panelRows, delegate { _cheats.ApplyStatus(PeakStatus.Hot, 1f); }, CheatColor.HotRed); AddActionButton("Apply Hunger", transform, panelRows, delegate { _cheats.ApplyStatus(PeakStatus.Hunger, 1f); }, CheatColor.HungerYellow); AddPlainHeaderText("UI", transform, 26f); AddCheatToggleButton("Minimap", _cfg.MinimapEnabled, transform, toggles, panelRows, CheatColor.UiTeal, delegate(bool enabled) { MinimapUi.SetEnabled(enabled); }); AddHeaderStyleCloseBar("CLOSE", panelGo2.transform, delegate { CanvasGroup component5 = panelGo2.GetComponent<CanvasGroup>(); if ((Object)(object)component5 != (Object)null) { component5.alpha = 0f; component5.interactable = false; component5.blocksRaycasts = false; } panelGo2.SetActive(false); }); panelGo2.SetActive(false); ((UnityEvent)openBtn2.Button.onClick).AddListener((UnityAction)delegate { //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014b: 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_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) _log.LogInfo((object)$"[PeakTuner] Cheats button clicked. panelActive={panelGo2.activeSelf}"); RefreshToggleLabels(toggles); RefreshSpeedButtonTints(); QueueRowHeightSync(openBtn2, panelRows); panelGo2.SetActive(true); panelGo2.transform.SetAsLastSibling(); CanvasGroup component2 = panelGo2.GetComponent<CanvasGroup>(); if ((Object)(object)component2 != (Object)null) { component2.alpha = 1f; component2.interactable = true; component2.blocksRaycasts = true; } if ((Object)(object)scrollRect2 != (Object)null) { Canvas.ForceUpdateCanvases(); scrollRect2.verticalNormalizedPosition = 1f; } LayoutRebuilder.ForceRebuildLayoutImmediate(panelRt2); RectTransform component3 = panelGo2.GetComponent<RectTransform>(); RectTransform component4 = scrollGo2.GetComponent<RectTransform>(); RectTransform content = scrollContent2.Content; ManualLogSource log = _log; object[] obj = new object[4] { panelGo2.activeSelf, null, null, null }; Vector2? obj2; Rect rect; if (component3 == null) { obj2 = null; } else { rect = component3.rect; obj2 = ((Rect)(ref rect)).size; } obj[1] = obj2; Vector2? obj3; if (component4 == null) { obj3 = null; } else { rect = component4.rect; obj3 = ((Rect)(ref rect)).size; } obj[2] = obj3; rect = content.rect; obj[3] = ((Rect)(ref rect)).size; log.LogInfo((object)string.Format("[PeakTuner] Cheats panel shown. panelActive={0} panelSize={1} scrollSize={2} contentSize={3}", obj)); }); void RefreshSpeedButtonTints() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0053: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: 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_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) float value = _cfg.SpeedMultiplier.Value; ApplyButtonTint(b1, (Mathf.Abs(value - 1f) < 0.001f) ? CheatColor.SpeedSelected : CheatColor.SpeedUnselected); ApplyButtonTint(b3, (Mathf.Abs(value - 2f) < 0.001f) ? CheatColor.SpeedSelected : CheatColor.SpeedUnselected); ApplyButtonTint(b5, (Mathf.Abs(value - 4f) < 0.001f) ? CheatColor.SpeedSelected : CheatColor.SpeedUnselected); ApplyButtonTint(b6, (Mathf.Abs(value - 8f) < 0.001f) ? CheatColor.SpeedSelected : CheatColor.SpeedUnselected); ApplyButtonTint(b2, (Mathf.Abs(value - 16f) < 0.001f) ? CheatColor.SpeedSelected : CheatColor.SpeedUnselected); ApplyButtonTint(b4, (Mathf.Abs(value - 32f) < 0.001f) ? CheatColor.SpeedSelected : CheatColor.SpeedUnselected); } } private static void AddScrollBar(GameObject scrollGo, ScrollRect scrollRect) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //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) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_006e: 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_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Expected O, but got Unknown //IL_011c: 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_0148: 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_01b3: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("PeakTuner_Scrollbar"); val.transform.SetParent(scrollGo.transform, false); RectTransform val2 = val.AddComponent<RectTransform>(); val2.anchorMin = new Vector2(1f, 0f); val2.anchorMax = new Vector2(1f, 1f); val2.pivot = new Vector2(1f, 0.5f); val2.sizeDelta = new Vector2(10f, 0f); val2.anchoredPosition = new Vector2(-6f, 0f); Image val3 = val.AddComponent<Image>(); val3.sprite = GetSolidSprite(); val3.type = (Type)1; ((Graphic)val3).material = null; ((Graphic)val3).raycastTarget = false; ((MaskableGraphic)val3).maskable = false; ((Graphic)val3).color = new Color(1f, 1f, 1f, 0.08f); Scrollbar val4 = val.AddComponent<Scrollbar>(); val4.direction = (Direction)2; GameObject val5 = new GameObject("Handle"); val5.transform.SetParent(val.transform, false); RectTransform val6 = val5.AddComponent<RectTransform>(); val6.anchorMin = new Vector2(0f, 0f); val6.anchorMax = new Vector2(1f, 1f); val6.offsetMin = new Vector2(2f, 2f); val6.offsetMax = new Vector2(-2f, -2f); Image val7 = val5.AddComponent<Image>(); val7.sprite = GetSolidSprite(); val7.type = (Type)1; ((Graphic)val7).material = null; ((Graphic)val7).raycastTarget = true; ((MaskableGraphic)val7).maskable = false; ((Graphic)val7).color = new Color(1f, 1f, 1f, 0.35f); val4.handleRect = val6; ((Selectable)val4).targetGraphic = (Graphic)(object)val7; scrollRect.verticalScrollbar = val4; scrollRect.verticalScrollbarVisibility = (ScrollbarVisibility)2; scrollRect.verticalScrollbarSpacing = -2f; } private static void AddCheatToggleButton(string label, ConfigEntry<bool> entry, Transform parent, List<ToggleRow> stash, List<PeakMenuButton> panelRows, Color tint, Action<bool>? onChanged = null) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0017: 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_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Expected O, but got Unknown //IL_00e1: Unknown result type (might be due to invalid IL or missing references) string label2 = label; ConfigEntry<bool> entry2 = entry; Action<bool> onChanged2 = onChanged; PeakMenuButton btn = MenuAPI.CreatePauseMenuButton(BuildToggleLabel(label2, entry2.Value)); ElementExtensions.ParentTo<PeakMenuButton>(btn, parent); SetButtonText(btn, BuildToggleLabel(label2, entry2.Value)); MakePanelRow(btn, 44f); ApplyToggleTint(btn, tint, entry2.Value); panelRows.Add(btn); ((UnityEvent)btn.Button.onClick).AddListener((UnityAction)delegate { RunUiActionThrottled(label2, delegate { //IL_0046: Unknown result type (might be due to invalid IL or missing references) entry2.Value = !entry2.Value; ((PeakLocalizableElement)btn).Text.text = BuildToggleLabel(label2, entry2.Value); ApplyToggleTint(btn, tint, entry2.Value); onChanged2?.Invoke(entry2.Value); }); }); stash.Add(new ToggleRow(label2, entry2, btn, tint)); } private static void AddActionButton(string text, Transform parent, Action action, Color tint) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) AddActionButton(text, parent, null, action, tint); } private static void AddActionButton(string text, Transform parent, List<PeakMenuButton>? panelRows, Action action, Color tint) { //IL_0040: 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_006d: Expected O, but got Unknown string text2 = text; Action action2 = action; PeakMenuButton val = MenuAPI.CreatePauseMenuButton(text2); ElementExtensions.ParentTo<PeakMenuButton>(val, parent); SetButtonText(val, text2); MakePanelRow(val, 44f); ApplyButtonTint(val, tint); panelRows?.Add(val); ((UnityEvent)val.Button.onClick).AddListener((UnityAction)delegate { RunUiActionThrottled(text2, delegate { action2(); }); }); } private static TMP_Text AddPlainHeaderText(string text, Transform parent, float fontSize) { //IL_0099: Unknown result type (might be due to invalid IL or missing references) PeakText val = MenuAPI.CreateText(text, "PeakTuner_hdr_" + Guid.NewGuid().ToString("N")); ElementExtensions.ParentTo<PeakText>(val, parent); TMP_Text text2 = ((PeakLocalizableElement)val).Text; text2.text = text; text2.fontSize = fontSize; text2.alignment = (TextAlignmentOptions)514; text2.textWrappingMode = (TextWrappingModes)0; LayoutElement val2 = ((Component)text2).gameObject.GetComponent<LayoutElement>(); if ((Object)(object)val2 == (Object)null) { val2 = ((Component)text2).gameObject.AddComponent<LayoutElement>(); } val2.flexibleWidth = 1f; val2.minHeight = fontSize + 10f; val2.preferredHeight = fontSize + 10f; ((Graphic)text2).color = Color.white; return text2; } private static void MakePanelRow(PeakMenuButton btn, float height) { try { GameObject gameObject = ((Component)btn.Button).gameObject; LayoutElement val = gameObject.GetComponent<LayoutElement>(); if ((Object)(object)val == (Object)null) { val = gameObject.AddComponent<LayoutElement>(); } val.flexibleWidth = 1f; val.minHeight = height; val.preferredHeight = height; val.flexibleHeight = 0f; } catch { } } private static void ApplyButtonTint(PeakMenuButton btn, Color tint) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) try { btn.SetColor(tint, true); if ((Object)(object)((PeakLocalizableElement)btn).Text != (Object)null) { ((Graphic)((PeakLocalizableElement)btn).Text).color = Color.white; } if ((Object)(object)btn.Button != (Object)null) { ((Selectable)btn.Button).transition = (Transition)0; } } catch { } } private static void QueueRowHeightSync(PeakMenuButton reference, List<PeakMenuButton> rows) { ((MonoBehaviour)EnsureUiHost()).StartCoroutine(SyncRowHeightsNextFrame(reference, rows)); } [IteratorStateMachine(typeof(<SyncRowHeightsNextFrame>d__39))] private static IEnumerator SyncRowHeightsNextFrame(PeakMenuButton reference, List<PeakMenuButton> rows) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <SyncRowHeightsNextFrame>d__39(0) { reference = reference, rows = rows }; } private static void SetRowHeight(PeakMenuButton btn, float height) { try { GameObject gameObject = ((Component)btn.Button).gameObject; LayoutElement val = gameObject.GetComponent<LayoutElement>(); if ((Object)(object)val == (Object)null) { val = gameObject.AddComponent<LayoutElement>(); } val.flexibleWidth = 1f; val.minHeight = height; val.preferredHeight = height; val.flexibleHeight = 0f; } catch { } } private static void ApplyToggleTint(PeakMenuButton btn, Color baseTint, bool enabled) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0004: 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) ApplyButtonTint(btn, enabled ? baseTint : Muted(baseTint)); } private static Color Muted(Color c) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: 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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) Color val = default(Color); ((Color)(ref val))..ctor(0.45f, 0.45f, 0.45f, 1f); Color val2 = Color.Lerp(c, val, 0.5f); return new Color(val2.r * 0.75f, val2.g * 0.75f, val2.b * 0.75f, c.a); } private static void RefreshToggleLabels(List<ToggleRow> rows) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) foreach (ToggleRow row in rows) { ApplyToggleTint(row.Button, row.BaseTint, row.Entry.Value); } foreach (ToggleRow row2 in rows) { ((PeakLocalizableElement)row2.Button).Text.text = BuildToggleLabel(row2.Label, row2.Entry.Value); } } private static string BuildToggleLabel(string label, bool enabled) { if (!enabled) { return label + ": OFF"; } return label + ": ON"; } private static bool IsGameplayReady() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown Character localCharacter = Character.localCharacter; return (Object)localCharacter != (Object)null; } private static Transform FindPauseMenuButtonListParent(Transform root) { Transform val = FindButtonParentByText(root, "BACK"); if ((Object)(object)val != (Object)null) { return val; } string[] array = new string[6] { "Resume", "Continue", "Options", "Settings", "Quit", "Exit" }; for (int i = 0; i < array.Length; i++) { Transform val2 = FindButtonParentByText(root, array[i]); if ((Object)(object)val2 != (Object)null) { return val2; } } return root; } private static Transform? FindButtonParentByText(Transform root, string needle) { Button[] componentsInChildren = ((Component)root).GetComponentsInChildren<Button>(true); Button[] array = componentsInChildren; foreach (Button val in array) { if ((Object)(object)val == (Object)null) { continue; } TMP_Text componentInChildren = ((Component)val).GetComponentInChildren<TMP_Text>(true); if (!((Object)(object)componentInChildren == (Object)null)) { string a = (componentInChildren.text ?? "").Trim(); if (string.Equals(a, needle, StringComparison.OrdinalIgnoreCase)) { return ((Component)val).transform.parent; } } } return null; } private static void ApplySolidPanelBackground(Image bg) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) bg.sprite = GetSolidSprite(); bg.type = (Type)1; ((Graphic)bg).material = null; ((Graphic)bg).raycastTarget = true; ((Graphic)bg).color = PanelBgColor; } private static Sprite GetSolidSprite() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown //IL_0020: 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) //IL_0056: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_solidSprite != (Object)null) { return _solidSprite; } Texture2D val = new Texture2D(1, 1, (TextureFormat)4, false); val.SetPixel(0, 0, Color.white); val.Apply(false, true); _solidSprite = Sprite.Create(val, new Rect(0f, 0f, 1f, 1f), new Vector2(0.5f, 0.5f), 100f); return _solidSprite; } private static void SetButtonText(PeakMenuButton btn, string text) { try { if ((Object)(object)((PeakLocalizableElement)btn).Text != (Object)null) { ((PeakLocalizableElement)btn).Text.text = text; } } catch { } } private static void AddHeaderStyleCloseBar(string text, Transform parent, Action onClick) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_020b: 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_0274: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: 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_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_02ef: 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_0331: Expected O, but got Unknown Action onClick2 = onClick; GameObject val = new GameObject("PeakTuner_CloseSpacer"); val.transform.SetParent(parent, false); LayoutElement val2 = val.AddComponent<LayoutElement>(); val2.flexibleWidth = 1f; float preferredHeight = (val2.minHeight = 18f); val2.preferredHeight = preferredHeight; val2.flexibleHeight = 0f; GameObject val3 = new GameObject("PeakTuner_CloseBar"); val3.transform.SetParent(parent, false); LayoutElement val4 = val3.AddComponent<LayoutElement>(); val4.flexibleWidth = 1f; val4.minHeight = 52f; val4.preferredHeight = 52f; val4.flexibleHeight = 0f; Image val5 = val3.AddComponent<Image>(); val5.sprite = GetSolidSprite(); val5.type = (Type)1; ((Graphic)val5).material = null; ((Graphic)val5).raycastTarget = true; Button val6 = val3.AddComponent<Button>(); ((Selectable)val6).targetGraphic = (Graphic)(object)val5; ((Selectable)val6).transition = (Transition)1; ColorBlock colors = ((Selectable)val6).colors; ((ColorBlock)(ref colors)).normalColor = CloseBarNormal; ((ColorBlock)(ref colors)).highlightedColor = CloseBarHover; ((ColorBlock)(ref colors)).pressedColor = CloseBarPress; ((ColorBlock)(ref colors)).selectedColor = CloseBarHover; ((ColorBlock)(ref colors)).disabledColor = new Color(CloseBarNormal.r, CloseBarNormal.g, CloseBarNormal.b, 0.35f); ((ColorBlock)(ref colors)).colorMultiplier = 1f; ((ColorBlock)(ref colors)).fadeDuration = 0.08f; ((Selectable)val6).colors = colors; PeakText val7 = MenuAPI.CreateText(text, "PeakTuner_close_txt_" + Guid.NewGuid().ToString("N")); ElementExtensions.ParentTo<PeakText>(val7, val3.transform); RectTransform component = ((Component)val7).gameObject.GetComponent<RectTransform>(); component.anchorMin = new Vector2(0f, 0f); component.anchorMax = new Vector2(1f, 1f); component.pivot = new Vector2(0.5f, 0.5f); component.offsetMin = Vector2.zero; component.offsetMax = Vector2.zero; component.anchoredPosition = Vector2.zero; ContentSizeFitter component2 = ((Component)val7).gameObject.GetComponent<ContentSizeFitter>(); if ((Object)(object)component2 != (Object)null) { ((Behaviour)component2).enabled = false; } TMP_Text text2 = ((PeakLocalizableElement)val7).Text; text2.text = text; text2.fontSize = 28f; text2.alignment = (TextAlignmentOptions)514; text2.textWrappingMode = (TextWrappingModes)0; ((Graphic)text2).color = CloseBarText; text2.margin = Vector4.zero; RectTransform component3 = ((Component)text2).GetComponent<RectTransform>(); component3.anchorMin = new Vector2(0f, 0f); component3.anchorMax = new Vector2(1f, 1f); component3.pivot = new Vector2(0.5f, 0.5f); component3.offsetMin = Vector2.zero; component3.offsetMax = Vector2.zero; component3.anchoredPosition = Vector2.zero; ContentSizeFitter component4 = ((Component)text2).gameObject.GetComponent<ContentSizeFitter>(); if ((Object)(object)component4 != (Object)null) { ((Behaviour)component4).enabled = false; } ((UnityEvent)val6.onClick).AddListener((UnityAction)delegate { RunUiActionThrottled("Close", delegate { onClick2(); }); }); } } public sealed class PeakMenuSkin { private readonly ManualLogSource _log; public Rect MenuRect = new Rect(24f, 80f, 520f, 520f); public string WindowTitle = ""; private static readonly Color32 CWindow = new Color32((byte)22, (byte)22, (byte)26, byte.MaxValue); private static readonly Color32 CPanel = new Color32((byte)30, (byte)30, (byte)36, byte.MaxValue); private static readonly Color32 CBorder = new Color32((byte)70, (byte)70, (byte)84, byte.MaxValue); private static readonly Color32 CText = new Color32((byte)235, (byte)235, (byte)240, byte.MaxValue); private static readonly Color32 CTextDim = new Color32((byte)190, (byte)190, (byte)200, byte.MaxValue); private static readonly Color32 CBtn = new Color32((byte)48, (byte)48, (byte)58, byte.MaxValue); private static readonly Color32 CBtnHover = new Color32((byte)62, (byte)62, (byte)76, byte.MaxValue); private static readonly Color32 CBtnActive = new Color32((byte)80, (byte)80, (byte)98, byte.MaxValue); private bool _ready; private Font? _uiFont; private Texture2D? _texWindow; private Texture2D? _texPanel; private Texture2D? _texBtn; private Texture2D? _texBtnHover; private Texture2D? _texBtnActive; private GUIStyle? _windowStyle; private GUIStyle? _panelStyle; private GUIStyle? _labelStyle; private GUIStyle? _labelDimStyle; private GUIStyle? _toggleStyle; private GUIStyle? _buttonStyle; private GUIStyle? _smallButtonStyle; private GUIStyle? _sectionHeaderStyle; public GUIStyle WindowStyle => _windowStyle; public GUIStyle PanelStyle => _panelStyle; public GUIStyle LabelStyle => _labelStyle; public GUIStyle LabelDimStyle => _labelDimStyle; public GUIStyle ToggleStyle => _toggleStyle; public GUIStyle ButtonStyle => _buttonStyle; public GUIStyle SmallButtonStyle => _smallButtonStyle; public GUIStyle SectionHeaderStyle => _sectionHeaderStyle; public PeakMenuSkin(ManualLogSource log) { //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) _log = log; } public void EnsureStyles() { //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_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_003f: 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) //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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: 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) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: 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_00c2: 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_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: 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_00f6: Expected O, but got Unknown //IL_00fb: Expected O, but got Unknown //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Expected O, but got Unknown //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_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_014a: 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_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Expected O, but got Unknown //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Expected O, but got Unknown //IL_0180: Expected O, but got Unknown //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0190: 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_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Expected O, but got Unknown //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: 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_01e4: Expected O, but got Unknown //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: 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_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Expected O, but got Unknown //IL_0228: Expected O, but got Unknown //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_024c: 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_0263: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_027e: 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_028e: Unknown result type (might be due to invalid IL or missing references) //IL_029f: 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_02af: 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_02c2: Expected O, but got Unknown //IL_02c7: Expected O, but got Unknown //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Expected O, but got Unknown //IL_02f1: Expected O, but got Unknown //IL_02fc: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_030d: Unknown result type (might be due to invalid IL or missing references) //IL_0315: Unknown result type (might be due to invalid IL or missing references) //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_0320: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Unknown result type (might be due to invalid IL or missing references) //IL_0330: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_033f: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_034f: Expected O, but got Unknown //IL_0354: Expected O, but got Unknown if (!_ready) { _uiFont = TryFindNiceFont(); _texWindow = MakeSolid(Color32.op_Implicit(CWindow)); _texPanel = MakeSolid(Color32.op_Implicit(CPanel)); _texBtn = MakeSolid(Color32.op_Implicit(CBtn)); _texBtnHover = MakeSolid(Color32.op_Implicit(CBtnHover)); _texBtnActive = MakeSolid(Color32.op_Implicit(CBtnActive)); GUIStyle val = new GUIStyle(GUI.skin.window) { font = _uiFont, fontSize = 16 }; val.normal.background = _texWindow; val.normal.textColor = Color.white; val.onNormal.background = _texWindow; val.onNormal.textColor = Color.white; val.padding = new RectOffset(14, 14, 12, 12); _windowStyle = val; _windowStyle.border = new RectOffset(6, 6, 6, 6); GUIStyle val2 = new GUIStyle(GUI.skin.box) { font = _uiFont, fontSize = 14 }; val2.normal.background = _texPanel; val2.normal.textColor = ToColor(CText); val2.padding = new RectOffset(14, 14, 12, 12); val2.margin = new RectOffset(0, 0, 0, 0); _panelStyle = val2; GUIStyle val3 = new GUIStyle(GUI.skin.label) { font = _uiFont, fontSize = 14 }; val3.normal.textColor = ToColor(CText); _labelStyle = val3; GUIStyle val4 = new GUIStyle(_labelStyle); val4.normal.textColor = ToColor(CTextDim); _labelDimStyle = val4; GUIStyle val5 = new GUIStyle(_labelStyle) { fontSize = 12, fontStyle = (FontStyle)1 }; val5.normal.textColor = ToColor(CTextDim); val5.margin = new RectOffset(0, 0, 8, 2); _sectionHeaderStyle = val5; GUIStyle val6 = new GUIStyle(GUI.skin.button) { font = _uiFont, fontSize = 14 }; val6.normal.background = _texBtn; val6.normal.textColor = Color.white; val6.hover.background = _texBtnHover; val6.hover.textColor = Color.white; val6.active.background = _texBtnActive; val6.active.textColor = Color.white; val6.padding = new RectOffset(12, 12, 9, 9); _buttonStyle = val6; _smallButtonStyle = new GUIStyle(_buttonStyle) { fontSize = 13, padding = new RectOffset(10, 10, 7, 7) }; GUIStyle val7 = new GUIStyle(GUI.skin.toggle) { font = _uiFont, fontSize = 14 }; val7.normal.textColor = ToColor(CText); val7.onNormal.textColor = ToColor(CText); val7.padding = new RectOffset(20, 0, 0, 0); _toggleStyle = val7; _ready = true; _log.LogInfo((object)$"[PeakMenuSkin] IMGUI styles ready. Using customFont={(Object)(object)_uiFont != (Object)null}"); } } public void DrawBorderedBox(Rect r) { //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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) Texture2D val = MakeSolid(Color32.op_Implicit(CBorder)); GUI.DrawTexture(new Rect(((Rect)(ref r)).x - 1f, ((Rect)(ref r)).y - 1f, ((Rect)(ref r)).width + 2f, 1f), (Texture)(object)val); GUI.DrawTexture(new Rect(((Rect)(ref r)).x - 1f, ((Rect)(ref r)).y + ((Rect)(ref r)).height, ((Rect)(ref r)).width + 2f, 1f), (Texture)(object)val); GUI.DrawTexture(new Rect(((Rect)(ref r)).x - 1f, ((Rect)(ref r)).y, 1f, ((Rect)(ref r)).height), (Texture)(object)val); GUI.DrawTexture(new Rect(((Rect)(ref r)).x + ((Rect)(ref r)).width, ((Rect)(ref r)).y, 1f, ((Rect)(ref r)).height), (Texture)(object)val); } private static Texture2D MakeSolid(Color c) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Expected O, but got Unknown //IL_000d: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(1, 1, (TextureFormat)4, false); val.SetPixel(0, 0, c); val.Apply(false, true); return val; } private static Color ToColor(Color32 c) { //IL_0000: 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) //IL_001a: 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_0034: Unknown result type (might be due to invalid IL or missing references) return new Color((float)(int)c.r / 255f, (float)(int)c.g / 255f, (float)(int)c.b / 255f, (float)(int)c.a / 255f); } private static Font? TryFindNiceFont() { try { Font[] array = Resources.FindObjectsOfTypeAll<Font>(); if (array == null || array.Length == 0) { return null; } Font result = null; int num = int.MinValue; Font[] array2 = array; foreach (Font val in array2) { if (!((Object)(object)val == (Object)null)) { string text = ((Object)val).name ?? ""; int num2 = 0; if (text.IndexOf("Arial", StringComparison.OrdinalIgnoreCase) >= 0) { num2 -= 50; } if (text.IndexOf("UI", StringComparison.OrdinalIgnoreCase) >= 0) { num2 += 30; } if (text.IndexOf("Menu", StringComparison.OrdinalIgnoreCase) >= 0) { num2 += 15; } if (text.IndexOf("Bold", StringComparison.OrdinalIgnoreCase) >= 0) { num2 += 5; } if (!val.dynamic) { num2 += 5; } if (num2 > num) { num = num2; result = val; } } } return result; } catch { return null; } } } public sealed class PeakMenuView { public readonly struct Actions { public readonly Action onClose; public readonly Action onApplyPoison; public readonly Action onApplyCold; public readonly Action onApplyHot; public readonly Action onApplyHunger; public Actions(Action onClose, Action onApplyPoison, Action onApplyCold, Action onApplyHot, Action onApplyHunger) { this.onClose = onClose; this.onApplyPoison = onApplyPoison; this.onApplyCold = onApplyCold; this.onApplyHot = onApplyHot; this.onApplyHunger = onApplyHunger; } } private readonly PeakMenuSkin _skin; private readonly ModConfig _cfg; private readonly Actions _a; private Vector2 _scroll; private readonly int _windowId; public PeakMenuView(PeakMenuSkin skin, ModConfig cfg, Actions actions) { //IL_002c: 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) _skin = skin; _cfg = cfg; _a = actions; _windowId = "PeakTuner.Window".GetHashCode(); _scroll = Vector2.zero; } public void Draw() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: 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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown //IL_0059: Unknown result type (might be due to invalid IL or missing references) _skin.EnsureStyles(); _skin.MenuRect = ClampToScreen(_skin.MenuRect); GUI.Window(_windowId, _skin.MenuRect, new WindowFunction(DrawWindowContents), _skin.WindowTitle, _skin.WindowStyle); } private void DrawWindowContents(int id) { //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) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) Rect val = default(Rect); ((Rect)(ref val))..ctor(10f, 28f, ((Rect)(ref _skin.MenuRect)).width - 20f, ((Rect)(ref _skin.MenuRect)).height - 38f); _skin.DrawBorderedBox(val); GUILayout.BeginArea(val); _scroll = GUILayout.BeginScrollView(_scroll, false, true, Array.Empty<GUILayoutOption>()); GUILayout.BeginVertical(_skin.PanelStyle, Array.Empty<GUILayoutOption>()); ToggleEntry(_cfg.InfiniteStamina, "Infinite Stamina"); ToggleEntry(_cfg.NoFallDamage, "No Fall Damage"); ToggleEntry(_cfg.DisableCold, "Disable Cold"); ToggleEntry(_cfg.DisablePoison, "Disable Poison"); ToggleEntry(_cfg.DisableHot, "Disable Hot"); ToggleEntry(_cfg.DisableHunger, "Disable Hunger"); ToggleEntry(_cfg.GodMode, "God Mode"); GUILayout.Space(12f); GUILayout.Label("Status effects", _skin.SectionHeaderStyle, Array.Empty<GUILayoutOption>()); if (GUILayout.Button("Apply Poison", _skin.ButtonStyle, Array.Empty<GUILayoutOption>())) { _a.onApplyPoison(); } if (GUILayout.Button("Apply Cold", _skin.ButtonStyle, Array.Empty<GUILayoutOption>())) { _a.onApplyCold(); } if (GUILayout.Button("Apply Hot", _skin.ButtonStyle, Array.Empty<GUILayoutOption>())) { _a.onApplyHot(); } if (GUILayout.Button("Apply Hunger", _skin.ButtonStyle, Array.Empty<GUILayoutOption>())) { _a.onApplyHunger(); } GUILayout.EndVertical(); GUILayout.EndScrollView(); GUILayout.EndArea(); GUI.DragWindow(new Rect(0f, 0f, 10000f, 24f)); } private void ToggleEntry(ConfigEntry<bool> entry, string label) { bool value = entry.Value; bool flag = GUILayout.Toggle(value, label, _skin.ToggleStyle, Array.Empty<GUILayoutOption>()); if (flag != value) { entry.Value = flag; } } private static Rect ClampToScreen(Rect r) { //IL_0064: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Clamp(((Rect)(ref r)).x, 0f, Mathf.Max(0f, (float)Screen.width - ((Rect)(ref r)).width)); float num2 = Mathf.Clamp(((Rect)(ref r)).y, 0f, Mathf.Max(0f, (float)Screen.height - ((Rect)(ref r)).height)); return new Rect(num, num2, ((Rect)(ref r)).width, ((Rect)(ref r)).height); } } } namespace PeakTuner.Cheats { public sealed class CheatsService { private sealed class SpeedTargets { private readonly struct Candidate { public readonly Component Component; public readonly MemberInfo Member; public readonly int Score; public readonly bool IsMultiplier; public readonly bool IsClimb; public readonly float BaseValue; public static Candidate None => new Candidate(null, null, int.MinValue, isMultiplier: false, isClimb: false, 1f); public Candidate(Component component, MemberInfo member, int score, bool isMultiplier, bool isClimb, float baseValue) { Component = component; Member = member; Score = score; IsMultiplier = isMultiplier; IsClimb = isClimb; BaseValue = baseValue; } public CachedTarget ToCachedTarget() { if (Member == null) { return default(CachedTarget); } string text = (((Object)(object)Component != (Object)null) ? (((object)Component).GetType().Name ?? "<?>") : "<?>"); string text2 = ((Member != null) ? (Member.Name ?? "<?>") : "<?>"); CachedTarget result = default(CachedTarget); result.Component = Component; result.Member = Member; result.IsMultiplier = IsMultiplier; result.BaseValue = (IsMultiplier ? 1f : BaseValue); result.LastSetValue = float.NaN; result.DebugLabel = text + "." + text2; return result; } } private struct CachedTarget { public Component? Component; public MemberInfo? Member; public bool IsMultiplier; public float BaseValue; public float LastSetValue; public string DebugLabel; } public float NextProbeTime; private CachedTarget _move; private CachedTarget _climb; private bool _loggedNotFound; public bool Ready { get { if (!(_move.Member != null)) { return _climb.Member != null; } return true; } } public void TryCache(ManualLogSource log, Character c) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown try { if ((Object)c == (Object)null) { _move = default(CachedTarget); _climb = default(CachedTarget); return; } Component[] componentsInChildren = ((Component)c).GetComponentsInChildren<Component>(true); if (componentsInChildren == null || componentsInChildren.Length == 0) { return; } Candidate bestMove = Candidate.None; Candidate bestClimb = Candidate.None; foreach (Component val in componentsInChildren) { if ((Object)val == (Object)null) { continue; } Type type = ((object)val).GetType(); string text = (type.Name ?? "").ToLowerInvariant(); if (type == typeof(Transform) || type == typeof(RectTransform)) { continue; } int num = 0; if (text.Contains("speed")) { num += 25; } if (text.Contains("movement")) { num += 18; } if (text.Contains("motor")) { num += 18; } if (text.Contains("controller")) { num += 10; } if (text.Contains("camera") || text.Contains("look") || text.Contains("aim")) { num -= 60; } FieldInfo[] fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (FieldInfo fieldInfo in fields) { if (!(fieldInfo.FieldType != typeof(float))) { float? num2 = TryReadFloat(fieldInfo, val); if (num2.HasValue) { ScoreAndMaybeTake(val, fieldInfo, fieldInfo.Name, num2.Value, num, ref bestMove, ref bestClimb); } } } PropertyInfo[] properties = type.GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (PropertyInfo propertyInfo in properties) { if (!(propertyInfo.PropertyType != typeof(float)) && propertyInfo.CanWrite && (propertyInfo.GetIndexParameters() == null || propertyInfo.GetIndexParameters().Length == 0)) { float? num3 = TryReadFloat(propertyInfo, val); if (num3.HasValue) { ScoreAndMaybeTake(val, propertyInfo, propertyInfo.Name, num3.Value, num, ref bestMove, ref bestClimb); } } } } _move = bestMove.ToCachedTarget(); _climb = bestClimb.ToCachedTarget(); if (!Ready) { if (!_loggedNotFound) { _loggedNotFound = true; log.LogInfo((object)"[PeakTuner] Speed: could not locate any plausible speed member on the player (will keep retrying)."); } } else { log.LogInfo((object)("[PeakTuner] Speed: cached move=" + _move.DebugLabel + " climb=" + _climb.DebugLabel)); } } catch (Exception ex) { log.LogError((object)("[PeakTuner] Speed: cache scan failed: " + ex.GetType().Name)); } } public void Apply(ManualLogSource log, Character c, float multiplier) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown try { if (!((Object)c == (Object)null)) { if (_move.Member != null) { ApplyOne(log, c, ref _move, multiplier); } if (_climb.Member != null) { ApplyOne(log, c, ref _climb, multiplier); } } } catch { } } private static void ApplyOne(ManualLogSource log, Character c, ref CachedTarget tgt, float m) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown if ((Object)(object)tgt.Component == (Object)null) { return; } Object component = (Object)(object)tgt.Component; if (component != null && component == (Object)null) { return; } float num = (tgt.IsMultiplier ? m : (tgt.BaseValue * m)); if (Mathf.Abs(num - tgt.LastSetValue) < 0.0001f) { return; } try { if (tgt.Member is FieldInfo fieldInfo) { fieldInfo.SetValue(tgt.Component, num); tgt.LastSetValue = num; } else if (tgt.Member is PropertyInfo propertyInfo) { propertyInfo.SetValue(tgt.Component, num, null); tgt.LastSetValue = num; } } catch (Exception ex)