using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Pigeon; using Pigeon.Math; using Pigeon.Movement; using Unity.Netcode; using UnityEngine; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("CheatMenu")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.0.0.0")] [assembly: AssemblyInformationalVersion("0.0.0-alpha.0.2+36858bab7df4ebf0639a01f16939f1b855b19909")] [assembly: AssemblyProduct("CheatMenu+")] [assembly: AssemblyTitle("CheatMenu")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } public static class CheatsMenu { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static UnityAction <>9__6_0; public static UnityAction <>9__6_1; public static UnityAction <>9__6_2; public static UnityAction <>9__6_3; public static UnityAction <>9__6_4; public static UnityAction <>9__6_5; public static UnityAction <>9__6_6; public static UnityAction <>9__6_7; public static UnityAction <>9__6_8; public static UnityAction <>9__6_9; public static UnityAction <>9__6_10; public static UnityAction <>9__6_11; public static UnityAction <>9__6_12; public static UnityAction <>9__6_13; public static UnityAction <>9__6_14; public static UnityAction <>9__6_15; public static UnityAction <>9__6_16; public static UnityAction <>9__6_17; public static UnityAction <>9__6_18; public static UnityAction <>9__6_19; public static UnityAction <>9__6_20; public static UnityAction <>9__6_21; public static UnityAction <>9__6_22; public static UnityAction <>9__6_23; public static UnityAction <>9__6_24; public static Func <>9__27_0; internal void b__6_0() { refillAmmoNow(); } internal void b__6_1() { refreshCooldownsNow(); } internal void b__6_2() { setMovementPreset(10f, 14f); } internal void b__6_3() { setMovementPreset(24f, 20f); } internal void b__6_4() { setMovementPreset(48f, 28f); } internal void b__6_5() { setMovementPreset(10f, 45f); } internal void b__6_6() { resetMovement(); } internal void b__6_7() { saveTeleportPosition(); } internal void b__6_8() { teleportToSavedPosition(); } internal void b__6_9() { teleportToCrosshair(); } internal void b__6_10() { killAllEnemies(); } internal void b__6_11() { SpawnMenu.spawnSwarm(10); } internal void b__6_12() { SpawnMenu.spawnSwarm(25); } internal void b__6_13() { makeEnemiesFlee(); } internal void b__6_14() { stopEnemiesFleeing(); } internal void b__6_15() { setEnemyIntensity(0f); } internal void b__6_16() { setEnemyIntensity(1f); } internal void b__6_17() { cleanUpParts(); } internal void b__6_18() { cleanUpCollectables(); } internal void b__6_19() { giveAllResources(); } internal void b__6_20() { clearLostLootUpgrades(); } internal void b__6_21() { SpawnMenu.spawnObject("SaxitosBag"); } internal void b__6_22() { SpawnMenu.spawnObject("HoldableBarrel"); } internal void b__6_23() { SpawnMenu.spawnObject("MilkJug"); } internal void b__6_24() { ProgressionMenu.unlockEverything(); } internal bool b__27_0(FieldInfo field) { return field.FieldType == typeof(CooldownData); } } private static readonly Dictionary cooldownFieldsByType = new Dictionary(); private static readonly FieldInfo cooldownChargeField = typeof(CooldownData).GetField("charge", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo cooldownMaxChargesField = typeof(CooldownData).GetField("maxCharges", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly PropertyInfo gunReloadingProperty = typeof(Gun).GetProperty("Reloading", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static Vector3 savedTeleportPosition; private static bool hasSavedTeleportPosition = false; public static void CreateCheatsMenu(MenuMod2Menu parentMenu) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown //IL_008d: 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_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Expected O, but got Unknown //IL_00e1: 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_00ec: Expected O, but got Unknown //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_0122: Expected O, but got Unknown //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_014d: Expected O, but got Unknown //IL_016d: 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_0178: Expected O, but got Unknown //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Expected O, but got Unknown //IL_01c2: 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_01cd: Expected O, but got Unknown //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Expected O, but got Unknown //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Expected O, but got Unknown //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Expected O, but got Unknown //IL_029d: 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_0252: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Expected O, but got Unknown //IL_02c6: 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_02d1: Expected O, but got Unknown //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: Expected O, but got Unknown //IL_031c: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Expected O, but got Unknown //IL_0347: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Expected O, but got Unknown //IL_0372: Unknown result type (might be due to invalid IL or missing references) //IL_0377: Unknown result type (might be due to invalid IL or missing references) //IL_037d: Expected O, but got Unknown //IL_039d: Unknown result type (might be due to invalid IL or missing references) //IL_03a2: Unknown result type (might be due to invalid IL or missing references) //IL_03a8: Expected O, but got Unknown //IL_03c8: Unknown result type (might be due to invalid IL or missing references) //IL_03cd: Unknown result type (might be due to invalid IL or missing references) //IL_03d3: Expected O, but got Unknown //IL_03f3: Unknown result type (might be due to invalid IL or missing references) //IL_03f8: Unknown result type (might be due to invalid IL or missing references) //IL_03fe: Expected O, but got Unknown //IL_045a: Unknown result type (might be due to invalid IL or missing references) //IL_0464: Expected O, but got Unknown //IL_046e: Unknown result type (might be due to invalid IL or missing references) //IL_041e: Unknown result type (might be due to invalid IL or missing references) //IL_0423: Unknown result type (might be due to invalid IL or missing references) //IL_0429: Expected O, but got Unknown //IL_0497: Unknown result type (might be due to invalid IL or missing references) //IL_049c: Unknown result type (might be due to invalid IL or missing references) //IL_04a2: Expected O, but got Unknown //IL_04c2: Unknown result type (might be due to invalid IL or missing references) //IL_04c7: Unknown result type (might be due to invalid IL or missing references) //IL_04cd: Expected O, but got Unknown //IL_04ed: Unknown result type (might be due to invalid IL or missing references) //IL_04f2: Unknown result type (might be due to invalid IL or missing references) //IL_04f8: Expected O, but got Unknown //IL_0518: Unknown result type (might be due to invalid IL or missing references) //IL_051d: Unknown result type (might be due to invalid IL or missing references) //IL_0523: Expected O, but got Unknown //IL_0573: Unknown result type (might be due to invalid IL or missing references) //IL_057d: Expected O, but got Unknown //IL_0587: Unknown result type (might be due to invalid IL or missing references) //IL_05b5: Unknown result type (might be due to invalid IL or missing references) //IL_05bf: Expected O, but got Unknown //IL_05c9: Unknown result type (might be due to invalid IL or missing references) //IL_05f7: Unknown result type (might be due to invalid IL or missing references) //IL_0601: Expected O, but got Unknown //IL_060b: Unknown result type (might be due to invalid IL or missing references) //IL_0543: Unknown result type (might be due to invalid IL or missing references) //IL_0548: Unknown result type (might be due to invalid IL or missing references) //IL_054e: Expected O, but got Unknown //IL_0634: Unknown result type (might be due to invalid IL or missing references) //IL_0639: Unknown result type (might be due to invalid IL or missing references) //IL_063f: Expected O, but got Unknown MenuMod2Menu menuMod2Menu = new MenuMod2Menu("CHEATS", parentMenu); MenuMod2Menu menuMod2Menu2 = new MenuMod2Menu("Ammo & Abilities", menuMod2Menu); MM2Button button7 = null; button7 = menuMod2Menu2.addButton("Infinite ammo", (UnityAction)delegate { toggleInfiniteAmmo(button7); }).changeSuffix(" OFF").changeColour(MenuStyle.Danger); MM2Button button6 = null; button6 = menuMod2Menu2.addButton("No cooldowns", (UnityAction)delegate { toggleNoCooldowns(button6); }).changeSuffix(" OFF").changeColour(MenuStyle.Danger); object obj = <>c.<>9__6_0; if (obj == null) { UnityAction val = delegate { refillAmmoNow(); }; <>c.<>9__6_0 = val; obj = (object)val; } menuMod2Menu2.addButton("Refill ammo now", (UnityAction)obj); object obj2 = <>c.<>9__6_1; if (obj2 == null) { UnityAction val2 = delegate { refreshCooldownsNow(); }; <>c.<>9__6_1 = val2; obj2 = (object)val2; } menuMod2Menu2.addButton("Refresh cooldowns now", (UnityAction)obj2); MenuMod2Menu menuMod2Menu3 = new MenuMod2Menu("Movement", menuMod2Menu); object obj3 = <>c.<>9__6_2; if (obj3 == null) { UnityAction val3 = delegate { setMovementPreset(10f, 14f); }; <>c.<>9__6_2 = val3; obj3 = (object)val3; } menuMod2Menu3.addButton("Movement normal", (UnityAction)obj3); object obj4 = <>c.<>9__6_3; if (obj4 == null) { UnityAction val4 = delegate { setMovementPreset(24f, 20f); }; <>c.<>9__6_3 = val4; obj4 = (object)val4; } menuMod2Menu3.addButton("Movement fast", (UnityAction)obj4); object obj5 = <>c.<>9__6_4; if (obj5 == null) { UnityAction val5 = delegate { setMovementPreset(48f, 28f); }; <>c.<>9__6_4 = val5; obj5 = (object)val5; } menuMod2Menu3.addButton("Movement very fast", (UnityAction)obj5); object obj6 = <>c.<>9__6_5; if (obj6 == null) { UnityAction val6 = delegate { setMovementPreset(10f, 45f); }; <>c.<>9__6_5 = val6; obj6 = (object)val6; } menuMod2Menu3.addButton("Jump high", (UnityAction)obj6); object obj7 = <>c.<>9__6_6; if (obj7 == null) { UnityAction val7 = delegate { resetMovement(); }; <>c.<>9__6_6 = val7; obj7 = (object)val7; } menuMod2Menu3.addButton("Reset movement", (UnityAction)obj7); MenuMod2Menu menuMod2Menu4 = new MenuMod2Menu("Teleport", menuMod2Menu); object obj8 = <>c.<>9__6_7; if (obj8 == null) { UnityAction val8 = delegate { saveTeleportPosition(); }; <>c.<>9__6_7 = val8; obj8 = (object)val8; } menuMod2Menu4.addButton("Save position", (UnityAction)obj8); object obj9 = <>c.<>9__6_8; if (obj9 == null) { UnityAction val9 = delegate { teleportToSavedPosition(); }; <>c.<>9__6_8 = val9; obj9 = (object)val9; } menuMod2Menu4.addButton("Teleport to saved position", (UnityAction)obj9); object obj10 = <>c.<>9__6_9; if (obj10 == null) { UnityAction val10 = delegate { teleportToCrosshair(); }; <>c.<>9__6_9 = val10; obj10 = (object)val10; } menuMod2Menu4.addButton("Teleport to crosshair", (UnityAction)obj10); MenuMod2Menu menuMod2Menu5 = new MenuMod2Menu("Enemies", menuMod2Menu); MM2Button button5 = null; button5 = menuMod2Menu5.addButton("Toggle enemy spawning", (UnityAction)delegate { toggleSpawning(button5); }).changeSuffix(" ON").changeColour(MenuStyle.Success); object obj11 = <>c.<>9__6_10; if (obj11 == null) { UnityAction val11 = delegate { killAllEnemies(); }; <>c.<>9__6_10 = val11; obj11 = (object)val11; } menuMod2Menu5.addButton("Kill all enemies", (UnityAction)obj11); object obj12 = <>c.<>9__6_11; if (obj12 == null) { UnityAction val12 = delegate { SpawnMenu.spawnSwarm(10); }; <>c.<>9__6_11 = val12; obj12 = (object)val12; } menuMod2Menu5.addButton("Spawn swarm x10", (UnityAction)obj12); object obj13 = <>c.<>9__6_12; if (obj13 == null) { UnityAction val13 = delegate { SpawnMenu.spawnSwarm(25); }; <>c.<>9__6_12 = val13; obj13 = (object)val13; } menuMod2Menu5.addButton("Spawn swarm x25", (UnityAction)obj13); object obj14 = <>c.<>9__6_13; if (obj14 == null) { UnityAction val14 = delegate { makeEnemiesFlee(); }; <>c.<>9__6_13 = val14; obj14 = (object)val14; } menuMod2Menu5.addButton("Make enemies flee", (UnityAction)obj14); object obj15 = <>c.<>9__6_14; if (obj15 == null) { UnityAction val15 = delegate { stopEnemiesFleeing(); }; <>c.<>9__6_14 = val15; obj15 = (object)val15; } menuMod2Menu5.addButton("Stop enemies fleeing", (UnityAction)obj15); object obj16 = <>c.<>9__6_15; if (obj16 == null) { UnityAction val16 = delegate { setEnemyIntensity(0f); }; <>c.<>9__6_15 = val16; obj16 = (object)val16; } menuMod2Menu5.addButton("Calm enemy intensity", (UnityAction)obj16); object obj17 = <>c.<>9__6_16; if (obj17 == null) { UnityAction val17 = delegate { setEnemyIntensity(1f); }; <>c.<>9__6_16 = val17; obj17 = (object)val17; } menuMod2Menu5.addButton("Max enemy intensity", (UnityAction)obj17); object obj18 = <>c.<>9__6_17; if (obj18 == null) { UnityAction val18 = delegate { cleanUpParts(); }; <>c.<>9__6_17 = val18; obj18 = (object)val18; } menuMod2Menu5.addButton("Clean up parts", (UnityAction)obj18); object obj19 = <>c.<>9__6_18; if (obj19 == null) { UnityAction val19 = delegate { cleanUpCollectables(); }; <>c.<>9__6_18 = val19; obj19 = (object)val19; } menuMod2Menu5.addButton("Clean up collectables", (UnityAction)obj19); MenuMod2Menu menuMod2Menu6 = new MenuMod2Menu("Loot", menuMod2Menu); MM2Button button4 = null; button4 = menuMod2Menu6.addButton("Infinite resources", (UnityAction)delegate { toggleInfiniteResources(button4); }).changeSuffix(" OFF").changeColour(MenuStyle.Danger); object obj20 = <>c.<>9__6_19; if (obj20 == null) { UnityAction val20 = delegate { giveAllResources(); }; <>c.<>9__6_19 = val20; obj20 = (object)val20; } menuMod2Menu6.addButton("Give max resources", (UnityAction)obj20); object obj21 = <>c.<>9__6_20; if (obj21 == null) { UnityAction val21 = delegate { clearLostLootUpgrades(); }; <>c.<>9__6_20 = val21; obj21 = (object)val21; } menuMod2Menu6.addButton("Clear lost loot upgrades", (UnityAction)obj21); object obj22 = <>c.<>9__6_21; if (obj22 == null) { UnityAction val22 = delegate { SpawnMenu.spawnObject("SaxitosBag"); }; <>c.<>9__6_21 = val22; obj22 = (object)val22; } menuMod2Menu6.addButton("Spawn Saxitos", (UnityAction)obj22); object obj23 = <>c.<>9__6_22; if (obj23 == null) { UnityAction val23 = delegate { SpawnMenu.spawnObject("HoldableBarrel"); }; <>c.<>9__6_22 = val23; obj23 = (object)val23; } menuMod2Menu6.addButton("Spawn barrel", (UnityAction)obj23); object obj24 = <>c.<>9__6_23; if (obj24 == null) { UnityAction val24 = delegate { SpawnMenu.spawnObject("MilkJug"); }; <>c.<>9__6_23 = val24; obj24 = (object)val24; } menuMod2Menu6.addButton("Spawn milk", (UnityAction)obj24); MM2Button button3 = null; button3 = menuMod2Menu.addButton("Godmode", (UnityAction)delegate { toggleGod(button3); }).changeSuffix(" OFF").changeColour(MenuStyle.Danger); MM2Button button2 = null; button2 = menuMod2Menu.addButton("Super sprint", (UnityAction)delegate { toggleSprintFast(button2); }).changeSuffix(" OFF").changeColour(MenuStyle.Danger); MM2Button button = null; button = menuMod2Menu.addButton("Super jump", (UnityAction)delegate { toggleSuperJump(button); }).changeSuffix(" OFF").changeColour(MenuStyle.Danger); object obj25 = <>c.<>9__6_24; if (obj25 == null) { UnityAction val25 = delegate { ProgressionMenu.unlockEverything(); }; <>c.<>9__6_24 = val25; obj25 = (object)val25; } menuMod2Menu.addButton("Unlock everything", (UnityAction)obj25); } public static void toggleGod(MM2Button button = null) { try { if (SparrohPlugin.god) { Player.LocalPlayer.SetMaxHealth(37.5f); typeof(Player).GetMethod("SetHealth_Client", BindingFlags.Instance | BindingFlags.NonPublic)?.Invoke(Player.LocalPlayer, new object[1] { 37.5f }); typeof(Player).GetMethod("SetHealth_Owner", BindingFlags.Instance | BindingFlags.NonPublic)?.Invoke(Player.LocalPlayer, new object[1] { 37.5f }); SparrohPlugin.god = false; } else { Player.LocalPlayer.SetMaxHealth(999999f); typeof(Player).GetMethod("SetHealth_Client", BindingFlags.Instance | BindingFlags.NonPublic)?.Invoke(Player.LocalPlayer, new object[1] { 999999f }); typeof(Player).GetMethod("SetHealth_Owner", BindingFlags.Instance | BindingFlags.NonPublic)?.Invoke(Player.LocalPlayer, new object[1] { 999999f }); SparrohPlugin.god = true; } if (button != null) { updateToggleButton(button, SparrohPlugin.god); } } catch (Exception ex) { SparrohPlugin.Logger.LogError((object)("Exception in toggleGod: " + ex.Message)); } } public static void toggleSprintFast(MM2Button b = null) { try { if (SparrohPlugin.sprintFast) { Player.LocalPlayer.DefaultMoveSpeed = 10f; SparrohPlugin.sprintFast = false; } else { Player.LocalPlayer.DefaultMoveSpeed = 100f; SparrohPlugin.sprintFast = true; } if (b != null) { updateToggleButton(b, SparrohPlugin.sprintFast); } } catch (Exception ex) { SparrohPlugin.Logger.LogError((object)("Exception in toggleSprintFast: " + ex.Message)); } } public static void toggleSuperJump(MM2Button b = null) { try { if (SparrohPlugin.superJump) { typeof(Player).GetField("jumpSpeed", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(Player.LocalPlayer, 14f); SparrohPlugin.superJump = false; } else { typeof(Player).GetField("jumpSpeed", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(Player.LocalPlayer, 100f); SparrohPlugin.superJump = true; } if (b != null) { updateToggleButton(b, SparrohPlugin.superJump); } } catch (Exception ex) { SparrohPlugin.Logger.LogError((object)("Exception in toggleSuperJump: " + ex.Message)); } } public static void setGod(bool enabled, MM2Button b = null) { if (enabled) { Player.LocalPlayer.SetMaxHealth(999999f); typeof(Player).GetMethod("SetHealth_Client", BindingFlags.Instance | BindingFlags.NonPublic)?.Invoke(Player.LocalPlayer, new object[1] { 999999f }); typeof(Player).GetMethod("SetHealth_Owner", BindingFlags.Instance | BindingFlags.NonPublic)?.Invoke(Player.LocalPlayer, new object[1] { 999999f }); } else { Player.LocalPlayer.SetMaxHealth(37.5f); typeof(Player).GetMethod("SetHealth_Client", BindingFlags.Instance | BindingFlags.NonPublic)?.Invoke(Player.LocalPlayer, new object[1] { 37.5f }); typeof(Player).GetMethod("SetHealth_Owner", BindingFlags.Instance | BindingFlags.NonPublic)?.Invoke(Player.LocalPlayer, new object[1] { 37.5f }); } } public static void setSprintFast(bool enabled, MM2Button b = null) { if (enabled) { Player.LocalPlayer.DefaultMoveSpeed = 100f; } else { Player.LocalPlayer.DefaultMoveSpeed = 10f; } } public static void setSuperJump(bool enabled, MM2Button b = null) { if (enabled) { typeof(Player).GetField("jumpSpeed", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(Player.LocalPlayer, 100f); } else { typeof(Player).GetField("jumpSpeed", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(Player.LocalPlayer, 14f); } } public static void setMovementPreset(float moveSpeed, float jumpSpeed) { try { SparrohPlugin.sprintFast = false; SparrohPlugin.superJump = false; SparrohPlugin.movementPreset = true; SparrohPlugin.moveSpeedOverride = moveSpeed; SparrohPlugin.jumpSpeedOverride = jumpSpeed; applyMovement(moveSpeed, jumpSpeed); } catch (Exception ex) { SparrohPlugin.Logger.LogError((object)("Exception in setMovementPreset: " + ex.Message)); } } public static void resetMovement() { try { SparrohPlugin.sprintFast = false; SparrohPlugin.superJump = false; SparrohPlugin.movementPreset = false; applyMovement(10f, 14f); } catch (Exception ex) { SparrohPlugin.Logger.LogError((object)("Exception in resetMovement: " + ex.Message)); } } public static void applyMovement(float moveSpeed, float jumpSpeed) { if (!((Object)(object)Player.LocalPlayer == (Object)null)) { Player.LocalPlayer.DefaultMoveSpeed = moveSpeed; typeof(Player).GetField("jumpSpeed", BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(Player.LocalPlayer, jumpSpeed); } } public static void enemySpawning(bool enabled, MM2Button b = null) { EnemyManager enemyManager = SparrohPlugin.GetEnemyManager(); if ((Object)(object)enemyManager != (Object)null) { if (enabled) { enemyManager.EnableSpawning(); } else { enemyManager.DisableSpawning(); } } } public static MM2Button toggleSpawning(MM2Button b = null) { try { EnemyManager enemyManager = SparrohPlugin.GetEnemyManager(); if ((Object)(object)enemyManager != (Object)null) { if ((bool)typeof(EnemyManager).GetField("enableAmbientWave", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(enemyManager)) { enemyManager.DisableSpawning(); if (b != null) { updateToggleButton(b, enabled: false); } } else { enemyManager.EnableSpawning(); if (b != null) { updateToggleButton(b, enabled: true); } } } return b; } catch (Exception ex) { SparrohPlugin.Logger.LogError((object)("Exception in toggleSpawning: " + ex.Message)); return b; } } public static void killAllEnemies(MM2Button b = null) { try { EnemyManager enemyManager = SparrohPlugin.GetEnemyManager(); if ((Object)(object)enemyManager != (Object)null) { enemyManager.KillAllEnemies_Server(); } } catch (Exception ex) { SparrohPlugin.Logger.LogError((object)("Exception in killAllEnemies: " + ex.Message)); } } public static void cleanUpParts(MM2Button b = null) { try { foreach (EnemyPart item in Object.FindObjectsOfType().ToList()) { item.Kill((DamageFlags)2); } } catch (Exception ex) { SparrohPlugin.Logger.LogError((object)("Exception in cleanUpParts: " + ex.Message)); } } public static void cleanUpCollectables(MM2Button b = null) { try { foreach (ClientCollectable item in Object.FindObjectsOfType().ToList()) { item.DespawnTrackedObject(); } } catch (Exception ex) { SparrohPlugin.Logger.LogError((object)("Exception in cleanUpCollectables: " + ex.Message)); } } public static void clearLostLootUpgrades(MM2Button b = null) { try { PlayerData.Instance.rentedUpgrades.Clear(); SparrohPlugin.Logger.LogInfo((object)"Cleared all rented upgrades from lost loot machine"); } catch (Exception ex) { SparrohPlugin.Logger.LogError((object)("Exception in clearLostLootUpgrades: " + ex.Message)); } } public static void toggleInfiniteResources(MM2Button b = null) { try { SparrohPlugin.infiniteResources = !SparrohPlugin.infiniteResources; if (SparrohPlugin.infiniteResources) { giveAllResources(); updateToggleButton(b, enabled: true); } else { updateToggleButton(b, enabled: false); } } catch (Exception ex) { SparrohPlugin.Logger.LogError((object)("Exception in toggleInfiniteResources: " + ex.Message)); } } public static void toggleInfiniteAmmo(MM2Button b = null) { try { SparrohPlugin.infiniteAmmo = !SparrohPlugin.infiniteAmmo; if (SparrohPlugin.infiniteAmmo) { refillAmmoNow(); updateToggleButton(b, enabled: true); } else { updateToggleButton(b, enabled: false); } } catch (Exception ex) { SparrohPlugin.Logger.LogError((object)("Exception in toggleInfiniteAmmo: " + ex.Message)); } } public static void toggleNoCooldowns(MM2Button b = null) { try { SparrohPlugin.noCooldowns = !SparrohPlugin.noCooldowns; if (SparrohPlugin.noCooldowns) { refreshCooldownsNow(); updateToggleButton(b, enabled: true); } else { updateToggleButton(b, enabled: false); } } catch (Exception ex) { SparrohPlugin.Logger.LogError((object)("Exception in toggleNoCooldowns: " + ex.Message)); } } public static void refillAmmoNow(MM2Button b = null) { try { Gun[] array = Object.FindObjectsOfType(); foreach (Gun val in array) { val.RemainingAmmo = Mathf.Max(val.RemainingAmmo, 999f); val.StoredAmmo = Mathf.Max(val.StoredAmmo, 999f); gunReloadingProperty?.SetValue(val, false, null); } } catch (Exception ex) { SparrohPlugin.Logger.LogError((object)("Exception in refillAmmoNow: " + ex.Message)); } } public static void refreshCooldownsNow(MM2Button b = null) { try { MonoBehaviour[] array = Object.FindObjectsOfType(); foreach (MonoBehaviour val in array) { if ((Object)(object)val == (Object)null) { continue; } FieldInfo[] cooldownFields = getCooldownFields(((object)val).GetType()); foreach (FieldInfo fieldInfo in cooldownFields) { object value = fieldInfo.GetValue(val); if (value != null) { int num = ((!(cooldownMaxChargesField != null)) ? 1 : ((int)cooldownMaxChargesField.GetValue(value))); if (num <= 0) { num = 1; } cooldownChargeField?.SetValue(value, (float)num); fieldInfo.SetValue(val, value); } } } } catch (Exception ex) { SparrohPlugin.Logger.LogError((object)("Exception in refreshCooldownsNow: " + ex.Message)); } } private static FieldInfo[] getCooldownFields(Type type) { if (cooldownFieldsByType.TryGetValue(type, out var value)) { return value; } List list = new List(); Type type2 = type; while (type2 != null) { list.AddRange(from field in type2.GetFields(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) where field.FieldType == typeof(CooldownData) select field); type2 = type2.BaseType; } FieldInfo[] array = list.ToArray(); cooldownFieldsByType[type] = array; return array; } public static void saveTeleportPosition(MM2Button b = null) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) try { if (!((Object)(object)Player.LocalPlayer == (Object)null)) { savedTeleportPosition = ((Component)Player.LocalPlayer).transform.position; hasSavedTeleportPosition = true; SparrohPlugin.SendTextChatMessageToClient("Saved teleport position."); } } catch (Exception ex) { SparrohPlugin.Logger.LogError((object)("Exception in saveTeleportPosition: " + ex.Message)); } } public static void teleportToSavedPosition(MM2Button b = null) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) try { if (hasSavedTeleportPosition && !((Object)(object)Player.LocalPlayer == (Object)null)) { teleportPlayer(savedTeleportPosition); } } catch (Exception ex) { SparrohPlugin.Logger.LogError((object)("Exception in teleportToSavedPosition: " + ex.Message)); } } public static void teleportToCrosshair(MM2Button b = null) { //IL_004e: 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_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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) try { if (!((Object)(object)Player.LocalPlayer == (Object)null) && !((Object)(object)Player.LocalPlayer.PlayerLook == (Object)null) && !((Object)(object)Player.LocalPlayer.PlayerLook.Camera == (Object)null)) { Transform transform = ((Component)Player.LocalPlayer.PlayerLook.Camera).transform; RaycastHit val = default(RaycastHit); if (Physics.Raycast(transform.position, transform.forward, ref val, 100000f)) { teleportPlayer(((RaycastHit)(ref val)).point + Vector3.up * 1.5f); } else { SparrohPlugin.SendTextChatMessageToClient("No teleport target found."); } } } catch (Exception ex) { SparrohPlugin.Logger.LogError((object)("Exception in teleportToCrosshair: " + ex.Message)); } } private static void teleportPlayer(Vector3 position) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) CharacterController component = ((Component)Player.LocalPlayer).GetComponent(); if ((Object)(object)component != (Object)null) { ((Collider)component).enabled = false; } ((Component)Player.LocalPlayer).transform.position = position; if ((Object)(object)component != (Object)null) { ((Collider)component).enabled = true; } } public static void makeEnemiesFlee(MM2Button b = null) { try { EnemyManager enemyManager = SparrohPlugin.GetEnemyManager(); if (enemyManager != null) { enemyManager.MakeAllEnemiesFlee_Server(1000f, 30f); } } catch (Exception ex) { SparrohPlugin.Logger.LogError((object)("Exception in makeEnemiesFlee: " + ex.Message)); } } public static void stopEnemiesFleeing(MM2Button b = null) { try { EnemyManager enemyManager = SparrohPlugin.GetEnemyManager(); if (enemyManager != null) { enemyManager.StopFlee_Server(); } } catch (Exception ex) { SparrohPlugin.Logger.LogError((object)("Exception in stopEnemiesFleeing: " + ex.Message)); } } public static void setEnemyIntensity(float intensity, MM2Button b = null) { try { EnemyManager enemyManager = SparrohPlugin.GetEnemyManager(); if (enemyManager != null) { enemyManager.SetEnemyIntensity(intensity, false); } } catch (Exception ex) { SparrohPlugin.Logger.LogError((object)("Exception in setEnemyIntensity: " + ex.Message)); } } private static void updateToggleButton(MM2Button button, bool enabled) { //IL_0025: 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) if (button != null) { button.changeSuffix(enabled ? " ON" : " OFF"); button.changeColour(enabled ? MenuStyle.Success : MenuStyle.Danger); } } public static void giveAllResoruces(MM2Button b = null) { giveAllResources(b); } public static void giveAllResources(MM2Button b = null) { try { if (!((Object)(object)Global.Instance == (Object)null) && PlayerData.Instance != null) { PlayerResource[] playerResources = Global.Instance.PlayerResources; foreach (PlayerResource val in playerResources) { PlayerData.Instance.AddResource(val, val.Max, true); } } } catch (Exception ex) { SparrohPlugin.Logger.LogError((object)("Exception in giveAllResources: " + ex.Message)); } } } public static class MenuMod2Manager { public static List allMenus; public static MenuMod2Menu currentMenu; } public class MenuMod2Menu { private const int PanelWidth = 420; private const int PanelHeight = 620; private const int HeaderHeight = 78; private const int FooterHeight = 34; private const int ButtonWidth = 390; private const int ButtonHeight = 34; private const int ButtonSpacing = 2; private const int ContentPadding = 15; public List buttons; public GameObject menuCanvas; public RectTransform contentRoot; public string menuName; public MenuMod2Menu parrentMenu; public MM2Button thisButton; public List subMenus; private bool hasMenuCameraLock; private bool hasMenuRotationLock; private bool hasMenuInputLock; private bool hasMenuFireLock; public MenuMod2Menu(string indetifier, MenuMod2Menu _parrentMenu = null) { //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Expected O, but got Unknown //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Expected O, but got Unknown //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Expected O, but got Unknown //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Expected O, but got Unknown //IL_017b: Unknown result type (might be due to invalid IL or missing references) try { menuName = indetifier; if (MenuMod2Manager.allMenus == null) { MenuMod2Manager.allMenus = new List(); } foreach (MenuMod2Menu allMenu in MenuMod2Manager.allMenus) { if (allMenu.menuName == indetifier) { throw new Exception("Menu with name " + indetifier + " already exists."); } } MenuMod2Manager.allMenus.Add(this); buttons = new List(); menuCanvas = new GameObject("menuCanvas"); Object.DontDestroyOnLoad((Object)(object)menuCanvas); Canvas obj = menuCanvas.AddComponent(); obj.renderMode = (RenderMode)0; obj.sortingOrder = 30000; CanvasScaler obj2 = menuCanvas.AddComponent(); obj2.uiScaleMode = (ScaleMode)1; obj2.referenceResolution = new Vector2(1920f, 1080f); obj2.screenMatchMode = (ScreenMatchMode)0; obj2.matchWidthOrHeight = 0.5f; menuCanvas.AddComponent(); BuildMenuShell(); menuCanvas.SetActive(false); if (_parrentMenu != null) { parrentMenu = _parrentMenu; MenuMod2Menu menuMod2Menu = parrentMenu; if (menuMod2Menu.subMenus == null) { menuMod2Menu.subMenus = new List(); } parrentMenu.subMenus.Add(this); thisButton = parrentMenu.addButton(indetifier, (UnityAction)delegate { Open(); }); addButton("Back", (UnityAction)delegate { parrentMenu.Open(); }).changeColour(MenuStyle.Secondary); } else if (indetifier == "Main Menu") { addButton("Close", (UnityAction)delegate { Close(); }).changeColour(MenuStyle.Danger); parrentMenu = null; } } catch (Exception ex) { SparrohPlugin.Logger.LogError((object)("Exception in MenuMod2Menu constructor: " + ex.Message)); } } private void BuildMenuShell() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: 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_0033: 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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Expected O, but got Unknown //IL_0139: 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_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: 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) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Expected O, but got Unknown //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_0279: 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_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Unknown result type (might be due to invalid IL or missing references) //IL_031f: Unknown result type (might be due to invalid IL or missing references) //IL_0325: Expected O, but got Unknown //IL_034b: Unknown result type (might be due to invalid IL or missing references) //IL_0361: Unknown result type (might be due to invalid IL or missing references) //IL_0377: Unknown result type (might be due to invalid IL or missing references) //IL_038d: Unknown result type (might be due to invalid IL or missing references) //IL_03b1: Unknown result type (might be due to invalid IL or missing references) //IL_03c7: Unknown result type (might be due to invalid IL or missing references) //IL_03ce: Expected O, but got Unknown //IL_03fe: Unknown result type (might be due to invalid IL or missing references) //IL_0418: Unknown result type (might be due to invalid IL or missing references) //IL_0432: Unknown result type (might be due to invalid IL or missing references) //IL_0442: Unknown result type (might be due to invalid IL or missing references) //IL_045c: Unknown result type (might be due to invalid IL or missing references) //IL_04a4: Unknown result type (might be due to invalid IL or missing references) //IL_04ab: Expected O, but got Unknown //IL_04d0: Unknown result type (might be due to invalid IL or missing references) //IL_04e5: Unknown result type (might be due to invalid IL or missing references) //IL_04fa: 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_0519: Unknown result type (might be due to invalid IL or missing references) //IL_052a: 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_054f: Unknown result type (might be due to invalid IL or missing references) //IL_055e: Unknown result type (might be due to invalid IL or missing references) //IL_056d: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("MenuBackdrop"); val.transform.SetParent(menuCanvas.transform, false); RectTransform obj = val.AddComponent(); obj.anchorMin = Vector2.zero; obj.anchorMax = Vector2.one; obj.offsetMin = Vector2.zero; obj.offsetMax = Vector2.zero; ((Graphic)val.AddComponent()).color = new Color(0f, 0f, 0f, 0f); GameObject val2 = new GameObject("MenuPanel"); val2.transform.SetParent(menuCanvas.transform, false); RectTransform obj2 = val2.AddComponent(); obj2.anchorMin = new Vector2(0.08f, 0.5f); obj2.anchorMax = new Vector2(0.08f, 0.5f); obj2.pivot = new Vector2(0f, 0.5f); obj2.sizeDelta = new Vector2(420f, 620f); obj2.anchoredPosition = Vector2.zero; ((Graphic)val2.AddComponent()).color = MenuStyle.Panel; GameObject val3 = new GameObject("Header"); val3.transform.SetParent(val2.transform, false); RectTransform obj3 = val3.AddComponent(); obj3.anchorMin = new Vector2(0f, 1f); obj3.anchorMax = new Vector2(1f, 1f); obj3.pivot = new Vector2(0.5f, 1f); obj3.sizeDelta = new Vector2(0f, 78f); obj3.anchoredPosition = Vector2.zero; ((Graphic)val3.AddComponent()).color = MenuStyle.Header; CreateText(val3.transform, "Brand", "CHEATMENU+", 24, (FontStyle)1, MenuStyle.HeaderText, (TextAnchor)4, new Vector2(0f, -30f), new Vector2(420f, 34f), new Vector2(0.5f, 1f)); CreateText(val3.transform, "Version", "1.5.5", 12, (FontStyle)1, MenuStyle.HeaderSubText, (TextAnchor)4, new Vector2(0f, -58f), new Vector2(420f, 20f), new Vector2(0.5f, 1f)); GameObject val4 = new GameObject("Section"); val4.transform.SetParent(val2.transform, false); RectTransform obj4 = val4.AddComponent(); obj4.anchorMin = new Vector2(0f, 1f); obj4.anchorMax = new Vector2(1f, 1f); obj4.pivot = new Vector2(0.5f, 1f); obj4.sizeDelta = new Vector2(0f, 36f); obj4.anchoredPosition = new Vector2(0f, -78f); ((Graphic)val4.AddComponent()).color = MenuStyle.Section; CreateText(val4.transform, "Title", menuName.ToUpperInvariant(), 16, (FontStyle)1, MenuStyle.Text, (TextAnchor)4, Vector2.zero, new Vector2(420f, 36f), new Vector2(0.5f, 0.5f)); GameObject val5 = new GameObject("Viewport"); val5.transform.SetParent(val2.transform, false); RectTransform val6 = val5.AddComponent(); val6.anchorMin = new Vector2(0f, 0f); val6.anchorMax = new Vector2(1f, 1f); val6.offsetMin = new Vector2(15f, 49f); val6.offsetMax = new Vector2(-15f, -129f); ((Graphic)val5.AddComponent()).color = new Color(0f, 0f, 0f, 0f); val5.AddComponent(); GameObject val7 = new GameObject("Content"); val7.transform.SetParent(val5.transform, false); contentRoot = val7.AddComponent(); contentRoot.anchorMin = new Vector2(0f, 1f); contentRoot.anchorMax = new Vector2(1f, 1f); contentRoot.pivot = new Vector2(0.5f, 1f); contentRoot.anchoredPosition = Vector2.zero; contentRoot.sizeDelta = new Vector2(0f, 0f); ScrollRect obj5 = val2.AddComponent(); obj5.viewport = val6; obj5.content = contentRoot; obj5.horizontal = false; obj5.vertical = true; obj5.movementType = (MovementType)2; obj5.scrollSensitivity = 28f; GameObject val8 = new GameObject("Footer"); val8.transform.SetParent(val2.transform, false); RectTransform obj6 = val8.AddComponent(); obj6.anchorMin = new Vector2(0f, 0f); obj6.anchorMax = new Vector2(1f, 0f); obj6.pivot = new Vector2(0.5f, 0f); obj6.sizeDelta = new Vector2(0f, 34f); obj6.anchoredPosition = Vector2.zero; ((Graphic)val8.AddComponent()).color = MenuStyle.Footer; CreateText(val8.transform, "Hint", "INSERT Open / Close", 12, (FontStyle)1, MenuStyle.MutedText, (TextAnchor)4, Vector2.zero, new Vector2(420f, 34f), new Vector2(0.5f, 0.5f)); } private Text CreateText(Transform parent, string objectName, string value, int fontSize, FontStyle fontStyle, Color color, TextAnchor alignment, Vector2 anchoredPosition, Vector2 size, Vector2 anchor) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(objectName); val.transform.SetParent(parent, false); Text obj = val.AddComponent(); obj.text = value; obj.font = Resources.GetBuiltinResource("Arial.ttf"); obj.fontSize = fontSize; obj.fontStyle = fontStyle; ((Graphic)obj).color = color; obj.alignment = alignment; obj.horizontalOverflow = (HorizontalWrapMode)1; obj.verticalOverflow = (VerticalWrapMode)0; RectTransform component = val.GetComponent(); component.anchorMin = anchor; component.anchorMax = anchor; component.pivot = anchor; component.sizeDelta = size; component.anchoredPosition = anchoredPosition; return obj; } public void Open() { try { SparrohPlugin.Logger.LogDebug((object)("Opening menu: " + (menuName ?? "unkown"))); if (MenuMod2Manager.currentMenu != null && MenuMod2Manager.currentMenu != this) { MenuMod2Manager.currentMenu.Close(); } MenuMod2Manager.currentMenu = this; menuCanvas.SetActive(true); AcquireMenuInputLock(); Cursor.visible = true; Cursor.lockState = (CursorLockMode)0; foreach (MM2Button button in buttons) { button.show(); } } catch (Exception ex) { SparrohPlugin.Logger.LogError((object)("Exception in Open(): " + ex.Message)); } } public void Close() { try { if (MenuMod2Manager.currentMenu != this) { SparrohPlugin.Logger.LogWarning((object)("Attempted to close menu \"" + menuName + "\" that wasn't open. This should not happen")); return; } SparrohPlugin.Logger.LogDebug((object)("Closing menu: " + menuName)); MenuMod2Manager.currentMenu = null; ReleaseMenuInputLock(); foreach (MM2Button button in buttons) { button.hide(); } menuCanvas.SetActive(false); } catch (Exception ex) { SparrohPlugin.Logger.LogError((object)("Exception in Close(): " + ex.Message)); } } private void AcquireMenuCameraLock() { try { if (!hasMenuCameraLock && !((Object)(object)Player.LocalPlayer == (Object)null) && !((Object)(object)Player.LocalPlayer.PlayerLook == (Object)null)) { PlayerLook playerLook = Player.LocalPlayer.PlayerLook; playerLook.EnableMenuCamera += 1; hasMenuCameraLock = true; } } catch (Exception ex) { SparrohPlugin.Logger.LogError((object)("Exception in AcquireMenuCameraLock(): " + ex.Message)); } } private void AcquireMenuInputLock() { try { if (!hasMenuInputLock) { PlayerInput.EnableMenu(); hasMenuInputLock = true; } if (!hasMenuRotationLock && !((Object)(object)Player.LocalPlayer == (Object)null) && !((Object)(object)Player.LocalPlayer.PlayerLook == (Object)null)) { PlayerLook playerLook = Player.LocalPlayer.PlayerLook; playerLook.RotationLocksX += 1; PlayerLook playerLook2 = Player.LocalPlayer.PlayerLook; playerLook2.RotationLocksY += 1; Player.LocalPlayer.LockFiring(true); hasMenuRotationLock = true; hasMenuFireLock = true; } } catch (Exception ex) { SparrohPlugin.Logger.LogError((object)("Exception in AcquireMenuInputLock(): " + ex.Message)); } } private void ReleaseMenuInputLock() { try { if (hasMenuRotationLock && (Object)(object)Player.LocalPlayer != (Object)null && (Object)(object)Player.LocalPlayer.PlayerLook != (Object)null) { Player.LocalPlayer.PlayerLook.RotationLocksX = Math.Max(0, Player.LocalPlayer.PlayerLook.RotationLocksX - 1); Player.LocalPlayer.PlayerLook.RotationLocksY = Math.Max(0, Player.LocalPlayer.PlayerLook.RotationLocksY - 1); } if (hasMenuFireLock && (Object)(object)Player.LocalPlayer != (Object)null) { Player.LocalPlayer.LockFiring(false); } hasMenuRotationLock = false; hasMenuFireLock = false; if (hasMenuInputLock) { PlayerInput.DisableMenu(); } hasMenuInputLock = false; } catch (Exception ex) { hasMenuInputLock = false; hasMenuRotationLock = false; hasMenuFireLock = false; SparrohPlugin.Logger.LogError((object)("Exception in ReleaseMenuInputLock(): " + ex.Message)); } } private void ReleaseMenuCameraLock() { try { if (!hasMenuCameraLock || (Object)(object)Player.LocalPlayer == (Object)null || (Object)(object)Player.LocalPlayer.PlayerLook == (Object)null) { hasMenuCameraLock = false; return; } Player.LocalPlayer.PlayerLook.EnableMenuCamera = Math.Max(0, Player.LocalPlayer.PlayerLook.EnableMenuCamera - 1); hasMenuCameraLock = false; if (Player.LocalPlayer.PlayerLook.EnableMenuCamera == 0) { Cursor.visible = false; Cursor.lockState = (CursorLockMode)1; } } catch (Exception ex) { SparrohPlugin.Logger.LogError((object)("Exception in ReleaseMenuCameraLock(): " + ex.Message)); } } public MenuMod2Menu hasMenu(string menuName) { if (this.menuName == menuName) { return this; } if (subMenus != null) { foreach (MenuMod2Menu subMenu in subMenus) { if (subMenu.menuName == menuName) { return subMenu; } } } return null; } public MM2Button addButtonBackup(string text, UnityAction callback) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) MM2Button mM2Button = new MM2Button(this, new Vector2(0f, 0f), text, callback, ((Component)contentRoot).gameObject); buttons.Add(mM2Button); arrangeButtons(); return mM2Button; } public MM2Button addButton(string text, UnityAction callback) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) MM2Button mM2Button = new MM2Button(this, new Vector2(0f, 0f), text, null, ((Component)contentRoot).gameObject); mM2Button.createButton(); mM2Button.SetCallback(callback); buttons.Add(mM2Button); arrangeButtons(); return mM2Button; } public MM2Button addInput(string text, string defaultValue) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) MM2Button mM2Button = new MM2Button(this, new Vector2(0f, 0f), text, null, ((Component)contentRoot).gameObject); mM2Button.createInput(defaultValue); buttons.Add(mM2Button); arrangeButtons(); return mM2Button; } public void destroy() { try { foreach (MenuMod2Menu item in new List(MenuMod2Manager.allMenus)) { if (item.menuName == menuName) { MenuMod2Manager.allMenus.Remove(item); } } if (MenuMod2Manager.currentMenu == this) { MM2Button mM2Button = buttons.FirstOrDefault((MM2Button b) => b.name == "back"); if (mM2Button == null) { Close(); } else { ((UnityEvent)mM2Button.button.onClick).Invoke(); } } foreach (MM2Button item2 in new List(parrentMenu?.buttons ?? new List())) { if (item2.name == thisButton.name) { parrentMenu.buttons.Remove(item2); } } foreach (MM2Button item3 in new List(buttons)) { Object.Destroy((Object)(object)item3.buttonObj); buttons.Remove(item3); } foreach (MenuMod2Menu item4 in subMenus ?? new List()) { item4.destroy(); } Object.Destroy((Object)(object)menuCanvas); } catch (Exception ex) { SparrohPlugin.Logger.LogError((object)("Exception in destroy(): " + ex.Message)); } } public bool removeButton(string buttonName) { try { MM2Button mM2Button = buttons.FirstOrDefault((MM2Button b) => b.name == buttonName); if (mM2Button != null) { buttons.Remove(mM2Button); Object.Destroy((Object)(object)mM2Button.buttonObj); arrangeButtons(); return true; } return false; } catch (Exception ex) { SparrohPlugin.Logger.LogError((object)("Exception in removeButton(): " + ex.Message)); return false; } } public void arrangeButtons() { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) try { if (!((Object)(object)contentRoot == (Object)null)) { int num = 1; float num2 = 36f; float num3 = num * 390 + (num - 1) * 2; int num4 = Mathf.CeilToInt((float)buttons.Count / (float)num); float num5 = Mathf.Max(0f, (float)num4 * num2 - 2f); contentRoot.sizeDelta = new Vector2(0f, num5); for (int i = 0; i < buttons.Count; i++) { int num6 = i % num; int num7 = i / num; float num8 = (0f - num3) / 2f + 195f + (float)(num6 * 392); float num9 = -17f - (float)num7 * num2; buttons[i].move(new Vector2(num8, num9)); } } } catch (Exception ex) { SparrohPlugin.Logger.LogError((object)("Exception in arrangeButtons(): " + ex.Message)); } } } public static class MenuStyle { public static readonly Color Panel = new Color(0.015f, 0.015f, 0.018f, 0.86f); public static readonly Color Header = new Color(0.12f, 0.44f, 0.95f, 0.98f); public static readonly Color Section = new Color(0.02f, 0.02f, 0.024f, 0.92f); public static readonly Color Footer = new Color(0.02f, 0.02f, 0.024f, 0.94f); public static readonly Color Button = new Color(0.03f, 0.03f, 0.036f, 0.76f); public static readonly Color ButtonHover = new Color(0.12f, 0.44f, 0.95f, 0.92f); public static readonly Color Accent = new Color(0.12f, 0.44f, 0.95f, 1f); public static readonly Color Secondary = new Color(0.08f, 0.08f, 0.09f, 0.92f); public static readonly Color Success = new Color(0.05f, 0.38f, 0.18f, 0.92f); public static readonly Color Danger = new Color(0.5f, 0.08f, 0.08f, 0.92f); public static readonly Color HeaderText = new Color(1f, 1f, 1f, 1f); public static readonly Color HeaderSubText = new Color(0.82f, 0.9f, 1f, 1f); public static readonly Color Text = new Color(0.94f, 0.96f, 0.96f, 1f); public static readonly Color MutedText = new Color(0.62f, 0.66f, 0.7f, 1f); } public class MM2Button { public GameObject buttonObj; public MenuMod2Menu menu; public string name; public string prefix; public string suffix; public GameObject canvas; public Vector2 pos; public Button button; public InputField inputField; public MM2Button(MenuMod2Menu _menu, Vector2 screenPos, string text, UnityAction callback, GameObject menuCanvas) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) menu = _menu; name = text; pos = screenPos; canvas = menuCanvas; prefix = string.Empty; suffix = string.Empty; } public MM2Button createButton() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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_00a3: 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_00d5: 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_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: 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_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: 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_01df: 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) buttonObj = new GameObject("MenuButton"); buttonObj.transform.SetParent(canvas.transform, false); RectTransform obj = buttonObj.AddComponent(); obj.anchorMin = new Vector2(0.5f, 1f); obj.anchorMax = new Vector2(0.5f, 1f); obj.pivot = new Vector2(0.5f, 0.5f); obj.sizeDelta = new Vector2(390f, 34f); obj.anchoredPosition = pos; Image val = buttonObj.AddComponent(); ((Graphic)val).color = MenuStyle.Button; button = buttonObj.AddComponent