using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq.Expressions; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using UnityEngine; 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("SlipStream")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("SlipStream")] [assembly: AssemblyFileVersion("1.0.15.0")] [assembly: AssemblyInformationalVersion("1.0.15+93e4786fd6da7213e58c36dcb338f01050b95c14")] [assembly: AssemblyProduct("SlipStream")] [assembly: AssemblyTitle("SlipStream")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.15.0")] [module: UnverifiableCode] [module: UnverifiableCode] namespace Slipstream; internal static class CoOp { private static bool _registered; private static object _console; private static MethodInfo _submit; private static readonly List _pending = new List(); public static void Register() { if (_registered) { if (_pending.Count > 0) { FlushPending(); } return; } Type type = Hook.Type("RoR2.Console"); if (type == null) { return; } _console = Hook.Get(Hook.Member(type, "instance", "_instance"), null); if (_console == null) { return; } _submit = Hook.Method(type, "SubmitCmd"); Type type2 = Hook.Type("RoR2.ConVarFlags") ?? type.GetNestedType("ConVarFlags", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); object flags = 1; if (type2 != null && type2.IsEnum) { try { flags = Enum.Parse(type2, "ExecuteOnServer"); } catch { flags = Enum.ToObject(type2, 1); } } bool num = AddCommand(type, "slipstream_t", flags, new Action(OnToggle)) & AddCommand(type, "slipstream_item", flags, new Action(OnItem)) & AddCommand(type, "slipstream_giveall", flags, new Action(OnGiveAll)) & AddCommand(type, "slipstream_clear", flags, new Action(OnClear)) & AddCommand(type, "slipstream_equip", flags, new Action(OnEquip)) & AddCommand(type, "slipstream_money", flags, new Action(OnMoney)) & AddCommand(type, "slipstream_void", flags, new Action(OnVoid)) & AddCommand(type, "slipstream_lunar", flags, new Action(OnLunar)) & AddCommand(type, "slipstream_revive", flags, new Action(OnRevive)) & AddCommand(type, "slipstream_spawnas", flags, new Action(OnSpawnAs)) & AddCommand(type, "slipstream_team", flags, new Action(OnTeam)) & AddCommand(type, "slipstream_skin", flags, new Action(OnSkin)); AddCommand(type, "slipstream_buff", flags, new Action(OnBuff)); _registered = num; if (num) { Log.Info("Co-op host commands ready."); FlushPending(); ReplayLocalToggles(); } else { Log.Warn("Could not register co-op host commands. Clients cannot gift items or god themselves until the host has SlipStream and this registers."); } } public static void Submit(string command) { if (!string.IsNullOrEmpty(command)) { Register(); if (_submit == null || _console == null || !_registered) { _pending.Add(command); } else { Send(command); } } } public static bool AskHost(string command) { if (Game.IsServer) { return false; } Submit(command); return true; } private static void Send(string command) { object obj = Game.LocalActor()?.NetworkUser ?? Game.FirstLocalNetworkUser(); if (obj == null) { _pending.Add(command); return; } try { ParameterInfo[] parameters = _submit.GetParameters(); if (parameters.Length == 2) { _submit.Invoke(_console, new object[2] { obj, command }); } else if (parameters.Length >= 3) { _submit.Invoke(_console, new object[3] { obj, command, false }); } else { MethodInfo submit = _submit; object console = _console; object[] parameters2 = new string[1] { command }; submit.Invoke(console, parameters2); } } catch (Exception ex) { Log.Warn("Host command failed: " + ex.Message); _pending.Add(command); } } private static void FlushPending() { if (_pending.Count != 0) { string[] array = _pending.ToArray(); _pending.Clear(); string[] array2 = array; for (int i = 0; i < array2.Length; i++) { Send(array2[i]); } } } private static void ReplayLocalToggles() { if (!Game.IsServer && Session.LocalMods.Any) { Actor actor = Game.LocalActor(); if (actor != null) { Game.PushLocalToggles(actor); } } } private static bool AddCommand(Type consoleType, string name, object flags, Delegate raw) { IDictionary dictionary = Hook.Field(consoleType, "concommandCatalog", "_concommandCatalog")?.GetValue(_console) as IDictionary; Type type = ((dictionary != null) ? Nested(consoleType, "ConCommand") : null); Type type2 = Nested(consoleType, "ConCommandDelegate"); if (dictionary == null || type == null || type2 == null) { return TryRegisterMethod(consoleType, name, flags, raw); } try { Delegate obj = BindHandler(type2, raw.Method); if ((object)obj == null) { return TryRegisterMethod(consoleType, name, flags, raw); } object obj2; try { obj2 = Activator.CreateInstance(type); } catch { obj2 = Activator.CreateInstance(type, nonPublic: true); } FieldInfo fieldInfo = Hook.Field(type, "flags"); FieldInfo fieldInfo2 = Hook.Field(type, "action", "fn", "callback"); FieldInfo fieldInfo3 = Hook.Field(type, "helpText", "help"); if (fieldInfo != null) { fieldInfo.SetValue(obj2, Hook.Coerce(flags, fieldInfo.FieldType)); } if (fieldInfo2 != null) { fieldInfo2.SetValue(obj2, obj); } if (fieldInfo3 != null && fieldInfo3.FieldType == typeof(string)) { fieldInfo3.SetValue(obj2, ""); } dictionary[name] = obj2; return true; } catch (Exception ex) { Log.Warn("Could not add " + name + ": " + ex.Message); return TryRegisterMethod(consoleType, name, flags, raw); } } private static bool TryRegisterMethod(Type consoleType, string name, object flags, Delegate raw) { MethodInfo[] methods = consoleType.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { if (methodInfo.Name.IndexOf("RegisterConCommand", StringComparison.OrdinalIgnoreCase) < 0) { continue; } ParameterInfo[] parameters = methodInfo.GetParameters(); try { if (parameters.Length == 4) { Delegate obj = BindHandler(parameters[3].ParameterType, raw.Method); if ((object)obj != null) { methodInfo.Invoke(_console, new object[4] { name, flags, "", obj }); return true; } } } catch { } } return false; } private static Delegate BindHandler(Type delType, MethodInfo handler) { if (delType == null || handler == null) { return null; } ParameterInfo[] array = delType.GetMethod("Invoke")?.GetParameters(); if (array == null || array.Length != 1) { return null; } try { ParameterExpression parameterExpression = Expression.Parameter(array[0].ParameterType, "args"); MethodCallExpression body = Expression.Call(handler, Expression.Convert(parameterExpression, typeof(object))); return Expression.Lambda(delType, body, parameterExpression).Compile(); } catch { return null; } } private static Type Nested(Type type, string name) { Type type2 = type; while (type2 != null) { Type nestedType = type2.GetNestedType(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (nestedType != null) { return nestedType; } type2 = type2.BaseType; } return Hook.Type(type.FullName + "+" + name); } private static Actor Sender(object args) { if (args == null) { return null; } object obj = Hook.Get(Hook.Member(args.GetType(), "sender"), args); if (obj == null) { return null; } foreach (Actor item in Game.Players()) { if (item.NetworkUser != null && item.NetworkUser == obj) { return item; } } uint num = Game.NetIdOf(obj); Actor actor = ((num != 0) ? Game.FindByNetId(num) : null); if (actor != null) { return actor; } uint num2 = Game.NetIdOf(Hook.Get(Hook.Member(obj.GetType(), "masterObject", "master"), obj)); if (num2 == 0) { return null; } return Game.FindByNetId(num2); } private static string[] Tokens(object args) { if (args == null) { return Array.Empty(); } Type type = args.GetType(); if (Hook.Get(Hook.Member(type, "userArgs", "args", "userTokenList"), args) is IList { Count: >0 } list) { string[] array = new string[list.Count]; for (int i = 0; i < list.Count; i++) { array[i] = list[i]?.ToString() ?? ""; } return array; } MethodInfo methodInfo = Hook.Method(type, "GetArgString") ?? Hook.Method(type, "GetArg"); MemberInfo memberInfo = Hook.Member(type, "Count", "count"); object obj = ((memberInfo != null) ? Hook.Get(memberInfo, args) : null); if (methodInfo != null && obj != null) { int num = Convert.ToInt32(obj); if (num > 0) { string[] array2 = new string[num]; for (int j = 0; j < num; j++) { try { array2[j] = methodInfo.Invoke(args, new object[1] { j })?.ToString() ?? ""; } catch { array2[j] = ""; } } return array2; } } MethodInfo method = type.GetMethod("get_Item", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[1] { typeof(int) }, null); if (method != null && obj != null) { int num2 = Convert.ToInt32(obj); string[] array3 = new string[num2]; for (int k = 0; k < num2; k++) { try { array3[k] = method.Invoke(args, new object[1] { k })?.ToString() ?? ""; } catch { array3[k] = ""; } } return array3; } return Array.Empty(); } private static uint UIntAt(string[] tokens, int i) { if (tokens == null || i < 0 || i >= tokens.Length) { return 0u; } uint.TryParse(tokens[i], out var result); return result; } private static int IntAt(string[] tokens, int i) { if (tokens == null || i < 0 || i >= tokens.Length) { return 0; } int.TryParse(tokens[i], out var result); return result; } private static void OnToggle(object args) { if (!Game.IsServer) { return; } string[] array = Tokens(args); if (array.Length < 2) { return; } uint num = UIntAt(array, 0); int num2 = IntAt(array, 1); if (num == 0) { return; } Actor actor = Game.FindByNetId(num); if (actor == null || actor.IsLocal) { return; } ActorMods actorMods = Session.RemoteModsFor(num); if (actorMods != null) { actorMods.God = (num2 & 1) != 0; actorMods.InfiniteSprint = (num2 & 2) != 0; actorMods.InfiniteSkills = (num2 & 4) != 0; actorMods.Noclip = (num2 & 8) != 0; Game.SetGod(actor, actorMods.God); if (!actorMods.Noclip) { Ticker.RestoreNoclip(actor); } } } private static void OnItem(object args) { if (Game.IsServer) { string[] tokens = Tokens(args); Actor actor = Game.FindByNetId(UIntAt(tokens, 0)); if (actor != null) { Game.GiveItemLocal(actor, IntAt(tokens, 1), IntAt(tokens, 2)); } } } private static void OnGiveAll(object args) { if (Game.IsServer) { string[] tokens = Tokens(args); Actor actor = Game.FindByNetId(UIntAt(tokens, 0)); if (actor != null) { Game.GiveAllItemsLocal(actor, IntAt(tokens, 1)); } } } private static void OnClear(object args) { if (Game.IsServer) { Actor actor = Game.FindByNetId(UIntAt(Tokens(args), 0)); if (actor != null) { Game.ClearInventoryLocal(actor); } } } private static void OnEquip(object args) { if (Game.IsServer) { string[] tokens = Tokens(args); Actor actor = Game.FindByNetId(UIntAt(tokens, 0)); if (actor != null) { Game.SetEquipmentLocal(actor, IntAt(tokens, 1)); } } } private static void OnMoney(object args) { if (Game.IsServer) { string[] tokens = Tokens(args); Actor actor = Game.FindByNetId(UIntAt(tokens, 0)); if (actor != null) { Game.SetMoney(actor, UIntAt(tokens, 1)); } } } private static void OnVoid(object args) { if (Game.IsServer) { string[] tokens = Tokens(args); Actor actor = Game.FindByNetId(UIntAt(tokens, 0)); if (actor != null) { Game.SetVoidCoins(actor, UIntAt(tokens, 1)); } } } private static void OnLunar(object args) { if (Game.IsServer) { string[] tokens = Tokens(args); Actor actor = Game.FindByNetId(UIntAt(tokens, 0)); if (actor != null) { Game.AwardLunar(actor, UIntAt(tokens, 1)); } } } private static void OnRevive(object args) { if (Game.IsServer) { Actor actor = Game.FindByNetId(UIntAt(Tokens(args), 0)); if (actor != null) { Game.Revive(actor); } } } private static void OnSpawnAs(object args) { if (Game.IsServer) { string[] array = Tokens(args); Actor actor = Game.FindByNetId(UIntAt(array, 0)); string bodyName = ((array != null && array.Length > 1) ? array[1] : null); if (actor != null) { Game.SpawnAsNamed(actor, bodyName); } } } private static void OnTeam(object args) { if (Game.IsServer) { string[] tokens = Tokens(args); Actor actor = Game.FindByNetId(UIntAt(tokens, 0)); if (actor != null) { Game.ApplyTeamLocal(actor, IntAt(tokens, 1)); } } } private static void OnBuff(object args) { if (Game.IsServer) { string[] tokens = Tokens(args); Actor actor = Game.FindByNetId(UIntAt(tokens, 0)); if (actor != null) { Game.SetBuffLocal(actor, IntAt(tokens, 1), IntAt(tokens, 2)); } } } private static void OnSkin(object args) { if (Game.IsServer) { string[] tokens = Tokens(args); Actor actor = Game.FindByNetId(UIntAt(tokens, 0)); if (actor != null) { Game.ApplySkin(actor, IntAt(tokens, 1)); } } } } internal static class Esp { private struct Mark { public Vector3 World; public string Label; public Color Color; } private static readonly List Marks = new List(128); private static float _nextRefresh; private static GUIStyle _style; public static void Draw() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Expected O, but got Unknown //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: 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_00df: 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_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Expected O, but got Unknown //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_0124: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) if (!Session.EspAny || (Object)(object)Camera.main == (Object)null) { return; } if (Time.unscaledTime >= _nextRefresh) { Rebuild(); _nextRefresh = Time.unscaledTime + 0.35f; } if (_style == null) { _style = new GUIStyle(GUI.skin.label) { fontSize = 12, fontStyle = (FontStyle)1, alignment = (TextAnchor)4, richText = false }; _style.normal.textColor = Color.white; } Camera main = Camera.main; int height = Screen.height; int num = ((Marks.Count < 96) ? Marks.Count : 96); for (int i = 0; i < num; i++) { Mark mark = Marks[i]; Vector3 val = main.WorldToScreenPoint(mark.World); if (!(val.z <= 0f)) { float x = val.x; float num2 = (float)height - val.y; _style.normal.textColor = mark.Color; string label = mark.Label; Vector2 val2 = _style.CalcSize(new GUIContent(label)); GUI.Label(new Rect(x - val2.x * 0.5f, num2 - 8f, val2.x + 4f, val2.y), label, _style); } } } private static void Rebuild() { //IL_0031: 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_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0189: 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_01b7: 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_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0256: 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_027f: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_0315: Unknown result type (might be due to invalid IL or missing references) //IL_0339: Unknown result type (might be due to invalid IL or missing references) //IL_033e: Unknown result type (might be due to invalid IL or missing references) //IL_0367: Unknown result type (might be due to invalid IL or missing references) //IL_036c: Unknown result type (might be due to invalid IL or missing references) //IL_0395: Unknown result type (might be due to invalid IL or missing references) //IL_039a: Unknown result type (might be due to invalid IL or missing references) //IL_03c3: Unknown result type (might be due to invalid IL or missing references) //IL_03c8: Unknown result type (might be due to invalid IL or missing references) //IL_03f1: Unknown result type (might be due to invalid IL or missing references) //IL_03f6: Unknown result type (might be due to invalid IL or missing references) //IL_041f: Unknown result type (might be due to invalid IL or missing references) //IL_0424: Unknown result type (might be due to invalid IL or missing references) //IL_0467: Unknown result type (might be due to invalid IL or missing references) //IL_046c: Unknown result type (might be due to invalid IL or missing references) //IL_0476: Unknown result type (might be due to invalid IL or missing references) //IL_047b: Unknown result type (might be due to invalid IL or missing references) //IL_0495: Unknown result type (might be due to invalid IL or missing references) //IL_049a: Unknown result type (might be due to invalid IL or missing references) Marks.Clear(); Actor actor = Game.LocalActor(); Vector3 origin = (((Object)(object)actor?.Transform != (Object)null) ? actor.Transform.position : Vector3.zero); if (Session.EspTeleporter) { AddTracked("RoR2.TeleporterInteraction", "TP", new Color(1f, 0.55f, 0.2f), origin, 280f); } if (Session.EspChests) { AddTracked("RoR2.ChestBehavior", "Chest", new Color(0.95f, 0.85f, 0.35f), origin, 280f); AddNamed("chest", "Chest", new Color(0.95f, 0.85f, 0.35f), origin, 280f); } if (Session.EspShops) { AddTracked("RoR2.ShopTerminalBehavior", "Shop", new Color(0.55f, 0.75f, 1f), origin, 280f); } if (Session.EspBarrels) { AddTracked("RoR2.BarrelInteraction", "Barrel", new Color(0.7f, 0.55f, 0.3f), origin, 280f); } if (Session.EspScrappers) { AddTracked("RoR2.ScrapperController", "Scrapper", new Color(0.4f, 0.9f, 0.55f), origin, 280f); } if (Session.EspSecrets) { AddTracked("RoR2.PressurePlateController", "Plate", new Color(0.85f, 0.4f, 0.9f), origin, 280f); AddNamed("pressureplate", "Secret", new Color(0.85f, 0.4f, 0.9f), origin, 280f); } if (Session.EspPrinters) { AddTracked("RoR2.PurchaseInteraction", "Printer", new Color(0.4f, 0.85f, 1f), origin, 280f, "duplicator", "printer"); AddNamed("duplicator", "Printer", new Color(0.4f, 0.85f, 1f), origin, 280f); } if (Session.EspNewt) { AddNamed("newt", "Newt", new Color(0.45f, 0.55f, 1f), origin, 280f); AddNamed("bazaar", "Newt", new Color(0.45f, 0.55f, 1f), origin, 280f); } if (Session.EspDrones) { AddTracked("RoR2.SummonMasterBehavior", "Drone", new Color(0.7f, 0.7f, 0.75f), origin, 280f); AddNamed("drone", "Drone", new Color(0.7f, 0.7f, 0.75f), origin, 280f); } if (Session.EspShrines) { AddNamed("shrine", "Shrine", new Color(0.95f, 0.45f, 0.45f), origin, 280f); AddTracked("RoR2.ShrineChanceBehavior", "Shrine", new Color(0.95f, 0.45f, 0.45f), origin, 280f); AddTracked("RoR2.ShrineBossBehavior", "Mountain", new Color(0.95f, 0.45f, 0.45f), origin, 280f); AddTracked("RoR2.ShrineBloodBehavior", "Blood", new Color(0.95f, 0.45f, 0.45f), origin, 280f); AddTracked("RoR2.ShrineCombatBehavior", "Combat", new Color(0.95f, 0.45f, 0.45f), origin, 280f); AddTracked("RoR2.ShrineRestackBehavior", "Order", new Color(0.95f, 0.45f, 0.45f), origin, 280f); AddTracked("RoR2.ShrineHealingBehavior", "Woods", new Color(0.95f, 0.45f, 0.45f), origin, 280f); } if (!Session.EspPlayers) { return; } foreach (Actor item in Game.Players()) { if (!((Object)(object)item.Transform == (Object)null)) { Add(item.Transform.position + Vector3.up * 2f, item.Name, new Color(0.45f, 1f, 0.55f), origin, 400f); } } } private static void AddTracked(string typeName, string label, Color color, Vector3 origin, float maxDist, params string[] nameContains) { //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) Type type = Hook.Type(typeName); IList list = Game.Tracked(type); if (list != null) { foreach (object item in list) { Transform val = Hook.TransformOf(item); if (!((Object)(object)val == (Object)null) && (nameContains == null || nameContains.Length == 0 || NameMatches(((Object)((Component)val).gameObject).name, nameContains))) { Add(val.position, LabelFor(((Object)((Component)val).gameObject).name, label), color, origin, maxDist); } } return; } if (type == null) { return; } Object[] array = Object.FindObjectsOfType(type); for (int i = 0; i < array.Length; i++) { Transform val2 = Hook.TransformOf(array[i]); if (!((Object)(object)val2 == (Object)null) && (nameContains == null || nameContains.Length == 0 || NameMatches(((Object)((Component)val2).gameObject).name, nameContains))) { Add(val2.position, LabelFor(((Object)((Component)val2).gameObject).name, label), color, origin, maxDist); } } } private static void AddNamed(string fragment, string label, Color color, Vector3 origin, float maxDist) { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) Type type = Hook.Type("RoR2.PurchaseInteraction") ?? Hook.Type("RoR2.GenericInteraction"); if (type == null) { return; } IEnumerable enumerable = Game.Tracked(type); if (enumerable == null) { enumerable = Object.FindObjectsOfType(type); } foreach (object item in enumerable) { Transform val = Hook.TransformOf(item); if (!((Object)(object)val == (Object)null) && ((Object)((Component)val).gameObject).name.IndexOf(fragment, StringComparison.OrdinalIgnoreCase) >= 0) { Add(val.position, LabelFor(((Object)((Component)val).gameObject).name, label), color, origin, maxDist); } } } private static bool NameMatches(string name, string[] fragments) { foreach (string value in fragments) { if (name.IndexOf(value, StringComparison.OrdinalIgnoreCase) >= 0) { return true; } } return false; } private static string LabelFor(string objectName, string fallback) { if (!Session.EspAdvanced) { return fallback; } string text = objectName.Replace("(Clone)", "").Trim(); if (text.Length <= 22) { return text; } return text.Substring(0, 22); } private static void Add(Vector3 world, string label, Color color, Vector3 origin, float maxDist) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) Vector3 val = world - origin; if (!(((Vector3)(ref val)).sqrMagnitude > maxDist * maxDist)) { Marks.Add(new Mark { World = world, Label = label, Color = color }); } } } internal sealed class Actor { public int Id; public string Name; public bool IsLocal; public object NetworkUser; public object Master; public object Body; public object Motor; public object Health; public object Inventory; public object InputBank; public object Team; public object Direction; public Transform Transform; } internal sealed class CatalogItem { public int Index; public string Name; public string Pickup; public bool Hidden; public object Def; public Texture Icon; public Rect IconUv = new Rect(0f, 0f, 1f, 1f); public Color IconColor = new Color(0.18f, 0.22f, 0.26f, 1f); public bool IconResolved; } internal static class Game { private struct PendingGive { public int ActorId; public uint NetId; public int ItemIndex; public int Count; } public static bool Ready; public static Harmony Harmony; public static Type TCharacterBody; public static Type TCharacterMaster; public static Type THealthComponent; public static Type TCharacterMotor; public static Type TInventory; public static Type TNetworkUser; public static Type TPlayerCharacterMasterController; public static Type TLocalUserManager; public static Type TTeamComponent; public static Type TInputBank; public static Type TCharacterDirection; public static Type TSkillLocator; public static Type TGenericSkill; public static Type TItemCatalog; public static Type TItemDef; public static Type TEquipmentCatalog; public static Type TEquipmentDef; public static Type TBuffCatalog; public static Type TBuffDef; public static Type TSurvivorCatalog; public static Type TSurvivorDef; public static Type TBodyCatalog; public static Type TMasterCatalog; public static Type TEliteCatalog; public static Type TEliteDef; public static Type TSceneCatalog; public static Type TSceneDef; public static Type TRun; public static Type TTeamManager; public static Type TTeleporterInteraction; public static Type THoldoutZoneController; public static Type TCombatDirector; public static Type TLanguage; public static Type TNetworkServer; public static Type TInstanceTracker; public static Type TTeleportHelper; public static Type TDirectorSpawnRequest; public static Type TDirectorPlacementRule; public static Type TSpawnCard; public static Type TInteractableSpawnCard; public static Type TCharacterSpawnCard; public static Type TRoR2Application; public static Type TNetworkManagerSystem; public static Type TMapZone; public static Type TBaseAI; public static Type TKinematicMotor; public static Type TItemIndex; public static Type TEquipmentIndex; public static Type TBuffIndex; public static Type TTeamIndex; public static Type THurtBox; public static Type TPickupIndex; public static Type TGenericPickupController; public static Type TSkinDef; public static Type TModelLocator; public static Type TModelSkinController; public static Type TBodyIndex; private static MemberInfo _bodyInstances; private static MemberInfo _playerInstances; private static MemberInfo _networkUsers; private static MemberInfo _localUsers; private static MemberInfo _runInstance; private static MemberInfo _teamManagerInstance; private static MemberInfo _teleporterInstance; private static MethodInfo _languageGet; private static MethodInfo _giveItem; private static MethodInfo _removeItem; private static MethodInfo _getItemCount; private static MethodInfo _onInventoryChanged; private static FieldInfo _itemStacks; private static MethodInfo _setEquipment; private static MethodInfo _getEquipment; private static MethodInfo _suicide; private static MethodInfo _respawn; private static MethodInfo _respawnAt; private static MethodInfo _getBody; private static MethodInfo _setBuffCount; private static MethodInfo _getBuffCount; private static MethodInfo _addTimedBuff; private static MethodInfo _clearTimedBuffs; private static MethodInfo _awardLunar; private static MethodInfo _advanceStage; private static MethodInfo _getSceneDef; private static MethodInfo _findSceneDef; private static MethodInfo _allSceneDefs; private static MethodInfo _itemCount; private static MethodInfo _getItemDef; private static MethodInfo _equipCount; private static MethodInfo _getEquipDef; private static MethodInfo _buffCount; private static MethodInfo _getBuffDef; private static MethodInfo _allSurvivors; private static MethodInfo _getBodyPrefab; private static MethodInfo _findBodyPrefab; private static MethodInfo _findBodyIndex; private static MethodInfo _transformBody; private static MethodInfo _getMasterPrefab; private static MethodInfo _bodyCount; private static MethodInfo _masterCount; private static MethodInfo _eliteCount; private static MethodInfo _getEliteDef; private static MethodInfo _instanceTrackerGet; private static MethodInfo _teleportBody; private static MethodInfo _spawnCardDoSpawn; private static MethodInfo _networkServerSpawn; private static MethodInfo _networkServerActive; private static MethodInfo _serverKick; private static MethodInfo _serverBan; private static MethodInfo _giveTeamMoney; private static MethodInfo _giveTeamExp; private static MethodInfo _getBodySkins; private static MethodInfo _applySkin; private static MethodInfo _applySkinAsync; private static MethodInfo _skinDefApply; private static MethodInfo _setLoadoutServer; private static MethodInfo _setSkinIndex; private static FieldInfo _directorCombatDisableField; private static MemberInfo _masterGod; private static MemberInfo _healthGod; private static MemberInfo _masterMoney; private static MemberInfo _voidCoins; private static MemberInfo _lunarCoins; private static MemberInfo _bodyMaster; private static MemberInfo _bodyHealth; private static MemberInfo _bodyMotor; private static MemberInfo _bodyInventory; private static MemberInfo _bodyInput; private static MemberInfo _bodyTeam; private static MemberInfo _bodySkill; private static MemberInfo _bodyDirection; private static MemberInfo _bodySprinting; private static MemberInfo _masterInventory; private static MemberInfo _masterBodyPrefab; private static MemberInfo _masterPcmc; private static MemberInfo _pcmcMaster; private static MemberInfo _nuMaster; private static MemberInfo _nuUserName; private static MemberInfo _motorGravity; private static MemberInfo _motorVelocity; private static FieldInfo _tpShop; private static FieldInfo _tpGold; private static FieldInfo _tpCelestial; private static FieldInfo _tpHoldout; private static FieldInfo _tpShrineStacks; private static FieldInfo _holdoutCharge; private static MemberInfo _kcmLayers; private static FieldInfo _itemNameToken; private static FieldInfo _itemHidden; private static FieldInfo _itemTier; private static MemberInfo _itemPickupToken; private static MemberInfo _itemDescToken; private static FieldInfo _equipNameToken; private static FieldInfo _buffNameToken; private static FieldInfo _survivorNameToken; private static MemberInfo _survivorBodyPrefab; private static FieldInfo _sceneNameToken; private static FieldInfo _sceneCachedName; private static FieldInfo _eliteNameToken; private static FieldInfo _eliteEquipment; private static MemberInfo _bodyNameToken; private static MemberInfo _allBodyPrefabs; private static MemberInfo _bodyIndex; private static MemberInfo _bodySkinIndex; private static FieldInfo _modelTransform; private static FieldInfo _mscSkins; private static MemberInfo _mscCurrentSkin; private static FieldInfo _skinNameToken; private static FieldInfo _catalogSkins; private static MemberInfo _masterLoadout; private static FieldInfo _loadoutBodyManager; private static FieldInfo _masterBodyPrefabField; private static PropertyInfo _inputMove; private static PropertyInfo _inputAim; private static FieldInfo _placementMode; private static FieldInfo _placementPosition; private static FieldInfo _spawnRequestTeam; private static FieldInfo _spawnRequestIgnoreLimit; private static object _directPlacementMode; private static FieldInfo[] _mouseSkillFields; private static FieldInfo _buttonDown; private static FieldInfo _buttonWasDown; private static bool _loggedMissing; public static string LastActionMessage; private static readonly List _pendingPlayer = new List(); private static readonly List _pendingGives = new List(); private static bool _skinBusy; private static float _skinBusyUntil; public static bool IsServer { get { try { if (_networkServerActive != null) { return (bool)_networkServerActive.Invoke(null, null); } } catch { } try { object obj2 = LocalActor()?.Master; Component val = (Component)((obj2 is Component) ? obj2 : null); if (Object.op_Implicit((Object)(object)val)) { PropertyInfo propertyInfo = Hook.Prop(((object)val).GetType(), "isServer") ?? Hook.Prop(Hook.Type("UnityEngine.Networking.NetworkBehaviour"), "isServer"); if (propertyInfo != null) { return (bool)propertyInfo.GetValue(val, null); } } } catch { } return false; } } public static object RunInstance { get { if (!(_runInstance == null)) { return Hook.Get(_runInstance, null); } return null; } } public static bool SkinBusy { get { if (_skinBusy) { return Time.unscaledTime < _skinBusyUntil; } return false; } } public static void Init(Harmony harmony) { Harmony = harmony; try { Resolve(); if (Ready) { Patches.Apply(harmony); CoOp.Register(); } } catch (Exception message) { Log.Error(message); Ready = TCharacterBody != null; } } public static void Resolve() { if (Ready) { return; } TCharacterBody = Hook.Type("RoR2.CharacterBody"); if (TCharacterBody == null) { if (!_loggedMissing) { Log.Warn("RoR2 types not loaded yet."); _loggedMissing = true; } return; } TCharacterMaster = Hook.Type("RoR2.CharacterMaster"); THealthComponent = Hook.Type("RoR2.HealthComponent"); TCharacterMotor = Hook.Type("RoR2.CharacterMotor"); TInventory = Hook.Type("RoR2.Inventory"); TNetworkUser = Hook.Type("RoR2.NetworkUser"); TPlayerCharacterMasterController = Hook.Type("RoR2.PlayerCharacterMasterController"); TLocalUserManager = Hook.Type("RoR2.LocalUserManager"); TTeamComponent = Hook.Type("RoR2.TeamComponent"); TInputBank = Hook.Type("RoR2.InputBankTest") ?? Hook.Type("RoR2.InputBank"); TCharacterDirection = Hook.Type("RoR2.CharacterDirection"); TSkillLocator = Hook.Type("RoR2.SkillLocator"); TGenericSkill = Hook.Type("RoR2.GenericSkill"); TItemCatalog = Hook.Type("RoR2.ItemCatalog"); TItemDef = Hook.Type("RoR2.ItemDef"); TEquipmentCatalog = Hook.Type("RoR2.EquipmentCatalog"); TEquipmentDef = Hook.Type("RoR2.EquipmentDef"); TBuffCatalog = Hook.Type("RoR2.BuffCatalog"); TBuffDef = Hook.Type("RoR2.BuffDef"); TSurvivorCatalog = Hook.Type("RoR2.SurvivorCatalog"); TSurvivorDef = Hook.Type("RoR2.SurvivorDef"); TBodyCatalog = Hook.Type("RoR2.BodyCatalog"); TMasterCatalog = Hook.Type("RoR2.MasterCatalog"); TEliteCatalog = Hook.Type("RoR2.EliteCatalog"); TEliteDef = Hook.Type("RoR2.EliteDef"); TSceneCatalog = Hook.Type("RoR2.SceneCatalog"); TSceneDef = Hook.Type("RoR2.SceneDef"); TRun = Hook.Type("RoR2.Run"); TTeamManager = Hook.Type("RoR2.TeamManager"); TTeleporterInteraction = Hook.Type("RoR2.TeleporterInteraction"); THoldoutZoneController = Hook.Type("RoR2.HoldoutZoneController"); TCombatDirector = Hook.Type("RoR2.CombatDirector"); TLanguage = Hook.Type("RoR2.Language"); TNetworkServer = Hook.Type("UnityEngine.Networking.NetworkServer") ?? Hook.Type("RoR2.NetworkServer"); TInstanceTracker = Hook.Type("RoR2.InstanceTracker"); TTeleportHelper = Hook.Type("RoR2.TeleportHelper"); TDirectorSpawnRequest = Hook.Type("RoR2.DirectorSpawnRequest"); TDirectorPlacementRule = Hook.Type("RoR2.DirectorPlacementRule"); TSpawnCard = Hook.Type("RoR2.SpawnCard"); TInteractableSpawnCard = Hook.Type("RoR2.InteractableSpawnCard"); TCharacterSpawnCard = Hook.Type("RoR2.CharacterSpawnCard"); TRoR2Application = Hook.Type("RoR2.RoR2Application"); TNetworkManagerSystem = Hook.Type("RoR2.Networking.NetworkManagerSystem") ?? Hook.Type("RoR2.NetworkManagerSystem"); TMapZone = Hook.Type("RoR2.MapZone"); TBaseAI = Hook.Type("RoR2.CharacterAI.BaseAI"); TKinematicMotor = Hook.Type("KinematicCharacterController.KinematicCharacterMotor"); TItemIndex = Hook.Type("RoR2.ItemIndex"); TEquipmentIndex = Hook.Type("RoR2.EquipmentIndex"); TBuffIndex = Hook.Type("RoR2.BuffIndex"); TTeamIndex = Hook.Type("RoR2.TeamIndex"); THurtBox = Hook.Type("RoR2.HurtBox"); TPickupIndex = Hook.Type("RoR2.PickupIndex"); TGenericPickupController = Hook.Type("RoR2.GenericPickupController"); TSkinDef = Hook.Type("RoR2.SkinDef"); TModelLocator = Hook.Type("RoR2.ModelLocator"); TModelSkinController = Hook.Type("RoR2.ModelSkinController"); TBodyIndex = Hook.Type("RoR2.BodyIndex"); _bodyInstances = Hook.Member(TCharacterBody, "readOnlyInstancesList", "instancesList", "instances"); _playerInstances = Hook.Member(TPlayerCharacterMasterController, "instances", "_instances", "instancesList", "readOnlyInstancesList"); _networkUsers = Hook.Member(TNetworkUser, "readOnlyInstancesList", "instances", "instancesList"); _localUsers = Hook.Member(TLocalUserManager, "readOnlyLocalUsersList") ?? Hook.Method(TLocalUserManager, "GetFirstLocalUser"); _runInstance = Hook.Member(TRun, "instance", "_instance"); _teamManagerInstance = Hook.Member(TTeamManager, "instance"); _teleporterInstance = Hook.Member(TTeleporterInteraction, "instance"); _directorCombatDisableField = Hook.Field(TCombatDirector, "cvDirectorCombatDisable"); _languageGet = Hook.Method(TLanguage, "GetString", typeof(string)) ?? Hook.Method(TLanguage, "GetLocalizedStringByToken", typeof(string)); _giveItem = FindMethod(TInventory, "GiveItem", 2) ?? FindMethod(TInventory, "GiveItem", 3) ?? FindMethod(TInventory, "GiveItem", 1) ?? Hook.Method(TInventory, "GiveItem"); _removeItem = FindMethod(TInventory, "RemoveItem", 2) ?? Hook.Method(TInventory, "RemoveItem"); _getItemCount = FindMethod(TInventory, "GetItemCount", 1) ?? Hook.Method(TInventory, "GetItemCount"); _onInventoryChanged = Hook.Method(TInventory, "OnInventoryChanged"); _itemStacks = Hook.Field(TInventory, "itemStacks", "_itemStacks"); _setEquipment = FindMethod(TInventory, "SetEquipmentIndex", 1) ?? FindMethod(TInventory, "SetEquipmentIndex", 2); _getEquipment = Hook.Method(TInventory, "GetEquipmentIndex") ?? Hook.Prop(TInventory, "currentEquipmentIndex")?.GetGetMethod(); _suicide = FindMethod(THealthComponent, "Suicide", 3) ?? FindMethod(THealthComponent, "Suicide", 0) ?? Hook.Method(THealthComponent, "Suicide"); _respawn = Hook.Method(TCharacterMaster, "RespawnExtraLife") ?? Hook.Method(TCharacterMaster, "RespawnExtraLifeVoid"); _respawnAt = FindMethod(TCharacterMaster, "Respawn", 2) ?? FindMethod(TCharacterMaster, "Respawn", 3); _getBody = Hook.Method(TCharacterMaster, "GetBody"); _setBuffCount = FindMethod(TCharacterBody, "SetBuffCount", 2); _getBuffCount = FindMethod(TCharacterBody, "GetBuffCount", 1); _addTimedBuff = FindMethod(TCharacterBody, "AddTimedBuff", 2) ?? FindMethod(TCharacterBody, "AddTimedBuff", 3); _clearTimedBuffs = FindMethod(TCharacterBody, "ClearTimedBuffs", 1); _awardLunar = Hook.Method(TNetworkUser, "AwardLunarCoins") ?? FindMethod(TNetworkUser, "AwardLunarCoins", 1); _advanceStage = FindMethod(TRun, "AdvanceStage", 1); _getSceneDef = Hook.Method(TSceneCatalog, "GetSceneDefForCurrentScene"); _findSceneDef = Hook.Method(TSceneCatalog, "FindSceneDef", typeof(string)) ?? Hook.Method(TSceneCatalog, "GetSceneDefFromSceneName", typeof(string)); _allSceneDefs = Hook.Prop(TSceneCatalog, "allSceneDefs")?.GetGetMethod() ?? Hook.Method(TSceneCatalog, "GetAllSceneDefs"); _itemCount = Hook.Prop(TItemCatalog, "itemCount")?.GetGetMethod(); _getItemDef = Hook.Method(TItemCatalog, "GetItemDef"); _equipCount = Hook.Prop(TEquipmentCatalog, "equipmentCount")?.GetGetMethod(); _getEquipDef = Hook.Method(TEquipmentCatalog, "GetEquipmentDef"); _buffCount = Hook.Prop(TBuffCatalog, "buffCount")?.GetGetMethod(); _getBuffDef = Hook.Method(TBuffCatalog, "GetBuffDef"); _allSurvivors = Hook.Prop(TSurvivorCatalog, "allSurvivorDefs")?.GetGetMethod(); _getBodyPrefab = Hook.Method(TBodyCatalog, "GetBodyPrefab"); _findBodyPrefab = Hook.Method(TBodyCatalog, "FindBodyPrefab", typeof(string)) ?? Hook.Method(TBodyCatalog, "FindBodyPrefab"); _findBodyIndex = Hook.Method(TBodyCatalog, "FindBodyIndex", typeof(string)) ?? Hook.Method(TBodyCatalog, "FindBodyIndex"); _transformBody = FindMethod(TCharacterMaster, "TransformBody", 1) ?? Hook.Method(TCharacterMaster, "TransformBody"); _getMasterPrefab = Hook.Method(TMasterCatalog, "GetMasterPrefab"); _bodyCount = Hook.Prop(TBodyCatalog, "bodyCount")?.GetGetMethod(); _masterCount = Hook.Prop(TMasterCatalog, "masterCount")?.GetGetMethod(); _eliteCount = Hook.Prop(TEliteCatalog, "eliteCount")?.GetGetMethod(); _getEliteDef = Hook.Method(TEliteCatalog, "GetEliteDef"); _teleportBody = FindMethod(TTeleportHelper, "TeleportBody", 2); _spawnCardDoSpawn = FindMethod(TSpawnCard, "DoSpawn", 3); _networkServerSpawn = Hook.Method(TNetworkServer, "Spawn", typeof(GameObject)); _networkServerActive = Hook.Prop(TNetworkServer, "active")?.GetGetMethod() ?? Hook.Method(TNetworkServer, "get_active"); _serverKick = FindMethod(TNetworkManagerSystem, "ServerKickClient", 2) ?? FindMethod(TNetworkManagerSystem, "ServerKickClient", 1); _serverBan = FindMethod(TNetworkManagerSystem, "ServerBanClient", 1); _giveTeamMoney = FindMethod(TTeamManager, "GiveTeamMoney", 2); _giveTeamExp = FindMethod(TTeamManager, "GiveTeamExperience", 2) ?? FindMethod(TTeamManager, "GiveTeamExperience", 3); _getBodySkins = Hook.Method(TBodyCatalog, "GetBodySkins") ?? Hook.Method(Hook.Type("RoR2.SkinCatalog"), "GetBodySkins"); _applySkin = FindMethod(TModelSkinController, "ApplySkin", 1) ?? Hook.Method(TModelSkinController, "ApplySkin"); _applySkinAsync = FindMethod(TModelSkinController, "ApplySkinAsync", 1) ?? Hook.Method(TModelSkinController, "ApplySkinAsync"); _skinDefApply = FindMethod(TSkinDef, "Apply", 1) ?? Hook.Method(TSkinDef, "Apply"); _setLoadoutServer = Hook.Method(TCharacterMaster, "SetLoadoutServer"); _catalogSkins = Hook.Field(TBodyCatalog, "skins"); _masterGod = Hook.Member(TCharacterMaster, "godMode"); _healthGod = Hook.Member(THealthComponent, "godMode"); _masterMoney = Hook.Member(TCharacterMaster, "money"); _voidCoins = Hook.Member(TCharacterMaster, "voidCoins", "voidCoin"); _lunarCoins = Hook.Member(TNetworkUser, "lunarCoins"); _bodyMaster = Hook.Member(TCharacterBody, "master", "_master"); _bodyHealth = Hook.Member(TCharacterBody, "healthComponent", "_healthComponent"); _bodyMotor = Hook.Member(TCharacterBody, "characterMotor", "_characterMotor"); _bodyInventory = Hook.Member(TCharacterBody, "inventory", "_inventory"); _bodyInput = Hook.Member(TCharacterBody, "inputBank", "_inputBank"); _bodyTeam = Hook.Member(TCharacterBody, "teamComponent", "_teamComponent"); _bodySkill = Hook.Member(TCharacterBody, "skillLocator", "_skillLocator"); _bodyDirection = Hook.Member(TCharacterBody, "characterDirection", "_characterDirection"); _bodySprinting = Hook.Member(TCharacterBody, "isSprinting", "sprinting"); _masterInventory = Hook.Member(TCharacterMaster, "inventory", "_inventory"); _masterBodyPrefab = Hook.Member(TCharacterMaster, "bodyPrefab", "_bodyPrefab"); _masterPcmc = Hook.Member(TCharacterMaster, "playerCharacterMasterController"); _pcmcMaster = Hook.Member(TPlayerCharacterMasterController, "master"); _nuMaster = Hook.Member(TNetworkUser, "master"); _nuUserName = Hook.Member(TNetworkUser, "userName"); _motorGravity = Hook.Member(TCharacterMotor, "useGravity"); _motorVelocity = Hook.Member(TCharacterMotor, "velocity", "Velocity", "BaseVelocity"); _tpShop = Hook.Field(TTeleporterInteraction, "shouldAttemptToSpawnShopPortal"); _tpGold = Hook.Field(TTeleporterInteraction, "shouldAttemptToSpawnGoldshoresPortal"); _tpCelestial = Hook.Field(TTeleporterInteraction, "shouldAttemptToSpawnMSPortal"); _tpHoldout = Hook.Field(TTeleporterInteraction, "holdoutZoneController"); _tpShrineStacks = Hook.Field(TTeleporterInteraction, "shrineBonusStacks", "bossShrineBonus"); _holdoutCharge = Hook.Field(THoldoutZoneController, "_charge", "charge"); _kcmLayers = Hook.Member(TKinematicMotor, "CollidableLayers", "collidableLayers"); _itemNameToken = Hook.Field(TItemDef, "nameToken"); _itemHidden = Hook.Field(TItemDef, "hidden"); _itemTier = Hook.Field(TItemDef, "tier"); _itemPickupToken = Hook.Member(TItemDef, "pickupToken", "descriptionToken"); _itemDescToken = Hook.Member(TItemDef, "descriptionToken", "pickupToken"); _equipNameToken = Hook.Field(TEquipmentDef, "nameToken"); _buffNameToken = Hook.Field(TBuffDef, "nameToken", "eliteNameToken"); _survivorNameToken = Hook.Field(TSurvivorDef, "displayNameToken"); _survivorBodyPrefab = Hook.Member(TSurvivorDef, "bodyPrefab", "_bodyPrefab"); _sceneNameToken = Hook.Field(TSceneDef, "nameToken"); _sceneCachedName = Hook.Field(TSceneDef, "cachedName", "baseSceneName"); _eliteNameToken = Hook.Field(TEliteDef, "modifierToken", "eliteNameToken"); _eliteEquipment = Hook.Field(TEliteDef, "eliteEquipmentDef"); _bodyNameToken = Hook.Member(TCharacterBody, "baseNameToken"); _allBodyPrefabs = Hook.Member(TBodyCatalog, "allBodyPrefabs", "bodyPrefabs"); _bodyIndex = Hook.Member(TCharacterBody, "bodyIndex"); _bodySkinIndex = Hook.Member(TCharacterBody, "skinIndex"); _modelTransform = Hook.Field(TModelLocator, "modelTransform", "_modelTransform"); _mscSkins = Hook.Field(TModelSkinController, "skins"); _mscCurrentSkin = Hook.Member(TModelSkinController, "currentSkinIndex", "skinIndex"); _skinNameToken = Hook.Field(TSkinDef, "nameToken"); _masterLoadout = Hook.Member(TCharacterMaster, "loadout", "_loadout"); Type type = Hook.Type("RoR2.Loadout"); Type type2 = type?.GetNestedType("BodyLoadoutManager") ?? Hook.Type("RoR2.Loadout+BodyLoadoutManager"); _loadoutBodyManager = Hook.Field(type, "bodyLoadoutManager"); _setSkinIndex = Hook.Method(type2, "SetSkinIndex"); _masterBodyPrefabField = Hook.Field(Hook.Type("RoR2.CharacterMaster"), "bodyPrefab"); _inputMove = Hook.Prop(TInputBank, "moveVector"); _inputAim = Hook.Prop(TInputBank, "aimDirection"); _placementMode = Hook.Field(TDirectorPlacementRule, "placementMode"); _placementPosition = Hook.Field(TDirectorPlacementRule, "position"); _spawnRequestTeam = Hook.Field(TDirectorSpawnRequest, "teamIndexOverride"); _spawnRequestIgnoreLimit = Hook.Field(TDirectorSpawnRequest, "ignoreTeamMemberLimit"); if (TDirectorPlacementRule != null) { Type nestedType = TDirectorPlacementRule.GetNestedType("PlacementMode"); if (nestedType != null && nestedType.IsEnum) { try { _directPlacementMode = Enum.Parse(nestedType, "Direct"); } catch { _directPlacementMode = Enum.ToObject(nestedType, 0); } } } Ready = true; Log.Info("RoR2 bridge ready. GiveItem=" + ((_giveItem != null) ? _giveItem.ToString() : "missing") + " itemStacks=" + (_itemStacks != null) + " money=" + (_masterMoney != null) + " motor=" + (_bodyMotor != null) + " sprint=" + (_bodySprinting != null) + " team=" + (_bodyTeam != null) + " applySkinAsync=" + ((_applySkinAsync != null) ? _applySkinAsync.ToString() : "missing") + " findBodyPrefab=" + (_findBodyPrefab != null) + " transformBody=" + ((_transformBody != null) ? _transformBody.ToString() : "missing")); } private static MethodInfo FindMethod(Type type, string name, int argc) { if (type == null) { return null; } MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { if (methodInfo.Name == name && methodInfo.GetParameters().Length == argc && !methodInfo.IsGenericMethod) { return methodInfo; } } return null; } public static string Localize(string token) { if (string.IsNullOrEmpty(token)) { return token; } if (_languageGet == null) { return token; } try { string text = _languageGet.Invoke(null, new object[1] { token }) as string; return string.IsNullOrEmpty(text) ? token : text; } catch { return token; } } public static List Players() { List list = new List(); HashSet hashSet = new HashSet(); object obj = LocalBody(); IEnumerable enumerable = ((_playerInstances != null) ? (Hook.Get(_playerInstances, null) as IEnumerable) : null); if (enumerable != null) { foreach (object item in enumerable) { if (item != null) { Actor actor = FromMaster((_pcmcMaster != null) ? Hook.Get(_pcmcMaster, item) : null, obj); if (actor != null && hashSet.Add(actor.Id)) { list.Add(actor); } } } } IEnumerable enumerable2 = ((_networkUsers != null) ? (Hook.Get(_networkUsers, null) as IEnumerable) : null); if (enumerable2 != null) { foreach (object item2 in enumerable2) { if (item2 != null) { Actor actor2 = FromMaster((_nuMaster != null) ? Hook.Get(_nuMaster, item2) : null, obj); if (actor2 != null && hashSet.Add(actor2.Id)) { actor2.NetworkUser = item2; list.Add(actor2); } } } } if (list.Count == 0 && obj != null) { Actor actor3 = FromBody(obj, obj); if (actor3 != null) { list.Add(actor3); } } return list; } public static Actor FindPlayer(int id) { foreach (Actor item in Players()) { if (item.Id == id) { return item; } } return null; } public static object LocalBody() { try { MethodInfo methodInfo = Hook.Method(TLocalUserManager, "GetFirstLocalUser"); object obj = ((methodInfo != null) ? methodInfo.Invoke(null, null) : null); if (obj == null) { return null; } MemberInfo memberInfo = Hook.Member(obj.GetType(), "cachedBody"); object obj2 = ((memberInfo != null) ? Hook.Get(memberInfo, obj) : null); if (obj2 != null) { return obj2; } MemberInfo memberInfo2 = Hook.Member(obj.GetType(), "cachedMaster", "cachedMasterController"); object obj3 = ((memberInfo2 != null) ? Hook.Get(memberInfo2, obj) : null); if (obj3 != null && _getBody != null) { return _getBody.Invoke(obj3, null); } } catch { } return null; } public static Actor LocalActor() { object obj = LocalBody(); if (obj != null) { return FromBody(obj, obj); } return null; } private static Actor FromMaster(object master, object localBody) { if (master == null) { return null; } object obj = null; try { obj = _getBody?.Invoke(master, null); } catch { } if (obj == null) { return FromMasterOnly(master, localBody); } return FromBody(obj, localBody); } private static Actor FromMasterOnly(object master, object localBody) { Actor obj = new Actor { Master = master, Name = "Player", Id = StableId(master, (Component)((master is Component) ? master : null)) }; obj.Inventory = InventoryOf(obj); FillNetworkUser(obj); return obj; } public static Actor FromBody(object body, object localBody) { if (body == null) { return null; } Component val = (Component)((body is Component) ? body : null); object obj = ((_bodyMaster != null) ? Hook.Get(_bodyMaster, body) : null); if (!UnityAlive(obj)) { obj = ComponentOf(Bind(body, "masterObject", "_masterObject"), TCharacterMaster); } Actor actor = new Actor { Body = body, Master = obj, Health = ((_bodyHealth != null) ? Hook.Get(_bodyHealth, body) : null), Motor = ((_bodyMotor != null) ? Hook.Get(_bodyMotor, body) : null), InputBank = ((_bodyInput != null) ? Hook.Get(_bodyInput, body) : null), Team = ((_bodyTeam != null) ? Hook.Get(_bodyTeam, body) : null), Direction = ((_bodyDirection != null) ? Hook.Get(_bodyDirection, body) : null), Transform = (Object.op_Implicit((Object)(object)val) ? val.transform : null), Id = StableId(obj, val), IsLocal = (localBody != null && body == localBody) }; if (!UnityAlive(actor.Health) && Object.op_Implicit((Object)(object)val) && THealthComponent != null) { actor.Health = val.GetComponent(THealthComponent); } if (!UnityAlive(actor.Motor) && Object.op_Implicit((Object)(object)val) && TCharacterMotor != null) { actor.Motor = val.GetComponent(TCharacterMotor); } if (!UnityAlive(actor.InputBank) && Object.op_Implicit((Object)(object)val) && TInputBank != null) { actor.InputBank = val.GetComponent(TInputBank); } if (!UnityAlive(actor.Team) && Object.op_Implicit((Object)(object)val) && TTeamComponent != null) { actor.Team = val.GetComponent(TTeamComponent); } actor.Inventory = InventoryOf(actor); FillNetworkUser(actor); if (string.IsNullOrEmpty(actor.Name)) { actor.Name = (Object.op_Implicit((Object)(object)val) ? ((Object)val.gameObject).name : "Body"); } return actor; } private static void FillNetworkUser(Actor actor) { object obj = ((actor.Master != null && _masterPcmc != null) ? Hook.Get(_masterPcmc, actor.Master) : null); if (!UnityAlive(obj)) { obj = ComponentOf(actor.Master, TPlayerCharacterMasterController); } if (UnityAlive(obj)) { MethodInfo methodInfo = Hook.Method(obj.GetType(), "GetDisplayName"); if (methodInfo != null) { actor.Name = (methodInfo.Invoke(obj, null) as string) ?? actor.Name; } object obj2 = Bind(obj, "networkUser"); if (UnityAlive(obj2)) { actor.NetworkUser = obj2; } } if (actor.NetworkUser != null && string.IsNullOrEmpty(actor.Name) && _nuUserName != null) { actor.Name = Hook.Get(_nuUserName, actor.NetworkUser) as string; } if (string.IsNullOrEmpty(actor.Name)) { actor.Name = "Player"; } } private static object Bind(object target, params string[] names) { if (target == null || names == null || names.Length == 0) { return null; } MemberInfo memberInfo = Hook.Member(target.GetType(), names); if (!(memberInfo == null)) { return Hook.Get(memberInfo, target); } return null; } private static object ComponentOf(object host, Type type) { if (host == null || type == null) { return null; } Component val = (Component)((host is Component) ? host : null); if (val != null && Object.op_Implicit((Object)(object)val)) { return val.GetComponent(type); } GameObject val2 = (GameObject)((host is GameObject) ? host : null); if (val2 != null && Object.op_Implicit((Object)(object)val2)) { return val2.GetComponent(type); } return null; } private static bool UnityAlive(object obj) { if (obj == null) { return false; } Object val = (Object)((obj is Object) ? obj : null); if (val != null) { return Object.op_Implicit(val); } return true; } private static int StableId(object master, Component fallback) { Component val = (Component)((master is Component) ? master : null); if (val != null && Object.op_Implicit((Object)(object)val)) { return ((Object)val).GetInstanceID(); } if (Object.op_Implicit((Object)(object)fallback)) { return ((Object)fallback).GetInstanceID(); } return master?.GetHashCode() ?? 0; } public static object FirstLocalNetworkUser() { try { MethodInfo methodInfo = Hook.Method(TLocalUserManager, "GetFirstLocalUser"); object obj = ((methodInfo != null) ? methodInfo.Invoke(null, null) : null); if (obj == null) { return null; } return Hook.Get(Hook.Member(obj.GetType(), "currentNetworkUser", "networkUser"), obj); } catch { return null; } } public static uint NetId(Actor actor) { uint num = NetIdOf(actor?.Master); if (num != 0) { return num; } uint num2 = NetIdOf(actor?.NetworkUser); if (num2 != 0) { return num2; } return NetIdOf(actor?.Body); } public static uint NetIdOf(object component) { Component val = (Component)((component is Component) ? component : null); if (!Object.op_Implicit((Object)(object)val)) { return 0u; } Type type = Hook.Type("UnityEngine.Networking.NetworkIdentity"); if (type == null) { return 0u; } Component val2 = val.GetComponent(type) ?? val.GetComponentInParent(type); if (!Object.op_Implicit((Object)(object)val2)) { return 0u; } object obj = Hook.Get(Hook.Member(((object)val2).GetType(), "netId"), val2); if (obj == null) { return 0u; } object obj2 = Hook.Get(Hook.Member(obj.GetType(), "Value", "value"), obj); try { return Convert.ToUInt32(obj2 ?? ((object)0)); } catch { return 0u; } } public static Actor FindByNetId(uint netId) { if (netId == 0) { return null; } foreach (Actor item in Players()) { if (NetIdOf(item.Master) == netId) { return item; } if (NetIdOf(item.NetworkUser) == netId) { return item; } if (NetIdOf(item.Body) == netId) { return item; } } return null; } public static IEnumerable Bodies() { IEnumerable enumerable = ((_bodyInstances != null) ? (Hook.Get(_bodyInstances, null) as IEnumerable) : null); return enumerable ?? Array.Empty(); } public static int TeamOf(object body) { if (body == null) { return 0; } object obj = ((_bodyTeam != null) ? Hook.Get(_bodyTeam, body) : null); if (!UnityAlive(obj)) { Component val = (Component)((body is Component) ? body : null); if (val != null && TTeamComponent != null) { obj = val.GetComponent(TTeamComponent); } } if (!UnityAlive(obj)) { return 0; } return IndexValue.ToInt(Hook.Get(Hook.Prop(obj.GetType(), "teamIndex") ?? Hook.Member(obj.GetType(), "teamIndex", "_teamIndex"), obj)); } public static void SetTeam(Actor actor, int teamIndex) { if (actor != null) { if (actor.IsLocal) { Session.ForcedTeam = teamIndex; } if (!CoOp.AskHost("slipstream_team " + NetId(actor) + " " + teamIndex)) { ApplyTeamLocal(actor, teamIndex); } } } public static void ApplyTeamLocal(Actor actor, int teamIndex) { if (actor == null) { return; } object teamEnum = ((TTeamIndex != null) ? IndexValue.FromInt(TTeamIndex, teamIndex) : ((object)teamIndex)); object obj = actor.Team; if (!UnityAlive(obj)) { object body = actor.Body; Component val = (Component)((body is Component) ? body : null); if (val != null && TTeamComponent != null) { obj = val.GetComponent(TTeamComponent) ?? val.GetComponentInChildren(TTeamComponent, true); } } actor.Team = obj; WriteTeamIndex(obj, teamEnum); WriteTeamIndex(actor.Master, teamEnum); WriteTeamIndex(actor.Body, teamEnum); WriteHurtBoxes(actor.Body, teamEnum); LastActionMessage = "Team: " + TeamName(teamIndex) + ". Allies on that team will not attack you."; Log.Info(LastActionMessage + " value=" + teamIndex + " on " + actor.Name); } public static void HoldForcedTeam(Actor actor) { if (actor != null && actor.Body != null && Session.ForcedTeam != int.MinValue && TeamOf(actor.Body) != Session.ForcedTeam) { ApplyTeamLocal(actor, Session.ForcedTeam); } } private static string TeamName(int teamIndex) { return teamIndex switch { 0 => "Neutral", 1 => "Player", 2 => "Monster", 3 => "Lunar", 4 => "Void", _ => "Team " + teamIndex, }; } private static void WriteTeamIndex(object target, object teamEnum) { if (target == null || teamEnum == null) { return; } Type type = target.GetType(); string[] array = new string[4] { "set_teamIndex", "SetTeamIndex", "SwitchTeam", "ChangeTeam" }; foreach (string name in array) { MethodInfo methodInfo = Hook.Method(type, name); if (!(methodInfo == null)) { ParameterInfo[] parameters = methodInfo.GetParameters(); if (parameters.Length == 1) { Hook.Call(methodInfo, target, Hook.Coerce(teamEnum, parameters[0].ParameterType)); return; } } } PropertyInfo propertyInfo = Hook.Prop(type, "teamIndex"); if (propertyInfo != null && propertyInfo.CanWrite) { Hook.Set(propertyInfo, target, teamEnum); return; } Hook.Set(Hook.Member(type, "teamIndex", "_teamIndex"), target, teamEnum); } private static void WriteHurtBoxes(object body, object teamEnum) { Component val = (Component)((body is Component) ? body : null); if (!Object.op_Implicit((Object)(object)val) || teamEnum == null) { return; } Type type = THurtBox ?? Hook.Type("RoR2.HurtBox"); if (type != null) { Component[] componentsInChildren = val.GetComponentsInChildren(type, true); for (int i = 0; i < componentsInChildren.Length; i++) { WriteTeamIndex(componentsInChildren[i], teamEnum); } } Type type2 = Hook.Type("RoR2.TeamFilter"); if (type2 != null) { WriteTeamIndex(val.GetComponent(type2) ?? val.GetComponentInChildren(type2, true), teamEnum); } } public static void PushLocalToggles(Actor self) { if (self != null) { SetGod(self, Session.LocalMods.God); if (!IsServer) { CoOp.Submit("slipstream_t " + NetId(self) + " " + PackToggles(Session.LocalMods)); } } } public static int PackToggles(ActorMods mods) { if (mods == null) { return 0; } int num = 0; if (mods.God) { num |= 1; } if (mods.InfiniteSprint) { num |= 2; } if (mods.InfiniteSkills) { num |= 4; } if (mods.Noclip) { num |= 8; } return num; } public static void SetGod(Actor actor, bool enabled) { if (actor != null) { if (actor.Master != null && _masterGod != null) { Hook.Set(_masterGod, actor.Master, enabled); } if (actor.Health != null && _healthGod != null) { Hook.Set(_healthGod, actor.Health, enabled); } } } public static void SetSprinting(Actor actor, bool enabled) { if (actor != null && actor.Body != null && !(_bodySprinting == null)) { Hook.Set(_bodySprinting, actor.Body, enabled); } } public static void SetMotorGravity(Actor actor, bool useGravity) { if (actor != null && actor.Motor != null && !(_motorGravity == null)) { Hook.Set(_motorGravity, actor.Motor, useGravity); } } public static void SetMotorVelocity(Actor actor, Vector3 velocity) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) if (actor != null && actor.Motor != null && !(_motorVelocity == null)) { Hook.Set(_motorVelocity, actor.Motor, velocity); } } public static Vector3 MotorVelocity(Actor actor) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) if (actor == null || actor.Motor == null || _motorVelocity == null) { return Vector3.zero; } object obj = Hook.Get(_motorVelocity, actor.Motor); if (obj is Vector3) { return (Vector3)obj; } return Vector3.zero; } public static void SetCollidable(Actor actor, bool enabled) { object obj = actor?.Body; Component val = (Component)((obj is Component) ? obj : null); if (val != null && TKinematicMotor != null) { Component component = val.GetComponent(TKinematicMotor); if ((Object)(object)component != (Object)null && _kcmLayers != null) { Hook.Set(_kcmLayers, component, enabled ? (-1) : 0); } } if ((Object)(object)actor?.Transform != (Object)null) { Collider component2 = ((Component)actor.Transform).GetComponent(); if ((Object)(object)component2 != (Object)null) { component2.enabled = enabled; } } } public static Vector3 MoveVector(Actor actor) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) if (actor == null || actor.InputBank == null || _inputMove == null) { return Vector3.zero; } object value = _inputMove.GetValue(actor.InputBank, null); if (value is Vector3) { return (Vector3)value; } return Vector3.zero; } public static Vector3 AimDirection(Actor actor) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) if (actor == null || actor.InputBank == null || _inputAim == null) { if (!Object.op_Implicit((Object)(object)actor.Transform)) { return Vector3.forward; } return actor.Transform.forward; } object value = _inputAim.GetValue(actor.InputBank, null); if (value is Vector3) { return (Vector3)value; } return Vector3.forward; } public static void SetAim(Actor actor, Vector3 direction) { //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) if (actor != null && actor.InputBank != null && _inputAim != null && _inputAim.CanWrite) { _inputAim.SetValue(actor.InputBank, ((Vector3)(ref direction)).normalized, null); } if (actor != null && actor.Direction != null) { Hook.Set(Hook.Member(actor.Direction.GetType(), "forward"), actor.Direction, ((Vector3)(ref direction)).normalized); } } public static void RefillSkills(Actor actor) { if (actor == null || actor.Body == null || _bodySkill == null) { return; } object obj = Hook.Get(_bodySkill, actor.Body); if (obj == null) { return; } string[] array = new string[4] { "primary", "secondary", "utility", "special" }; foreach (string text in array) { MemberInfo memberInfo = Hook.Member(obj.GetType(), text); object obj2 = ((memberInfo != null) ? Hook.Get(memberInfo, obj) : null); if (obj2 != null) { MemberInfo memberInfo2 = Hook.Member(obj2.GetType(), "maxStock"); MemberInfo member = Hook.Member(obj2.GetType(), "stock"); FieldInfo fieldInfo = Hook.Field(obj2.GetType(), "rechargeStopwatch", "finalRechargeStopwatch"); object value = ((memberInfo2 != null) ? Hook.Get(memberInfo2, obj2) : ((object)1)); Hook.Set(member, obj2, value); if (fieldInfo != null) { fieldInfo.SetValue(obj2, 0f); } } } } public static uint GetMoney(Actor actor) { if (actor == null || actor.Master == null || _masterMoney == null) { return 0u; } try { return Convert.ToUInt32(Hook.Get(_masterMoney, actor.Master) ?? ((object)0)); } catch { return 0u; } } public static void SetMoney(Actor actor, uint amount) { if (actor != null && actor.Master != null && !CoOp.AskHost("slipstream_money " + NetId(actor) + " " + amount)) { if (_masterMoney == null) { LastActionMessage = "Could not find CharacterMaster.money."; Log.Warn(LastActionMessage); return; } Hook.Set(_masterMoney, actor.Master, amount); LastActionMessage = "Set money to " + amount + " for " + actor.Name + "."; Log.Info(LastActionMessage); } } public static uint GetVoidCoins(Actor actor) { if (actor == null || actor.Master == null || _voidCoins == null) { return 0u; } try { return Convert.ToUInt32(Hook.Get(_voidCoins, actor.Master) ?? ((object)0)); } catch { return 0u; } } public static void SetVoidCoins(Actor actor, uint amount) { if (actor != null && actor.Master != null && !(_voidCoins == null) && !CoOp.AskHost("slipstream_void " + NetId(actor) + " " + amount)) { Hook.Set(_voidCoins, actor.Master, amount); LastActionMessage = "Set Void coins to " + amount + " for " + actor.Name + "."; } } public static uint GetLunar(Actor actor) { if (actor == null || actor.NetworkUser == null || _lunarCoins == null) { return 0u; } try { return Convert.ToUInt32(Hook.Get(_lunarCoins, actor.NetworkUser) ?? ((object)0)); } catch { return 0u; } } public static void AwardLunar(Actor actor, uint amount) { if (actor != null && actor.NetworkUser != null && !CoOp.AskHost("slipstream_lunar " + NetId(actor) + " " + amount)) { if (_awardLunar != null) { Hook.Call(_awardLunar, actor.NetworkUser, amount); } else if (_lunarCoins != null) { uint lunar = GetLunar(actor); Hook.Set(_lunarCoins, actor.NetworkUser, lunar + amount); } LastActionMessage = "Awarded " + amount + " lunar coins to " + actor.Name + "."; } } public static void GiveExperience(uint amount) { object obj = ((_teamManagerInstance != null) ? Hook.Get(_teamManagerInstance, null) : null); if (obj == null || _giveTeamExp == null) { LastActionMessage = "Team XP could not be applied (TeamManager missing)."; return; } if (_giveTeamExp.GetParameters().Length == 2) { Hook.Call(_giveTeamExp, obj, IndexValue.FromInt(TTeamIndex, 1), amount); } else { Hook.Call(_giveTeamExp, obj, IndexValue.FromInt(TTeamIndex, 1), (ulong)amount, true); } LastActionMessage = "Gave " + amount + " team XP."; } public static void QueuePlayer(Action action) { if (action != null) { _pendingPlayer.Add(action); } } public static void DrainPendingPlayer() { if (_pendingPlayer.Count == 0) { return; } Action[] array = _pendingPlayer.ToArray(); _pendingPlayer.Clear(); Action[] array2 = array; foreach (Action action in array2) { try { action(); } catch (Exception ex) { LastActionMessage = "Player action failed: " + ex.Message; Log.Warn(LastActionMessage); } } } public static void QueueGive(Actor actor, int itemIndex, int count) { if (actor != null && count != 0) { _pendingGives.Add(new PendingGive { ActorId = actor.Id, NetId = NetId(actor), ItemIndex = itemIndex, Count = count }); } } public static void DrainPendingGive() { if (_pendingGives.Count == 0) { return; } PendingGive[] array = _pendingGives.ToArray(); _pendingGives.Clear(); PendingGive[] array2 = array; for (int i = 0; i < array2.Length; i++) { PendingGive pendingGive = array2[i]; Actor actor = FindPlayer(pendingGive.ActorId) ?? FindByNetId(pendingGive.NetId); if (actor == null && pendingGive.NetId == 0) { actor = LocalActor(); } GiveItem(actor, pendingGive.ItemIndex, pendingGive.Count); } } public static void GiveItem(Actor actor, int itemIndex, int count) { if (actor == null || count == 0) { return; } if (!IsServer) { uint num = NetId(actor); if (num != 0) { CoOp.Submit("slipstream_item " + num + " " + itemIndex + " " + count); LastActionMessage = "Asked the host to grant ×" + count + "."; return; } if (!actor.IsLocal) { LastActionMessage = "Could not reach that player. Need a netId and the host running SlipStream."; return; } } GiveItemLocal(actor, itemIndex, count); } public static void GiveItemLocal(Actor actor, int itemIndex, int count) { object obj = InventoryOf(actor); if (obj == null) { LastActionMessage = "No inventory on " + (actor?.Name ?? "that player") + "."; Log.Warn(LastActionMessage + " master=" + UnityAlive(actor?.Master) + " body=" + UnityAlive(actor?.Body) + " TInventory=" + (TInventory != null)); } else if (count != 0) { object index = IndexValue.FromInt(TItemIndex, itemIndex); bool flag = false; if (count > 0) { flag = InvokeInventory(obj, _giveItem, index, count); } else if (_removeItem != null) { flag = InvokeInventory(obj, _removeItem, index, -count); } if (!flag) { flag = TryWriteStacks(obj, itemIndex, count); } if (flag) { Hook.Call(_onInventoryChanged, obj); LastActionMessage = ((count > 0) ? "Gave ×" : "Removed ×") + Math.Abs(count) + " to " + actor.Name + "."; Log.Info(LastActionMessage + " itemIndex=" + itemIndex); } else { LastActionMessage = "Could not change inventory (GiveItem missing)."; Log.Warn(LastActionMessage + " GiveItem=" + (_giveItem != null) + " stacks=" + (_itemStacks != null)); } } } private static object InventoryOf(Actor actor) { if (actor == null) { return null; } if (UnityAlive(actor.Inventory)) { return actor.Inventory; } object obj = null; if (UnityAlive(actor.Master)) { if (_masterInventory != null) { obj = Hook.Get(_masterInventory, actor.Master); } if (!UnityAlive(obj)) { obj = Bind(actor.Master, "inventory", "_inventory"); } if (!UnityAlive(obj)) { obj = ComponentOf(actor.Master, TInventory); } } if (!UnityAlive(obj) && UnityAlive(actor.Body)) { if (_bodyInventory != null) { obj = Hook.Get(_bodyInventory, actor.Body); } if (!UnityAlive(obj)) { obj = Bind(actor.Body, "inventory", "_inventory"); } if (!UnityAlive(obj)) { obj = ComponentOf(actor.Body, TInventory); } } if (!UnityAlive(obj) && UnityAlive(actor.Body) && !UnityAlive(actor.Master)) { object obj2 = (actor.Master = Bind(actor.Body, "master", "_master") ?? ComponentOf(Bind(actor.Body, "masterObject", "_masterObject"), TCharacterMaster)); if (UnityAlive(obj2)) { obj = Bind(obj2, "inventory", "_inventory") ?? ComponentOf(obj2, TInventory); } } actor.Inventory = (UnityAlive(obj) ? obj : null); return actor.Inventory; } private static bool InvokeInventory(object inv, MethodInfo method, object index, int count) { if (inv == null || method == null) { return false; } try { ParameterInfo[] parameters = method.GetParameters(); object obj = index; if (TItemDef != null && parameters.Length != 0 && parameters[0].ParameterType == TItemDef && _getItemDef != null) { obj = _getItemDef.Invoke(null, new object[1] { index }); } else if (parameters.Length != 0) { obj = Hook.Coerce(index, parameters[0].ParameterType); } if (parameters.Length == 1) { method.Invoke(inv, new object[1] { obj }); } else if (parameters.Length == 2) { method.Invoke(inv, new object[2] { obj, Hook.Coerce(count, parameters[1].ParameterType) }); } else { if (parameters.Length < 3) { return false; } object obj2 = null; if (parameters[2].ParameterType == typeof(bool) || parameters[2].ParameterType == typeof(bool?)) { obj2 = false; } else if (parameters[2].ParameterType.IsValueType) { obj2 = Activator.CreateInstance(parameters[2].ParameterType); } method.Invoke(inv, new object[3] { obj, Hook.Coerce(count, parameters[1].ParameterType), obj2 }); } return true; } catch (Exception ex) { Log.Warn(method.Name + " failed: " + (ex.InnerException ?? ex).Message); return false; } } private static bool TryWriteStacks(object inv, int itemIndex, int count) { if (inv == null || _itemStacks == null || itemIndex < 0) { return false; } object value = _itemStacks.GetValue(inv); if (value is int[] array) { if (itemIndex >= array.Length) { return false; } array[itemIndex] = Math.Max(0, array[itemIndex] + count); _itemStacks.SetValue(inv, array); return true; } if (value is Array array2 && itemIndex < array2.Length) { int num = Convert.ToInt32(array2.GetValue(itemIndex)); array2.SetValue(Math.Max(0, num + count), itemIndex); return true; } return false; } public static int ItemCount(Actor actor, int itemIndex) { object obj = InventoryOf(actor); if (obj == null || _getItemCount == null) { return 0; } object obj2 = Hook.Call(_getItemCount, obj, IndexValue.FromInt(TItemIndex, itemIndex)); if (obj2 != null) { return Convert.ToInt32(obj2); } return 0; } public static void ClearInventory(Actor actor) { if (actor != null && !CoOp.AskHost("slipstream_clear " + NetId(actor))) { ClearInventoryLocal(actor); } } public static void ClearInventoryLocal(Actor actor) { object obj = InventoryOf(actor); if (obj == null) { return; } foreach (CatalogItem item in Items()) { int num = ItemCount(actor, item.Index); if (num > 0 && _removeItem != null) { Hook.Call(_removeItem, obj, IndexValue.FromInt(TItemIndex, item.Index), num); } } LastActionMessage = "Cleared inventory for " + actor.Name + "."; } public static void GiveAllItems(Actor actor, int stacks) { if (actor != null && !CoOp.AskHost("slipstream_giveall " + NetId(actor) + " " + stacks)) { GiveAllItemsLocal(actor, stacks); } } public static void GiveAllItemsLocal(Actor actor, int stacks) { bool flag = default(bool); foreach (CatalogItem item in Items()) { int num; if (item.Def != null && _itemHidden != null) { object value = _itemHidden.GetValue(item.Def); if (value is bool) { flag = (bool)value; num = 1; } else { num = 0; } } else { num = 0; } if (((uint)num & (flag ? 1u : 0u)) == 0) { GiveItemLocal(actor, item.Index, stacks); } } LastActionMessage = "Gave all items ×" + stacks + " to " + actor.Name + "."; } public static void SetEquipment(Actor actor, int equipmentIndex) { if (actor != null && !CoOp.AskHost("slipstream_equip " + NetId(actor) + " " + equipmentIndex)) { SetEquipmentLocal(actor, equipmentIndex); } } public static void SetEquipmentLocal(Actor actor, int equipmentIndex) { object obj = InventoryOf(actor); if (obj != null && !(_setEquipment == null)) { object obj2 = IndexValue.FromInt(TEquipmentIndex, equipmentIndex); if (_setEquipment.GetParameters().Length == 1) { Hook.Call(_setEquipment, obj, obj2); } else { Hook.Call(_setEquipment, obj, obj2, false); } } } public static void SetBuff(Actor actor, int buffIndex, int count) { if (actor != null && !CoOp.AskHost("slipstream_buff " + NetId(actor) + " " + buffIndex + " " + count)) { SetBuffLocal(actor, buffIndex, count); } } public static void SetBuffLocal(Actor actor, int buffIndex, int count) { if (actor == null || actor.Body == null) { return; } object obj = IndexValue.FromInt(TBuffIndex, buffIndex); if (_setBuffCount != null) { Hook.Call(_setBuffCount, actor.Body, obj, count); } else if (count > 0 && _addTimedBuff != null) { if (_addTimedBuff.GetParameters().Length == 2) { Hook.Call(_addTimedBuff, actor.Body, obj, 60f); } else { Hook.Call(_addTimedBuff, actor.Body, obj, count, 60f); } } } public static void Kill(object body) { if (body == null) { return; } object obj = ((_bodyHealth != null) ? Hook.Get(_bodyHealth, body) : null); if (obj == null) { Component val = (Component)((body is Component) ? body : null); if (val != null && THealthComponent != null) { obj = val.GetComponent(THealthComponent); } } if (obj != null && _suicide != null) { if (_suicide.GetParameters().Length == 0) { Hook.Call(_suicide, obj); } else { Hook.Call(_suicide, obj, null, null, null); } } } public static void KillAllMobs() { int num = 0; foreach (object item in Bodies()) { if (TeamOf(item) != 1) { Kill(item); num++; } } LastActionMessage = "Killed " + num + " non-player bodies."; Log.Info(LastActionMessage); } public static void Revive(Actor actor) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_009b: 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) if (actor == null || actor.Master == null || CoOp.AskHost("slipstream_revive " + NetId(actor))) { return; } Vector3 val = (Object.op_Implicit((Object)(object)actor.Transform) ? actor.Transform.position : Vector3.zero); Quaternion val2 = (Object.op_Implicit((Object)(object)actor.Transform) ? actor.Transform.rotation : Quaternion.identity); if (_respawnAt != null) { if (_respawnAt.GetParameters().Length == 2) { Hook.Call(_respawnAt, actor.Master, val, val2); } else { Hook.Call(_respawnAt, actor.Master, val, val2, true); } } else if (_respawn != null) { Hook.Call(_respawn, actor.Master); } LastActionMessage = "Revived " + actor.Name + "."; } public static void Teleport(Actor actor, Vector3 position) { //IL_002c: 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) if (actor != null && actor.Body != null) { if (_teleportBody != null) { Hook.Call(_teleportBody, actor.Body, position); } else if (Object.op_Implicit((Object)(object)actor.Transform)) { actor.Transform.position = position; } } } public static void SpawnAs(Actor actor, GameObject bodyPrefab) { SpawnAsBody(actor, bodyPrefab); } public static void SpawnAsSurvivor(Actor actor, object survivorDef) { GameObject val = BodyPrefabOf(survivorDef); if (!Object.op_Implicit((Object)(object)val)) { object obj = ((survivorDef is Object) ? survivorDef : null); LastActionMessage = "Could not resolve a body prefab for " + (((obj != null) ? ((Object)obj).name : null) ?? "that survivor") + "."; Log.Warn(LastActionMessage); } else { SpawnAsBody(actor, val); } } public static void SpawnAsNamed(Actor actor, string bodyName) { SpawnAsBody(actor, FindBodyPrefab(bodyName)); } private static void SpawnAsBody(Actor actor, GameObject prefab) { if (actor == null || actor.Master == null) { LastActionMessage = "No player master to spawn as."; Log.Warn(LastActionMessage); } else if (!Object.op_Implicit((Object)(object)prefab)) { LastActionMessage = "Body prefab was null."; Log.Warn(LastActionMessage); } else { if (CoOp.AskHost("slipstream_spawnas " + NetId(actor) + " " + ((Object)prefab).name)) { return; } Log.Info("Spawn as " + ((Object)prefab).name + " on " + actor.Name + "."); bool flag = false; if (_transformBody != null) { try { ParameterInfo[] parameters = _transformBody.GetParameters(); if (parameters.Length == 1 && parameters[0].ParameterType == typeof(string)) { Hook.Call(_transformBody, actor.Master, ((Object)prefab).name); flag = true; } else if (parameters.Length == 1) { Hook.Call(_transformBody, actor.Master, Hook.Coerce(prefab, parameters[0].ParameterType)); flag = true; } } catch (Exception ex) { Log.Warn("TransformBody failed: " + (ex.InnerException ?? ex).Message); } } if (!flag) { if (_masterBodyPrefab != null) { Hook.Set(_masterBodyPrefab, actor.Master, prefab); } else if (_masterBodyPrefabField != null) { _masterBodyPrefabField.SetValue(actor.Master, prefab); } Revive(actor); } LastActionMessage = "Spawning as " + ((Object)prefab).name + "."; if (Session.ForcedTeam != int.MinValue) { ApplyTeamLocal(actor.IsLocal ? (LocalActor() ?? actor) : actor, Session.ForcedTeam); } } } public static string BodyDisplayName(Actor actor) { if (actor == null || actor.Body == null) { return null; } string text = ((_bodyNameToken != null) ? (Hook.Get(_bodyNameToken, actor.Body) as string) : null); string text2 = Localize(text); if (string.IsNullOrEmpty(text2) || text2 == text) { object body = actor.Body; object obj = ((body is Component) ? body : null); text2 = ((obj != null) ? ((Object)obj).name : null); } if (!string.IsNullOrEmpty(text2)) { return text2; } return actor.Name; } public static int CurrentSkinIndex(Actor actor) { if (actor == null || actor.Body == null) { return -1; } Component val = ModelSkinOf(actor); if ((Object)(object)val != (Object)null && _mscCurrentSkin != null) { return IndexValue.ToInt(Hook.Get(_mscCurrentSkin, val)); } if (_bodySkinIndex != null) { return IndexValue.ToInt(Hook.Get(_bodySkinIndex, actor.Body)); } return -1; } public static List SkinsFor(Actor actor) { List list = new List(); Array array = SkinArray(actor); if (array == null) { return list; } for (int i = 0; i < array.Length; i++) { object obj = null; try { obj = array.GetValue(i); } catch { continue; } if (obj != null) { list.Add(new CatalogItem { Index = i, Def = obj, Name = SkinDisplayName(obj, i) }); } } return list; } public static void QueueSkin(Actor actor, int skinIndex) { if (actor != null && actor.Body != null && skinIndex >= 0) { Session.PendingSkinActorId = actor.Id; Session.PendingSkinIndex = skinIndex; } } public static void DrainPendingSkin() { if (Session.PendingSkinIndex >= 0 && !SkinBusy) { int pendingSkinActorId = Session.PendingSkinActorId; int pendingSkinIndex = Session.PendingSkinIndex; Session.PendingSkinIndex = -1; ApplySkin(FindPlayer(pendingSkinActorId) ?? LocalActor(), pendingSkinIndex); } } public static void ApplySkin(Actor actor, int skinIndex) { if (actor == null || actor.Body == null || skinIndex < 0 || SkinBusy) { return; } Array array = SkinArray(actor); if (array == null || skinIndex >= array.Length) { Log.Warn("No skins array for this body."); return; } Component val = ModelSkinOf(actor); if ((Object)(object)val == (Object)null) { Log.Warn("No ModelSkinController on this body."); return; } _skinBusy = true; _skinBusyUntil = Time.unscaledTime + 12f; Log.Info("Applying skin " + skinIndex + " on " + actor.Name + "."); SlipstreamPlugin.Run(ApplySkinRoutine(actor, skinIndex, val)); } private static IEnumerator ApplySkinRoutine(Actor actor, int skinIndex, object msc) { yield return null; object started = null; try { started = InvokeApplySkinAsync(msc, skinIndex); } catch (Exception ex) { Log.Warn("ApplySkinAsync threw: " + (ex.InnerException ?? ex).Message); } if (started == null) { Log.Warn("ApplySkinAsync did not start. SkinDef.Apply was not used."); _skinBusy = false; yield break; } Log.Info("ApplySkinAsync started for skin " + skinIndex + " (" + started.GetType().Name + ")."); if (started is IEnumerator routine) { float until = Time.unscaledTime + 12f; while (routine.MoveNext() && !(Time.unscaledTime > until)) { yield return routine.Current; } } else { IEnumerator pump = UniTaskToCoroutine(started); float until = Time.unscaledTime + 10f; if (pump != null) { while (pump.MoveNext() && !(Time.unscaledTime > until)) { yield return pump.Current; } } else { ForgetUniTask(started); while (Time.unscaledTime < until && !UniTaskCompleted(started)) { yield return null; } } } WriteSkinLoadout(actor, skinIndex); if (IsServer) { PushLoadout(actor); } else { CoOp.Submit("slipstream_skin " + NetId(actor) + " " + skinIndex); } _skinBusy = false; Log.Info("Skin " + skinIndex + " apply finished."); } private static void PushLoadout(Actor actor) { if (actor == null || actor.Master == null || _setLoadoutServer == null) { return; } try { object obj = ((_masterLoadout != null) ? Hook.Get(_masterLoadout, actor.Master) : Bind(actor.Master, "loadout", "_loadout")); if (obj != null) { Hook.Call(_setLoadoutServer, actor.Master, obj); } } catch (Exception ex) { Log.Warn("SetLoadoutServer skipped: " + ex.Message); } } private static object InvokeApplySkinAsync(object msc, int skinIndex) { if (msc == null || TModelSkinController == null) { return null; } MethodInfo methodInfo = null; MethodInfo methodInfo2 = null; MethodInfo[] methods = TModelSkinController.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); foreach (MethodInfo methodInfo3 in methods) { if (methodInfo3.Name != "ApplySkinAsync" || methodInfo3.IsGenericMethod) { continue; } ParameterInfo[] parameters = methodInfo3.GetParameters(); if (parameters.Length >= 1 && parameters.Length <= 2) { if (typeof(IEnumerator).IsAssignableFrom(methodInfo3.ReturnType)) { methodInfo = methodInfo3; } else { methodInfo2 = methodInfo3; } } } MethodInfo methodInfo4 = methodInfo ?? methodInfo2 ?? _applySkinAsync; if (methodInfo4 == null) { return null; } try { object[] array = ArgsForApplySkinAsync(methodInfo4, skinIndex); if (array == null) { return null; } Log.Info("Invoking " + methodInfo4); return methodInfo4.Invoke(msc, array); } catch (Exception ex) { Log.Warn("ApplySkinAsync failed: " + (ex.InnerException ?? ex).Message); return null; } } private static object[] ArgsForApplySkinAsync(MethodInfo method, int skinIndex) { ParameterInfo[] parameters = method.GetParameters(); if (parameters.Length < 1 || parameters.Length > 2) { return null; } object[] array = new object[parameters.Length]; for (int i = 0; i < parameters.Length; i++) { Type parameterType = parameters[i].ParameterType; if (parameterType == typeof(int) || parameterType == typeof(uint) || (parameterType.IsEnum && parameterType.Name.IndexOf("Unload", StringComparison.OrdinalIgnoreCase) < 0)) { array[i] = Hook.Coerce(skinIndex, parameterType); } else if (parameterType.IsEnum) { array[i] = ParseNamedEnum(parameterType, "OnRunEnd", "AtWill", "OnSceneUnload"); } else if (parameterType.IsValueType) { array[i] = Activator.CreateInstance(parameterType); } else { array[i] = null; } } return array; } private static object ParseNamedEnum(Type type, params string[] names) { if (type == null || !type.IsEnum) { return null; } foreach (string value in names) { try { return Enum.Parse(type, value); } catch { } } return Enum.ToObject(type, 0); } private static void ForgetUniTask(object task) { if (task == null) { return; } Type type = task.GetType(); string[] array = new string[2] { "Cysharp.Threading.Tasks.UniTaskExtensions", "Cysharp.Threading.Tasks.UniTask" }; for (int i = 0; i < array.Length; i++) { Type type2 = Hook.Type(array[i]); if (type2 == null) { continue; } MethodInfo[] methods = type2.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { if (methodInfo.Name != "Forget") { continue; } try { MethodInfo methodInfo2 = (methodInfo.IsGenericMethod ? methodInfo.MakeGenericMethod(type) : methodInfo); if (methodInfo2.GetParameters().Length == 1) { methodInfo2.Invoke(null, new object[1] { task }); return; } } catch { } } } } private static IEnumerator UniTaskToCoroutine(object task) { if (task == null) { yield break; } IEnumerator inner = null; Type type = task.GetType(); Type type2 = Hook.Type("Cysharp.Threading.Tasks.UniTaskExtensions"); if (type2 != null) { MethodInfo[] methods = type2.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { if (methodInfo.Name != "ToCoroutine" || methodInfo.GetParameters().Length != 1) { continue; } try { MethodInfo methodInfo2 = methodInfo; if (!methodInfo.IsGenericMethod) { goto IL_00b6; } if (!type.IsGenericType) { continue; } methodInfo2 = methodInfo.MakeGenericMethod(type.GetGenericArguments()); goto IL_00b6; IL_00b6: if (methodInfo2.Invoke(null, new object[1] { task }) is IEnumerator enumerator) { inner = enumerator; break; } } catch (Exception ex) { Log.Warn("ToCoroutine skipped: " + (ex.InnerException ?? ex).Message); } } } if (inner != null) { while (inner.MoveNext()) { yield return inner.Current; } yield break; } ForgetUniTask(task); float until = Time.unscaledTime + 10f; while (Time.unscaledTime < until && !UniTaskCompleted(task)) { yield return null; } } private static bool UniTaskCompleted(object task) { if (task == null) { return true; } object obj = Hook.Get(Hook.Member(task.GetType(), "Status", "status"), task); if (obj == null) { return false; } try { return Convert.ToInt32(obj) != 0; } catch { return false; } } private static string SkinDisplayName(object def, int index) { string text = ((_skinNameToken != null) ? (_skinNameToken.GetValue(def) as string) : null); string text2 = Localize(text); if (string.IsNullOrEmpty(text2) || text2 == text) { object obj = ((def is Object) ? def : null); text2 = ((obj != null) ? ((Object)obj).name : null); } if (!string.IsNullOrEmpty(text2)) { return text2; } return "Skin " + index; } private static object BodyIndexOf(Actor actor) { if (actor == null || actor.Body == null || _bodyIndex == null) { return null; } return Hook.Get(_bodyIndex, actor.Body); } private static Component ModelSkinOf(Actor actor) { object obj = actor?.Body; Component val = (Component)((obj is Component) ? obj : null); if (!Object.op_Implicit((Object)(object)val)) { return null; } if (TModelLocator != null) { Component component = val.GetComponent(TModelLocator); if (Object.op_Implicit((Object)(object)component)) { object obj2 = Bind(component, "modelTransform", "_modelTransform"); Transform val2 = (Transform)((obj2 is Transform) ? obj2 : null); if (Object.op_Implicit((Object)(object)val2) && TModelSkinController != null) { Component component2 = ((Component)val2).GetComponent(TModelSkinController); if (Object.op_Implicit((Object)(object)component2)) { return component2; } } } } if (TModelSkinController != null) { Component componentInChildren = val.GetComponentInChildren(TModelSkinController, true); if (Object.op_Implicit((Object)(object)componentInChildren)) { return componentInChildren; } } return null; } private static Array SkinArray(Actor actor) { Component val = ModelSkinOf(actor); if ((Object)(object)val != (Object)null && _mscSkins != null && _mscSkins.GetValue(val) is Array { Length: >0 } array) { return array; } object obj = BodyIndexOf(actor); if (obj == null) { return null; } if (_getBodySkins != null) { try { ParameterInfo[] parameters = _getBodySkins.GetParameters(); object obj2 = obj; if (parameters.Length == 1) { obj2 = Hook.Coerce(obj, parameters[0].ParameterType); } if (_getBodySkins.Invoke(null, new object[1] { obj2 }) is Array { Length: >0 } array2) { return array2; } } catch { } } if (_catalogSkins?.GetValue(null) is Array array3) { try { int num = IndexValue.ToInt(obj); if (num >= 0 && num < array3.Length && array3.GetValue(num) is Array { Length: >0 } array4) { return array4; } } catch { } } return null; } private static void WriteSkinLoadout(Actor actor, int skinIndex) { if (actor.Master == null) { return; } try { object obj = ((_masterLoadout != null) ? Hook.Get(_masterLoadout, actor.Master) : Bind(actor.Master, "loadout", "_loadout")); object obj2 = ((obj != null && _loadoutBodyManager != null) ? _loadoutBodyManager.GetValue(obj) : null); object obj3 = BodyIndexOf(actor); if (obj2 != null && obj3 != null && _setSkinIndex != null) { TryInvoke(_setSkinIndex, obj2, obj3, skinIndex); } } catch (Exception ex) { Log.Warn("Could not write skin loadout: " + ex.Message); } } private static bool TryInvoke(MethodInfo method, object target, params object[] args) { return TryInvokeResult(method, target, args) != Missing.Value; } private static object TryInvokeResult(MethodInfo method, object target, params object[] args) { if (method == null) { return Missing.Value; } try { ParameterInfo[] parameters = method.GetParameters(); if (parameters.Length != args.Length) { return Missing.Value; } object[] array = new object[args.Length]; for (int i = 0; i < args.Length; i++) { array[i] = Hook.Coerce(args[i], parameters[i].ParameterType); } return method.Invoke(target, array) ?? ((object)true); } catch { return Missing.Value; } } public static void SetSpawnsDisabled(bool disabled) { Session.DisableSpawns = disabled; if (_directorCombatDisableField != null) { object value = _directorCombatDisableField.GetValue(null); if (value != null) { Hook.Set(Hook.Member(value.GetType(), "value"), value, disabled); } } } public static object Teleporter() { if (!(_teleporterInstance != null)) { return null; } return Hook.Get(_teleporterInstance, null); } public static void ChargeTeleporter() { object obj = Teleporter(); if (obj == null || _tpHoldout == null) { return; } object obj2 = Hook.Get(_tpHoldout, obj); if (obj2 != null) { if (_holdoutCharge != null) { Hook.Set(_holdoutCharge, obj2, 1f); } PropertyInfo propertyInfo = Hook.Prop(obj2.GetType(), "charge"); if (propertyInfo != null) { Hook.Set(propertyInfo, obj2, 1f); } } } public static void AddMountain() { object obj = Teleporter(); if (obj != null && !(_tpShrineStacks == null)) { int num = Convert.ToInt32(_tpShrineStacks.GetValue(obj) ?? ((object)0)); _tpShrineStacks.SetValue(obj, num + 1); } } public static void EnablePortal(string kind) { object obj = Teleporter(); if (obj == null || kind == null) { return; } switch (kind.Length) { case 4: switch (kind[0]) { case 'n': if (!(kind == "newt")) { break; } goto IL_00b6; case 's': if (!(kind == "shop")) { break; } goto IL_00b6; case 'b': if (!(kind == "blue")) { break; } goto IL_00b6; case 'g': { if (kind == "gold" && _tpGold != null) { _tpGold.SetValue(obj, true); } break; } IL_00b6: if (_tpShop != null) { _tpShop.SetValue(obj, true); } break; } break; case 9: if (!(kind == "celestial")) { break; } goto IL_00fa; case 2: if (!(kind == "ms")) { break; } goto IL_00fa; case 3: { if (kind == "all") { if (_tpShop != null) { _tpShop.SetValue(obj, true); } if (_tpGold != null) { _tpGold.SetValue(obj, true); } if (_tpCelestial != null) { _tpCelestial.SetValue(obj, true); } } break; } IL_00fa: if (_tpCelestial != null) { _tpCelestial.SetValue(obj, true); } break; } } public static void SkipStage(string sceneName) { object runInstance = RunInstance; if (runInstance != null && !(_advanceStage == null)) { object obj = null; if (!string.IsNullOrEmpty(sceneName) && _findSceneDef != null) { obj = Hook.Call(_findSceneDef, null, sceneName); } if (obj == null && _getSceneDef != null) { obj = Hook.Call(_getSceneDef, null); } if (obj != null) { Hook.Call(_advanceStage, runInstance, obj); } } } public static void SpawnCardAt(object spawnCard, Vector3 position, int teamIndex, bool braindead, int eliteIndex) { //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) if (spawnCard == null || _spawnCardDoSpawn == null) { return; } object obj = null; if (TDirectorPlacementRule != null) { obj = Activator.CreateInstance(TDirectorPlacementRule); if (_placementMode != null && _directPlacementMode != null) { _placementMode.SetValue(obj, _directPlacementMode); } if (_placementPosition != null) { _placementPosition.SetValue(obj, position); } } object obj2 = null; MemberInfo memberInfo = Hook.Member(TRoR2Application, "rng"); if (memberInfo != null) { obj2 = Hook.Get(memberInfo, null); } object obj3 = null; if (TDirectorSpawnRequest != null) { try { obj3 = Activator.CreateInstance(TDirectorSpawnRequest, spawnCard, obj, obj2); } catch { obj3 = Activator.CreateInstance(TDirectorSpawnRequest); } if (_spawnRequestTeam != null && TTeamIndex != null) { _spawnRequestTeam.SetValue(obj3, IndexValue.FromInt(TTeamIndex, teamIndex)); } if (_spawnRequestIgnoreLimit != null) { _spawnRequestIgnoreLimit.SetValue(obj3, true); } } object obj5 = Hook.Call(_spawnCardDoSpawn, spawnCard, position, Quaternion.identity, obj3); object obj6 = obj5; if (obj5 != null && obj5.GetType() != typeof(GameObject)) { MemberInfo memberInfo2 = Hook.Member(obj5.GetType(), "spawnedInstance"); obj6 = ((memberInfo2 != null) ? Hook.Get(memberInfo2, obj5) : null); } GameObject val = (GameObject)((obj6 is GameObject) ? obj6 : null); if ((Object)(object)val == (Object)null) { return; } if (_networkServerSpawn != null) { Hook.Call(_networkServerSpawn, null, val); } Component val2 = ((TCharacterMaster != null) ? val.GetComponent(TCharacterMaster) : null); if ((Object)(object)val2 == (Object)null) { return; } if (braindead && TBaseAI != null) { Component[] componentsInChildren = val.GetComponentsInChildren(TBaseAI); for (int i = 0; i < componentsInChildren.Length; i++) { Object.Destroy((Object)(object)componentsInChildren[i]); } } if (eliteIndex < 0) { return; } object elite = GetElite(eliteIndex); if (elite == null || !(_eliteEquipment != null)) { return; } object value = _eliteEquipment.GetValue(elite); if (value == null) { return; } MemberInfo memberInfo3 = Hook.Member(value.GetType(), "equipmentIndex"); object obj7 = ((memberInfo3 != null) ? Hook.Get(memberInfo3, value) : null); object obj8 = Bind(val2, "inventory", "_inventory") ?? ComponentOf(val2, TInventory); if (obj8 != null && obj7 != null && _setEquipment != null) { if (_setEquipment.GetParameters().Length == 1) { Hook.Call(_setEquipment, obj8, obj7); } else { Hook.Call(_setEquipment, obj8, obj7, false); } } } public static void SpawnPrefabNamed(string[] names, Vector3 position) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) GameObject[] array = Resources.FindObjectsOfTypeAll(); foreach (GameObject val in array) { if ((Object)(object)val == (Object)null) { continue; } Scene scene = val.scene; if (((Scene)(ref scene)).IsValid()) { scene = val.scene; if (!string.IsNullOrEmpty(((Scene)(ref scene)).name)) { continue; } } foreach (string value in names) { if (((Object)val).name.Equals(value, StringComparison.OrdinalIgnoreCase) || ((Object)val).name.StartsWith(value, StringComparison.OrdinalIgnoreCase)) { GameObject val2 = Object.Instantiate(val, position, Quaternion.identity); if (_networkServerSpawn != null) { Hook.Call(_networkServerSpawn, null, val2); } return; } } } } public static void Kick(Actor actor) { if (actor == null || actor.NetworkUser == null || TNetworkManagerSystem == null) { return; } MemberInfo memberInfo = Hook.Member(TNetworkManagerSystem, "singleton"); object obj = ((memberInfo != null) ? Hook.Get(memberInfo, null) : null); MemberInfo memberInfo2 = Hook.Member(actor.NetworkUser.GetType(), "connectionToClient"); object obj2 = ((memberInfo2 != null) ? Hook.Get(memberInfo2, actor.NetworkUser) : null); if (obj == null || obj2 == null || _serverKick == null) { return; } if (_serverKick.GetParameters().Length == 1) { Hook.Call(_serverKick, obj, obj2); return; } object obj3 = null; Type type = Hook.Type("RoR2.Networking.NetworkManagerSystem+SimpleLocalizedKickReason"); if (type != null) { try { obj3 = Activator.CreateInstance(type, "KICK_REASON_KICK"); } catch { obj3 = Activator.CreateInstance(type); } } Hook.Call(_serverKick, obj, obj2, obj3); } public static void Ban(Actor actor) { if (actor != null && actor.NetworkUser != null && !(TNetworkManagerSystem == null)) { MemberInfo memberInfo = Hook.Member(TNetworkManagerSystem, "singleton"); object obj = ((memberInfo != null) ? Hook.Get(memberInfo, null) : null); MemberInfo memberInfo2 = Hook.Member(actor.NetworkUser.GetType(), "connectionToClient"); object obj2 = ((memberInfo2 != null) ? Hook.Get(memberInfo2, actor.NetworkUser) : null); if (obj != null && obj2 != null && !(_serverBan == null)) { Hook.Call(_serverBan, obj, obj2); } } } public static void SetMenuCursor(bool open) { if (!open) { Menu.PointerOverMenu = false; } ApplyCursor(open); } public static void PumpCursor() { if (Session.MenuOpen) { ApplyCursor(show: true); } } private static void ApplyCursor(bool show) { Cursor.visible = show; Cursor.lockState = (CursorLockMode)(!show); } public static void SwallowMenuMouse() { if (!Ready || !Session.MenuOpen || !Menu.PointerOverMenu) { return; } Actor actor = LocalActor(); if (actor == null || actor.InputBank == null) { return; } EnsureMouseSkillFields(actor.InputBank.GetType()); if (_mouseSkillFields == null) { return; } FieldInfo[] mouseSkillFields = _mouseSkillFields; foreach (FieldInfo fieldInfo in mouseSkillFields) { if (fieldInfo == null) { continue; } object value = fieldInfo.GetValue(actor.InputBank); if (value != null) { if (_buttonDown != null) { _buttonDown.SetValue(value, false); } if (_buttonWasDown != null) { _buttonWasDown.SetValue(value, false); } fieldInfo.SetValue(actor.InputBank, value); } } } private static void EnsureMouseSkillFields(Type inputBank) { if (_mouseSkillFields != null || inputBank == null) { return; } _mouseSkillFields = new FieldInfo[2] { inputBank.GetField("skill1", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic), inputBank.GetField("skill2", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic) }; FieldInfo[] mouseSkillFields = _mouseSkillFields; foreach (FieldInfo fieldInfo in mouseSkillFields) { if (!(fieldInfo == null)) { _buttonDown = fieldInfo.FieldType.GetField("down", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); _buttonWasDown = fieldInfo.FieldType.GetField("wasDown", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); break; } } } public static List Items() { List list = Catalog(_itemCount, _getItemDef, TItemIndex, _itemNameToken, TItemDef); for (int num = list.Count - 1; num >= 0; num--) { FillItemCard(list[num]); if (list[num].Hidden || string.IsNullOrEmpty(list[num].Name)) { list.RemoveAt(num); } } list.Sort((CatalogItem a, CatalogItem b) => string.Compare(a.Name, b.Name, StringComparison.OrdinalIgnoreCase)); return list; } private static void FillItemCard(CatalogItem item) { //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) if (item == null || item.Def == null) { return; } if (_itemHidden != null && _itemHidden.GetValue(item.Def) is bool hidden) { item.Hidden = hidden; } MemberInfo memberInfo = Hook.Member(item.Def.GetType(), "itemIndex"); if (memberInfo != null) { int num = IndexValue.ToInt(Hook.Get(memberInfo, item.Def)); if (num >= 0) { item.Index = num; } } string text = ReadToken(item.Def, _itemPickupToken); if (string.IsNullOrEmpty(text)) { text = ReadToken(item.Def, _itemDescToken); } item.Pickup = FirstSentence(StripRichText(text)); item.IconColor = TierColor(item.Def); } private static string ReadToken(object def, MemberInfo member) { if (def == null || member == null) { return null; } string text = Hook.Get(member, def) as string; string text2 = Localize(text); if (string.IsNullOrEmpty(text2) || text2 == text) { return null; } return text2; } private static string StripRichText(string text) { if (string.IsNullOrEmpty(text)) { return ""; } StringBuilder stringBuilder = new StringBuilder(text.Length); bool flag = false; foreach (char c in text) { switch (c) { case '<': flag = true; continue; case '>': flag = false; continue; } if (!flag) { stringBuilder.Append((c == '\n' || c == '\r') ? ' ' : c); } } return stringBuilder.ToString().Trim(); } private static string FirstSentence(string text) { if (string.IsNullOrEmpty(text)) { return ""; } int num = text.IndexOf(". ", StringComparison.Ordinal); if (num >= 8 && num < 160) { return text.Substring(0, num + 1); } if (text.Length > 160) { return text.Substring(0, 157).TrimEnd() + "..."; } return text; } private static Color TierColor(object def) { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) int num = 0; if (def != null && _itemTier != null) { num = IndexValue.ToInt(_itemTier.GetValue(def)); } return (Color)(num switch { 1 => new Color(0.78f, 0.8f, 0.84f, 1f), 2 => new Color(0.35f, 0.78f, 0.42f, 1f), 3 => new Color(0.9f, 0.32f, 0.32f, 1f), 4 => new Color(0.45f, 0.7f, 0.95f, 1f), 5 => new Color(0.95f, 0.78f, 0.28f, 1f), 6 => new Color(0.72f, 0.38f, 0.9f, 1f), 7 => new Color(0.62f, 0.28f, 0.82f, 1f), 8 => new Color(0.55f, 0.22f, 0.72f, 1f), _ => new Color(0.18f, 0.22f, 0.26f, 1f), }); } public static void DrawItemIcon(Rect rect, CatalogItem item) { //IL_002d: 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_0022: 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_0045: Unknown result type (might be due to invalid IL or missing references) ResolveItemIcon(item); if ((Object)(object)item?.Icon != (Object)null) { GUI.DrawTextureWithTexCoords(rect, item.Icon, item.IconUv); } else { Theme.DrawRect(rect, (Color)(((??)item?.IconColor) ?? new Color(0.18f, 0.22f, 0.26f, 1f))); } } private static void ResolveItemIcon(CatalogItem item) { //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) if (item == null || item.IconResolved || item.Def == null) { return; } item.IconResolved = true; try { object obj = ReadIconAsset(item.Def); Sprite val = (Sprite)((obj is Sprite) ? obj : null); if (val != null && (Object)(object)val.texture != (Object)null) { Texture2D texture = val.texture; Rect textureRect = val.textureRect; item.Icon = (Texture)(object)texture; if (((Texture)texture).width > 0 && ((Texture)texture).height > 0 && ((Rect)(ref textureRect)).width > 0f && ((Rect)(ref textureRect)).height > 0f) { item.IconUv = new Rect(((Rect)(ref textureRect)).x / (float)((Texture)texture).width, ((Rect)(ref textureRect)).y / (float)((Texture)texture).height, ((Rect)(ref textureRect)).width / (float)((Texture)texture).width, ((Rect)(ref textureRect)).height / (float)((Texture)texture).height); } } else { Texture val2 = (Texture)((obj is Texture) ? obj : null); if (val2 != null) { item.Icon = val2; item.IconUv = new Rect(0f, 0f, 1f, 1f); } } } catch { } } private static object ReadIconAsset(object def) { if (def == null) { return null; } Type type = def.GetType(); string[] array = new string[5] { "pickupIconTexture", "pickupIconSprite", "_pickupIconSprite", "pickupIconSpriteReference", "pickupIconRef" }; foreach (string text in array) { MemberInfo memberInfo = Hook.Member(type, text); if (memberInfo == null) { continue; } object obj = Hook.Get(memberInfo, def); if (obj != null) { if (obj is Sprite || obj is Texture) { return obj; } object obj2 = LoadedAddressable(obj); if (obj2 != null) { return obj2; } } } return null; } private static object LoadedAddressable(object aref) { if (aref == null) { return null; } Type type = aref.GetType(); string text = type.Name ?? ""; if (text.IndexOf("AssetReference", StringComparison.OrdinalIgnoreCase) < 0 && text.IndexOf("Addressable", StringComparison.OrdinalIgnoreCase) < 0 && text.IndexOf("AssetAsync", StringComparison.OrdinalIgnoreCase) < 0 && text.IndexOf("AssetOrDirect", StringComparison.OrdinalIgnoreCase) < 0) { object obj = Hook.Get(Hook.Member(type, "Asset", "asset", "Value", "value", "sprite", "texture"), aref); if (!(obj is Sprite) && !(obj is Texture)) { return null; } return obj; } object obj2 = Hook.Get(Hook.Member(type, "Asset", "asset", "m_CachedAsset"), aref); if (obj2 is Sprite || obj2 is Texture) { return obj2; } object obj3 = Hook.Get(Hook.Member(type, "OperationHandle", "m_Operation"), aref); if (obj3 == null) { return null; } object obj4 = Hook.Get(Hook.Member(obj3.GetType(), "IsDone", "IsValid"), obj3); if (obj4 is bool && !(bool)obj4) { return null; } object obj5 = Hook.Get(Hook.Member(obj3.GetType(), "Result", "result"), obj3); if (!(obj5 is Sprite) && !(obj5 is Texture)) { return null; } return obj5; } public static List Equipment() { return Catalog(_equipCount, _getEquipDef, TEquipmentIndex, _equipNameToken, TEquipmentDef); } public static List Buffs() { return Catalog(_buffCount, _getBuffDef, TBuffIndex, _buffNameToken, TBuffDef); } public static List Elites() { return Catalog(_eliteCount, _getEliteDef, null, _eliteNameToken, TEliteDef); } public static object GetElite(int index) { if (_getEliteDef == null) { return null; } return Hook.Call(_getEliteDef, null, IndexValue.FromInt(Hook.Type("RoR2.EliteIndex") ?? typeof(int), index)); } public static List Survivors() { List list = new List(); if (_allSurvivors == null) { return list; } if (!(_allSurvivors.Invoke(null, null) is IEnumerable enumerable)) { return list; } int num = 0; foreach (object item in enumerable) { if (item != null) { string token = ((_survivorNameToken != null) ? (_survivorNameToken.GetValue(item) as string) : null); CatalogItem obj = new CatalogItem { Index = num++, Def = item }; object obj2 = Localize(token); if (obj2 == null) { object obj3 = ((item is Object) ? item : null); obj2 = ((obj3 != null) ? ((Object)obj3).name : null) ?? "Survivor"; } obj.Name = (string)obj2; list.Add(obj); } } return list; } public static List PlayableBodies() { List result = new List(); HashSet seen = new HashSet(); HashSet survivorIds = SurvivorPrefabIds(); if (((_allBodyPrefabs != null) ? Hook.Get(_allBodyPrefabs, null) : null) is IEnumerable enumerable) { int num = 0; foreach (object item in enumerable) { Add((GameObject)((item is GameObject) ? item : null), num++); } } if (result.Count == 0 && _getBodyPrefab != null && _bodyCount != null) { int num2; try { num2 = Convert.ToInt32(_bodyCount.Invoke(null, null)); } catch { num2 = 0; } ParameterInfo[] parameters = _getBodyPrefab.GetParameters(); if (parameters.Length == 1) { for (int i = 0; i < num2; i++) { try { object? obj2 = _getBodyPrefab.Invoke(null, new object[1] { IndexValue.FromInt(parameters[0].ParameterType, i) }); Add((GameObject)((obj2 is GameObject) ? obj2 : null), i); } catch { } } } } result.Sort(delegate(CatalogItem a, CatalogItem b) { int num3 = ((!(a.Pickup == "Survivor")) ? 1 : 0); int num4 = ((!(b.Pickup == "Survivor")) ? 1 : 0); return (num3 != num4) ? (num3 - num4) : string.Compare(a.Name, b.Name, StringComparison.OrdinalIgnoreCase); }); return result; void Add(GameObject go, int index) { if (Object.op_Implicit((Object)(object)go) && seen.Add(((Object)go).GetInstanceID()) && !SkipPlayableBody(((Object)go).name)) { bool flag = survivorIds.Contains(((Object)go).GetInstanceID()); result.Add(new CatalogItem { Index = index, Def = go, Name = PrettyBodyName(go), Pickup = (flag ? "Survivor" : "Monster") }); } } } private static HashSet SurvivorPrefabIds() { HashSet hashSet = new HashSet(); foreach (CatalogItem item in Survivors()) { GameObject val = BodyPrefabOf(item.Def); if (Object.op_Implicit((Object)(object)val)) { hashSet.Add(((Object)val).GetInstanceID()); } } return hashSet; } private static bool SkipPlayableBody(string name) { if (string.IsNullOrEmpty(name)) { return true; } if (name.Equals("None", StringComparison.OrdinalIgnoreCase)) { return true; } if (name.IndexOf("Display", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } if (name.IndexOf("Logbook", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } if (name.IndexOf("Portrait", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } return false; } private static string PrettyBodyName(GameObject go) { if (!Object.op_Implicit((Object)(object)go)) { return "Body"; } string text = null; if (TCharacterBody != null) { Component val = go.GetComponent(TCharacterBody) ?? go.GetComponentInChildren(TCharacterBody, true); if ((Object)(object)val != (Object)null) { string text2 = Bind(val, "baseNameToken") as string; text = Localize(text2); if (text == text2) { text = null; } } } string text3 = ((Object)go).name; if (text3.EndsWith("Body", StringComparison.OrdinalIgnoreCase) && text3.Length > 4) { text3 = text3.Substring(0, text3.Length - 4); } if (!string.IsNullOrEmpty(text) && !text.Equals(text3, StringComparison.OrdinalIgnoreCase) && !text.Equals(((Object)go).name, StringComparison.OrdinalIgnoreCase)) { return text + " (" + ((Object)go).name + ")"; } if (!string.IsNullOrEmpty(text)) { return text; } return text3; } public static GameObject SurvivorPrefab(CatalogItem item) { return BodyPrefabOf(item?.Def); } private static GameObject BodyPrefabOf(object def) { if (def == null) { return null; } object obj = Bind(def, "bodyPrefab", "_bodyPrefab"); GameObject val = (GameObject)((obj is GameObject) ? obj : null); if (Object.op_Implicit((Object)(object)val)) { return val; } foreach (string item in PrefabNameCandidates(def)) { GameObject val2 = FindBodyPrefab(item); if (Object.op_Implicit((Object)(object)val2)) { return val2; } } return null; } private static IEnumerable PrefabNameCandidates(object def) { List names = new List(); Add(Bind(def, "bodyName", "bodyPrefabName") as string); Object val = (Object)((def is Object) ? def : null); if (val != (Object)null) { Add(val.name); if (!val.name.EndsWith("Body", StringComparison.OrdinalIgnoreCase)) { Add(val.name + "Body"); } } return names; void Add(string value) { if (!string.IsNullOrEmpty(value) && !names.Contains(value)) { names.Add(value); } } } private static GameObject FindBodyPrefab(string name) { if (string.IsNullOrEmpty(name)) { return null; } if (_findBodyPrefab != null) { try { ParameterInfo[] parameters = _findBodyPrefab.GetParameters(); if (parameters.Length == 1 && parameters[0].ParameterType == typeof(string)) { object? obj = _findBodyPrefab.Invoke(null, new object[1] { name }); GameObject val = (GameObject)((obj is GameObject) ? obj : null); if (Object.op_Implicit((Object)(object)val)) { return val; } } } catch { } } if (_findBodyIndex != null && _getBodyPrefab != null) { try { object obj3 = _findBodyIndex.Invoke(null, new object[1] { name }); if (obj3 != null) { object? obj4 = _getBodyPrefab.Invoke(null, new object[1] { Hook.Coerce(obj3, _getBodyPrefab.GetParameters()[0].ParameterType) }); GameObject val2 = (GameObject)((obj4 is GameObject) ? obj4 : null); if (Object.op_Implicit((Object)(object)val2)) { return val2; } } } catch { } } return ScanBodyCatalog(name); } private static GameObject ScanBodyCatalog(string name) { if (_getBodyPrefab == null || _bodyCount == null || string.IsNullOrEmpty(name)) { return null; } int num; try { num = Convert.ToInt32(_bodyCount.Invoke(null, null)); } catch { return null; } ParameterInfo[] parameters = _getBodyPrefab.GetParameters(); if (parameters.Length != 1) { return null; } for (int i = 0; i < num; i++) { try { object? obj2 = _getBodyPrefab.Invoke(null, new object[1] { IndexValue.FromInt(parameters[0].ParameterType, i) }); GameObject val = (GameObject)((obj2 is GameObject) ? obj2 : null); if (!Object.op_Implicit((Object)(object)val) || (!((Object)val).name.Equals(name, StringComparison.OrdinalIgnoreCase) && !((Object)val).name.Equals(name + "Body", StringComparison.OrdinalIgnoreCase) && !((Object)val).name.StartsWith(name, StringComparison.OrdinalIgnoreCase))) { continue; } return val; } catch { } } return null; } public static List Scenes() { List list = new List(); object obj = null; if (_allSceneDefs != null) { obj = _allSceneDefs.Invoke(null, null); } if (!(obj is IEnumerable enumerable)) { return list; } int num = 0; foreach (object item in enumerable) { if (item == null) { continue; } string token = ((_sceneNameToken != null) ? (_sceneNameToken.GetValue(item) as string) : null); string text = ((_sceneCachedName != null) ? (_sceneCachedName.GetValue(item) as string) : null); CatalogItem obj2 = new CatalogItem { Index = num++, Def = item }; object obj3 = Localize(token); if (obj3 == null) { obj3 = text; if (obj3 == null) { object obj4 = ((item is Object) ? item : null); obj3 = ((obj4 != null) ? ((Object)obj4).name : null); } } obj2.Name = (string?)obj3 + ((text != null) ? (" (" + text + ")") : ""); list.Add(obj2); } return list; } public static string SceneInternalName(CatalogItem item) { if (item == null || item.Def == null || _sceneCachedName == null) { return null; } return _sceneCachedName.GetValue(item.Def) as string; } public static List InteractableCards() { List list = new List(); if (TInteractableSpawnCard == null) { return list; } Object[] array = Resources.FindObjectsOfTypeAll(TInteractableSpawnCard); foreach (Object val in array) { if (val != (Object)null) { list.Add(val); } } list.Sort((Object a, Object b) => string.Compare(a.name, b.name, StringComparison.OrdinalIgnoreCase)); return list; } public static List MonsterCards() { List list = new List(); Type type = TCharacterSpawnCard ?? TSpawnCard; if (type == null) { return list; } Object[] array = Resources.FindObjectsOfTypeAll(type); foreach (Object val in array) { if (!(val == (Object)null) && (!(TInteractableSpawnCard != null) || !TInteractableSpawnCard.IsInstanceOfType(val))) { list.Add(val); } } list.Sort((Object a, Object b) => string.Compare(a.name, b.name, StringComparison.OrdinalIgnoreCase)); return list; } public static IList Tracked(Type type) { if (type == null || TInstanceTracker == null) { return null; } try { if (_instanceTrackerGet == null) { MethodInfo[] methods = TInstanceTracker.GetMethods(BindingFlags.Static | BindingFlags.Public); foreach (MethodInfo methodInfo in methods) { if (methodInfo.Name == "GetInstances" && methodInfo.IsGenericMethod) { _instanceTrackerGet = methodInfo; break; } } } if (_instanceTrackerGet == null) { return null; } return _instanceTrackerGet.MakeGenericMethod(type).Invoke(null, null) as IList; } catch { return null; } } private static List Catalog(MethodInfo countMethod, MethodInfo getDef, Type indexType, FieldInfo nameToken, Type defType) { List list = new List(); if (getDef == null) { return list; } int num = 0; if (countMethod != null) { try { num = Convert.ToInt32(countMethod.Invoke(null, null)); } catch { num = 0; } } if (num <= 0) { num = 200; } for (int i = 0; i < num; i++) { object obj2 = null; try { object obj3 = ((indexType != null) ? IndexValue.FromInt(indexType, i) : ((object)i)); obj2 = getDef.Invoke(null, new object[1] { obj3 }); } catch { continue; } if (obj2 != null) { string text = ((nameToken != null) ? (nameToken.GetValue(obj2) as string) : null); string text2 = Localize(text); if (string.IsNullOrEmpty(text2) || text2 == text) { object obj5 = ((obj2 is Object) ? obj2 : null); text2 = ((obj5 != null) ? ((Object)obj5).name : null) ?? ("#" + i); } list.Add(new CatalogItem { Index = i, Def = obj2, Name = text2 }); } } return list; } } internal static class Hook { public const BindingFlags Any = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; public static Type Type(string name) { if (string.IsNullOrEmpty(name)) { return null; } Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly in assemblies) { Type type = null; try { type = assembly.GetType(name, throwOnError: false); } catch { } if (type != null) { return type; } } return null; } public static FieldInfo Field(Type type, params string[] names) { if (type == null || names == null) { return null; } foreach (string name in names) { Type type2 = type; while (type2 != null && type2 != typeof(object)) { FieldInfo field = type2.GetField(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { return field; } type2 = type2.BaseType; } } return null; } public static PropertyInfo Prop(Type type, params string[] names) { if (type == null || names == null) { return null; } foreach (string name in names) { Type type2 = type; while (type2 != null && type2 != typeof(object)) { PropertyInfo property = type2.GetProperty(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (property != null) { return property; } type2 = type2.BaseType; } } return null; } public static MethodInfo Method(Type type, string name, params Type[] args) { if (type == null || string.IsNullOrEmpty(name)) { return null; } try { if (args != null && args.Length != 0) { MethodInfo method = type.GetMethod(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, args, null); if (method != null) { return method; } } MethodInfo result = null; int num = int.MaxValue; MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { if (!(methodInfo.Name != name) && !methodInfo.IsGenericMethod) { int num2 = methodInfo.GetParameters().Length; if ((args == null || args.Length == 0 || num2 == args.Length) && num2 < num) { result = methodInfo; num = num2; } } } return result; } catch (AmbiguousMatchException) { return FirstMethod(type, name); } } private static MethodInfo FirstMethod(Type type, string name) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { if (methodInfo.Name == name && !methodInfo.IsGenericMethod) { return methodInfo; } } return null; } public static MemberInfo Member(Type type, params string[] names) { FieldInfo fieldInfo = Field(type, names); if (fieldInfo != null) { return fieldInfo; } return Prop(type, names); } public static object Get(MemberInfo member, object target) { if (!(member is FieldInfo fieldInfo)) { if (member is PropertyInfo propertyInfo) { return propertyInfo.GetValue(target, null); } return null; } return fieldInfo.GetValue(target); } public static T Get(MemberInfo member, object target) { object obj = Get(member, target); if (obj is T) { return (T)obj; } if (obj == null) { return default(T); } try { return (T)Convert.ChangeType(obj, typeof(T)); } catch { return default(T); } } public static void Set(MemberInfo member, object target, object value) { if (!(member is FieldInfo fieldInfo)) { if (member is PropertyInfo { CanWrite: not false } propertyInfo) { propertyInfo.SetValue(target, Coerce(value, propertyInfo.PropertyType), null); } } else { fieldInfo.SetValue(target, Coerce(value, fieldInfo.FieldType)); } } public static object Call(MethodInfo method, object target, params object[] args) { if (method == null) { return null; } try { return method.Invoke(target, args); } catch (TargetInvocationException ex) { Log.Error(ex.InnerException ?? ex); return null; } catch (Exception message) { Log.Error(message); return null; } } public static object Coerce(object value, Type type) { if (value == null || type == null) { return value; } if (type.IsInstanceOfType(value)) { return value; } if (type.IsEnum) { return Enum.ToObject(type, value); } try { return Convert.ChangeType(value, type); } catch { return value; } } public static Transform TransformOf(object component) { Component val = (Component)((component is Component) ? component : null); if (val != null) { return val.transform; } return null; } public static GameObject GameObjectOf(object component) { Component val = (Component)((component is Component) ? component : null); if (val != null) { return val.gameObject; } return null; } } internal static class IndexValue { public static object FromInt(Type type, int value) { if (type == null) { return value; } if (type == typeof(int)) { return value; } if (type.IsEnum) { return Enum.ToObject(type, value); } try { ConstructorInfo constructor = type.GetConstructor(new Type[1] { typeof(int) }); if (constructor != null) { return constructor.Invoke(new object[1] { value }); } } catch { } try { object obj2 = Activator.CreateInstance(type); FieldInfo fieldInfo = type.GetField("value", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? type.GetField("_value", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (fieldInfo != null) { fieldInfo.SetValue(obj2, Convert.ChangeType(value, fieldInfo.FieldType)); return obj2; } } catch { } return value; } public static int ToInt(object value) { if (value == null) { return 0; } if (value is int) { return (int)value; } if (value is Enum) { return Convert.ToInt32(value); } Type type = value.GetType(); FieldInfo fieldInfo = type.GetField("value", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? type.GetField("_value", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (fieldInfo != null) { try { return Convert.ToInt32(fieldInfo.GetValue(value)); } catch { return 0; } } try { return Convert.ToInt32(value); } catch { return 0; } } } internal static class Log { internal static ManualLogSource Source; public static void Info(object message) { ManualLogSource source = Source; if (source != null) { source.LogInfo(message); } } public static void Warn(object message) { ManualLogSource source = Source; if (source != null) { source.LogWarning(message); } } public static void Error(object message) { ManualLogSource source = Source; if (source != null) { source.LogError(message); } } } internal static class Menu { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static WindowFunction <>9__26_0; public static Action <>9__33_3; public static Comparison <>9__43_0; internal void b__26_0(int Id) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) DrawInner(); GUI.DragWindow(new Rect(0f, 0f, ((Rect)(ref _rect)).width, 22f)); } internal void b__33_3() { <>c__DisplayClass33_7 CS$<>8__locals2 = new <>c__DisplayClass33_7(); if (uint.TryParse(_xp, out CS$<>8__locals2.v)) { Game.QueuePlayer(delegate { Game.GiveExperience(CS$<>8__locals2.v); }); } } internal int b__43_0(Actor a, Actor b) { return string.Compare(a.Name, b.Name, StringComparison.OrdinalIgnoreCase); } } [CompilerGenerated] private sealed class <>c__DisplayClass33_7 { public uint v; internal void b__10() { Game.GiveExperience(v); } } private static Rect _rect = new Rect(80f, 80f, 980f, 640f); private static int _tab; private static Vector2 _scroll; private static string _search = ""; private static string _money = ""; private static string _lunar = ""; private static string _voidCoins = ""; private static string _xp = "1000"; private static string _itemGiveText = "1"; private static int _itemGiveCount = 1; private static CatalogItem _pickedItem; private static Rect _giveRect; private static Rect _giveDropRect; private static bool _giveHover; private static string _buffCount = "1"; private static int _lastPlayer = int.MinValue; private static List _items; private static List _equipment; private static List _buffs; private static List _bodies; private static List _elites; private static List _scenes; private static List _interactables; private static List _monsters; private static float _catalogAt = -999f; private static readonly string[] Tabs = new string[9] { "Player", "Skins", "Items", "Equipment", "Buffs", "ESP", "Spawn", "Stage", "Lobby" }; public static bool PointerOverMenu; public static void Draw() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown Theme.Ensure(); RefreshHitTest(); Rect rect = _rect; object obj = <>c.<>9__26_0; if (obj == null) { WindowFunction val = delegate { //IL_001e: Unknown result type (might be due to invalid IL or missing references) DrawInner(); GUI.DragWindow(new Rect(0f, 0f, ((Rect)(ref _rect)).width, 22f)); }; <>c.<>9__26_0 = val; obj = (object)val; } _rect = GUI.Window(85940202, rect, (WindowFunction)obj, " SlipStream", Theme.Window); RefreshHitTest(); Event current = Event.current; if (PointerOverMenu && current != null && current.isMouse) { current.Use(); } } public static void RefreshHitTest() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) if (!Session.MenuOpen) { PointerOverMenu = false; } else { PointerOverMenu = ((Rect)(ref _rect)).Contains(GuiMouse()); } } private static Vector2 GuiMouse() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) Vector3 mousePosition = Input.mousePosition; return new Vector2(mousePosition.x, (float)Screen.height - mousePosition.y); } private static void DrawInner() { //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_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) Theme.DrawRect(new Rect(0f, 22f, 168f, ((Rect)(ref _rect)).height), Theme.Sidebar); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.BeginVertical((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(168f) }); GUILayout.Space(8f); for (int i = 0; i < Tabs.Length; i++) { if (GUILayout.Button(Tabs[i], (i == _tab) ? Theme.TabOn : Theme.Tab, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(32f) })) { _tab = i; } } GUILayout.FlexibleSpace(); GUILayout.Label("F1 close idle ≈ 0", Theme.Label, Array.Empty()); GUILayout.Space(8f); GUILayout.EndVertical(); GUILayout.BeginVertical(Array.Empty()); if (_tab != 2) { _pickedItem = null; } if (_tab == 2 && _pickedItem != null) { ItemDetail(); } else { _scroll = GUILayout.BeginScrollView(_scroll, Array.Empty()); switch (_tab) { case 0: PlayerTab(); break; case 1: SkinTab(); break; case 2: ItemTab(); break; case 3: EquipTab(); break; case 4: BuffTab(); break; case 5: EspTab(); break; case 6: SpawnTab(); break; case 7: StageTab(); break; case 8: LobbyTab(); break; } GUILayout.EndScrollView(); } GUILayout.EndVertical(); GUILayout.EndHorizontal(); } private static Actor Selected() { List list = Game.Players(); if (list.Count == 0) { return null; } foreach (Actor item in list) { if (item.Id == Session.SelectedPlayerId) { return item; } } Session.SelectedPlayerId = list[0].Id; return list[0]; } private static void EnsureCatalogs() { if (!(Time.unscaledTime - _catalogAt < 8f) || _items == null) { _items = Game.Items(); _equipment = Game.Equipment(); _buffs = Game.Buffs(); _bodies = Game.PlayableBodies(); _elites = Game.Elites(); _scenes = Game.Scenes(); _interactables = Game.InteractableCards(); _monsters = Game.MonsterCards(); _catalogAt = Time.unscaledTime; } } private static void PlayerTab() { Actor actor = Selected(); Actor actor2 = Game.LocalActor() ?? actor; GUILayout.Label("Player", Theme.Header, Array.Empty()); GUILayout.Label("Toggles apply only to you. Money, equipment, and revive apply to the selected gift target. Use the Items tab to Take an item for yourself or Give it to someone else.", Theme.Label, Array.Empty()); if (!string.IsNullOrEmpty(Game.LastActionMessage)) { GUILayout.Label(Game.LastActionMessage, Theme.MutedLabel, Array.Empty()); } if (!Game.IsServer) { GUILayout.Label("You are not the host. Gifts and your toggles are sent to the host so they stick. Spawns and stage tools still need the host.", Theme.Label, Array.Empty()); } List list = Game.Players(); GUILayout.Label("Gift target", Theme.Label, Array.Empty()); foreach (Actor item in list) { string text = (item.IsLocal ? " (you)" : ""); if (GUILayout.Toggle(Session.SelectedPlayerId == item.Id, item.Name + text, Theme.Toggle, Array.Empty())) { Session.SelectedPlayerId = item.Id; } } if (actor2 == null) { GUILayout.Label("No player body yet. Start a run.", Theme.Label, Array.Empty()); return; } if (actor != null && _lastPlayer != actor.Id) { _money = Game.GetMoney(actor).ToString(); _lunar = Game.GetLunar(actor).ToString(); _voidCoins = Game.GetVoidCoins(actor).ToString(); _lastPlayer = actor.Id; } ActorMods localMods = Session.LocalMods; GUILayout.Space(8f); GUILayout.Label("Toggles — you only. They never apply to the host or anyone else.", Theme.Label, Array.Empty()); bool flag = GUILayout.Toggle(localMods.God, "God mode", Theme.Toggle, Array.Empty()); bool flag2 = GUILayout.Toggle(localMods.Noclip, "Noclip (shift faster, space up, ctrl down)", Theme.Toggle, Array.Empty()); bool flag3 = GUILayout.Toggle(localMods.InfiniteSprint, "Infinite sprint", Theme.Toggle, Array.Empty()); bool flag4 = GUILayout.Toggle(localMods.InfiniteSkills, "Infinite skills", Theme.Toggle, Array.Empty()); bool aimbot = GUILayout.Toggle(localMods.Aimbot, "Aimbot", Theme.Toggle, Array.Empty()); bool num = flag != localMods.God || flag2 != localMods.Noclip || flag3 != localMods.InfiniteSprint || flag4 != localMods.InfiniteSkills; if (flag2 != localMods.Noclip && !flag2) { Ticker.RestoreNoclip(actor2); } localMods.God = flag; localMods.Noclip = flag2; localMods.InfiniteSprint = flag3; localMods.InfiniteSkills = flag4; localMods.Aimbot = aimbot; if (num) { Game.PushLocalToggles(actor2); } else { Game.SetGod(actor2, localMods.God); } bool flag5 = GUILayout.Toggle(Session.DisableSpawns, "Disable mob spawns", Theme.Toggle, Array.Empty()); if (flag5 != Session.DisableSpawns) { Game.SetSpawnsDisabled(flag5); } Actor actor3 = actor ?? actor2; GUILayout.Space(8f); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button("Kill all monsters", Theme.Button, Array.Empty())) { Game.QueuePlayer(Game.KillAllMobs); } if (GUILayout.Button("Revive", Theme.Button, Array.Empty())) { int id = actor3.Id; Game.QueuePlayer(delegate { Game.Revive(Game.FindPlayer(id) ?? Game.LocalActor()); }); } if (GUILayout.Button("Give all items ×1", Theme.Button, Array.Empty())) { int id2 = actor3.Id; Game.QueuePlayer(delegate { Game.GiveAllItems(Game.FindPlayer(id2) ?? Game.LocalActor(), 1); }); } if (GUILayout.Button("Clear inventory", Theme.Button, Array.Empty())) { int id3 = actor3.Id; Game.QueuePlayer(delegate { Game.ClearInventory(Game.FindPlayer(id3) ?? Game.LocalActor()); }); } GUILayout.EndHorizontal(); GUILayout.Space(6f); RowField("Money", ref _money, delegate { if (uint.TryParse(_money, out var v)) { int id4 = actor3.Id; Game.QueuePlayer(delegate { Game.SetMoney(Game.FindPlayer(id4) ?? Game.LocalActor(), v); }); } }); RowField("Lunar coins (+)", ref _lunar, delegate { if (uint.TryParse(_lunar, out var v)) { int id4 = actor3.Id; Game.QueuePlayer(delegate { Game.AwardLunar(Game.FindPlayer(id4) ?? Game.LocalActor(), v); }); } }); RowField("Void coins", ref _voidCoins, delegate { if (uint.TryParse(_voidCoins, out var v)) { int id4 = actor3.Id; Game.QueuePlayer(delegate { Game.SetVoidCoins(Game.FindPlayer(id4) ?? Game.LocalActor(), v); }); } }); RowField("Team XP", ref _xp, delegate { if (uint.TryParse(_xp, out var v)) { Game.QueuePlayer(delegate { Game.GiveExperience(v); }); } }); GUILayout.Space(8f); GUILayout.Label("Team", Theme.Label, Array.Empty()); GUILayout.Label("Allies on the team you pick will not attack you. Stage monsters are Monster; Void enemies are Void.", Theme.MutedLabel, Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); TeamButton("Player", actor3, 1); TeamButton("Monster", actor3, 2); TeamButton("Neutral", actor3, 0); TeamButton("Lunar", actor3, 3); TeamButton("Void", actor3, 4); GUILayout.EndHorizontal(); EnsureCatalogs(); GUILayout.Space(8f); GUILayout.Label("Spawn as", Theme.Label, Array.Empty()); GUILayout.Label("Every survivor and enemy body the game has loaded — vanilla and mods. Filter by name.", Theme.MutedLabel, Array.Empty()); SearchBar(); if (_bodies == null || _bodies.Count == 0) { GUILayout.Label("No bodies in the catalog yet. Start a run or wait for mods to finish loading.", Theme.Label, Array.Empty()); return; } DrawSpawnGroup("Survivors (vanilla and mods)", actor3, "Survivor"); DrawSpawnGroup("Enemies and other bodies (vanilla and mods)", actor3, "Monster"); } private static void DrawSpawnGroup(string header, Actor actor, string group) { bool flag = false; GameObject prefab = default(GameObject); foreach (CatalogItem body in _bodies) { if (body.Pickup != group) { continue; } if (!Matches(body.Name)) { object def = body.Def; GameObject val = (GameObject)((def is GameObject) ? def : null); if (!Object.op_Implicit((Object)(object)val) || !Matches(((Object)val).name)) { continue; } } if (!flag) { GUILayout.Space(6f); GUILayout.Label(header, Theme.Label, Array.Empty()); flag = true; } if (GUILayout.Button(body.Name, Theme.Button, Array.Empty())) { int id = actor.Id; ref GameObject reference = ref prefab; object def2 = body.Def; reference = (GameObject)((def2 is GameObject) ? def2 : null); Game.QueuePlayer(delegate { Game.SpawnAs(Game.FindPlayer(id) ?? Game.LocalActor(), prefab); }); } } } private static void TeamButton(string label, Actor actor, int team) { GUIStyle val = ((((Session.ForcedTeam != int.MinValue) ? Session.ForcedTeam : ((actor == null || actor.Body == null) ? 1 : Game.TeamOf(actor.Body))) == team) ? Theme.TabOn : Theme.Button); if (GUILayout.Button(label, val, Array.Empty())) { int id = actor.Id; Game.QueuePlayer(delegate { Game.SetTeam(Game.FindPlayer(id) ?? Game.LocalActor(), team); }); } } private static void SkinTab() { GUILayout.Label("Skins", Theme.Header, Array.Empty()); Actor actor = Game.LocalActor(); if (actor == null || actor.Body == null) { GUILayout.Label("No player body yet. Start a run, then this list fills with skins that body can equip.", Theme.Label, Array.Empty()); return; } string text = Game.BodyDisplayName(actor) ?? "this body"; GUILayout.Label("Skins for " + text + ". Everyone in the match sees this change.", Theme.Label, Array.Empty()); if (Game.SkinBusy) { GUILayout.Label("Applying skin… first swap can hitch while Addressables load. Do not click again yet.", Theme.Label, Array.Empty()); } SearchBar(); List list = Game.SkinsFor(actor); if (list.Count == 0) { GUILayout.Label("This body has no skins.", Theme.Label, Array.Empty()); return; } int num = Game.CurrentSkinIndex(actor); foreach (CatalogItem item in list) { if (Matches(item.Name)) { string text2 = ((item.Index == num) ? (item.Name + " (equipped)") : item.Name); GUIStyle val = ((item.Index == num) ? Theme.TabOn : Theme.Button); if (Game.SkinBusy) { GUILayout.Label(text2, Theme.Label, Array.Empty()); } else if (GUILayout.Button(text2, val, Array.Empty())) { Game.QueueSkin(actor, item.Index); } } } } private static void ItemTab() { EnsureCatalogs(); GUILayout.Label("Items", Theme.Header, Array.Empty()); GUILayout.Label("Alphabetical grid. Click an item to Take it for yourself or Give it to someone else.", Theme.Label, Array.Empty()); SearchBar(); if (_items == null) { GUILayout.Label("Item catalog is not ready yet.", Theme.Label, Array.Empty()); return; } float num = Mathf.Max(320f, ((Rect)(ref _rect)).width - 200f); int num2 = Mathf.Max(1, Mathf.FloorToInt(num / 348f)); int num3 = 0; GUILayout.BeginHorizontal(Array.Empty()); bool flag = false; foreach (CatalogItem item in _items) { if (Matches(item.Name) || Matches(item.Pickup)) { flag = true; if (num3 >= num2) { GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty()); num3 = 0; } DrawItemCard(item, 340f, 88f); num3++; } } GUILayout.EndHorizontal(); if (!flag) { GUILayout.Label("No items match that filter.", Theme.Label, Array.Empty()); } } private static void DrawItemCard(CatalogItem item, float width, float height) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) if (GUILayout.Button("", Theme.Card, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(width), GUILayout.Height(height) })) { OpenItem(item); } Rect lastRect = GUILayoutUtility.GetLastRect(); Rect rect = default(Rect); ((Rect)(ref rect))..ctor(((Rect)(ref lastRect)).x + 8f, ((Rect)(ref lastRect)).y + 10f, 56f, 56f); Game.DrawItemIcon(rect, item); float num = ((Rect)(ref rect)).xMax + 10f; float num2 = ((Rect)(ref lastRect)).width - 78f; GUI.Label(new Rect(num, ((Rect)(ref lastRect)).y + 8f, num2, 22f), item.Name ?? "", Theme.Small); GUI.Label(new Rect(num, ((Rect)(ref lastRect)).y + 30f, num2, 50f), string.IsNullOrEmpty(item.Pickup) ? "No pickup text." : item.Pickup, Theme.MutedLabel); } private static void OpenItem(CatalogItem item) { _pickedItem = item; _itemGiveCount = 1; _itemGiveText = "1"; _giveHover = false; } private static void ItemDetail() { //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: 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_0379: Unknown result type (might be due to invalid IL or missing references) CatalogItem pickedItem = _pickedItem; if (pickedItem == null) { return; } GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button("Back", Theme.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) })) { _pickedItem = null; } GUILayout.Label("Items", Theme.Header, Array.Empty()); GUILayout.EndHorizontal(); if (_pickedItem == null) { return; } pickedItem = _pickedItem; GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Box("", (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(72f), GUILayout.Height(72f) }); Rect lastRect = GUILayoutUtility.GetLastRect(); Game.DrawItemIcon(new Rect(((Rect)(ref lastRect)).x + 8f, ((Rect)(ref lastRect)).y + 8f, 56f, 56f), pickedItem); GUILayout.BeginVertical(Array.Empty()); GUILayout.Label(pickedItem.Name ?? "Item", Theme.Header, Array.Empty()); GUILayout.Label(string.IsNullOrEmpty(pickedItem.Pickup) ? "No pickup text." : pickedItem.Pickup, Theme.Label, Array.Empty()); Actor actor = Game.LocalActor(); if (actor != null) { GUILayout.Label("You have ×" + Game.ItemCount(actor, pickedItem.Index), Theme.MutedLabel, Array.Empty()); } if (!string.IsNullOrEmpty(Game.LastActionMessage)) { GUILayout.Label(Game.LastActionMessage, Theme.MutedLabel, Array.Empty()); } GUILayout.EndVertical(); GUILayout.EndHorizontal(); GUILayout.Space(12f); GUILayout.Label("Count", Theme.Label, Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button("−", Theme.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(36f) })) { ParseGiveCount(); _itemGiveCount = Mathf.Max(1, _itemGiveCount - 1); _itemGiveText = _itemGiveCount.ToString(); } string text = GUILayout.TextField(_itemGiveText ?? "1", Theme.Field, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) }); if (text != _itemGiveText) { _itemGiveText = text; if (int.TryParse(_itemGiveText, out var result)) { _itemGiveCount = Mathf.Clamp(result, 1, 999); } } if (GUILayout.Button("+", Theme.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(36f) })) { ParseGiveCount(); _itemGiveCount = Mathf.Min(999, _itemGiveCount + 1); _itemGiveText = _itemGiveCount.ToString(); } GUILayout.Label("(1–999)", Theme.MutedLabel, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) }); GUILayout.EndHorizontal(); GUILayout.Space(10f); GUILayout.BeginHorizontal(Array.Empty()); bool flag = actor != null; if (GUILayout.Button("Take", Theme.Button, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(120f), GUILayout.Height(32f) })) { ParseGiveCount(); Actor actor2 = Game.LocalActor() ?? actor; if (actor2 != null) { Game.QueueGive(actor2, pickedItem.Index, _itemGiveCount); } else { Game.LastActionMessage = "No local player body to take into."; } } GUILayout.Button("Give", Theme.Button, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(120f), GUILayout.Height(32f) }); _giveRect = GUILayoutUtility.GetLastRect(); GUILayout.EndHorizontal(); if (!flag) { GUILayout.Label("Take needs a run in progress so you have a body.", Theme.MutedLabel, Array.Empty()); } DrawGiveDropdown(pickedItem); } private static void ParseGiveCount() { if (!int.TryParse(_itemGiveText, out _itemGiveCount)) { _itemGiveCount = 1; } _itemGiveCount = Mathf.Clamp(_itemGiveCount, 1, 999); _itemGiveText = _itemGiveCount.ToString(); } private static void DrawGiveDropdown(CatalogItem item) { //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_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: 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_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) Vector2 mousePosition = Event.current.mousePosition; bool num = ((Rect)(ref _giveRect)).Contains(mousePosition); bool flag = _giveHover && ((Rect)(ref _giveDropRect)).width > 0f && ((Rect)(ref _giveDropRect)).Contains(mousePosition); _giveHover = num || flag; if (!_giveHover) { return; } List list = OtherPlayers(); float num2 = Mathf.Max(26f, (float)((list.Count == 0) ? 1 : list.Count) * 26f + 8f); _giveDropRect = new Rect(((Rect)(ref _giveRect)).x, ((Rect)(ref _giveRect)).yMax + 2f, Mathf.Max(220f, ((Rect)(ref _giveRect)).width), num2); Theme.DrawRect(_giveDropRect, Theme.Sidebar); float num3 = ((Rect)(ref _giveDropRect)).y + 4f; if (list.Count == 0) { GUI.Label(new Rect(((Rect)(ref _giveDropRect)).x + 8f, num3, ((Rect)(ref _giveDropRect)).width - 16f, 26f), "No other players in the lobby.", Theme.MutedLabel); return; } ParseGiveCount(); foreach (Actor item2 in list) { if (GUI.Button(new Rect(((Rect)(ref _giveDropRect)).x + 4f, num3, ((Rect)(ref _giveDropRect)).width - 8f, 24f), item2.Name ?? "Player", Theme.Button)) { Game.QueueGive(item2, item.Index, _itemGiveCount); } num3 += 26f; } } private static List OtherPlayers() { List list = new List(); foreach (Actor item in Game.Players()) { if (item != null && !item.IsLocal) { list.Add(item); } } list.Sort((Actor a, Actor b) => string.Compare(a.Name, b.Name, StringComparison.OrdinalIgnoreCase)); return list; } private static void EquipTab() { EnsureCatalogs(); GUILayout.Label("Equipment", Theme.Header, Array.Empty()); GUILayout.Label("Equips on the selected gift target.", Theme.Label, Array.Empty()); SearchBar(); Actor actor = Selected(); if (actor == null || _equipment == null) { GUILayout.Label("No gift target. Start a run or pick a player.", Theme.Label, Array.Empty()); return; } GUILayout.Label("Target: " + actor.Name + (actor.IsLocal ? " (you)" : ""), Theme.Label, Array.Empty()); if (GUILayout.Button("Clear equipment", Theme.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(180f) })) { Game.SetEquipment(actor, -1); } foreach (CatalogItem item in _equipment) { if (Matches(item.Name) && GUILayout.Button(item.Name, Theme.Button, Array.Empty())) { Game.SetEquipment(actor, item.Index); } } } private static void BuffTab() { EnsureCatalogs(); GUILayout.Label("Buffs", Theme.Header, Array.Empty()); GUILayout.Label("Applies on the selected gift target.", Theme.Label, Array.Empty()); SearchBar(); RowField("Count", ref _buffCount, null); Actor actor = Selected(); if (actor == null || _buffs == null) { GUILayout.Label("No gift target. Start a run or pick a player.", Theme.Label, Array.Empty()); return; } GUILayout.Label("Target: " + actor.Name + (actor.IsLocal ? " (you)" : ""), Theme.Label, Array.Empty()); if (!int.TryParse(_buffCount, out var result)) { result = 1; } foreach (CatalogItem buff in _buffs) { if (Matches(buff.Name)) { GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(buff.Name, Theme.Label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(280f) }); if (GUILayout.Button("Apply", Theme.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) })) { Game.SetBuff(actor, buff.Index, result); } if (GUILayout.Button("Clear", Theme.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) })) { Game.SetBuff(actor, buff.Index, 0); } GUILayout.EndHorizontal(); } } } private static void EspTab() { GUILayout.Label("ESP", Theme.Header, Array.Empty()); GUILayout.Label("Off by default. Labels refresh 3 times a second, not every frame, and skip off-screen / far objects.", Theme.Label, Array.Empty()); Session.EspAdvanced = GUILayout.Toggle(Session.EspAdvanced, "Advanced names", Theme.Toggle, Array.Empty()); Session.EspPlayers = GUILayout.Toggle(Session.EspPlayers, "Players", Theme.Toggle, Array.Empty()); Session.EspTeleporter = GUILayout.Toggle(Session.EspTeleporter, "Teleporter", Theme.Toggle, Array.Empty()); Session.EspChests = GUILayout.Toggle(Session.EspChests, "Chests", Theme.Toggle, Array.Empty()); Session.EspShops = GUILayout.Toggle(Session.EspShops, "Shops", Theme.Toggle, Array.Empty()); Session.EspBarrels = GUILayout.Toggle(Session.EspBarrels, "Barrels", Theme.Toggle, Array.Empty()); Session.EspScrappers = GUILayout.Toggle(Session.EspScrappers, "Scrappers", Theme.Toggle, Array.Empty()); Session.EspSecrets = GUILayout.Toggle(Session.EspSecrets, "Secrets / plates", Theme.Toggle, Array.Empty()); Session.EspPrinters = GUILayout.Toggle(Session.EspPrinters, "Printers", Theme.Toggle, Array.Empty()); Session.EspNewt = GUILayout.Toggle(Session.EspNewt, "Newt altar", Theme.Toggle, Array.Empty()); Session.EspDrones = GUILayout.Toggle(Session.EspDrones, "Drones", Theme.Toggle, Array.Empty()); Session.EspShrines = GUILayout.Toggle(Session.EspShrines, "Shrines", Theme.Toggle, Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button("Enable all", Theme.Button, Array.Empty())) { SetEsp(value: true); } if (GUILayout.Button("Disable all", Theme.Button, Array.Empty())) { SetEsp(value: false); } GUILayout.EndHorizontal(); } private static void SetEsp(bool value) { Session.EspTeleporter = (Session.EspChests = (Session.EspShops = (Session.EspBarrels = (Session.EspScrappers = (Session.EspSecrets = (Session.EspPrinters = (Session.EspNewt = (Session.EspDrones = (Session.EspShrines = (Session.EspPlayers = value)))))))))); } private static void SpawnTab() { //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_015b: 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_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) EnsureCatalogs(); GUILayout.Label("Spawn", Theme.Header, Array.Empty()); SearchBar(); Session.SpawnBraindead = GUILayout.Toggle(Session.SpawnBraindead, "Braindead (no AI)", Theme.Toggle, Array.Empty()); GUILayout.Label("Team index (0 neutral, 1 player, 2 monster, 3 lunar, 4 void)", Theme.Label, Array.Empty()); if (int.TryParse(GUILayout.TextField(Session.SpawnTeamIndex.ToString(), Theme.Field, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) }), out var result)) { Session.SpawnTeamIndex = result; } GUILayout.Label("Elite (−1 none)", Theme.Label, Array.Empty()); if (_elites != null) { if (GUILayout.Toggle(Session.SpawnEliteIndex < 0, "No elite", Theme.Toggle, Array.Empty())) { Session.SpawnEliteIndex = -1; } foreach (CatalogItem elite in _elites) { if (GUILayout.Toggle(Session.SpawnEliteIndex == elite.Index, elite.Name, Theme.Toggle, Array.Empty())) { Session.SpawnEliteIndex = elite.Index; } } } Actor actor = Selected(); Vector3 position = (((Object)(object)actor?.Transform != (Object)null) ? (actor.Transform.position + actor.Transform.forward * 6f) : Vector3.zero); GUILayout.Space(8f); GUILayout.Label("Interactables", Theme.Header, Array.Empty()); if (_interactables != null) { foreach (Object interactable in _interactables) { if (!(interactable == (Object)null) && Matches(interactable.name) && GUILayout.Button(interactable.name, Theme.Button, Array.Empty())) { Game.SpawnCardAt(interactable, position, Session.SpawnTeamIndex, braindead: false, -1); } } } GUILayout.Space(8f); GUILayout.Label("Monsters", Theme.Header, Array.Empty()); if (_monsters == null) { return; } foreach (Object monster in _monsters) { if (!(monster == (Object)null) && Matches(monster.name) && GUILayout.Button(monster.name, Theme.Button, Array.Empty())) { Game.SpawnCardAt(monster, position, Session.SpawnTeamIndex, Session.SpawnBraindead, Session.SpawnEliteIndex); } } } private static void StageTab() { EnsureCatalogs(); GUILayout.Label("Teleporter / stage", Theme.Header, Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button("Insta-charge", Theme.Button, Array.Empty())) { Game.ChargeTeleporter(); } if (GUILayout.Button("Mountain shrine +1", Theme.Button, Array.Empty())) { Game.AddMountain(); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button("Newt portal", Theme.Button, Array.Empty())) { Game.EnablePortal("newt"); SpawnPortal("PortalShop", "PortalBazaar"); } if (GUILayout.Button("Gold portal", Theme.Button, Array.Empty())) { Game.EnablePortal("gold"); SpawnPortal("PortalGoldshores"); } if (GUILayout.Button("Celestial portal", Theme.Button, Array.Empty())) { Game.EnablePortal("celestial"); SpawnPortal("PortalMS"); } if (GUILayout.Button("Void portal", Theme.Button, Array.Empty())) { SpawnPortal("PortalVoid", "DeepVoidPortal"); } if (GUILayout.Button("All portals", Theme.Button, Array.Empty())) { Game.EnablePortal("all"); SpawnPortal("PortalShop"); SpawnPortal("PortalGoldshores"); SpawnPortal("PortalMS"); SpawnPortal("PortalVoid"); } GUILayout.EndHorizontal(); GUILayout.Space(8f); GUILayout.Label("Change stage", Theme.Header, Array.Empty()); SearchBar(); if (_scenes == null) { return; } foreach (CatalogItem scene in _scenes) { if (Matches(scene.Name) && GUILayout.Button(scene.Name, Theme.Button, Array.Empty())) { Game.SkipStage(Game.SceneInternalName(scene)); } } } private static void SpawnPortal(params string[] names) { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) object obj = Game.Teleporter(); Component val = (Component)((obj is Component) ? obj : null); ? val2; if (!Object.op_Implicit((Object)(object)val)) { Actor actor = Game.LocalActor(); Vector3? obj2; if (actor == null) { obj2 = null; } else { Transform transform = actor.Transform; obj2 = ((transform != null) ? new Vector3?(transform.position) : ((Vector3?)null)); } val2 = ((??)obj2) ?? Vector3.zero; } else { val2 = val.transform.position + Vector3.up * 2f; } Vector3 position = (Vector3)val2; Game.SpawnPrefabNamed(names, position); } private static void LobbyTab() { //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) GUILayout.Label("Lobby", Theme.Header, Array.Empty()); GUILayout.Label("Kick / ban require host. Goto / bring teleport bodies.", Theme.Label, Array.Empty()); Actor actor = Game.LocalActor(); foreach (Actor item in Game.Players()) { GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(item.Name + (item.IsLocal ? " (you)" : ""), Theme.Label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(220f) }); if (GUILayout.Button("Goto", Theme.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) }) && Object.op_Implicit((Object)(object)item.Transform) && actor != null) { Game.Teleport(actor, item.Transform.position + Vector3.up); } if (GUILayout.Button("Bring", Theme.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) }) && Object.op_Implicit((Object)(object)actor?.Transform) && item.Id != actor.Id) { Game.Teleport(item, actor.Transform.position + Vector3.up); } if (GUILayout.Button("Revive", Theme.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) })) { Game.Revive(item); } if (!item.IsLocal && GUILayout.Button("Kick", Theme.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) })) { Game.Kick(item); } if (!item.IsLocal && GUILayout.Button("Ban", Theme.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) })) { Game.Ban(item); } GUILayout.EndHorizontal(); } } private static void SearchBar() { GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label("Filter", Theme.Label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(48f) }); _search = GUILayout.TextField(_search ?? "", Theme.Search, Array.Empty()); GUILayout.EndHorizontal(); } private static bool Matches(string name) { if (!string.IsNullOrEmpty(_search)) { if (name != null) { return name.IndexOf(_search, StringComparison.OrdinalIgnoreCase) >= 0; } return false; } return true; } private static void RowField(string label, ref string value, Action apply) { GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(label, Theme.Label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(120f) }); value = GUILayout.TextField(value ?? "", Theme.Field, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(160f) }); if (apply != null && GUILayout.Button("Apply", Theme.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) })) { apply(); } GUILayout.EndHorizontal(); } } internal static class Patches { private static bool _cursorGuard; public static void ApplyCursorGuards(Harmony harmony) { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Expected O, but got Unknown if (_cursorGuard || harmony == null) { return; } _cursorGuard = true; try { MethodInfo methodInfo = typeof(Cursor).GetProperty("lockState")?.GetSetMethod(); MethodInfo methodInfo2 = typeof(Cursor).GetProperty("visible")?.GetSetMethod(); if (methodInfo != null) { harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(Patches), "ForceMenuLock", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } if (methodInfo2 != null) { harmony.Patch((MethodBase)methodInfo2, new HarmonyMethod(typeof(Patches), "ForceMenuVisible", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } catch (Exception ex) { Log.Warn("Could not pin the menu cursor: " + ex.Message); } } public static void Apply(Harmony harmony) { ApplyCursorGuards(harmony); TryPrefix(harmony, Game.THealthComponent, "TakeDamage", "GodTakeDamage"); TryPrefix(harmony, Game.THealthComponent, "TakeDamageProcess", "GodTakeDamage"); TryPrefix(harmony, Game.TCombatDirector, "FixedUpdate", "SkipDirector"); TryPrefix(harmony, Game.TCombatDirector, "AttemptSpawnOnTarget", "SkipDirector"); TryPrefix(harmony, Game.TMapZone, "TeleportBody", "SkipOob"); TryPostfix(harmony, Game.TCharacterMaster, "Awake", "MasterAwake"); TryPostfix(harmony, Game.TPlayerCharacterMasterController, "Update", "AfterLocalInput"); TryPostfix(harmony, Game.TPlayerCharacterMasterController, "FixedUpdate", "AfterLocalInput"); Type type = Hook.Type("RoR2.CameraRigController"); TryPostfix(harmony, type, "Update", "AfterCamera"); TryPostfix(harmony, type, "LateUpdate", "AfterCamera"); TryMouseFilter(harmony); TryRewiredFilter(harmony); } private static void TryMouseFilter(Harmony harmony) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown try { Type typeFromHandle = typeof(Input); HarmonyMethod val = new HarmonyMethod(typeof(Patches), "BlockGameMouse", (Type[])null); HarmonyMethod val2 = new HarmonyMethod(typeof(Patches), "BlockMenuLookAxis", (Type[])null); harmony.Patch((MethodBase)typeFromHandle.GetMethod("GetMouseButton", new Type[1] { typeof(int) }), val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)typeFromHandle.GetMethod("GetMouseButtonDown", new Type[1] { typeof(int) }), val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)typeFromHandle.GetMethod("GetMouseButtonUp", new Type[1] { typeof(int) }), val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)typeFromHandle.GetMethod("GetAxis", new Type[1] { typeof(string) }), val2, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)typeFromHandle.GetMethod("GetAxisRaw", new Type[1] { typeof(string) }), val2, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } catch (Exception ex) { Log.Warn("Could not filter menu mouse clicks: " + ex.Message); } } private static void TryRewiredFilter(Harmony harmony) { //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Expected O, but got Unknown //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Expected O, but got Unknown Type type = Hook.Type("Rewired.Player"); if (type == null) { return; } try { MethodInfo method = type.GetMethod("GetButton", new Type[1] { typeof(string) }); MethodInfo method2 = type.GetMethod("GetButtonDown", new Type[1] { typeof(string) }); MethodInfo method3 = type.GetMethod("GetAxis", new Type[1] { typeof(string) }); HarmonyMethod val = new HarmonyMethod(typeof(Patches), "BlockRewiredButton", (Type[])null); HarmonyMethod val2 = new HarmonyMethod(typeof(Patches), "BlockRewiredLook", (Type[])null); if (method != null) { harmony.Patch((MethodBase)method, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } if (method2 != null) { harmony.Patch((MethodBase)method2, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } if (method3 != null) { harmony.Patch((MethodBase)method3, val2, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } catch (Exception ex) { Log.Warn("Could not filter Rewired menu clicks: " + ex.Message); } } private static void ForceMenuLock(ref CursorLockMode value) { if (Session.MenuOpen) { value = (CursorLockMode)0; } } private static void ForceMenuVisible(ref bool value) { if (Session.MenuOpen) { value = true; } } private static bool BlockGameMouse(ref bool __result, int button) { if (!Session.MenuOpen || !Menu.PointerOverMenu) { return true; } if (button > 2) { return true; } __result = false; return false; } private static bool BlockMenuLookAxis(ref float __result, string axisName) { if (!Session.MenuOpen || !Menu.PointerOverMenu || string.IsNullOrEmpty(axisName)) { return true; } if (!IsLookAxis(axisName)) { return true; } __result = 0f; return false; } private static bool BlockRewiredButton(ref bool __result, string actionName) { if (!Session.MenuOpen || !Menu.PointerOverMenu || string.IsNullOrEmpty(actionName)) { return true; } if (actionName != "PrimarySkill" && actionName != "SecondarySkill") { return true; } __result = false; return false; } private static bool BlockRewiredLook(ref float __result, string actionName) { if (!Session.MenuOpen || !Menu.PointerOverMenu || string.IsNullOrEmpty(actionName)) { return true; } if (!IsLookAxis(actionName)) { return true; } __result = 0f; return false; } private static bool IsLookAxis(string name) { switch (name) { default: return name == "MouseLookY"; case "Mouse X": case "Mouse Y": case "MouseX": case "MouseY": case "LookHorizontal": case "LookVertical": case "MouseLook": case "MouseLookX": return true; } } private static void AfterLocalInput() { Game.SwallowMenuMouse(); } private static void AfterCamera() { if (Session.MenuOpen) { Game.PumpCursor(); } } private static void TryPrefix(Harmony harmony, Type type, string method, string patch) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown if (type == null) { return; } MethodInfo methodInfo = Hook.Method(type, method); if (methodInfo == null) { return; } try { harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(Patches), patch, (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } catch (Exception ex) { Log.Warn("Could not prefix " + type.Name + "." + method + ": " + ex.Message); } } private static void TryPostfix(Harmony harmony, Type type, string method, string patch) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown if (type == null) { return; } MethodInfo methodInfo = Hook.Method(type, method); if (methodInfo == null) { return; } try { harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(typeof(Patches), patch, (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } catch (Exception ex) { Log.Warn("Could not postfix " + type.Name + "." + method + ": " + ex.Message); } } private static bool GodTakeDamage(object __instance) { if (__instance == null) { return true; } Component val = (Component)((__instance is Component) ? __instance : null); if ((Object)(object)val == (Object)null) { return true; } Component val2 = ((Game.TCharacterBody != null) ? val.GetComponent(Game.TCharacterBody) : null); if ((Object)(object)val2 == (Object)null) { return true; } if (Session.LocalMods.God && IsLocalBody(val2, __instance)) { return false; } if (!Game.IsServer) { return true; } foreach (KeyValuePair remoteMod in Session.RemoteMods) { if (!remoteMod.Value.God) { continue; } Actor actor = Game.FindByNetId(remoteMod.Key); if (actor != null && !actor.IsLocal) { if (actor.Health != null && actor.Health == __instance) { return false; } if (actor.Body != null && actor.Body == val2) { return false; } } } return true; } private static bool IsLocalBody(object body, object health) { Actor actor = Game.LocalActor(); if (actor == null) { return false; } if (actor.Health != null && actor.Health == health) { return true; } if (actor.Body != null) { return actor.Body == body; } return false; } private static bool SkipDirector() { return !Session.DisableSpawns; } private static bool SkipOob(object characterBody) { if (!Session.HasTickWork || characterBody == null) { return true; } if (Session.LocalMods.Noclip) { Actor actor = Game.LocalActor(); if (actor != null && actor.Body != null && actor.Body == characterBody) { return false; } } if (!Game.IsServer) { return true; } foreach (KeyValuePair remoteMod in Session.RemoteMods) { if (remoteMod.Value.Noclip) { Actor actor2 = Game.FindByNetId(remoteMod.Key); if (actor2 != null && !actor2.IsLocal && actor2.Body != null && actor2.Body == characterBody) { return false; } } } return true; } private static void MasterAwake(object __instance) { if (__instance == null) { return; } if (Session.LocalMods.God) { Actor actor = Game.LocalActor(); if (actor != null && actor.Master != null && actor.Master == __instance) { Game.SetGod(actor, enabled: true); } } if (!Game.IsServer) { return; } uint num = Game.NetIdOf(__instance); if (num != 0 && Session.RemoteMods.TryGetValue(num, out var value) && value.God) { Actor actor2 = Game.FindByNetId(num); if (actor2 != null && !actor2.IsLocal) { Game.SetGod(actor2, enabled: true); } } } } internal sealed class ActorMods { public bool God; public bool Noclip; public bool InfiniteSprint; public bool InfiniteSkills; public bool Aimbot; public bool Any { get { if (!God && !Noclip && !InfiniteSprint && !InfiniteSkills) { return Aimbot; } return true; } } } internal static class Session { public static bool MenuOpen; public static int SelectedPlayerId; public static readonly ActorMods LocalMods = new ActorMods(); public static readonly Dictionary RemoteMods = new Dictionary(); public static bool DisableSpawns; public static bool EspTeleporter; public static bool EspChests; public static bool EspShops; public static bool EspBarrels; public static bool EspScrappers; public static bool EspSecrets; public static bool EspPrinters; public static bool EspNewt; public static bool EspDrones; public static bool EspShrines; public static bool EspAdvanced; public static bool EspPlayers; public static bool SpawnBraindead; public static int SpawnEliteIndex = -1; public static int SpawnTeamIndex = 2; public static int SpawnCount = 1; public static int PendingSkinActorId = int.MinValue; public static int PendingSkinIndex = -1; public static int ForcedTeam = int.MinValue; public static bool EspAny { get { if (!EspTeleporter && !EspChests && !EspShops && !EspBarrels && !EspScrappers && !EspSecrets && !EspPrinters && !EspNewt && !EspDrones && !EspShrines) { return EspPlayers; } return true; } } public static bool HasTickWork { get { if (DisableSpawns) { return true; } if (ForcedTeam != int.MinValue) { return true; } if (LocalMods.Any) { return true; } foreach (KeyValuePair remoteMod in RemoteMods) { if (remoteMod.Value.Any) { return true; } } return false; } } public static ActorMods RemoteModsFor(uint netId) { if (netId == 0) { return null; } if (!RemoteMods.TryGetValue(netId, out var value)) { value = new ActorMods(); RemoteMods[netId] = value; } return value; } } [BepInPlugin("dev.slipstream", "SlipStream", "1.0.15")] [BepInProcess("Risk of Rain 2.exe")] public sealed class SlipstreamPlugin : BaseUnityPlugin { public const string PluginGuid = "dev.slipstream"; public const string PluginName = "SlipStream"; public const string PluginVersion = "1.0.15"; private static ConfigEntry _menuKey; private Harmony _harmony; private bool _wired; private int _wireAttempts; private static SlipstreamPlugin _instance; public static void Run(IEnumerator routine) { if ((Object)(object)_instance != (Object)null && routine != null) { ((MonoBehaviour)_instance).StartCoroutine(routine); } } private void Awake() { //IL_002b: 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_004f: Expected O, but got Unknown //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) _instance = this; Log.Source = ((BaseUnityPlugin)this).Logger; _menuKey = ((BaseUnityPlugin)this).Config.Bind("Input", "MenuKey", new KeyboardShortcut((KeyCode)282, Array.Empty()), "Toggle SlipStream. The plugin does no per-frame work while the menu is closed and no toggles are on."); _harmony = new Harmony("dev.slipstream"); Patches.ApplyCursorGuards(_harmony); Log.Info("SlipStream loaded. Open with " + ((object)_menuKey.Value/*cast due to .constrained prefix*/).ToString()); } private void Start() { TryWire(); } private void TryWire() { if (_wired || _wireAttempts >= 8) { return; } _wireAttempts++; try { Game.Init(_harmony); _wired = Game.Ready; } catch (Exception message) { Log.Error(message); _wired = true; } } private void Update() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) if (!_wired) { if (_wireAttempts >= 8) { _wired = true; } else if (Time.frameCount % 30 == 0) { TryWire(); } } KeyboardShortcut value = _menuKey.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { Session.MenuOpen = !Session.MenuOpen; Game.SetMenuCursor(Session.MenuOpen); } if (Game.Ready) { CoOp.Register(); } if (Session.MenuOpen) { Menu.RefreshHitTest(); } Game.DrainPendingGive(); Game.DrainPendingPlayer(); Game.DrainPendingSkin(); if (Session.HasTickWork) { Ticker.Tick(); } } private void LateUpdate() { if (Session.MenuOpen) { Menu.RefreshHitTest(); Game.PumpCursor(); Game.SwallowMenuMouse(); } } private void OnGUI() { if (Session.MenuOpen) { Menu.Draw(); } if (Session.EspAny) { Esp.Draw(); } } private void OnDestroy() { if (Session.MenuOpen) { Game.SetMenuCursor(open: false); } Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } } internal static class Theme { public static readonly Color WindowBg = new Color(0.07f, 0.09f, 0.12f, 0.96f); public static readonly Color Sidebar = new Color(0.05f, 0.06f, 0.08f, 0.98f); public static readonly Color Accent = new Color(0.22f, 0.82f, 0.74f, 1f); public static readonly Color AccentDim = new Color(0.16f, 0.42f, 0.4f, 1f); public static readonly Color Danger = new Color(0.86f, 0.32f, 0.32f, 1f); public static readonly Color Text = new Color(0.92f, 0.95f, 0.96f, 1f); public static readonly Color Muted = new Color(0.62f, 0.68f, 0.72f, 1f); private static Texture2D _pixel; private static GUIStyle _window; private static GUIStyle _tab; private static GUIStyle _tabOn; private static GUIStyle _header; private static GUIStyle _label; private static GUIStyle _muted; private static GUIStyle _small; private static GUIStyle _button; private static GUIStyle _card; private static GUIStyle _toggle; private static GUIStyle _field; private static GUIStyle _search; private static bool _ready; public static GUIStyle Window => _window; public static GUIStyle Tab => _tab; public static GUIStyle TabOn => _tabOn; public static GUIStyle Header => _header; public static GUIStyle Label => _label; public static GUIStyle MutedLabel => _muted; public static GUIStyle Small => _small; public static GUIStyle Button => _button; public static GUIStyle Card => _card; public static GUIStyle Toggle => _toggle; public static GUIStyle Field => _field; public static GUIStyle Search => _search; public static void Ensure() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0088: 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_00bd: Expected O, but got Unknown //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Expected O, but got Unknown //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Expected O, but got Unknown //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: 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_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Expected O, but got Unknown //IL_01c3: Expected O, but got Unknown //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Expected O, but got Unknown //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Expected O, but got Unknown //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Expected O, but got Unknown //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Expected O, but got Unknown //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Expected O, but got Unknown //IL_02b9: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Expected O, but got Unknown //IL_02f4: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Expected O, but got Unknown //IL_0308: Unknown result type (might be due to invalid IL or missing references) //IL_030d: Unknown result type (might be due to invalid IL or missing references) //IL_0315: Unknown result type (might be due to invalid IL or missing references) //IL_031b: 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_032b: 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_033b: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Expected O, but got Unknown //IL_034a: Expected O, but got Unknown //IL_0354: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_0361: Unknown result type (might be due to invalid IL or missing references) //IL_0367: 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_038b: Unknown result type (might be due to invalid IL or missing references) //IL_039f: Expected O, but got Unknown //IL_03a4: Unknown result type (might be due to invalid IL or missing references) //IL_03a9: Unknown result type (might be due to invalid IL or missing references) //IL_03b6: Expected O, but got Unknown if (!_ready || _window == null) { _pixel = new Texture2D(1, 1, (TextureFormat)4, false); _pixel.SetPixel(0, 0, Color.white); _pixel.Apply(); _window = new GUIStyle(GUI.skin.window); _window.normal.background = Tint(WindowBg); _window.onNormal.background = Tint(WindowBg); _window.normal.textColor = Accent; _window.fontSize = 14; _window.fontStyle = (FontStyle)1; _window.padding = new RectOffset(0, 0, 22, 8); _tab = MakeButton(new Color(0.1f, 0.12f, 0.15f, 1f), Text); _tab.alignment = (TextAnchor)3; _tab.padding = new RectOffset(14, 8, 8, 8); _tab.margin = new RectOffset(6, 6, 3, 3); _tab.fontSize = 13; _tabOn = MakeButton(AccentDim, Color.white); _tabOn.alignment = (TextAnchor)3; _tabOn.padding = _tab.padding; _tabOn.margin = _tab.margin; _tabOn.fontSize = 13; _tabOn.fontStyle = (FontStyle)1; GUIStyle val = new GUIStyle(GUI.skin.label) { fontSize = 16, fontStyle = (FontStyle)1 }; val.normal.textColor = Accent; val.padding = new RectOffset(0, 0, 4, 8); _header = val; GUIStyle val2 = new GUIStyle(GUI.skin.label) { fontSize = 13 }; val2.normal.textColor = Text; val2.wordWrap = true; _label = val2; GUIStyle val3 = new GUIStyle(_label) { fontSize = 11 }; val3.normal.textColor = Muted; val3.wordWrap = true; _muted = val3; _small = new GUIStyle(_label) { fontSize = 12, fontStyle = (FontStyle)1, clipping = (TextClipping)1 }; _button = MakeButton(new Color(0.14f, 0.18f, 0.22f, 1f), Text); _button.fontSize = 13; _button.padding = new RectOffset(10, 10, 6, 6); _button.margin = new RectOffset(4, 4, 4, 4); _card = MakeButton(new Color(0.11f, 0.14f, 0.18f, 1f), Text); _card.alignment = (TextAnchor)0; _card.padding = new RectOffset(8, 8, 8, 8); _card.margin = new RectOffset(4, 4, 4, 4); GUIStyle val4 = new GUIStyle(GUI.skin.toggle) { fontSize = 13 }; val4.normal.textColor = Text; val4.onNormal.textColor = Accent; val4.padding = new RectOffset(20, 4, 4, 4); _toggle = val4; GUIStyle val5 = new GUIStyle(GUI.skin.textField) { fontSize = 13 }; val5.normal.textColor = Text; val5.normal.background = Tint(new Color(0.1f, 0.12f, 0.16f, 1f)); _field = val5; _search = new GUIStyle(_field) { fontSize = 13 }; _ready = true; } } private static GUIStyle MakeButton(Color bg, Color text) { //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_0017: 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_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown GUIStyle val = new GUIStyle(GUI.skin.button) { fontSize = 13, alignment = (TextAnchor)4 }; val.normal.background = Tint(bg); val.normal.textColor = text; val.hover.background = Tint(bg * 1.25f); val.hover.textColor = Color.white; val.active.background = Tint(AccentDim); val.active.textColor = Color.white; return val; } private static Texture2D Tint(Color color) { //IL_0004: 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_000c: 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_0019: Expected O, but got Unknown Texture2D val = new Texture2D(1, 1, (TextureFormat)4, false); val.SetPixel(0, 0, color); val.Apply(); return val; } public static void DrawRect(Rect rect, Color color) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) Color color2 = GUI.color; GUI.color = color; GUI.DrawTexture(rect, (Texture)(object)_pixel); GUI.color = color2; } } internal static class Ticker { public static void Tick() { if (!Game.Ready || !Session.HasTickWork) { return; } Apply(Game.LocalActor(), Session.LocalMods, local: true); if (Session.ForcedTeam != int.MinValue) { Game.HoldForcedTeam(Game.LocalActor()); } if (!Game.IsServer) { return; } foreach (KeyValuePair remoteMod in Session.RemoteMods) { Actor actor = Game.FindByNetId(remoteMod.Key); if (actor != null && !actor.IsLocal) { Apply(actor, remoteMod.Value, local: false); } } } private static void Apply(Actor actor, ActorMods mods, bool local) { if (actor != null && actor.Body != null && mods != null && mods.Any) { if (mods.God) { Game.SetGod(actor, enabled: true); } if (mods.InfiniteSprint) { Game.SetSprinting(actor, enabled: true); } if (mods.InfiniteSkills) { Game.RefillSkills(actor); } if (local && mods.Noclip) { Noclip(actor); } if (local && mods.Aimbot) { Aimbot(actor); } } } private static void Noclip(Actor actor) { //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_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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_00d5: 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_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) Game.SetMotorGravity(actor, useGravity: false); Game.SetCollidable(actor, enabled: false); Vector3 val = Game.MoveVector(actor); Vector3 val2 = Game.AimDirection(actor); float num = ((Input.GetKey((KeyCode)304) || Input.GetKey((KeyCode)303)) ? 80f : 32f); Vector3 val3 = val * num; if (((Vector3)(ref val)).sqrMagnitude > 0.01f && Vector3.Dot(((Vector3)(ref val)).normalized, val2) > 0.15f) { val3.y = val2.y * num; } if (Input.GetKey((KeyCode)32)) { val3.y = num; } if (Input.GetKey((KeyCode)306) || Input.GetKey((KeyCode)99)) { val3.y = 0f - num; } Game.SetMotorVelocity(actor, val3); if (Object.op_Implicit((Object)(object)actor.Transform) && ((Vector3)(ref val3)).sqrMagnitude > 0f) { Transform transform = actor.Transform; transform.position += val3 * Time.deltaTime; } } private static void Aimbot(Actor actor) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)actor.Transform == (Object)null) { return; } Transform val = null; float num = 32400f; Vector3 val2 = actor.Transform.position + Vector3.up; foreach (object item in Game.Bodies()) { if (item == null || item == actor.Body || Game.TeamOf(item) == 1) { continue; } Transform val3 = Hook.TransformOf(item); if (!((Object)(object)val3 == (Object)null)) { Vector3 val4 = val3.position + Vector3.up - val2; float sqrMagnitude = ((Vector3)(ref val4)).sqrMagnitude; if (!(sqrMagnitude < 4f) && !(sqrMagnitude > num)) { num = sqrMagnitude; val = val3; } } } if (!((Object)(object)val == (Object)null)) { Vector3 val5 = val.position + Vector3.up * 0.8f - val2; Vector3 normalized = ((Vector3)(ref val5)).normalized; Game.SetAim(actor, normalized); } } public static void RestoreNoclip(Actor actor) { if (actor != null) { Game.SetMotorGravity(actor, useGravity: true); Game.SetCollidable(actor, enabled: true); } } }