using System; using System.Collections.Generic; namespace UltraParadise.Shared { internal enum CKind { Toggle, Action, Slider, Buttons, Info, Note } internal sealed class CBtn { public string Label, Act, Arg; public CBtn(string label, string act, string arg) { Label = label; Act = act; Arg = arg; } } internal sealed class COpt { public CKind Kind; public string Id, Name, Hint, Key = ""; public float Min, Max, Step, Default; public string Format = "x{0:0.00}"; public List Buttons; public Func, string> Text; } internal sealed class CSection { public string Title; public int Col; public readonly List Rows = new List(); } internal sealed class CTab { public string Name; public readonly List Sections = new List(); public CTab(string name) { Name = name; } } internal static class Cheats { public const string MenuKey = "F10"; public const string OverlayKey = "Insert"; private static CTab tab; private static CSection sec; private static int n; private static void Sec(string title, int col) { sec = new CSection(); sec.Title = title; sec.Col = col; tab.Sections.Add(sec); } private static COpt Add(COpt o) { sec.Rows.Add(o); n++; return o; } private static COpt T(string id, string name, string key, string hint) { COpt o = new COpt(); o.Kind = CKind.Toggle; o.Id = id; o.Name = name; o.Key = key ?? ""; o.Hint = hint; return Add(o); } private static COpt A(string id, string name, string key, string hint) { COpt o = new COpt(); o.Kind = CKind.Action; o.Id = id; o.Name = name; o.Key = key ?? ""; o.Hint = hint; return Add(o); } private static COpt S(string id, string name, float min, float max, float step, float def, string fmt) { COpt o = new COpt(); o.Kind = CKind.Slider; o.Id = id; o.Name = name; o.Min = min; o.Max = max; o.Step = step; o.Default = def; if (fmt != null) o.Format = fmt; return Add(o); } private static COpt B(string name, Func, string> text, params CBtn[] btns) { COpt o = new COpt(); o.Kind = CKind.Buttons; o.Id = "btn:" + n; o.Name = name; o.Text = text; o.Buttons = new List(btns); return Add(o); } private static COpt I(Func, string> text) { COpt o = new COpt(); o.Kind = CKind.Info; o.Id = "info:" + n; o.Text = text; return Add(o); } private static COpt N(string text) { COpt o = new COpt(); o.Kind = CKind.Note; o.Id = "note:" + n; o.Name = text; return Add(o); } public static string Get(Dictionary d, string k, string def) { string v; return d != null && d.TryGetValue(k, out v) ? v : def; } private static Func, string> Skill(string label, string key) { return delegate (Dictionary d) { return label + " " + Get(d, key, "-"); }; } public static List Build() { List tabs = new List(); n = 0; tab = new CTab("Player"); tabs.Add(tab); Sec("PLAYER", 0); T("GodMode", "God Mode", "Keypad1", "Can't be hurt or killed. Pauses itself if your character gives up or tries to end it."); T("NoFallDamage", "No Fall Damage", null, "Falls and hard landings don't hurt."); T("InfiniteStamina", "Infinite Stamina", "Keypad2", null); T("NoHunger", "No Hunger", "Keypad3", null); T("NoThirst", "No Thirst", "Keypad4", null); T("NoTiredness", "No Tiredness", "Keypad5", "You can't sleep while this is on."); Sec("HEALING", 0); A("heal", "Heal All Wounds", "Ctrl+Keypad1", "Heals every wound, fixes bones and blood, and clears hearing loss."); A("limbs", "Reattach Limbs", null, "Puts lost limbs back (not prosthetics)."); Sec("EMERGENCY", 0); A("em_full", "Full Restore", null, "One click: heals every wound, reattaches limbs, fills blood, food and water."); A("em_bleed", "Stop the Bleeding", null, "Stops all bleeding, inside and out, and tops your blood up to 70%."); A("em_breathe", "Can't Breathe", null, "Fills blood oxygen and clears embolisms, collapsed lungs and barotrauma."); A("em_heart", "Heart Trouble", null, "Stops fibrillation and shock, steadies heart rate and blood pressure, wakes you up."); A("em_cure", "Cure Everything", null, "Clears infection, sickness, radiation sickness, venom and sepsis."); A("em_body", "Food, Water, Warmth", null, "Fills hunger and thirst, sets your temperature to 37C and takes the pain away."); Sec("PROTECTION", 1); T("NoBleeding", "No Bleeding", "Keypad6", "No bleeding, inside or out."); T("NoPain", "No Pain", "Keypad7", null); T("NoInfection", "No Infection", null, "Wounds never get infected."); T("NoSickness", "No Sickness", null, "No sickness, nausea or venom."); T("NoRadiation", "No Radiation Sickness", null, null); T("UnlimitedOxygen", "Unlimited Oxygen", "Keypad8", "Blood oxygen stays full, even underwater."); T("StableTemperature", "Stable Body Temperature", null, "Your body stays at 37C."); T("FasterHealing", "Faster Healing", null, "Wounds, bones and blood heal faster."); S("HealingMult", "Healing rate", 1f, 10f, 0.5f, 3f, null); Sec("MOOD", 2); I(delegate (Dictionary d) { return "Mood " + Get(d, "mood", "-"); }); T("MoodLock", "Mood Lock", null, "Keeps your mood where it is when you switch it on."); B("Change", null, new CBtn("Max", "moodmax", null), new CBtn("+10", "mood", "10"), new CBtn("-10", "mood", "-10"), new CBtn("-50", "mood", "-50")).Hint = "Very low mood can lead to self-harm."; Sec("SKILLS", 2); T("MoreXp", "Increased XP Gain", null, "Skills level up faster."); S("XpMult", "XP rate", 1f, 10f, 0.5f, 3f, null); B(null, Skill("Strength", "str"), new CBtn("-1", "skill", "0 -1"), new CBtn("+1", "skill", "0 1"), new CBtn("+5", "skill", "0 5")); B(null, Skill("Resilience", "res"), new CBtn("-1", "skill", "1 -1"), new CBtn("+1", "skill", "1 1"), new CBtn("+5", "skill", "1 5")); B(null, Skill("Intelligence", "int"), new CBtn("-1", "skill", "2 -1"), new CBtn("+1", "skill", "2 1"), new CBtn("+5", "skill", "2 5")); tab = new CTab("Movement"); tabs.Add(tab); Sec("MOVEMENT", 0); T("FasterMovement", "Faster Movement", null, "You walk and run faster."); S("MoveSpeedMult", "Speed", 1f, 4f, 0.1f, 1.6f, null); T("FasterClimbing", "Faster Climbing", null, "Ropes and ladders."); S("ClimbSpeedMult", "Climb speed", 1f, 5f, 0.25f, 2f, null); T("HigherJumps", "Higher Jumps", null, null); S("JumpMult", "Jump power", 1f, 3f, 0.1f, 1.5f, null); T("UnlimitedJumps", "Unlimited Jumps", null, "Jump again in mid-air as often as you like."); T("UnlimitedWallJumps", "Unlimited Wall Jumps", null, "Wall jump off the same wall over and over."); Sec("BODY", 1); T("LowGravity", "Low Gravity", null, "You fall slower and float further."); S("GravityScale", "Gravity", 0.05f, 1f, 0.05f, 0.4f, null); T("UnlimitedCarry", "No Over-Encumbrance", null, "Carrying too much never slows you, tires you or slows your attacks."); Sec("FLYING", 1); T("FlyMode", "Fly Mode", null, "Movement keys to fly, Space to go up, Shift for speed. You still bump into walls."); S("FlySpeed", "Fly speed", 5f, 40f, 1f, 18f, "{0:0}"); T("Noclip", "Noclip", "Keypad0", "Fly through walls with your movement keys. Shift for speed."); Sec("TELEPORT", 2); T("ClickTeleport", "Middle-Click Teleport", null, "Click the middle mouse button in game to teleport to the cursor."); A("exit", "Teleport to Layer Exit", "Ctrl+Keypad3", "Takes you to the bottom of the layer, where the next one starts."); tab = new CTab("Items"); tabs.Add(tab); Sec("CRAFTING", 0); T("FreeCrafting", "Free Crafting", null, "Craft any recipe you can see without ingredients."); T("NoCraftFail", "No Crafting Failures", null, "Crafting never fails, even above your Intelligence."); T("AllRecipes", "Show All Recipes", null, "Every recipe shows, whatever your Intelligence."); Sec("INVENTORY", 0); T("NoDegradation", "No Item Degradation", null, "Tools, weapons, armor, containers and batteries never wear out."); T("UnlimitedLiquids", "Unlimited Liquids", null, "Liquids in containers never run out."); T("UnlimitedBattery", "Unlimited Battery", null, "Batteries never drain."); T("MasterLockpick", "Master Lockpicker", null, "Every lock opens the moment you turn it, with a lockpicking kit or bare claws. No hurt claws, no worn-out kit."); Sec("LOADOUT", 1); A("starterkit", "Starter Kit", null, "The game's own kit of tools, medicine and supplies."); A("randomloadout", "Random Loadout", null, "Gives you 6 random items."); tab = new CTab("Combat"); tabs.Add(tab); Sec("WEAPONS", 0); T("UnlimitedAmmo", "Unlimited Ammo", "Keypad9", "Load the gun once (magazine in, or a shell in the shotgun) and it keeps refilling."); T("NoGunJams", "No Gun Jams", null, null); T("NoRecoil", "No Recoil", null, "Guns don't kick you back or spread."); T("MoreDamage", "Increased Damage", null, "Your melee and gun hits do more damage."); S("DamageMult", "Damage", 1f, 10f, 0.5f, 2f, null); T("FasterAttacks", "Faster Attacks", null, "Shorter wait between melee swings."); S("AttackSpeedMult", "Swing speed", 1f, 5f, 0.25f, 2.5f, null); T("OneHitKills", "One-Hit Kills", null, "Your melee hits and gunshots kill enemies in one hit."); T("InstantMine", "Instant Mine", null, "Your melee hits break any breakable block in one hit."); Sec("ENEMIES", 1); T("FreezeEnemies", "Freeze Enemies", null, "Enemies can't move or attack."); T("Invisibility", "Invisibility", null, "Enemies and turrets can't attack you."); T("DisableTraps", "Disable Traps", null, "Mines, bear traps, spike stabbers, fans, sound cannons and turrets do nothing."); A("killall", "Kill All Enemies", "Ctrl+Keypad2", null); A("spiders", "Spider Ambush", null, "Drops cave ticks around you. Good luck."); tab = new CTab("World"); tabs.Add(tab); Sec("LAYER", 0); T("PauseRadiation", "Pause Radiation Line", null, "The layer timer and the radiation line stop."); T("LongerEscape", "Longer Escape Timer", null, "The end lab countdown is 2 minutes instead of 1."); T("MoreLoot", "Increased Loot", null, "New layers have more loot. Starts on the next layer."); S("LootMult", "Loot", 1f, 5f, 0.25f, 2f, null); A("back", "Previous Layer", "Ctrl+Keypad4", null); A("skip", "Skip Layer", "Ctrl+Keypad5", null); Sec("EVENTS", 1); T("NoEarthquakes", "No Earthquakes", null, null); A("quake", "Start Earthquake", null, null); A("downpour", "Fungal Downpour", null, "Fungal rain for 60 seconds."); Sec("UNLOCKS", 1); A("unlock", "Unlock All Characters", null, "Permanent: marks every character as beaten so the next one unlocks."); Sec("VIEW", 2); T("FullBright", "Full Bright", "KeypadPeriod", "Lights up everything."); T("FreeCamera", "Free Camera", null, "Arrow keys move the camera on its own, Shift for speed."); S("CameraZoom", "Camera zoom", 0.5f, 3f, 0.05f, 1f, null).Hint = "Above 1 shows more of the cave."; S("GameSpeed", "Game speed", 0.25f, 3f, 0.05f, 1f, null); A("speedcycle", "Cycle Game Speed", "Ctrl+Keypad6", "Cycles 1x, 1.5x, 2x and 0.5x."); tab = new CTab("Traders"); tabs.Add(tab); Sec("TRADERS", 0); T("MaxTraderRep", "Max Reputation", null, "Nearby survivors always have max reputation and are never hostile."); T("FreeShopping", "Free Shopping", null, "Everything survivors sell costs 0."); T("InfiniteCredit", "Infinite Credit", null, "Keeps the nearest survivor's trade credit at 9999."); Sec("NEAREST SURVIVOR", 1); I(delegate (Dictionary d) { string t = Get(d, "trader", null); if (t == null) return "No survivor within 20 m"; return t + " " + Get(d, "tdist", "?") + " m away, rep " + Get(d, "rep", "?") + (Get(d, "hostile", null) != null ? ", hostile" : ""); }); I(delegate (Dictionary d) { return Get(d, "trader", null) == null ? "" : "Trade credit " + Get(d, "credit", "0"); }); B("Credit", null, new CBtn("+10", "credit", "10"), new CBtn("+50", "credit", "50"), new CBtn("+100", "credit", "100"), new CBtn("+1000", "credit", "1000")); B("", null, new CBtn("-10", "credit", "-10"), new CBtn("Set 0", "credit", "zero"), new CBtn("Restock", "restock", null)); Sec("HOW TRADING WORKS", 2); N("The game has no money. Each survivor keeps a trade credit for what you've given them. Add credit here, then spend it in their trade menu.\n\nCredit belongs to each survivor, so stand near the one you want to trade with."); tab = new CTab("Challenges"); tabs.Add(tab); Sec("CHALLENGES", 0); T("FragileBody", "Fragile Body", null, "You take double damage."); T("FastMetabolism", "Faster Hunger and Thirst", null, "Hunger, thirst and tiredness drain twice as fast."); T("HopelessStart", "Hopeless Start", null, "New runs start with no supplies at all. Starts with your next new run."); T("BrittleGear", "Brittle Gear", null, "Items decay three times faster."); T("StrongerEnemies", "Stronger Enemies", null, "Enemies take half damage and creatures hit harder."); Sec(" ", 1); T("FastRadiation", "Fast Radiation Line", null, "The layer timer and the radiation line go twice as fast."); T("UnchippedChallenge", "Unchipped Mode", null, "No health readouts and limited vision."); T("ColdCaves", "Cold Caves", null, "The caves are 15C colder."); T("MoreTraps", "More Traps", null, "Twice as many traps, from the next layer."); T("LootScarcity", "Loot Scarcity", null, "Much less loot, from the next layer."); Sec("ABOUT CHALLENGES", 2); N("Make the game harder. They stack with the game's own run settings, and you can mix them with cheats however you like."); return tabs; } public static string KeyLabel(string k) { if (string.IsNullOrEmpty(k) || k == "none") return "-"; string[] parts = k.Split('+'); string last = parts[parts.Length - 1]; string name = last; if (last.StartsWith("Keypad", StringComparison.Ordinal)) { string r = last.Substring(6); if (r == "Period") r = "."; else if (r == "Plus") r = "+"; else if (r == "Minus") r = "-"; else if (r == "Multiply") r = "*"; else if (r == "Divide") r = "/"; else if (r == "Enter") r = "Enter"; name = "Num " + r; } else if (last.StartsWith("Alpha", StringComparison.Ordinal)) name = last.Substring(5); else if (last.StartsWith("JoystickButton", StringComparison.Ordinal)) name = "Pad " + last.Substring(14); else if (last.EndsWith("Arrow", StringComparison.Ordinal)) name = last.Substring(0, last.Length - 5); string pre = ""; for (int i = 0; i < parts.Length - 1; i++) pre += parts[i] + "+"; return pre + name; } } }