using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HG; using HarmonyLib; using KinematicCharacterController; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using R2API.Networking; using R2API.Networking.Interfaces; using RoR2; using RoR2.Networking; using RoR2.Projectile; using RoR2.UI; using UnityEngine; using UnityEngine.Networking; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("PoppyMenu")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("2.2.3.0")] [assembly: AssemblyInformationalVersion("2.2.3+d72084a38932c53427d8cdd8f373efcc3029c5b8")] [assembly: AssemblyProduct("PoppyMenu")] [assembly: AssemblyTitle("PoppyMenu")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("2.2.3.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace PoppyMenu { internal static class ActionRegistry { private static readonly List _all; private static readonly Dictionary _byId; internal static IReadOnlyList All => _all; static ActionRegistry() { _all = new List(); _byId = new Dictionary(); Build(); } internal static PoppyAction Get(string id) { if (id == null || !_byId.TryGetValue(id, out var value)) { return null; } return value; } internal static void Run(string id) { PoppyAction poppyAction = Get(id); if (poppyAction == null) { return; } try { poppyAction.Invoke(); } catch (Exception arg) { Log.Error($"action {id} failed: {arg}"); } } internal static void RunId(string id) { if (!string.IsNullOrEmpty(id)) { if (id.StartsWith("macro:")) { MacroStore.Run(id.Substring("macro:".Length)); } else { Run(id); } } } private static void Add(string id, string category, string name, Action fn) { PoppyAction poppyAction = new PoppyAction(id, category, name, fn); _all.Add(poppyAction); _byId[id] = poppyAction; } private static void Build() { Add("menu.disableAll", "Menu", "Disable everything", Cheats.DisableAll); Add("player.god", "Player", "God mode", delegate { PlayerModule.GodMode = !PlayerModule.GodMode; }); Add("player.buddha", "Player", "Buddha", delegate { Safety.Buddha = !Safety.Buddha; }); Add("player.skills", "Player", "Infinite skills", delegate { PlayerModule.InfiniteSkills = !PlayerModule.InfiniteSkills; }); Add("player.healFull", "Player", "Heal to full", delegate { NetUtil.Do(PoppyOp.HealFull); }); Add("player.respawn", "Player", "Respawn", delegate { NetUtil.Do(PoppyOp.Respawn); }); Add("move.flight", "Movement", "Flight", MovementModule.ToggleFlight); Add("move.noclip", "Movement", "No-clip", MovementModule.ToggleNoClip); Add("move.sprint", "Movement", "Always sprint", MovementModule.ToggleSprint); Add("move.jump", "Movement", "Jump pack", delegate { MovementModule.JumpPack = !MovementModule.JumpPack; }); Add("aim.toggle", "Aimbot", "Aimbot", delegate { Aim.Enabled = !Aim.Enabled; }); Add("aim.magic", "Aimbot", "Magic bullet", delegate { Aim.MagicBullet = !Aim.MagicBullet; }); Add("items.giveAll", "Items", "Give all items", delegate { NetUtil.Do(PoppyOp.GiveAllItems, 0, 1); }); Add("items.clear", "Items", "Clear inventory", delegate { NetUtil.Do(PoppyOp.ClearInventory); }); Add("items.stack", "Items", "Stack inventory", delegate { NetUtil.Do(PoppyOp.StackInventory); }); Add("items.reroll", "Items", "Reroll items", delegate { NetUtil.Do(PoppyOp.RollItems); }); Add("items.noEquipCd", "Items", "No equipment cooldown", delegate { ItemsModule.NoEquipmentCooldown = !ItemsModule.NoEquipmentCooldown; }); Add("combat.killAll", "Combat", "Kill all enemies", delegate { NetUtil.Do(PoppyOp.KillAllEnemies); }); Add("combat.noEnemies", "Combat", "No enemies", delegate { Safety.NoEnemies = !Safety.NoEnemies; }); Add("tp.charge", "Teleporter", "Charge teleporter", delegate { NetUtil.Do(PoppyOp.ChargeTeleporter); }); Add("tp.skip", "Teleporter", "Skip stage", delegate { NetUtil.Do(PoppyOp.SkipStage); }); Add("tp.portals", "Teleporter", "Spawn all portals", delegate { NetUtil.Do(PoppyOp.SpawnShopPortal); NetUtil.Do(PoppyOp.SpawnGoldshoresPortal); NetUtil.Do(PoppyOp.SpawnMSPortal); }); Add("world.freeze", "World", "Freeze match", delegate { WorldModule.FreezeMatch = !WorldModule.FreezeMatch; }); Add("world.freezeTimer", "World", "Freeze run timer", delegate { WorldModule.FreezeTimer = !WorldModule.FreezeTimer; }); Add("esp.enemies", "ESP", "Enemy ESP", delegate { RenderModule.EspMobs = !RenderModule.EspMobs; }); Add("esp.interactables", "ESP", "Interactable ESP", delegate { RenderModule.EspInteractables = !RenderModule.EspInteractables; }); Add("esp.teleporter", "ESP", "Teleporter ESP", delegate { RenderModule.EspTeleporter = !RenderModule.EspTeleporter; }); Add("macro.midgame", "Macros", "Mid-game loadout", delegate { PoppyConsole.Submit("midgame"); }); Add("macro.lategame", "Macros", "End-game loadout", delegate { PoppyConsole.Submit("lategame"); }); Add("macro.dtzoom", "Macros", "Zoom items", delegate { PoppyConsole.Submit("dtzoom"); }); Add("tab.player", "Open tab", "Player tab", delegate { MenuRoot.SelectTabByName("Player"); }); Add("tab.items", "Open tab", "Items tab", delegate { MenuRoot.SelectTabByName("Items"); }); Add("tab.players", "Open tab", "Players tab", delegate { MenuRoot.SelectTabByName("Players"); }); Add("tab.console", "Open tab", "Console tab", delegate { MenuRoot.SelectTabByName("Console"); }); Add("tab.keybinds", "Open tab", "Keybinds tab", delegate { MenuRoot.SelectTabByName("Keybinds"); }); } } internal class Bind { public KeyCode Key; public string ActionId; } internal static class BindStore { internal static List Binds = new List(); private static string FilePath => Path.Combine(Paths.ConfigPath, "PoppyMenu.binds.json"); internal static void Load() { try { if (File.Exists(FilePath)) { Binds = JsonConvert.DeserializeObject>(File.ReadAllText(FilePath)) ?? new List(); } } catch (Exception ex) { Log.Error("Bind load failed: " + ex); Binds = new List(); } } internal static void Save() { try { File.WriteAllText(FilePath, JsonConvert.SerializeObject((object)Binds, (Formatting)1)); } catch (Exception ex) { Log.Error("Bind save failed: " + ex); } } internal static void Add(KeyCode key, string actionId) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) Binds.Add(new Bind { Key = key, ActionId = actionId }); Save(); } internal static void Remove(Bind b) { if (Binds.Remove(b)) { Save(); } } internal static void Clear() { Binds.Clear(); Save(); } internal static KeyCode KeyFor(string actionId) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) foreach (Bind bind in Binds) { if (bind != null && (int)bind.Key != 0 && bind.ActionId == actionId) { return bind.Key; } } return (KeyCode)0; } internal static void Poll() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) if (Rebind.IsActive || MenuRoot.Visible || ListPicker.IsOpen) { return; } for (int i = 0; i < Binds.Count; i++) { Bind bind = Binds[i]; if (bind != null && (int)bind.Key != 0 && Input.GetKeyDown(bind.Key)) { ActionRegistry.RunId(bind.ActionId); } } } } internal static class Catalogs { internal readonly struct ItemEntry { internal readonly ItemIndex Index; internal readonly string Name; internal readonly string Quality; internal readonly ItemTier Tier; internal readonly Color Color; internal ItemEntry(ItemIndex index, string name, string quality, ItemTier tier, Color color) { //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_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: 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) Index = index; Name = name; Quality = quality; Tier = tier; Color = color; } } internal readonly struct EquipEntry { internal readonly EquipmentIndex Index; internal readonly string Name; internal readonly Color Color; internal readonly bool IsLunar; internal readonly bool IsBoss; internal EquipEntry(EquipmentIndex index, string name, Color color, bool isLunar, bool isBoss) { //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_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) Index = index; Name = name; Color = color; IsLunar = isLunar; IsBoss = isBoss; } } internal readonly struct BuffEntry { internal readonly BuffIndex Index; internal readonly string Name; internal readonly bool IsDebuff; internal BuffEntry(BuffIndex index, string name, bool isDebuff) { //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) Index = index; Name = name; IsDebuff = isDebuff; } } internal readonly struct BodyEntry { internal readonly GameObject Prefab; internal readonly string Name; internal BodyEntry(GameObject prefab, string name) { Prefab = prefab; Name = name; } } internal readonly struct SurvivorEntry { internal readonly SurvivorDef Def; internal readonly string Name; internal SurvivorEntry(SurvivorDef def, string name) { Def = def; Name = name; } } internal readonly struct SpawnEntry { internal readonly SpawnCard Card; internal readonly string Name; internal readonly bool IsInteractable; internal SpawnEntry(SpawnCard card, string name, bool isInteractable) { Card = card; Name = name; IsInteractable = isInteractable; } } internal static readonly List Items = new List(); internal static readonly List Equipment = new List(); internal static readonly List Buffs = new List(); internal static readonly List Bodies = new List(); internal static readonly List Survivors = new List(); internal static readonly List SpawnCards = new List(); internal static bool Ready { get; private set; } internal static void Refresh() { BuildItems(); BuildEquipment(); BuildBuffs(); BuildBodies(); BuildSurvivors(); BuildSpawnCards(); Ready = true; Log.Info($"Catalogs: {Items.Count} items, {Equipment.Count} equipment, {Buffs.Count} buffs, " + $"{Bodies.Count} bodies, {Survivors.Count} survivors, {SpawnCards.Count} spawn cards."); } private static string Loc(string token) { if (!string.IsNullOrEmpty(token)) { return Language.GetString(token); } return token; } private static string Sanitize(string s) { if (string.IsNullOrEmpty(s)) { return s; } StringBuilder stringBuilder = new StringBuilder(s.Length); bool flag = false; foreach (char c in s) { switch (c) { case '<': flag = true; continue; case '>': flag = false; continue; } if (!flag) { stringBuilder.Append(c); } } return Regex.Replace(stringBuilder.ToString(), "\\s+", " ").Trim(); } private static string ExtractQuality(string raw) { if (string.IsNullOrEmpty(raw)) { return null; } int num = raw.IndexOf("name=", StringComparison.OrdinalIgnoreCase); if (num < 0) { return null; } num += 5; if (num >= raw.Length) { return null; } char c = ((raw[num] == '"' || raw[num] == '\'') ? raw[num] : '\0'); int num2 = ((c != 0) ? (num + 1) : num); int i; for (i = num2; i < raw.Length; i++) { char c2 = raw[i]; if (c != 0) { if (c2 == c) { break; } } else if (c2 == ' ' || c2 == '>' || c2 == ']' || c2 == '\t') { break; } } if (i <= num2) { return null; } string text = raw.Substring(num2, i - num2); if (text.StartsWith("Quality", StringComparison.OrdinalIgnoreCase)) { text = text.Substring(7); } text = text.Trim(); if (!string.IsNullOrEmpty(text)) { return text; } return null; } private unsafe static void BuildItems() { //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) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) Items.Clear(); AllItemsEnumerator enumerator = ItemCatalog.allItems.GetEnumerator(); try { while (((AllItemsEnumerator)(ref enumerator)).MoveNext()) { ItemIndex current = ((AllItemsEnumerator)(ref enumerator)).Current; ItemDef itemDef = ItemCatalog.GetItemDef(current); if (!((Object)(object)itemDef == (Object)null)) { string text = Loc(itemDef.nameToken); if (string.IsNullOrWhiteSpace(text)) { text = ((Object)itemDef).name; } string text2 = Sanitize(text); if (string.IsNullOrEmpty(text2)) { text2 = ((Object)itemDef).name; } Color color = Color32.op_Implicit(ColorCatalog.GetColor(itemDef.darkColorIndex)); Items.Add(new ItemEntry(current, text2, ExtractQuality(text), itemDef.tier, color)); } } } finally { ((IDisposable)(*(AllItemsEnumerator*)(&enumerator))/*cast due to .constrained prefix*/).Dispose(); } Items.Sort(delegate(ItemEntry a, ItemEntry b) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) int num = TierOrder(a.Tier); int num2 = TierOrder(b.Tier); return (num == num2) ? string.Compare(a.Name, b.Name, StringComparison.OrdinalIgnoreCase) : num.CompareTo(num2); }); } private static int TierOrder(ItemTier tier) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected I4, but got Unknown return (int)tier switch { 0 => 0, 1 => 1, 2 => 2, 4 => 3, 3 => 4, 6 => 5, 7 => 6, 8 => 7, 9 => 8, _ => 99, }; } private unsafe static void BuildEquipment() { //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) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) Equipment.Clear(); AllEquipmentEnumerator enumerator = EquipmentCatalog.allEquipment.GetEnumerator(); try { while (((AllEquipmentEnumerator)(ref enumerator)).MoveNext()) { EquipmentIndex current = ((AllEquipmentEnumerator)(ref enumerator)).Current; EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef(current); if (!((Object)(object)equipmentDef == (Object)null)) { string text = Sanitize(Loc(equipmentDef.nameToken)); if (string.IsNullOrWhiteSpace(text)) { text = ((Object)equipmentDef).name; } Color color = Color32.op_Implicit(ColorCatalog.GetColor(equipmentDef.colorIndex)); Equipment.Add(new EquipEntry(current, text, color, equipmentDef.isLunar, equipmentDef.isBoss)); } } } finally { ((IDisposable)(*(AllEquipmentEnumerator*)(&enumerator))/*cast due to .constrained prefix*/).Dispose(); } Equipment.Sort((EquipEntry a, EquipEntry b) => string.Compare(a.Name, b.Name, StringComparison.OrdinalIgnoreCase)); } private static void BuildBuffs() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) Buffs.Clear(); BuffDef[] buffDefs = BuffCatalog.buffDefs; if (buffDefs == null) { return; } BuffDef[] array = buffDefs; foreach (BuffDef val in array) { if (!((Object)(object)val == (Object)null)) { Buffs.Add(new BuffEntry(val.buffIndex, ((Object)val).name, val.isDebuff)); } } Buffs.Sort((BuffEntry a, BuffEntry b) => string.Compare(a.Name, b.Name, StringComparison.OrdinalIgnoreCase)); } private static void BuildBodies() { Bodies.Clear(); foreach (GameObject allBodyPrefab in BodyCatalog.allBodyPrefabs) { if ((Object)(object)allBodyPrefab == (Object)null) { continue; } string name = ((Object)allBodyPrefab).name; CharacterBody component = allBodyPrefab.GetComponent(); if ((Object)(object)component != (Object)null) { string text = Sanitize(Loc(component.baseNameToken)); if (!string.IsNullOrWhiteSpace(text)) { name = text; } } Bodies.Add(new BodyEntry(allBodyPrefab, name)); } Bodies.Sort((BodyEntry a, BodyEntry b) => string.Compare(a.Name, b.Name, StringComparison.OrdinalIgnoreCase)); } private static void BuildSurvivors() { Survivors.Clear(); foreach (SurvivorDef orderedSurvivorDef in SurvivorCatalog.orderedSurvivorDefs) { if (!((Object)(object)orderedSurvivorDef == (Object)null)) { string text = Loc(orderedSurvivorDef.displayNameToken); if (string.IsNullOrWhiteSpace(text)) { text = orderedSurvivorDef.cachedName; } Survivors.Add(new SurvivorEntry(orderedSurvivorDef, text)); } } } internal static void RefreshSpawnCards() { try { BuildSpawnCards(); } catch (Exception arg) { Log.Error($"RefreshSpawnCards: {arg}"); } } private static void BuildSpawnCards() { SpawnCards.Clear(); SpawnCard[] array = Resources.FindObjectsOfTypeAll(); foreach (SpawnCard val in array) { if (!((Object)(object)val == (Object)null)) { bool isInteractable = val is InteractableSpawnCard; SpawnCards.Add(new SpawnEntry(val, ((Object)val).name, isInteractable)); } } SpawnCards.Sort((SpawnEntry a, SpawnEntry b) => string.Compare(a.Name, b.Name, StringComparison.OrdinalIgnoreCase)); } } internal enum StepKind { Feature, Item, Equipment, Buff, Money, Xp, Lunar, Spawn, Become, Heal, Command, Macro } internal class CustomStep { public StepKind Kind; public string Id = ""; public int Index = -1; public int Amount = 1; public float Duration; public int Team; public string Label = ""; } internal static class Steps { internal static CustomStep Feature(string id) { PoppyAction poppyAction = ActionRegistry.Get(id); return new CustomStep { Kind = StepKind.Feature, Id = id, Label = ((poppyAction != null) ? poppyAction.Name : id) }; } internal static CustomStep Item(int index, int count) { return new CustomStep { Kind = StepKind.Item, Index = index, Amount = count, Label = $"Give {ItemName(index)} x{count}" }; } internal static CustomStep Equipment(int index) { return new CustomStep { Kind = StepKind.Equipment, Index = index, Label = "Equip " + EquipName(index) }; } internal static CustomStep Buff(int index, float duration) { return new CustomStep { Kind = StepKind.Buff, Index = index, Duration = duration, Label = ((duration > 0f) ? $"Buff {BuffName(index)} ({duration:0}s)" : ("Buff " + BuffName(index))) }; } internal static CustomStep Money(int amount) { return new CustomStep { Kind = StepKind.Money, Amount = amount, Label = "Money +" + amount }; } internal static CustomStep Xp(int amount) { return new CustomStep { Kind = StepKind.Xp, Amount = amount, Label = "XP +" + amount }; } internal static CustomStep Lunar(int amount) { return new CustomStep { Kind = StepKind.Lunar, Amount = amount, Label = "Lunar +" + amount }; } internal static CustomStep Spawn(string card, int count, int team, string display) { return new CustomStep { Kind = StepKind.Spawn, Id = card, Amount = count, Team = team, Label = $"Spawn {display} x{count}" }; } internal static CustomStep Become(string body, string display) { return new CustomStep { Kind = StepKind.Become, Id = body, Label = "Become " + display }; } internal static CustomStep Heal(int amount) { return new CustomStep { Kind = StepKind.Heal, Amount = amount, Label = ((amount > 0) ? ("Heal " + amount) : "Heal to full") }; } internal static CustomStep Command(string cmd) { return new CustomStep { Kind = StepKind.Command, Id = cmd, Label = "> " + cmd }; } internal static CustomStep Macro(string name) { return new CustomStep { Kind = StepKind.Macro, Id = name, Label = "Macro: " + name }; } private static string ItemName(int idx) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Invalid comparison between Unknown and I4 foreach (Catalogs.ItemEntry item in Catalogs.Items) { if ((int)item.Index == idx) { return item.Name; } } return "item"; } private static string BuffName(int idx) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Invalid comparison between Unknown and I4 foreach (Catalogs.BuffEntry buff in Catalogs.Buffs) { if ((int)buff.Index == idx) { return buff.Name; } } return "buff"; } private static string EquipName(int idx) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Invalid comparison between Unknown and I4 foreach (Catalogs.EquipEntry item in Catalogs.Equipment) { if ((int)item.Index == idx) { return item.Name; } } return "equipment"; } } internal static class HomeLayoutStore { internal static List Shortcuts = new List(); private static string FilePath => Path.Combine(Paths.ConfigPath, "PoppyMenu.home.json"); internal static void Load() { try { if (File.Exists(FilePath)) { Shortcuts = JsonConvert.DeserializeObject>(File.ReadAllText(FilePath)) ?? new List(); } } catch (Exception ex) { Log.Error("Home layout load failed: " + ex); Shortcuts = new List(); } } internal static void Save() { try { File.WriteAllText(FilePath, JsonConvert.SerializeObject((object)Shortcuts, (Formatting)1)); } catch (Exception ex) { Log.Error("Home layout save failed: " + ex); } } internal static void Add(CustomStep s) { if (s != null) { Shortcuts.Add(s); Save(); } } internal static void Remove(CustomStep s) { if (Shortcuts.Remove(s)) { Save(); } } internal static void MoveUp(int i) { if (i > 0 && i < Shortcuts.Count) { CustomStep value = Shortcuts[i]; Shortcuts[i] = Shortcuts[i - 1]; Shortcuts[i - 1] = value; Save(); } } } internal class Macro { public string Name = "Macro"; public List Steps = new List(); } internal static class MacroStore { internal static List Macros = new List(); private static string FilePath => Path.Combine(Paths.ConfigPath, "PoppyMenu.macros.json"); internal static void Load() { try { if (File.Exists(FilePath)) { Macros = JsonConvert.DeserializeObject>(File.ReadAllText(FilePath)) ?? new List(); } } catch (Exception ex) { Log.Error("Macro load failed: " + ex); Macros = new List(); } } internal static void Save() { try { File.WriteAllText(FilePath, JsonConvert.SerializeObject((object)Macros, (Formatting)1)); } catch (Exception ex) { Log.Error("Macro save failed: " + ex); } } internal static Macro Get(string name) { foreach (Macro macro in Macros) { if (macro != null && macro.Name == name) { return macro; } } return null; } internal static void Run(string name) { Macro macro = Get(name); if (macro == null) { return; } foreach (CustomStep step in macro.Steps) { StepRunner.Run(step); } } } internal static class ModConfig { internal static ConfigEntry ToggleMenuKey; internal static ConfigEntry UiScale; internal static ConfigEntry RequireServerForCheats; internal static ConfigEntry AllowClientCheats; internal static ConfigEntry ShowHud; internal static ConfigEntry WindowX; internal static ConfigEntry WindowY; internal static ConfigEntry WindowW; internal static ConfigEntry WindowH; internal static ConfigEntry SilentAimKey; internal static ConfigEntry AccentR; internal static ConfigEntry AccentG; internal static ConfigEntry AccentB; internal static ConfigEntry GiveMoneyAmount; internal static ConfigEntry GiveXpAmount; internal static ConfigEntry GiveCoinsAmount; internal static ConfigEntry FlightSpeed; internal static void Init(ConfigFile cfg) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected O, but got Unknown //IL_01ba: Unknown result type (might be due to invalid IL or missing references) ToggleMenuKey = cfg.Bind("General", "ToggleMenuKey", (KeyCode)277, "Opens/closes the Poppy menu."); UiScale = cfg.Bind("General", "UiScale", 1f, new ConfigDescription("Menu scale.", (AcceptableValueBase)(object)new AcceptableValueRange(0.6f, 2f), Array.Empty())); RequireServerForCheats = cfg.Bind("General", "RequireServerForCheats", false, "When true, server-side actions are skipped on non-host clients instead of being requested over the network."); AllowClientCheats = cfg.Bind("General", "AllowClientCheats", false, "HOST ONLY: when OFF (default), commands from other clients are ignored, so nobody can use this menu in your game without your permission. Turn ON only if you trust everyone in the lobby."); ShowHud = cfg.Bind("General", "ShowActiveEffectsHud", true, "Show a small active-effects HUD when the menu is closed."); WindowX = cfg.Bind("General", "WindowX", 40f, "Remembered menu window X position."); WindowY = cfg.Bind("General", "WindowY", 60f, "Remembered menu window Y position."); WindowW = cfg.Bind("General", "WindowW", 540f, "Remembered menu window width."); WindowH = cfg.Bind("General", "WindowH", 600f, "Remembered menu window height."); SilentAimKey = cfg.Bind("Hotkeys", "SilentAimHoldKey", (KeyCode)0, "Hold-to-aim key. If set, Silent Aim only acts while this key is held (rebind in the Aimbot tab)."); AccentR = cfg.Bind("Theme", "AccentR", 0.898f, "Menu accent color, red channel (0-1)."); AccentG = cfg.Bind("Theme", "AccentG", 0.219f, "Menu accent color, green channel (0-1)."); AccentB = cfg.Bind("Theme", "AccentB", 0.29f, "Menu accent color, blue channel (0-1)."); Theme.ApplyAccent(new Color(AccentR.Value, AccentG.Value, AccentB.Value)); GiveMoneyAmount = cfg.Bind("Tunables", "GiveMoneyAmount", 1000, "Gold granted per 'Give Money' click."); GiveXpAmount = cfg.Bind("Tunables", "GiveXpAmount", 100, "Experience granted per 'Give XP' click."); GiveCoinsAmount = cfg.Bind("Tunables", "GiveCoinsAmount", 10, "Lunar coins granted per 'Give Coins' click."); FlightSpeed = cfg.Bind("Tunables", "FlightSpeed", 40f, "Flight movement speed."); } } internal static class PlayerContext { internal static NetworkUser User; internal static CharacterMaster Master; internal static CharacterBody Body; internal static Inventory Inventory; internal static HealthComponent Health; internal static SkillLocator Skills; internal static CharacterMotor Motor; internal static InputBankTest InputBank; internal static bool InGame => (Object)(object)Run.instance != (Object)null; internal static bool HasBody { get { if ((Object)(object)Master != (Object)null) { return (Object)(object)Body != (Object)null; } return false; } } internal static void Refresh() { User = null; Master = null; Body = null; Inventory = null; Health = null; Skills = null; Motor = null; InputBank = null; if (!InGame) { return; } foreach (NetworkUser readOnlyLocalPlayers in NetworkUser.readOnlyLocalPlayersList) { if ((Object)(object)readOnlyLocalPlayers == (Object)null) { continue; } User = readOnlyLocalPlayers; Master = readOnlyLocalPlayers.master; if (!((Object)(object)Master == (Object)null)) { Body = Master.GetBody(); if (!((Object)(object)Body == (Object)null)) { Inventory = Master.inventory; Health = Body.healthComponent; Skills = Body.skillLocator; Motor = ((Component)Body).GetComponent(); InputBank = ((Component)Body).GetComponent(); break; } } } } internal static Ray AimRay() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)InputBank != (Object)null) { return new Ray(InputBank.aimOrigin, InputBank.aimDirection); } Camera main = Camera.main; if (!((Object)(object)main != (Object)null)) { return default(Ray); } return main.ScreenPointToRay(new Vector3((float)Screen.width / 2f, (float)Screen.height / 2f)); } } internal class PoppyAction { internal readonly string Id; internal readonly string Category; internal readonly string Name; internal readonly Action Invoke; internal PoppyAction(string id, string category, string name, Action invoke) { Id = id; Category = category; Name = name; Invoke = invoke; } } internal class PoppyController : MonoBehaviour { private readonly List _modules = new List(); private readonly List _groups = new List(); private bool _catalogsTried; private string _lastScene; private bool _pendingAutoApply; private static string ActiveScene() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) Scene activeScene = SceneManager.GetActiveScene(); return ((Scene)(ref activeScene)).name; } private void Awake() { _groups.Add(new TabGroup("Home", new HomeModule())); _groups.Add(new TabGroup("Player", new PlayerModule(), new AimbotModule(), new StatsModule(), new MovementModule())); _groups.Add(new TabGroup("Items", new ItemsModule())); _groups.Add(new TabGroup("Character", new CharacterModule())); _groups.Add(new TabGroup("World", new WorldModule(), new SpawnModule(), new RunModule(), new TeleporterModule())); _groups.Add(new TabGroup("Players", new PlayersModule())); _groups.Add(new TabGroup("Visuals", new RenderModule())); _groups.Add(new TabGroup("Console", new ConsoleModule())); _groups.Add(new TabGroup("Settings", new SettingsModule(), new KeybindsModule(), new PresetsModule(), new MacrosModule())); foreach (TabGroup group in _groups) { _modules.AddRange(group.Pages); } CharacterBody.onBodyStartGlobal += OnBodyStart; ((Component)this).gameObject.AddComponent(); } private void OnBodyStart(CharacterBody body) { if (!((Object)(object)body == (Object)null)) { NetworkUser val = Util.LookUpBodyNetworkUser(body); if ((Object)(object)val != (Object)null && NetworkUser.readOnlyLocalPlayersList.Contains(val)) { _pendingAutoApply = true; } } } private void Update() { PlayerContext.Refresh(); if (PlayerContext.InGame) { if (!Catalogs.Ready && !_catalogsTried) { _catalogsTried = true; try { Catalogs.Refresh(); } catch (Exception data) { Log.Error(data); } _lastScene = ActiveScene(); } else if (Catalogs.Ready) { string text = ActiveScene(); if (text != _lastScene) { _lastScene = text; try { Catalogs.RefreshSpawnCards(); } catch (Exception data2) { Log.Error(data2); } } } } NetUtil.TickGuards(); Rebind.Poll(); if (Rebind.IsActive && !MenuRoot.Visible) { Rebind.Cancel(); } if (!PlayerContext.InGame) { WorldModule.RestoreTime(); } if (_pendingAutoApply && PlayerContext.HasBody) { _pendingAutoApply = false; try { PresetStore.ApplyStartupPresets(); PresetStore.ApplyAutoPresets(); } catch (Exception data3) { Log.Error(data3); } } HandleHotkeys(); InputCapture.Sync(MenuRoot.Visible || ListPicker.IsOpen); if (!PlayerContext.InGame) { return; } foreach (PoppyModule module in _modules) { try { module.Tick(); } catch (Exception arg) { Log.Error($"{module.Name}.Tick: {arg}"); } } } private void HandleHotkeys() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) if (Rebind.IsActive) { return; } if (Input.GetKeyDown(ModConfig.ToggleMenuKey.Value)) { MenuRoot.Visible = !MenuRoot.Visible; if (!MenuRoot.Visible) { ListPicker.Close(); MenuRoot.SaveLayout(); } } BindStore.Poll(); } private void OnGUI() { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) Theme.EnsureInit(); if (PlayerContext.InGame) { foreach (PoppyModule module in _modules) { try { module.DrawOverlay(); } catch { } } } Notify.Draw(); GUI.matrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, Vector3.one * ModConfig.UiScale.Value); MenuRoot.Draw(_groups); } private void LateUpdate() { if (MenuRoot.Visible || ListPicker.IsOpen) { Cursor.lockState = (CursorLockMode)0; } } private void OnDestroy() { CharacterBody.onBodyStartGlobal -= OnBodyStart; MenuRoot.Visible = false; ListPicker.Close(); try { InputCapture.Shutdown(); } catch { } try { Aim.Shutdown(); } catch { } try { Safety.Shutdown(); } catch { } try { ConsoleCommands.Shutdown(); } catch { } foreach (PoppyModule module in _modules) { try { module.OnUnload(); } catch { } } } } [BepInPlugin("com.poppy.poppymenu", "Poppy Menu", "2.2.3")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class PoppyPlugin : BaseUnityPlugin { internal const string Guid = "com.poppy.poppymenu"; internal const string Version = "2.2.3"; internal static PoppyPlugin Instance { get; private set; } private void Awake() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0078: Unknown result type (might be due to invalid IL or missing references) Instance = this; Log.Init(((BaseUnityPlugin)this).Logger); ModConfig.Init(((BaseUnityPlugin)this).Config); NetUtil.Init(); InputCapture.Init(); Aim.Init(); Safety.Init(); ConsoleCommands.Init(); PresetStore.Load(); BindStore.Load(); MacroStore.Load(); HomeLayoutStore.Load(); GameObject val = new GameObject("PoppyMenu"); Object.DontDestroyOnLoad((Object)(object)val); ((Object)val).hideFlags = (HideFlags)61; val.AddComponent(); Log.Message(string.Format("Poppy Menu v{0} loaded. Press {1} to open.", "2.2.3", ModConfig.ToggleMenuKey.Value)); } } internal class Preset { public string Name = "New Preset"; public bool AutoApplyOnSpawn; public bool LoadOnStartup; public bool God; public bool Skills; public bool Flight; public bool Sprint; public bool JumpPack; public bool NoEquipCd; public bool SilentAim; public bool EspMobs; public bool EspInteractables; public bool EspTeleporter; public bool DmgOn; public bool AtkOn; public bool MoveOn; public bool ArmorOn; public bool CritOn; public bool HpOn; public float DmgMul = 1f; public float AtkMul = 1f; public float MoveMul = 1f; public float ArmorMul = 1f; public float CritMul = 1f; public float HpMul = 1f; public List Items = new List(); public List Equipment = new List(); public bool GiveAllItems; public int Money; public int Xp; public int Coins; } internal class GrantItem { public string Name; public string Display; public int Count = 1; } internal static class PresetStore { internal static List Presets = new List(); private static bool _startupDone; private static string FilePath => Path.Combine(Paths.ConfigPath, "PoppyMenu.presets.json"); internal static void Load() { try { if (File.Exists(FilePath)) { Presets = JsonConvert.DeserializeObject>(File.ReadAllText(FilePath)) ?? new List(); } } catch (Exception ex) { Log.Error("Preset load failed: " + ex); Presets = new List(); } } internal static void Save() { try { File.WriteAllText(FilePath, JsonConvert.SerializeObject((object)Presets, (Formatting)1)); } catch (Exception ex) { Log.Error("Preset save failed: " + ex); } } internal static Preset AddFromCurrent(string name) { Preset preset = Cheats.Capture(string.IsNullOrWhiteSpace(name) ? ("Preset " + (Presets.Count + 1)) : name.Trim()); Presets.Add(preset); Save(); return preset; } internal static void Delete(Preset p) { if (p != null && Presets.Remove(p)) { Save(); } } internal static void ApplyAutoPresets() { foreach (Preset preset in Presets) { if (preset != null && preset.AutoApplyOnSpawn) { Cheats.Apply(preset); } } } internal static void ApplyStartupPresets() { if (_startupDone) { return; } _startupDone = true; foreach (Preset preset in Presets) { if (preset != null && preset.LoadOnStartup) { Cheats.Apply(preset); } } } } internal class TabGroup { internal readonly string Name; internal readonly List Pages; internal int Page; internal TabGroup(string name, params PoppyModule[] pages) { Name = name; Pages = new List(pages); } } internal class AimbotModule : PoppyModule { private static readonly string[] Priorities = new string[4] { "Closest to Crosshair", "Closest Distance", "Lowest HP", "Highest HP" }; internal override string Name => "Aimbot"; internal override void Tick() { Aim.Tick(); } internal override void DrawOverlay() { Aim.DrawOverlay(); } internal override void DrawMenu() { //IL_0019: 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_004d: Unknown result type (might be due to invalid IL or missing references) Widgets.SectionBegin("Aimbot"); Aim.Enabled = Widgets.Toggle("Enable Aimbot", Aim.Enabled, ModConfig.SilentAimKey.Value); Widgets.KeybindRow("Aim Hold Key", ModConfig.SilentAimKey); Widgets.Hint(((int)ModConfig.SilentAimKey.Value == 0) ? "No hold key, so it's on whenever it's enabled. Click the box and press a key or mouse button." : $"Only active while you hold [{ModConfig.SilentAimKey.Value}]. X clears it."); Widgets.Hint("Silent aim. Your shots go to the target, your camera never moves."); Widgets.SectionEnd(); Widgets.SectionBegin("Targeting"); int num = Mathf.Clamp(Aim.Sorting, 0, Priorities.Length - 1); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label("Priority: " + Priorities[num], Theme.Label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); if (GUILayout.Button("<", Theme.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(28f) })) { Aim.Sorting = (num + Priorities.Length - 1) % Priorities.Length; } if (GUILayout.Button(">", Theme.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(28f) })) { Aim.Sorting = (num + 1) % Priorities.Length; } GUILayout.EndHorizontal(); Aim.PrioritizeBosses = Widgets.Toggle("Prioritize Bosses", Aim.PrioritizeBosses); Aim.Sticky = Widgets.Toggle("Sticky Target", Aim.Sticky); Widgets.Hint("Keeps one target until it dies or leaves range."); Aim.RequireLoS = Widgets.Toggle("Require Line of Sight", Aim.RequireLoS); Aim.MaxRange = Widgets.Slider("Max Range", Aim.MaxRange, 20f, 600f); Aim.UseFov = Widgets.Toggle("Limit to FOV cone", Aim.UseFov); if (Aim.UseFov) { Aim.Fov = Widgets.Slider("FOV (deg)", Aim.Fov, 1f, 180f); } Widgets.SectionEnd(); Widgets.SectionBegin("Projectiles"); Widgets.Hint("Your projectiles automatically curve onto the locked target. Host or solo."); Aim.MagicBullet = Widgets.Toggle("Magic Bullet (shoot through walls)", Aim.MagicBullet); Widgets.Hint("Your shots pass through walls. Enemies don't. Host or solo."); Widgets.SectionEnd(); Widgets.SectionBegin("Visuals"); Aim.Highlight = Widgets.Toggle("Highlight Target", Aim.Highlight); Aim.ShowFovCircle = Widgets.Toggle("Show FOV Circle", Aim.ShowFovCircle); Widgets.SectionEnd(); } } internal class CharacterModule : PoppyModule { internal override string Name => "Character"; internal override void DrawMenu() { //IL_0060: Unknown result type (might be due to invalid IL or missing references) Widgets.SectionBegin("Change Character"); Widgets.Hint("Respawns you here as whatever you pick. Survivors and monsters both."); List list = new List(Catalogs.Bodies.Count); foreach (Catalogs.BodyEntry body in Catalogs.Bodies) { if (!((Object)(object)body.Prefab == (Object)null)) { Catalogs.BodyEntry e = body; list.Add(new ListPicker.Row(e.Name, Color.white, delegate { //IL_0013: 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_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) Vector3 val = (PlayerContext.HasBody ? PlayerContext.Body.footPosition : Vector3.zero); NetUtil.Do(PoppyOp.ChangeBody, 0, 0, val.x, val.y, val.z, b1: false, ((Object)e.Prefab).name); })); } } Widgets.PickerButton("Change Character / Play As...", "Bodies", list); Widgets.SectionEnd(); } } internal class ConsoleModule : PoppyModule { private static string _input = ""; private static string _filter = ""; private static Vector2 _logScroll; internal override string Name => "Console"; internal override void DrawMenu() { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Invalid comparison between Unknown and I4 //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Invalid comparison between Unknown and I4 Widgets.SectionBegin("Console"); Widgets.Hint("Type a command and hit Run. Unknown ones fall through to the game console. Type help for the list."); GUILayout.BeginHorizontal(Array.Empty()); GUI.SetNextControlName("poppyConsoleInput"); _input = GUILayout.TextField(_input ?? "", Theme.Search, Array.Empty()); if (Widgets.Button("Run")) { Submit(); } GUILayout.EndHorizontal(); if ((int)Event.current.type == 4 && (int)Event.current.keyCode == 13 && GUI.GetNameOfFocusedControl() == "poppyConsoleInput") { Submit(); Event.current.Use(); } _logScroll = GUILayout.BeginScrollView(_logScroll, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(220f) }); foreach (string item in PoppyConsole.History) { GUILayout.Label(item, Theme.Hint, Array.Empty()); } GUILayout.EndScrollView(); if (Widgets.Button("Clear log")) { PoppyConsole.History.Clear(); } Widgets.SectionEnd(); Widgets.SectionBegin("Command reference"); _filter = GUILayout.TextField(_filter ?? "", Theme.Search, Array.Empty()); foreach (string item2 in PoppyConsole.CommandList()) { if (string.IsNullOrEmpty(_filter) || item2.IndexOf(_filter, StringComparison.OrdinalIgnoreCase) >= 0) { GUILayout.Label(item2, Theme.Hint, Array.Empty()); } } Widgets.SectionEnd(); } private static void Submit() { if (!string.IsNullOrWhiteSpace(_input)) { PoppyConsole.Submit(_input); _input = ""; _logScroll.y = float.MaxValue; } } } internal class HomeModule : PoppyModule { private static string _query = ""; private static bool _customizing; private const StringComparison OIC = StringComparison.OrdinalIgnoreCase; internal override string Name => "Home"; internal override void DrawMenu() { DrawSearch(); DrawShortcuts(); Widgets.SectionBegin("Quick Toggles"); PlayerModule.GodMode = Widgets.Toggle("God Mode", PlayerModule.GodMode); MovementModule.Flight = Widgets.Toggle("Flight", MovementModule.Flight); MovementModule.AlwaysSprint = Widgets.Toggle("Always Sprint", MovementModule.AlwaysSprint); PlayerModule.InfiniteSkills = Widgets.Toggle("Infinite Skills", PlayerModule.InfiniteSkills); Aim.Enabled = Widgets.Toggle("Aimbot", Aim.Enabled); ItemsModule.NoEquipmentCooldown = Widgets.Toggle("No Equipment Cooldown", ItemsModule.NoEquipmentCooldown); bool flag = RenderModule.EspMobs || RenderModule.EspInteractables || RenderModule.EspTeleporter; bool flag2 = Widgets.Toggle("ESP (all)", flag); if (flag2 != flag) { RenderModule.EspMobs = (RenderModule.EspInteractables = (RenderModule.EspTeleporter = flag2)); } Widgets.SectionEnd(); Widgets.SectionBegin("Give"); ModConfig.GiveMoneyAmount.Value = Widgets.IntStepper("Money", ModConfig.GiveMoneyAmount.Value, 1000, 0, 1000000000); ModConfig.GiveXpAmount.Value = Widgets.IntStepper("XP", ModConfig.GiveXpAmount.Value, 100, 0, 1000000000); ModConfig.GiveCoinsAmount.Value = Widgets.IntStepper("Coins", ModConfig.GiveCoinsAmount.Value, 5, 0, 100000); Widgets.Button("Give Money", delegate { NetUtil.Do(PoppyOp.GiveMoney, ModConfig.GiveMoneyAmount.Value); }); Widgets.Button("Give XP", delegate { NetUtil.Do(PoppyOp.GiveXp, ModConfig.GiveXpAmount.Value); }); Widgets.Button("Give Lunar Coins", delegate { NetUtil.Do(PoppyOp.GiveLunar, ModConfig.GiveCoinsAmount.Value); }); Widgets.SectionEnd(); Widgets.SectionBegin("Quick Actions"); Widgets.PrimaryButton("Give All Items", delegate { NetUtil.Do(PoppyOp.GiveAllItems, 0, 1); }); Widgets.Button("Heal to Full", delegate { NetUtil.Do(PoppyOp.HealFull); }); Widgets.Button("Respawn", delegate { NetUtil.Do(PoppyOp.Respawn); }); Widgets.Button("Instant Charge Teleporter", delegate { NetUtil.Do(PoppyOp.ChargeTeleporter); }); Widgets.Button("Kill All Enemies", delegate { NetUtil.Do(PoppyOp.KillAllEnemies); }); Widgets.ConfirmButton("home.clearinv", "Clear Inventory", delegate { NetUtil.Do(PoppyOp.ClearInventory); }); Widgets.SectionEnd(); List list = MenuRoot.ActiveEffects(); Widgets.SectionBegin("Status"); Widgets.Hint((list.Count > 0) ? ("Active: " + string.Join(", ", list)) : "No effects active."); if (list.Count > 0) { Widgets.DangerButton("Disable All", Cheats.DisableAll); } Widgets.SectionEnd(); } private unsafe static void DrawSearch() { //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Expected I4, but got Unknown //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Expected I4, but got Unknown Widgets.SectionBegin("Search"); _query = GUILayout.TextField(_query ?? "", Theme.Search, Array.Empty()); string text = (_query ?? "").Trim(); if (text.Length == 0) { Widgets.Hint("Find any feature or item, run it, or pin it to Home."); Widgets.SectionEnd(); return; } int num = 0; foreach (PoppyAction item in ActionRegistry.All) { if (num >= 10) { break; } if (item.Name.IndexOf(text, StringComparison.OrdinalIgnoreCase) >= 0 || item.Category.IndexOf(text, StringComparison.OrdinalIgnoreCase) >= 0) { string id = item.Id; KeyCode val = BindStore.KeyFor(id); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(item.Category + ": " + item.Name + (((int)val != 0) ? (" [" + ((object)(*(KeyCode*)(&val))/*cast due to .constrained prefix*/).ToString() + "]") : ""), Theme.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) })) { ActionRegistry.RunId(id); } if (GUILayout.Button("Pin", Theme.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(52f) })) { HomeLayoutStore.Add(Steps.Feature(id)); } GUILayout.EndHorizontal(); num++; } } int num2 = 0; HashSet hashSet = new HashSet(); foreach (Catalogs.ItemEntry item2 in Catalogs.Items) { if (num2 >= 8) { break; } if (item2.Name.IndexOf(text, StringComparison.OrdinalIgnoreCase) >= 0 && hashSet.Add(item2.Name)) { Catalogs.ItemEntry itemEntry = item2; GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button("Give: " + itemEntry.Name, Theme.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) })) { NetUtil.Do(PoppyOp.GiveItem, (int)itemEntry.Index, ItemsModule.GiveCount); } if (GUILayout.Button("Pin", Theme.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(52f) })) { HomeLayoutStore.Add(Steps.Item((int)itemEntry.Index, ItemsModule.GiveCount)); } GUILayout.EndHorizontal(); num2++; } } if (num == 0 && num2 == 0) { Widgets.Hint("No matches."); } Widgets.SectionEnd(); } private static void DrawShortcuts() { Widgets.SectionBegin("My Shortcuts"); List shortcuts = HomeLayoutStore.Shortcuts; if (shortcuts.Count == 0) { Widgets.Hint("Pin things from search above, or turn on Customize to add any item, buff, spawn, macro, and more."); } for (int i = 0; i < shortcuts.Count; i++) { CustomStep customStep = shortcuts[i]; int i2 = i; GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(customStep.Label, Theme.Primary, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) })) { StepRunner.Run(customStep); } if (GUILayout.Button("^", Theme.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(26f) })) { HomeLayoutStore.MoveUp(i2); break; } if (GUILayout.Button("X", Theme.Danger_, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(26f) })) { HomeLayoutStore.Remove(customStep); break; } GUILayout.EndHorizontal(); } _customizing = Widgets.Toggle("Customize (add anything)", _customizing); if (_customizing) { StepBuilder.Draw(delegate(CustomStep s) { HomeLayoutStore.Add(s); }); } Widgets.SectionEnd(); } } internal class ItemsModule : PoppyModule { internal static bool NoEquipmentCooldown; internal static int GiveCount = 1; internal override string Name => "Items"; internal override void DrawMenu() { //IL_0092: Unknown result type (might be due to invalid IL or missing references) Widgets.SectionBegin("Give"); GiveCount = Widgets.IntStepper("Count", GiveCount, 1, 1, 1000); Widgets.Button("Give Item...", delegate { ItemPicker.Open("Items", delegate(ItemIndex idx) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected I4, but got Unknown NetUtil.Do(PoppyOp.GiveItem, (int)idx, GiveCount); }); }); List list = new List(Catalogs.Equipment.Count); foreach (Catalogs.EquipEntry item in Catalogs.Equipment) { Catalogs.EquipEntry e = item; list.Add(new ListPicker.Row(e.Name, e.Color, delegate { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected I4, but got Unknown NetUtil.Do(PoppyOp.GiveEquipment, (int)e.Index); })); } Widgets.PickerButton("Give Equipment...", "Equipment", list); Widgets.Button($"Give All Items (x{GiveCount})", delegate { NetUtil.Do(PoppyOp.GiveAllItems, 0, GiveCount); }); Widgets.SectionEnd(); Widgets.SectionBegin("Inventory"); Widgets.Button("Stack (Shrine of Order)", delegate { NetUtil.Do(PoppyOp.StackInventory); }); Widgets.Button("Reroll Items", delegate { NetUtil.Do(PoppyOp.RollItems); }); Widgets.Button("Undo Last Item Change", delegate { NetUtil.Do(PoppyOp.UndoInventory); }); NoEquipmentCooldown = Widgets.Toggle("No Equipment Cooldown", NoEquipmentCooldown); Widgets.ConfirmButton("items.clearinv", "Clear Inventory", delegate { NetUtil.Do(PoppyOp.ClearInventory); }); Widgets.SectionEnd(); } internal override void Tick() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Invalid comparison between Unknown and I4 if (!NoEquipmentCooldown || !NetUtil.IsServer || !PlayerContext.HasBody) { return; } EquipmentSlot equipmentSlot = PlayerContext.Body.equipmentSlot; if (!((Object)(object)equipmentSlot == (Object)null) && (int)equipmentSlot.equipmentIndex != -1) { int num = ((equipmentSlot.maxStock <= 0) ? 1 : equipmentSlot.maxStock); if (equipmentSlot.stock < num) { equipmentSlot.stock = num; } } } } internal class KeybindsModule : PoppyModule { internal override string Name => "Keybinds"; internal override void DrawMenu() { //IL_00de: Unknown result type (might be due to invalid IL or missing references) Widgets.SectionBegin("Add a keybind"); Widgets.Hint("Pick any feature, then press the key or mouse button you want. Bindings fire while the menu is closed."); Widgets.PickerButton("Bind a feature...", "Pick a feature", ActionRows()); if (Rebind.IsActive) { Widgets.Hint("Now press a key or button. Esc cancels."); } Widgets.SectionEnd(); Widgets.SectionBegin("Your keybinds"); if (BindStore.Binds.Count == 0) { Widgets.Hint("Nothing bound yet."); } for (int num = BindStore.Binds.Count - 1; num >= 0; num--) { Bind bind = BindStore.Binds[num]; PoppyAction poppyAction = ActionRegistry.Get(bind.ActionId); string text = ((poppyAction != null) ? (poppyAction.Category + ": " + poppyAction.Name) : bind.ActionId); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(text, Theme.Label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); Bind captured = bind; if (GUILayout.Button(((int)bind.Key == 0) ? "set key" : ((object)Unsafe.As(ref bind.Key)/*cast due to .constrained prefix*/).ToString(), Theme.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(120f) })) { Rebind.Capture((Action)delegate(KeyCode kc) { //IL_0006: 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) captured.Key = kc; BindStore.Save(); }); } if (GUILayout.Button("X", Theme.Danger_, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(28f) })) { BindStore.Remove(bind); } GUILayout.EndHorizontal(); } if (BindStore.Binds.Count > 0) { Widgets.ConfirmButton("keybinds.clear", "Clear all keybinds", BindStore.Clear); } Widgets.SectionEnd(); } private static List ActionRows() { //IL_005d: 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) List list = new List(ActionRegistry.All.Count + MacroStore.Macros.Count); foreach (PoppyAction item in ActionRegistry.All) { PoppyAction act = item; list.Add(new ListPicker.Row(act.Category + ": " + act.Name, Color.white, delegate { Rebind.Capture((Action)delegate(KeyCode kc) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) BindStore.Add(kc, act.Id); }); })); } foreach (Macro macro2 in MacroStore.Macros) { Macro macro = macro2; list.Add(new ListPicker.Row("Macro: " + macro.Name, Color.yellow, delegate { Rebind.Capture((Action)delegate(KeyCode kc) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) BindStore.Add(kc, "macro:" + macro.Name); }); })); } return list; } } internal class MacrosModule : PoppyModule { private static string _newName = ""; private static int _expanded = -1; private static Macro _pendingDelete; internal override string Name => "Macros"; internal unsafe override void DrawMenu() { //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) Widgets.SectionBegin("Macros"); Widgets.Hint("A macro runs several custom actions at once. Add any items, buffs, currency, spawns, or features, then bind it to a key or pin it on Home."); GUILayout.BeginHorizontal(Array.Empty()); _newName = GUILayout.TextField(_newName ?? "", Theme.Search, Array.Empty()); if (GUILayout.Button("+ New Macro", Theme.Primary, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(110f) })) { string name = (string.IsNullOrWhiteSpace(_newName) ? ("Macro " + (MacroStore.Macros.Count + 1)) : _newName.Trim()); MacroStore.Macros.Add(new Macro { Name = name }); MacroStore.Save(); _newName = ""; _expanded = MacroStore.Macros.Count - 1; } GUILayout.EndHorizontal(); Widgets.SectionEnd(); if (MacroStore.Macros.Count == 0) { Widgets.Label("No macros yet. Name one above and click + New Macro."); return; } for (int i = 0; i < MacroStore.Macros.Count; i++) { Macro macro = MacroStore.Macros[i]; Widgets.SectionBegin(null); GUILayout.BeginHorizontal(Array.Empty()); string text = GUILayout.TextField(macro.Name ?? "", Theme.Search, Array.Empty()); if (text != macro.Name) { macro.Name = text; MacroStore.Save(); } if (GUILayout.Button((_expanded == i) ? "v Edit" : "> Edit", Theme.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(64f) })) { _expanded = ((_expanded == i) ? (-1) : i); } GUILayout.EndHorizontal(); KeyCode val = BindStore.KeyFor("macro:" + macro.Name); Widgets.Hint(macro.Steps.Count + ((macro.Steps.Count == 1) ? " step" : " steps") + (((int)val != 0) ? (" bound to [" + ((object)(*(KeyCode*)(&val))/*cast due to .constrained prefix*/).ToString() + "]") : "")); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button("Run now", Theme.Primary, Array.Empty())) { MacroStore.Run(macro.Name); } Macro bindTarget = macro; if (GUILayout.Button("Bind key", Theme.Button, Array.Empty())) { Rebind.Capture((Action)delegate(KeyCode kc) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) BindStore.Add(kc, "macro:" + bindTarget.Name); }); } GUILayout.EndHorizontal(); if (Rebind.IsActive) { Widgets.Hint("Press a key or button to bind this macro. Esc cancels."); } if (_expanded == i) { DrawEditor(macro); } Widgets.SectionEnd(); } if (_pendingDelete != null) { MacroStore.Macros.Remove(_pendingDelete); MacroStore.Save(); _pendingDelete = null; _expanded = -1; } } private static void DrawEditor(Macro m) { Widgets.Header("Steps (run top to bottom)"); StepBuilder.Draw(delegate(CustomStep s) { m.Steps.Add(s); MacroStore.Save(); }); for (int num = 0; num < m.Steps.Count; num++) { int index = num; GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(num + 1 + ". " + m.Steps[num].Label, Theme.Label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); if (GUILayout.Button("X", Theme.Danger_, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(28f) })) { m.Steps.RemoveAt(index); MacroStore.Save(); break; } GUILayout.EndHorizontal(); } if (m.Steps.Count == 0) { Widgets.Hint("No steps yet. Use the buttons above to add any item, buff, spawn, feature, and more."); } Widgets.Separator(); Widgets.ConfirmButton("macro.delete." + m.Name, "Delete this macro", delegate { _pendingDelete = m; }); } } internal class MovementModule : PoppyModule { internal static bool Flight; internal static bool NoClip; internal static bool AlwaysSprint; internal static bool JumpPack; private bool _gravityOff; private bool _collisionsDisabled; private KinematicCharacterMotor _kcm; private CharacterBody _lastBody; internal override string Name => "Move"; internal static void ToggleFlight() { Flight = !Flight; } internal static void ToggleSprint() { AlwaysSprint = !AlwaysSprint; } internal static void ToggleNoClip() { NoClip = !NoClip; } internal override void Tick() { //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: 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_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) if (!PlayerContext.InGame || !PlayerContext.HasBody) { return; } CharacterMotor motor = PlayerContext.Motor; CharacterBody body = PlayerContext.Body; if ((Object)(object)body != (Object)(object)_lastBody) { _lastBody = body; _kcm = ((Component)body).GetComponent(); _collisionsDisabled = false; _gravityOff = false; } if ((Object)(object)_kcm != (Object)null && NoClip != _collisionsDisabled) { SetCollisions(!NoClip); _collisionsDisabled = NoClip; } bool flag = Flight || NoClip; if (flag && (Object)(object)motor != (Object)null) { motor.useGravity = false; motor.disableAirControlUntilCollision = false; _gravityOff = true; Vector3 val = Vector3.zero; Camera main = Camera.main; if ((Object)(object)main != (Object)null && !InputCapture.Active) { Vector3 forward = ((Component)main).transform.forward; forward.y = 0f; ((Vector3)(ref forward)).Normalize(); Vector3 right = ((Component)main).transform.right; right.y = 0f; ((Vector3)(ref right)).Normalize(); val = forward * Input.GetAxisRaw("Vertical") + right * Input.GetAxisRaw("Horizontal"); if (Input.GetKey((KeyCode)32)) { val.y += 1f; } if (Input.GetKey((KeyCode)306)) { val.y -= 1f; } } if (((Vector3)(ref val)).sqrMagnitude > 0.01f) { if (((Vector3)(ref val)).sqrMagnitude > 1f) { ((Vector3)(ref val)).Normalize(); } motor.velocity = val * ModConfig.FlightSpeed.Value; } else { motor.velocity = Vector3.Lerp(motor.velocity, Vector3.zero, 12f * Time.deltaTime); } } else if ((Object)(object)motor != (Object)null && _gravityOff) { motor.useGravity = true; _gravityOff = false; } if (AlwaysSprint && (Object)(object)body != (Object)null) { body.isSprinting = true; } if (JumpPack && (Object)(object)motor != (Object)null && !InputCapture.Active && Input.GetKeyDown((KeyCode)32) && !flag) { Vector3 velocity = motor.velocity; velocity.y = 40f; motor.velocity = velocity; } } private void SetCollisions(bool on) { if (!((Object)(object)_kcm == (Object)null)) { _kcm.SetCapsuleCollisionsActivation(on); _kcm.SetMovementCollisionsSolvingActivation(on); _kcm.SetGroundSolvingActivation(on); } } internal override void OnUnload() { if ((Object)(object)_kcm != (Object)null && _collisionsDisabled) { SetCollisions(on: true); } if ((Object)(object)PlayerContext.Motor != (Object)null && _gravityOff) { PlayerContext.Motor.useGravity = true; } } internal override void DrawMenu() { Widgets.SectionBegin("Movement"); Flight = Widgets.Toggle("Flight", Flight); NoClip = Widgets.Toggle("No-Clip (fly through walls)", NoClip); AlwaysSprint = Widgets.Toggle("Always Sprint", AlwaysSprint); JumpPack = Widgets.Toggle("Jump Pack", JumpPack); ModConfig.FlightSpeed.Value = Widgets.Slider("Fly Speed", ModConfig.FlightSpeed.Value, 5f, 150f); Widgets.Hint("Fly: WASD move, Space up, Left Ctrl down. You can still aim and fire while flying."); Widgets.SectionEnd(); } } internal class PlayerModule : PoppyModule { internal static bool GodMode; internal static bool InfiniteSkills; private static int _heal = 500; private static int _hurt = 100; private static float _buffDuration; internal override string Name => "Combat"; internal static void ToggleGod() { GodMode = !GodMode; } internal override void Tick() { if (PlayerContext.InGame && PlayerContext.HasBody) { if ((Object)(object)PlayerContext.Health != (Object)null) { PlayerContext.Health.godMode = GodMode; } if ((Object)(object)PlayerContext.Master != (Object)null) { PlayerContext.Master.godMode = GodMode; } if (InfiniteSkills && (Object)(object)PlayerContext.Skills != (Object)null) { PlayerContext.Skills.ApplyAmmoPack(); } } } internal override void DrawMenu() { Widgets.SectionBegin("Combat"); GodMode = Widgets.Toggle("God Mode", GodMode); Safety.Buddha = Widgets.Toggle("Buddha (survive lethal hits)", Safety.Buddha); InfiniteSkills = Widgets.Toggle("Infinite Skills", InfiniteSkills); Widgets.SectionEnd(); Widgets.SectionBegin("Health"); Widgets.Button("Heal to Full", delegate { NetUtil.Do(PoppyOp.HealFull); }); GUILayout.BeginHorizontal(Array.Empty()); Widgets.Button("Heal " + _heal, delegate { NetUtil.Do(PoppyOp.HealAmount, 0, 0, _heal); }); Widgets.Button("Hurt " + _hurt, delegate { NetUtil.Do(PoppyOp.HurtBody, 0, 0, _hurt); }); GUILayout.EndHorizontal(); _heal = Widgets.IntStepper("Heal amount", _heal, 100, 1, 1000000000); _hurt = Widgets.IntStepper("Hurt amount", _hurt, 50, 1, 1000000000); Widgets.Button("Respawn", delegate { NetUtil.Do(PoppyOp.Respawn); }); Widgets.SectionEnd(); Widgets.SectionBegin("Grants"); Widgets.Button("Give Money", delegate { NetUtil.Do(PoppyOp.GiveMoney, ModConfig.GiveMoneyAmount.Value); }); Widgets.Button("Give XP", delegate { NetUtil.Do(PoppyOp.GiveXp, ModConfig.GiveXpAmount.Value); }); Widgets.Button("Give Lunar Coins", delegate { NetUtil.Do(PoppyOp.GiveLunar, ModConfig.GiveCoinsAmount.Value); }); Widgets.SectionEnd(); Widgets.SectionBegin("Buffs & DoTs"); _buffDuration = Widgets.Slider("Buff duration (0 = permanent)", _buffDuration, 0f, 60f); Widgets.PickerButton("Give Buff...", "Buffs", BuffRows()); Widgets.Button("Remove All Buffs", delegate { NetUtil.Do(PoppyOp.RemoveAllBuffs); }); Widgets.PickerButton("Inflict DoT...", "Damage over time", DotRows()); Widgets.SectionEnd(); } private static List BuffRows() { //IL_0052: 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) List list = new List(Catalogs.Buffs.Count); foreach (Catalogs.BuffEntry buff in Catalogs.Buffs) { Catalogs.BuffEntry e = buff; list.Add(new ListPicker.Row(e.Name, e.IsDebuff ? Color.red : Color.cyan, delegate { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected I4, but got Unknown //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected I4, but got Unknown if (_buffDuration > 0.05f) { NetUtil.Do(PoppyOp.GiveTimedBuff, (int)e.Index, 0, _buffDuration); } else { NetUtil.Do(PoppyOp.GiveBuff, (int)e.Index, 1); } })); } return list; } private static List DotRows() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Invalid comparison between Unknown and I4 //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) List list = new List(); foreach (DotIndex value in Enum.GetValues(typeof(DotIndex))) { if ((int)value >= 0) { DotIndex d = value; list.Add(new ListPicker.Row(((object)Unsafe.As(ref d)/*cast due to .constrained prefix*/).ToString(), Color.red, delegate { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected I4, but got Unknown NetUtil.Do(PoppyOp.InflictDot, (int)d, 0, (_buffDuration > 0.05f) ? _buffDuration : 5f); })); } } return list; } } internal class PlayersModule : PoppyModule { private static int _hurt = 100; private static int _giveCount = 1; internal override string Name => "Players"; internal override void DrawMenu() { if (!PlayerContext.InGame) { Widgets.Label("Start a run first."); return; } ReadOnlyCollection readOnlyInstancesList = NetworkUser.readOnlyInstancesList; if (readOnlyInstancesList == null || readOnlyInstancesList.Count == 0) { Widgets.Label("No players in the lobby."); return; } if (!NetUtil.IsServer) { Widgets.Hint("You're a client, so these go to the host and only apply if the host turned on \"Allow Others To Use This\"."); } _hurt = Widgets.IntStepper("Hurt amount", _hurt, 50, 1, 1000000000); _giveCount = Widgets.IntStepper("Give item count", _giveCount, 1, 1, 100); foreach (NetworkUser item in readOnlyInstancesList) { if ((Object)(object)item != (Object)null) { DrawPlayer(item); } } } private static void DrawPlayer(NetworkUser user) { CharacterMaster master = user.master; bool flag = NetworkUser.readOnlyLocalPlayersList.Contains(user); Widgets.SectionBegin(user.userName + (flag ? " (you)" : "")); CharacterBody val = (((Object)(object)master != (Object)null) ? master.GetBody() : null); if ((Object)(object)val != (Object)null && (Object)(object)val.healthComponent != (Object)null) { Widgets.Label($"{val.GetDisplayName()} · {Mathf.CeilToInt(val.healthComponent.health)} / {Mathf.CeilToInt(val.healthComponent.fullCombinedHealth)} HP"); } else { Widgets.Label("No body (dead or not spawned)"); } if (!flag && NetUtil.IsServer) { GUILayout.BeginHorizontal(Array.Empty()); Widgets.Button("Kick", delegate { NetUtil.KickUser(user); }); Widgets.ConfirmButton("players.ban." + user.userName, "Ban", delegate { NetUtil.BanUser(user); }); GUILayout.EndHorizontal(); } if ((Object)(object)master == (Object)null) { Widgets.SectionEnd(); return; } GUILayout.BeginHorizontal(Array.Empty()); Widgets.Button("Heal", delegate { NetUtil.DoFor(master, PoppyOp.HealFull); }); Widgets.Button("Revive", delegate { NetUtil.DoFor(master, PoppyOp.Respawn); }); Widgets.Button("Hurt " + _hurt, delegate { NetUtil.DoFor(master, PoppyOp.HurtBody, 0, 0, _hurt); }); Widgets.Button("Kill", delegate { NetUtil.DoFor(master, PoppyOp.TrueKillTarget); }); GUILayout.EndHorizontal(); if (!flag) { GUILayout.BeginHorizontal(Array.Empty()); Widgets.Button("Bring to me", delegate { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) Vector3 val2 = MyPos(); NetUtil.DoFor(master, PoppyOp.TeleportBody, 0, 0, val2.x, val2.y, val2.z); }); Widgets.Button("Go to them", delegate { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0015: 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_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) CharacterBody body = master.GetBody(); Vector3 val2 = (((Object)(object)body != (Object)null) ? body.footPosition : MyPos()); NetUtil.DoFor(PlayerContext.Master, PoppyOp.TeleportBody, 0, 0, val2.x, val2.y, val2.z); }); GUILayout.EndHorizontal(); } GUILayout.BeginHorizontal(Array.Empty()); Widgets.Button("Team: Players", delegate { NetUtil.DoFor(master, PoppyOp.SetTeam, 1); }); Widgets.Button("Monsters", delegate { NetUtil.DoFor(master, PoppyOp.SetTeam, 2); }); Widgets.Button("Neutral", delegate { NetUtil.DoFor(master, PoppyOp.SetTeam); }); GUILayout.EndHorizontal(); CharacterMaster target = master; Widgets.Button("Give item", delegate { ItemPicker.Open("Give item to " + user.userName, delegate(ItemIndex idx) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected I4, but got Unknown NetUtil.DoFor(target, PoppyOp.GiveItem, (int)idx, _giveCount); }); }); Widgets.PickerButton("Set body", "Set " + user.userName + "'s body", SetBodyRows(master)); Widgets.SectionEnd(); } private static List SetBodyRows(CharacterMaster master) { //IL_0064: Unknown result type (might be due to invalid IL or missing references) List list = new List(Catalogs.Bodies.Count); foreach (Catalogs.BodyEntry body2 in Catalogs.Bodies) { if (!((Object)(object)body2.Prefab == (Object)null)) { Catalogs.BodyEntry e = body2; list.Add(new ListPicker.Row(e.Name, Color.white, delegate { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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_0043: Unknown result type (might be due to invalid IL or missing references) CharacterBody body = master.GetBody(); Vector3 val = (((Object)(object)body != (Object)null) ? body.footPosition : Vector3.zero); NetUtil.DoFor(master, PoppyOp.ChangeBody, 0, 0, val.x, val.y, val.z, b1: false, ((Object)e.Prefab).name); })); } } return list; } private static Vector3 MyPos() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) CharacterBody body = PlayerContext.Body; if (!((Object)(object)body != (Object)null)) { return Vector3.zero; } return body.footPosition; } } internal abstract class PoppyModule { internal abstract string Name { get; } internal virtual void Tick() { } internal virtual void DrawMenu() { } internal virtual void DrawOverlay() { } internal virtual void OnUnload() { } } internal class PresetsModule : PoppyModule { private static string _newName = ""; private static string _importCode = ""; private static int _expanded = -1; private static Preset _pendingDelete; internal override string Name => "Presets"; internal override void DrawMenu() { //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Expected O, but got Unknown Widgets.SectionBegin("Presets"); Widgets.Hint("Save items and toggles, then flip on Auto-grant to apply them on every spawn."); GUILayout.BeginHorizontal(Array.Empty()); _newName = GUILayout.TextField(_newName ?? "", Theme.Search, Array.Empty()); if (GUILayout.Button("+ New Preset", Theme.Primary, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(110f) })) { Preset item = NewEmpty(_newName); _newName = ""; _expanded = PresetStore.Presets.IndexOf(item); } GUILayout.EndHorizontal(); Widgets.Button("Save current setup as a preset", delegate { Preset preset2 = PresetStore.AddFromCurrent(_newName); _expanded = PresetStore.Presets.IndexOf(preset2); Notify.Push("Saved preset: " + preset2.Name); }); GUILayout.BeginHorizontal(Array.Empty()); _importCode = GUILayout.TextField(_importCode ?? "", Theme.Search, Array.Empty()); if (GUILayout.Button("Import code", Theme.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(100f) })) { ImportCode(); } GUILayout.EndHorizontal(); Widgets.Hint("Paste a code to import a shared preset, or use Export on one below to copy its code."); Widgets.SectionEnd(); if (PresetStore.Presets.Count == 0) { Widgets.Label("No presets yet, click \"+ New Preset\" above to start."); return; } for (int num = 0; num < PresetStore.Presets.Count; num++) { Preset preset = PresetStore.Presets[num]; Widgets.SectionBegin(null); GUILayout.BeginHorizontal(Array.Empty()); string text = GUILayout.TextField(preset.Name ?? "", Theme.Search, Array.Empty()); if (text != preset.Name) { preset.Name = text; PresetStore.Save(); } if (GUILayout.Button((_expanded == num) ? "v Edit" : "> Edit", Theme.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(64f) })) { _expanded = ((_expanded == num) ? (-1) : num); } GUILayout.EndHorizontal(); GUILayout.Label((preset.LoadOnStartup ? "* STARTUP " : "") + (preset.AutoApplyOnSpawn ? "* AUTO " : "") + Summary(preset), new GUIStyle(Theme.Hint) { richText = true }, Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button("Apply now", Theme.Primary, Array.Empty())) { Cheats.Apply(preset); } if (GUILayout.Button(preset.AutoApplyOnSpawn ? "Auto-grant: ON" : "Auto-grant: OFF", preset.AutoApplyOnSpawn ? Theme.SwitchOn : Theme.SwitchOff, Array.Empty())) { preset.AutoApplyOnSpawn = !preset.AutoApplyOnSpawn; PresetStore.Save(); } Preset p = preset; if (GUILayout.Button("Export", Theme.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(72f) })) { ExportCode(p); } GUILayout.EndHorizontal(); if (_expanded == num) { DrawEditor(preset); } Widgets.SectionEnd(); } if (_pendingDelete != null) { PresetStore.Delete(_pendingDelete); _pendingDelete = null; _expanded = -1; } } private static void ExportCode(Preset p) { try { string s = JsonConvert.SerializeObject((object)p); GUIUtility.systemCopyBuffer = Convert.ToBase64String(Encoding.UTF8.GetBytes(s)); Notify.Push("Copied " + p.Name + " code to clipboard"); } catch (Exception ex) { Log.Error("Preset export failed: " + ex); Notify.Push("Export failed"); } } private static void ImportCode() { string text = (_importCode ?? "").Trim(); if (text.Length == 0) { return; } try { byte[] bytes = Convert.FromBase64String(text); Preset preset = JsonConvert.DeserializeObject(Encoding.UTF8.GetString(bytes)); if (preset == null) { Notify.Push("Bad preset code"); return; } if (string.IsNullOrWhiteSpace(preset.Name)) { preset.Name = "Imported"; } PresetStore.Presets.Add(preset); PresetStore.Save(); _importCode = ""; Notify.Push("Imported preset: " + preset.Name); } catch (Exception ex) { Log.Error("Preset import failed: " + ex); Notify.Push("Bad preset code"); } } private static Preset NewEmpty(string name) { Preset preset = new Preset { Name = (string.IsNullOrWhiteSpace(name) ? ("Preset " + (PresetStore.Presets.Count + 1)) : name.Trim()) }; PresetStore.Presets.Add(preset); PresetStore.Save(); Notify.Push("Created preset: " + preset.Name); return preset; } private static void DrawEditor(Preset p) { Widgets.Header("Items granted on spawn"); Preset preset = p; Widgets.Button("+ Add item", delegate { ItemPicker.Open("Add item to " + preset.Name, delegate(ItemIndex idx) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) AddItem(preset, idx); }); }); if (p.Items.Count == 0 && p.Equipment.Count == 0 && !p.GiveAllItems) { Widgets.Hint("No items yet, click \"+ Add item\"."); } for (int num = p.Items.Count - 1; num >= 0; num--) { GrantItem grantItem = p.Items[num]; GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(string.IsNullOrEmpty(grantItem.Display) ? grantItem.Name : grantItem.Display, Theme.Label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); if (GUILayout.Button("-", Theme.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(24f) })) { grantItem.Count = Mathf.Max(1, grantItem.Count - 1); PresetStore.Save(); } GUILayout.Label("x" + grantItem.Count, Theme.Label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(38f) }); if (GUILayout.Button("+", Theme.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(24f) })) { grantItem.Count++; PresetStore.Save(); } if (GUILayout.Button("X", Theme.Danger_, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(24f) })) { p.Items.RemoveAt(num); PresetStore.Save(); } GUILayout.EndHorizontal(); } Widgets.PickerButton("+ Add equipment", "Add equipment to preset", BuildEquipRows(p)); for (int num2 = p.Equipment.Count - 1; num2 >= 0; num2--) { GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(p.Equipment[num2], Theme.Label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); if (GUILayout.Button("X", Theme.Danger_, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(24f) })) { p.Equipment.RemoveAt(num2); PresetStore.Save(); } GUILayout.EndHorizontal(); } Tog("Give ALL items", ref p.GiveAllItems); Step("Gold", ref p.Money, 1000, 0, 1000000000); Step("XP", ref p.Xp, 100, 0, 1000000000); Step("Lunar coins", ref p.Coins, 5, 0, 100000); Widgets.Header("Features enabled on spawn"); Tog("God Mode", ref p.God); Tog("Infinite Skills", ref p.Skills); Tog("Silent Aim", ref p.SilentAim); Tog("Flight", ref p.Flight); Tog("Always Sprint", ref p.Sprint); Tog("Jump Pack", ref p.JumpPack); Tog("No Equipment Cooldown", ref p.NoEquipCd); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button("Copy current stat mults", Theme.Button, Array.Empty())) { CopyStats(p); PresetStore.Save(); } if (GUILayout.Button("Clear", Theme.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(56f) })) { ClearStats(p); PresetStore.Save(); } GUILayout.EndHorizontal(); Widgets.Hint(StatSummary(p)); Widgets.Header("Automation"); Tog("Auto-grant on spawn", ref p.AutoApplyOnSpawn); Widgets.Hint(p.AutoApplyOnSpawn ? "This preset runs automatically every time your character spawns." : "Off, use \"Apply now\" to run it manually."); Tog("Load on startup (your default)", ref p.LoadOnStartup); Widgets.Hint(p.LoadOnStartup ? "Applied once when you first load into a game each session, so this setup is always there when you reopen the game." : "Off. Turn on to make this your default setup that loads every time."); Widgets.Separator(); Widgets.ConfirmButton("preset.delete." + p.Name, "Delete this preset", delegate { _pendingDelete = p; }); } private static void Tog(string label, ref bool field) { bool flag = Widgets.Toggle(label, field); if (flag != field) { field = flag; PresetStore.Save(); } } private static void Step(string label, ref int field, int step, int min, int max) { int num = Widgets.IntStepper(label, field, step, min, max); if (num != field) { field = num; PresetStore.Save(); } } private static void AddItem(Preset p, ItemIndex idx) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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) ItemDef def = ItemCatalog.GetItemDef(idx); if ((Object)(object)def == (Object)null) { return; } string name = ((Object)def).name; foreach (Catalogs.ItemEntry item in Catalogs.Items) { if (item.Index == idx) { name = item.Name; break; } } GrantItem grantItem = p.Items.Find((GrantItem g) => g.Name == ((Object)def).name); if (grantItem != null) { grantItem.Count++; } else { p.Items.Add(new GrantItem { Name = ((Object)def).name, Display = name, Count = 1 }); } PresetStore.Save(); Notify.Push("Added " + name); } private static List BuildEquipRows(Preset p) { //IL_005d: Unknown result type (might be due to invalid IL or missing references) List list = new List(Catalogs.Equipment.Count); foreach (Catalogs.EquipEntry item in Catalogs.Equipment) { Catalogs.EquipEntry e = item; list.Add(new ListPicker.Row(e.Name, e.Color, delegate { //IL_0006: Unknown result type (might be due to invalid IL or missing references) EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef(e.Index); if ((Object)(object)equipmentDef != (Object)null && !p.Equipment.Contains(((Object)equipmentDef).name)) { p.Equipment.Add(((Object)equipmentDef).name); PresetStore.Save(); Notify.Push("Added " + e.Name); } })); } return list; } private static void CopyStats(Preset p) { p.DmgOn = StatsModule.DamageOn; p.AtkOn = StatsModule.AttackSpeedOn; p.MoveOn = StatsModule.MoveSpeedOn; p.ArmorOn = StatsModule.ArmorOn; p.CritOn = StatsModule.CritOn; p.HpOn = StatsModule.MaxHealthOn; p.DmgMul = StatsModule.DamageMult; p.AtkMul = StatsModule.AttackSpeedMult; p.MoveMul = StatsModule.MoveSpeedMult; p.ArmorMul = StatsModule.ArmorMult; p.CritMul = StatsModule.CritMult; p.HpMul = StatsModule.MaxHealthMult; } private static void ClearStats(Preset p) { p.DmgOn = (p.AtkOn = (p.MoveOn = (p.ArmorOn = (p.CritOn = (p.HpOn = false))))); } private static string StatSummary(Preset p) { List list = new List(); if (p.DmgOn) { list.Add($"Dmg x{p.DmgMul:0.#}"); } if (p.AtkOn) { list.Add($"Atk x{p.AtkMul:0.#}"); } if (p.MoveOn) { list.Add($"Move x{p.MoveMul:0.#}"); } if (p.ArmorOn) { list.Add($"Armor x{p.ArmorMul:0.#}"); } if (p.CritOn) { list.Add($"Crit x{p.CritMul:0.#}"); } if (p.HpOn) { list.Add($"HP x{p.HpMul:0.#}"); } if (list.Count != 0) { return "Stat multipliers: " + string.Join(", ", list); } return "Stat multipliers: none"; } private static string Summary(Preset p) { List list = new List(); int num = p.Items.Count + p.Equipment.Count; if (num > 0) { list.Add(num + ((num == 1) ? " item" : " items")); } if (p.GiveAllItems) { list.Add("all items"); } if (p.Money > 0 || p.Xp > 0 || p.Coins > 0) { list.Add("currency"); } if (p.God) { list.Add("God"); } if (p.Flight) { list.Add("Flight"); } if (p.SilentAim) { list.Add("Silent Aim"); } if (p.Skills) { list.Add("Skills"); } if (list.Count != 0) { return string.Join(" · ", list); } return "empty"; } } internal class RenderModule : PoppyModule { internal static bool EspMobs; internal static bool EspInteractables; internal static bool EspTeleporter; internal static bool ShowNames = true; internal static bool ShowDistance = true; internal static bool ShowEnemyHealth = true; internal static float MaxDistance; internal static float MarkerSize = 6f; internal static Color EnemyColor = Color.red; internal static Color InteractableColor = Color.cyan; internal static Color TeleporterColor = Color.yellow; private static GUIStyle _labelStyle; private static Color _styleColor = Color.clear; private static PurchaseInteraction[] _interactables = (PurchaseInteraction[])(object)new PurchaseInteraction[0]; private static float _nextScan; internal override string Name => "ESP"; internal override void Tick() { if (EspInteractables && Time.realtimeSinceStartup >= _nextScan) { _interactables = Object.FindObjectsOfType(); _nextScan = Time.realtimeSinceStartup + 0.5f; } } internal override void DrawMenu() { //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) Widgets.SectionBegin("ESP / Wallhack"); EspMobs = Widgets.Toggle("Enemies", EspMobs); EspInteractables = Widgets.Toggle("Interactables", EspInteractables); EspTeleporter = Widgets.Toggle("Teleporter", EspTeleporter); Widgets.Hint("Markers draw through walls while in a run."); Widgets.SectionEnd(); Widgets.SectionBegin("Display"); ShowNames = Widgets.Toggle("Show names", ShowNames); ShowDistance = Widgets.Toggle("Show distance", ShowDistance); ShowEnemyHealth = Widgets.Toggle("Show enemy health", ShowEnemyHealth); MaxDistance = Widgets.Slider("Max distance (0 = unlimited)", MaxDistance, 0f, 500f); MarkerSize = Widgets.Slider("Marker size", MarkerSize, 2f, 16f); Widgets.SectionEnd(); Widgets.SectionBegin("Colors"); EnemyColor = ColorRow("Enemies", EnemyColor); InteractableColor = ColorRow("Interactables", InteractableColor); TeleporterColor = ColorRow("Teleporter", TeleporterColor); Widgets.SectionEnd(); } private static Color ColorRow(string label, Color c) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) Widgets.Label(label); c.r = Widgets.Slider(" R", c.r, 0f, 1f); c.g = Widgets.Slider(" G", c.g, 0f, 1f); c.b = Widgets.Slider(" B", c.b, 0f, 1f); return c; } internal override void DrawOverlay() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0191: 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) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: 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_009f: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Invalid comparison between Unknown and I4 //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) if (!PlayerContext.InGame || (!EspMobs && !EspInteractables && !EspTeleporter)) { return; } Camera main = Camera.main; if ((Object)(object)main == (Object)null) { return; } Vector3 origin = (PlayerContext.HasBody ? PlayerContext.Body.corePosition : ((Component)main).transform.position); try { if (EspMobs) { foreach (CharacterBody readOnlyInstances in CharacterBody.readOnlyInstancesList) { if (!((Object)(object)readOnlyInstances == (Object)null) && !((Object)(object)readOnlyInstances == (Object)(object)PlayerContext.Body) && !((Object)(object)readOnlyInstances.teamComponent == (Object)null)) { TeamIndex teamIndex = readOnlyInstances.teamComponent.teamIndex; if (((int)teamIndex == 2 || (int)teamIndex == 4) && !Culled(origin, readOnlyInstances.corePosition, out var dist)) { DrawMarker(main, readOnlyInstances.corePosition, EnemyLabel(readOnlyInstances, dist), EnemyColor); } } } } if (EspInteractables) { PurchaseInteraction[] interactables = _interactables; foreach (PurchaseInteraction val in interactables) { if (!((Object)(object)val == (Object)null) && !Culled(origin, ((Component)val).transform.position, out var dist2)) { DrawMarker(main, ((Component)val).transform.position, Label("Interactable", dist2), InteractableColor); } } } if (EspTeleporter && (Object)(object)TeleporterInteraction.instance != (Object)null) { Vector3 position = ((Component)TeleporterInteraction.instance).transform.position; if (!Culled(origin, position, out var dist3)) { DrawMarker(main, position, Label("Teleporter", dist3), TeleporterColor); } } } catch { } } private static bool Culled(Vector3 origin, Vector3 target, out float dist) { //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) dist = Vector3.Distance(origin, target); if (MaxDistance > 0.5f) { return dist > MaxDistance; } return false; } private static string EnemyLabel(CharacterBody body, float dist) { string text = (ShowNames ? body.GetDisplayName() : ""); if (ShowEnemyHealth && (Object)(object)body.healthComponent != (Object)null) { text = Append(text, Mathf.CeilToInt(body.healthComponent.combinedHealth) + " hp"); } if (ShowDistance) { text = Append(text, Mathf.RoundToInt(dist) + "m"); } return text; } private static string Label(string name, float dist) { string text = (ShowNames ? name : ""); if (ShowDistance) { text = Append(text, Mathf.RoundToInt(dist) + "m"); } return text; } private static string Append(string a, string b) { if (a.Length <= 0) { return b; } return a + " " + b; } private void DrawMarker(Camera cam, Vector3 worldPos, string label, Color color) { //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_0008: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Expected O, but got Unknown //IL_009b: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) Vector3 val = cam.WorldToScreenPoint(worldPos); if (val.z <= 0f) { return; } float num = (float)Screen.height - val.y; float num2 = MarkerSize * 0.5f; Theme.Fill(new Rect(val.x - num2, num - num2, MarkerSize, MarkerSize), color); if (!string.IsNullOrEmpty(label)) { if (_labelStyle == null) { _labelStyle = new GUIStyle(GUI.skin.label); } if (_styleColor != color) { _labelStyle.normal.textColor = color; _styleColor = color; } GUI.Label(new Rect(val.x + num2 + 3f, num - 8f, 260f, 20f), label, _labelStyle); } } } internal class RunModule : PoppyModule { private static int _stages; private static int _minutes; private static int _teamLevel = 1; internal override string Name => "Run"; internal override void DrawMenu() { if (!PlayerContext.InGame || (Object)(object)Run.instance == (Object)null) { Widgets.Label("Start a run first."); return; } Run instance = Run.instance; Widgets.SectionBegin("Run State"); Widgets.Label($"Stage {instance.stageClearCount + 1} · {FormatClock(instance.GetRunStopwatch())} · difficulty {instance.difficultyCoefficient:0.0}"); _stages = Widgets.IntStepper("Stages cleared", _stages, 1, 0, 200); Widgets.Button("Set stages cleared", delegate { NetUtil.Do(PoppyOp.SetStagesCleared, _stages); }); _minutes = Widgets.IntStepper("Run time (minutes)", _minutes, 1, 0, 600); Widgets.Button("Set run time", delegate { NetUtil.Do(PoppyOp.SetRunTime, 0, 0, (float)_minutes * 60f); }); Widgets.Hint("Run time drives difficulty. Freeze it under World > Time to lock it."); Widgets.SectionEnd(); Widgets.SectionBegin("Team Level"); _teamLevel = Widgets.IntStepper("Player team level", _teamLevel, 1, 1, 99999); Widgets.Button("Set team level", delegate { NetUtil.Do(PoppyOp.SetTeamLevel, 1, _teamLevel); }); Widgets.SectionEnd(); Widgets.SectionBegin("Change Stage"); Widgets.PickerButton("Go to scene...", "Scenes", SceneRows()); Widgets.SectionEnd(); DrawArtifacts(); } private static List SceneRows() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) List list = new List(); Enumerator enumerator = SceneCatalog.allSceneDefs.GetEnumerator(); try { while (enumerator.MoveNext()) { SceneDef current = enumerator.Current; if (!((Object)(object)current == (Object)null)) { SceneDef d = current; string text = Language.GetString(d.nameToken); if (string.IsNullOrEmpty(text) || text == d.nameToken) { text = d.cachedName; } list.Add(new ListPicker.Row(text, Color.white, delegate { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected I4, but got Unknown NetUtil.Do(PoppyOp.ChangeScene, (int)d.sceneDefIndex); })); } } return list; } finally { ((IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose(); } } private static void DrawArtifacts() { //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Expected I4, but got Unknown Widgets.SectionBegin("Artifacts"); ArtifactDef[] artifactDefs = ArtifactCatalog.artifactDefs; RunArtifactManager instance = RunArtifactManager.instance; if (artifactDefs == null || (Object)(object)instance == (Object)null) { Widgets.Hint("Artifacts aren't available right now."); Widgets.SectionEnd(); return; } ArtifactDef[] array = artifactDefs; foreach (ArtifactDef val in array) { if (!((Object)(object)val == (Object)null)) { bool flag = instance.IsArtifactEnabled(val); bool flag2 = Widgets.Toggle(ArtifactName(val), flag); if (flag2 != flag) { NetUtil.Do(PoppyOp.SetArtifact, (int)val.artifactIndex, 0, 0f, 0f, 0f, flag2); } } } Widgets.SectionEnd(); } private static string ArtifactName(ArtifactDef def) { string text = Language.GetString(def.nameToken); if (string.IsNullOrEmpty(text) || text == def.nameToken) { text = def.cachedName; } return text; } private static string FormatClock(float seconds) { int num = Mathf.Max(0, (int)seconds); return num / 60 + ":" + (num % 60).ToString("00"); } } internal class SettingsModule : PoppyModule { internal override string Name => "Settings"; internal override void DrawMenu() { Widgets.SectionBegin("Keybinds"); Widgets.KeybindRow("Open Menu", ModConfig.ToggleMenuKey); if (Rebind.IsActive) { Widgets.Hint("Press any key or mouse button (right/middle/side) to bind. Esc cancels. X clears."); } Widgets.Hint("Bind any feature to any key over in the Keybinds tab."); Widgets.SectionEnd(); Widgets.SectionBegin("Display"); ModConfig.UiScale.Value = Widgets.Slider("UI Scale", ModConfig.UiScale.Value, 0.6f, 2f); ModConfig.ShowHud.Value = Widgets.Toggle("Active-Effects HUD", ModConfig.ShowHud.Value); Widgets.SectionEnd(); DrawThemeSection(); Widgets.SectionBegin("Multiplayer"); ModConfig.AllowClientCheats.Value = Widgets.Toggle("Allow Others To Use This (host)", ModConfig.AllowClientCheats.Value); Widgets.Hint("HOST: off by default, so others can't use this menu in YOUR game without permission. Turn on only if you trust the lobby."); ModConfig.RequireServerForCheats.Value = Widgets.Toggle("Host-Only (skip on client)", ModConfig.RequireServerForCheats.Value); Widgets.Hint("On: as a client, don't even request server-side actions, just skip them."); Widgets.SectionEnd(); Widgets.SectionBegin("Maintenance"); Widgets.Button("Refresh Catalogs", delegate { Catalogs.Refresh(); Notify.Push("Catalogs refreshed"); }); Widgets.Button("Reset Window Position", delegate { MenuRoot.ResetPosition(); Notify.Push("Window reset"); }); Widgets.SectionEnd(); Widgets.SectionBegin("About"); Widgets.Label("Poppy Menu v2.2.3"); Widgets.Hint("Risk of Rain 2 cheat and debug menu. Single-player and private lobbies."); Widgets.SectionEnd(); } private static void DrawThemeSection() { //IL_00a5: Unknown result type (might be due to invalid IL or missing references) Widgets.SectionBegin("Theme"); float value = ModConfig.AccentR.Value; float value2 = ModConfig.AccentG.Value; float value3 = ModConfig.AccentB.Value; float num = Widgets.Slider("Accent R", value, 0f, 1f); float num2 = Widgets.Slider("Accent G", value2, 0f, 1f); float num3 = Widgets.Slider("Accent B", value3, 0f, 1f); if (num != value || num2 != value2 || num3 != value3) { ModConfig.AccentR.Value = num; ModConfig.AccentG.Value = num2; ModConfig.AccentB.Value = num3; Theme.ApplyAccent(new Color(num, num2, num3)); } Widgets.Button("Reset to poppy red", delegate { //IL_003c: Unknown result type (might be due to invalid IL or missing references) ModConfig.AccentR.Value = 0.898f; ModConfig.AccentG.Value = 0.219f; ModConfig.AccentB.Value = 0.29f; Theme.ApplyAccent(new Color(0.898f, 0.219f, 0.29f)); }); Widgets.SectionEnd(); } } internal class SpawnModule : PoppyModule { private static int _count = 1; private static bool _ally; internal override string Name => "Spawn"; private static Vector3 ComputePos() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0015: 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_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) RaycastHit val = default(RaycastHit); if (Physics.Raycast(PlayerContext.AimRay(), ref val, 1000f)) { return ((RaycastHit)(ref val)).point; } if (PlayerContext.HasBody) { return PlayerContext.Body.footPosition + PlayerContext.Body.transform.forward * 5f; } return Vector3.zero; } internal override void DrawMenu() { //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) if (Catalogs.SpawnCards.Count == 0) { Widgets.Label("No spawn cards loaded, start a stage."); return; } List list = new List(); List list2 = new List(); foreach (Catalogs.SpawnEntry spawnCard in Catalogs.SpawnCards) { string name = spawnCard.Name; if (spawnCard.IsInteractable) { list2.Add(new ListPicker.Row(name, Color.cyan, delegate { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ComputePos(); NetUtil.Do(PoppyOp.Spawn, _count, _ally ? 1 : 2, s1: name, f1: val.x, f2: val.y, f3: val.z); })); } else { list.Add(new ListPicker.Row(name, Color.red, delegate { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ComputePos(); NetUtil.Do(PoppyOp.Spawn, _count, _ally ? 1 : 2, s1: name, f1: val.x, f2: val.y, f3: val.z); })); } } Widgets.SectionBegin("Spawn at Crosshair"); _count = Widgets.IntStepper("Count", _count, 1, 1, 50); _ally = Widgets.Toggle("Spawn as ally (your team)", _ally); Widgets.PickerButton("Spawn Monster...", "Spawn Monster", list); Widgets.PickerButton("Spawn Interactable...", "Spawn Interactable", list2); Widgets.Hint("Spawns where you aim, or just ahead of you."); Widgets.SectionEnd(); Widgets.SectionBegin("Combat"); Widgets.DangerButton("Kill All Enemies", delegate { NetUtil.Do(PoppyOp.KillAllEnemies); }); Widgets.SectionEnd(); } } internal class StatsModule : PoppyModule { internal static bool DamageOn; internal static bool AttackSpeedOn; internal static bool MoveSpeedOn; internal static bool ArmorOn; internal static bool CritOn; internal static bool MaxHealthOn; internal static float DamageMult = 1f; internal static float AttackSpeedMult = 1f; internal static float MoveSpeedMult = 1f; internal static float ArmorMult = 1f; internal static float CritMult = 1f; internal static float MaxHealthMult = 1f; private static Harmony _harmony; private static bool _wasOn; internal override string Name => "Stats"; private static bool AnyOn { get { if (!DamageOn && !AttackSpeedOn && !MoveSpeedOn && !ArmorOn && !CritOn) { return MaxHealthOn; } return true; } } internal static bool Active => AnyOn; internal static void DisableAll() { DamageOn = (AttackSpeedOn = (MoveSpeedOn = (ArmorOn = (CritOn = (MaxHealthOn = false))))); } private static void EnsurePatched() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown if (_harmony == null) { _harmony = new Harmony("poppy.stats"); MethodInfo methodInfo = AccessTools.Method(typeof(CharacterBody), "RecalculateStats", (Type[])null, (Type[])null); MethodInfo methodInfo2 = AccessTools.Method(typeof(StatsModule), "RecalcPostfix", (Type[])null, (Type[])null); _harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } private static void RecalcPostfix(CharacterBody __instance) { if (!((Object)(object)__instance == (Object)null) && !((Object)(object)__instance != (Object)(object)PlayerContext.Body)) { if (DamageOn) { __instance.damage *= DamageMult; } if (AttackSpeedOn) { __instance.attackSpeed *= AttackSpeedMult; } if (MoveSpeedOn) { __instance.moveSpeed *= MoveSpeedMult; } if (ArmorOn) { __instance.armor *= ArmorMult; } if (CritOn) { __instance.crit *= CritMult; } if (MaxHealthOn) { __instance.maxHealth *= MaxHealthMult; } } } internal override void Tick() { EnsurePatched(); if ((AnyOn || _wasOn) && PlayerContext.HasBody) { PlayerContext.Body.RecalculateStats(); } _wasOn = AnyOn; } internal override void DrawMenu() { Widgets.SectionBegin("Stat Multipliers"); DamageOn = Widgets.Toggle("Damage", DamageOn); DamageMult = Widgets.Slider("Damage x", DamageMult, 1f, 50f); AttackSpeedOn = Widgets.Toggle("Attack Speed", AttackSpeedOn); AttackSpeedMult = Widgets.Slider("Atk Spd x", AttackSpeedMult, 1f, 50f); MoveSpeedOn = Widgets.Toggle("Move Speed", MoveSpeedOn); MoveSpeedMult = Widgets.Slider("Move x", MoveSpeedMult, 1f, 50f); ArmorOn = Widgets.Toggle("Armor", ArmorOn); ArmorMult = Widgets.Slider("Armor x", ArmorMult, 1f, 50f); CritOn = Widgets.Toggle("Crit", CritOn); CritMult = Widgets.Slider("Crit x", CritMult, 1f, 50f); MaxHealthOn = Widgets.Toggle("Max Health", MaxHealthOn); MaxHealthMult = Widgets.Slider("Health x", MaxHealthMult, 1f, 50f); Widgets.SectionEnd(); Widgets.SectionBegin("Current"); if (PlayerContext.HasBody) { CharacterBody body = PlayerContext.Body; Widgets.Label($"Max Health: {body.maxHealth:0}"); Widgets.Label($"Damage: {body.damage:0.##}"); Widgets.Label($"Attack Speed: {body.attackSpeed:0.##}"); Widgets.Label($"Armor: {body.armor:0.##}"); Widgets.Label($"Crit: {body.crit:0.##}%"); Widgets.Label($"Move Speed: {body.moveSpeed:0.##}"); } else { Widgets.Label("(no body)"); } Widgets.SectionEnd(); } internal override void OnUnload() { if (_harmony != null) { _harmony.UnpatchSelf(); _harmony = null; } } } internal class TeleporterModule : PoppyModule { internal override string Name => "Teleport"; internal override void DrawMenu() { if (!PlayerContext.InGame) { Widgets.Label("Start a run first."); return; } Widgets.SectionBegin("Teleporter"); TeleporterInteraction instance = TeleporterInteraction.instance; Widgets.Label(((Object)(object)instance != (Object)null) ? ("Charge: " + instance.chargePercent + "%") : "No teleporter on this stage."); Widgets.Button("Instant Charge", delegate { NetUtil.Do(PoppyOp.ChargeTeleporter); }); Widgets.Button("Skip Stage", delegate { NetUtil.Do(PoppyOp.SkipStage); }); Widgets.Button("Add Mountain Shrine Stack", delegate { NetUtil.Do(PoppyOp.AddMountainShrine); }); Widgets.SectionEnd(); Widgets.SectionBegin("Portals"); Widgets.Button("Blue (Shop) Portal", delegate { NetUtil.Do(PoppyOp.SpawnShopPortal); }); Widgets.Button("Gold Portal", delegate { NetUtil.Do(PoppyOp.SpawnGoldshoresPortal); }); Widgets.Button("Celestial Portal", delegate { NetUtil.Do(PoppyOp.SpawnMSPortal); }); Widgets.PrimaryButton("Spawn All Portals", delegate { NetUtil.Do(PoppyOp.SpawnShopPortal); NetUtil.Do(PoppyOp.SpawnGoldshoresPortal); NetUtil.Do(PoppyOp.SpawnMSPortal); }); Widgets.SectionEnd(); } } internal class WorldModule : PoppyModule { internal static bool FreezeMatch; internal static bool FreezeTimer; internal static float TimeScale = 1f; private static bool _controllingTime; private static bool _timerFrozen; internal override string Name => "Time"; internal override void Tick() { if (NetUtil.IsServer && (Object)(object)Run.instance != (Object)null) { if (FreezeTimer) { Run.instance.SetRunStopwatchPaused(true); } else if (_timerFrozen) { Run.instance.SetRunStopwatchPaused(false); } } _timerFrozen = FreezeTimer; ApplyTimeScale(); } private static void ApplyTimeScale() { if (FreezeMatch || Mathf.Abs(TimeScale - 1f) > 0.001f) { Time.timeScale = (FreezeMatch ? 0f : TimeScale); _controllingTime = true; } else if (_controllingTime) { if (!PauseManager.isPaused) { Time.timeScale = 1f; } _controllingTime = false; } } internal static void RestoreTime() { FreezeMatch = false; if (_controllingTime) { if (!PauseManager.isPaused) { Time.timeScale = 1f; } _controllingTime = false; } if (_timerFrozen) { if (NetUtil.IsServer && (Object)(object)Run.instance != (Object)null) { Run.instance.SetRunStopwatchPaused(false); } _timerFrozen = false; } FreezeTimer = false; } internal override void OnUnload() { RestoreTime(); } internal override void DrawMenu() { Widgets.SectionBegin("Time"); FreezeMatch = Widgets.Toggle("Freeze Match (everything stops)", FreezeMatch); Widgets.Hint("Stops everything, including you. Toggle off to move. Host or solo."); FreezeTimer = Widgets.Toggle("Freeze Timer (difficulty)", FreezeTimer); Widgets.Hint("Stops the run clock so difficulty quits climbing. Enemies still move."); GUILayout.Space(4f); TimeScale = Widgets.Slider("Time Scale", TimeScale, 0.1f, 3f); GUILayout.BeginHorizontal(Array.Empty()); Widgets.Button("Slow-mo (0.25x)", delegate { TimeScale = 0.25f; }); Widgets.Button("Normal (1x)", delegate { TimeScale = 1f; }); Widgets.Button("Fast (2x)", delegate { TimeScale = 2f; }); GUILayout.EndHorizontal(); Widgets.SectionEnd(); Widgets.SectionBegin("Safety"); Safety.NoEnemies = Widgets.Toggle("No Enemies (kill on spawn)", Safety.NoEnemies); Safety.LockExp = Widgets.Toggle("Lock Experience", Safety.LockExp); Safety.PreventProfileWriting = Widgets.Toggle("Prevent Profile Saving", Safety.PreventProfileWriting); Widgets.Hint("Host or solo. Prevent Profile Saving keeps test runs out of your save file."); Widgets.SectionEnd(); } } internal class CursorOverlay : MonoBehaviour { private void OnGUI() { GUI.depth = -1000; if (MenuRoot.Visible || ListPicker.IsOpen) { SoftCursor.Draw(); } } private void LateUpdate() { if (MenuRoot.Visible || ListPicker.IsOpen) { Cursor.lockState = (CursorLockMode)0; } } } internal static class ItemPicker { internal static void Open(string title, Action give) { ListPicker.Open(title, Groups(title, give)); } private static List Groups(string title, Action give) { //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) Dictionary> dictionary = new Dictionary>(); List list = new List(); foreach (Catalogs.ItemEntry item in Catalogs.Items) { if (!dictionary.TryGetValue(item.Name, out var value)) { value = new List(); dictionary[item.Name] = value; list.Add(item.Name); } value.Add(item); } List list2 = new List(list.Count); foreach (string item2 in list) { List list3 = dictionary[item2]; if (list3.Count == 1) { Catalogs.ItemEntry e = list3[0]; list2.Add(new ListPicker.Row($"{item2} [{e.Tier}]", e.Color, delegate { //IL_0011: Unknown result type (might be due to invalid IL or missing references) give(e.Index); })); continue; } string n = item2; List vs = list3; list2.Add(new ListPicker.Row($"{item2} ({list3.Count} qualities)", list3[0].Color, delegate { ListPicker.Open(n, Variants(title, n, vs, give)); })); } return list2; } private static List Variants(string title, string name, List variants, Action give) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) List list = new List(variants.Count + 1); list.Add(new ListPicker.Row("< Back", Color.gray, delegate { ListPicker.Open(title, Groups(title, give)); })); foreach (Catalogs.ItemEntry variant in variants) { Catalogs.ItemEntry e = variant; string text = ((!string.IsNullOrEmpty(e.Quality)) ? e.Quality : ((object)e.Tier/*cast due to .constrained prefix*/).ToString()); list.Add(new ListPicker.Row(name + " - " + text, e.Color, delegate { //IL_0011: Unknown result type (might be due to invalid IL or missing references) give(e.Index); })); } return list; } } internal static class ListPicker { internal struct Row { internal string Label; internal Color Color; internal Action OnClick; internal Row(string label, Color color, Action onClick) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) Label = label; Color = color; OnClick = onClick; } } [CompilerGenerated] private static class <>O { public static WindowFunction <0>__DrawWindow; } private const int WindowId = 5995009; private static bool _open; private static string _title = ""; private static string _search = ""; private static Vector2 _scroll; private static List _rows = new List(); private static Rect _rect = new Rect(600f, 90f, 340f, 560f); private static bool _resizing; internal static bool IsOpen => _open; internal static void Open(string title, List rows) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) _title = title; _rows = rows ?? new List(); _search = ""; _scroll = Vector2.zero; _open = true; } internal static void Close() { _open = false; } internal static void Draw() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown if (_open) { Rect rect = _rect; object obj = <>O.<0>__DrawWindow; if (obj == null) { WindowFunction val = DrawWindow; <>O.<0>__DrawWindow = val; obj = (object)val; } _rect = GUI.Window(5995009, rect, (WindowFunction)obj, "", Theme.Window); } } private static void DrawWindow(int id) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: 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_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Invalid comparison between Unknown and I4 //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Invalid comparison between Unknown and I4 if ((int)Event.current.type == 0) { Rect val = new Rect(((Rect)(ref _rect)).width - 26f, ((Rect)(ref _rect)).height - 26f, 26f, 26f); if (((Rect)(ref val)).Contains(Event.current.mousePosition)) { _resizing = true; Event.current.Use(); } } GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(_title.ToUpperInvariant(), Theme.SubHeader, Array.Empty()); GUILayout.FlexibleSpace(); if (GUILayout.Button("X", Theme.IconBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(24f), GUILayout.Height(20f) })) { Close(); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty()); GUI.SetNextControlName("poppy_picker_search"); _search = GUILayout.TextField(_search ?? "", Theme.Search, Array.Empty()); if (GUILayout.Button("clear", Theme.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(48f) })) { _search = ""; } GUILayout.EndHorizontal(); string text = (_search ?? "").Trim(); bool flag = text.Length > 0; _scroll = GUILayout.BeginScrollView(_scroll, Array.Empty()); int num = 0; for (int i = 0; i < _rows.Count; i++) { Row row = _rows[i]; if (!flag || row.Label.IndexOf(text, StringComparison.OrdinalIgnoreCase) >= 0) { num++; bool flag2 = GUILayout.Button(row.Label, Theme.RowButton, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(24f) }); Rect lastRect = GUILayoutUtility.GetLastRect(); Theme.Fill(new Rect(((Rect)(ref lastRect)).x + 7f, ((Rect)(ref lastRect)).y + (((Rect)(ref lastRect)).height - 12f) / 2f, 12f, 12f), row.Color); if (flag2) { row.OnClick?.Invoke(); } } } if (num == 0) { GUILayout.Label("No matches.", Theme.Hint, Array.Empty()); } GUILayout.EndScrollView(); GUILayout.Label($"{num} of {_rows.Count} · Esc to close", Theme.Hint, Array.Empty()); if ((int)Event.current.type == 4 && (int)Event.current.keyCode == 27) { Close(); Event.current.Use(); } HandleResize(); GUI.DragWindow(new Rect(0f, 0f, ((Rect)(ref _rect)).width, 24f)); } private static void HandleResize() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) Rect r = default(Rect); ((Rect)(ref r))..ctor(((Rect)(ref _rect)).width - 18f, ((Rect)(ref _rect)).height - 18f, 16f, 16f); Theme.Fill(r, Theme.Accent); Theme.Fill(new Rect(((Rect)(ref r)).x + 5f, ((Rect)(ref r)).y + 10f, 9f, 2f), new Color(1f, 1f, 1f, 0.55f)); Theme.Fill(new Rect(((Rect)(ref r)).x + 10f, ((Rect)(ref r)).y + 5f, 2f, 9f), new Color(1f, 1f, 1f, 0.55f)); if (_resizing) { float num = Mathf.Max(0.1f, ModConfig.UiScale.Value); float num2 = Input.mousePosition.x / num; float num3 = ((float)Screen.height - Input.mousePosition.y) / num; ((Rect)(ref _rect)).width = Mathf.Clamp(num2 - ((Rect)(ref _rect)).x + 3f, 260f, 800f); ((Rect)(ref _rect)).height = Mathf.Clamp(num3 - ((Rect)(ref _rect)).y + 3f, 240f, 900f); if (!Input.GetMouseButton(0)) { _resizing = false; } } } } internal static class MenuRoot { [CompilerGenerated] private static class <>O { public static WindowFunction <0>__DrawWindow; } private const int WindowId = 5995008; internal static bool Visible; internal static int ActiveTab; private static Rect _rect = new Rect(40f, 60f, 540f, 600f); private static Vector2 _scroll; private static List _groups; private static bool _posLoaded; private static GUIStyle _headerBar; private static GUIStyle _sidebar; private static GUIStyle _hudBox; private static GUIStyle _hudTitle; private static GUIStyle _hudLine; private static bool _resizing; private const float MinW = 400f; private const float MinH = 340f; private const float MaxW = 1100f; private const float MaxH = 960f; private static Vector2 _sideScroll; internal static string CurrentTabName { get { if (_groups == null || _groups.Count <= 0) { return ""; } return _groups[Mathf.Clamp(ActiveTab, 0, _groups.Count - 1)].Name; } } internal static void Draw(List groups) { //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Expected O, but got Unknown _groups = groups; EnsureLocalStyles(); if (!_posLoaded) { ((Rect)(ref _rect)).x = ModConfig.WindowX.Value; ((Rect)(ref _rect)).y = ModConfig.WindowY.Value; ((Rect)(ref _rect)).width = Mathf.Clamp(ModConfig.WindowW.Value, 400f, 1100f); ((Rect)(ref _rect)).height = Mathf.Clamp(ModConfig.WindowH.Value, 340f, 960f); _posLoaded = true; } if (Visible) { Rect rect = _rect; object obj = <>O.<0>__DrawWindow; if (obj == null) { WindowFunction val = DrawWindow; <>O.<0>__DrawWindow = val; obj = (object)val; } _rect = GUI.Window(5995008, rect, (WindowFunction)obj, "", Theme.Window); } else if (ModConfig.ShowHud.Value && PlayerContext.InGame) { DrawHud(); } ListPicker.Draw(); } internal static void SaveLayout() { ModConfig.WindowX.Value = ((Rect)(ref _rect)).x; ModConfig.WindowY.Value = ((Rect)(ref _rect)).y; ModConfig.WindowW.Value = ((Rect)(ref _rect)).width; ModConfig.WindowH.Value = ((Rect)(ref _rect)).height; } internal static void ResetPosition() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) _rect = new Rect(40f, 60f, 540f, 600f); SaveLayout(); } internal static void SelectTabByName(string name) { if (_groups == null) { return; } for (int i = 0; i < _groups.Count; i++) { if (_groups[i].Name == name) { ActiveTab = i; Visible = true; return; } } for (int j = 0; j < _groups.Count; j++) { for (int k = 0; k < _groups[j].Pages.Count; k++) { if (_groups[j].Pages[k].Name == name) { ActiveTab = j; _groups[j].Page = k; Visible = true; return; } } } } private static void EnsureLocalStyles() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_002c: Expected O, but got Unknown //IL_0036: 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_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown //IL_0068: Expected O, but got Unknown //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: 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_00a1: Expected O, but got Unknown //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Expected O, but got Unknown //IL_00b7: Unknown result type (might be due to invalid IL or missing references) if (_headerBar == null) { _headerBar = new GUIStyle(GUI.skin.box) { padding = new RectOffset(10, 8, 0, 0) }; _headerBar.normal.background = Theme.Solid(Theme.HeaderBg); _sidebar = new GUIStyle(GUI.skin.box) { padding = new RectOffset(6, 6, 8, 8) }; _sidebar.normal.background = Theme.Solid(Theme.SidebarBg); _hudBox = new GUIStyle(GUI.skin.box) { padding = new RectOffset(10, 10, 8, 8), alignment = (TextAnchor)0 }; _hudBox.normal.background = Theme.Solid(Theme.WindowBg); } } private static void DrawWindow(int id) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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) if (_groups == null || _groups.Count == 0) { GUI.DragWindow(); return; } ActiveTab = Mathf.Clamp(ActiveTab, 0, _groups.Count - 1); if ((int)Event.current.type == 0) { Rect val = new Rect(((Rect)(ref _rect)).width - 26f, ((Rect)(ref _rect)).height - 26f, 26f, 26f); if (((Rect)(ref val)).Contains(Event.current.mousePosition)) { _resizing = true; Event.current.Use(); } } DrawHeaderBar(); GUILayout.BeginHorizontal(Array.Empty()); DrawSidebar(); DrawContent(); GUILayout.EndHorizontal(); DrawFooter(); HandleResize(); GUI.DragWindow(new Rect(0f, 0f, ((Rect)(ref _rect)).width, 40f)); } private static void HandleResize() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) Rect r = default(Rect); ((Rect)(ref r))..ctor(((Rect)(ref _rect)).width - 18f, ((Rect)(ref _rect)).height - 18f, 16f, 16f); Theme.Fill(r, Theme.Accent); Theme.Fill(new Rect(((Rect)(ref r)).x + 5f, ((Rect)(ref r)).y + 10f, 9f, 2f), new Color(1f, 1f, 1f, 0.55f)); Theme.Fill(new Rect(((Rect)(ref r)).x + 10f, ((Rect)(ref r)).y + 5f, 2f, 9f), new Color(1f, 1f, 1f, 0.55f)); if (_resizing) { float num = Mathf.Max(0.1f, ModConfig.UiScale.Value); float num2 = Input.mousePosition.x / num; float num3 = ((float)Screen.height - Input.mousePosition.y) / num; ((Rect)(ref _rect)).width = Mathf.Clamp(num2 - ((Rect)(ref _rect)).x + 3f, 400f, 1100f); ((Rect)(ref _rect)).height = Mathf.Clamp(num3 - ((Rect)(ref _rect)).y + 3f, 340f, 960f); if (!Input.GetMouseButton(0)) { _resizing = false; SaveLayout(); } } } private static void DrawHeaderBar() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown GUILayout.BeginHorizontal(_headerBar, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(40f) }); GUILayout.Label("P O P P Y", Theme.Header, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(140f) }); GUIStyle val = new GUIStyle(Theme.Hint) { alignment = (TextAnchor)3 }; GUILayout.Label("v2.2.3", val, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(46f) }); GUILayout.FlexibleSpace(); DrawStatusPill(); if (GUILayout.Button("-", Theme.IconBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(26f), GUILayout.Height(22f) })) { ModConfig.UiScale.Value = Mathf.Clamp(ModConfig.UiScale.Value - 0.1f, 0.6f, 2f); } if (GUILayout.Button("+", Theme.IconBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(26f), GUILayout.Height(22f) })) { ModConfig.UiScale.Value = Mathf.Clamp(ModConfig.UiScale.Value + 0.1f, 0.6f, 2f); } if (GUILayout.Button("X", Theme.IconBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(26f), GUILayout.Height(22f) })) { Visible = false; SaveLayout(); ListPicker.Close(); } GUILayout.EndHorizontal(); } private static void DrawStatusPill() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) string text; Color textColor = default(Color); if (!PlayerContext.InGame) { text = "MAIN MENU"; textColor = Theme.TextDim; } else if (NetUtil.IsServer) { text = "IN RUN · HOST"; textColor = Theme.On; } else { text = "IN RUN · CLIENT"; ((Color)(ref textColor))..ctor(0.95f, 0.8f, 0.3f); } Theme.Pill.normal.textColor = textColor; GUILayout.Label("* " + text, Theme.Pill, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(22f) }); } private static void DrawSidebar() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) GUILayout.BeginVertical(_sidebar, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(132f), GUILayout.Height(((Rect)(ref _rect)).height - 86f) }); _sideScroll = GUILayout.BeginScrollView(_sideScroll, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(132f) }); for (int i = 0; i < _groups.Count; i++) { bool flag = i == ActiveTab; if (GUILayout.Button(_groups[i].Name, flag ? Theme.SideItemActive : Theme.SideItem, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { ActiveTab = i; } } GUILayout.EndScrollView(); GUILayout.EndVertical(); } private static void DrawContent() { //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) GUILayout.BeginVertical(Array.Empty()); if (!PlayerContext.InGame) { GUILayout.Label("Start a run to use most features.", Theme.Hint, Array.Empty()); } TabGroup tabGroup = _groups[ActiveTab]; tabGroup.Page = Mathf.Clamp(tabGroup.Page, 0, tabGroup.Pages.Count - 1); bool flag = tabGroup.Pages.Count > 1; if (flag) { GUILayout.BeginHorizontal(Array.Empty()); for (int i = 0; i < tabGroup.Pages.Count; i++) { bool flag2 = i == tabGroup.Page; if (GUILayout.Button(tabGroup.Pages[i].Name, flag2 ? Theme.Primary : Theme.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(24f) })) { tabGroup.Page = i; } } GUILayout.EndHorizontal(); GUILayout.Space(2f); } PoppyModule poppyModule = tabGroup.Pages[tabGroup.Page]; _scroll = GUILayout.BeginScrollView(_scroll, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(((Rect)(ref _rect)).height - 86f - (float)(flag ? 30 : 0)) }); Widgets.OpenSections = 0; try { poppyModule.DrawMenu(); } catch (Exception arg) { while (Widgets.OpenSections > 0) { Widgets.SectionEnd(); } GUILayout.Label("This tab hit an error, see console.", Theme.Label, Array.Empty()); Log.Error($"{poppyModule.Name}.DrawMenu: {arg}"); } GUILayout.EndScrollView(); GUILayout.EndVertical(); } private static void DrawFooter() { //IL_0035: 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) //IL_004b: Expected O, but got Unknown //IL_005a: Unknown result type (might be due to invalid IL or missing references) GUILayout.BeginHorizontal(Array.Empty()); int count = ActiveEffects().Count; GUILayout.Label((count > 0) ? $"* {count} active" : "* idle", new GUIStyle(Theme.Hint) { richText = true }, Array.Empty()); GUILayout.FlexibleSpace(); GUILayout.Label($"[{ModConfig.ToggleMenuKey.Value}] toggle · drag header to move", Theme.Hint, Array.Empty()); GUILayout.EndHorizontal(); } private static void DrawHud() { //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: 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_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown if (_hudTitle == null) { _hudTitle = new GUIStyle(Theme.Label) { richText = true, fontSize = 12, wordWrap = false }; _hudLine = new GUIStyle(Theme.Hint) { richText = true, fontSize = 11, wordWrap = false }; } List list = ActiveEffects(); float num = 36f + (float)list.Count * 16f; GUILayout.BeginArea(new Rect(10f, 10f, 220f, num), _hudBox); GUILayout.Label("POPPY [" + ((object)ModConfig.ToggleMenuKey.Value/*cast due to .constrained prefix*/).ToString() + "]", _hudTitle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(20f) }); foreach (string item in list) { GUILayout.Label("* " + item, _hudLine, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(16f) }); } GUILayout.EndArea(); } internal static List ActiveEffects() { List list = new List(); if (PlayerModule.GodMode) { list.Add("God Mode"); } if (PlayerModule.InfiniteSkills) { list.Add("Infinite Skills"); } if (Aim.Enabled) { list.Add("Aimbot"); } if (Aim.MagicBullet) { list.Add("Magic Bullet"); } if (MovementModule.Flight) { list.Add("Flight"); } if (MovementModule.NoClip) { list.Add("No-Clip"); } if (MovementModule.AlwaysSprint) { list.Add("Always Sprint"); } if (MovementModule.JumpPack) { list.Add("Jump Pack"); } if (StatsModule.Active) { list.Add("Stat Mods"); } if (ItemsModule.NoEquipmentCooldown) { list.Add("No Equip Cooldown"); } if (RenderModule.EspMobs || RenderModule.EspInteractables || RenderModule.EspTeleporter) { list.Add("ESP"); } if (WorldModule.FreezeMatch) { list.Add("Match Frozen"); } if (WorldModule.FreezeTimer) { list.Add("Timer Frozen"); } if (Math.Abs(WorldModule.TimeScale - 1f) > 0.001f && !WorldModule.FreezeMatch) { list.Add($"Time {WorldModule.TimeScale:0.##}x"); } return list; } } internal static class Rebind { internal static ConfigEntry Listening; private static Action _callback; internal static bool IsActive { get { if (Listening == null) { return _callback != null; } return true; } } internal static void Capture(ConfigEntry entry) { Listening = entry; _callback = null; } internal static void Capture(Action callback) { _callback = callback; Listening = null; } internal static void Cancel() { Listening = null; _callback = null; } private static void Apply(KeyCode kc) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) if (Listening != null) { Listening.Value = kc; } else { _callback?.Invoke(kc); } Listening = null; _callback = null; } internal static void Poll() { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Invalid comparison between Unknown and I4 //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected I4, but got Unknown //IL_007a: 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) if (!IsActive) { return; } if (Input.GetKeyDown((KeyCode)27)) { Cancel(); return; } for (int i = 1; i <= 6; i++) { if (Input.GetMouseButtonDown(i)) { Apply((KeyCode)(323 + i)); return; } } if (!Input.anyKeyDown) { return; } foreach (KeyCode value in Enum.GetValues(typeof(KeyCode))) { if ((int)value != 27) { int num = (int)value; if ((num < 323 || num > 329) && Input.GetKeyDown(value)) { Apply(value); break; } } } } } internal static class SoftCursor { private static Texture2D _tex; private static readonly string[] Art = new string[19] { "O...........", "OO..........", "O#O.........", "O##O........", "O###O.......", "O####O......", "O#####O.....", "O######O....", "O#######O...", "O########O..", "O#########O.", "O######OOOOO", "O###O##O....", "O##OO##O....", "O#O.O##O....", "OO..O##O....", "O....O##O...", ".....O##O...", ".....OOOO..." }; internal static void Draw() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: 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) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_tex == (Object)null) { Build(); } Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(Input.mousePosition.x, (float)Screen.height - Input.mousePosition.y); Color color = GUI.color; GUI.color = Color.white; GUI.DrawTexture(new Rect(val.x, val.y, (float)((Texture)_tex).width, (float)((Texture)_tex).height), (Texture)(object)_tex); GUI.color = color; } private static void Build() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: 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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) int num = Art.Length; int length = Art[0].Length; _tex = new Texture2D(length, num, (TextureFormat)4, false) { filterMode = (FilterMode)0, hideFlags = (HideFlags)61 }; Color white = Color.white; Color val = default(Color); ((Color)(ref val))..ctor(0.05f, 0.05f, 0.07f, 1f); Color val2 = default(Color); ((Color)(ref val2))..ctor(0f, 0f, 0f, 0f); for (int i = 0; i < num; i++) { string text = Art[i]; for (int j = 0; j < length; j++) { Color val3 = (Color)(((j < text.Length) ? text[j] : '.') switch { 'O' => val, '#' => white, _ => val2, }); _tex.SetPixel(j, num - 1 - i, val3); } } _tex.Apply(); } } internal static class StepBuilder { private static int _amount = 1; private static float _duration; private static string _command = ""; internal static void Draw(Action onAdd) { _amount = Widgets.IntStepper("Count / amount", _amount, 1, 1, 1000000000); _duration = Widgets.Slider("Buff duration (0 = permanent)", _duration, 0f, 120f); GUILayout.BeginHorizontal(Array.Empty()); Widgets.Button("Item", delegate { ItemPicker.Open("Pick an item", delegate(ItemIndex idx) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected I4, but got Unknown Done(onAdd, Steps.Item((int)idx, _amount)); }); }); Widgets.Button("Buff", delegate { ListPicker.Open("Pick a buff", BuffRows(onAdd)); }); Widgets.Button("Equipment", delegate { ListPicker.Open("Pick equipment", EquipRows(onAdd)); }); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty()); Widgets.Button("Become", delegate { ListPicker.Open("Pick a body", BodyRows(onAdd)); }); Widgets.Button("Spawn", delegate { ListPicker.Open("Pick something to spawn", SpawnRows(onAdd)); }); Widgets.Button("Feature", delegate { ListPicker.Open("Pick a feature", FeatureRows(onAdd)); }); Widgets.Button("Macro", delegate { ListPicker.Open("Pick a macro", MacroRows(onAdd)); }); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty()); Widgets.Button("Money +" + _amount, delegate { Done(onAdd, Steps.Money(_amount)); }); Widgets.Button("XP +" + _amount, delegate { Done(onAdd, Steps.Xp(_amount)); }); Widgets.Button("Lunar +" + _amount, delegate { Done(onAdd, Steps.Lunar(_amount)); }); Widgets.Button("Heal full", delegate { Done(onAdd, Steps.Heal(0)); }); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty()); _command = GUILayout.TextField(_command ?? "", Theme.Search, Array.Empty()); if (GUILayout.Button("Add command", Theme.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(110f) }) && !string.IsNullOrWhiteSpace(_command)) { Done(onAdd, Steps.Command(_command.Trim())); _command = ""; } GUILayout.EndHorizontal(); } private static void Done(Action onAdd, CustomStep s) { onAdd(s); Notify.Push("Added " + s.Label); } private static List BuffRows(Action onAdd) { //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) List list = new List(Catalogs.Buffs.Count); foreach (Catalogs.BuffEntry buff in Catalogs.Buffs) { Catalogs.BuffEntry e = buff; list.Add(new ListPicker.Row(e.Name, e.IsDebuff ? Color.red : Color.cyan, delegate { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected I4, but got Unknown Done(onAdd, Steps.Buff((int)e.Index, _duration)); })); } return list; } private static List EquipRows(Action onAdd) { //IL_005d: Unknown result type (might be due to invalid IL or missing references) List list = new List(Catalogs.Equipment.Count); foreach (Catalogs.EquipEntry item in Catalogs.Equipment) { Catalogs.EquipEntry e = item; list.Add(new ListPicker.Row(e.Name, e.Color, delegate { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected I4, but got Unknown Done(onAdd, Steps.Equipment((int)e.Index)); })); } return list; } private static List BodyRows(Action onAdd) { //IL_0064: Unknown result type (might be due to invalid IL or missing references) List list = new List(Catalogs.Bodies.Count); foreach (Catalogs.BodyEntry body in Catalogs.Bodies) { if (!((Object)(object)body.Prefab == (Object)null)) { Catalogs.BodyEntry e = body; list.Add(new ListPicker.Row(e.Name, Color.white, delegate { Done(onAdd, Steps.Become(((Object)e.Prefab).name, e.Name)); })); } } return list; } private static List SpawnRows(Action onAdd) { //IL_005e: 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_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) List list = new List(Catalogs.SpawnCards.Count); foreach (Catalogs.SpawnEntry spawnCard in Catalogs.SpawnCards) { Catalogs.SpawnEntry e = spawnCard; Color color = (e.IsInteractable ? Color.cyan : Color.red); list.Add(new ListPicker.Row(e.Name, color, delegate { Done(onAdd, Steps.Spawn(e.Name, _amount, 2, e.Name)); })); } return list; } private static List FeatureRows(Action onAdd) { //IL_006b: Unknown result type (might be due to invalid IL or missing references) List list = new List(ActionRegistry.All.Count); foreach (PoppyAction item in ActionRegistry.All) { PoppyAction act = item; list.Add(new ListPicker.Row(act.Category + ": " + act.Name, Color.white, delegate { Done(onAdd, Steps.Feature(act.Id)); })); } return list; } private static List MacroRows(Action onAdd) { //IL_0056: Unknown result type (might be due to invalid IL or missing references) List list = new List(MacroStore.Macros.Count); foreach (Macro macro2 in MacroStore.Macros) { Macro macro = macro2; list.Add(new ListPicker.Row(macro.Name, Color.yellow, delegate { Done(onAdd, Steps.Macro(macro.Name)); })); } return list; } } internal static class Theme { internal static Color Accent = Color32.op_Implicit(new Color32((byte)229, (byte)56, (byte)74, byte.MaxValue)); internal static Color Accent2 = Color32.op_Implicit(new Color32((byte)240, (byte)88, (byte)78, byte.MaxValue)); internal static readonly Color On = Color32.op_Implicit(new Color32((byte)79, (byte)199, (byte)107, byte.MaxValue)); internal static readonly Color Danger = Color32.op_Implicit(new Color32((byte)158, (byte)41, (byte)41, byte.MaxValue)); internal static readonly Color Text = Color32.op_Implicit(new Color32((byte)236, (byte)236, (byte)243, byte.MaxValue)); internal static readonly Color TextDim = Color32.op_Implicit(new Color32((byte)138, (byte)138, (byte)153, byte.MaxValue)); internal static readonly Color WindowBg = Color32.op_Implicit(new Color32((byte)18, (byte)12, (byte)14, (byte)247)); internal static readonly Color SidebarBg = Color32.op_Implicit(new Color32((byte)12, (byte)8, (byte)9, byte.MaxValue)); internal static readonly Color HeaderBg = Color32.op_Implicit(new Color32((byte)34, (byte)18, (byte)21, byte.MaxValue)); internal static readonly Color CardBg = Color32.op_Implicit(new Color32((byte)30, (byte)22, (byte)24, byte.MaxValue)); internal static readonly Color RowBg = Color32.op_Implicit(new Color32((byte)40, (byte)28, (byte)30, byte.MaxValue)); internal static readonly Color SlotOff = Color32.op_Implicit(new Color32((byte)54, (byte)42, (byte)44, byte.MaxValue)); internal static readonly Color Hovered = Color32.op_Implicit(new Color32((byte)78, (byte)36, (byte)42, byte.MaxValue)); internal static GUIStyle Window; internal static GUIStyle Header; internal static GUIStyle SubHeader; internal static GUIStyle Label; internal static GUIStyle Hint; internal static GUIStyle Pill; internal static GUIStyle Button; internal static GUIStyle Primary; internal static GUIStyle Danger_; internal static GUIStyle SideItem; internal static GUIStyle SideItemActive; internal static GUIStyle SwitchOn; internal static GUIStyle SwitchOff; internal static GUIStyle Card; internal static GUIStyle Search; internal static GUIStyle RowButton; internal static GUIStyle IconBtn; internal static GUIStyle ChipLabel; private static bool _ready; private static Texture2D _trans; internal static Texture2D Solid(Color c) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_000b: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(1, 1); val.SetPixel(0, 0, c); val.Apply(); ((Object)val).hideFlags = (HideFlags)61; return val; } internal static void EnsureInit() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: 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_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Expected O, but got Unknown //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Expected O, but got Unknown //IL_0106: Expected O, but got Unknown //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: 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_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Expected O, but got Unknown //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Expected O, but got Unknown //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Expected O, but got Unknown //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Expected O, but got Unknown //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Expected O, but got Unknown //IL_0239: Expected O, but got Unknown //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Expected O, but got Unknown //IL_0290: Expected O, but got Unknown //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02f0: Unknown result type (might be due to invalid IL or missing references) //IL_02fa: Expected O, but got Unknown //IL_0315: Unknown result type (might be due to invalid IL or missing references) //IL_0329: Unknown result type (might be due to invalid IL or missing references) //IL_033d: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Expected O, but got Unknown //IL_0374: Unknown result type (might be due to invalid IL or missing references) //IL_038d: Unknown result type (might be due to invalid IL or missing references) //IL_03b2: Unknown result type (might be due to invalid IL or missing references) //IL_03b7: Unknown result type (might be due to invalid IL or missing references) //IL_03bf: Unknown result type (might be due to invalid IL or missing references) //IL_03c6: Unknown result type (might be due to invalid IL or missing references) //IL_03cc: Unknown result type (might be due to invalid IL or missing references) //IL_03d6: Expected O, but got Unknown //IL_03db: Expected O, but got Unknown //IL_03f5: Unknown result type (might be due to invalid IL or missing references) //IL_041a: Unknown result type (might be due to invalid IL or missing references) //IL_0429: Unknown result type (might be due to invalid IL or missing references) //IL_0433: Expected O, but got Unknown //IL_044d: Unknown result type (might be due to invalid IL or missing references) //IL_0467: Unknown result type (might be due to invalid IL or missing references) //IL_046c: Unknown result type (might be due to invalid IL or missing references) //IL_0473: Unknown result type (might be due to invalid IL or missing references) //IL_047a: Unknown result type (might be due to invalid IL or missing references) //IL_0484: Expected O, but got Unknown //IL_0489: Expected O, but got Unknown //IL_04b6: Unknown result type (might be due to invalid IL or missing references) //IL_04f2: Unknown result type (might be due to invalid IL or missing references) //IL_050b: Unknown result type (might be due to invalid IL or missing references) //IL_051a: Unknown result type (might be due to invalid IL or missing references) //IL_0524: Expected O, but got Unknown //IL_0550: Unknown result type (might be due to invalid IL or missing references) //IL_0564: Unknown result type (might be due to invalid IL or missing references) //IL_0569: Unknown result type (might be due to invalid IL or missing references) //IL_0571: Unknown result type (might be due to invalid IL or missing references) //IL_057b: Expected O, but got Unknown //IL_057b: Unknown result type (might be due to invalid IL or missing references) //IL_0580: Unknown result type (might be due to invalid IL or missing references) //IL_058a: Expected O, but got Unknown //IL_058f: Expected O, but got Unknown //IL_05a9: Unknown result type (might be due to invalid IL or missing references) //IL_05ae: Unknown result type (might be due to invalid IL or missing references) //IL_05b6: Unknown result type (might be due to invalid IL or missing references) //IL_05bb: Unknown result type (might be due to invalid IL or missing references) //IL_05c5: Expected O, but got Unknown //IL_05ca: Expected O, but got Unknown //IL_05d4: Unknown result type (might be due to invalid IL or missing references) //IL_05e3: Unknown result type (might be due to invalid IL or missing references) //IL_05e8: Unknown result type (might be due to invalid IL or missing references) //IL_05ef: Unknown result type (might be due to invalid IL or missing references) //IL_05f7: Unknown result type (might be due to invalid IL or missing references) //IL_05fd: Unknown result type (might be due to invalid IL or missing references) //IL_0607: Expected O, but got Unknown //IL_060c: Expected O, but got Unknown //IL_0633: Unknown result type (might be due to invalid IL or missing references) //IL_0638: Unknown result type (might be due to invalid IL or missing references) //IL_0640: Unknown result type (might be due to invalid IL or missing references) //IL_0647: Unknown result type (might be due to invalid IL or missing references) //IL_064c: Unknown result type (might be due to invalid IL or missing references) //IL_0656: Expected O, but got Unknown //IL_0656: Unknown result type (might be due to invalid IL or missing references) //IL_0662: Expected O, but got Unknown //IL_066c: Unknown result type (might be due to invalid IL or missing references) //IL_0671: Unknown result type (might be due to invalid IL or missing references) //IL_0679: Unknown result type (might be due to invalid IL or missing references) //IL_0685: Expected O, but got Unknown //IL_068f: Unknown result type (might be due to invalid IL or missing references) if (!_ready) { _ready = true; _trans = Solid(new Color(0f, 0f, 0f, 0f)); Texture2D background = Solid(WindowBg); Texture2D background2 = Solid(SidebarBg); Texture2D val = Solid(HeaderBg); Texture2D background3 = Solid(CardBg); Texture2D background4 = Solid(RowBg); Texture2D background5 = Solid(SlotOff); Texture2D background6 = Solid(Hovered); Texture2D background7 = Solid(Accent); Texture2D background8 = Solid(new Color(Accent.r, Accent.g, Accent.b, 0.35f)); Texture2D val2 = Solid(On); Texture2D background9 = Solid(Danger); Window = new GUIStyle(GUI.skin.box) { padding = new RectOffset(0, 0, 0, 0), border = new RectOffset(2, 2, 2, 2) }; Window.normal.background = background; Header = new GUIStyle(GUI.skin.label) { fontStyle = (FontStyle)1, fontSize = 15, alignment = (TextAnchor)3 }; Header.normal.textColor = Text; SubHeader = new GUIStyle(GUI.skin.label) { fontStyle = (FontStyle)1, fontSize = 12, alignment = (TextAnchor)3 }; SubHeader.normal.textColor = Accent2; Label = new GUIStyle(GUI.skin.label) { fontSize = 12, wordWrap = true }; Label.normal.textColor = Text; Hint = new GUIStyle(GUI.skin.label) { fontSize = 10, wordWrap = true }; Hint.normal.textColor = TextDim; Pill = new GUIStyle(GUI.skin.label) { fontSize = 10, fontStyle = (FontStyle)1, alignment = (TextAnchor)4, padding = new RectOffset(8, 8, 3, 3) }; Pill.normal.textColor = Text; Pill.normal.background = background4; Button = new GUIStyle(GUI.skin.button) { fontSize = 12, alignment = (TextAnchor)4, padding = new RectOffset(8, 8, 6, 6) }; Button.normal.background = background5; Button.normal.textColor = Text; Button.hover.background = background6; Button.hover.textColor = Color.white; Button.active.background = background8; Primary = new GUIStyle(Button); Primary.normal.background = background7; Primary.normal.textColor = Color.white; Primary.hover.background = Solid(Accent2); Danger_ = new GUIStyle(Button); Danger_.normal.background = Solid(new Color(Danger.r, Danger.g, Danger.b, 0.85f)); Danger_.normal.textColor = Color.white; Danger_.hover.background = background9; SideItem = new GUIStyle(GUI.skin.button) { fontSize = 12, alignment = (TextAnchor)3, padding = new RectOffset(12, 6, 8, 8) }; SideItem.normal.background = background2; SideItem.normal.textColor = TextDim; SideItem.hover.background = background6; SideItem.hover.textColor = Text; SideItemActive = new GUIStyle(SideItem); SideItemActive.normal.background = background3; SideItemActive.normal.textColor = Color.white; SideItemActive.fontStyle = (FontStyle)1; SwitchOn = new GUIStyle(Button) { alignment = (TextAnchor)3, padding = new RectOffset(10, 10, 7, 7) }; SwitchOn.normal.background = Solid(new Color(On.r, On.g, On.b, 0.22f)); SwitchOn.hover.background = Solid(new Color(On.r, On.g, On.b, 0.32f)); SwitchOn.normal.textColor = Color.white; SwitchOff = new GUIStyle(SwitchOn); SwitchOff.normal.background = background4; SwitchOff.hover.background = background6; SwitchOff.normal.textColor = TextDim; Card = new GUIStyle(GUI.skin.box) { padding = new RectOffset(10, 10, 8, 10), margin = new RectOffset(0, 0, 4, 4) }; Card.normal.background = background3; Search = new GUIStyle(GUI.skin.textField) { fontSize = 12, padding = new RectOffset(8, 8, 6, 6) }; Search.normal.textColor = Text; RowButton = new GUIStyle(Button) { alignment = (TextAnchor)3, fontSize = 12, padding = new RectOffset(26, 8, 6, 6) }; RowButton.normal.background = background4; RowButton.hover.background = background6; IconBtn = new GUIStyle(Button) { fontSize = 12, fontStyle = (FontStyle)1, padding = new RectOffset(0, 0, 2, 2), alignment = (TextAnchor)4 }; ChipLabel = new GUIStyle(GUI.skin.label) { fontSize = 11, alignment = (TextAnchor)3 }; ChipLabel.normal.textColor = Text; GUIStyle header = Header; GUIStyle subHeader = SubHeader; GUIStyle label = Label; GUIStyle hint = Hint; bool flag = (Pill.richText = true); bool flag3 = (hint.richText = flag); bool flag5 = (label.richText = flag3); bool richText = (subHeader.richText = flag5); header.richText = richText; } } internal static void ApplyAccent(Color c) { //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_0006: 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_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) Accent = c; Accent2 = Color.Lerp(c, Color.white, 0.18f); _ready = false; } internal static string Hex(Color c) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return ColorUtility.ToHtmlStringRGB(c); } internal static void Fill(Rect r, Color c) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) Color color = GUI.color; GUI.color = c; GUI.DrawTexture(r, (Texture)(object)Texture2D.whiteTexture); GUI.color = color; } } internal static class Widgets { private static GUIStyle _chip; private static string _armed; internal static int OpenSections; private static GUIStyle Chip { get { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown if (_chip == null) { _chip = new GUIStyle(GUI.skin.label) { fontSize = 10, fontStyle = (FontStyle)1, alignment = (TextAnchor)4 }; } _chip.normal.textColor = Color.white; return _chip; } } internal static void Header(string text) { GUILayout.Space(2f); GUILayout.Label(text.ToUpperInvariant(), Theme.SubHeader, Array.Empty()); } internal static void Label(string text) { GUILayout.Label(text, Theme.Label, Array.Empty()); } internal static void Hint(string text) { GUILayout.Label(text, Theme.Hint, Array.Empty()); } internal static void Separator() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) Rect rect = GUILayoutUtility.GetRect(1f, 1f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); Theme.Fill(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, ((Rect)(ref rect)).width, 1f), new Color(1f, 1f, 1f, 0.06f)); } internal static bool Button(string text) { return GUILayout.Button(text, Theme.Button, Array.Empty()); } internal static void Button(string text, Action onClick) { if (GUILayout.Button(text, Theme.Button, Array.Empty())) { onClick?.Invoke(); } } internal static void PrimaryButton(string text, Action onClick) { if (GUILayout.Button(text, Theme.Primary, Array.Empty())) { onClick?.Invoke(); } } internal static void DangerButton(string text, Action onClick) { if (GUILayout.Button(text, Theme.Danger_, Array.Empty())) { onClick?.Invoke(); } } internal static void ConfirmButton(string id, string text, Action onConfirm) { bool flag = _armed == id; if (GUILayout.Button(flag ? ("Confirm, " + text + "?") : text, flag ? Theme.Danger_ : Theme.Button, Array.Empty())) { if (flag) { _armed = null; onConfirm?.Invoke(); } else { _armed = id; } } } internal static bool Toggle(string label, bool value) { return Toggle(label, value, (KeyCode)0); } internal unsafe static bool Toggle(string label, bool value, KeyCode key) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) bool flag = GUILayout.Button(label, value ? Theme.SwitchOn : Theme.SwitchOff, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) }); Rect lastRect = GUILayoutUtility.GetLastRect(); float num = ((Rect)(ref lastRect)).xMax - 46f; if ((int)key != 0) { Rect val = default(Rect); ((Rect)(ref val))..ctor(((Rect)(ref lastRect)).xMax - 92f, ((Rect)(ref lastRect)).y + 6f, 42f, 16f); GUI.Label(val, ((object)(*(KeyCode*)(&key))/*cast due to .constrained prefix*/).ToString(), Theme.Hint); } Rect val2 = default(Rect); ((Rect)(ref val2))..ctor(num, ((Rect)(ref lastRect)).y + (((Rect)(ref lastRect)).height - 16f) / 2f, 38f, 16f); Theme.Fill(val2, value ? Theme.On : Theme.SlotOff); GUI.Label(val2, value ? "ON" : "OFF", Chip); if (!flag) { return value; } return !value; } internal static int IntStepper(string label, int value, int step, int min = int.MinValue, int max = int.MaxValue) { GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(label, Theme.Label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(80f) }); if (GUILayout.Button("-", Theme.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(30f) })) { value = Mathf.Clamp(value - step, min, max); } GUILayout.Label(value.ToString(), Theme.Label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(64f) }); if (GUILayout.Button("+", Theme.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(30f) })) { value = Mathf.Clamp(value + step, min, max); } GUILayout.EndHorizontal(); return value; } internal static float Slider(string label, float value, float min, float max) { GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label($"{label}: {value:0.##}", Theme.Label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(120f) }); value = GUILayout.HorizontalSlider(value, min, max, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.MinWidth(110f), GUILayout.Height(18f) }); GUILayout.EndHorizontal(); return value; } internal static void SectionBegin(string title) { GUILayout.BeginVertical(Theme.Card, Array.Empty()); OpenSections++; if (!string.IsNullOrEmpty(title)) { GUILayout.Label(title.ToUpperInvariant(), Theme.SubHeader, Array.Empty()); } } internal static void SectionEnd() { if (OpenSections > 0) { GUILayout.EndVertical(); OpenSections--; } } internal static void KeybindRow(string label, ConfigEntry entry) { //IL_0035: 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) GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(label, Theme.Label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(96f) }); bool flag = Rebind.Listening == entry; if (GUILayout.Button(flag ? "press a key/button..." : ((object)entry.Value/*cast due to .constrained prefix*/).ToString(), flag ? Theme.Primary : Theme.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(24f) })) { if (flag) { Rebind.Cancel(); } else { Rebind.Capture(entry); } } if (GUILayout.Button("X", Theme.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(24f) })) { entry.Value = (KeyCode)0; if (flag) { Rebind.Cancel(); } } GUILayout.EndHorizontal(); } internal static void PickerButton(string text, string title, List rows) { if (GUILayout.Button(text, Theme.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) })) { ListPicker.Open(title, rows); } } } internal static class Aim { internal static bool Enabled; internal static bool Active; internal static HurtBox Target; internal static int Sorting; internal static bool UseFov; internal static float Fov = 60f; internal static float MaxRange = 300f; internal static bool RequireLoS; internal static bool PrioritizeBosses; internal static bool Sticky; internal static bool Highlight = true; internal static bool ShowFovCircle; internal static bool MagicBullet; private static Harmony _h; private static GUIStyle _label; internal static void Init() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Expected O, but got Unknown //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Expected O, but got Unknown //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Expected O, but got Unknown _h = new Harmony("poppy.aimbot"); MethodInfo methodInfo = AccessTools.Method(typeof(BulletAttack), "Fire", new Type[0], (Type[])null); if (methodInfo != null) { _h.Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(Aim), "BulletFirePrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } MethodInfo methodInfo2 = AccessTools.Method(typeof(ProjectileManager), "FireProjectile", new Type[1] { typeof(FireProjectileInfo) }, (Type[])null); if (methodInfo2 != null) { _h.Patch((MethodBase)methodInfo2, new HarmonyMethod(typeof(Aim), "FireProjectilePrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } MethodInfo methodInfo3 = AccessTools.Method(typeof(ProjectileManager), "InitializeProjectile", (Type[])null, (Type[])null); if (methodInfo3 != null) { _h.Patch((MethodBase)methodInfo3, (HarmonyMethod)null, new HarmonyMethod(typeof(Aim), "InitProjectilePostfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } internal static void Shutdown() { Target = null; Harmony h = _h; if (h != null) { h.UnpatchSelf(); } _h = null; } internal static void Tick() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) KeyCode value = ModConfig.SilentAimKey.Value; Active = Enabled && ((int)value == 0 || Input.GetKey(value)); if (!Active || !PlayerContext.HasBody) { Target = null; } else { UpdateTarget(); } } private static void UpdateTarget() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) CharacterBody body = PlayerContext.Body; if ((Object)(object)body == (Object)null || (Object)(object)body.teamComponent == (Object)null) { Target = null; return; } Ray aim = PlayerContext.AimRay(); if (Sticky && IsValidTarget(aim)) { return; } Target = null; TeamIndex teamIndex = body.teamComponent.teamIndex; float num = MaxRange * MaxRange; float num2 = float.MaxValue; bool flag = false; foreach (CharacterBody readOnlyInstances in CharacterBody.readOnlyInstancesList) { if (!IsHostile(body, teamIndex, readOnlyInstances)) { continue; } HurtBox val = Util.FindBodyMainHurtBox(readOnlyInstances); if ((Object)(object)val == (Object)null) { continue; } Vector3 val2 = ((Component)val).transform.position - ((Ray)(ref aim)).origin; if (((Vector3)(ref val2)).sqrMagnitude > num) { continue; } float num3 = Vector3.Angle(((Ray)(ref aim)).direction, val2); if ((UseFov && num3 > Fov) || (RequireLoS && Physics.Linecast(((Ray)(ref aim)).origin, ((Component)val).transform.position, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask)))) { continue; } bool isBoss = readOnlyInstances.isBoss; if (PrioritizeBosses) { if (flag && !isBoss) { continue; } if (isBoss && !flag) { Target = val; num2 = Score(readOnlyInstances, num3, ((Vector3)(ref val2)).magnitude); flag = true; continue; } } float num4 = Score(readOnlyInstances, num3, ((Vector3)(ref val2)).magnitude); if (num4 < num2) { num2 = num4; flag = isBoss; Target = val; } } } private static float Score(CharacterBody b, float angle, float dist) { switch (Sorting) { case 1: return dist; case 2: if (!((Object)(object)b.healthComponent != (Object)null)) { return float.MaxValue; } return b.healthComponent.health; case 3: if (!((Object)(object)b.healthComponent != (Object)null)) { return float.MaxValue; } return 0f - b.healthComponent.health; default: return angle; } } private static bool IsHostile(CharacterBody me, TeamIndex myTeam, CharacterBody body) { //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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Invalid comparison between Unknown and I4 //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Invalid comparison between Unknown and I4 if ((Object)(object)body == (Object)null || (Object)(object)body == (Object)(object)me) { return false; } if ((Object)(object)body.healthComponent == (Object)null || !body.healthComponent.alive) { return false; } if ((Object)(object)body.teamComponent == (Object)null) { return false; } TeamIndex teamIndex = body.teamComponent.teamIndex; if (teamIndex != myTeam && (int)teamIndex != -1 && (int)teamIndex != 0) { return (int)teamIndex != 1; } return false; } private static bool IsValidTarget(Ray aim) { //IL_003c: 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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Target == (Object)null || (Object)(object)Target.healthComponent == (Object)null || !Target.healthComponent.alive) { return false; } Vector3 val = ((Component)Target).transform.position - ((Ray)(ref aim)).origin; if (((Vector3)(ref val)).sqrMagnitude > MaxRange * MaxRange) { return false; } if (UseFov && Vector3.Angle(((Ray)(ref aim)).direction, val) > Fov) { return false; } return true; } private static bool IsLocalOwner(GameObject owner) { CharacterBody body = PlayerContext.Body; if ((Object)(object)body != (Object)null && (Object)(object)owner != (Object)null) { return (Object)(object)owner == (Object)(object)((Component)body).gameObject; } return false; } private static void BulletFirePrefix(BulletAttack __instance) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) if (!IsLocalOwner(__instance.owner)) { return; } if (MagicBullet) { __instance.stopperMask = ((LayerIndex)(ref LayerIndex.entityPrecise)).mask; } if (Active && (Object)(object)Target != (Object)null) { Vector3 val = ((Component)Target).transform.position - __instance.origin; if (((Vector3)(ref val)).sqrMagnitude > 0.001f) { __instance.aimVector = ((Vector3)(ref val)).normalized; } } } private static void FireProjectilePrefix(ref FireProjectileInfo fireProjectileInfo) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) if (Active && !((Object)(object)Target == (Object)null) && IsLocalOwner(fireProjectileInfo.owner)) { Vector3 val = ((Component)Target).transform.position - fireProjectileInfo.position; if (((Vector3)(ref val)).sqrMagnitude > 0.001f) { fireProjectileInfo.rotation = Quaternion.LookRotation(((Vector3)(ref val)).normalized); } } } private static void InitProjectilePostfix(ProjectileController projectileController, FireProjectileInfo fireProjectileInfo) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)projectileController == (Object)null || projectileController.isPrediction || !NetUtil.IsServer || !IsLocalOwner(fireProjectileInfo.owner)) { return; } if (MagicBullet) { ((Component)projectileController).gameObject.AddComponent(); } if (Active && (Object)(object)Target != (Object)null) { CharacterBody body = PlayerContext.Body; if ((Object)(object)body != (Object)null && (Object)(object)body.teamComponent != (Object)null) { ((Component)projectileController).gameObject.AddComponent().Init(((Component)Target).transform, body.teamComponent.teamIndex); } } } internal static void DrawOverlay() { if (!Active) { return; } Camera main = Camera.main; if (!((Object)(object)main == (Object)null)) { if (ShowFovCircle && UseFov) { DrawFovCircle(main); } if (Highlight && (Object)(object)Target != (Object)null) { DrawLock(main); } } } private static void DrawLock(Camera cam) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: 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_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Expected O, but got Unknown Vector3 val = cam.WorldToScreenPoint(((Component)Target).transform.position); if (!(val.z <= 0f)) { float num = (float)Screen.height - val.y; Color accent = Theme.Accent; Theme.Fill(new Rect(val.x - 16f, num - 16f, 8f, 2f), accent); Theme.Fill(new Rect(val.x - 16f, num - 16f, 2f, 8f), accent); Theme.Fill(new Rect(val.x + 16f - 8f, num - 16f, 8f, 2f), accent); Theme.Fill(new Rect(val.x + 16f - 2f, num - 16f, 2f, 8f), accent); Theme.Fill(new Rect(val.x - 16f, num + 16f - 2f, 8f, 2f), accent); Theme.Fill(new Rect(val.x - 16f, num + 16f - 8f, 2f, 8f), accent); Theme.Fill(new Rect(val.x + 16f - 8f, num + 16f - 2f, 8f, 2f), accent); Theme.Fill(new Rect(val.x + 16f - 2f, num + 16f - 8f, 2f, 8f), accent); if (_label == null) { _label = new GUIStyle(GUI.skin.label) { fontSize = 10, fontStyle = (FontStyle)1, alignment = (TextAnchor)4 }; } _label.normal.textColor = accent; GUI.Label(new Rect(val.x - 40f, num - 16f - 16f, 80f, 14f), "LOCKED", _label); } } private static void DrawFovCircle(Camera cam) { //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) float num = (float)Screen.height * 0.5f * Mathf.Tan(Fov * (MathF.PI / 180f)) / Mathf.Tan(cam.fieldOfView * 0.5f * (MathF.PI / 180f)); num = Mathf.Clamp(num, 8f, (float)Screen.height); float num2 = (float)Screen.width * 0.5f; float num3 = (float)Screen.height * 0.5f; Color c = default(Color); ((Color)(ref c))..ctor(Theme.Accent.r, Theme.Accent.g, Theme.Accent.b, 0.5f); for (int i = 0; i < 48; i++) { float num4 = (float)i / 48f * MathF.PI * 2f; Theme.Fill(new Rect(num2 + Mathf.Cos(num4) * num - 1f, num3 + Mathf.Sin(num4) * num - 1f, 2f, 2f), c); } } } internal static class Cheats { internal static void DisableAll() { PlayerModule.GodMode = (PlayerModule.InfiniteSkills = false); Aim.Enabled = false; Aim.MagicBullet = false; Aim.Target = null; MovementModule.Flight = (MovementModule.NoClip = (MovementModule.AlwaysSprint = (MovementModule.JumpPack = false))); ItemsModule.NoEquipmentCooldown = false; RenderModule.EspMobs = (RenderModule.EspInteractables = (RenderModule.EspTeleporter = false)); StatsModule.DisableAll(); WorldModule.FreezeMatch = false; WorldModule.FreezeTimer = false; WorldModule.TimeScale = 1f; Notify.Push("All features disabled"); } internal static Preset Capture(string name) { return new Preset { Name = name, God = PlayerModule.GodMode, Skills = PlayerModule.InfiniteSkills, SilentAim = Aim.Enabled, Flight = MovementModule.Flight, Sprint = MovementModule.AlwaysSprint, JumpPack = MovementModule.JumpPack, NoEquipCd = ItemsModule.NoEquipmentCooldown, EspMobs = RenderModule.EspMobs, EspInteractables = RenderModule.EspInteractables, EspTeleporter = RenderModule.EspTeleporter, DmgOn = StatsModule.DamageOn, AtkOn = StatsModule.AttackSpeedOn, MoveOn = StatsModule.MoveSpeedOn, ArmorOn = StatsModule.ArmorOn, CritOn = StatsModule.CritOn, HpOn = StatsModule.MaxHealthOn, DmgMul = StatsModule.DamageMult, AtkMul = StatsModule.AttackSpeedMult, MoveMul = StatsModule.MoveSpeedMult, ArmorMul = StatsModule.ArmorMult, CritMul = StatsModule.CritMult, HpMul = StatsModule.MaxHealthMult, Money = ModConfig.GiveMoneyAmount.Value, Xp = ModConfig.GiveXpAmount.Value, Coins = ModConfig.GiveCoinsAmount.Value }; } internal static void ApplyToggles(Preset p) { if (p != null) { PlayerModule.GodMode = p.God; PlayerModule.InfiniteSkills = p.Skills; Aim.Enabled = p.SilentAim; MovementModule.Flight = p.Flight; MovementModule.AlwaysSprint = p.Sprint; MovementModule.JumpPack = p.JumpPack; ItemsModule.NoEquipmentCooldown = p.NoEquipCd; RenderModule.EspMobs = p.EspMobs; RenderModule.EspInteractables = p.EspInteractables; RenderModule.EspTeleporter = p.EspTeleporter; StatsModule.DamageOn = p.DmgOn; StatsModule.AttackSpeedOn = p.AtkOn; StatsModule.MoveSpeedOn = p.MoveOn; StatsModule.ArmorOn = p.ArmorOn; StatsModule.CritOn = p.CritOn; StatsModule.MaxHealthOn = p.HpOn; StatsModule.DamageMult = p.DmgMul; StatsModule.AttackSpeedMult = p.AtkMul; StatsModule.MoveSpeedMult = p.MoveMul; StatsModule.ArmorMult = p.ArmorMul; StatsModule.CritMult = p.CritMul; StatsModule.MaxHealthMult = p.HpMul; } } internal static void ApplyGrants(Preset p) { //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Invalid comparison between Unknown and I4 //IL_0038: 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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Invalid comparison between Unknown and I4 //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Expected I4, but got Unknown //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected I4, but got Unknown if (p == null) { return; } if (p.Items != null) { foreach (GrantItem item in p.Items) { if (item != null && !string.IsNullOrEmpty(item.Name)) { ItemIndex val = ItemCatalog.FindItemIndex(item.Name); if ((int)val != -1) { NetUtil.Do(PoppyOp.GiveItem, (int)val, Mathf.Max(1, item.Count)); } } } } if (p.Equipment != null) { foreach (string item2 in p.Equipment) { if (!string.IsNullOrEmpty(item2)) { EquipmentIndex val2 = EquipmentCatalog.FindEquipmentIndex(item2); if ((int)val2 != -1) { NetUtil.Do(PoppyOp.GiveEquipment, (int)val2); } } } } if (p.GiveAllItems) { NetUtil.Do(PoppyOp.GiveAllItems, 0, 1); } if (p.Money > 0) { NetUtil.Do(PoppyOp.GiveMoney, p.Money); } if (p.Xp > 0) { NetUtil.Do(PoppyOp.GiveXp, p.Xp); } if (p.Coins > 0) { NetUtil.Do(PoppyOp.GiveLunar, p.Coins); } } internal static void Apply(Preset p) { if (p != null) { ApplyToggles(p); ApplyGrants(p); Notify.Push("Applied preset: " + p.Name); } } } internal static class ConsoleCommands { private static Harmony _h; private static bool _collected; internal static void Init() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Expected O, but got Unknown //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown _h = new Harmony("poppy.concommands"); MethodInfo methodInfo = AccessTools.Method(typeof(Console), "InitConVars", (Type[])null, (Type[])null); if (methodInfo != null) { _h.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(typeof(ConsoleCommands), "AfterInit", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } else { Log.Warning("ConsoleCommands: Console.InitConVars not found; commands may not register."); } if ((Object)(object)Console.instance != (Object)null) { Collect(Console.instance); } } internal static void Shutdown() { Harmony h = _h; if (h != null) { h.UnpatchSelf(); } _h = null; } private static void AfterInit(Console __instance) { Collect(__instance); } private static void Collect(Console console) { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Expected O, but got Unknown if (_collected || (Object)(object)console == (Object)null) { return; } try { IDictionary dictionary = FindCatalog(console); if (dictionary == null) { Log.Warning("ConsoleCommands: command catalog not found."); return; } int num = 0; MethodInfo[] methods = typeof(DebugCommands).GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { ConCommandAttribute customAttribute = ((MemberInfo)methodInfo).GetCustomAttribute(); if (customAttribute != null) { string key = customAttribute.commandName.ToLowerInvariant(); if (!dictionary.Contains(key)) { ConCommand val = new ConCommand(); val.flags = customAttribute.flags; val.helpText = customAttribute.helpText; val.action = (ConCommandDelegate)Delegate.CreateDelegate(typeof(ConCommandDelegate), methodInfo); dictionary[key] = val; num++; } } } _collected = true; Log.Message($"Poppy: registered {num} console commands."); } catch (Exception ex) { Log.Error("ConsoleCommands.Collect: " + ex); } } private static IDictionary FindCatalog(Console console) { FieldInfo[] fields = typeof(Console).GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (FieldInfo fieldInfo in fields) { if (typeof(IDictionary).IsAssignableFrom(fieldInfo.FieldType) && fieldInfo.Name.ToLowerInvariant().Contains("concommand")) { return fieldInfo.GetValue(console) as IDictionary; } } return null; } } internal static class DebugCommands { private const StringComparison OIC = StringComparison.OrdinalIgnoreCase; [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCGiveItem(ConCommandArgs args) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Invalid comparison between Unknown and I4 //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Expected I4, but got Unknown CharacterMaster senderMaster = ((ConCommandArgs)(ref args)).senderMaster; if ((Object)(object)senderMaster == (Object)null) { Print("give_item: no target."); return; } ItemIndex val = ResolveItem(Arg(args, 0)); if ((int)val == -1) { Print("give_item: unknown item."); } else { NetUtil.Execute(PoppyOp.GiveItem, senderMaster, (int)val, ArgInt(args, 1, 1), 0f, 0f, 0f, b1: false, null); } } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCRemoveItem(ConCommandArgs args) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Invalid comparison between Unknown and I4 //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected I4, but got Unknown CharacterMaster senderMaster = ((ConCommandArgs)(ref args)).senderMaster; if (!((Object)(object)senderMaster == (Object)null)) { ItemIndex val = ResolveItem(Arg(args, 0)); if ((int)val == -1) { Print("remove_item: unknown item."); } else { NetUtil.Execute(PoppyOp.RemoveItem, senderMaster, (int)val, ArgInt(args, 1, 1), 0f, 0f, 0f, b1: false, null); } } } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCRemoveAllItems(ConCommandArgs args) { if ((Object)(object)((ConCommandArgs)(ref args)).senderMaster != (Object)null) { NetUtil.Execute(PoppyOp.ClearInventory, ((ConCommandArgs)(ref args)).senderMaster, 0, 0, 0f, 0f, 0f, b1: false, null); } } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCGiveEquipment(ConCommandArgs args) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Invalid comparison between Unknown and I4 //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected I4, but got Unknown CharacterMaster senderMaster = ((ConCommandArgs)(ref args)).senderMaster; if (!((Object)(object)senderMaster == (Object)null)) { string text = Arg(args, 0); EquipmentIndex val = (string.Equals(text, "random", StringComparison.OrdinalIgnoreCase) ? RandomEquip() : ResolveEquip(text)); if ((int)val == -1) { Print("give_equip: unknown equipment."); } else { NetUtil.Execute(PoppyOp.GiveEquipment, senderMaster, (int)val, 0, 0f, 0f, 0f, b1: false, null); } } } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCGiveMoney(ConCommandArgs args) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((ConCommandArgs)(ref args)).senderMaster != (Object)null) { NetUtil.Execute(PoppyOp.GiveMoney, ((ConCommandArgs)(ref args)).senderMaster, ArgInt(args, 0, 0), 0, 0f, 0f, 0f, b1: false, null); } } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCGiveLunar(ConCommandArgs args) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((ConCommandArgs)(ref args)).senderMaster != (Object)null) { NetUtil.Execute(PoppyOp.GiveLunar, ((ConCommandArgs)(ref args)).senderMaster, ArgInt(args, 0, 1), 0, 0f, 0f, 0f, b1: false, null); } } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCRandomItems(ConCommandArgs args) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected I4, but got Unknown CharacterMaster senderMaster = ((ConCommandArgs)(ref args)).senderMaster; if (!((Object)(object)senderMaster == (Object)null) && Catalogs.Items.Count != 0) { int num = Mathf.Clamp(ArgInt(args, 0, 5), 1, 1000); for (int i = 0; i < num; i++) { ItemIndex index = Catalogs.Items[Random.Range(0, Catalogs.Items.Count)].Index; NetUtil.Execute(PoppyOp.GiveItem, senderMaster, (int)index, 1, 0f, 0f, 0f, b1: false, null); } } } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCGiveBuff(ConCommandArgs args) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Invalid comparison between Unknown and I4 //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Expected I4, but got Unknown //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected I4, but got Unknown CharacterMaster senderMaster = ((ConCommandArgs)(ref args)).senderMaster; if ((Object)(object)senderMaster == (Object)null) { return; } BuffIndex val = ResolveBuff(Arg(args, 0)); if ((int)val == -1) { Print("give_buff: unknown buff."); return; } float num = ArgFloat(args, 2, 0f); if (num > 0f) { NetUtil.Execute(PoppyOp.GiveTimedBuff, senderMaster, (int)val, 0, num, 0f, 0f, b1: false, null); } else { NetUtil.Execute(PoppyOp.GiveBuff, senderMaster, (int)val, ArgInt(args, 1, 1), 0f, 0f, 0f, b1: false, null); } } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCRemoveBuff(ConCommandArgs args) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Invalid comparison between Unknown and I4 //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected I4, but got Unknown CharacterMaster senderMaster = ((ConCommandArgs)(ref args)).senderMaster; if (!((Object)(object)senderMaster == (Object)null)) { BuffIndex val = ResolveBuff(Arg(args, 0)); if ((int)val == -1) { Print("remove_buff: unknown buff."); } else { NetUtil.Execute(PoppyOp.RemoveBuff, senderMaster, (int)val, 0, 0f, 0f, 0f, b1: false, null); } } } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCRemoveAllBuffs(ConCommandArgs args) { if ((Object)(object)((ConCommandArgs)(ref args)).senderMaster != (Object)null) { NetUtil.Execute(PoppyOp.RemoveAllBuffs, ((ConCommandArgs)(ref args)).senderMaster, 0, 0, 0f, 0f, 0f, b1: false, null); } } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCGod(ConCommandArgs args) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) PlayerModule.GodMode = Flag(args, 0, PlayerModule.GodMode); Print("god " + PlayerModule.GodMode); } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCBuddha(ConCommandArgs args) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) Safety.Buddha = Flag(args, 0, Safety.Buddha); Print("buddha " + Safety.Buddha); } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCNoclip(ConCommandArgs args) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) MovementModule.NoClip = Flag(args, 0, MovementModule.NoClip); Print("noclip " + MovementModule.NoClip); } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCNoEnemies(ConCommandArgs args) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) Safety.NoEnemies = Flag(args, 0, Safety.NoEnemies); Print("no_enemies " + Safety.NoEnemies); } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCLockExp(ConCommandArgs args) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) Safety.LockExp = Flag(args, 0, Safety.LockExp); Print("lock_exp " + Safety.LockExp); } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCKillAll(ConCommandArgs args) { NetUtil.Execute(PoppyOp.KillAllEnemies, null, 0, 0, 0f, 0f, 0f, b1: false, null); } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCTrueKill(ConCommandArgs args) { if ((Object)(object)((ConCommandArgs)(ref args)).senderMaster != (Object)null) { NetUtil.Execute(PoppyOp.TrueKillTarget, ((ConCommandArgs)(ref args)).senderMaster, 0, 0, 0f, 0f, 0f, b1: false, null); } } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCRespawn(ConCommandArgs args) { if ((Object)(object)((ConCommandArgs)(ref args)).senderMaster != (Object)null) { NetUtil.Execute(PoppyOp.Respawn, ((ConCommandArgs)(ref args)).senderMaster, 0, 0, 0f, 0f, 0f, b1: false, null); } } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCHeal(ConCommandArgs args) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) CharacterMaster senderMaster = ((ConCommandArgs)(ref args)).senderMaster; if (!((Object)(object)senderMaster == (Object)null)) { if (((ConCommandArgs)(ref args)).Count == 0) { NetUtil.Execute(PoppyOp.HealFull, senderMaster, 0, 0, 0f, 0f, 0f, b1: false, null); } else { NetUtil.Execute(PoppyOp.HealAmount, senderMaster, 0, 0, ArgFloat(args, 0, 0f), 0f, 0f, b1: false, null); } } } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCHurt(ConCommandArgs args) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((ConCommandArgs)(ref args)).senderMaster != (Object)null) { NetUtil.Execute(PoppyOp.HurtBody, ((ConCommandArgs)(ref args)).senderMaster, 0, 0, ArgFloat(args, 0, 0f), 0f, 0f, b1: false, null); } } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCTeleportOnCursor(ConCommandArgs args) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_005e: Unknown result type (might be due to invalid IL or missing references) CharacterBody senderBody = ((ConCommandArgs)(ref args)).senderBody; if (!((Object)(object)senderBody == (Object)null) && !((Object)(object)senderBody.inputBank == (Object)null)) { Ray val = default(Ray); ((Ray)(ref val))..ctor(senderBody.inputBank.aimOrigin, senderBody.inputBank.aimDirection); RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(val, ref val2, 2000f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask))) { TeleportHelper.TeleportBody(senderBody, ((RaycastHit)(ref val2)).point); } } } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCChangeTeam(ConCommandArgs args) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected I4, but got Unknown CharacterMaster senderMaster = ((ConCommandArgs)(ref args)).senderMaster; if (!((Object)(object)senderMaster == (Object)null)) { if (!TryResolveTeam(Arg(args, 0), out var team)) { Print("change_team: unknown team."); } else { NetUtil.Execute(PoppyOp.SetTeam, senderMaster, (int)team, 0, 0f, 0f, 0f, b1: false, null); } } } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCSpawnAs(ConCommandArgs args) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) CharacterMaster senderMaster = ((ConCommandArgs)(ref args)).senderMaster; if (!((Object)(object)senderMaster == (Object)null)) { GameObject val = ResolveBodyPrefab(Arg(args, 0)); if ((Object)(object)val == (Object)null) { Print("spawn_as: unknown body."); return; } Vector3 val2 = (((Object)(object)senderMaster.GetBody() != (Object)null) ? senderMaster.GetBody().footPosition : Vector3.zero); NetUtil.Execute(PoppyOp.ChangeBody, senderMaster, 0, 0, val2.x, val2.y, val2.z, b1: false, ((Object)val).name); } } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCSpawnAi(ConCommandArgs args) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) SummonAi(args, braindead: false); } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCSpawnBody(ConCommandArgs args) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) SummonAi(args, braindead: true); } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCSpawnInteractable(ConCommandArgs args) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) SpawnCardAt(args); } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCSpawnInteractible(ConCommandArgs args) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) SpawnCardAt(args); } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCSpawnPortal(ConCommandArgs args) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) Portal(Arg(args, 0)); } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCAddPortal(ConCommandArgs args) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) Portal(Arg(args, 0)); } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCNextStage(ConCommandArgs args) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) string text = Arg(args, 0); if (!string.IsNullOrEmpty(text)) { SceneDef sceneDefFromSceneName = SceneCatalog.GetSceneDefFromSceneName(text); if ((Object)(object)sceneDefFromSceneName != (Object)null && (Object)(object)Run.instance != (Object)null) { Run.instance.AdvanceStage(sceneDefFromSceneName); return; } } NetUtil.Execute(PoppyOp.SkipStage, null, 0, 0, 0f, 0f, 0f, b1: false, null); } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCFixedTime(ConCommandArgs args) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) Run instance = Run.instance; if (instance != null) { instance.SetRunStopwatch(Mathf.Max(0f, ArgFloat(args, 0, 0f))); } } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCStopTimer(ConCommandArgs args) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) WorldModule.FreezeTimer = Flag(args, 0, WorldModule.FreezeTimer); Run instance = Run.instance; if (instance != null) { instance.SetRunStopwatchPaused(WorldModule.FreezeTimer); } Print("stop_timer " + WorldModule.FreezeTimer); } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCChargeZone(ConCommandArgs args) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) TeleporterInteraction instance = TeleporterInteraction.instance; if (!((Object)(object)instance == (Object)null) && !((Object)(object)instance.holdoutZoneController == (Object)null)) { instance.holdoutZoneController.charge = Mathf.Clamp01(ArgFloat(args, 0, 100f) / 100f); } } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCSetArtifact(ConCommandArgs args) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) ArtifactDef val = ResolveArtifact(Arg(args, 0)); if ((Object)(object)val == (Object)null || (Object)(object)RunArtifactManager.instance == (Object)null) { Print("set_artifact: unknown artifact."); return; } bool flag = ((((ConCommandArgs)(ref args)).Count > 1) ? Flag(args, 1, current: false) : (!RunArtifactManager.instance.IsArtifactEnabled(val))); RunArtifactManager.instance.SetArtifactEnabledServer(val, flag); } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCTimeScale(ConCommandArgs args) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) WorldModule.TimeScale = Mathf.Max(0f, ArgFloat(args, 0, 1f)); Print("time_scale " + WorldModule.TimeScale); } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCSetStagesCleared(ConCommandArgs args) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) NetUtil.Execute(PoppyOp.SetStagesCleared, null, ArgInt(args, 0, 0), 0, 0f, 0f, 0f, b1: false, null); } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCTeamSetLevel(ConCommandArgs args) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected I4, but got Unknown //IL_0011: Unknown result type (might be due to invalid IL or missing references) if (!TryResolveTeam(Arg(args, 0), out var team)) { team = (TeamIndex)1; } NetUtil.Execute(PoppyOp.SetTeamLevel, null, (int)team, ArgInt(args, 1, 1), 0f, 0f, 0f, b1: false, null); } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCListItem(ConCommandArgs args) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected I4, but got Unknown foreach (Catalogs.ItemEntry item in Catalogs.Items) { ItemDef itemDef = ItemCatalog.GetItemDef(item.Index); Print(string.Format("[{0}] {1} / {2}", (int)item.Index, ((Object)(object)itemDef != (Object)null) ? ((Object)itemDef).name : "?", item.Name)); } } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCListEquip(ConCommandArgs args) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected I4, but got Unknown foreach (Catalogs.EquipEntry item in Catalogs.Equipment) { EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef(item.Index); Print(string.Format("[{0}] {1} / {2}", (int)item.Index, ((Object)(object)equipmentDef != (Object)null) ? ((Object)equipmentDef).name : "?", item.Name)); } } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCListBuff(ConCommandArgs args) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected I4, but got Unknown foreach (Catalogs.BuffEntry buff in Catalogs.Buffs) { Print($"[{(int)buff.Index}] {buff.Name}"); } } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCListBody(ConCommandArgs args) { foreach (Catalogs.BodyEntry body in Catalogs.Bodies) { if ((Object)(object)body.Prefab != (Object)null) { Print(((Object)body.Prefab).name + " / " + body.Name); } } } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCListArtifact(ConCommandArgs args) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected I4, but got Unknown ArtifactDef[] artifactDefs = ArtifactCatalog.artifactDefs; if (artifactDefs == null) { return; } ArtifactDef[] array = artifactDefs; foreach (ArtifactDef val in array) { if ((Object)(object)val != (Object)null) { Print($"[{(int)val.artifactIndex}] {val.cachedName}"); } } } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCListSurvivor(ConCommandArgs args) { foreach (Catalogs.SurvivorEntry survivor in Catalogs.Survivors) { if ((Object)(object)survivor.Def != (Object)null) { Print(survivor.Def.cachedName + " / " + survivor.Name); } } } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCListInteractables(ConCommandArgs args) { foreach (Catalogs.SpawnEntry spawnCard in Catalogs.SpawnCards) { if (spawnCard.IsInteractable) { Print(spawnCard.Name); } } } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCMidgame(ConCommandArgs args) { GrantTier(((ConCommandArgs)(ref args)).senderMaster, (ItemTier)0, 20); GrantTier(((ConCommandArgs)(ref args)).senderMaster, (ItemTier)1, 8); GrantTier(((ConCommandArgs)(ref args)).senderMaster, (ItemTier)2, 2); } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCLategame(ConCommandArgs args) { GrantTier(((ConCommandArgs)(ref args)).senderMaster, (ItemTier)0, 40); GrantTier(((ConCommandArgs)(ref args)).senderMaster, (ItemTier)1, 20); GrantTier(((ConCommandArgs)(ref args)).senderMaster, (ItemTier)2, 8); GrantTier(((ConCommandArgs)(ref args)).senderMaster, (ItemTier)4, 1); } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCDtzoom(ConCommandArgs args) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Invalid comparison between Unknown and I4 //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Invalid comparison between Unknown and I4 //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected I4, but got Unknown //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected I4, but got Unknown CharacterMaster senderMaster = ((ConCommandArgs)(ref args)).senderMaster; if (!((Object)(object)senderMaster == (Object)null)) { ItemIndex val = ResolveItem("Hoof"); ItemIndex val2 = ResolveItem("Feather"); if ((int)val != -1) { NetUtil.Execute(PoppyOp.GiveItem, senderMaster, (int)val, 20, 0f, 0f, 0f, b1: false, null); } if ((int)val2 != -1) { NetUtil.Execute(PoppyOp.GiveItem, senderMaster, (int)val2, 200, 0f, 0f, 0f, b1: false, null); } } } private static void SummonAi(ConCommandArgs args, bool braindead) { //IL_0008: 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) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0067: 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_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: 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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Expected O, but got Unknown CharacterBody senderBody = ((ConCommandArgs)(ref args)).senderBody; GameObject val = ResolveMaster(Arg(args, 0)); if ((Object)(object)val == (Object)null) { Print("spawn: unknown ai/body."); return; } Vector3 position = (((Object)(object)senderBody != (Object)null) ? senderBody.footPosition : Vector3.zero); TeamIndex value = (TeamIndex)2; int num = (braindead ? (-1) : 2); if (num >= 0 && TryResolveTeam(Arg(args, num), out var team)) { value = team; } int num2 = Mathf.Clamp(braindead ? 1 : ArgInt(args, 1, 1), 1, 50); for (int i = 0; i < num2; i++) { MasterSummon val2 = new MasterSummon { masterPrefab = val, position = position, rotation = Quaternion.identity, ignoreTeamMemberLimit = true, teamIndexOverride = value, summonerBodyObject = (((Object)(object)senderBody != (Object)null) ? ((Component)senderBody).gameObject : null) }; val2.Perform(); } } private static void SpawnCardAt(ConCommandArgs args) { //IL_0008: 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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) CharacterBody senderBody = ((ConCommandArgs)(ref args)).senderBody; string value = Arg(args, 0); if (string.IsNullOrEmpty(value)) { return; } foreach (Catalogs.SpawnEntry spawnCard in Catalogs.SpawnCards) { if (spawnCard.Name.IndexOf(value, StringComparison.OrdinalIgnoreCase) >= 0) { Vector3 val = (((Object)(object)senderBody != (Object)null) ? senderBody.footPosition : Vector3.zero); NetUtil.Execute(PoppyOp.Spawn, null, 1, 2, val.x, val.y, val.z, b1: false, spawnCard.Name); return; } } Print("spawn: unknown interactable."); } private static void Portal(string kind) { kind = (kind ?? "").ToLowerInvariant(); if (kind.StartsWith("blue") || kind.StartsWith("shop")) { NetUtil.Execute(PoppyOp.SpawnShopPortal, null, 0, 0, 0f, 0f, 0f, b1: false, null); } else if (kind.StartsWith("gold")) { NetUtil.Execute(PoppyOp.SpawnGoldshoresPortal, null, 0, 0, 0f, 0f, 0f, b1: false, null); } else if (kind.StartsWith("cele") || kind.StartsWith("moon")) { NetUtil.Execute(PoppyOp.SpawnMSPortal, null, 0, 0, 0f, 0f, 0f, b1: false, null); } else { Print("portal must be blue, gold, or celestial."); } } private static void GrantTier(CharacterMaster m, ItemTier tier, int count) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Expected I4, but got Unknown if ((Object)(object)m == (Object)null) { return; } List list = new List(); foreach (Catalogs.ItemEntry item in Catalogs.Items) { if (item.Tier == tier) { list.Add(item.Index); } } if (list.Count != 0) { for (int i = 0; i < count; i++) { NetUtil.Execute(PoppyOp.GiveItem, m, (int)list[Random.Range(0, list.Count)], 1, 0f, 0f, 0f, b1: false, null); } } } private static void Print(string s) { Debug.Log((object)("[Poppy] " + s)); } private static string Arg(ConCommandArgs a, int i) { if (i < 0 || i >= ((ConCommandArgs)(ref a)).Count) { return null; } return ((ConCommandArgs)(ref a))[i]; } private static int ArgInt(ConCommandArgs a, int i, int def) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) string s = Arg(a, i); if (!int.TryParse(s, out var result)) { return def; } return result; } private static float ArgFloat(ConCommandArgs a, int i, float def) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) string s = Arg(a, i); if (!float.TryParse(s, out var result)) { return def; } return result; } private static bool Flag(ConCommandArgs a, int i, bool current) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) string text = Arg(a, i); if (string.IsNullOrEmpty(text)) { return !current; } if (!(text == "1") && !text.Equals("true", StringComparison.OrdinalIgnoreCase)) { return text.Equals("on", StringComparison.OrdinalIgnoreCase); } return true; } private static ItemIndex ResolveItem(string s) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Invalid comparison between Unknown and I4 //IL_002f: 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_005c: Unknown result type (might be due to invalid IL or missing references) //IL_00df: 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_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrEmpty(s)) { return (ItemIndex)(-1); } if (int.TryParse(s, out var result) && (Object)(object)ItemCatalog.GetItemDef((ItemIndex)result) != (Object)null) { return (ItemIndex)result; } ItemIndex val = ItemCatalog.FindItemIndex(s); if ((int)val != -1) { return val; } foreach (Catalogs.ItemEntry item in Catalogs.Items) { if (item.Name.IndexOf(s, StringComparison.OrdinalIgnoreCase) >= 0) { return item.Index; } } foreach (Catalogs.ItemEntry item2 in Catalogs.Items) { ItemDef itemDef = ItemCatalog.GetItemDef(item2.Index); if ((Object)(object)itemDef != (Object)null && ((Object)itemDef).name.IndexOf(s, StringComparison.OrdinalIgnoreCase) >= 0) { return item2.Index; } } return (ItemIndex)(-1); } private static EquipmentIndex ResolveEquip(string s) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Invalid comparison between Unknown and I4 //IL_002f: 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_005c: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrEmpty(s)) { return (EquipmentIndex)(-1); } if (int.TryParse(s, out var result) && (Object)(object)EquipmentCatalog.GetEquipmentDef((EquipmentIndex)result) != (Object)null) { return (EquipmentIndex)result; } EquipmentIndex val = EquipmentCatalog.FindEquipmentIndex(s); if ((int)val != -1) { return val; } foreach (Catalogs.EquipEntry item in Catalogs.Equipment) { if (item.Name.IndexOf(s, StringComparison.OrdinalIgnoreCase) >= 0) { return item.Index; } } return (EquipmentIndex)(-1); } private static EquipmentIndex RandomEquip() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) if (Catalogs.Equipment.Count <= 0) { return (EquipmentIndex)(-1); } return Catalogs.Equipment[Random.Range(0, Catalogs.Equipment.Count)].Index; } private static BuffIndex ResolveBuff(string s) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) if (!string.IsNullOrEmpty(s)) { if (!int.TryParse(s, out var result)) { foreach (Catalogs.BuffEntry buff in Catalogs.Buffs) { if (buff.Name.IndexOf(s, StringComparison.OrdinalIgnoreCase) >= 0) { return buff.Index; } } return (BuffIndex)(-1); } return (BuffIndex)result; } return (BuffIndex)(-1); } private static GameObject ResolveBodyPrefab(string s) { if (string.IsNullOrEmpty(s)) { return null; } GameObject val = BodyCatalog.FindBodyPrefab(s); if ((Object)(object)val != (Object)null) { return val; } foreach (Catalogs.BodyEntry body in Catalogs.Bodies) { if ((Object)(object)body.Prefab != (Object)null && (body.Name.IndexOf(s, StringComparison.OrdinalIgnoreCase) >= 0 || ((Object)body.Prefab).name.IndexOf(s, StringComparison.OrdinalIgnoreCase) >= 0)) { return body.Prefab; } } return null; } private static GameObject ResolveMaster(string s) { if (string.IsNullOrEmpty(s) || MasterCatalog.masterPrefabs == null) { return null; } GameObject[] masterPrefabs = MasterCatalog.masterPrefabs; foreach (GameObject val in masterPrefabs) { if ((Object)(object)val != (Object)null && ((Object)val).name.IndexOf(s, StringComparison.OrdinalIgnoreCase) >= 0) { return val; } } return null; } private static ArtifactDef ResolveArtifact(string s) { if (string.IsNullOrEmpty(s)) { return null; } ArtifactDef[] artifactDefs = ArtifactCatalog.artifactDefs; if (artifactDefs == null) { return null; } if (int.TryParse(s, out var result)) { ArtifactDef artifactDef = ArtifactCatalog.GetArtifactDef((ArtifactIndex)result); if ((Object)(object)artifactDef != (Object)null) { return artifactDef; } } ArtifactDef[] array = artifactDefs; foreach (ArtifactDef val in array) { if (!((Object)(object)val == (Object)null)) { if (val.cachedName.IndexOf(s, StringComparison.OrdinalIgnoreCase) >= 0) { return val; } string text = Language.GetString(val.nameToken); if (!string.IsNullOrEmpty(text) && text.IndexOf(s, StringComparison.OrdinalIgnoreCase) >= 0) { return val; } } } return null; } private static bool TryResolveTeam(string s, out TeamIndex team) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Expected I4, but got Unknown team = (TeamIndex)2; if (string.IsNullOrEmpty(s)) { return false; } if (int.TryParse(s, out var result)) { team = (TeamIndex)(sbyte)result; return true; } foreach (TeamIndex value in Enum.GetValues(typeof(TeamIndex))) { if (((object)value/*cast due to .constrained prefix*/).ToString().Equals(s, StringComparison.OrdinalIgnoreCase)) { team = (TeamIndex)(int)value; return true; } } return false; } } internal static class InputCapture { private static Harmony _h; private static readonly List _held = new List(); internal static bool Active { get; private set; } internal static void Init() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown _h = new Harmony("poppy.input"); MethodInfo methodInfo = AccessTools.Method(typeof(PlayerCharacterMasterController), "Update", (Type[])null, (Type[])null); if (methodInfo != null) { _h.Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(InputCapture), "PcmcUpdatePrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } internal static void Sync(bool want) { if (want) { _held.RemoveAll((MPEventSystem es) => (Object)(object)es == (Object)null); foreach (MPEventSystem instances in MPEventSystem.instancesList) { if (!((Object)(object)instances == (Object)null) && !_held.Contains(instances)) { int cursorOpenerCount = instances.cursorOpenerCount; instances.cursorOpenerCount = cursorOpenerCount + 1; _held.Add(instances); } } } else if (_held.Count > 0) { foreach (MPEventSystem item in _held) { if ((Object)(object)item != (Object)null) { item.cursorOpenerCount = Mathf.Max(0, item.cursorOpenerCount - 1); } } _held.Clear(); } Active = want; } internal static void Shutdown() { Sync(want: false); Harmony h = _h; if (h != null) { h.UnpatchSelf(); } _h = null; } private static bool PcmcUpdatePrefix(PlayerCharacterMasterController __instance) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) if (!Active) { return true; } InputBankTest bodyInputs = __instance.bodyInputs; if ((Object)(object)bodyInputs == (Object)null || (Object)(object)bodyInputs != (Object)(object)PlayerContext.InputBank) { return true; } bodyInputs.moveVector = Vector3.zero; bodyInputs.SetRawMoveStates(Vector2.zero); bodyInputs.skill1 = default(ButtonState); bodyInputs.skill2 = default(ButtonState); bodyInputs.skill3 = default(ButtonState); bodyInputs.skill4 = default(ButtonState); bodyInputs.jump = default(ButtonState); bodyInputs.sprint = default(ButtonState); bodyInputs.interact = default(ButtonState); bodyInputs.activateEquipment = default(ButtonState); bodyInputs.nextEquipment = default(ButtonState); bodyInputs.prevEquipment = default(ButtonState); bodyInputs.ping = default(ButtonState); return false; } } internal static class Log { private static ManualLogSource _log; internal static void Init(ManualLogSource log) { _log = log; } internal static void Info(object data) { ManualLogSource log = _log; if (log != null) { log.LogInfo(data); } } internal static void Message(object data) { ManualLogSource log = _log; if (log != null) { log.LogMessage(data); } } internal static void Warning(object data) { ManualLogSource log = _log; if (log != null) { log.LogWarning(data); } } internal static void Error(object data) { ManualLogSource log = _log; if (log != null) { log.LogError(data); } } internal static void Debug(object data) { ManualLogSource log = _log; if (log != null) { log.LogDebug(data); } } } internal enum PoppyOp : byte { GiveItem, RemoveItem, GiveEquipment, GiveAllItems, ClearInventory, StackInventory, RollItems, GiveMoney, GiveXp, GiveLunar, GiveBuff, RemoveBuff, RemoveAllBuffs, Respawn, ChangeBody, HealFull, KillAllEnemies, Spawn, ChargeTeleporter, SkipStage, AddMountainShrine, SpawnShopPortal, SpawnGoldshoresPortal, SpawnMSPortal, SetStagesCleared, SetRunTime, SetTeamLevel, SetArtifact, TrueKillTarget, TeleportBody, SetTeam, HurtBody, HealAmount, GiveTimedBuff, InflictDot, ChangeScene, UndoInventory } internal static class NetUtil { private static readonly List _undoItems = new List(); private static readonly List _undoCounts = new List(); private static EquipmentIndex _undoEquip = (EquipmentIndex)(-1); private static bool _hasUndo; private static CharacterMaster _goGuardMaster; private static float _goGuardUntil; internal static bool IsServer => NetworkServer.active; internal static void Init() { NetworkingAPI.RegisterMessageType(); } internal static void Do(PoppyOp op, int i1 = 0, int i2 = 0, float f1 = 0f, float f2 = 0f, float f3 = 0f, bool b1 = false, string s1 = null) { DoFor(PlayerContext.Master, op, i1, i2, f1, f2, f3, b1, s1); } internal static void DoFor(CharacterMaster target, PoppyOp op, int i1 = 0, int i2 = 0, float f1 = 0f, float f2 = 0f, float f3 = 0f, bool b1 = false, string s1 = null) { //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) if (IsServer) { Execute(op, target, i1, i2, f1, f2, f3, b1, s1); Notify.Push(Describe(op, s1)); } else if (ModConfig.RequireServerForCheats.Value) { Notify.Push("Skipped: host only"); Log.Warning($"{op} skipped: not the server (RequireServerForCheats is on)."); } else { NetworkInstanceId target2 = (((Object)(object)target != (Object)null) ? ((NetworkBehaviour)target).netId : NetworkInstanceId.Invalid); NetMessageExtensions.Send((INetMessage)(object)new PoppyCommandMessage(op, target2, i1, i2, f1, f2, f3, b1, s1), (NetworkDestination)2); Notify.Push(Describe(op, s1) + " (requested)"); } } private static string Describe(PoppyOp op, string s1) { return op switch { PoppyOp.GiveItem => "Item given", PoppyOp.GiveEquipment => "Equipment given", PoppyOp.GiveAllItems => "Gave all items", PoppyOp.ClearInventory => "Inventory cleared", PoppyOp.StackInventory => "Inventory stacked", PoppyOp.RollItems => "Items rerolled", PoppyOp.GiveMoney => "Money granted", PoppyOp.GiveXp => "XP granted", PoppyOp.GiveLunar => "Lunar coins granted", PoppyOp.GiveBuff => "Buff applied", PoppyOp.RemoveAllBuffs => "Buffs removed", PoppyOp.Respawn => "Respawned", PoppyOp.HealFull => "Healed to full", PoppyOp.ChangeBody => "Became " + (s1 ?? "body"), PoppyOp.KillAllEnemies => "Killed all enemies", PoppyOp.Spawn => "Spawned " + (s1 ?? "object"), PoppyOp.ChargeTeleporter => "Teleporter charged", PoppyOp.SkipStage => "Skipping stage", PoppyOp.AddMountainShrine => "Mountain shrine added", PoppyOp.SpawnShopPortal => "Shop portal spawned", PoppyOp.SpawnGoldshoresPortal => "Gold portal spawned", PoppyOp.SpawnMSPortal => "Celestial portal spawned", PoppyOp.SetStagesCleared => "Stages cleared set", PoppyOp.SetRunTime => "Run time set", PoppyOp.SetTeamLevel => "Team level set", PoppyOp.SetArtifact => "Artifact toggled", PoppyOp.TrueKillTarget => "Player killed", PoppyOp.TeleportBody => "Teleported", PoppyOp.SetTeam => "Team changed", PoppyOp.HurtBody => "Damage dealt", PoppyOp.HealAmount => "Healed", PoppyOp.GiveTimedBuff => "Buff applied", PoppyOp.InflictDot => "DoT applied", PoppyOp.ChangeScene => "Changing scene", PoppyOp.UndoInventory => "Inventory restored", _ => op.ToString(), }; } internal static NetworkUser UserForMaster(CharacterMaster master) { if ((Object)(object)master == (Object)null) { return null; } foreach (NetworkUser readOnlyInstances in NetworkUser.readOnlyInstancesList) { if ((Object)(object)readOnlyInstances != (Object)null && (Object)(object)readOnlyInstances.master == (Object)(object)master) { return readOnlyInstances; } } return null; } internal static void KickUser(NetworkUser user) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown if (!NetworkServer.active || (Object)(object)user == (Object)null) { Notify.Push("Kick is host only"); return; } NetworkConnection val = ConnectionFor(user); if (val == null) { Notify.Push("Couldn't find that connection"); return; } SimpleLocalizedKickReason val2 = new SimpleLocalizedKickReason("KICK_REASON_KICK", Array.Empty()); NetworkManagerSystem.singleton.ServerKickClient(val, (BaseKickReason)(object)val2); Notify.Push("Kicked " + user.userName); } internal static void BanUser(NetworkUser user) { if (!NetworkServer.active || (Object)(object)user == (Object)null) { Notify.Push("Ban is host only"); return; } NetworkConnection val = ConnectionFor(user); if (val == null) { Notify.Push("Couldn't find that connection"); return; } NetworkManagerSystem.singleton.ServerBanClient(val); Notify.Push("Banned " + user.userName); } private static NetworkConnection ConnectionFor(NetworkUser user) { foreach (NetworkConnection connection in NetworkServer.connections) { if (connection != null && ((NetworkBehaviour)user).connectionToClient == connection) { return connection; } } return null; } private static void GiveBestOfEachItem(Inventory inv, int count) { //IL_00aa: 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_00d1: Invalid comparison between Unknown and I4 //IL_0114: Unknown result type (might be due to invalid IL or missing references) Dictionary> dictionary = new Dictionary>(); foreach (Catalogs.ItemEntry item in Catalogs.Items) { if (!dictionary.TryGetValue(item.Name, out var value)) { value = new List(); dictionary[item.Name] = value; } value.Add(item); } foreach (KeyValuePair> item2 in dictionary) { List value2 = item2.Value; if (!GroupHasBeneficialItem(value2)) { continue; } bool flag = false; Catalogs.ItemEntry b = default(Catalogs.ItemEntry); foreach (Catalogs.ItemEntry item3 in value2) { ItemDef itemDef = ItemCatalog.GetItemDef(item3.Index); if (!((Object)(object)itemDef == (Object)null) && !itemDef.hidden && (int)itemDef.tier != 3 && !itemDef.ContainsTag((ItemTag)9) && (!flag || IsBetterVariant(item3, b))) { b = item3; flag = true; } } if (flag) { inv.GiveItem(b.Index, Mathf.Max(1, count)); } } } private static bool GroupHasBeneficialItem(List variants) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected I4, but got Unknown foreach (Catalogs.ItemEntry variant in variants) { ItemDef itemDef = ItemCatalog.GetItemDef(variant.Index); if (!((Object)(object)itemDef == (Object)null) && !itemDef.hidden && !itemDef.ContainsTag((ItemTag)9)) { ItemTier tier = itemDef.tier; switch ((int)tier) { case 0: case 1: case 2: case 4: case 6: case 7: case 8: case 9: return true; } } } return false; } private static bool IsBetterVariant(Catalogs.ItemEntry a, Catalogs.ItemEntry b) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) int num = QualityRank(a.Quality); int num2 = QualityRank(b.Quality); if (num != num2) { return num > num2; } return a.Index > b.Index; } private static int QualityRank(string q) { if (string.IsNullOrEmpty(q)) { return 0; } string text = q.ToLowerInvariant(); if (text.Contains("mythic") || text.Contains("godly")) { return 8; } if (text.Contains("legend")) { return 7; } if (text.Contains("epic")) { return 6; } if (text.Contains("unique")) { return 6; } if (text.Contains("rare")) { return 5; } if (text.Contains("uncommon")) { return 4; } if (text.Contains("common")) { return 3; } return 1; } internal static void Execute(PoppyOp op, CharacterMaster master, int i1, int i2, float f1, float f2, float f3, bool b1, string s1) { //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_042f: Unknown result type (might be due to invalid IL or missing references) //IL_0552: Unknown result type (might be due to invalid IL or missing references) //IL_0575: Unknown result type (might be due to invalid IL or missing references) //IL_0599: Unknown result type (might be due to invalid IL or missing references) //IL_059b: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_0498: Unknown result type (might be due to invalid IL or missing references) //IL_049d: Unknown result type (might be due to invalid IL or missing references) //IL_04af: Unknown result type (might be due to invalid IL or missing references) //IL_04b1: Unknown result type (might be due to invalid IL or missing references) //IL_04b6: Unknown result type (might be due to invalid IL or missing references) //IL_04bb: Unknown result type (might be due to invalid IL or missing references) //IL_04bd: Unknown result type (might be due to invalid IL or missing references) //IL_04c2: Unknown result type (might be due to invalid IL or missing references) //IL_04c4: Unknown result type (might be due to invalid IL or missing references) //IL_04c9: Unknown result type (might be due to invalid IL or missing references) //IL_04d0: Expected O, but got Unknown //IL_0513: Unknown result type (might be due to invalid IL or missing references) //IL_0519: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) try { CharacterBody val = (((Object)(object)master != (Object)null) ? master.GetBody() : null); Inventory val2 = (((Object)(object)master != (Object)null) ? master.inventory : null); switch (op) { case PoppyOp.GiveItem: if (val2 != null) { val2.GiveItem((ItemIndex)i1, Mathf.Max(1, i2)); } break; case PoppyOp.RemoveItem: if (val2 != null) { val2.RemoveItem((ItemIndex)i1, Mathf.Max(1, i2)); } break; case PoppyOp.GiveEquipment: if (val2 != null) { val2.SetEquipmentIndex((EquipmentIndex)i1); } break; case PoppyOp.GiveAllItems: if ((Object)(object)val2 != (Object)null) { Snapshot(val2); GiveBestOfEachItem(val2, i2); if ((Object)(object)val != (Object)null && (Object)(object)val.healthComponent != (Object)null) { val.healthComponent.HealFraction(1f, default(ProcChainMask)); } } break; case PoppyOp.ClearInventory: if ((Object)(object)val2 != (Object)null) { Snapshot(val2); val2.CleanInventory(); } break; case PoppyOp.StackInventory: Snapshot(val2); StackInventory(val2); break; case PoppyOp.RollItems: Snapshot(val2); RollItems(val2); break; case PoppyOp.UndoInventory: RestoreSnapshot(val2); break; case PoppyOp.GiveMoney: if (master != null) { master.GiveMoney((uint)Mathf.Max(0, i1)); } break; case PoppyOp.GiveXp: if (master != null) { master.GiveExperience((ulong)Mathf.Max(0, i1)); } break; case PoppyOp.GiveLunar: { NetworkUser obj = UserForMaster(master); if (obj != null) { obj.AwardLunarCoins((uint)Mathf.Max(0, i1)); } break; } case PoppyOp.GiveBuff: if ((Object)(object)val != (Object)null) { val.SetBuffCount((BuffIndex)i1, val.GetBuffCount((BuffIndex)i1) + Mathf.Max(1, i2)); } break; case PoppyOp.RemoveBuff: if (val != null) { val.RemoveBuff((BuffIndex)i1); } break; case PoppyOp.RemoveAllBuffs: RemoveAllBuffs(val); break; case PoppyOp.Respawn: if ((Object)(object)master != (Object)null && (Object)(object)master.GetBody() == (Object)null) { master.RespawnExtraLife(); } break; case PoppyOp.HealFull: if ((Object)(object)val != (Object)null && (Object)(object)val.healthComponent != (Object)null) { val.healthComponent.Heal(val.healthComponent.fullCombinedHealth, default(ProcChainMask), true); } break; case PoppyOp.ChangeBody: ChangeBody(master, s1, new Vector3(f1, f2, f3)); break; case PoppyOp.KillAllEnemies: KillAllEnemies(); break; case PoppyOp.Spawn: Spawn(s1, new Vector3(f1, f2, f3), Mathf.Max(1, i1), i2); break; case PoppyOp.ChargeTeleporter: ChargeTeleporter(); break; case PoppyOp.SkipStage: SkipStage(); break; case PoppyOp.AddMountainShrine: if ((Object)(object)TeleporterInteraction.instance != (Object)null) { TeleporterInteraction.instance.AddShrineStack(); } break; case PoppyOp.SpawnShopPortal: { TeleporterInteraction instance4 = TeleporterInteraction.instance; if (instance4 != null) { instance4.AttemptToSpawnShopPortal(); } break; } case PoppyOp.SpawnGoldshoresPortal: { TeleporterInteraction instance3 = TeleporterInteraction.instance; if (instance3 != null) { instance3.AttemptToSpawnGoldshoresPortal(); } break; } case PoppyOp.SpawnMSPortal: { TeleporterInteraction instance2 = TeleporterInteraction.instance; if (instance2 != null) { instance2.AttemptToSpawnMSPortal(); } break; } case PoppyOp.SetStagesCleared: if ((Object)(object)Run.instance != (Object)null) { Run.instance.stageClearCount = Mathf.Max(0, i1); } break; case PoppyOp.SetRunTime: { Run instance = Run.instance; if (instance != null) { instance.SetRunStopwatch(Mathf.Max(0f, f1)); } break; } case PoppyOp.SetTeamLevel: if ((Object)(object)TeamManager.instance != (Object)null) { TeamManager.instance.SetTeamLevel((TeamIndex)(sbyte)i1, (uint)Mathf.Max(1, i2)); } break; case PoppyOp.SetArtifact: { ArtifactDef artifactDef = ArtifactCatalog.GetArtifactDef((ArtifactIndex)i1); if ((Object)(object)artifactDef != (Object)null && (Object)(object)RunArtifactManager.instance != (Object)null) { RunArtifactManager.instance.SetArtifactEnabledServer(artifactDef, b1); } break; } case PoppyOp.TrueKillTarget: if (master != null) { master.TrueKill(); } break; case PoppyOp.TeleportBody: if ((Object)(object)val != (Object)null) { TeleportHelper.TeleportBody(val, new Vector3(f1, f2, f3)); } break; case PoppyOp.SetTeam: if ((Object)(object)val != (Object)null && (Object)(object)val.teamComponent != (Object)null) { val.teamComponent.teamIndex = (TeamIndex)(sbyte)i1; } if ((Object)(object)master != (Object)null) { master.teamIndex = (TeamIndex)(sbyte)i1; } break; case PoppyOp.HurtBody: if ((Object)(object)val != (Object)null && (Object)(object)val.healthComponent != (Object)null) { DamageInfo val4 = new DamageInfo { damage = Mathf.Max(0f, f1), position = val.corePosition, damageColorIndex = (DamageColorIndex)0, damageType = DamageTypeCombo.op_Implicit((DamageType)0) }; val.healthComponent.TakeDamage(val4); } break; case PoppyOp.HealAmount: if ((Object)(object)val != (Object)null && (Object)(object)val.healthComponent != (Object)null) { val.healthComponent.Heal(Mathf.Max(0f, f1), default(ProcChainMask), true); } break; case PoppyOp.GiveTimedBuff: if (val != null) { val.AddTimedBuff((BuffIndex)i1, Mathf.Max(0.1f, f1)); } break; case PoppyOp.InflictDot: if ((Object)(object)val != (Object)null) { InflictDotInfo val3 = new InflictDotInfo { victimObject = ((Component)val).gameObject, attackerObject = ((Component)val).gameObject, dotIndex = (DotIndex)i1, duration = Mathf.Max(0.1f, f1), damageMultiplier = 1f }; DotController.InflictDot(ref val3); } break; case PoppyOp.ChangeScene: { SceneDef sceneDef = SceneCatalog.GetSceneDef((SceneIndex)i1); if ((Object)(object)sceneDef != (Object)null && (Object)(object)Run.instance != (Object)null) { Run.instance.AdvanceStage(sceneDef); } break; } } } catch (Exception arg) { Log.Error($"NetUtil.Execute({op}) failed: {arg}"); } } private static void Snapshot(Inventory inv) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) _undoItems.Clear(); _undoCounts.Clear(); if ((Object)(object)inv == (Object)null) { _hasUndo = false; return; } foreach (ItemIndex item in inv.itemAcquisitionOrder) { _undoItems.Add(item); _undoCounts.Add(inv.GetItemCount(item)); } _undoEquip = inv.GetEquipmentIndex(); _hasUndo = true; } private static void RestoreSnapshot(Inventory inv) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)inv == (Object)null || !_hasUndo) { Notify.Push("Nothing to undo"); return; } inv.CleanInventory(); for (int i = 0; i < _undoItems.Count; i++) { inv.GiveItem(_undoItems[i], _undoCounts[i]); } inv.SetEquipmentIndex(_undoEquip); _hasUndo = false; } private static void RemoveAllBuffs(CharacterBody body) { //IL_0029: 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) if ((Object)(object)body == (Object)null) { return; } BuffDef[] buffDefs = BuffCatalog.buffDefs; if (buffDefs == null) { return; } BuffDef[] array = buffDefs; foreach (BuffDef val in array) { if (!((Object)(object)val == (Object)null)) { int buffCount = body.GetBuffCount(val.buffIndex); for (int j = 0; j < buffCount; j++) { body.RemoveBuff(val.buffIndex); } } } } private static void StackInventory(Inventory inv) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: 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_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: 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_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_0115: 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_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)inv == (Object)null) { return; } Dictionary> dictionary = new Dictionary>(); foreach (ItemIndex item in new List(inv.itemAcquisitionOrder)) { ItemDef itemDef = ItemCatalog.GetItemDef(item); if (!((Object)(object)itemDef == (Object)null)) { if (!dictionary.TryGetValue(itemDef.tier, out var value)) { value = new List(); dictionary[itemDef.tier] = value; } value.Add(item); } } foreach (KeyValuePair> item2 in dictionary) { List value2 = item2.Value; if (value2.Count == 0) { continue; } int num = 0; ItemIndex val = value2[0]; int num2 = -1; foreach (ItemIndex item3 in value2) { int itemCount = inv.GetItemCount(item3); num += itemCount; if (itemCount > num2) { num2 = itemCount; val = item3; } } foreach (ItemIndex item4 in value2) { inv.RemoveItem(item4, inv.GetItemCount(item4)); } inv.GiveItem(val, num); } } private static void RollItems(Inventory inv) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: 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_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)inv == (Object)null) { return; } Dictionary> dictionary = new Dictionary>(); foreach (Catalogs.ItemEntry item in Catalogs.Items) { if (!dictionary.TryGetValue(item.Tier, out var value)) { value = new List(); dictionary[item.Tier] = value; } value.Add(item.Index); } foreach (ItemIndex item2 in new List(inv.itemAcquisitionOrder)) { ItemDef itemDef = ItemCatalog.GetItemDef(item2); if (!((Object)(object)itemDef == (Object)null)) { int itemCount = inv.GetItemCount(item2); if (dictionary.TryGetValue(itemDef.tier, out var value2) && value2.Count != 0) { ItemIndex val = value2[Random.Range(0, value2.Count)]; inv.RemoveItem(item2, itemCount); inv.GiveItem(val, itemCount); } } } } internal static void TickGuards() { if ((Object)(object)_goGuardMaster != (Object)null && Time.time >= _goGuardUntil) { _goGuardMaster.preventGameOver = false; _goGuardMaster = null; } } private static void ChangeBody(CharacterMaster master, string bodyName, Vector3 fallbackPos) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0068: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: 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) if ((Object)(object)master == (Object)null || string.IsNullOrEmpty(bodyName)) { return; } GameObject val = BodyCatalog.FindBodyPrefab(bodyName); if ((Object)(object)val == (Object)null) { Log.Warning("ChangeBody: no body '" + bodyName + "'."); return; } CharacterBody body = master.GetBody(); Vector3 val2 = (((Object)(object)body != (Object)null) ? body.footPosition : fallbackPos); Quaternion val3 = (((Object)(object)body != (Object)null) ? body.transform.rotation : Quaternion.identity); GameObject bodyPrefab = master.bodyPrefab; master.preventGameOver = true; _goGuardMaster = master; _goGuardUntil = Time.time + 5f; master.bodyPrefab = val; CharacterBody val4 = master.Respawn(val2, val3, false); master.lostBodyToDeath = false; if ((Object)(object)val4 == (Object)null && (Object)(object)bodyPrefab != (Object)null) { master.bodyPrefab = bodyPrefab; master.Respawn(val2, val3, false); Notify.Push("Couldn't spawn that body, reverted"); } } private static void KillAllEnemies() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Invalid comparison between Unknown and I4 //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Invalid comparison between Unknown and I4 foreach (CharacterMaster readOnlyInstances in CharacterMaster.readOnlyInstancesList) { if (!((Object)(object)readOnlyInstances == (Object)null)) { CharacterBody body = readOnlyInstances.GetBody(); if (!((Object)(object)body == (Object)null) && !((Object)(object)body.teamComponent == (Object)null) && ((int)body.teamComponent.teamIndex == 2 || (int)body.teamComponent.teamIndex == 4)) { readOnlyInstances.TrueKill(); } } } } private static void Spawn(string cardName, Vector3 position, int count, int teamRaw) { //IL_0098: 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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Expected O, but got Unknown //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_00e4: Expected O, but got Unknown //IL_00e9: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrEmpty(cardName) || (Object)(object)DirectorCore.instance == (Object)null || (Object)(object)Run.instance == (Object)null) { return; } SpawnCard val = null; bool flag = false; foreach (Catalogs.SpawnEntry spawnCard in Catalogs.SpawnCards) { if (spawnCard.Name == cardName) { val = spawnCard.Card; flag = spawnCard.IsInteractable; break; } } if ((Object)(object)val == (Object)null) { Log.Warning("Spawn: no card '" + cardName + "'."); return; } TeamIndex value = (TeamIndex)(sbyte)teamRaw; for (int i = 0; i < Mathf.Clamp(count, 1, 50); i++) { DirectorPlacementRule val2 = new DirectorPlacementRule { placementMode = (PlacementMode)1, position = position, minDistance = 0f, maxDistance = 40f }; DirectorSpawnRequest val3 = new DirectorSpawnRequest(val, val2, Run.instance.spawnRng) { ignoreTeamMemberLimit = true }; if (!flag) { val3.teamIndexOverride = value; } DirectorCore.instance.TrySpawnObject(val3); } } private static void ChargeTeleporter() { TeleporterInteraction instance = TeleporterInteraction.instance; if ((Object)(object)instance != (Object)null && (Object)(object)instance.holdoutZoneController != (Object)null) { instance.holdoutZoneController.FullyChargeHoldoutZone(); } } private static void SkipStage() { if (!((Object)(object)Run.instance == (Object)null)) { Run.instance.PickNextStageSceneFromCurrentSceneDestinations(); if ((Object)(object)Run.instance.nextStageScene != (Object)null) { Run.instance.AdvanceStage(Run.instance.nextStageScene); } } } } internal class PoppyCommandMessage : INetMessage, ISerializableObject { private byte _op; private NetworkInstanceId _target; private int _i1; private int _i2; private float _f1; private float _f2; private float _f3; private bool _b1; private string _s1; public PoppyCommandMessage() { } public PoppyCommandMessage(PoppyOp op, NetworkInstanceId target, int i1, int i2, float f1, float f2, float f3, bool b1, string s1) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) _op = (byte)op; _target = target; _i1 = i1; _i2 = i2; _f1 = f1; _f2 = f2; _f3 = f3; _b1 = b1; _s1 = s1 ?? string.Empty; } public void Serialize(NetworkWriter writer) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) writer.Write(_op); writer.Write(_target); writer.Write(_i1); writer.Write(_i2); writer.Write(_f1); writer.Write(_f2); writer.Write(_f3); writer.Write(_b1); writer.Write(_s1 ?? string.Empty); } public void Deserialize(NetworkReader reader) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) _op = reader.ReadByte(); _target = reader.ReadNetworkId(); _i1 = reader.ReadInt32(); _i2 = reader.ReadInt32(); _f1 = reader.ReadSingle(); _f2 = reader.ReadSingle(); _f3 = reader.ReadSingle(); _b1 = reader.ReadBoolean(); _s1 = reader.ReadString(); } public void OnReceived() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active || !ModConfig.AllowClientCheats.Value) { return; } CharacterMaster master = null; if (!((NetworkInstanceId)(ref _target)).IsEmpty()) { GameObject val = Util.FindNetworkObject(_target); if ((Object)(object)val != (Object)null) { master = val.GetComponent(); } } NetUtil.Execute((PoppyOp)_op, master, _i1, _i2, _f1, _f2, _f3, _b1, _s1); } } internal static class Notify { private struct Toast { internal string Msg; internal float Until; } private static readonly List _toasts = new List(); private static GUIStyle _style; internal static void Push(string msg, float seconds = 2.5f) { if (!string.IsNullOrEmpty(msg)) { _toasts.Add(new Toast { Msg = msg, Until = Time.realtimeSinceStartup + seconds }); if (_toasts.Count > 5) { _toasts.RemoveAt(0); } } } internal static void Draw() { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Expected O, but got Unknown //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Expected O, but got Unknown //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) if (_toasts.Count == 0) { return; } float now = Time.realtimeSinceStartup; _toasts.RemoveAll((Toast t) => t.Until <= now); if (_toasts.Count != 0) { if (_style == null) { _style = new GUIStyle(GUI.skin.box) { fontSize = 12, fontStyle = (FontStyle)1, alignment = (TextAnchor)4, padding = new RectOffset(14, 14, 6, 6), richText = true }; _style.normal.textColor = Color.white; _style.normal.background = Theme.Solid(Theme.Accent); } float num = ((float)Screen.width - 300f) / 2f; float num2 = 42f; for (int num3 = 0; num3 < _toasts.Count; num3++) { GUI.Box(new Rect(num, num2, 300f, 26f), _toasts[num3].Msg, _style); num2 += 30f; } } } } internal static class PoppyConsole { private struct Command { public string Usage; public string Help; public Action Run; public Command(string usage, string help, Action run) { Usage = usage; Help = help; Run = run; } } internal static readonly List History; private static readonly Dictionary Commands; static PoppyConsole() { History = new List(); Commands = new Dictionary(StringComparer.OrdinalIgnoreCase); RegisterAll(); } internal static void Print(string line) { History.Add(line); if (History.Count > 300) { History.RemoveAt(0); } } internal static IEnumerable CommandList() { List list = new List(Commands.Keys); list.Sort(StringComparer.OrdinalIgnoreCase); foreach (string item in list) { Command command = Commands[item]; yield return string.IsNullOrEmpty(command.Usage) ? (item + " - " + command.Help) : (item + " " + command.Usage + " - " + command.Help); } } internal static void Submit(string line) { if (string.IsNullOrWhiteSpace(line)) { return; } Print("> " + line); string[] array = line.Trim().Split(new char[1] { ' ' }, StringSplitOptions.RemoveEmptyEntries); string key = array[0]; string[] array2 = new string[array.Length - 1]; Array.Copy(array, 1, array2, 0, array2.Length); if (Commands.TryGetValue(key, out var value)) { try { value.Run(array2); return; } catch (Exception ex) { Print("error: " + ex.Message); return; } } ForwardToGame(line); } private static void ForwardToGame(string line) { try { if ((Object)(object)Console.instance == (Object)null) { Print("Unknown command. Type 'help'."); return; } NetworkUser val = ((NetworkUser.readOnlyLocalPlayersList.Count > 0) ? NetworkUser.readOnlyLocalPlayersList[0] : null); Console.instance.SubmitCmd(val, line, false); Print("(sent to the game console)"); } catch (Exception ex) { Print("Unknown command (" + ex.Message + ")"); } } private static void RegisterAll() { Add("help", "", "List every command", delegate { foreach (string item3 in CommandList()) { Print(item3); } }); Add("give", " [count]", "Give yourself an item", delegate(string[] a) { (string name, int count) tuple = NameAndCount(a, 1); string item = tuple.name; int item2 = tuple.count; int num = FindItem(item); if (num < 0) { Print("no item matching '" + item + "'"); } else { NetUtil.Do(PoppyOp.GiveItem, num, item2); } }); Add("give_all", "[count]", "Give one of every item", delegate(string[] a) { NetUtil.Do(PoppyOp.GiveAllItems, 0, Int(a, 0, 1)); }); Add("clear", "", "Clear your inventory", delegate { NetUtil.Do(PoppyOp.ClearInventory); }); Add("stack", "", "Stack inventory (Shrine of Order)", delegate { NetUtil.Do(PoppyOp.StackInventory); }); Add("reroll", "", "Reroll your items", delegate { NetUtil.Do(PoppyOp.RollItems); }); Add("equip", "", "Give equipment", delegate(string[] a) { int num = FindEquip(Join(a, 0)); if (num < 0) { Print("no equipment matching that"); } else { NetUtil.Do(PoppyOp.GiveEquipment, num); } }); Add("buff", " [count]", "Give a buff", delegate(string[] a) { (string name, int count) tuple = NameAndCount(a, 1); string item = tuple.name; int item2 = tuple.count; int num = FindBuff(item); if (num < 0) { Print("no buff matching '" + item + "'"); } else { NetUtil.Do(PoppyOp.GiveBuff, num, item2); } }); Add("spawn", " [count]", "Spawn a monster or interactable at you", delegate(string[] a) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) (string name, int count) tuple = NameAndCount(a, 1); string item = tuple.name; int item2 = tuple.count; string text = FindSpawn(item); if (text == null) { Print("no spawnable matching '" + item + "'"); } else { Vector3 val = (PlayerContext.HasBody ? PlayerContext.Body.footPosition : Vector3.zero); NetUtil.Do(PoppyOp.Spawn, item2, 2, val.x, val.y, val.z, b1: false, text); } }); Add("become", "", "Turn into a body", delegate(string[] a) { //IL_002e: 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_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) string text = FindBody(Join(a, 0)); if (text == null) { Print("no body matching that"); } else { Vector3 val = (PlayerContext.HasBody ? PlayerContext.Body.footPosition : Vector3.zero); NetUtil.Do(PoppyOp.ChangeBody, 0, 0, val.x, val.y, val.z, b1: false, text); } }); Add("kill_all", "", "Kill all enemies", delegate { NetUtil.Do(PoppyOp.KillAllEnemies); }); Add("money", "", "Give money", delegate(string[] a) { NetUtil.Do(PoppyOp.GiveMoney, Int(a, 0, 0)); }); Add("xp", "", "Give experience", delegate(string[] a) { NetUtil.Do(PoppyOp.GiveXp, Int(a, 0, 0)); }); Add("lunar", "", "Give lunar coins", delegate(string[] a) { NetUtil.Do(PoppyOp.GiveLunar, Int(a, 0, 1)); }); Add("heal", "[amount]", "Heal yourself (no amount = full)", delegate(string[] a) { if (a.Length == 0) { NetUtil.Do(PoppyOp.HealFull); } else { NetUtil.Do(PoppyOp.HealAmount, 0, 0, Float(a, 0, 0f)); } }); Add("hurt", "", "Damage yourself", delegate(string[] a) { NetUtil.Do(PoppyOp.HurtBody, 0, 0, Float(a, 0, 0f)); }); Add("respawn", "", "Respawn at the map spawn", delegate { NetUtil.Do(PoppyOp.Respawn); }); Add("god", "[0/1]", "Toggle god mode", delegate(string[] a) { PlayerModule.GodMode = Flag(a, 0, PlayerModule.GodMode); Print("god " + PlayerModule.GodMode); }); Add("buddha", "[0/1]", "Toggle buddha (survive lethal hits)", delegate(string[] a) { Safety.Buddha = Flag(a, 0, Safety.Buddha); Print("buddha " + Safety.Buddha); }); Add("noclip", "[0/1]", "Toggle noclip", delegate(string[] a) { MovementModule.NoClip = Flag(a, 0, MovementModule.NoClip); Print("noclip " + MovementModule.NoClip); }); Add("flight", "[0/1]", "Toggle flight", delegate(string[] a) { MovementModule.Flight = Flag(a, 0, MovementModule.Flight); Print("flight " + MovementModule.Flight); }); Add("sprint", "[0/1]", "Toggle always-sprint", delegate(string[] a) { MovementModule.AlwaysSprint = Flag(a, 0, MovementModule.AlwaysSprint); Print("sprint " + MovementModule.AlwaysSprint); }); Add("no_enemies", "[0/1]", "Stop enemies from spawning", delegate(string[] a) { Safety.NoEnemies = Flag(a, 0, Safety.NoEnemies); Print("no_enemies " + Safety.NoEnemies); }); Add("lock_exp", "[0/1]", "Stop experience gain", delegate(string[] a) { Safety.LockExp = Flag(a, 0, Safety.LockExp); Print("lock_exp " + Safety.LockExp); }); Add("skip", "", "Skip to the next stage", delegate { NetUtil.Do(PoppyOp.SkipStage); }); Add("charge", "", "Fully charge the teleporter", delegate { NetUtil.Do(PoppyOp.ChargeTeleporter); }); Add("portal", "", "Spawn a portal", delegate(string[] a) { string text = ((a.Length != 0) ? a[0].ToLowerInvariant() : ""); if (text.StartsWith("blue") || text.StartsWith("shop")) { NetUtil.Do(PoppyOp.SpawnShopPortal); } else if (text.StartsWith("gold")) { NetUtil.Do(PoppyOp.SpawnGoldshoresPortal); } else if (text.StartsWith("cele") || text.StartsWith("moon")) { NetUtil.Do(PoppyOp.SpawnMSPortal); } else { Print("portal type must be blue, gold, or celestial"); } }); Add("stages", "", "Set stages cleared", delegate(string[] a) { NetUtil.Do(PoppyOp.SetStagesCleared, Int(a, 0, 0)); }); Add("runtime", "", "Set the run time", delegate(string[] a) { NetUtil.Do(PoppyOp.SetRunTime, 0, 0, Float(a, 0, 0f) * 60f); }); Add("teamlevel", "", "Set the player team level", delegate(string[] a) { NetUtil.Do(PoppyOp.SetTeamLevel, 1, Int(a, 0, 1)); }); Add("timescale", "", "Set the time scale", delegate(string[] a) { WorldModule.TimeScale = Float(a, 0, 1f); Print("timescale " + WorldModule.TimeScale); }); Add("freeze", "[0/1]", "Freeze the whole match", delegate(string[] a) { WorldModule.FreezeMatch = Flag(a, 0, WorldModule.FreezeMatch); Print("freeze " + WorldModule.FreezeMatch); }); Add("freeze_timer", "[0/1]", "Freeze the run timer", delegate(string[] a) { WorldModule.FreezeTimer = Flag(a, 0, WorldModule.FreezeTimer); Print("freeze_timer " + WorldModule.FreezeTimer); }); Add("random_items", "", "Give random items", delegate(string[] a) { GiveRandom(Int(a, 0, 5), null); }); Add("midgame", "", "Random mid-game loadout plus money", delegate { Midgame(); }); Add("lategame", "", "Random end-game loadout plus money", delegate { Lategame(); }); Add("dtzoom", "", "20 hooves and 200 feathers for fast movement", delegate { GiveByName("Hoof", 20); GiveByName("Feather", 200); }); Add("dump_stats", "", "Print your stats to the log", delegate { DumpStats(); }); static void Add(string n, string usage, string help, Action run) { Commands[n] = new Command(usage, help, run); } } private static void GiveRandom(int count, ItemTier? tier) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected I4, but got Unknown //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) List list = new List(); foreach (Catalogs.ItemEntry item in Catalogs.Items) { if (!tier.HasValue || item.Tier == tier.Value) { list.Add((int)item.Index); } } if (list.Count == 0) { Print("no items available for that tier"); return; } count = Mathf.Clamp(count, 1, 1000); for (int i = 0; i < count; i++) { NetUtil.Do(PoppyOp.GiveItem, list[Random.Range(0, list.Count)], 1); } Print("gave " + count + " random items"); } private static void GiveByName(string name, int count) { int num = FindItem(name); if (num < 0) { Print("no item matching '" + name + "'"); } else { NetUtil.Do(PoppyOp.GiveItem, num, count); } } private static void Midgame() { GiveRandom(20, (ItemTier)0); GiveRandom(8, (ItemTier)1); GiveRandom(2, (ItemTier)2); NetUtil.Do(PoppyOp.GiveMoney, 1000); Print("mid-game loadout granted"); } private static void Lategame() { GiveRandom(40, (ItemTier)0); GiveRandom(20, (ItemTier)1); GiveRandom(8, (ItemTier)2); GiveRandom(1, (ItemTier)4); NetUtil.Do(PoppyOp.GiveMoney, 10000); Print("end-game loadout granted"); } private static void DumpStats() { CharacterBody body = PlayerContext.Body; if ((Object)(object)body == (Object)null) { Print("no body"); return; } Print($"{body.GetDisplayName()} level {body.level:0}"); Print($" HP {Mathf.CeilToInt(((Object)(object)body.healthComponent != (Object)null) ? body.healthComponent.combinedHealth : 0f)} / {Mathf.CeilToInt(body.maxHealth)}"); Print($" damage {body.damage:0.0} attack speed {body.attackSpeed:0.00} crit {body.crit:0}%"); Print($" move speed {body.moveSpeed:0.0} armor {body.armor:0} regen {body.regen:0.0}/s"); } private static int Int(string[] a, int i, int def) { if (i >= a.Length || !int.TryParse(a[i], out var result)) { return def; } return result; } private static float Float(string[] a, int i, float def) { if (i >= a.Length || !float.TryParse(a[i], out var result)) { return def; } return result; } private static bool Flag(string[] a, int i, bool current) { if (i >= a.Length) { return !current; } if (!(a[i] == "1") && !a[i].Equals("true", StringComparison.OrdinalIgnoreCase)) { return a[i].Equals("on", StringComparison.OrdinalIgnoreCase); } return true; } private static string Join(string[] a, int from) { if (from < a.Length) { return string.Join(" ", a, from, a.Length - from); } return ""; } private static (string name, int count) NameAndCount(string[] a, int defCount) { if (a.Length == 0) { return (name: "", count: defCount); } int item = defCount; int count = a.Length; if (a.Length >= 2 && int.TryParse(a[^1], out var result)) { item = result; count = a.Length - 1; } return (name: string.Join(" ", a, 0, count), count: item); } private static int FindItem(string q) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected I4, but got Unknown if (string.IsNullOrWhiteSpace(q)) { return -1; } foreach (Catalogs.ItemEntry item in Catalogs.Items) { if (item.Name.IndexOf(q, StringComparison.OrdinalIgnoreCase) >= 0) { return (int)item.Index; } } return -1; } private static int FindEquip(string q) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected I4, but got Unknown if (string.IsNullOrWhiteSpace(q)) { return -1; } foreach (Catalogs.EquipEntry item in Catalogs.Equipment) { if (item.Name.IndexOf(q, StringComparison.OrdinalIgnoreCase) >= 0) { return (int)item.Index; } } return -1; } private static int FindBuff(string q) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected I4, but got Unknown if (string.IsNullOrWhiteSpace(q)) { return -1; } foreach (Catalogs.BuffEntry buff in Catalogs.Buffs) { if (buff.Name.IndexOf(q, StringComparison.OrdinalIgnoreCase) >= 0) { return (int)buff.Index; } } return -1; } private static string FindBody(string q) { if (string.IsNullOrWhiteSpace(q)) { return null; } foreach (Catalogs.BodyEntry body in Catalogs.Bodies) { if ((Object)(object)body.Prefab != (Object)null && (body.Name.IndexOf(q, StringComparison.OrdinalIgnoreCase) >= 0 || ((Object)body.Prefab).name.IndexOf(q, StringComparison.OrdinalIgnoreCase) >= 0)) { return ((Object)body.Prefab).name; } } return null; } private static string FindSpawn(string q) { if (string.IsNullOrWhiteSpace(q)) { return null; } foreach (Catalogs.SpawnEntry spawnCard in Catalogs.SpawnCards) { if (spawnCard.Name.IndexOf(q, StringComparison.OrdinalIgnoreCase) >= 0) { return spawnCard.Name; } } return null; } } internal class PoppyGhost : MonoBehaviour { private Collider[] _cols; private Rigidbody _rb; private readonly HashSet _ignored = new HashSet(); private void Start() { ProjectileController component = ((Component)this).GetComponent(); _cols = (((Object)(object)component != (Object)null && component.myColliders != null && component.myColliders.Length != 0) ? component.myColliders : ((Component)this).GetComponentsInChildren(true)); _rb = ((Component)this).GetComponent(); Scan(); } private void FixedUpdate() { if (Aim.MagicBullet) { Scan(); } } private void Scan() { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) if (_cols == null || _cols.Length == 0) { return; } float num = 10f; if ((Object)(object)_rb != (Object)null) { float num2 = num; Vector3 velocity = _rb.velocity; num = Mathf.Max(num2, ((Vector3)(ref velocity)).magnitude * Time.fixedDeltaTime * 3f); } Collider[] array = Physics.OverlapSphere(((Component)this).transform.position, num, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)2); foreach (Collider val in array) { if ((Object)(object)val == (Object)null || _ignored.Contains(val)) { continue; } _ignored.Add(val); for (int j = 0; j < _cols.Length; j++) { if ((Object)(object)_cols[j] != (Object)null) { Physics.IgnoreCollision(_cols[j], val, true); } } } } } internal class PoppyHoming : MonoBehaviour { private const float CatchTime = 0.12f; private const float SnapRadius = 3f; private Transform _target; private TeamIndex _team; private ProjectileSimple _simple; private Rigidbody _rb; private float _baseSpeed; private float _reacquire; internal void Init(Transform target, TeamIndex ownerTeam) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) _target = target; _team = ownerTeam; _simple = ((Component)this).GetComponent(); _rb = ((Component)this).GetComponent(); _baseSpeed = (((Object)(object)_simple != (Object)null) ? Mathf.Max(_simple.desiredForwardSpeed, 1f) : 0f); } private void FixedUpdate() { //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0115: 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_0140: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_target == (Object)null) { _reacquire -= Time.fixedDeltaTime; if (_reacquire <= 0f) { _target = FindNearest(); _reacquire = 0.2f; } if ((Object)(object)_target == (Object)null) { return; } } if (_baseSpeed <= 1f && (Object)(object)_rb != (Object)null) { Vector3 velocity = _rb.velocity; _baseSpeed = Mathf.Max(((Vector3)(ref velocity)).magnitude, 1f); } if (_baseSpeed <= 1f) { _baseSpeed = 60f; } Vector3 val = _target.position - ((Component)this).transform.position; float magnitude = ((Vector3)(ref val)).magnitude; if (magnitude < 0.0001f) { return; } Vector3 val2 = val / magnitude; ((Component)this).transform.rotation = Quaternion.LookRotation(val2); float fixedDeltaTime = Time.fixedDeltaTime; float num = Mathf.Min(Mathf.Max(_baseSpeed, magnitude / 0.12f), magnitude / fixedDeltaTime); Vector3 velocity2 = val2 * num; bool flag = false; if ((Object)(object)_rb != (Object)null && !_rb.isKinematic) { _rb.velocity = velocity2; flag = true; } if ((Object)(object)_simple != (Object)null) { _simple.desiredForwardSpeed = num; _simple.velocity = num; flag = true; } if (!flag) { Vector3 val3 = ((Component)this).transform.position + val2 * Mathf.Min(magnitude, num * fixedDeltaTime); if ((Object)(object)_rb != (Object)null) { _rb.MovePosition(val3); } else { ((Component)this).transform.position = val3; } } if (magnitude <= 3f) { ((Component)this).transform.position = _target.position; if ((Object)(object)_rb != (Object)null) { _rb.position = _target.position; } } } private Transform FindNearest() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0079: 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_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Invalid comparison between Unknown and I4 //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Invalid comparison between Unknown and I4 //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)this).transform.position; float num = Aim.MaxRange * Aim.MaxRange; Transform result = null; foreach (CharacterBody readOnlyInstances in CharacterBody.readOnlyInstancesList) { if ((Object)(object)readOnlyInstances == (Object)null || (Object)(object)readOnlyInstances.healthComponent == (Object)null || !readOnlyInstances.healthComponent.alive || (Object)(object)readOnlyInstances.teamComponent == (Object)null) { continue; } TeamIndex teamIndex = readOnlyInstances.teamComponent.teamIndex; if (teamIndex == _team || (int)teamIndex == -1 || (int)teamIndex == 0 || (int)teamIndex == 1) { continue; } Vector3 val = readOnlyInstances.corePosition - position; float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude; if (!(sqrMagnitude >= num)) { HurtBox val2 = Util.FindBodyMainHurtBox(readOnlyInstances); if ((Object)(object)val2 != (Object)null) { num = sqrMagnitude; result = ((Component)val2).transform; } } } return result; } } internal static class Safety { internal static bool NoEnemies; internal static bool Buddha; internal static bool LockExp; internal static bool PreventProfileWriting; private static Harmony _h; internal static void Init() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Expected O, but got Unknown _h = new Harmony("poppy.safety"); Patch(typeof(HealthComponent), "TakeDamage", "BuddhaPrefix"); Patch(typeof(ExperienceManager), "AwardExperience", "LockExpPrefix"); Patch(typeof(UserProfile), "RequestEventualSave", "PreventSavePrefix"); CharacterBody.onBodyStartGlobal += OnBodyStart; } internal static void Shutdown() { CharacterBody.onBodyStartGlobal -= OnBodyStart; Harmony h = _h; if (h != null) { h.UnpatchSelf(); } _h = null; } private static void Patch(Type type, string method, string prefix) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown try { MethodInfo methodInfo = AccessTools.Method(type, method, (Type[])null, (Type[])null); if (methodInfo != null) { _h.Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(Safety), prefix, (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); return; } Log.Warning("Safety: " + type.Name + "." + method + " not found, that toggle will be inert."); } catch (Exception arg) { Log.Error($"Safety patch {type.Name}.{method}: {arg}"); } } private static void OnBodyStart(CharacterBody body) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Invalid comparison between Unknown and I4 //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Invalid comparison between Unknown and I4 if (NoEnemies && NetworkServer.active && !((Object)(object)body == (Object)null) && !((Object)(object)body.teamComponent == (Object)null) && !((Object)(object)body.master == (Object)null)) { TeamIndex teamIndex = body.teamComponent.teamIndex; if ((int)teamIndex == 2 || (int)teamIndex == 4) { body.master.TrueKill(); } } } private static void BuddhaPrefix(HealthComponent __instance, DamageInfo damageInfo) { if (Buddha && !((Object)(object)__instance == (Object)null) && damageInfo != null && !((Object)(object)__instance.body == (Object)null) && IsLocalPlayer(__instance.body)) { float num = Mathf.Max(0f, __instance.combinedHealth - 1f); if (damageInfo.damage > num) { damageInfo.damage = num; } } } private static bool LockExpPrefix() { return !LockExp; } private static bool PreventSavePrefix() { return !PreventProfileWriting; } private static bool IsLocalPlayer(CharacterBody body) { NetworkUser val = Util.LookUpBodyNetworkUser(body); if ((Object)(object)val != (Object)null) { return NetworkUser.readOnlyLocalPlayersList.Contains(val); } return false; } } internal static class StepRunner { internal static void Run(CustomStep s) { //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0174: 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_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) if (s == null) { return; } switch (s.Kind) { case StepKind.Feature: ActionRegistry.RunId(s.Id); break; case StepKind.Item: NetUtil.Do(PoppyOp.GiveItem, s.Index, Mathf.Max(1, s.Amount)); break; case StepKind.Equipment: NetUtil.Do(PoppyOp.GiveEquipment, s.Index); break; case StepKind.Buff: if (s.Duration > 0f) { NetUtil.Do(PoppyOp.GiveTimedBuff, s.Index, 0, s.Duration); } else { NetUtil.Do(PoppyOp.GiveBuff, s.Index, Mathf.Max(1, s.Amount)); } break; case StepKind.Money: NetUtil.Do(PoppyOp.GiveMoney, s.Amount); break; case StepKind.Xp: NetUtil.Do(PoppyOp.GiveXp, s.Amount); break; case StepKind.Lunar: NetUtil.Do(PoppyOp.GiveLunar, s.Amount); break; case StepKind.Spawn: { Vector3 val2 = AtPlayer(); NetUtil.Do(PoppyOp.Spawn, Mathf.Max(1, s.Amount), s.Team, val2.x, val2.y, val2.z, b1: false, s.Id); break; } case StepKind.Become: { Vector3 val = AtPlayer(); NetUtil.Do(PoppyOp.ChangeBody, 0, 0, val.x, val.y, val.z, b1: false, s.Id); break; } case StepKind.Heal: if (s.Amount > 0) { NetUtil.Do(PoppyOp.HealAmount, 0, 0, s.Amount); } else { NetUtil.Do(PoppyOp.HealFull); } break; case StepKind.Command: PoppyConsole.Submit(s.Id); break; case StepKind.Macro: MacroStore.Run(s.Id); break; } } private static Vector3 AtPlayer() { //IL_0012: 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) if (!PlayerContext.HasBody) { return Vector3.zero; } return PlayerContext.Body.footPosition; } } public static class MyPluginInfo { public const string PLUGIN_GUID = "com.poppy.poppymenu"; public const string PLUGIN_NAME = "Poppy Menu"; public const string PLUGIN_VERSION = "2.2.3"; } }