Decompiled source of Cheat Menu v1.0.0
plugins/PigfaceCheatMenu.dll
Decompiled 2 days ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Rewired; using Rewired.Glyphs; using Rewired.Glyphs.UnityUI; using Rewired.UI; using Rewired.UI.ControlMapper; using TMPro; using UnityEngine; using UnityEngine.Audio; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.Rendering; using UnityEngine.Rendering.Universal; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: AssemblyTitle("PigfaceCheatMenu")] [assembly: AssemblyDescription("Pause-menu cheats and resource editor for PIGFACE (BepInEx 5).")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyVersion("1.0.0.0")] [BepInPlugin("bradg.pigface.cheatmenu", "PigfaceCheatMenu", "1.0.0")] public sealed class PigfaceCheatMenuPlugin : BaseUnityPlugin { internal static bool UnlimitedAmmoEnabled; internal static bool UnlimitedItemsEnabled; internal static bool GodModeEnabled; internal static bool ExplosiveAmmoEnabled; internal static bool NoRecoilEnabled; internal static bool BigHeadEnabled; internal static bool HighlightEnemiesEnabled; internal static bool HighlightObjectivesEnabled; internal static float FireRateMultiplier = 1f; internal static float KickMultiplier = 1f; internal static float DamageMultiplier = 1f; internal static ManualLogSource PluginLog; private Harmony harmony; internal static ConfigEntry<KeyCode> BulletTimeKey; private void Awake() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown PluginLog = ((BaseUnityPlugin)this).Logger; CheatSettings.Load(); harmony = new Harmony("bradg.pigface.cheatmenu"); harmony.PatchAll(Assembly.GetExecutingAssembly()); SceneManager.sceneLoaded += SceneLoaded; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded. Open Pause > Cheats for toggles and adjustable fire rate, kick strength, jump and movement sliders."); } private void Update() { if ((Object)(object)PlayerInput.Instance != (Object)null && PlayerInput.Instance._playerEnabled && (Object)(object)PlayerHealth.Instance != (Object)null && !PlayerHealth.Instance._playerIsDead && Time.timeScale > 0f) { if (CheatBindings.Pressed() && (Object)(object)TimeManager.Instance != (Object)null) { BulletTimeControl.Toggle(); } if (CheatBindings.Pressed(1)) { NoclipControl.Toggle(); } } NoclipControl.Tick(); } private void LateUpdate() { BulletTimeControl.Tick(); ExplosiveAmmoControl.Tick(); HighlightControl.Tick(); BigHeadControl.Tick(); } private void SceneLoaded(Scene scene, LoadSceneMode mode) { NoclipControl.Reset(); BulletTimeControl.Reset(); ExplosiveAmmoControl.Reset(); AmmoCounterDisplay.Reset(); HighlightControl.Reset(); BigHeadControl.Reset(); } private void OnDestroy() { SceneManager.sceneLoaded -= SceneLoaded; NoclipControl.Reset(); BulletTimeControl.Reset(); ExplosiveAmmoControl.Reset(); AmmoCounterDisplay.Reset(); HighlightControl.Reset(); BigHeadControl.Reset(); if (harmony != null) { harmony.UnpatchSelf(); } } internal static void ToggleHighlight(bool objectives) { if (objectives) { HighlightObjectivesEnabled = !HighlightObjectivesEnabled; } else { HighlightEnemiesEnabled = !HighlightEnemiesEnabled; } HighlightControl.Refresh(); CheatSettings.Save(); } internal static void ToggleItems() { UnlimitedItemsEnabled = !UnlimitedItemsEnabled; CheatSettings.Save(); PluginLog.LogInfo((object)("Unlimited items " + (UnlimitedItemsEnabled ? "enabled" : "disabled") + ".")); } internal static void ToggleAmmo() { UnlimitedAmmoEnabled = !UnlimitedAmmoEnabled; CheatSettings.Save(); PluginLog.LogInfo((object)("Unlimited ammo " + (UnlimitedAmmoEnabled ? "enabled" : "disabled") + ".")); } internal static void ToggleGodMode() { GodModeEnabled = !GodModeEnabled; CheatSettings.Save(); PluginLog.LogInfo((object)("Godmode " + (GodModeEnabled ? "enabled" : "disabled") + ".")); } internal static void ToggleExplosiveAmmo() { ExplosiveAmmoEnabled = !ExplosiveAmmoEnabled; CheatSettings.Save(); PluginLog.LogInfo((object)("Explosive ammo " + (ExplosiveAmmoEnabled ? "enabled" : "disabled") + ".")); } internal static void ToggleNoRecoil() { NoRecoilEnabled = !NoRecoilEnabled; CheatSettings.Save(); PluginLog.LogInfo((object)("No recoil " + (NoRecoilEnabled ? "enabled" : "disabled") + ".")); } internal static void ToggleBigHead() { BigHeadEnabled = !BigHeadEnabled; if (!BigHeadEnabled) { BigHeadControl.Reset(); } CheatSettings.Save(); } } public static class CheatSettings { internal const float MinimumMultiplier = 1f; internal const float MaximumMultiplier = 5f; internal const float MultiplierStep = 0.5f; private static ConfigFile file; private static ConfigFile legacy; private static bool saved; private static ConfigEntry<bool> god; private static ConfigEntry<bool> ammo; private static ConfigEntry<bool> items; private static ConfigEntry<bool> explosive; private static ConfigEntry<bool> noRecoil; private static ConfigEntry<bool> bigHead; private static ConfigEntry<bool> highlightEnemies; private static ConfigEntry<bool> highlightObjectives; private static ConfigEntry<int> bulletTimeSpeed; private static ConfigEntry<float> speed; private static ConfigEntry<float> jump; private static ConfigEntry<float> kick; private static ConfigEntry<float> fire; private static ConfigEntry<float> damage; internal static void Load() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown string text = Path.Combine(Paths.ConfigPath, "PigfaceCheatMenu.ini"); file = new ConfigFile(text, false); file.SaveOnConfigSet = false; string text2 = Path.Combine(Paths.ConfigPath, "bradg.pigface.cheatmenu.cfg"); if (File.Exists(text2)) { legacy = new ConfigFile(text2, false); legacy.SaveOnConfigSet = false; } god = file.Bind<bool>("Cheats", "Godmode", false, (ConfigDescription)null); ammo = file.Bind<bool>("Cheats", "UnlimitedAmmo", false, (ConfigDescription)null); items = file.Bind<bool>("Cheats", "UnlimitedItems", false, (ConfigDescription)null); explosive = file.Bind<bool>("Cheats", "ExplosiveAmmo", false, (ConfigDescription)null); noRecoil = file.Bind<bool>("Cheats", "NoRecoil", false, (ConfigDescription)null); PigfaceCheatMenuPlugin.NoRecoilEnabled = noRecoil.Value; bigHead = file.Bind<bool>("Cheats", "BigHead", false, (ConfigDescription)null); PigfaceCheatMenuPlugin.BigHeadEnabled = bigHead.Value; bulletTimeSpeed = file.Bind<int>("BulletTime", "SpeedPercent", 65, new ConfigDescription("World speed while Bullet Time is enabled, as a percentage.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(10, 90), new object[0])); BulletTimeControl.SpeedPercent = Mathf.Clamp(bulletTimeSpeed.Value, 10, 90); highlightEnemies = file.Bind<bool>("Cheats", "HighlightAllEnemies", false, (ConfigDescription)null); highlightObjectives = file.Bind<bool>("Cheats", "HighlightAllObjectives", false, (ConfigDescription)null); PigfaceCheatMenuPlugin.HighlightEnemiesEnabled = highlightEnemies.Value; PigfaceCheatMenuPlugin.HighlightObjectivesEnabled = highlightObjectives.Value; speed = file.Bind<float>("Multipliers", "MovementSpeed", 1f, (ConfigDescription)null); jump = file.Bind<float>("Multipliers", "JumpHeight", 1f, (ConfigDescription)null); kick = file.Bind<float>("Multipliers", "KickStrength", 1f, (ConfigDescription)null); fire = file.Bind<float>("Multipliers", "FireRate", 1f, (ConfigDescription)null); damage = file.Bind<float>("Multipliers", "Damage", 1f, (ConfigDescription)null); PigfaceCheatMenuPlugin.GodModeEnabled = god.Value; PigfaceCheatMenuPlugin.UnlimitedAmmoEnabled = ammo.Value; PigfaceCheatMenuPlugin.UnlimitedItemsEnabled = items.Value; PigfaceCheatMenuPlugin.ExplosiveAmmoEnabled = explosive.Value; MovementCheats.SpeedMultiplier = Normalize(speed.Value); MovementCheats.JumpMultiplier = Normalize(jump.Value); PigfaceCheatMenuPlugin.KickMultiplier = Normalize(kick.Value); PigfaceCheatMenuPlugin.FireRateMultiplier = Normalize(fire.Value); PigfaceCheatMenuPlugin.DamageMultiplier = Normalize(damage.Value); PigfaceCheatMenuPlugin.BulletTimeKey = BindHotkey<KeyCode>("BulletTime", "SlowTime", (KeyCode)120); CheatBindings.Initialize(); Save(); if (saved && legacy != null) { try { string text3 = Path.Combine(Paths.ConfigPath, "PigfaceCheatMenu-backups"); Directory.CreateDirectory(text3); string text4 = Path.Combine(text3, "bradg.pigface.cheatmenu-" + DateTime.UtcNow.ToString("yyyyMMdd-HHmmss-fffffff") + ".cfg.bak"); File.Move(text2, text4); PigfaceCheatMenuPlugin.PluginLog.LogInfo((object)("Imported legacy hotkeys; original file backed up to " + text4)); legacy = null; } catch (Exception ex) { PigfaceCheatMenuPlugin.PluginLog.LogWarning((object)("Settings migrated, but old config could not be archived: " + ex.Message)); } } PigfaceCheatMenuPlugin.PluginLog.LogInfo((object)("Loaded cheat settings from " + text)); } internal static ConfigEntry<T> BindHotkey<T>(string key, string oldKey, T fallback) { if (legacy != null) { fallback = legacy.Bind<T>("Hotkeys", oldKey, fallback, (ConfigDescription)null).Value; } return file.Bind<T>("Hotkeys", key, fallback, (ConfigDescription)null); } private static float Normalize(float value) { if (float.IsNaN(value) || float.IsInfinity(value)) { return 1f; } return Mathf.Round(Mathf.Clamp(value, 1f, 5f) / 0.5f) * 0.5f; } internal static void Save() { if (file == null) { return; } god.Value = PigfaceCheatMenuPlugin.GodModeEnabled; ammo.Value = PigfaceCheatMenuPlugin.UnlimitedAmmoEnabled; items.Value = PigfaceCheatMenuPlugin.UnlimitedItemsEnabled; explosive.Value = PigfaceCheatMenuPlugin.ExplosiveAmmoEnabled; noRecoil.Value = PigfaceCheatMenuPlugin.NoRecoilEnabled; bigHead.Value = PigfaceCheatMenuPlugin.BigHeadEnabled; bulletTimeSpeed.Value = BulletTimeControl.SpeedPercent; highlightEnemies.Value = PigfaceCheatMenuPlugin.HighlightEnemiesEnabled; highlightObjectives.Value = PigfaceCheatMenuPlugin.HighlightObjectivesEnabled; speed.Value = MovementCheats.SpeedMultiplier; jump.Value = MovementCheats.JumpMultiplier; kick.Value = PigfaceCheatMenuPlugin.KickMultiplier; fire.Value = PigfaceCheatMenuPlugin.FireRateMultiplier; damage.Value = PigfaceCheatMenuPlugin.DamageMultiplier; saved = false; try { file.Save(); saved = true; } catch (Exception ex) { PigfaceCheatMenuPlugin.PluginLog.LogError((object)("Could not save cheat settings: " + ex.Message)); } } } public static class BigHeadControl { private sealed class Head { internal EntityManager entity; internal Vector3 scale; } private static readonly Dictionary<Transform, Head> heads = new Dictionary<Transform, Head>(); private static float nextScan; internal static void Tick() { //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: 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_0108: Unknown result type (might be due to invalid IL or missing references) if (!PigfaceCheatMenuPlugin.BigHeadEnabled) { return; } if (Time.unscaledTime >= nextScan) { nextScan = Time.unscaledTime + 0.5f; EntityManager[] array = Object.FindObjectsOfType<EntityManager>(); foreach (EntityManager val in array) { if (val._entityIsDead || val._entityIsGibbed) { continue; } Transform val2 = null; if ((Object)(object)val._headLookAtConstraint != (Object)null) { Transform transform = ((Component)val._headLookAtConstraint).transform; SkinnedMeshRenderer[] componentsInChildren = ((Component)val).GetComponentsInChildren<SkinnedMeshRenderer>(true); foreach (SkinnedMeshRenderer val3 in componentsInChildren) { if (Array.IndexOf(val3.bones, transform) >= 0) { val2 = transform; break; } } } if ((Object)(object)val2 == (Object)null && (Object)(object)val._entityAnimator != (Object)null && val._entityAnimator.isHuman) { val2 = val._entityAnimator.GetBoneTransform((HumanBodyBones)10); } if ((Object)(object)val2 != (Object)null && !heads.ContainsKey(val2)) { heads.Add(val2, new Head { entity = val, scale = val2.localScale }); } } } List<Transform> list = null; foreach (KeyValuePair<Transform, Head> head in heads) { if ((Object)(object)head.Key == (Object)null || (Object)(object)head.Value.entity == (Object)null || head.Value.entity._entityIsDead || head.Value.entity._entityIsGibbed) { if ((Object)(object)head.Key != (Object)null) { head.Key.localScale = head.Value.scale; } if (list == null) { list = new List<Transform>(); } list.Add(head.Key); } else { head.Key.localScale = head.Value.scale * 3f; } } if (list == null) { return; } foreach (Transform item in list) { heads.Remove(item); } } internal static void Reset() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) foreach (KeyValuePair<Transform, Head> head in heads) { if ((Object)(object)head.Key != (Object)null) { head.Key.localScale = head.Value.scale; } } heads.Clear(); nextScan = 0f; } } public static class NoRecoilControl { public static void Fire(Recoil recoil, float pitch, float yaw, float roll) { if (!PigfaceCheatMenuPlugin.NoRecoilEnabled) { recoil.RecoilFire(pitch, yaw, roll); } } } [HarmonyPatch] internal static class NoRecoilShotPatch { private static IEnumerable<MethodBase> TargetMethods() { yield return AccessTools.Method(typeof(Gun), "OnGunShot", new Type[0], (Type[])null); yield return AccessTools.Method(typeof(GrenadeLauncher), "ShootGrenade", new Type[0], (Type[])null); } private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions, MethodBase __originalMethod) { MethodInfo native = AccessTools.Method(typeof(Recoil), "RecoilFire", new Type[3] { typeof(float), typeof(float), typeof(float) }, (Type[])null); MethodInfo replacement = AccessTools.Method(typeof(NoRecoilControl), "Fire", (Type[])null, (Type[])null); int matches = 0; foreach (CodeInstruction instruction in instructions) { if (CodeInstructionExtensions.Calls(instruction, native)) { instruction.opcode = OpCodes.Call; instruction.operand = replacement; matches++; } yield return instruction; } if (matches != 1) { throw new InvalidOperationException(string.Concat(__originalMethod, ": expected one verified RecoilFire call, found ", matches)); } } } public static class ExplosiveAmmoControl { private const float Radius = 3f; private const float Damage = 75f; private static readonly List<Vector3> pending = new List<Vector3>(); private static readonly HashSet<int> gunsThisFrame = new HashSet<int>(); private static int shotFrame = -1; private static GameObject explosionFx; private static bool searchedFx; private static readonly FieldInfo explosionPrefabField = AccessTools.Field(typeof(NailBombInstance), "explosionPrefab"); private static readonly MethodInfo detectionMethod = AccessTools.Method(typeof(Gun).Assembly.GetType("SoundDetection", throwOnError: true), "RotateEntitiesTowardsSoundExpensive", new Type[4] { typeof(Vector3), typeof(float), typeof(bool), typeof(bool) }, (Type[])null); internal static void Reset() { pending.Clear(); gunsThisFrame.Clear(); shotFrame = -1; explosionFx = null; searchedFx = false; } internal static void Hit(Gun gun, RaycastHit hit) { //IL_0050: 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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) if (PigfaceCheatMenuPlugin.ExplosiveAmmoEnabled && !((Object)(object)((RaycastHit)(ref hit)).collider == (Object)null)) { if (shotFrame != Time.frameCount) { gunsThisFrame.Clear(); shotFrame = Time.frameCount; } if (gunsThisFrame.Add(((Object)gun).GetInstanceID())) { pending.Add(((RaycastHit)(ref hit)).point + ((RaycastHit)(ref hit)).normal * 0.1f); } } } public static void MarkBolt(GameObject projectile) { if (PigfaceCheatMenuPlugin.ExplosiveAmmoEnabled && (Object)(object)projectile.GetComponent<CrossbowBolt>() != (Object)null) { projectile.AddComponent<ExplosiveBoltMarker>(); } } internal static void BoltHit(CrossbowBolt bolt) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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_004c: Unknown result type (might be due to invalid IL or missing references) ExplosiveBoltMarker component = ((Component)bolt).GetComponent<ExplosiveBoltMarker>(); if (!((Object)(object)component == (Object)null) && !component.detonated && PigfaceCheatMenuPlugin.ExplosiveAmmoEnabled) { component.detonated = true; pending.Add(((Component)bolt).transform.position - ((Component)bolt).transform.forward * 0.1f); } } internal static void Tick() { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) if (pending.Count == 0) { return; } Vector3[] array = pending.ToArray(); pending.Clear(); if (!PigfaceCheatMenuPlugin.ExplosiveAmmoEnabled || (Object)(object)PlayerMovement.Instance == (Object)null) { return; } Vector3[] array2 = array; foreach (Vector3 point in array2) { try { Blast(point); } catch (Exception ex) { PigfaceCheatMenuPlugin.PluginLog.LogError((object)("Explosive ammo impact failed: " + ex)); } } } private static bool Visible(Vector3 point, Vector3 target, Component recipient) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) Vector3 val = target - point; if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { return true; } RaycastHit val2 = default(RaycastHit); if (!Physics.Raycast(point, ((Vector3)(ref val)).normalized, ref val2, ((Vector3)(ref val)).magnitude, -1, (QueryTriggerInteraction)1)) { return true; } Transform transform = ((RaycastHit)(ref val2)).transform; if ((Object)(object)transform == (Object)(object)recipient.transform || transform.IsChildOf(recipient.transform) || recipient.transform.IsChildOf(transform)) { return true; } EntityHealth val3 = (EntityHealth)(object)((recipient is EntityHealth) ? recipient : null); if ((Object)(object)val3 != (Object)null) { EntityManager componentInParent = ((Component)transform).GetComponentInParent<EntityManager>(); Hitbox component = ((Component)transform).GetComponent<Hitbox>(); if (!((Object)(object)componentInParent != (Object)null) || !((Object)(object)componentInParent._entityHealth == (Object)(object)val3)) { if ((Object)(object)component != (Object)null && (Object)(object)((AbstractEntityManager)component)._entityManager != (Object)null) { return (Object)(object)((AbstractEntityManager)component)._entityManager._entityHealth == (Object)(object)val3; } return false; } return true; } return false; } private static void Blast(Vector3 point) { //IL_0000: 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) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_018d: 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_0196: 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_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_009f: 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_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: 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_00ca: 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_00d0: 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_0246: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0332: Unknown result type (might be due to invalid IL or missing references) //IL_0339: Expected O, but got Unknown //IL_0340: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Unknown result type (might be due to invalid IL or missing references) Collider[] array = Physics.OverlapSphere(point, 3f, -1, (QueryTriggerInteraction)1); Dictionary<Component, Vector3> dictionary = new Dictionary<Component, Vector3>(); HashSet<Rigidbody> hashSet = new HashSet<Rigidbody>(); Collider[] array2 = array; foreach (Collider val in array2) { if ((Object)(object)val == (Object)null) { continue; } EntityManager val2 = ((Component)val).GetComponentInParent<EntityManager>(); Hitbox component = ((Component)val).GetComponent<Hitbox>(); if ((Object)(object)val2 == (Object)null && (Object)(object)component != (Object)null) { val2 = ((AbstractEntityManager)component)._entityManager; } Component val3 = (Component)(((Object)(object)val2 != (Object)null) ? ((object)val2._entityHealth) : ((object)/*isinst with value type is only supported in some contexts*/)); Bounds bounds = val.bounds; Vector3 center = ((Bounds)(ref bounds)).center; if ((Object)(object)val3 != (Object)null && Visible(point, center, val3)) { if (dictionary.TryGetValue(val3, out var value)) { Vector3 val4 = center - point; float sqrMagnitude = ((Vector3)(ref val4)).sqrMagnitude; Vector3 val5 = value - point; if (!(sqrMagnitude < ((Vector3)(ref val5)).sqrMagnitude)) { goto IL_00e5; } } dictionary[val3] = center; } goto IL_00e5; IL_00e5: Rigidbody attachedRigidbody = val.attachedRigidbody; if ((Object)(object)val2 == (Object)null && (Object)(object)attachedRigidbody != (Object)null && !attachedRigidbody.isKinematic && (Object)(object)((Component)val).GetComponentInParent<PlayerHealth>() == (Object)null && Visible(point, val.ClosestPoint(point), (Component)(object)attachedRigidbody)) { hashSet.Add(attachedRigidbody); } } foreach (KeyValuePair<Component, Vector3> item in dictionary) { if (!((Object)(object)item.Key == (Object)null)) { float num = Mathf.Clamp01(1f - Vector3.Distance(point, item.Value) / 3f); Vector3 val6 = item.Value - point; Vector3 normalized = ((Vector3)(ref val6)).normalized; ((IDamageable)item.Key).TakeDamage(75f * num, 20f * num, normalized, ((Component)PlayerMovement.Instance).transform, (DamageType)2); } } foreach (Rigidbody item2 in hashSet) { if ((Object)(object)item2 != (Object)null) { item2.AddExplosionForce(20f, point, 3f, 0.2f, (ForceMode)1); } } detectionMethod.Invoke(null, new object[4] { point, 20f, false, false }); if (!searchedFx) { searchedFx = true; NailBombInstance val7 = ((IEnumerable<NailBombInstance>)Resources.FindObjectsOfTypeAll<NailBombInstance>()).FirstOrDefault((Func<NailBombInstance, bool>)delegate(NailBombInstance bomb) { object? value3 = explosionPrefabField.GetValue(bomb); return (Object)((value3 is GameObject) ? value3 : null) != (Object)null; }); if ((Object)(object)val7 != (Object)null) { object? value2 = explosionPrefabField.GetValue(val7); explosionFx = (GameObject)((value2 is GameObject) ? value2 : null); } } if ((Object)(object)explosionFx != (Object)null) { GameObject val8 = Object.Instantiate<GameObject>(explosionFx, point, Quaternion.identity); Transform transform = val8.transform; transform.localScale *= 0.5f; Object.Destroy((Object)(object)val8, 5f); return; } GameObject val9 = new GameObject("PIGFACE Explosive Ammo Flash", new Type[1] { typeof(Light) }); val9.transform.position = point; Light component2 = val9.GetComponent<Light>(); component2.color = new Color(1f, 0.45f, 0.1f); component2.range = 6f; component2.intensity = 3f; Object.Destroy((Object)(object)val9, 0.08f); } } public sealed class ExplosiveBoltMarker : MonoBehaviour { internal bool detonated; } [HarmonyPatch(typeof(Gun), "GunRaycast", new Type[] { typeof(Vector3) })] internal static class ExplosiveAmmoImpactPatch { private static void Prefix(ref RaycastHit ___hitInfo) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) if (PigfaceCheatMenuPlugin.ExplosiveAmmoEnabled) { ___hitInfo = default(RaycastHit); } } private static void Postfix(Gun __instance, RaycastHit ___hitInfo) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) ExplosiveAmmoControl.Hit(__instance, ___hitInfo); } } [HarmonyPatch(typeof(Gun), "SpawnProjectile", new Type[] { typeof(GameObject) })] internal static class ExplosiveAmmoProjectilePatch { private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { List<CodeInstruction> code = new List<CodeInstruction>(instructions); int count = code.Count(delegate(CodeInstruction i) { MethodInfo methodInfo = i.operand as MethodInfo; return methodInfo != null && methodInfo.DeclaringType == typeof(Object) && methodInfo.Name == "Instantiate"; }); if (count != 1) { throw new InvalidOperationException("Gun.SpawnProjectile: expected one verified Instantiate site."); } foreach (CodeInstruction instruction in code) { yield return instruction; MethodInfo method = instruction.operand as MethodInfo; if (method != null && method.DeclaringType == typeof(Object) && method.Name == "Instantiate") { yield return new CodeInstruction(OpCodes.Dup, (object)null); yield return new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(ExplosiveAmmoControl), "MarkBolt", (Type[])null, (Type[])null)); } } } } [HarmonyPatch(typeof(CrossbowBolt), "OnTriggerEnter", new Type[] { typeof(Collider) })] internal static class ExplosiveBoltImpactPatch { private static void Prefix(bool ____active, out bool __state) { __state = ____active; } private static void Postfix(CrossbowBolt __instance, bool ____active, bool __state) { if (__state && !____active) { ExplosiveAmmoControl.BoltHit(__instance); } } } public static class CheatBindings { private sealed class BindingAction { internal ConfigEntry<KeyCode> primary; internal ConfigEntry<KeyCode> secondary; internal ConfigEntry<int>[] mouse; internal ConfigEntry<string>[] controller; internal KeyCode defaultKey; } private static BindingAction[] actions; internal static string ActionName(int slot) { if (slot / 6 != 0) { return "NOCLIP"; } return "BULLET TIME"; } internal static void Initialize() { //IL_003e: 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) actions = new BindingAction[2]; for (int i = 0; i < actions.Length; i++) { string text = ((i == 0) ? "BulletTime" : "Noclip"); string text2 = ((i == 0) ? "SlowTime" : text); BindingAction bindingAction = new BindingAction(); bindingAction.defaultKey = (KeyCode)((i == 0) ? 120 : 110); bindingAction.primary = ((i == 0) ? PigfaceCheatMenuPlugin.BulletTimeKey : CheatSettings.BindHotkey<KeyCode>(text, text, bindingAction.defaultKey)); bindingAction.secondary = CheatSettings.BindHotkey<KeyCode>(text + "Secondary", text2 + "Secondary", (KeyCode)0); bindingAction.mouse = new ConfigEntry<int>[2] { CheatSettings.BindHotkey(text + "MousePrimary", text2 + "MousePrimary", -1), CheatSettings.BindHotkey(text + "MouseSecondary", text2 + "MouseSecondary", -1) }; bindingAction.controller = new ConfigEntry<string>[2] { CheatSettings.BindHotkey(text + "ControllerPrimary", text + "ControllerPrimary", ""), CheatSettings.BindHotkey(text + "ControllerSecondary", text + "ControllerSecondary", "") }; actions[i] = bindingAction; } } private static Controller Pad(int slot) { string value = actions[slot / 6].controller[slot % 6 - 4].Value; int num = value.IndexOf('|'); if (num < 0 || !ReInput.isReady) { return null; } string hardware = value.Substring(0, num); return (Controller)(object)((IEnumerable<Joystick>)ReInput.controllers.Joysticks).FirstOrDefault((Func<Joystick, bool>)((Joystick j) => ((Controller)j).hardwareTypeGuid.ToString() == hardware)); } private static int PadElement(int slot) { string value = actions[slot / 6].controller[slot % 6 - 4].Value; int num = value.IndexOf('|'); if (num < 0 || !int.TryParse(value.Substring(num + 1), out var result)) { return -1; } return result; } internal static ControllerElementIdentifier Element(int slot) { //IL_0037: 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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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) if (!ReInput.isReady) { return null; } if (slot % 6 < 2) { KeyCode val = ((slot % 6 == 0) ? actions[slot / 6].primary.Value : actions[slot / 6].secondary.Value); if ((int)val != 0) { return ReInput.controllers.Keyboard.GetElementIdentifierByKeyCode(val); } return null; } if (slot % 6 < 4) { int value = actions[slot / 6].mouse[slot % 6 - 2].Value; if (value >= 0) { return ((Controller)ReInput.controllers.Mouse).GetElementIdentifierById(value); } return null; } Controller val2 = Pad(slot); if (val2 != null) { return val2.GetElementIdentifierById(PadElement(slot)); } return null; } internal static bool Assigned(int slot) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Invalid comparison between Unknown and I4 //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Invalid comparison between Unknown and I4 if (slot % 6 == 0) { return (int)actions[slot / 6].primary.Value != 0; } if (slot % 6 == 1) { return (int)actions[slot / 6].secondary.Value != 0; } if (slot % 6 < 4) { return actions[slot / 6].mouse[slot % 6 - 2].Value >= 0; } return !string.IsNullOrEmpty(actions[slot / 6].controller[slot % 6 - 4].Value); } internal static bool Pressed(int action = 0) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) BindingAction bindingAction = actions[action]; if (Input.GetKeyDown(bindingAction.primary.Value) || Input.GetKeyDown(bindingAction.secondary.Value)) { return true; } if (!ReInput.isReady) { return false; } for (int i = 0; i < 2; i++) { if (bindingAction.mouse[i].Value >= 0 && ((Controller)ReInput.controllers.Mouse).GetButtonDownById(bindingAction.mouse[i].Value)) { return true; } int slot = action * 6 + i + 4; Controller val = Pad(slot); if (val != null && val.GetButtonDownById(PadElement(slot))) { return true; } } return false; } internal static void Remove(int slot) { if (slot % 6 == 0) { actions[slot / 6].primary.Value = (KeyCode)0; } else if (slot % 6 == 1) { actions[slot / 6].secondary.Value = (KeyCode)0; } else if (slot % 6 < 4) { actions[slot / 6].mouse[slot % 6 - 2].Value = -1; } else { actions[slot / 6].controller[slot % 6 - 4].Value = ""; } CheatSettings.Save(); } internal static void Save(int slot, ControllerPollingInfo input) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) if (slot % 6 == 0) { actions[slot / 6].primary.Value = ((ControllerPollingInfo)(ref input)).keyboardKey; } else if (slot % 6 == 1) { actions[slot / 6].secondary.Value = ((ControllerPollingInfo)(ref input)).keyboardKey; } else if (slot % 6 < 4) { actions[slot / 6].mouse[slot % 6 - 2].Value = ((ControllerPollingInfo)(ref input)).elementIdentifierId; } else { actions[slot / 6].controller[slot % 6 - 4].Value = ((ControllerPollingInfo)(ref input)).controller.hardwareTypeGuid.ToString() + "|" + ((ControllerPollingInfo)(ref input)).elementIdentifierId; } CheatSettings.Save(); } internal static void Defaults() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) BindingAction[] array = actions; foreach (BindingAction bindingAction in array) { bindingAction.primary.Value = bindingAction.defaultKey; bindingAction.secondary.Value = (KeyCode)0; ConfigEntry<int>[] mouse = bindingAction.mouse; foreach (ConfigEntry<int> val in mouse) { val.Value = -1; } ConfigEntry<string>[] controller = bindingAction.controller; foreach (ConfigEntry<string> val2 in controller) { val2.Value = ""; } } CheatSettings.Save(); } } public static class NoclipControl { private static PlayerMovement player; private static Rigidbody body; private static bool gravity; private static bool kinematic; private static bool collisions; private static bool flying; private static Vector3 entryPosition; internal static bool Active { get { if ((Object)(object)player != (Object)null) { return (Object)(object)body != (Object)null; } return false; } } internal static bool Owns(PlayerMovement movement) { if (Active) { return (Object)(object)movement == (Object)(object)player; } return false; } internal static void Toggle() { //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) if (Active) { Reset(); Notify("Noclip OFF"); return; } PlayerMovement instance = PlayerMovement.Instance; if (!((Object)(object)instance == (Object)null) && !((Object)(object)instance._playerRigidBody == (Object)null) && !instance._isMantling && !instance._grappling && !((Object)(object)PlayerInput.Instance == (Object)null) && !PlayerInput.Instance._onZipline) { player = instance; body = player._playerRigidBody; gravity = body.useGravity; kinematic = body.isKinematic; collisions = body.detectCollisions; flying = player._flying; entryPosition = body.position; if (!body.isKinematic) { body.velocity = Vector3.zero; body.angularVelocity = Vector3.zero; } player._flying = true; body.useGravity = false; body.detectCollisions = false; body.isKinematic = true; Notify("Noclip ON"); } } private static void Notify(string message) { PigfaceCheatMenuPlugin.PluginLog.LogInfo((object)message); if ((Object)(object)PushManager.Instance != (Object)null) { PushManager.Instance.Push(message); } } internal static void Tick() { if ((!((Object)(object)player == (Object)null) || !((Object)(object)body == (Object)null)) && (!Active || (Object)(object)PlayerMovement.Instance != (Object)(object)player || (Object)(object)PlayerHealth.Instance == (Object)null || PlayerHealth.Instance._playerIsDead)) { Reset(); } } internal static void Fly() { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0082: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0116: 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: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) if (Active && !((Object)(object)PlayerInput.Instance == (Object)null) && PlayerInput.Instance._playerEnabled && !(Time.timeScale <= 0f) && !((Object)(object)PlayerLook.Instance == (Object)null) && !((Object)(object)PlayerLook.Instance._playerCam == (Object)null)) { Player val = PlayerInput.Instance._player; if (val != null) { Transform transform = ((Component)PlayerLook.Instance._playerCam).transform; Vector3 val2 = transform.right * val.GetAxisRaw("MoveHorizontal") + transform.forward * val.GetAxisRaw("MoveVertical"); val2 += Vector3.up * ((val.GetButton("Jump") ? 1f : 0f) - (val.GetButton("Crouch") ? 1f : 0f)); float num = 10f * MovementCheats.SpeedMultiplier * (val.GetButton("Sprint") ? 1.5f : 1f); body.MovePosition(body.position + Vector3.ClampMagnitude(val2, 1f) * num * Time.fixedDeltaTime); } } } private static bool Embedded() { //IL_0047: 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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00db: 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) Collider[] componentsInChildren = ((Component)body).GetComponentsInChildren<Collider>(true); Vector3 val3 = default(Vector3); float num = default(float); foreach (Collider val in componentsInChildren) { if (!val.enabled || val.isTrigger || (Object)(object)val.attachedRigidbody != (Object)(object)body) { continue; } Bounds bounds = val.bounds; Collider[] array = Physics.OverlapBox(((Bounds)(ref bounds)).center, ((Bounds)(ref bounds)).extents, Quaternion.identity, -1, (QueryTriggerInteraction)1); foreach (Collider val2 in array) { if (!((Object)(object)val2.attachedRigidbody == (Object)(object)body) && !((Component)val2).transform.IsChildOf(((Component)player).transform) && !Physics.GetIgnoreLayerCollision(((Component)val).gameObject.layer, ((Component)val2).gameObject.layer) && Physics.ComputePenetration(val, ((Component)val).transform.position, ((Component)val).transform.rotation, val2, ((Component)val2).transform.position, ((Component)val2).transform.rotation, ref val3, ref num) && num > 0.02f) { return true; } } } return false; } internal static void Reset() { //IL_0069: 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_0026: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)body != (Object)null) { if ((Object)(object)player != (Object)null && Embedded()) { body.position = entryPosition; } body.isKinematic = kinematic; body.useGravity = gravity; body.detectCollisions = collisions; if (!kinematic) { body.velocity = Vector3.zero; body.angularVelocity = Vector3.zero; } } if ((Object)(object)player != (Object)null) { player._flying = flying; player._startOfFall = 0f; } player = null; body = null; } } [HarmonyPatch(typeof(PlayerMovement), "FixedUpdate", new Type[] { })] internal static class NoclipPhysicsPatch { private static bool Prefix(PlayerMovement __instance) { if (!NoclipControl.Owns(__instance)) { return true; } NoclipControl.Fly(); return false; } } [HarmonyPatch] internal static class NoclipMovementPatch { private static IEnumerable<MethodBase> TargetMethods() { yield return AccessTools.Method(typeof(PlayerMovement), "Move", new Type[1] { typeof(Vector2) }, (Type[])null); yield return AccessTools.Method(typeof(PlayerMovement), "Jump", new Type[1] { typeof(bool) }, (Type[])null); yield return AccessTools.Method(typeof(PlayerMovement), "InAir", new Type[0], (Type[])null); } private static bool Prefix(PlayerMovement __instance) { return !NoclipControl.Owns(__instance); } } public static class MovementCheats { internal static float SpeedMultiplier = 1f; internal static float JumpMultiplier = 1f; public static float Speed(float original) { return original * SpeedMultiplier; } public static float Jump(float original) { return original * JumpMultiplier; } internal static IEnumerable<CodeInstruction> MultiplyReads(IEnumerable<CodeInstruction> instructions, string fieldName, string helperName, int expected) { List<CodeInstruction> code = new List<CodeInstruction>(instructions); int matches = code.Count(delegate(CodeInstruction i) { FieldInfo fieldInfo = i.operand as FieldInfo; return i.opcode == OpCodes.Ldfld && fieldInfo != null && fieldInfo.DeclaringType == typeof(PlayerMovement) && fieldInfo.Name == fieldName; }); if (matches != expected) { throw new InvalidOperationException("PlayerMovement." + fieldName + ": expected " + expected + " reads, found " + matches); } foreach (CodeInstruction instruction in code) { yield return instruction; FieldInfo field = instruction.operand as FieldInfo; if (instruction.opcode == OpCodes.Ldfld && field != null && field.DeclaringType == typeof(PlayerMovement) && field.Name == fieldName) { yield return new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(MovementCheats), helperName, (Type[])null, (Type[])null)); } } } } [HarmonyPatch(typeof(PlayerMovement), "Move", new Type[] { typeof(Vector2) })] internal static class MovementSpeedPatch { [HarmonyTranspiler] private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { return MovementCheats.MultiplyReads(instructions, "speed", "Speed", 4); } } [HarmonyPatch(typeof(PlayerMovement), "Jump", new Type[] { typeof(bool) })] internal static class SuperJumpPatch { [HarmonyTranspiler] private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { return MovementCheats.MultiplyReads(instructions, "jumpForce", "Jump", 2); } } public static class BulletTimeControl { internal static bool Enabled; internal static int SpeedPercent = 65; private static float nativeScale = 1f; private static float nativePitch = 1f; private static bool transitioning; private static float ceiling = 1f; private static float startCeiling = 1f; private static float elapsed; private static float duration; internal static void SetSpeed(int percent) { SpeedPercent = Mathf.Clamp(percent, 10, 90); if (Enabled) { startCeiling = ceiling; elapsed = 0f; duration = 0.125f; transitioning = true; } } private static float Effective(float native) { if (!Enabled && !transitioning) { return native; } return Mathf.Min(native, ceiling); } public static void SetScale(float value) { nativeScale = value; Time.timeScale = Effective(value); } public static bool SetPitch(AudioMixer mixer, string name, float value) { if (name == "MasterPitch") { nativePitch = value; value = Effective(value); } return mixer.SetFloat(name, value); } internal static void Toggle() { TimeManager instance = TimeManager.Instance; if ((Object)(object)instance == (Object)null) { return; } if (!Enabled && !transitioning) { ceiling = 1f; nativeScale = Time.timeScale; nativePitch = 1f; float num = default(float); if ((Object)(object)instance.masterMixer != (Object)null && instance.masterMixer.GetFloat("MasterPitch", ref num)) { nativePitch = num; } } Enabled = !Enabled; startCeiling = ceiling; elapsed = 0f; duration = (Enabled ? 0.125f : 0.15f); transitioning = true; Apply(instance); PigfaceCheatMenuPlugin.PluginLog.LogInfo((object)("Bullet Time " + (Enabled ? "enabled" : "disabled") + ".")); } internal static void Tick() { if (!Enabled && !transitioning) { return; } TimeManager instance = TimeManager.Instance; if ((Object)(object)instance == (Object)null) { return; } if (transitioning) { if (nativeScale > 0f) { elapsed += (Enabled ? Time.deltaTime : Time.unscaledDeltaTime); } float num = Mathf.Clamp01(elapsed / duration); ceiling = Mathf.Lerp(startCeiling, Enabled ? ((float)SpeedPercent * 0.01f) : 1f, num); if (num >= 1f) { transitioning = false; } } Apply(instance); } private static void Apply(TimeManager manager) { Time.timeScale = Effective(nativeScale); Time.fixedDeltaTime = manager._fixedUpdateTimeStep * Time.timeScale; if ((Object)(object)manager.masterMixer != (Object)null) { manager.masterMixer.SetFloat("MasterPitch", Effective(nativePitch)); } } internal static void Reset() { if (Enabled || transitioning) { Enabled = false; transitioning = false; ceiling = 1f; TimeManager instance = TimeManager.Instance; if ((Object)(object)instance != (Object)null) { Apply(instance); } } } } [HarmonyPatch] internal static class BulletTimeNativePatch { private static IEnumerable<MethodBase> TargetMethods() { yield return AccessTools.Method(typeof(TimeManager), "TimeResume", new Type[0], (Type[])null); try { string[] array = new string[3] { "<TimeStop>d__10", "<TimeSlowDownProlonged>d__11", "<TimeSlowDown>d__12" }; foreach (string name in array) { Type stateMachine = typeof(TimeManager).GetNestedType(name, BindingFlags.NonPublic); if (stateMachine == null) { throw new MissingMemberException("TimeManager." + name); } yield return AccessTools.Method(stateMachine, "MoveNext", new Type[0], (Type[])null); } } finally { } } [HarmonyTranspiler] private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { foreach (CodeInstruction instruction in instructions) { MethodInfo method = instruction.operand as MethodInfo; if (method != null && method.DeclaringType == typeof(Time) && method.Name == "set_timeScale") { instruction.opcode = OpCodes.Call; instruction.operand = AccessTools.Method(typeof(BulletTimeControl), "SetScale", (Type[])null, (Type[])null); } else if (method != null && method.DeclaringType == typeof(AudioMixer) && method.Name == "SetFloat") { instruction.opcode = OpCodes.Call; instruction.operand = AccessTools.Method(typeof(BulletTimeControl), "SetPitch", (Type[])null, (Type[])null); } yield return instruction; } } } [HarmonyPatch(typeof(SetTimeScale), "Awake", new Type[] { })] internal static class BulletTimeSceneResetPatch { private static void Prefix() { BulletTimeControl.Reset(); } } [HarmonyPatch(typeof(DeathState), "Awake", new Type[] { })] internal static class BulletTimeDeathResetPatch { private static void Prefix() { BulletTimeControl.Reset(); } } [HarmonyPatch(typeof(PlayerMovement), "KickRaycast", new Type[] { })] public static class SuperKickPatch { public static float EffectiveForce(float original) { return original * PigfaceCheatMenuPlugin.KickMultiplier; } [HarmonyTranspiler] private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { List<CodeInstruction> code = new List<CodeInstruction>(instructions); int matches = code.Count((CodeInstruction i) => i.opcode == OpCodes.Ldc_R4 && i.operand is float && ((float)i.operand == 10f || (float)i.operand == 40f)); if (matches != 4) { throw new InvalidOperationException("KickRaycast force sites differ from the verified binary: expected 4, found " + matches + "."); } foreach (CodeInstruction instruction in code) { yield return instruction; if (instruction.opcode == OpCodes.Ldc_R4 && instruction.operand is float && ((float)instruction.operand == 10f || (float)instruction.operand == 40f)) { yield return new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(SuperKickPatch), "EffectiveForce", (Type[])null, (Type[])null)); } } } } public static class RapidFireTranspiler { public static float EffectiveRate(float original) { return original * PigfaceCheatMenuPlugin.FireRateMultiplier; } public static bool RequireNewPress(bool original) { if (original) { return PigfaceCheatMenuPlugin.FireRateMultiplier <= 1f; } return false; } internal static IEnumerable<CodeInstruction> AdjustTiming(IEnumerable<CodeInstruction> instructions) { foreach (CodeInstruction instruction in instructions) { yield return instruction; FieldInfo field = instruction.operand as FieldInfo; if (!(instruction.opcode != OpCodes.Ldfld) && !(field == null) && !(field.DeclaringType != typeof(GunData))) { if (field.Name == "fireRate" || field.Name == "altFireRate") { yield return new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(RapidFireTranspiler), "EffectiveRate", (Type[])null, (Type[])null)); } else if (field.Name == "_semiAuto") { yield return new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(RapidFireTranspiler), "RequireNewPress", (Type[])null, (Type[])null)); } } } } } [HarmonyPatch(typeof(Gun), "CanShoot")] internal static class RapidFireCooldownPatch { [HarmonyTranspiler] private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { return RapidFireTranspiler.AdjustTiming(instructions); } } [HarmonyPatch] internal static class PlayerDamageMultiplierPatch { [ThreadStatic] private static int depth; private static IEnumerable<MethodBase> TargetMethods() { Type[] signature = new Type[5] { typeof(float), typeof(float), typeof(Vector3), typeof(Transform), typeof(DamageType) }; try { Type[] types = typeof(IDamageable).Assembly.GetTypes(); foreach (Type type in types) { if (!type.IsInterface && !(type == typeof(PlayerHealth)) && typeof(IDamageable).IsAssignableFrom(type)) { MethodInfo method = type.GetMethod("TakeDamage", BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, signature, null); if (method != null && !method.IsAbstract) { yield return method; } } } } finally { } } private static void Prefix(object __instance, ref float __0, Transform __3, out bool __state) { __state = true; depth++; if (depth == 1 && !(PigfaceCheatMenuPlugin.DamageMultiplier <= 1f) && !((Object)(object)__3 == (Object)null) && !((Object)(object)PlayerMovement.Instance == (Object)null)) { Transform transform = ((Component)PlayerMovement.Instance).transform; bool flag = (Object)(object)__3 == (Object)(object)transform || __3.IsChildOf(transform); NailBombInstance componentInParent = ((Component)__3).GetComponentInParent<NailBombInstance>(); BearTrap componentInParent2 = ((Component)__3).GetComponentInParent<BearTrap>(); Landmine componentInParent3 = ((Component)__3).GetComponentInParent<Landmine>(); flag |= (Object)(object)componentInParent != (Object)null && componentInParent._thrownByPlayer; flag |= (Object)(object)componentInParent2 != (Object)null && componentInParent2._playerIsOwner; flag |= (Object)(object)componentInParent3 != (Object)null && componentInParent3._playerIsOwner; Component val = (Component)((__instance is Component) ? __instance : null); if (flag && ((Object)(object)val == (Object)null || (Object)(object)val.GetComponentInParent<PlayerHealth>() == (Object)null)) { __0 *= PigfaceCheatMenuPlugin.DamageMultiplier; } } } private static Exception Finalizer(Exception __exception, bool __state) { if (__state) { depth--; } return __exception; } } [HarmonyPatch(typeof(PlayerHealth), "TakeDamage", new Type[] { typeof(float), typeof(float), typeof(Vector3), typeof(Transform), typeof(DamageType) })] internal static class PlayerGodModePatch { private static bool Prefix() { return !PigfaceCheatMenuPlugin.GodModeEnabled; } } public static class AmmoCounterDisplay { private static readonly Dictionary<Text, Font> originalFonts = new Dictionary<Text, Font>(); private static Font infinityFont; internal static void Reset() { foreach (KeyValuePair<Text, Font> originalFont in originalFonts) { if ((Object)(object)originalFont.Key != (Object)null) { originalFont.Key.font = originalFont.Value; } } originalFonts.Clear(); } internal static void Update(Text counter, bool infinite) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)counter == (Object)null) { return; } if (!infinite) { if (originalFonts.TryGetValue(counter, out var value)) { counter.font = value; originalFonts.Remove(counter); } return; } Font font = counter.font; if ((Object)(object)font != (Object)null && font.dynamic) { font.RequestCharactersInTexture("∞", counter.fontSize, counter.fontStyle); } if ((Object)(object)font == (Object)null || !font.HasCharacter('∞')) { if ((Object)(object)infinityFont == (Object)null) { infinityFont = Font.CreateDynamicFontFromOSFont("Arial", Math.Max(1, counter.fontSize)); } if ((Object)(object)infinityFont != (Object)null) { Text[] array = originalFonts.Keys.Where((Text t) => (Object)(object)t == (Object)null).ToArray(); foreach (Text key in array) { originalFonts.Remove(key); } if (!originalFonts.ContainsKey(counter)) { originalFonts.Add(counter, font); } counter.font = infinityFont; } } counter.text = "∞"; } } [HarmonyPatch(typeof(Gun), "AmmoUI", new Type[] { })] internal static class GunInfinityCounterPatch { private static void Postfix(Text ___ammoText) { AmmoCounterDisplay.Update(___ammoText, PigfaceCheatMenuPlugin.UnlimitedAmmoEnabled); } } [HarmonyPatch(typeof(Special), "AmmoUI", new Type[] { })] internal static class SpecialInfinityCounterPatch { private static void Postfix(Special __instance, Text ___ammoText) { SpecialData specialData = __instance._specialData; AmmoCounterDisplay.Update(___ammoText, (Object)(object)specialData != (Object)null && ((PigfaceCheatMenuPlugin.UnlimitedItemsEnabled && (specialData.usesAmmo || specialData.isMed)) || (PigfaceCheatMenuPlugin.UnlimitedAmmoEnabled && specialData.usesAmmo && !specialData.isMed))); } } public static class ItemConsumption { public static int AdjustItem(int current, int amount) { if (!PigfaceCheatMenuPlugin.UnlimitedItemsEnabled) { return current - amount; } return current; } public static int AdjustSpecial(int current, int amount) { if (!PigfaceCheatMenuPlugin.UnlimitedItemsEnabled && !PigfaceCheatMenuPlugin.UnlimitedAmmoEnabled) { return current - amount; } return current; } internal static IEnumerable<CodeInstruction> PreserveSpecialUse(IEnumerable<CodeInstruction> instructions) { List<CodeInstruction> list = new List<CodeInstruction>(instructions); int num = 0; for (int i = 1; i < list.Count - 1; i++) { FieldInfo fieldInfo = list[i + 1].operand as FieldInfo; if (list[i].opcode == OpCodes.Sub && list[i - 1].opcode == OpCodes.Ldc_I4_1 && list[i + 1].opcode == OpCodes.Stfld && fieldInfo != null && fieldInfo.DeclaringType == typeof(SpecialData) && fieldInfo.Name == "currentAmmo") { list[i].opcode = OpCodes.Call; list[i].operand = AccessTools.Method(typeof(ItemConsumption), (num == 0) ? "AdjustItem" : "AdjustSpecial", (Type[])null, (Type[])null); num++; } } if (num != 2) { throw new InvalidOperationException("Special.Use consumption sites changed; expected 2, found " + num); } return list; } } [HarmonyPatch] internal static class ItemInventoryConsumptionPatch { private static IEnumerable<MethodBase> TargetMethods() { yield return AccessTools.Method(typeof(SpecialBearTrap), "BearTrapUseEvent", new Type[0], (Type[])null); yield return AccessTools.Method(typeof(SpecialLandmine), "LandmineUseEvent", new Type[0], (Type[])null); Type coroutine = typeof(MedsControl).GetNestedType("<ApplyMeds>d__9", BindingFlags.NonPublic); if (coroutine == null) { throw new MissingMemberException("MedsControl.<ApplyMeds>d__9"); } yield return AccessTools.Method(coroutine, "MoveNext", new Type[0], (Type[])null); } [HarmonyTranspiler] private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { List<CodeInstruction> list = new List<CodeInstruction>(instructions); int num = 0; for (int i = 1; i < list.Count - 1; i++) { if (list[i].opcode == OpCodes.Sub && list[i - 1].opcode == OpCodes.Ldc_I4_1 && list[i + 1].opcode == OpCodes.Stind_I4) { list[i].opcode = OpCodes.Call; list[i].operand = AccessTools.Method(typeof(ItemConsumption), "AdjustItem", (Type[])null, (Type[])null); num++; } } if (num != 1) { throw new InvalidOperationException("Item inventory consumption sites changed; expected 1, found " + num); } return list; } } public static class AmmoTranspiler { public static int AdjustAfterConsumption(int currentValue, int amount) { if (!PigfaceCheatMenuPlugin.UnlimitedAmmoEnabled) { return currentValue - amount; } return currentValue; } internal static IEnumerable<CodeInstruction> PreserveField(IEnumerable<CodeInstruction> instructions, Type expectedDeclaringType, string fieldName, int skipMatches = 0, string helperName = "AdjustAfterConsumption") { List<CodeInstruction> list = new List<CodeInstruction>(instructions); MethodInfo operand = ((helperName == "AdjustAfterConsumption") ? AccessTools.Method(typeof(AmmoTranspiler), helperName, (Type[])null, (Type[])null) : AccessTools.Method(typeof(ItemConsumption), helperName, (Type[])null, (Type[])null)); int num = 0; for (int i = 1; i < list.Count - 1; i++) { FieldInfo fieldInfo = list[i + 1].operand as FieldInfo; if (list[i].opcode == OpCodes.Sub && (fieldName == "currentMaxAmmo" || list[i - 1].opcode == OpCodes.Ldc_I4_1) && list[i + 1].opcode == OpCodes.Stfld && fieldInfo != null && fieldInfo.Name == fieldName && fieldInfo.DeclaringType == expectedDeclaringType) { if (skipMatches > 0) { skipMatches--; continue; } list[i].opcode = OpCodes.Call; list[i].operand = operand; num++; } } if (num == 0 && PigfaceCheatMenuPlugin.PluginLog != null) { PigfaceCheatMenuPlugin.PluginLog.LogWarning((object)("No ammo-consumption instruction matched for " + expectedDeclaringType.Name + "." + fieldName + ".")); } return list; } } [HarmonyPatch(typeof(Gun), "Shoot")] internal static class GunShootUnlimitedAmmoPatch { private static void Prefix(Gun __instance, bool __0) { if (PigfaceCheatMenuPlugin.UnlimitedAmmoEnabled && __0 && !((Object)(object)__instance._gunData == (Object)null) && __instance._gunData.currentAmmo < 1) { __instance._gunData.currentAmmo = 1; } } [HarmonyTranspiler] private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { return RapidFireTranspiler.AdjustTiming(AmmoTranspiler.PreserveField(instructions, typeof(GunData), "currentAmmo")); } } [HarmonyPatch] internal static class GunBurstFireUnlimitedAmmoPatch { private static MethodBase TargetMethod() { Type nestedType = typeof(Gun).GetNestedType("<BurstFire>d__73", BindingFlags.NonPublic); if (nestedType == null) { throw new MissingMemberException("Gun.<BurstFire>d__73 was not found."); } MethodInfo method = nestedType.GetMethod("MoveNext", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method == null) { throw new MissingMemberException("Gun.<BurstFire>d__73.MoveNext was not found."); } return method; } [HarmonyTranspiler] private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { return RapidFireTranspiler.AdjustTiming(AmmoTranspiler.PreserveField(instructions, typeof(GunData), "currentAmmo")); } } [HarmonyPatch(typeof(Special), "Use")] internal static class SpecialUseUnlimitedAmmoPatch { private static void Prefix(Special __instance, bool __0) { if (PigfaceCheatMenuPlugin.UnlimitedAmmoEnabled && __0 && !((Object)(object)__instance._specialData == (Object)null) && __instance._specialData.usesAmmo && !__instance._specialData.isMed && __instance._specialData.currentAmmo < 1) { __instance._specialData.currentAmmo = 1; } } [HarmonyTranspiler] private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { return ItemConsumption.PreserveSpecialUse(instructions); } } [HarmonyPatch] internal static class GunReloadUnlimitedReservePatch { private static MethodBase TargetMethod() { Type nestedType = typeof(Gun).GetNestedType("<Reload>d__71", BindingFlags.NonPublic); if (nestedType == null) { throw new MissingMemberException("Gun.<Reload>d__71 was not found."); } MethodInfo method = nestedType.GetMethod("MoveNext", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method == null) { throw new MissingMemberException("Gun.<Reload>d__71.MoveNext was not found."); } return method; } [HarmonyTranspiler] private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { return AmmoTranspiler.PreserveField(instructions, typeof(GunData), "currentMaxAmmo"); } } [HarmonyPatch(typeof(Gun), "SingleShotReloadLogic")] internal static class GunSingleRoundReloadUnlimitedReservePatch { [HarmonyTranspiler] private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { return AmmoTranspiler.PreserveField(instructions, typeof(GunData), "currentMaxAmmo"); } } [HarmonyPatch] internal static class SpecialReloadUnlimitedReservePatch { private static MethodBase TargetMethod() { Type nestedType = typeof(Special).GetNestedType("<Reload>d__20", BindingFlags.NonPublic); if (nestedType == null) { throw new MissingMemberException("Special.<Reload>d__20 was not found."); } MethodInfo method = nestedType.GetMethod("MoveNext", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method == null) { throw new MissingMemberException("Special.<Reload>d__20.MoveNext was not found."); } return method; } [HarmonyTranspiler] private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { return AmmoTranspiler.PreserveField(instructions, typeof(SpecialData), "currentMaxAmmo", 0, "AdjustSpecial"); } } [HarmonyPatch(typeof(PlayerOptions), "Start")] internal static class CheatMenuStartPatch { private static void Postfix(PlayerOptions __instance) { CheatMenuController.Ensure(__instance); } } [HarmonyPatch(typeof(PlayerOptions), "ToggleMenu")] internal static class CheatMenuPausePatch { private static bool Prefix(PlayerOptions __instance) { CheatHotkeyControls active = CheatHotkeyControls.Active; if ((Object)(object)active != (Object)null && active.HandleBack()) { return false; } CheatMenuController component = ((Component)__instance).GetComponent<CheatMenuController>(); if ((Object)(object)component != (Object)null && component.IsOpen && __instance.menuOpen) { component.Close(); return false; } return true; } private static void Postfix(PlayerOptions __instance) { CheatMenuController cheatMenuController = CheatMenuController.Ensure(__instance); if ((Object)(object)cheatMenuController != (Object)null && __instance.menuOpen && !cheatMenuController.IsOpen) { cheatMenuController.PositionEntry(); } } } internal static class HighlightControl { private enum Kind { Enemy, Objective, Reward } private sealed class Overlay { private readonly Renderer source; private readonly EntityManager entity; private readonly Turret turret; private bool enemyHighlight; private Material maskMaterial; private Material fillMaterial; internal Overlay(Renderer original) { source = original; entity = ((Component)source).GetComponentInParent<EntityManager>(); turret = ((Component)source).GetComponentInParent<Turret>(); } internal void SetMaterials(Material mask, Material fill) { maskMaterial = mask; fillMaterial = fill; enemyHighlight = (Object)(object)fill == (Object)(object)red; } internal void Draw(CommandBuffer buffer, Camera camera, bool stencil) { if ((Object)(object)source == (Object)null || !source.enabled || !((Component)source).gameObject.activeInHierarchy || ((Object)(object)entity != (Object)null && entity._entityIsDead) || (enemyHighlight && (Object)(object)turret != (Object)null && (turret._dead || !((Behaviour)turret).isActiveAndEnabled)) || (camera.cullingMask & (1 << ((Component)source).gameObject.layer)) == 0) { return; } Renderer obj = source; SkinnedMeshRenderer val = (SkinnedMeshRenderer)(object)((obj is SkinnedMeshRenderer) ? obj : null); MeshFilter val2 = (((Object)(object)val == (Object)null) ? ((Component)source).GetComponent<MeshFilter>() : null); Mesh val3 = (((Object)(object)val != (Object)null) ? val.sharedMesh : (((Object)(object)val2 != (Object)null) ? val2.sharedMesh : null)); Material val4 = (stencil ? maskMaterial : fillMaterial); if (!((Object)(object)val3 == (Object)null) && !((Object)(object)val4 == (Object)null)) { for (int i = 0; i < val3.subMeshCount; i++) { buffer.DrawRenderer(source, val4, i, -1); } } } internal void Dispose() { maskMaterial = (fillMaterial = null); } } private static readonly Dictionary<Renderer, Overlay> overlays = new Dictionary<Renderer, Overlay>(); private static readonly HashSet<EntityManager> objectiveEnemies = new HashSet<EntityManager>(); private static readonly Dictionary<Type, FieldInfo[]> eventFields = new Dictionary<Type, FieldInfo[]>(); private static readonly FieldInfo collectibleType = AccessTools.Field(typeof(Collectible), "type"); private static readonly FieldInfo collectibleMask = AccessTools.Field(typeof(Collectible), "typeOfMask"); private static Material mask; private static Material red; private static Material green; private static Material gold; private static readonly FieldInfo initialFov = AccessTools.Field(typeof(PlayerLook), "initialFov"); private static readonly FieldInfo playerCamera = AccessTools.Field(typeof(Interactor), "playerCam"); private static CommandBuffer commands; private static Camera renderCamera; private static bool loggedRenderPath; private static float nextScan; private static bool unavailable; internal static bool HasTargets { get { if (!unavailable && (Object)(object)mask != (Object)null && overlays.Count > 0) { if (!PigfaceCheatMenuPlugin.HighlightEnemiesEnabled) { return PigfaceCheatMenuPlugin.HighlightObjectivesEnabled; } return true; } return false; } } internal static void Refresh() { nextScan = 0f; } internal static void Reset() { foreach (Overlay value in overlays.Values) { value.Dispose(); } overlays.Clear(); objectiveEnemies.Clear(); if ((Object)(object)renderCamera != (Object)null && commands != null) { renderCamera.RemoveCommandBuffer((CameraEvent)17, commands); } if (commands != null) { commands.Release(); } commands = null; renderCamera = null; loggedRenderPath = false; if ((Object)(object)mask != (Object)null) { Object.Destroy((Object)(object)mask); } if ((Object)(object)red != (Object)null) { Object.Destroy((Object)(object)red); } if ((Object)(object)green != (Object)null) { Object.Destroy((Object)(object)green); } if ((Object)(object)gold != (Object)null) { Object.Destroy((Object)(object)gold); } mask = (red = (green = (gold = null))); unavailable = false; nextScan = 0f; } internal static void Tick() { bool highlightEnemiesEnabled = PigfaceCheatMenuPlugin.HighlightEnemiesEnabled; bool highlightObjectivesEnabled = PigfaceCheatMenuPlugin.HighlightObjectivesEnabled; if (!highlightEnemiesEnabled && !highlightObjectivesEnabled) { if (overlays.Count > 0 || (Object)(object)mask != (Object)null || commands != null) { Reset(); } } else { if (unavailable) { return; } if (Time.unscaledTime >= nextScan) { nextScan = Time.unscaledTime + 1f; try { Scan(highlightEnemiesEnabled, highlightObjectivesEnabled); } catch (Exception ex) { Reset(); unavailable = true; PigfaceCheatMenuPlugin.PluginLog.LogError((object)("Highlights unavailable in this scene: " + ex)); } } if ((Object)(object)GraphicsSettings.currentRenderPipeline == (Object)null) { BuildDrawCommands(); } } } private static bool InScene(Component component) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)component != (Object)null) { Scene scene = component.gameObject.scene; if (((Scene)(ref scene)).IsValid()) { return component.gameObject.activeInHierarchy; } } return false; } private static void Scan(bool enemies, bool objectives) { //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Expected O, but got Unknown //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Expected O, but got Unknown //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Expected O, but got Unknown //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Expected O, but got Unknown //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Unknown result type (might be due to invalid IL or missing references) objectiveEnemies.Clear(); Dictionary<Renderer, Kind> dictionary = new Dictionary<Renderer, Kind>(); if (enemies) { EntityManager[] array = Resources.FindObjectsOfTypeAll<EntityManager>(); foreach (EntityManager val in array) { if (InScene((Component)(object)val) && !val._entityIsDead) { AddEnemy(val, dictionary); } } Turret[] array2 = Resources.FindObjectsOfTypeAll<Turret>(); foreach (Turret val2 in array2) { if (InScene((Component)(object)val2) && ((Behaviour)val2).isActiveAndEnabled && !val2._dead) { AddRenderers((Component)(object)val2, dictionary, Kind.Enemy); } } } if (objectives) { FindObjectiveRenderers(dictionary); Collectible[] array3 = Resources.FindObjectsOfTypeAll<Collectible>(); foreach (Collectible val3 in array3) { if (InScene((Component)(object)val3) && (Object)(object)((Component)val3).GetComponentInParent<EntityManager>() == (Object)null && (Object)(object)((Component)val3).GetComponentInParent<PlayerHealth>() == (Object)null && (Convert.ToInt32(collectibleType.GetValue(val3)) == 1 || Convert.ToInt32(collectibleType.GetValue(val3)) == 13 || (Convert.ToInt32(collectibleType.GetValue(val3)) == 7 && Convert.ToInt32(collectibleMask.GetValue(val3)) != 0))) { AddRenderers((Component)(object)val3, dictionary, Kind.Reward); Interactable componentInParent = ((Component)val3).GetComponentInParent<Interactable>(); if ((Object)(object)componentInParent != (Object)null) { AddRenderers((Component)(object)componentInParent, dictionary, Kind.Reward); } } } } Renderer[] array4 = overlays.Keys.ToArray(); foreach (Renderer val4 in array4) { if ((Object)(object)val4 == (Object)null || !dictionary.ContainsKey(val4)) { overlays[val4].Dispose(); overlays.Remove(val4); } } if (dictionary.Count == 0) { return; } if ((Object)(object)mask == (Object)null) { Material val5 = Resources.Load<Material>("Materials/OutlineMask"); Material val6 = Resources.Load<Material>("Materials/OutlineFill"); if ((Object)(object)val5 == (Object)null || (Object)(object)val6 == (Object)null) { throw new InvalidOperationException("Native outline materials were not loaded."); } mask = new Material(val5); red = new Material(val6); green = new Material(val6); gold = new Material(val6); mask.SetFloat("_ZTest", 8f); Material[] array5 = (Material[])(object)new Material[3] { red, green, gold }; foreach (Material val7 in array5) { val7.SetFloat("_ZTest", 8f); val7.SetFloat("_OutlineWidth", 2f); } red.SetColor("_OutlineColor", Color.red); green.SetColor("_OutlineColor", Color.green); gold.SetColor("_OutlineColor", new Color(1f, 0.72f, 0.05f, 1f)); } foreach (KeyValuePair<Renderer, Kind> item in dictionary) { if (!overlays.TryGetValue(item.Key, out var value)) { value = new Overlay(item.Key); overlays.Add(item.Key, value); } value.SetMaterials(mask, (item.Value == Kind.Reward) ? gold : ((item.Value == Kind.Objective) ? green : red)); } } private static void AddRenderers(Component source, Dictionary<Renderer, Kind> wanted, Kind kind) { if (!InScene(source)) { return; } Renderer[] componentsInChildren = source.GetComponentsInChildren<Renderer>(true); if (componentsInChildren.Length > 64) { return; } Renderer[] array = componentsInChildren; foreach (Renderer val in array) { if (InScene((Component)(object)val) && (val is MeshRenderer || val is SkinnedMeshRenderer) && !((Object)val).name.StartsWith("PIGFACE Highlight", StringComparison.Ordinal)) { EntityManager componentInParent = ((Component)val).GetComponentInParent<EntityManager>(); if ((kind != Kind.Objective || !((Object)(object)componentInParent != (Object)null) || objectiveEnemies.Contains(componentInParent)) && (!wanted.TryGetValue(val, out var value) || kind > value)) { wanted[val] = kind; } } } } private static void FindObjectiveRenderers(Dictionary<Renderer, Kind> wanted) { //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Expected O, but got Unknown ObjectiveManager instance = ObjectiveManager.Instance; if ((Object)(object)instance == (Object)null || instance.objectives == null) { return; } HashSet<Objective> hashSet = new HashSet<Objective>(instance.objectives.Where((Objective o) => InScene((Component)(object)o) && !o._completed)); if (hashSet.Count == 0) { return; } EntitySpawner[] array = Resources.FindObjectsOfTypeAll<EntitySpawner>().Where(delegate(EntitySpawner spawner) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)spawner != (Object)null) { Scene scene = ((Component)spawner).gameObject.scene; if (((Scene)(ref scene)).IsValid()) { return (Object)(object)spawner._entityKilledObjective != (Object)null; } } return false; }).ToArray(); Dictionary<Objective, int> dictionary = (from spawner in array group spawner by spawner._entityKilledObjective).ToDictionary((IGrouping<Objective, EntitySpawner> group) => group.Key, (IGrouping<Objective, EntitySpawner> group) => group.Count()); EntitySpawner[] array2 = array; foreach (EntitySpawner val in array2) { Objective entityKilledObjective = val._entityKilledObjective; if (hashSet.Contains(entityKilledObjective) && !entityKilledObjective._countRemainingEntities && !entityKilledObjective._killHalf && !entityKilledObjective._countRemainingDamageTypes && !entityKilledObjective._countRemainingInts && dictionary[entityKilledObjective] == 1 && InScene((Component)(object)val._spawnedEntity) && !val._spawnedEntity._entityIsDead) { objectiveEnemies.Add(val._spawnedEntity); } } foreach (EntityManager objectiveEnemy in objectiveEnemies) { AddEnemy(objectiveEnemy, wanted, Kind.Objective); } Dictionary<Component, List<Component>> dictionary2 = new Dictionary<Component, List<Component>>(); MonoBehaviour[] array3 = Resources.FindObjectsOfTypeAll<MonoBehaviour>(); foreach (MonoBehaviour val2 in array3) { if (!InScene((Component)(object)val2) || ((object)val2).GetType().Assembly != typeof(Objective).Assembly) { continue; } Type type = ((object)val2).GetType(); if (!eventFields.TryGetValue(type, out var value)) { List<FieldInfo> list = new List<FieldInfo>(); Type type2 = type; while (type2 != null && type2 != typeof(MonoBehaviour)) { list.AddRange(from f in type2.GetFields(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) where typeof(UnityEventBase).IsAssignableFrom(f.FieldType) select f); type2 = type2.BaseType; } value = list.ToArray(); eventFields[type] = value; } FieldInfo[] array4 = value; foreach (FieldInfo fieldInfo in array4) { object? value2 = fieldInfo.GetValue(val2); UnityEventBase val3 = (UnityEventBase)((value2 is UnityEventBase) ? value2 : null); if (val3 == null) { continue; } for (int num4 = 0; num4 < val3.GetPersistentEventCount(); num4++) { if ((int)val3.GetPersistentListenerState(num4) == 0) { continue; } Object persistentTarget = val3.GetPersistentTarget(num4); Component val4 = (Component)(object)((persistentTarget is Component) ? persistentTarget : null); if (!((Object)(object)val4 == (Object)null) && (!(val4 is Objective) || (hashSet.Contains((Objective)val4) && !(val3.GetPersistentMethodName(num4) != "ObjectiveCompleted")))) { if (!dictionary2.TryGetValue(val4, out var value3)) { value3 = new List<Component>(); dictionary2.Add(val4, value3); } value3.Add((Component)(object)val2); } } } } HashSet<Component> hashSet2 = new HashSet<Component>(); List<Component> list2 = new List<Component>(hashSet.Cast<Component>()); for (int num5 = 0; num5 < 8; num5++) { if (list2.Count <= 0) { break; } List<Component> list3 = new List<Component>(); foreach (Component item in list2) { if ((Object)(object)item == (Object)null || !hashSet2.Add(item) || item is EntityMaster) { continue; } AddRenderers(item, wanted, Kind.Objective); EntitySpawner val5 = (EntitySpawner)(object)((item is EntitySpawner) ? item : null); if ((Object)(object)val5 != (Object)null) { AddEnemy(val5._spawnedEntity, wanted, Kind.Objective); } EntityManager val6 = (EntityManager)(object)((item is EntityManager) ? item : null); if ((Object)(object)val6 == (Object)null) { val6 = item.GetComponentInParent<EntityManager>(); } if ((Object)(object)val6 != (Object)null) { AddEnemy(val6, wanted, Kind.Objective); } Interactable componentInParent = item.GetComponentInParent<Interactable>(); if ((Object)(object)componentInParent != (Object)null) { AddRenderers((Component)(object)componentInParent, wanted, Kind.Objective); } EventOnSpecificColliderInTrigger val7 = (EventOnSpecificColliderInTrigger)(object)((item is EventOnSpecificColliderInTrigger) ? item : null); if ((Object)(object)val7 != (Object)null && val7._specificColliders != null) { Collider[] specificColliders = val7._specificColliders; foreach (Collider source in specificColliders) { AddRenderers((Component)(object)source, wanted, Kind.Objective); } } if (dictionary2.TryGetValue(item, out var value4)) { list3.AddRange(value4); } } list2 = list3; } } private static void AddEnemy(EntityManager entity, Dictionary<Renderer, Kind> wanted, Kind kind = Kind.Enemy) { if (InScene((Component)(object)entity) && !entity._entityIsDead && (kind != Kind.Objective || objectiveEnemies.Contains(entity))) { AddRenderers((Component)(object)entity, wanted, kind); Renderer entitySkinnedMeshRenderer = (Renderer)(object)entity._entitySkinnedMeshRenderer; if ((Object)(object)entitySkinnedMeshRenderer != (Object)null && (!wanted.TryGetValue(entitySkinnedMeshRenderer, out var value) || kind > value)) { wanted[entitySkinnedMeshRenderer] = kind; } } } private static void UpdateOutlineWidth(Camera camera) { float num = 60f; if ((Object)(object)PlayerLook.Instance != (Object)null) { float num2 = (float)initialFov.GetValue(PlayerLook.Instance); if (num2 > 1f && num2 < 179f) { num = num2; } } float num3 = (camera.orthographic ? 1f : (Mathf.Tan(Mathf.Clamp(camera.fieldOfView, 1f, 179f) * ((float)Math.PI / 180f) * 0.5f) / Mathf.Tan(num * ((float)Math.PI / 180f) * 0.5f))); float num4 = 2f * Mathf.Clamp(num3, 0.01f, 1f); Material[] array = (Material[])(object)new Material[3] { red, green, gold }; foreach (Material val in array) { if ((Object)(object)val != (Object)null) { val.SetFloat("_OutlineWidth", num4); } } } private static void BuildDrawCommands() { //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Expected O, but got Unknown Camera val = (Camera)(((Object)(object)Interactor.Instance != (Object)null) ? /*isinst with value type is only supported in some contexts*/: null); if ((Object)(object)val == (Object)null) { val = Camera.main; } if ((Object)(object)val != (Object)(object)renderCamera) { if ((Object)(object)renderCamera != (Object)null && commands != null) { renderCamera.RemoveCommandBuffer((CameraEvent)17, commands); } renderCamera = val; if (commands != null) { commands.Clear(); } if ((Object)(object)renderCamera != (Object)null) { if (commands == null) { CommandBuffer val2 = new CommandBuffer(); val2.name = "PIGFACE Cheat Highlights"; commands = val2; } renderCamera.AddCommandBuffer((CameraEvent)17, commands); } } if (commands == null) { return; } commands.Clear(); if ((Object)(object)renderCamera == (Object)null || (Object)(object)mask == (Object)null) { return; } UpdateOutlineWidth(renderCamera); foreach (Overlay value in overlays.Values) { value.Draw(commands, renderCamera, stencil: true); } foreach (Overlay value2 in overlays.Values) { value2.Draw(commands, renderCamera, stencil: false); } LogRenderPath("built-in camera event", renderCamera); } internal static void DrawUniversal(CommandBuffer buffer, Camera camera) { if (!HasTargets || (Object)(object)camera == (Object)null) { return; } UpdateOutlineWidth(camera); foreach (Overlay value in overlays.Values) { value.Draw(buffer, camera, stencil: true); } foreach (Overlay value2 in overlays.Values) { value2.Draw(buffer, camera, stencil: false); } LogRenderPath("Universal Render Pipeline pass", camera); } private static void LogRenderPath(string path, Camera camera) { if (!loggedRenderPath && overlays.Count != 0) { loggedRenderPath = true; PigfaceCheatMenuPlugin.PluginLog.LogInfo((object)("Highlight rendering: " + path + "; camera=" + ((Object)camera).name + "; targets=" + overlays.Count + "; pipeline=" + (((Object)(object)GraphicsSettings.currentRenderPipeline == (Object)null) ? "built-in" : ((object)GraphicsSettings.currentRenderPipeline).GetType().FullName))); } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] internal static class HighlightUniversalRendererPatch { private sealed class HighlightPass : ScriptableRenderPass { internal HighlightPass() { ((ScriptableRenderPass)this).renderPassEvent = (RenderPassEvent)550; } public override void OnCameraSetup(CommandBuffer cmd, ref RenderingData renderingData) { ScriptableRenderer renderer = renderingData.cameraData.renderer; ((ScriptableRenderPass)this).ConfigureTarget(renderer.cameraColorTargetHandle, renderer.cameraDepthTargetHandle); } public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData) { CommandBuffer val = CommandBufferPool.Get("PIGFACE Cheat Highlights"); try { HighlightControl.DrawUniversal(val, renderingData.cameraData.camera); ((ScriptableRenderContext)(ref context)).ExecuteCommandBuffer(val); } finally { CommandBufferPool.Release(val); } } } private static readonly HighlightPass pass = new HighlightPass(); private static void Postfix(UniversalRenderer __instance, ref RenderingData renderingData) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Invalid comparison between Unknown and I4 //IL_002b: Unknown result type (might be due to invalid IL or missing references) Camera camera = renderingData.cameraData.camera; if (HighlightControl.HasTargets && (Object)(object)camera != (Object)null && (int)camera.cameraType == 1 && (int)renderingData.cameraData.renderType == 0) { ((ScriptableRenderer)__instance).EnqueuePass((ScriptableRenderPass)(object)pass); } } } internal static class ResourceEditor { private sealed class Change : IDataPersistence { private readonly int index; private readonly int value; internal Change(int index, int value) { this.index = index; this.value = value; } public void LoadData(GameData data) { } public void SaveData(ref GameData data) { if (index < 0) { for (int i = 0; i < Names.Length; i++) { Set(data, i, 999999); } } else { Set(data, index, value); } } } internal const int Maximum = 999999; internal static readonly string[] Names = new string[5] { "MONEY", "ADHESIVE", "ELECTRICAL SCRAP", "HOSPITAL JUNK", "METAL PARTS" }; internal static GameData Data { get { if (!((Object)(object)DataPersistenceManager.Instance == (Object)null)) { return DataPersistenceManager.Instance.gameData; } return null; } } internal static int Get(GameData data, int index) { return index switch { 0 => data._totalMoney, 1 => data._adhesiveAmount, 2 => data._electricalAmount, 3 => data._hospitalAmount, 4 => data._metalAmount, _ => throw new ArgumentOutOfRangeException("index"), }; } private static void Set(GameData data, int index, int value) { value = Mathf.Clamp(value, 0, 999999); switch (index) { case 0: data._totalMoney = value; break; case 1: data._adhesiveAmount = value; break; case 2: data._electricalAmount = value; break; case 3: data._hospitalAmount = value; break; case 4: data._metalAmount = value; break; default: throw new ArgumentOutOfRangeException("index"); } } internal static bool Apply(int index, int value) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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_0085: Unknown result type (might be due to invalid IL or missing references) DataPersistenceManager instance = DataPersistenceManager.Instance; if ((Object)(object)instance == (Object)null || instance.gameData == null) { return false; } try { instance.SaveSpecificDataNoSaveImage((IDataPersistence)(object)new Change(index, value)); PlayerCrafting[] array = Resources.FindObjectsOfTypeAll<PlayerCrafting>(); foreach (PlayerCrafting val in array) { Scene scene = ((Component)val).gameObject.scene; if (((Scene)(ref scene)).IsValid()) { val.LoadData(instance.gameData); } } CraftingStation[] array2 = Resources.FindObjectsOfTypeAll<CraftingStation>(); foreach (CraftingStation val2 in array2) { Scene scene2 = ((Component)val2).gameObject.scene; if (((Scene)(ref scene2)).IsValid() && ((Behaviour)val2).isActiveAndEnabled) { val2.UpdateComponentTotals(); } } PigfaceCheatMenuPlugin.PluginLog.LogInfo((object)((index < 0) ? "Resources: Max All applied." : ("Resource updated: " + Names[index] + " = " + value))); return true; } catch (Exception ex) { PigfaceCheatMenuPlugin.PluginLog.LogError((object)("Resource update failed: " + ex)); return false; } } } public sealed class CheatMenuController : MonoBehaviour { private PlayerOptions owner; private GameObject pauseRoot; private GameObject panel; private Button template; private Button entry; private Button ammo; private Button items; private Button godMode; private Button explosiveAmmo; private Button noRecoil; private Button bigHead; private Button bulletTimeSpeedLabel; private Slider bulletTimeSpeedSlider; private Button highlightEnemies; private Button highlightObjectives; private Button fireRateLabel; private Button damageLabel; private Button kickStrengthLabel; private Button jumpLabel; private Button speedLabel; private Slider fireRateSlider; private Slider damageSlider; private Slider kickSlider; private Slider jumpSlider; private Slider speedSlider; private Button quit; private bool quitMoved; private Vector2 quitOriginalPosition; private Vector2 quitAppliedPosition; private Button back; private Button cheatsPageTab; private Button resourcesPageTab; private GameObject cheatsPage; private GameObject resourcesPage; private Button[] resourceLabels; private TMP_InputField[] resourceInputs; private string[] resourceDisplayedValues; private Button maxAll; private Button resourceStatus; private bool showingResources; private readonly Dictionary<GameObject, bool> hiddenChildren = new Dictionary<GameObject, bool>(); public bool IsOpen { get; private set; } internal static CheatMenuController Ensure(PlayerOptions owner) { CheatMenuController cheatMenuController = ((Component)owner).GetComponent<CheatMenuController>(); if ((Object)(object)cheatMenuController == (Object)null) { cheatMenuController = ((Component)owner).gameObject.AddComponent<CheatMenuController>(); } if ((Object)(object)cheatMenuController.panel == (Object)null) { try { cheatMenuController.Initialize(owner); } catch (Exception ex) { PigfaceCheatMenuPlugin.PluginLog.LogError((object)("Could not create Cheats menu: " + ex)); } } return cheatMenuController; } private void Initialize(PlayerOptions options) { //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Expected O, but got Unknown //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Expected O, but got Unknown //IL_0128: 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_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Expected O, but got Unknown //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Expected O, but got Unknown //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Expected O, but got Unknown //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Expected O, but got Unknown //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_033f: Expected O, but got Unknown //IL_0351: Unknown result type (might be due to invalid IL or missing references) //IL_035b: Expected O, but got Unknown //IL_0697: Unknown result type (might be due to invalid IL or missing references) //IL_06a1: Expected O, but got Unknown //IL_06b3: Unknown result type (might be due to invalid IL or missing references) //IL_06bd: Expected O, but got Unknown //IL_06cf: Unknown result type (might be due to invalid IL or missing references) //IL_06d9: Expected O, but got Unknown //IL_06eb: Unknown result type (might be due to invalid IL or missing references) //IL_06f5: Expected O, but got Unknown //IL_0893: Unknown result type (might be due to invalid IL or missing references) //IL_089d: Expected O, but got Unknown //IL_08af: Unknown result type (might be due to invalid IL or missing references) //IL_08b9: Expected O, but got Unknown owner = options; ref GameObject reference = ref pauseRoot; object? value = AccessTools.Field(typeof(PlayerOptions), "pauseMenu").GetValue(owner); reference = (GameObject)((value is GameObject) ? value : null); if ((Object)(object)pauseRoot == (Object)null) { return; } Button[] componentsInChildren = pauseRoot.GetComponentsInChildren<Button>(true); template = ((IEnumerable<Button>)componentsInChildren).FirstOrDefault((Func<Button, bool>)((Button b) => Label(b).Trim().Equals("RESUME", StringComparison.OrdinalIgnoreCase))); if ((Object)(object)template == (Object)null) { template = componentsInChildren.FirstOrDefault(); } if ((Object)(object)template == (Object)null) { PigfaceCheatMenuPlugin.PluginLog.LogWarning((object)"The pause menu has no button template; the Cheats menu could not be created."); return; } panel = new GameObject("PIGFACE Cheats Panel", new Type[1] { typeof(RectTransform) }); panel.SetActive(false); RectTransform val = (RectTransform)panel.transform; Canvas componentInParent = pauseRoot.GetComponentInParent<Canvas>(); ((Transform)val).SetParent(((Object)(object)componentInParent != (Object)null) ? ((Component)componentInParent.rootCanvas).transform : pauseRoot.transform, false); val.anchorMin = Vector2.zero; val.anchorMax = Vector2.one; val.offsetMin = Vector2.zero; val.offsetMax = Vector2.zero; quit = ((IEnumerable<Button>)componentsInChildren).FirstOrDefault((Func<Button, bool>)((Button b) => Label(b).Trim().Equals("QUIT", StringComparison.OrdinalIgnoreCase))); entry = CloneButton("Cheats", ((Object)(object)quit != (Object)null) ? ((Component)quit).transform.parent : ((Component)template).transform.parent); SetLabel(entry, "CHEATS"); ((UnityEvent)entry.onClick).AddListener(new UnityAction(Open)); PositionEntry(); ammo = CloneButton("Unlimited Ammo", panel.transform); items = CloneButton("Unlimited Items", panel.transform); godMode = CloneButton("Godmode", panel.transform); explosiveAmmo = CloneButton("Explosive Ammo", panel.transform); noRecoil = CloneButton("No Recoil", panel.transform); ((UnityEvent)noRecoil.onClick).AddListener((UnityAction)delegate { PigfaceCheatMenuPlugin.ToggleNoRecoil(); RefreshLabel(); }); bigHead = CloneButton("Big Head", panel.transform); ((UnityEvent)bigHead.onClick).AddListener((UnityAction)delegate { PigfaceCheatMenuPlugin.ToggleBigHead(); RefreshLabel(); }); highlightEnemies = CloneButton("Highlight All Enemies", panel.transform); highlightObjectives = CloneButton("Highlight All Objectives", panel.transform); ((UnityEvent)highlightEnemies.onClick).AddListener((UnityAction)delegate { PigfaceCheatMenuPlugin.ToggleHighlight(objectives: false); RefreshLabel(); }); ((UnityEvent)highlightObjectives.onClick).AddListener((UnityAction)delegate { PigfaceCheatMenuPlugin.ToggleHighlight(objectives: true); RefreshLabel(); }); ((UnityEvent)explosiveAmmo.onClick).AddListener((UnityAction)delegate { PigfaceCheatMenuPlugin.ToggleExplosiveAmmo(); RefreshLabel(); }); fireRateLabel = CloneButton("Fire Rate Label", panel.transform); damageLabel = CloneButton("Damage Multiplier Label", panel.transform); kickStrengthLabel = CloneButton("Kick Strength Label", panel.transform); jumpLabel = CloneButton("Jump Height Label", panel.transform); speedLabel = CloneButton("Movement Speed Label", panel.transform); bulletTimeSpeedLabel = CloneButton("Bullet Time Speed Label", panel.transform); Button[] array = (Button[])(object)new Button[6] { fireRateLabel, kickStrengthLabel, jumpLabel, speedLabel, damageLabel, bulletTimeSpeedLabel }; foreach (Button val2 in array) { ((Behaviour)val2).enabled = false; if ((Object)(object)((Selectable)val2).targetGraphic != (Object)null) { ((Behaviour)((Selectable)val2).targetGraphic).enabled = false; } } object? value2 = AccessTools.Field(typeof(PlayerOptions), "volumeSlider").GetValue(owner); Slider val3 = (Slider)((value2 is Slider) ? value2 : null); if ((Object)(object)val3 == (Object)null) { throw new MissingMemberException("PlayerOptions.volumeSlider has no slider template."); } fireRateSlider = CreateMultiplierSlider(val3, "Fire Rate", PigfaceCheatMenuPlugin.FireRateMultiplier, delegate(float fireRateMultiplier) { PigfaceCheatMenuPlugin.FireRateMultiplier = fireRateMultiplier; }); kickSlider = CreateMultiplierSlider(val3, "Kick Strength", PigfaceCheatMenuP