Due to update 2.4.3, some mods may no longer function. FixedConfig may be necessary.
Decompiled source of Cheat Mode v1.0.1
plugins/CheatMode.dll
Decompiled 11 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Logging; using BoplFixedMath; using HarmonyLib; using Microsoft.CodeAnalysis; using Steamworks; using Steamworks.Data; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; 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("CheatMode")] [assembly: AssemblyConfiguration("Pack")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("CheatMode")] [assembly: AssemblyTitle("CheatMode")] [assembly: AssemblyVersion("1.0.0.0")] [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 KonamiCheatMenu { internal static class Bots { internal enum Mode { Idle, Follow, Fight } internal sealed class Bot { public int Id; public Mode Mode; public int Target = -1; public bool AimAtTarget; public Vec2 AimDir = Vec2.right; public readonly Fix[] Hold = (Fix[])(object)new Fix[3]; public readonly Fix[] Pending = (Fix[])(object)new Fix[3]; public Fix Jump; public Fix WalkTime; public Fix Think; public int Walk; public int Spam = -1; public uint Rng; } private static readonly Dictionary<int, Bot> bots = new Dictionary<int, Bot>(); private static readonly FieldRef<SlimeController, Fix[]> cooldownRef = AccessTools.FieldRefAccess<SlimeController, Fix[]>("abilityCooldownTimers"); private static readonly Fix Tap = (Fix)0.12; public static bool Any => bots.Count > 0; public static Bot Get(int id) { if (!bots.TryGetValue(id, out var value)) { return null; } return value; } public static void Clear() { bots.Clear(); } private static Bot Make(int id) { if (!bots.TryGetValue(id, out var value)) { value = new Bot { Id = id, Rng = (uint)(id * 7919 + 17) }; bots[id] = value; } return value; } public static string Command(int id, string action, List<string> args, int sender) { //IL_0400: Unknown result type (might be due to invalid IL or missing references) //IL_0405: Unknown result type (might be due to invalid IL or missing references) //IL_032b: Unknown result type (might be due to invalid IL or missing references) //IL_0330: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_0417: Unknown result type (might be due to invalid IL or missing references) //IL_041c: Unknown result type (might be due to invalid IL or missing references) //IL_036a: Unknown result type (might be due to invalid IL or missing references) //IL_036f: Unknown result type (might be due to invalid IL or missing references) //IL_0374: Unknown result type (might be due to invalid IL or missing references) //IL_042e: Unknown result type (might be due to invalid IL or missing references) //IL_0433: Unknown result type (might be due to invalid IL or missing references) //IL_0438: Unknown result type (might be due to invalid IL or missing references) //IL_043d: Unknown result type (might be due to invalid IL or missing references) //IL_0442: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0454: Unknown result type (might be due to invalid IL or missing references) //IL_0459: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_03a6: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_0309: Unknown result type (might be due to invalid IL or missing references) //IL_049b: Unknown result type (might be due to invalid IL or missing references) //IL_04a0: Unknown result type (might be due to invalid IL or missing references) //IL_04a5: Unknown result type (might be due to invalid IL or missing references) if (!Spawner.IsDummy(id)) { return $"!player {id} is not a dummy (only dummies can be controlled; spawn one with 'spawn dummy')"; } Bot bot = Make(id); string text = ((args.Count > 0) ? args[0].ToLowerInvariant() : null); switch (action) { case "use": case "spam": { int num4 = SlotOf(id, string.Join(" ", args)); if (num4 < 0) { return string.Format("!dummy {0} has no ability '{1}'", id, string.Join(" ", args)); } if (action == "spam") { bot.Spam = num4; return $"dummy {id}: spamming slot {num4 + 1} ({SlotName(id, num4)})"; } bot.Pending[num4] = (Fix)10L; return string.Format("dummy {0}: use slot {1} ({2}){3}", id, num4 + 1, SlotName(id, num4), (ReadyIn(id, num4) > Fix.Zero) ? $" when ready ({(float)ReadyIn(id, num4):0.#} s)" : ""); } case "hold": { int result2; int num3 = ((text != null && int.TryParse(text, out result2)) ? (result2 - 1) : (-1)); if (num3 < 0 || num3 > 2) { return "!slot must be 1, 2 or 3"; } bot.Hold[num3] = Seconds(args, 1, (Fix)2L); return $"dummy {id}: holding slot {num3 + 1} for {(float)bot.Hold[num3]:0.#} s"; } case "jump": bot.Jump = Seconds(args, 0, (Fix)0.25); return $"dummy {id}: jump"; case "walk": bot.Walk = ((!(text == "left")) ? 1 : (-1)); bot.WalkTime = Seconds(args, 1, Fix.One); bot.Mode = Mode.Idle; return string.Format("dummy {0}: walk {1} for {2:0.#} s", id, (bot.Walk < 0) ? "left" : "right", (float)bot.WalkTime); case "aim": switch (text) { case "up": bot.AimDir = Vec2.up; bot.AimAtTarget = false; break; case "down": bot.AimDir = Vec2.down; bot.AimAtTarget = false; break; case "left": bot.AimDir = new Vec2(-Fix.One, Fix.Zero); bot.AimAtTarget = false; break; case "right": bot.AimDir = Vec2.right; bot.AimAtTarget = false; break; case "nearest": bot.Target = -2; bot.AimAtTarget = true; break; default: { if (float.TryParse(text, NumberStyles.Float, CultureInfo.InvariantCulture, out var result)) { bot.AimDir = new Vec2((Fix)(result * (MathF.PI / 180f))); bot.AimAtTarget = false; break; } goto case null; } case null: { int num2 = Cheats.Targets(text, sender).FirstOrDefault((int x) => x != id); if (num2 <= 0) { return "!no player '" + text + "'"; } bot.Target = num2; bot.AimAtTarget = true; break; } } return $"dummy {id}: aiming {text}"; case "follow": case "fight": { int num = ((text != null) ? Cheats.Targets(text, sender).FirstOrDefault((int x) => x != id) : sender); if (num <= 0 || num == id) { num = -2; } bot.Target = num; bot.AimAtTarget = true; bot.Mode = ((!(action == "fight")) ? Mode.Follow : Mode.Fight); return string.Format("dummy {0}: {1} {2}", id, action, (num > 0) ? ("player " + num) : "nearest player"); } case "stop": bots.Remove(id); Release(id); return $"dummy {id}: stopped"; default: return "!unknown action " + action; } } private static Fix Seconds(List<string> args, int index, Fix fallback) { //IL_0045: 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_0032: 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_003f: Unknown result type (might be due to invalid IL or missing references) if (args.Count > index && float.TryParse(args[index], NumberStyles.Float, CultureInfo.InvariantCulture, out var result)) { return Fix.Clamp((Fix)result, (Fix)0.02, (Fix)30L); } return fallback; } private static int SlotOf(int id, string what) { //IL_0069: Unknown result type (might be due to invalid IL or missing references) what = (what ?? "").Trim().ToLowerInvariant(); if (int.TryParse(what, out var result)) { if (result < 1 || result > 3) { return -1; } return result - 1; } Player player = PlayerHandler.Get().GetPlayer(id); NamedSprite? val = Spawner.FindAbility(what); if (player == null || player.Abilities == null || !val.HasValue) { return -1; } for (int i = 0; i < player.Abilities.Count; i++) { if ((Object)(object)player.Abilities[i] == (Object)(object)val.Value.associatedGameObject) { return i; } } return -1; } private static string SlotName(int id, int slot) { Player player = PlayerHandler.Get().GetPlayer(id); if (player == null || player.Abilities == null || slot >= player.Abilities.Count) { return "-"; } return Cheats.AbilityName(player.Abilities[slot]); } private static void Release(int id) { PlayerHandler obj = PlayerHandler.Get(); Player obj2 = ((obj != null) ? obj.GetPlayer(id) : null); if (obj2 != null) { obj2.ForceSetInputProfile(false, false, false, false, false, false, (byte)0, false, false, false, false); } } public static void Tick() { //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_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_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: 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_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: 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_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_0227: 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_0151: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_0212: 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_0219: 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_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_024b: 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_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_0331: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_031a: Unknown result type (might be due to invalid IL or missing references) //IL_031f: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Unknown result type (might be due to invalid IL or missing references) //IL_035c: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_034b: Unknown result type (might be due to invalid IL or missing references) //IL_0350: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Unknown result type (might be due to invalid IL or missing references) //IL_0370: Unknown result type (might be due to invalid IL or missing references) //IL_0371: Unknown result type (might be due to invalid IL or missing references) //IL_0376: Unknown result type (might be due to invalid IL or missing references) if (bots.Count == 0) { return; } PlayerHandler val = PlayerHandler.Get(); if (val == null) { return; } Fix fixedTimeStep = GameTime.FixedTimeStep; foreach (int item in bots.Keys.OrderBy((int k) => k).ToList()) { Bot bot = bots[item]; Player player = val.GetPlayer(item); if (player == null || !Spawner.IsDummy(item)) { bots.Remove(item); } else { if (!player.IsAlive) { continue; } SlimeController val2 = ((IEnumerable<SlimeController>)Cheats.SlimesOf(item)).FirstOrDefault((Func<SlimeController, bool>)((SlimeController s) => ((Component)s).gameObject.activeInHierarchy)); Vec2 position = player.Position; Player val3 = TargetOf(bot, position); if (bot.Mode != Mode.Idle) { Think(bot, player, val2, position, val3, fixedTimeStep); } if (bot.Spam >= 0 && (Object)(object)val2 != (Object)null && bot.Hold[bot.Spam] <= Fix.Zero && Ready(val2, bot.Spam)) { bot.Hold[bot.Spam] = Tap; } for (int num = 0; num < 3; num++) { if (!(bot.Pending[num] <= Fix.Zero)) { ref Fix reference = ref bot.Pending[num]; reference -= fixedTimeStep; if ((Object)(object)val2 != (Object)null && bot.Hold[num] <= Fix.Zero && Ready(val2, num)) { bot.Hold[num] = Tap; bot.Pending[num] = Fix.Zero; } } } Vec2 val4 = bot.AimDir; if (bot.AimAtTarget && val3 != null) { val4 = Vec2.NormalizedSafe(val3.Position - position); } if (val4 == Vec2.zero) { val4 = Vec2.right; } bool flag = bot.Walk < 0 && bot.WalkTime > Fix.Zero; bool flag2 = bot.Walk > 0 && bot.WalkTime > Fix.Zero; player.ForceSetInputProfile(false, false, bot.Jump > Fix.Zero, bot.Hold[0] > Fix.Zero, bot.Hold[1] > Fix.Zero, bot.Hold[2] > Fix.Zero, InputProfile.JoyStickAngleByteFromVector(val4), false, flag, false, flag2); for (int num2 = 0; num2 < 3; num2++) { if (bot.Hold[num2] > Fix.Zero) { ref Fix reference2 = ref bot.Hold[num2]; reference2 -= fixedTimeStep; } } if (bot.Jump > Fix.Zero) { bot.Jump -= fixedTimeStep; } if (bot.WalkTime > Fix.Zero) { bot.WalkTime -= fixedTimeStep; } } } } private static Player TargetOf(Bot b, Vec2 pos) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_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_00a4: 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_00c9: 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_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: 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_00df: 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) PlayerHandler val = PlayerHandler.Get(); if (b.Target > 0) { Player player = val.GetPlayer(b.Target); if (player != null && player.IsAlive) { return player; } } if (b.Target == -1 && !b.AimAtTarget) { return null; } Player result = null; Fix val2 = Fix.MaxValue; foreach (Player item in from q in val.PlayerList() orderby q.Id select q) { if (item != null && item.Id != b.Id && item.IsAlive) { Fix val3 = Vec2.SqrMagnitude(item.Position - pos) + (Spawner.IsDummy(item.Id) ? ((Fix)100000L) : Fix.Zero); if (val3 < val2) { val2 = val3; result = item; } } } return result; } private static Fix ReadyIn(int id, int slot) { //IL_006f: 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_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_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) SlimeController val = ((IEnumerable<SlimeController>)Cheats.SlimesOf(id)).FirstOrDefault((Func<SlimeController, bool>)((SlimeController s) => s.abilities != null)); Fix[] array = (((Object)(object)val != (Object)null) ? cooldownRef.Invoke(val) : null); if (array == null || slot >= val.abilities.Count || slot >= array.Length || (Object)(object)val.abilities[slot] == (Object)null) { return Fix.Zero; } return Fix.Max(Fix.Zero, val.abilities[slot].GetCooldown() - array[slot]); } private static bool Ready(SlimeController slime, int slot) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) Fix[] array = cooldownRef.Invoke(slime); if (slime.abilities == null || slot >= slime.abilities.Count || array == null || slot >= array.Length) { return false; } AbilityMonoBehaviour val = slime.abilities[slot]; if ((Object)(object)val != (Object)null && !((MonoUpdatable)val).IsDestroyed) { return array[slot] >= val.GetCooldown(); } return false; } private static void Think(Bot b, Player p, SlimeController slime, Vec2 pos, Player target, Fix dt) { //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_0009: 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_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_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_0054: 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_0076: 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_007b: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: 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_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: 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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: 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_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_00da: 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_00e2: 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_01c2: 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_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_0254: 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) b.Think -= dt; if (b.Think > Fix.Zero) { return; } b.Think = (Fix)0.3; if (target == null) { b.Walk = 0; return; } Vec2 val = target.Position - pos; Fix val2 = Vec2.Magnitude(val); Fix val3 = ((b.Mode == Mode.Fight) ? ((Fix)5L) : ((Fix)2.5)); bool flag = (Object)(object)slime != (Object)null && (Object)(object)slime.playerPhysics != (Object)null && slime.playerPhysics.IsGrounded(); if (Fix.Abs(val.x) > val3) { int num = ((val.x > Fix.Zero) ? 1 : (-1)); if (!flag || GroundAhead(pos, num) || val.y < -(Fix)3L) { b.Walk = num; b.WalkTime = (Fix)0.4; } else { b.Walk = 0; } } else if (b.Mode == Mode.Fight && Next(b) % 4 == 0) { b.Walk = ((Next(b) % 2 != 0) ? 1 : (-1)); b.WalkTime = (Fix)0.25; } else { b.Walk = 0; } if (flag && (val.y > (Fix)2.5 || (b.Walk != 0 && !GroundAhead(pos, b.Walk))) && Next(b) % 2 == 0) { b.Jump = (Fix)0.3; } if (b.Mode != Mode.Fight || (Object)(object)slime == (Object)null || val2 > (Fix)28L || Next(b) % 10 >= 6) { return; } int num2 = (int)(Next(b) % 3); for (int i = 0; i < 3; i++) { int num3 = (num2 + i) % 3; if (!(b.Hold[num3] > Fix.Zero) && Ready(slime, num3)) { uint num4 = Next(b) % 10; Fix[] hold = b.Hold; Fix val4; switch (num4) { default: val4 = (Fix)3.3; break; case 6u: case 7u: case 8u: val4 = (Fix)0.6; break; case 0u: case 1u: case 2u: case 3u: case 4u: case 5u: val4 = Tap; break; } hold[num3] = val4; break; } } } private static bool GroundAhead(Vec2 pos, int dir) { //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_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_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) return (Object)(object)DetPhysics.Get().RaycastToClosestRoundedRect(pos + new Vec2((Fix)(long)(dir * 2), Fix.One), Vec2.down, (Fix)25L).pp.fixTrans != (Object)null; } private static uint Next(Bot b) { b.Rng = b.Rng * 1664525 + 1013904223; return b.Rng >> 8; } } internal sealed class CheatMenu : MonoBehaviour { private struct Line { public string Text; public Color Color; } private static CheatMenu instance; private static readonly List<Line> log = new List<Line>(); private static readonly Color InfoColor = new Color(0.85f, 0.85f, 0.85f); private static readonly Color OkColor = new Color(0.45f, 0.95f, 0.45f); private static readonly Color ErrorColor = new Color(1f, 0.35f, 0.3f); private static readonly Color EchoColor = new Color(0.55f, 0.75f, 1f); private readonly List<string> history = new List<string>(); private int historyIndex = -1; private bool open; private string input = ""; private string analyzedInput; private Commands.Analysis analysis; private int selected; private bool suggestHidden; private bool moveCursorEnd; private Rect window = new Rect(20f, 20f, 1000f, 720f); private Vector2 logScroll; private Vector2 panelScroll; private Vector2 suggestScroll; private int tab; private int abPlayer = -1; private int abSlot; private string abSearch = ""; private bool focusInput; private bool blocked; private bool sized; private int resizeEdges; private Vector2 bottomScroll; private const float MinW = 380f; private const float MinH = 280f; private const float Edge = 7f; private readonly List<Player> blockedPlayers = new List<Player>(); private static bool mouseCaptured; private Rect suggestBox; private readonly List<Rect> suggestRows = new List<Rect>(); private int suggestFirst; private GUIStyle logStyle; private GUIStyle inputStyle; private GUIStyle overlayStyle; private GUIStyle hintStyle; private GUIStyle suggestStyle; private GUIStyle suggestDetail; private GUIStyle boxLabel; private Texture2D black; private Texture2D white; private Texture2D selectTex; private Font mono; private static readonly Key[] Konami; private int konamiStep; private readonly Dictionary<Color, Texture2D> texCache = new Dictionary<Color, Texture2D>(); public static bool IsOpen { get { if ((Object)(object)instance != (Object)null) { return instance.open; } return false; } } public static bool SwallowMouse { get { //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_0045: 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_0058: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)instance == (Object)null || !instance.open) { return false; } if (mouseCaptured) { return true; } Mouse current = Mouse.current; if (current == null) { return false; } Vector2 val = ((InputControl<Vector2>)(object)((Pointer)current).position).ReadValue(); return ((Rect)(ref instance.window)).Contains(new Vector2(val.x, (float)Screen.height - val.y)); } } private bool Suggesting { get { if (!suggestHidden && !string.IsNullOrEmpty(input) && analysis != null && analysis.Suggestions.Count > 0 && GUI.GetNameOfFocusedControl() == "cheatInput") { if (analysis.Suggestions.Count == 1) { return !CurrentWord().Equals(analysis.Suggestions[0].Text, StringComparison.OrdinalIgnoreCase); } return true; } return false; } } private void Awake() { instance = this; Info("Cheat Mode. Type 'help' (Tab completes, Up/Down picks)."); } public static void Print(string line) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) Add(line, InfoColor); } public static void Info(string line) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) Add(line, InfoColor); } public static void Ok(string line) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) Add(line, OkColor); } public static void Error(string line) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) Add(line, ErrorColor); } private static void Echo(string line) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) Add(line, EchoColor); } private static void Add(string text, Color color) { //IL_0029: 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) string[] array = text.Split('\n'); foreach (string text2 in array) { log.Add(new Line { Text = text2, Color = color }); } Plugin.Log.LogInfo((object)("[cheat] " + text)); while (log.Count > 400) { log.RemoveAt(0); } if ((Object)(object)instance != (Object)null) { instance.logScroll.y = float.MaxValue; } } public static void Clear() { log.Clear(); } public static void Close() { if ((Object)(object)instance != (Object)null) { instance.SetOpen(on: false); } } private void SetOpen(bool on) { open = on; focusInput = on; mouseCaptured = false; if (!on) { Unblock(); } } private void Update() { //IL_0068: 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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Invalid comparison between Unknown and I4 //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Invalid comparison between Unknown and I4 Mouse current = Mouse.current; if (mouseCaptured && (current == null || (!current.leftButton.isPressed && !current.rightButton.isPressed && !current.middleButton.isPressed))) { mouseCaptured = false; } Keyboard current2 = Keyboard.current; if (current2 == null || open) { return; } Key[] array = new Key[5]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); Key[] array2 = (Key[])(object)array; foreach (Key val in array2) { if (!((ButtonControl)current2[val]).wasPressedThisFrame) { continue; } if ((int)val == (int)Konami[konamiStep]) { konamiStep++; if (konamiStep == Konami.Length) { konamiStep = 0; SetOpen(on: true); Ok("cheats unlocked!"); } } else { konamiStep = (((int)val == (int)Konami[0]) ? 1 : 0); } } } private void Block(bool on) { if (on == blocked) { if (!on) { return; } { foreach (Player blockedPlayer in blockedPlayers) { if (blockedPlayer != null) { InputProfile rawInputProfile = blockedPlayer.GetRawInputProfile(); if (rawInputProfile != null) { rawInputProfile.Reset(); } } } return; } } blocked = on; if (on) { blockedPlayers.Clear(); PlayerHandler val = PlayerHandler.Get(); if (val == null) { return; } { foreach (Player item in val.PlayerList()) { if (item != null && item.IsLocalPlayer && !item.ignoreAllInputs && !Spawner.IsDummy(item.Id)) { item.ignoreAllInputs = true; InputProfile rawInputProfile2 = item.GetRawInputProfile(); if (rawInputProfile2 != null) { rawInputProfile2.Reset(); } blockedPlayers.Add(item); } } return; } } Unblock(); } private void Unblock() { foreach (Player blockedPlayer in blockedPlayers) { if (blockedPlayer != null) { blockedPlayer.ignoreAllInputs = false; } } blockedPlayers.Clear(); blocked = false; } private Texture2D Tex(Color c) { //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_000f: 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_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown Texture2D val = new Texture2D(1, 1) { hideFlags = (HideFlags)61 }; val.SetPixel(0, 0, c); val.Apply(); return val; } private void Styles() { //IL_004a: 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_0080: 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_00ab: 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_00ba: 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_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Expected O, but got Unknown //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_00df: Expected O, but got Unknown //IL_00e4: Expected O, but got Unknown //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Expected O, but got Unknown //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_015d: 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_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: 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_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Expected O, but got Unknown //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0204: 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_0213: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Expected O, but got Unknown //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Expected O, but got Unknown //IL_0264: Expected O, but got Unknown //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_0277: 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_0286: Expected O, but got Unknown //IL_028b: Expected O, but got Unknown //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Expected O, but got Unknown if (logStyle == null) { mono = Font.CreateDynamicFontFromOSFont(new string[3] { "Consolas", "Lucida Console", "Courier New" }, 15); black = Tex(new Color(0.03f, 0.03f, 0.04f, 0.97f)); white = Tex(Color.white); selectTex = Tex(new Color(0.15f, 0.3f, 0.55f, 1f)); logStyle = new GUIStyle(GUI.skin.label) { font = mono, fontSize = 15, wordWrap = true, richText = false, padding = new RectOffset(0, 0, 0, 0), margin = new RectOffset(0, 0, 0, 0) }; inputStyle = new GUIStyle(GUI.skin.textField) { font = mono, fontSize = 17 }; Color val = default(Color); ((Color)(ref val))..ctor(0f, 0f, 0f, 0f); GUIStyleState normal = inputStyle.normal; GUIStyleState hover = inputStyle.hover; GUIStyleState focused = inputStyle.focused; Color val2 = (inputStyle.active.textColor = val); Color val4 = (focused.textColor = val2); Color textColor = (hover.textColor = val4); normal.textColor = textColor; overlayStyle = new GUIStyle(GUI.skin.label) { font = mono, fontSize = 17, richText = true, wordWrap = false, clipping = (TextClipping)1, padding = inputStyle.padding, alignment = inputStyle.alignment, contentOffset = inputStyle.contentOffset }; overlayStyle.normal.textColor = Color.white; hintStyle = new GUIStyle(logStyle) { fontSize = 14, wordWrap = false, richText = true, clipping = (TextClipping)1 }; suggestStyle = new GUIStyle(logStyle) { fontSize = 15, wordWrap = false, richText = true, clipping = (TextClipping)1, padding = new RectOffset(28, 4, 2, 2) }; suggestDetail = new GUIStyle(suggestStyle) { alignment = (TextAnchor)2, padding = new RectOffset(4, 8, 2, 2) }; suggestDetail.normal.textColor = new Color(0.55f, 0.55f, 0.55f); boxLabel = new GUIStyle(GUI.skin.label) { richText = true, wordWrap = false }; } } private void OnGUI() { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Invalid comparison between Unknown and I4 //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_00a1: 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_0070: Invalid comparison between Unknown and I4 //IL_0114: 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_00af: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Expected O, but got Unknown //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) if (!open) { return; } Styles(); if (!sized) { sized = true; window = new Rect(20f, 20f, (float)Mathf.Min(1100, Screen.width - 40), (float)Mathf.Min(880, Screen.height - 40)); } Event current = Event.current; if ((int)current.type == 4 && (int)current.keyCode == 27) { if (Suggesting) { suggestHidden = true; } else { SetOpen(on: false); } current.Use(); if (!open) { return; } } ResizeByEdges(current); if ((int)current.type == 0 && ((Rect)(ref window)).Contains(current.mousePosition)) { mouseCaptured = true; } ((Rect)(ref window)).width = Mathf.Clamp(((Rect)(ref window)).width, 380f, (float)Screen.width); ((Rect)(ref window)).height = Mathf.Clamp(((Rect)(ref window)).height, 280f, (float)Screen.height); window = GUI.Window(4932429, window, new WindowFunction(DrawWindow), (((Rect)(ref window)).width > 760f) ? "CHEAT MODE (konami) Tab: complete Up/Down: pick Enter: run Esc: close" : "CHEAT MODE"); DrawEdgeHover(current); string nameOfFocusedControl = GUI.GetNameOfFocusedControl(); Block(nameOfFocusedControl == "cheatInput" || nameOfFocusedControl == "abSearch"); } private int EdgesAt(Vector2 m) { //IL_004d: 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_007b: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) Rect val = default(Rect); ((Rect)(ref val))..ctor(((Rect)(ref window)).x - 7f, ((Rect)(ref window)).y - 7f, ((Rect)(ref window)).width + 14f, ((Rect)(ref window)).height + 14f); if (!((Rect)(ref val)).Contains(m)) { return 0; } int num = 0; if (Mathf.Abs(m.x - ((Rect)(ref window)).xMin) < 7f) { num |= 1; } if (Mathf.Abs(m.x - ((Rect)(ref window)).xMax) < 7f) { num |= 2; } if (Mathf.Abs(m.y - ((Rect)(ref window)).yMin) < 4.2000003f) { num |= 4; } if (Mathf.Abs(m.y - ((Rect)(ref window)).yMax) < 7f) { num |= 8; } return num; } private void ResizeByEdges(Event e) { //IL_0001: 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_013b: Invalid comparison between Unknown and I4 //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Invalid comparison between Unknown and I4 //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0078: 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_00e1: 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) if ((int)e.type == 0 && e.button == 0) { resizeEdges = EdgesAt(e.mousePosition); if (resizeEdges != 0) { mouseCaptured = true; e.Use(); } } else if (resizeEdges != 0 && (int)e.type == 3) { Vector2 mousePosition = e.mousePosition; if ((resizeEdges & 1) != 0) { float xMax = ((Rect)(ref window)).xMax; ((Rect)(ref window)).xMin = Mathf.Min(mousePosition.x, xMax - 380f); } if ((resizeEdges & 2) != 0) { ((Rect)(ref window)).width = Mathf.Max(380f, mousePosition.x - ((Rect)(ref window)).x); } if ((resizeEdges & 4) != 0) { float yMax = ((Rect)(ref window)).yMax; ((Rect)(ref window)).yMin = Mathf.Min(Mathf.Max(0f, mousePosition.y), yMax - 280f); } if ((resizeEdges & 8) != 0) { ((Rect)(ref window)).height = Mathf.Max(280f, mousePosition.y - ((Rect)(ref window)).y); } e.Use(); } if ((int)e.rawType == 1) { resizeEdges = 0; } } private void DrawEdgeHover(Event e) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 //IL_0014: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_007f: 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_0101: 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) if ((int)e.type != 7) { return; } int num = ((resizeEdges != 0) ? resizeEdges : EdgesAt(e.mousePosition)); if (num != 0) { Color color = GUI.color; GUI.color = new Color(0.3f, 0.75f, 1f, 0.9f); if ((num & 1) != 0) { GUI.DrawTexture(new Rect(((Rect)(ref window)).xMin - 2f, ((Rect)(ref window)).yMin, 4f, ((Rect)(ref window)).height), (Texture)(object)white); } if ((num & 2) != 0) { GUI.DrawTexture(new Rect(((Rect)(ref window)).xMax - 2f, ((Rect)(ref window)).yMin, 4f, ((Rect)(ref window)).height), (Texture)(object)white); } if ((num & 4) != 0) { GUI.DrawTexture(new Rect(((Rect)(ref window)).xMin, ((Rect)(ref window)).yMin - 2f, ((Rect)(ref window)).width, 4f), (Texture)(object)white); } if ((num & 8) != 0) { GUI.DrawTexture(new Rect(((Rect)(ref window)).xMin, ((Rect)(ref window)).yMax - 2f, ((Rect)(ref window)).width, 4f), (Texture)(object)white); } GUI.color = color; } } private string CurrentWord() { if (analysis == null) { return ""; } int num = Mathf.Clamp(analysis.ReplaceStart, 0, input.Length); int length = Mathf.Clamp(analysis.ReplaceLength, 0, input.Length - num); return input.Substring(num, length); } private void Reanalyze() { if (!(analyzedInput == input) || analysis == null) { analyzedInput = input; analysis = Commands.Analyze(input); selected = 0; suggestFirst = 0; suggestHidden = false; } } private void DrawWindow(int id) { //IL_0035: 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_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Invalid comparison between Unknown and I4 //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: 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_0227: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Expected O, but got Unknown //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_0325: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Unknown result type (might be due to invalid IL or missing references) //IL_032f: Unknown result type (might be due to invalid IL or missing references) //IL_033b: Unknown result type (might be due to invalid IL or missing references) //IL_0340: Unknown result type (might be due to invalid IL or missing references) //IL_0353: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Unknown result type (might be due to invalid IL or missing references) //IL_03aa: Unknown result type (might be due to invalid IL or missing references) //IL_03e4: Unknown result type (might be due to invalid IL or missing references) //IL_0434: 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_04dd: Unknown result type (might be due to invalid IL or missing references) //IL_04fd: Unknown result type (might be due to invalid IL or missing references) //IL_04a3: Unknown result type (might be due to invalid IL or missing references) //IL_04aa: Expected O, but got Unknown //IL_0554: Unknown result type (might be due to invalid IL or missing references) //IL_05b3: Unknown result type (might be due to invalid IL or missing references) //IL_05bc: Unknown result type (might be due to invalid IL or missing references) //IL_05c6: Unknown result type (might be due to invalid IL or missing references) //IL_05cb: Unknown result type (might be due to invalid IL or missing references) //IL_0a33: Unknown result type (might be due to invalid IL or missing references) //IL_0a38: Unknown result type (might be due to invalid IL or missing references) //IL_0a29: Unknown result type (might be due to invalid IL or missing references) //IL_0a59: Unknown result type (might be due to invalid IL or missing references) Event current = Event.current; float width = ((Rect)(ref window)).width; float height = ((Rect)(ref window)).height; Reanalyze(); bool flag = GUI.GetNameOfFocusedControl() == "cheatInput"; if ((int)current.type == 0 && Suggesting && ((Rect)(ref suggestBox)).Contains(current.mousePosition)) { for (int i = 0; i < suggestRows.Count; i++) { Rect val = suggestRows[i]; if (((Rect)(ref val)).Contains(current.mousePosition)) { selected = suggestFirst + i; Accept(); break; } } current.Use(); } if (flag && (int)current.type == 4) { TerminalKeys(current); } if (GUI.Button(new Rect(width - 28f, 2f, 24f, 18f), "X")) { SetOpen(on: false); return; } float num = 8f; float num2 = 22f; int num3 = Cheats.LocalPlayerId(); GUI.Label(new Rect(num, num2, width - 2f * num, 20f), $"you: player {num3} god: {OnOff(CheatState.God(num3))} fly: {OnOff(CheatState.Fly(num3))} nocd: {OnOff(CheatState.NoCooldown(num3))} " + (CheatNet.Online ? "<color=#ffd54a>ONLINE (commands run 0.75 s later on everyone)</color>" : "offline"), boxLabel); num2 += 20f; GUI.Label(new Rect(num, num2, width - 2f * num, 20f), "<b>players:</b> " + PlayersLine(), boxLabel); num2 += 22f; float num4 = ((height >= 520f) ? 160f : 0f); float num5 = Mathf.Clamp(height * 0.55f, Mathf.Min(170f, height - num2 - 10f), height - num2 - 10f - num4); Rect val2 = default(Rect); ((Rect)(ref val2))..ctor(num, num2, width - 2f * num, num5); GUI.DrawTexture(val2, (Texture)(object)black); Rect val3 = default(Rect); ((Rect)(ref val3))..ctor(((Rect)(ref val2)).x + 6f, ((Rect)(ref val2)).y + 4f, ((Rect)(ref val2)).width - 8f, Mathf.Max(20f, ((Rect)(ref val2)).height - 64f)); float num6 = ((Rect)(ref val3)).width - 20f; float num7 = 0f; float[] array = new float[log.Count]; for (int j = 0; j < log.Count; j++) { array[j] = Mathf.Ceil(logStyle.CalcHeight(new GUIContent(log[j].Text), num6) * 1.2f) + 1f; num7 += array[j]; } logScroll = GUI.BeginScrollView(val3, logScroll, new Rect(0f, 0f, num6, Mathf.Max(num7, ((Rect)(ref val3)).height - 4f))); float num8 = 0f; Color contentColor = GUI.contentColor; for (int k = 0; k < log.Count; k++) { GUI.contentColor = log[k].Color; GUI.Label(new Rect(0f, num8, num6, array[k]), log[k].Text, logStyle); num8 += array[k]; } GUI.contentColor = contentColor; GUI.EndScrollView(); float num9 = ((Rect)(ref val2)).yMax - 56f; GUI.Label(new Rect(((Rect)(ref val2)).x + 6f, num9 + 3f, 16f, 24f), "<color=#4fc1ff><b>»</b></color>", boxLabel); Rect val4 = default(Rect); ((Rect)(ref val4))..ctor(((Rect)(ref val2)).x + 22f, num9, ((Rect)(ref val2)).width - 96f, 28f); GUI.SetNextControlName("cheatInput"); string text = input; input = GUI.TextField(val4, input ?? "", 300, inputStyle); if (input != text) { historyIndex = -1; Reanalyze(); } if (moveCursorEnd && GUI.GetNameOfFocusedControl() == "cheatInput") { TextEditor val5 = (TextEditor)GUIUtility.GetStateObject(typeof(TextEditor), GUIUtility.keyboardControl); if (val5 != null) { val5.text = input; val5.MoveTextEnd(); } moveCursorEnd = false; } GUI.Label(val4, Colored(), overlayStyle); Squiggle(val4); if (GUI.Button(new Rect(((Rect)(ref val4)).xMax + 6f, num9, 60f, 28f), "Run")) { Run(); } if (focusInput) { GUI.FocusControl("cheatInput"); focusInput = false; } GUI.Label(new Rect(((Rect)(ref val2)).x + 22f, num9 + 31f, ((Rect)(ref val2)).width - 30f, 20f), HintText(), hintStyle); num2 = ((Rect)(ref val2)).yMax + 6f; Rect val6 = default(Rect); ((Rect)(ref val6))..ctor(num, num2, width - 2f * num, Mathf.Max(0f, height - num2 - 6f)); if (((Rect)(ref val6)).height > 20f) { GUILayout.BeginArea(val6); bottomScroll = GUILayout.BeginScrollView(bottomScroll, Array.Empty<GUILayoutOption>()); int cols = Mathf.Clamp((int)((((Rect)(ref val6)).width - 24f) / 140f), 2, 6); Grid(cols, ("God", "god"), ("Fly", "fly"), ("No Cooldowns", "nocd"), ("Spawn Dummy", "spawn dummy"), ("Dummies Fight Me", "bot dummies fight me"), ("Kill Dummies", "kill dummies"), ("Grenade", "spawn grenade"), ("Smoke", "spawn smoke"), ("Mine", "spawn mine"), ("Missile", "spawn missile"), ("Arrow", "spawn arrow"), ("Boom", "spawn explosion"), ("Black Hole", "spawn blackhole"), ("White Hole", "spawn whitehole"), ("Spike", "spawn spike"), ("Tesla", "spawn tesla"), ("Engine", "spawn engine"), ("Boulder", "spawn boulder"), ("Bigger", "size me 2"), ("Smaller", "size me 0.5"), ("Normal Size", "size me 1"), ("All Normal Size", "size all 1"), ("Next Map", "map next"), ("Random Map", "map random")); int num10 = Mathf.Clamp((int)((((Rect)(ref val6)).width - 24f) / 120f), 2, 7); (string, int, string)[] array2 = new(string, int, string)[7] { ("Change Ability", 1, null), ("Dummies", 2, null), ("Spawn Anything", 3, null), ("Maps", 4, null), ("Players", 0, "players"), ("Help", 0, "help"), ("Clear", 0, null) }; for (int l = 0; l < array2.Length; l += num10) { GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); for (int m = l; m < l + num10 && m < array2.Length; m++) { (string, int, string) tuple = array2[m]; string text2; if (tuple.Item2 == 0 || tab != tuple.Item2) { (text2, _, _) = tuple; } else { text2 = "[" + tuple.Item1 + "]"; } if (GUILayout.Button(text2, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(24f) })) { if (tuple.Item2 != 0) { tab = ((tab != tuple.Item2) ? tuple.Item2 : 0); } else if (tuple.Item3 != null) { Submit(tuple.Item3); } else { Clear(); } } } GUILayout.EndHorizontal(); } if (tab != 0) { GUILayout.BeginVertical(GUI.skin.box, Array.Empty<GUILayoutOption>()); if (tab == 1) { AbilityPanel(); } else if (tab == 2) { DummyPanel(); } else if (tab == 3) { SpawnPanel(); } else { MapPanel(); } GUILayout.EndVertical(); } GUILayout.EndScrollView(); GUILayout.EndArea(); } if (Suggesting) { DrawSuggestions(val4); } else { suggestBox = Rect.zero; } if (resizeEdges == 0) { GUI.DragWindow(new Rect(0f, 0f, 10000f, 20f)); } } private static string OnOff(bool b) { if (!b) { return "off"; } return "<color=#7cff7c>ON</color>"; } private void Grid(int cols, params (string label, string cmd)[] buttons) { for (int i = 0; i < buttons.Length; i += cols) { GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); for (int j = i; j < i + cols && j < buttons.Length; j++) { if (GUILayout.Button(buttons[j].label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(24f) })) { Submit(buttons[j].cmd); } } GUILayout.EndHorizontal(); } } private static string PlayersLine() { PlayerHandler val = PlayerHandler.Get(); if (val == null || !Cheats.InMatch()) { return "<color=#909090>(start a match)</color>"; } StringBuilder stringBuilder = new StringBuilder(); int num = Cheats.LocalPlayerId(); foreach (Player item in from p in val.PlayerList() where p != null orderby p.Id select p) { string text = Cheats.ColorName(item); string arg = (Spawner.IsDummy(item.Id) ? "dummy" : ((item.Id == num) ? ("you (" + text + ")") : text)); string arg2 = (item.IsAlive ? "" : " dead"); stringBuilder.Append($"<color=#9cdcfe><b>{item.Id}</b></color> = {arg}{arg2} "); } stringBuilder.Append("<color=#909090>or type: me, all, others, dummies, a color</color>"); return stringBuilder.ToString(); } private void TerminalKeys(Event e) { //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_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Invalid comparison between Unknown and I4 //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Invalid comparison between Unknown and I4 //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) //IL_0041: Expected I4, but got Unknown if (e.character == '\t') { e.Use(); return; } KeyCode keyCode = e.keyCode; if ((int)keyCode != 9) { if ((int)keyCode != 13) { switch (keyCode - 271) { default: return; case 2: if (Suggesting) { selected = (selected - 1 + analysis.Suggestions.Count) % analysis.Suggestions.Count; } else if (history.Count > 0) { historyIndex = ((historyIndex < 0) ? (history.Count - 1) : Mathf.Max(0, historyIndex - 1)); SetInput(history[historyIndex]); suggestHidden = true; } e.Use(); return; case 3: if (Suggesting) { selected = (selected + 1) % analysis.Suggestions.Count; } else if (historyIndex >= 0) { historyIndex++; SetInput((historyIndex < history.Count) ? history[historyIndex] : ""); if (historyIndex >= history.Count) { historyIndex = -1; } suggestHidden = true; } e.Use(); return; case 0: break; case 1: return; } } Run(); e.Use(); } else { if (Suggesting) { Accept(); } e.Use(); } } private void SetInput(string text) { input = text; Reanalyze(); suggestHidden = true; moveCursorEnd = true; } private void Accept() { if (analysis != null && analysis.Suggestions.Count != 0) { Commands.Suggestion suggestion = analysis.Suggestions[Mathf.Clamp(selected, 0, analysis.Suggestions.Count - 1)]; int num = Mathf.Clamp(analysis.ReplaceStart, 0, input.Length); int num2 = Mathf.Clamp(analysis.ReplaceLength, 0, input.Length - num); input = input.Substring(0, num) + suggestion.Text + " " + input.Substring(num + num2).TrimStart(); Reanalyze(); moveCursorEnd = true; GUI.FocusControl("cheatInput"); } } private void Run() { string text = (input ?? "").Trim(); input = ""; Reanalyze(); Submit(text); } private void Submit(string text) { text = (text ?? "").Trim(); if (text.Length != 0) { history.Remove(text); history.Add(text); historyIndex = -1; Echo("> " + text); Cheats.Submit(text); } } private string Colored() { if (string.IsNullOrEmpty(input)) { return "<color=#5a5a5a>type a command... (help)</color>"; } StringBuilder stringBuilder = new StringBuilder(); int num = 0; foreach (Commands.Token token in analysis.Tokens) { if (token.Start > num) { stringBuilder.Append(Escape(input.Substring(num, token.Start - num))); } float result; string value = (token.Bad ? "#ff5a50" : (token.IsCommand ? "#dcdcaa" : (float.TryParse(token.Text, out result) ? "#b5cea8" : "#9cdcfe"))); stringBuilder.Append("<color=").Append(value).Append('>') .Append(Escape(token.Text)) .Append("</color>"); num = token.Start + token.Length; } if (num < input.Length && num <= input.Length) { stringBuilder.Append(Escape(input.Substring(Mathf.Min(num, input.Length)))); } if (Suggesting) { Commands.Suggestion suggestion = analysis.Suggestions[Mathf.Clamp(selected, 0, analysis.Suggestions.Count - 1)]; string text = CurrentWord(); if (analysis.ReplaceStart + analysis.ReplaceLength >= input.Length && suggestion.Text.StartsWith(text, StringComparison.OrdinalIgnoreCase) && suggestion.Text.Length > text.Length) { stringBuilder.Append("<color=#5f5f5f>").Append(Escape(suggestion.Text.Substring(text.Length))).Append("</color>"); } } return stringBuilder.ToString(); } private static string Escape(string s) { return s.Replace("<", "‹").Replace(">", "›"); } private void Squiggle(Rect r) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Invalid comparison between Unknown and I4 //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_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) if (analysis != null && analysis.Error != null && analysis.ErrorStart >= 0 && analysis.ErrorStart < input.Length && (int)Event.current.type == 7) { float num = ((Rect)(ref r)).x + (float)overlayStyle.padding.left + TextWidth(input.Substring(0, analysis.ErrorStart)); float num2 = ((Rect)(ref r)).x + (float)overlayStyle.padding.left + TextWidth(input.Substring(0, Mathf.Min(input.Length, analysis.ErrorStart + analysis.ErrorLength))); float num3 = ((Rect)(ref r)).yMax - 6f; Color color = GUI.color; GUI.color = new Color(1f, 0.25f, 0.2f); for (float num4 = num; num4 < num2; num4 += 2f) { GUI.DrawTexture(new Rect(num4, num3 + (((int)((num4 - num) / 2f) % 2 == 0) ? 0f : 2f), 2f, 2f), (Texture)(object)white); } GUI.color = color; } } private float TextWidth(string s) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown //IL_0023: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrEmpty(s)) { return 0f; } return overlayStyle.CalcSize(new GUIContent(s.Replace(' ', '_'))).x - (float)overlayStyle.padding.horizontal; } private string HintText() { if (analysis == null || string.IsNullOrEmpty(input)) { return "<color=#808080>Tab: complete Up/Down: pick Enter: run try: spawn engine, god, bot dummies fight me, ability 1 rock</color>"; } if (analysis.Error != null) { return "<color=#ff5a50>✖ " + Escape(analysis.Error) + "</color>"; } string text = ((analysis.Usage != null) ? Escape(analysis.Usage) : ""); string text2 = ((analysis.Hint != null) ? (" <color=#c8c8c8>next: " + Escape(analysis.Hint) + "</color>") : ""); if (analysis.Missing == null && analysis.Command != null) { return "<color=#7cff7c>✔ ready</color> <color=#808080>" + text + "</color>"; } return "<color=#808080>" + text + "</color>" + text2; } private void DrawSuggestions(Rect inputRect) { //IL_0130: 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_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_0403: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_0389: Unknown result type (might be due to invalid IL or missing references) //IL_03a6: Unknown result type (might be due to invalid IL or missing references) List<Commands.Suggestion> suggestions = analysis.Suggestions; selected = Mathf.Clamp(selected, 0, suggestions.Count - 1); if (selected < suggestFirst) { suggestFirst = selected; } if (selected >= suggestFirst + 9) { suggestFirst = selected - 9 + 1; } suggestFirst = Mathf.Clamp(suggestFirst, 0, Mathf.Max(0, suggestions.Count - 9)); int num = Mathf.Min(9, suggestions.Count - suggestFirst); float num2 = TextWidth(input.Substring(0, Mathf.Clamp(analysis.ReplaceStart, 0, input.Length))); float num3 = Mathf.Min(560f, ((Rect)(ref window)).width - 30f); float num4 = Mathf.Min(((Rect)(ref inputRect)).x + num2, ((Rect)(ref window)).width - num3 - 10f); float num5 = (float)num * 24f + 4f; float num6 = ((Rect)(ref inputRect)).y - num5 - 2f; suggestBox = new Rect(num4, num6, num3, num5); GUI.DrawTexture(suggestBox, (Texture)(object)Tex2(new Color(0.12f, 0.12f, 0.14f, 0.98f))); Color color = GUI.color; GUI.color = new Color(0.35f, 0.35f, 0.4f); GUI.DrawTexture(new Rect(((Rect)(ref suggestBox)).x, ((Rect)(ref suggestBox)).y, ((Rect)(ref suggestBox)).width, 1f), (Texture)(object)white); GUI.DrawTexture(new Rect(((Rect)(ref suggestBox)).x, ((Rect)(ref suggestBox)).yMax - 1f, ((Rect)(ref suggestBox)).width, 1f), (Texture)(object)white); GUI.color = color; suggestRows.Clear(); string text = CurrentWord(); Rect val = default(Rect); for (int i = 0; i < num; i++) { Commands.Suggestion suggestion = suggestions[suggestFirst + i]; ((Rect)(ref val))..ctor(num4 + 2f, num6 + 2f + (float)i * 24f, num3 - 4f, 24f); suggestRows.Add(val); if (suggestFirst + i == selected) { GUI.DrawTexture(val, (Texture)(object)selectTex); } if ((Object)(object)suggestion.Icon != (Object)null) { DrawSprite(new Rect(((Rect)(ref val)).x + 4f, ((Rect)(ref val)).y + 2f, 20f, 20f), suggestion.Icon); } else { GUI.Label(new Rect(((Rect)(ref val)).x + 4f, ((Rect)(ref val)).y + 1f, 20f, 24f), "<color=#c586c0>■</color>", suggestStyle); } string text2 = suggestion.Text; int num7 = text2.IndexOf(text, StringComparison.OrdinalIgnoreCase); string text3 = ((text.Length > 0 && num7 >= 0) ? (Escape(text2.Substring(0, num7)) + "<color=#4fc1ff><b>" + Escape(text2.Substring(num7, text.Length)) + "</b></color>" + Escape(text2.Substring(num7 + text.Length))) : Escape(text2)); GUI.Label(val, text3, suggestStyle); if (!string.IsNullOrEmpty(suggestion.Detail)) { GUI.Label(val, Escape(suggestion.Detail), suggestDetail); } } if (suggestions.Count > 9) { GUI.Label(new Rect(((Rect)(ref suggestBox)).xMax - 70f, ((Rect)(ref suggestBox)).y - 18f, 70f, 18f), $"<color=#808080>{selected + 1}/{suggestions.Count}</color>", boxLabel); } } private Texture2D Tex2(Color c) { //IL_0006: 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: Unknown result type (might be due to invalid IL or missing references) if (!texCache.TryGetValue(c, out var value) || (Object)(object)value == (Object)null) { value = (texCache[c] = Tex(c)); } return value; } private static void DrawSprite(Rect r, Sprite s) { //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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_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) if (!((Object)(object)s == (Object)null) && !((Object)(object)s.texture == (Object)null)) { Rect val = default(Rect); try { Rect textureRect = s.textureRect; val = new Rect(((Rect)(ref textureRect)).x / (float)((Texture)s.texture).width, ((Rect)(ref textureRect)).y / (float)((Texture)s.texture).height, ((Rect)(ref textureRect)).width / (float)((Texture)s.texture).width, ((Rect)(ref textureRect)).height / (float)((Texture)s.texture).height); } catch { ((Rect)(ref val))..ctor(0f, 0f, 1f, 1f); } GUI.DrawTextureWithTexCoords(r, (Texture)(object)s.texture, val); } } private void AbilityPanel() { //IL_0389: Unknown result type (might be due to invalid IL or missing references) //IL_03a1: Unknown result type (might be due to invalid IL or missing references) //IL_03a6: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Expected O, but got Unknown //IL_0270: 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_0277: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_047f: Unknown result type (might be due to invalid IL or missing references) //IL_048e: Unknown result type (might be due to invalid IL or missing references) //IL_04c2: Expected O, but got Unknown //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_04cf: Unknown result type (might be due to invalid IL or missing references) //IL_056f: Unknown result type (might be due to invalid IL or missing references) //IL_0578: Unknown result type (might be due to invalid IL or missing references) //IL_0537: Unknown result type (might be due to invalid IL or missing references) //IL_0510: Unknown result type (might be due to invalid IL or missing references) PlayerHandler val = PlayerHandler.Get(); List<Player> list = ((val != null && Cheats.InMatch()) ? (from p in val.PlayerList() where p != null orderby p.Id select p).ToList() : new List<Player>()); if (list.Count == 0) { GUILayout.Label("Start a match first.", Array.Empty<GUILayoutOption>()); return; } int num = Cheats.LocalPlayerId(); if (abPlayer < 0 || list.All((Player p) => p.Id != abPlayer)) { abPlayer = num; } GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.Label("<b>1. Player:</b>", boxLabel, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(90f) }); foreach (Player item in list) { string arg = ((item.Id == num) ? "you" : (Spawner.IsDummy(item.Id) ? "dummy" : "player")); string text = $"{item.Id} {arg} ({Cheats.ColorName(item)})"; if (GUILayout.Toggle(abPlayer == item.Id, text, GUI.skin.button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(24f) })) { abPlayer = item.Id; } } GUILayout.EndHorizontal(); Player player = val.GetPlayer(abPlayer); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.Label("<b>2. Slot:</b>", boxLabel, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(90f) }); for (int num2 = 0; num2 < 3; num2++) { GameObject val2 = ((((player != null) ? player.Abilities : null) != null && num2 < player.Abilities.Count) ? player.Abilities[num2] : null); string arg2 = (((Object)(object)val2 != (Object)null) ? Cheats.AbilityName(val2) : "(empty)"); Rect rect = GUILayoutUtility.GetRect(new GUIContent($" {num2 + 1}: {arg2}"), GUI.skin.button, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Height(30f), GUILayout.MinWidth(180f) }); if (GUI.Toggle(rect, abSlot == num2, $" {num2 + 1}: {arg2}", GUI.skin.button)) { abSlot = num2; } Sprite val3 = Cheats.AbilityIcon(val2); if ((Object)(object)val3 != (Object)null) { DrawSprite(new Rect(((Rect)(ref rect)).x + 4f, ((Rect)(ref rect)).y + 3f, 24f, 24f), val3); } } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.Label("<b>3. New ability:</b>", boxLabel, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(110f) }); GUI.SetNextControlName("abSearch"); abSearch = GUILayout.TextField(abSearch ?? "", 40, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(220f) }); GUILayout.Label("<color=#909090>type to search, click to swap</color>", boxLabel, Array.Empty<GUILayoutOption>()); GUILayout.EndHorizontal(); panelScroll = GUILayout.BeginScrollView(panelScroll, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(190f) }); NamedSpriteList val4 = (((Object)(object)SteamManager.instance != (Object)null) ? SteamManager.instance.abilityIcons : null); if ((Object)(object)val4 != (Object)null) { List<NamedSprite> list2 = (from s in val4.sprites where (Object)(object)s.associatedGameObject != (Object)null && Cheats.IsRealAbility(s.name) && (string.IsNullOrEmpty(abSearch) || s.name.IndexOf(abSearch, StringComparison.OrdinalIgnoreCase) >= 0) group s by s.name into g select g.First()).ToList(); int num3 = Mathf.Max(1, (int)((((Rect)(ref window)).width - 60f) / 170f)); for (int num4 = 0; num4 < list2.Count; num4 += num3) { GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); for (int num5 = num4; num5 < num4 + num3 && num5 < list2.Count; num5++) { Rect rect2 = GUILayoutUtility.GetRect(new GUIContent(" " + list2[num5].name), GUI.skin.button, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(164f), GUILayout.Height(32f) }); if (GUI.Button(rect2, " " + list2[num5].name)) { Submit((abPlayer == num) ? $"ability {abSlot + 1} {list2[num5].name}" : $"give {abPlayer} {abSlot + 1} {list2[num5].name}"); } DrawSprite(new Rect(((Rect)(ref rect2)).x + 4f, ((Rect)(ref rect2)).y + 4f, 24f, 24f), list2[num5].sprite); } GUILayout.EndHorizontal(); } } GUILayout.EndScrollView(); } private void DummyPanel() { //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Expected O, but got Unknown //IL_02ee: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_02f5: Unknown result type (might be due to invalid IL or missing references) //IL_0366: Unknown result type (might be due to invalid IL or missing references) PlayerHandler val = PlayerHandler.Get(); List<Player> list = ((val != null && Cheats.InMatch()) ? (from p in val.PlayerList() where p != null && Spawner.IsDummy(p.Id) orderby p.Id select p).ToList() : new List<Player>()); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); if (GUILayout.Button("Spawn Dummy", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) })) { Submit("spawn dummy"); } if (GUILayout.Button("All Fight Me", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) })) { Submit("bot dummies fight me"); } if (GUILayout.Button("All Follow Me", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) })) { Submit("bot dummies follow me"); } if (GUILayout.Button("All Stop", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) })) { Submit("bot dummies stop"); } if (GUILayout.Button("Bring Dummies", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) })) { Submit("bring dummies"); } if (GUILayout.Button("Kill Dummies", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) })) { Submit("kill dummies"); } GUILayout.EndHorizontal(); if (list.Count == 0) { GUILayout.Label("No dummies yet. Spawn one, then make it fight, jump, walk or use any ability. Terminal: bot <dummy> <action>", Array.Empty<GUILayoutOption>()); return; } panelScroll = GUILayout.BeginScrollView(panelScroll, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(190f) }); foreach (Player item in list) { int id = item.Id; Bots.Bot bot = Bots.Get(id); string text = ((bot == null) ? "idle" : ((bot.Mode != Bots.Mode.Idle) ? bot.Mode.ToString().ToLower() : ((bot.Spam >= 0) ? ("spamming " + (bot.Spam + 1)) : "idle"))); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.Label(string.Format("<b>Dummy {0}</b> ({1})", id, item.IsAlive ? text : "dead"), boxLabel, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(150f) }); for (int num = 0; num < 3; num++) { GameObject prefab = ((item.Abilities != null && num < item.Abilities.Count) ? item.Abilities[num] : null); Rect rect = GUILayoutUtility.GetRect(new GUIContent(" Use " + Cheats.AbilityName(prefab)), GUI.skin.button, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Height(28f), GUILayout.MinWidth(120f) }); if (GUI.Button(rect, " Use " + Cheats.AbilityName(prefab))) { Submit($"bot {id} use {num + 1}"); } Sprite val2 = Cheats.AbilityIcon(prefab); if ((Object)(object)val2 != (Object)null) { DrawSprite(new Rect(((Rect)(ref rect)).x + 4f, ((Rect)(ref rect)).y + 3f, 22f, 22f), val2); } } if (GUILayout.Button("Change", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { abPlayer = id; tab = 1; } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.Space(150f); if (GUILayout.Button("Fight Me", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(24f) })) { Submit($"bot {id} fight me"); } if (GUILayout.Button("Follow Me", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(24f) })) { Submit($"bot {id} follow me"); } if (GUILayout.Button("Jump", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(24f) })) { Submit($"bot {id} jump"); } if (GUILayout.Button("< Walk", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(24f) })) { Submit($"bot {id} walk left"); } if (GUILayout.Button("Walk >", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(24f) })) { Submit($"bot {id} walk right"); } if (GUILayout.Button("Aim Me", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(24f) })) { Submit($"bot {id} aim me"); } if (GUILayout.Button("Spam 1", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(24f) })) { Submit($"bot {id} spam 1"); } if (GUILayout.Button("Stop", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(24f) })) { Submit($"bot {id} stop"); } if (GUILayout.Button("Bring", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(24f) })) { Submit($"bring {id}"); } if (GUILayout.Button("Kill", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(24f) })) { Submit($"kill {id}"); } GUILayout.EndHorizontal(); GUILayout.Space(6f); } GUILayout.EndScrollView(); } private void SpawnPanel() { //IL_0002: 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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Expected O, but got Unknown panelScroll = GUILayout.BeginScrollView(panelScroll, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(190f) }); List<string> list = Spawner.Names(); int num = Mathf.Max(1, (int)((((Rect)(ref window)).width - 60f) / 160f)); for (int i = 0; i < list.Count; i += num) { GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); for (int j = i; j < i + num && j < list.Count; j++) { if (GUILayout.Button(new GUIContent(list[j], Spawner.Describe(list[j])), (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(154f), GUILayout.Height(26f) })) { Submit("spawn " + list[j]); } } GUILayout.EndHorizontal(); } GUILayout.EndScrollView(); } private void MapPanel() { //IL_0091: 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_00ae: Unknown result type (might be due to invalid IL or missing references) GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); if (GUILayout.Button("Next Map", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) })) { Submit("map next"); } if (GUILayout.Button("Random Map", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) })) { Submit("map random"); } GUILayout.Label(Cheats.InMatch() ? $"now: map {GameSession.CurrentLevel()} (* = space map)" : "(* = space map)", Array.Empty<GUILayoutOption>()); GUILayout.EndHorizontal(); panelScroll = GUILayout.BeginScrollView(panelScroll, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(190f) }); int num = Cheats.MapCount(); int num2 = Mathf.Max(1, (int)((((Rect)(ref window)).width - 60f) / 70f)); for (int i = 0; i < num; i += num2) { GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); for (int j = i; j < i + num2 && j < num; j++) { if (GUILayout.Button(j + (Cheats.IsSpaceMap(j) ? "*" : ""), (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(64f), GUILayout.Height(24f) })) { Submit("map " + j); } } GUILayout.EndHorizontal(); } GUILayout.EndScrollView(); } static CheatMenu() { //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_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_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_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) Key[] array = new Key[10]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); Konami = (Key[])(object)array; } } [HarmonyPatch(typeof(InputUpdater), "Update")] internal static class Patch_InputUpdater_MenuMouse { private static readonly FieldRef<InputUpdater, InputProfile> profileRef = AccessTools.FieldRefAccess<InputUpdater, InputProfile>("inputProfile"); private static void Prefix(InputUpdater __instance) { if (CheatMenu.SwallowMouse) { InputProfile val = profileRef.Invoke(__instance); if (val != null) { val.firstAbilityButton_IS_DOWN = false; val.secondAbilityButton_IS_DOWN = false; val.thirdAbilityButton_IS_DOWN = false; } } } } internal static class CheatNet { internal sealed class Pending { public long Tick; public int Epoch; public int Sender; public int Seq; public string Text; } public const int OnlineDelay = 45; private static readonly byte[] Magic = new byte[4] { 75, 67, 77, 1 }; private static readonly byte[] HelloMagic = new byte[4] { 75, 67, 77, 2 }; private const int HelloSize = 40; private static readonly HashSet<ulong> modded = new HashSet<ulong>(); private static readonly List<Pending> queue = new List<Pending>(); private static readonly List<Pending> due = new List<Pending>(); private static int seq; private static int epoch; private static byte[] buffer = new byte[4096]; public static bool Online => GameLobby.isOnlineGame; public static int Waiting => queue.Count; public static void Submit(string text, int sender) { long tick = Updater.SimulationTicks + ((!Online) ? 1 : 45); Pending pending = new Pending { Tick = tick, Epoch = epoch, Sender = sender, Seq = ((sender << 20) | (seq++ & 0xFFFFF)), Text = text }; queue.Add(pending); if (Online) { Broadcast(pending); } } private static void Broadcast(Pending p) { byte[] array = Encoding.UTF8.GetBytes(p.Text); if (array.Length > 1500) { Array.Resize(ref array, 1500); } byte[] array2 = new byte[Magic.Length + 8 + 4 + 4 + 4 + 2 + array.Length]; int num = 0; Array.Copy(Magic, 0, array2, num, Magic.Length); num += Magic.Length; BitConverter.GetBytes(p.Tick).CopyTo(array2, num); num += 8; BitConverter.GetBytes(p.Epoch).CopyTo(array2, num); num += 4; BitConverter.GetBytes(p.Sender).CopyTo(array2, num); num += 4; BitConverter.GetBytes(p.Seq).CopyTo(array2, num); num += 4; BitConverter.GetBytes((ushort)array.Length).CopyTo(array2, num); num += 2; Array.Copy(array, 0, array2, num, array.Length); SendAll(Padded(array2)); } private static byte[] Padded(byte[] b) { int i; for (i = b.Length; i == 67 || i == 83 || i == 105; i++) { } if (i != b.Length) { Array.Resize(ref b, i); } return b; } private static void SendAll(byte[] b) { List<SteamConnection> list = (((Object)(object)SteamManager.instance != (Object)null) ? SteamManager.instance.connectedPlayers : null); if (list == null) { return; } foreach (SteamConnection item in list) { Send(item, b); } } private static void Send(SteamConnection c, byte[] b) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) try { if (c != null && ((ConnectionManager)c).Connected) { ((Connection)(ref ((ConnectionManager)c).Connection)).SendMessage(b, (SendType)8); } } catch (Exception ex) { Plugin.Log.LogWarning((object)("Hile paketi gonderilemedi: " + ex.Message)); } } public static void Hello(SteamConnection to = null, bool reply = false) { if (Online) { byte[] array = new byte[40]; Array.Copy(HelloMagic, array, HelloMagic.Length); array[HelloMagic.Length] = (reply ? ((byte)1) : ((byte)0)); if (to != null) { Send(to, array); } else { SendAll(array); } } } public static List<string> Missing() { List<string> list = new List<string>(); List<SteamConnection> list2 = (((Object)(object)SteamManager.instance != (Object)null) ? SteamManager.instance.connectedPlayers : null); if (!Online || list2 == null) { return list; } foreach (SteamConnection item in list2) { if (item != null && !modded.Contains(item.id.Value)) { list.Add(string.IsNullOrEmpty(item.steamName) ? item.id.Value.ToString() : item.steamName); } } return list; } internal static bool Receive(ulong from, IntPtr data, int size) { if (size < Magic.Length + 22 || size > buffer.Length) { return false; } Marshal.Copy(data, buffer, 0, size); for (int i = 0; i < Magic.Length - 1; i++) { if (buffer[i] != Magic[i]) { return false; } } if (buffer[3] == HelloMagic[3]) { bool num = modded.Add(from); if (buffer[HelloMagic.Length] == 0) { Hello(SteamManager.instance?.connectedPlayers.Find((SteamConnection c) => c != null && c.id.Value == from), reply: true); } if (num) { Plugin.Log.LogInfo((object)("Cheat Mode: " + from + " de mod var")); } return true; } if (buffer[3] != Magic[3]) { return false; } modded.Add(from); int num2 = Magic.Length; Pending pending = new Pending(); pending.Tick = BitConverter.ToInt64(buffer, num2); num2 += 8; pending.Epoch = BitConverter.ToInt32(buffer, num2); num2 += 4; pending.Sender = BitConverter.ToInt32(buffer, num2); num2 += 4; pending.Seq = BitConverter.ToInt32(buffer, num2); num2 += 4; int num3 = BitConverter.ToUInt16(buffer, num2); num2 += 2; if (num2 + num3 > size) { return true; } pending.Text = Encoding.UTF8.GetString(buffer, num2, num3); queue.Add(pending); CheatMenu.Print("[" + PlayerName(pending.Sender) + "] " + pending.Text); return true; } private static string PlayerName(int id) { return "player " + id; } internal static bool RunDue() { if (queue.Count == 0) { return true; } long num = Updater.SimulationTicks; due.Clear(); for (int num2 = queue.Count - 1; num2 >= 0; num2--) { Pending pending = queue[num2]; if (pending.Epoch < epoch) { queue.RemoveAt(num2); } else if (pending.Epoch <= epoch && pending.Tick <= num) { if (pending.Tick < num && Online) { Plugin.Log.LogWarning((object)$"Hile komutu gec geldi ({num - pending.Tick} adim): {pending.Text}"); } due.Add(pending); queue.RemoveAt(num2); } } if (due.Count == 0) { return true; } due.Sort((Pending a, Pending b) => (a.Tick == b.Tick) ? a.Seq.CompareTo(b.Seq) : a.Tick.CompareTo(b.Tick)); foreach (Pending item in due) { try { if (Cheats.Execute(item.Text, item.Sender)) { return false; } } catch (Exception ex) { CheatMenu.Error("error: " + ex.Message); Plugin.Log.LogError((object)ex); } } return true; } internal static void NewLevel() { epoch++; queue.RemoveAll((Pending p) => p.Epoch < epoch); } } [HarmonyPatch(typeof(Updater), "TickSimulation")] internal static class Patch_Updater_TickSimulation_Cheats { private static bool Prefix() { if (!CheatNet.RunDue()) { return false; } CheatState.Tick(); Spawner.Tick(); Bots.Tick(); return true; } } [HarmonyPatch(typeof(Updater), "PreLevelLoad")] internal static class Patch_Updater_PreLevelLoad_Cheats { private static void Postfix() { CheatNet.NewLevel(); CheatState.NewLevel(); CheatNet.Hello(); } } [HarmonyPatch(typeof(SteamSocket), "OnMessage")] internal static class Patch_SteamSocket_Cheats { private static bool Prefix(NetIdentity identity, IntPtr data, int size) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) try { return !CheatNet.Receive(((NetIdentity)(ref identity)).SteamId.Value, data, size); } catch (Exception ex) { Plugin.Log.LogWarning((object)("Hile paketi okunamadi: " + ex.Message)); return true; } } } internal static class Cheats { private static readonly int ShadowId = Shader.PropertyToID("_ShadowColor"); public static void Submit(string text) { text = Commands.Expand((text ?? "").Trim()); Commands.Analysis analysis = Commands.Analyze(text); if (analysis.Tokens.Count == 0) { return; } if (analysis.Error != null || analysis.Missing != null) { int count = ((analysis.Error != null) ? analysis.ErrorStart : text.Length); int num = ((analysis.Error == null) ? 1 : analysis.ErrorLength); CheatMenu.Error(" " + new string(' ', count) + new string('^', Mathf.Max(1, num))); CheatMenu.Error(" " + (analysis.Error ?? analysis.Missing) + ((analysis.Command != null) ? (" usage: " + analysis.Command.Usage) : "")); return; } Commands.Command command = analysis.Command; if (command.Local) { RunLocal(command.Name, Split(text)); return; } if (!InMatch()) { CheatMenu.Error("start a match first"); return; } List<string> list = CheatNet.Missing(); if (list.Count > 0) { CheatNet.Hello(); CheatMenu.Error("not sent: everyone needs Cheat Mode installed. Missing: " + string.Join(", ", list) + " (if they have it, try again in a second)"); return; } CheatNet.Submit(text, LocalPlayerId()); if (CheatNet.Online) { CheatMenu.Info("(sent to everyone)"); } } private static void Result(string r) { if (!string.IsNullOrEmpty(r)) { if (r.StartsWith("!")) { CheatMenu.Error(r.Substring(1)); } else { CheatMenu.Ok(r); } } } private static string[] Split(string text) { return (text ?? "").Split(new char[2] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries); } public static bool InMatch() { if (!GameSession.inMenus && PlayerHandler.Get() != null && PlayerHandler.Get().PlayerList() != null) { return PlayerHandler.Get().PlayerList().Count > 0; } return false; } public static int LocalPlayerId() { PlayerHandler val = PlayerHandler.Get(); if (val == null || val.PlayerList() == null) { return 1; } foreach (Player item in val.PlayerList()) { if (item != null && item.IsLocalPlayer && !Spawner.IsDummy(item.Id)) { return item.Id; } } return 1; } private static void RunLocal(string cmd, string[] words) { if (cmd == null) { return; } switch (cmd.Length) { case 4: switch (cmd[0]) { case 'h': if (!(cmd ==