using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Linq.Expressions; using System.Net; using System.Net.Http; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Threading.Tasks; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using DebugToolkit.Code; using EntityStates.Drone.DroneJunk; using EntityStates.LunarTeleporter; using HG; using HG.Reflection; using HarmonyLib; using IL.EntityStates.Drifter; using IL.EntityStates.Drone.DroneJunk; using IL.RoR2; using IL.RoR2.Projectile; using KinematicCharacterController; using Microsoft.CodeAnalysis; using Mono.Cecil; using Mono.Cecil.Cil; using Mono.Cecil.Rocks; using Mono.Collections.Generic; using MonoMod.Cil; using MonoMod.RuntimeDetour; using MonoMod.Utils; using Newtonsoft.Json; using Newtonsoft.Json.Converters; using On.EntityStates.LunarTeleporter; using On.RoR2; using On.RoR2.Artifacts; using On.RoR2.Items; using On.RoR2.UI; using On.RoR2.UI.MainMenu; using ProperSave; using ProperSave.Data; using R2API; using RoR2; using RoR2.Artifacts; using RoR2.ContentManagement; using RoR2.EntitlementManagement; using RoR2.ExpansionManagement; using RoR2.Navigation; using RoR2.PointOfInterest; using RoR2.Projectile; using RoR2.Stats; using RoR2.UI; using RoR2.UI.MainMenu; using RoR2.UI.SkinControllers; using RoRGauntlet; using RoRGauntlet.Utilities; using RoRGauntlet.Utilities.Extensions; using RoRGauntlet.Web; using RoRes; using ScrollableLobbyUI; using TMPro; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.ResourceManagement.AsyncOperations; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: OptIn] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("DebugToolkit")] [assembly: AssemblyCompany("RoRGauntlet")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+71aeea154fb93759763846874bb584172a291e68")] [assembly: AssemblyProduct("RoRGauntlet")] [assembly: AssemblyTitle("RoRGauntlet")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [CompilerGenerated] internal sealed class <>z__ReadOnlyList : IEnumerable, ICollection, IList, IEnumerable, IReadOnlyCollection, IReadOnlyList, ICollection, IList { int ICollection.Count => _items.Count; bool ICollection.IsSynchronized => false; object ICollection.SyncRoot => this; object IList.this[int index] { get { return _items[index]; } set { throw new NotSupportedException(); } } bool IList.IsFixedSize => true; bool IList.IsReadOnly => true; int IReadOnlyCollection.Count => _items.Count; T IReadOnlyList.this[int index] => _items[index]; int ICollection.Count => _items.Count; bool ICollection.IsReadOnly => true; T IList.this[int index] { get { return _items[index]; } set { throw new NotSupportedException(); } } public <>z__ReadOnlyList(List items) { _items = items; } IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)_items).GetEnumerator(); } void ICollection.CopyTo(Array array, int index) { ((ICollection)_items).CopyTo(array, index); } int IList.Add(object value) { throw new NotSupportedException(); } void IList.Clear() { throw new NotSupportedException(); } bool IList.Contains(object value) { return ((IList)_items).Contains(value); } int IList.IndexOf(object value) { return ((IList)_items).IndexOf(value); } void IList.Insert(int index, object value) { throw new NotSupportedException(); } void IList.Remove(object value) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)_items).GetEnumerator(); } void ICollection.Add(T item) { throw new NotSupportedException(); } void ICollection.Clear() { throw new NotSupportedException(); } bool ICollection.Contains(T item) { return _items.Contains(item); } void ICollection.CopyTo(T[] array, int arrayIndex) { _items.CopyTo(array, arrayIndex); } bool ICollection.Remove(T item) { throw new NotSupportedException(); } int IList.IndexOf(T item) { return _items.IndexOf(item); } void IList.Insert(int index, T item) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class ParamCollectionAttribute : Attribute { } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace RoRes { public sealed class AuthInfo { [JsonProperty("idToken")] public string IdToken { get; set; } [JsonProperty("refreshToken")] public string RefreshToken { get; set; } [JsonProperty("localId")] public string LocalId { get; set; } } public sealed class Loadout { [JsonProperty("id")] public long Id { get; set; } [JsonProperty("seed")] public ulong Seed { get; set; } [JsonProperty("survivor")] public string Survivor { get; set; } [JsonProperty("skills")] public List Skills { get; set; } [JsonProperty("stages")] public List Stages { get; set; } [JsonProperty("dlcs")] public List Expansions { get; set; } public override string ToString() { return JsonConvert.SerializeObject((object)this); } } public sealed class Member { [JsonProperty("team")] public long Id { get; set; } [JsonProperty("userId")] public string UserId { get; set; } } public sealed class Race { [JsonProperty("id")] public string Id { get; set; } [JsonProperty("lobbyCode")] public string LobbyCode { get; set; } [JsonProperty("password")] public string Password { get; set; } [JsonProperty("active")] public bool Active { get; set; } [JsonProperty("loadouts")] public List Loadouts { get; set; } [JsonProperty("members")] public List Members { get; set; } [JsonProperty("createTimestamp")] public long CreateTimestamp { get; set; } [JsonProperty("createUser")] public string CreateUser { get; set; } [JsonProperty("sanctioned")] public bool Sanctioned { get; set; } [JsonProperty("runSubmissions")] public List RunSubmissions { get; set; } public static Race FromJson(string json) { return JsonConvert.DeserializeObject(json, Converter.Settings); } public int GetCurrentLoadoutIndex(string userId) { if (RunSubmissions == null) { return 1; } List list = (from sub in RunSubmissions where sub != null && sub.UserId == userId orderby sub.LoadoutId select sub).ToList(); if (list.Count() == 0) { return 1; } int num = 1; for (int i = 0; i < list.Count(); i++) { int loadoutId = list[i].LoadoutId; if (loadoutId > num) { return num; } if (i < list.Count - 1 && list[i + 1].LoadoutId - loadoutId > 1) { num = loadoutId + 1; break; } num++; } return num; } } public sealed class RunSubmission { [JsonProperty("loadoutId")] public int LoadoutId { get; set; } [JsonProperty("userId")] public string UserId { get; set; } [JsonProperty("runTime")] public long RunTime { get; set; } [JsonProperty("lazarusCount")] public long LazarusCount { get; set; } [JsonProperty("didConcede")] public bool DidConcede { get; set; } [JsonProperty("splitTimes")] public List SplitTimes { get; set; } public static RunSubmission FromJson(string json) { return JsonConvert.DeserializeObject(json, Converter.Settings); } } public static class Serializer { public static string ToJson(this Race self) { return JsonConvert.SerializeObject((object)self, Converter.Settings); } public static string ToJson(this User self) { return JsonConvert.SerializeObject((object)self, Converter.Settings); } public static string ToJson(this RunSubmission self) { return JsonConvert.SerializeObject((object)self, Converter.Settings); } public static string ToJson(this AuthInfo self) { return JsonConvert.SerializeObject((object)self, Converter.Settings); } } internal static class Converter { public static readonly JsonSerializerSettings Settings = new JsonSerializerSettings { MetadataPropertyHandling = (MetadataPropertyHandling)2, DateParseHandling = (DateParseHandling)0, Converters = { (JsonConverter)new IsoDateTimeConverter { DateTimeStyles = DateTimeStyles.AssumeUniversal } } }; } public sealed class User { [JsonProperty("id")] public string Id { get; set; } [JsonProperty("username")] public string Username { get; set; } [JsonProperty("pfp")] public Uri Pfp { get; set; } public static User FromJson(string json) { return JsonConvert.DeserializeObject(json, Converter.Settings); } } public sealed class UserInfo { [JsonProperty("user")] public User User { get; set; } [JsonProperty("auth")] public AuthInfo Auth { get; set; } } public sealed class UserLoginResponse { [JsonProperty("id")] public string Id { get; set; } [JsonProperty("auth_id")] public string auth_id { get; set; } [JsonProperty("username")] public string Username { get; set; } [JsonProperty("pfp")] public Uri pfp { get; set; } [JsonProperty("twitch_handle")] public string twitchHandle { get; set; } [JsonProperty("youtube_handle")] public string youtubeHandle { get; set; } [JsonProperty("sanctioned_admin")] public bool sanctionedAdmin { get; set; } public static UserLoginResponse FromJson(string json) { return JsonConvert.DeserializeObject(json, Converter.Settings); } } internal sealed class RaceV2Api { private sealed class JoinLobbyRequest { public string Password { get; set; } public int Team { get; set; } } [CompilerGenerated] private static class <>O { public static hook_OnEnter <0>__onEnter; } [CompilerGenerated] private sealed class d__9 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public long id; public RaceV2Api <>4__this; public Action onDone; private UnityWebRequest 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__9(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } 5__2 = null; <>1__state = -2; } private bool MoveNext() { //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_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Invalid comparison between Unknown and I4 bool result2; try { int num = <>1__state; RaceV2Api raceV2Api = <>4__this; switch (num) { default: result2 = false; break; case 0: { <>1__state = -1; string endpoint = EnvironmentService.Instance.GetEnvironment().Endpoint; string text = $"{endpoint}/race?id={id}"; 5__2 = UnityWebRequest.Get(text); <>1__state = -3; raceV2Api.AddHeaders(5__2); <>2__current = 5__2.SendWebRequest(); <>1__state = 1; result2 = true; break; } case 1: { <>1__state = -3; Result result = 5__2.result; if (result - 2 <= 1) { raceV2Api._log.LogError((object)("Error trying to fetch race data : " + 5__2.error)); } else { raceV2Api._log.LogInfo((object)("Updated race data fetched : " + 5__2.downloadHandler.text)); T obj = JsonConvert.DeserializeObject(5__2.downloadHandler.text, Converter.Settings); onDone(obj); } result2 = false; <>m__Finally1(); break; } } } catch { //try-fault ((IDisposable)this).Dispose(); throw; } return result2; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (5__2 != null) { ((IDisposable)5__2).Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__10 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string lobbyCode; public RaceV2Api <>4__this; public Action onDone; private UnityWebRequest 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__10(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 2) { try { } finally { <>m__Finally1(); } } 5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_00e1: 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_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Invalid comparison between Unknown and I4 try { int num = <>1__state; RaceV2Api raceV2Api = <>4__this; string text; switch (num) { default: return false; case 0: <>1__state = -1; if (lobbyCode == null || lobbyCode.Length == 0) { raceV2Api._log.LogWarning((object)"Can't get race data from null or empty lobby code"); <>2__current = null; <>1__state = 1; return true; } goto IL_006f; case 1: <>1__state = -1; goto IL_006f; case 2: { <>1__state = -3; Result result = 5__2.result; if (result - 2 <= 1) { raceV2Api._log.LogError((object)("Error trying to fetch race data : " + 5__2.error)); } else { raceV2Api._log.LogInfo((object)("Updated race data fetched : " + 5__2.downloadHandler.text)); T obj = JsonConvert.DeserializeObject(5__2.downloadHandler.text, Converter.Settings); onDone(obj); } <>m__Finally1(); 5__2 = null; return false; } IL_006f: text = EnvironmentService.Instance.GetEnvironment().Endpoint + "/race/" + lobbyCode.ToUpper(); 5__2 = UnityWebRequest.Get(text); <>1__state = -3; raceV2Api.AddHeaders(5__2); <>2__current = 5__2.SendWebRequest(); <>1__state = 2; return true; } } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (5__2 != null) { ((IDisposable)5__2).Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__17 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public RaceV2Api <>4__this; public Action onDone; private UnityWebRequest 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__17(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } 5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Invalid comparison between Unknown and I4 try { int num = <>1__state; RaceV2Api raceV2Api = <>4__this; switch (num) { default: return false; case 0: { <>1__state = -1; string text = EnvironmentService.Instance.GetEnvironment().Endpoint + "/race/current"; raceV2Api._log.LogDebug((object)("GetUsersCurrentRace endpoint " + text)); Debug.Log((object)("GetUsersCurrentRace endpoint " + text)); 5__2 = UnityWebRequest.Get(text); <>1__state = -3; raceV2Api.AddHeaders(5__2); <>2__current = 5__2.SendWebRequest(); <>1__state = 1; return true; } case 1: { <>1__state = -3; Result result = 5__2.result; if (result - 2 <= 1) { raceV2Api._log.LogError((object)("Error trying to fetch race data : " + 5__2.error)); } else { raceV2Api._log.LogInfo((object)("Updated race data fetched : " + 5__2.downloadHandler.text)); Race arg = JsonConvert.DeserializeObject(5__2.downloadHandler.text, Converter.Settings); string requestHeader = 5__2.GetRequestHeader("Authorization"); onDone(arg, requestHeader); } <>m__Finally1(); 5__2 = null; return false; } } } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (5__2 != null) { ((IDisposable)5__2).Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__12 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string username; public RaceV2Api <>4__this; public Action onDone; private UnityWebRequest 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__12(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } 5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_0091: 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_0098: 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_009d: Invalid comparison between Unknown and I4 try { int num = <>1__state; RaceV2Api raceV2Api = <>4__this; switch (num) { default: return false; case 0: { <>1__state = -1; string text = EnvironmentService.Instance.GetEnvironment().Endpoint + "/user/" + username; 5__2 = UnityWebRequest.Post(text, (string)null); <>1__state = -3; raceV2Api.AddHeaders(5__2); <>2__current = 5__2.SendWebRequest(); <>1__state = 1; return true; } case 1: { <>1__state = -3; Result result = 5__2.result; if (result - 2 <= 1) { raceV2Api._log.LogError((object)("Error during login : " + 5__2.error)); } else { raceV2Api._log.LogInfo((object)("Login success : " + 5__2.downloadHandler.text)); T obj = JsonConvert.DeserializeObject(5__2.downloadHandler.text, Converter.Settings); onDone(obj); } <>m__Finally1(); 5__2 = null; return false; } } } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (5__2 != null) { ((IDisposable)5__2).Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__15 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public RaceV2Api <>4__this; public RunSubmission runSubmission; private UnityWebRequest 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__15(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } 5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Invalid comparison between Unknown and I4 //IL_0130: Unknown result type (might be due to invalid IL or missing references) try { int num = <>1__state; RaceV2Api raceV2Api = <>4__this; switch (num) { default: return false; case 0: { <>1__state = -1; string lobbyCode = LoadoutHandler.Instance.Race.LobbyCode; string text = EnvironmentService.Instance.GetEnvironment().Endpoint + "/race/" + lobbyCode + "/submitRun"; raceV2Api._log.LogDebug((object)("Submit endpoint " + text)); string text2 = JsonConvert.SerializeObject((object)runSubmission); raceV2Api._log.LogDebug((object)("post data : " + text2)); 5__2 = UnityWebRequest.Put(text, text2); <>1__state = -3; raceV2Api.AddHeaders(5__2); <>2__current = 5__2.SendWebRequest(); <>1__state = 1; return true; } case 1: { <>1__state = -3; Result result = 5__2.result; if (result - 2 <= 1) { raceV2Api._log.LogError((object)("Error while submitting run : " + 5__2.error)); raceV2Api._log.LogError((object)$"getError : {5__2.GetError()}"); foreach (KeyValuePair responseHeader in 5__2.GetResponseHeaders()) { raceV2Api._log.LogError((object)("Response header > " + responseHeader.Key + " : " + responseHeader.Value)); } } else { raceV2Api._log.LogInfo((object)("Submit completed: " + 5__2.downloadHandler.text)); } <>m__Finally1(); 5__2 = null; return false; } } } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (5__2 != null) { ((IDisposable)5__2).Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__7 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public RaceV2Api <>4__this; public string lobbyCode; public string lobbyPassword; public int team; public Action onDone; private UnityWebRequest 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__7(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } 5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Invalid comparison between Unknown and I4 bool result2; try { int num = <>1__state; RaceV2Api raceV2Api = <>4__this; switch (num) { default: result2 = false; break; case 0: { <>1__state = -1; raceV2Api._log.LogInfo((object)("JoinLobby(" + lobbyCode.ToUpper() + ")")); string text = EnvironmentService.Instance.GetEnvironment().Endpoint + "/race/" + lobbyCode + "/join"; JoinLobbyRequest joinLobbyRequest = new JoinLobbyRequest { Password = lobbyPassword, Team = team }; 5__2 = UnityWebRequest.Put(text, JsonConvert.SerializeObject((object)joinLobbyRequest)); <>1__state = -3; raceV2Api.AddHeaders(5__2); <>2__current = 5__2.SendWebRequest(); <>1__state = 1; result2 = true; break; } case 1: { <>1__state = -3; Result result = 5__2.result; if (result - 2 <= 1) { raceV2Api._log.LogError((object)("Error while joining lobby : " + 5__2.error)); Debug.Log((object)("Error while joining lobby : " + 5__2.error)); } else { Race race = JsonConvert.DeserializeObject(5__2.downloadHandler.text, Converter.Settings); LoadoutHandler.Instance.RegisterRace(race); Debug.Log((object)("Joined lobby '" + lobbyCode + "'")); onDone(race); } result2 = false; <>m__Finally1(); break; } } } catch { //try-fault ((IDisposable)this).Dispose(); throw; } return result2; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (5__2 != null) { ((IDisposable)5__2).Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private readonly ManualLogSource _log = Logger.CreateLogSource("RoResV2Api"); public static RaceV2Api Instance { get; } = new RaceV2Api(); private void AddHeaders(UnityWebRequest uwr) { string apiKey = EnvironmentService.Instance.GetEnvironment().ApiKey; uwr.SetRequestHeader("x-api-key", apiKey); uwr.SetRequestHeader("Content-Type", "application/json"); if (!string.IsNullOrEmpty(Main.instance.authorization)) { uwr.SetRequestHeader("Authorization", Main.instance.authorization ?? ""); } } public void SignIn(string username) { Debug.Log((object)("SignIn(" + username + ")")); ((MonoBehaviour)Main.instance).StartCoroutine(InvokeSignIn(username, delegate(User u) { Debug.Log((object)("Received user Id : " + u.Id)); Main.UserId.Value = u.Id; })); } public Task SignInWeb() { if (WebService.Instance.NegotiatedPort > 0) { TaskCompletionSource tcs = new TaskCompletionSource(); string webUrl = EnvironmentService.Instance.GetEnvironment().WebUrl; Application.OpenURL($"{webUrl}/authorize?callback=http://localhost:{WebService.Instance.NegotiatedPort}/"); WebService.Instance.SignedIn += delegate { tcs.TrySetResult(null); }; return tcs.Task; } return Task.Run(async delegate { UserInfo userInfo = await InvokeSignInWeb(); if (Debug.IsLoggingEnabled()) { Debug.LogWarning((object)("Received user Id from web: " + userInfo.User.Id)); } Debug.LogWarning((object)("Login successful: " + userInfo.User.Username)); string authorization = Convert.ToBase64String(Encoding.UTF8.GetBytes(userInfo.Auth.ToJson())).Replace("=", ""); Main.instance.authorization = authorization; Main.UserId.Value = userInfo.User.Id; }); } [IteratorStateMachine(typeof(d__7))] public IEnumerator JoinLobby(string lobbyCode, string lobbyPassword, Action onDone, int team = 0) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__7(0) { <>4__this = this, lobbyCode = lobbyCode, lobbyPassword = lobbyPassword, onDone = onDone, team = team }; } public void AuditLobby(long id) { ((MonoBehaviour)Main.instance).StartCoroutine(Instance.GetRaceById(id, delegate(Race race) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown LoadoutHandler.Instance.RegisterRace(race); if (Object.op_Implicit((Object)(object)MainMenuController.instance)) { Console.instance.SubmitCmd((NetworkUser)null, "transition_command \"gamemode ClassicRun; host 0; \"", false); } else { object obj2 = <>O.<0>__onEnter; if (obj2 == null) { hook_OnEnter val2 = onEnter; <>O.<0>__onEnter = val2; obj2 = (object)val2; } BaseMainMenuScreen.OnEnter -= (hook_OnEnter)obj2; object obj3 = <>O.<0>__onEnter; if (obj3 == null) { hook_OnEnter val3 = onEnter; <>O.<0>__onEnter = val3; obj3 = (object)val3; } BaseMainMenuScreen.OnEnter += (hook_OnEnter)obj3; Console.instance.SubmitCmd((NetworkUser)null, "transition_command \"disconnect; \"", false); } Debug.Log((object)$"Auditing lobby: {id}"); })); static void onEnter(orig_OnEnter orig, BaseMainMenuScreen self, MainMenuController controller) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown orig.Invoke(self, controller); Console.instance.SubmitCmd((NetworkUser)null, "transition_command \"gamemode ClassicRun; host 0; \"", false); object obj = <>O.<0>__onEnter; if (obj == null) { hook_OnEnter val = onEnter; <>O.<0>__onEnter = val; obj = (object)val; } BaseMainMenuScreen.OnEnter -= (hook_OnEnter)obj; } } [IteratorStateMachine(typeof(d__9<>))] private IEnumerator GetRaceById(long id, Action onDone) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__9(0) { <>4__this = this, id = id, onDone = onDone }; } [IteratorStateMachine(typeof(d__10<>))] public IEnumerator GetRaceData(string lobbyCode, Action onDone) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__10(0) { <>4__this = this, lobbyCode = lobbyCode, onDone = onDone }; } public void SubmitRun(RunSubmission runSubmission) { _log.LogInfo((object)("SubmitRun(" + runSubmission.ToJson() + ")")); ((MonoBehaviour)Main.instance).StartCoroutine(InvokeSubmitRun(runSubmission)); } [IteratorStateMachine(typeof(d__12<>))] private IEnumerator InvokeSignIn(string username, Action onDone) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__12(0) { <>4__this = this, username = username, onDone = onDone }; } private async Task InvokeSignInWeb() { using HttpListener listener = new HttpListener(); bool flag = false; int i; for (i = 49152; i < 65536 && !flag; i++) { try { listener.Prefixes.Add($"http://*:{i}/"); listener.Start(); flag = true; if (Debug.IsLoggingEnabled()) { Debug.Log((object)$"Listening for user on port {i}"); } } catch (Exception ex) { listener.Prefixes.Clear(); if (Debug.IsLoggingEnabled()) { Debug.Log((object)$"Couldn't bind port: {i}. {ex.Message}"); } continue; } break; } string webUrl = EnvironmentService.Instance.GetEnvironment().WebUrl; Application.OpenURL($"{webUrl}/authorize?callback=http://localhost:{i}/"); string origin; if (flag) { Debug.Log((object)"Check for browser opening!"); Debug.Log((object)$"If the browser doesn't open automatically you should open {webUrl}/authorize?callback=http://localhost:{i}/"); HttpListenerContext httpListenerContext = await listener.GetContextAsync(); origin = httpListenerContext.Request.Headers.Get("origin"); if (httpListenerContext.Request.HttpMethod == HttpMethod.Options.Method) { addCorsHeaders(httpListenerContext.Response); httpListenerContext.Response.OutputStream.Close(); httpListenerContext = await listener.GetContextAsync(); } addCorsHeaders(httpListenerContext.Response); if (httpListenerContext.Request.HttpMethod == HttpMethod.Post.Method && httpListenerContext.Request.ContentType == "application/json") { using (StreamReader reader = new StreamReader(httpListenerContext.Request.InputStream, httpListenerContext.Request.ContentEncoding)) { return JsonConvert.DeserializeObject(await reader.ReadToEndAsync()); } } Debug.Log((object)"Response was not Json"); } else if (Debug.IsLoggingEnabled()) { Debug.LogError((object)"Failed to start the server."); } return null; void addCorsHeaders(HttpListenerResponse response) { if (origin != null && (origin.EndsWith("riskofresources.com") || origin.EndsWith("localhost"))) { response.AddHeader("Access-Control-Allow-Headers", "Authorization,Content-Type"); response.AddHeader("Access-Control-Allow-Methods", "POST,OPTIONS"); response.AddHeader("Access-Control-Allow-Origin", origin); } } } [IteratorStateMachine(typeof(d__15))] public IEnumerator InvokeSubmitRun(RunSubmission runSubmission) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__15(0) { <>4__this = this, runSubmission = runSubmission }; } public void JoinCurrentRace(Action onDone) { ((MonoBehaviour)Main.instance).StartCoroutine(InvokeGetUsersCurrentRace(delegate(Race race, string auth) { Main.instance.authorization = auth; LoadoutHandler.Instance.RegisterRace(race); Debug.Log((object)$"Race successfully received : {race}"); Debug.Log((object)("Joined lobby '" + race.LobbyCode + "'")); onDone(race); })); } [IteratorStateMachine(typeof(d__17<>))] private IEnumerator InvokeGetUsersCurrentRace(Action onDone) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__17(0) { <>4__this = this, onDone = onDone }; } } internal sealed class EnvironmentService { private readonly ManualLogSource _log = Logger.CreateLogSource("EnvironmentService"); private readonly Dictionary _environmentMap = new Dictionary(); public static EnvironmentService Instance { get; } = new EnvironmentService(); private EnvironmentService() { Environment value = new Environment("https://tletsx8le3.execute-api.us-east-1.amazonaws.com/Prod", "uXTWWu8WyLaEPPwM5JggX4EJbSWB9jKa2ei7hXkk", "https://riskofresources.com"); Environment value2 = new Environment("https://kwtoi865tl.execute-api.us-east-1.amazonaws.com/Prod", "uXTWWu8WyLaEPPwM5JggX4EJbSWB9jKa2ei7hXkk", "https://dev.riskofresources.com"); Environment value3 = new Environment("http://127.0.0.1:3000/", "uXTWWu8WyLaEPPwM5JggX4EJbSWB9jKa2ei7hXkk", "http://localhost:3001"); _environmentMap.Add("prd", value); _environmentMap.Add("dev", value2); _environmentMap.Add("dbg", value3); } public Environment GetEnvironment() { string value = Main.EnvironmentName.Value; try { return _environmentMap[value]; } catch (KeyNotFoundException ex) { _log.LogError((object)ex.StackTrace); _log.LogError((object)("Environment '" + value + "' not found; returning first available")); return _environmentMap.Values.ToList().First(); } } } internal sealed class Environment { public readonly string Endpoint; public readonly string ApiKey; public readonly string WebUrl; public Environment(string endpoint, string apiKey, string webUrl) { Endpoint = endpoint; ApiKey = apiKey; WebUrl = webUrl; } } } namespace RoRGauntlet { public sealed class AntiCheat : MonoBehaviour { private Harmony _harmonyInstance; private void OnEnable() { if (Chainloader.PluginInfos.ContainsKey("iHarbHD.DebugToolkit")) { _harmonyInstance = Harmony.CreateAndPatchAll(typeof(AntiCheat), (string)null); } } private void OnDisable() { Harmony harmonyInstance = _harmonyInstance; if (harmonyInstance != null) { harmonyInstance.UnpatchSelf(); } _harmonyInstance = null; } [HarmonyPatch(typeof(MacroSystem), "Update")] [HarmonyPrefix] private static bool CheckForKeyDown() { return !(LoadoutHandler.Instance.Race?.Sanctioned ?? false); } } internal static class Assets { public static GameObject lazarusResurrectionEffect; public static List swappedMaterials = new List(); public static void Initialize(string infoLocation) { try { PopulateAssets(infoLocation); } catch (Exception arg) { Debug.LogWarning((object)$"Failed to populate assets: {arg}"); } } private static void PopulateAssets(string infoLocation) { AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(infoLocation) ?? string.Empty, "riskofresourcesassets")); lazarusResurrectionEffect = val.LoadAsset("LazarusWingsRez"); if (!ContentAddition.AddEffect(lazarusResurrectionEffect)) { Log.Error("lazarusResurrectionEffect is not valid.", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/Assets.cs", "PopulateAssets", 35); return; } Material[] array = (from mat in val.LoadAllAssets() where ((Object)mat.shader).name.StartsWith("Stubbed") select mat).ToArray(); foreach (Material val2 in array) { if (!((Object)val2.shader).name.StartsWith("Stubbed")) { Log.Warning($"The material {val2} is invalid.", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/Assets.cs", "PopulateAssets", 45); continue; } try { SwapShader(val2); } catch (Exception arg) { Log.Error($"Failed to swap shader of material {val2}: {arg}", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/Assets.cs", "PopulateAssets", 55); } } } private static void SwapShader(Material material) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) Shader shader = Addressables.LoadAssetAsync((object)(((Object)material.shader).name.Substring("Stubbed".Length) + ".shader")).WaitForCompletion(); material.shader = shader; if (((Object)material.shader).name.Contains("Cloud Remap")) { Material val = Addressables.LoadAssetAsync((object)"RoR2/Base/Common/VFX/matLightningLongBlue.mat").WaitForCompletion(); RuntimeCloudMaterialMapper runtimeCloudMaterialMapper = new RuntimeCloudMaterialMapper(material); material.CopyPropertiesFromMaterial(val); runtimeCloudMaterialMapper.SetMaterialValues(ref material); } swappedMaterials.Add(material); } } public sealed class BenthicBloomSeeding : MonoBehaviour { private delegate bool TryOverrideTransformedItemDelegate(ItemIndex itemToTransform, CharacterMaster master, ref ItemDef transformedItem); private BenthicBloomTransformationProvider _bloomTransformationProvider; private void OnEnable() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown RunHooks.OnRunPostStartGlobal += onRunPostStartGlobal; CharacterMaster.TryCloverVoidUpgrades += new Manipulator(CharacterMaster_TryCloverVoidUpgrades); } private void OnDisable() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown RunHooks.OnRunPostStartGlobal -= onRunPostStartGlobal; CharacterMaster.TryCloverVoidUpgrades -= new Manipulator(CharacterMaster_TryCloverVoidUpgrades); } private void onRunPostStartGlobal(Run run) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown Xoroshiro128Plus val = new Xoroshiro128Plus(run.seed ^ 0x3EABE82DFA7uL); _bloomTransformationProvider = new BenthicBloomTransformationProvider(val.nextUlong, run); } private void CharacterMaster_TryCloverVoidUpgrades(ILContext il) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); int transformableItemsLocalIndex = -1; ILCursor[] array = default(ILCursor[]); if (!val.TryFindNext(ref array, new Func[3] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "itemAcquisitionOrder"), (Instruction x) => ILPatternMatchingExt.MatchNewobj>(x), (Instruction x) => x.MatchStloc(typeof(List), il, out transformableItemsLocalIndex) })) { Log.Error("Failed to find transformable items list local index", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/BenthicBloomSeeding.cs", "CharacterMaster_TryCloverVoidUpgrades", 49); return; } if (!val.TryFindNext(ref array, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, transformableItemsLocalIndex), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)typeof(List).GetProperty("Item").GetMethod) })) { Log.Error("Failed to find transformable items shuffle patch location", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/BenthicBloomSeeding.cs", "CharacterMaster_TryCloverVoidUpgrades", 57); return; } val.Goto(array[1].Next, (MoveType)2, false); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getNextItemToTransform); VariableDefinition val2 = il.AddVariable(); val.Emit(OpCodes.Dup); val.Emit(OpCodes.Stloc, val2); if (!val.TryGotoNext(new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)typeof(List).GetMethod("Sort", new Type[1] { typeof(Comparison) })) })) { Log.Error("Failed to find transform item selection location", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/BenthicBloomSeeding.cs", "CharacterMaster_TryCloverVoidUpgrades", 71); return; } int availableTransformedItemsLocalIndex = -1; ILCursor[] array2 = default(ILCursor[]); if (!val.TryFindPrev(ref array2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref availableTransformedItemsLocalIndex) && Extensions.Is((MemberReference)(object)((VariableReference)il.Body.Variables[availableTransformedItemsLocalIndex]).VariableType, (MemberInfo)typeof(List)) })) { Log.Error("Failed to find available transformed items list local index", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/BenthicBloomSeeding.cs", "CharacterMaster_TryCloverVoidUpgrades", 79); return; } int transformedItemDefLocalIndex = -1; if (!val.TryFindNext(ref array2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref transformedItemDefLocalIndex) && Extensions.Is((MemberReference)(object)((VariableReference)il.Body.Variables[transformedItemDefLocalIndex]).VariableType, (MemberInfo)typeof(ItemDef)) })) { Log.Error("Failed to find transformed item def local index", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/BenthicBloomSeeding.cs", "CharacterMaster_TryCloverVoidUpgrades", 87); return; } ILLabel afterSelectTransformedItemLabel = null; if (!val.TryGotoPrev((MoveType)1, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, availableTransformedItemsLocalIndex), (Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref afterSelectTransformedItemLabel) })) { Log.Error("Failed to find transformed item select patch location", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/BenthicBloomSeeding.cs", "CharacterMaster_TryCloverVoidUpgrades", 96); return; } val.Emit(OpCodes.Ldloc, val2); val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldloca, transformedItemDefLocalIndex); val.EmitDelegate<<>F{00000040}>((<>F{00000040})tryOverrideTransformedItem); val.Emit(OpCodes.Brtrue, (object)afterSelectTransformedItemLabel); } private static bool shouldSeed(CharacterMaster master) { if (Object.op_Implicit((Object)(object)master) && Object.op_Implicit((Object)(object)master.inventory)) { return Object.op_Implicit((Object)(object)master.playerCharacterMasterController); } return false; } private ItemIndex getNextItemToTransform(ItemIndex itemToTransform, CharacterMaster master) { //IL_0075: 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) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: 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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) if (shouldSeed(master) && _bloomTransformationProvider != null) { if (!_bloomTransformationProvider.TryGetNextItemToTake(master.inventory.itemAcquisitionOrder, out var nextItemToTake)) { nextItemToTake = itemToTransform; foreach (ItemIndex item in master.inventory.itemAcquisitionOrder) { if (!_bloomTransformationProvider.IsValidItemToTake(item)) { nextItemToTake = item; break; } } } itemToTransform = nextItemToTake; } return itemToTransform; } private bool tryOverrideTransformedItem(ItemIndex itemToTransform, CharacterMaster master, ref ItemDef transformedItem) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) if (!shouldSeed(master)) { return false; } if (_bloomTransformationProvider == null) { return false; } if (!_bloomTransformationProvider.TryGetNextTransformation(itemToTransform, out var transformation)) { transformation = (ItemIndex)(-1); } transformedItem = ItemCatalog.GetItemDef(transformation); return true; } } public sealed class BenthicBloomTransformationProvider { private static ItemIndex[] _availableInputItems = Array.Empty(); private readonly Dictionary> _tierTransformationGenerators; private readonly OrderedTransformationGenerator _itemTakeOrderGenerator; [SystemInitializer(new Type[] { typeof(ItemCatalog) })] private static void Init() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) _availableInputItems = (from item in (IEnumerable)(object)ItemCatalog.allItemDefs where Object.op_Implicit((Object)(object)item) && ((int)item.tier == 0 || (int)item.tier == 1) select item.itemIndex).ToArray(); } public BenthicBloomTransformationProvider(ulong seed, Run run) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown Xoroshiro128Plus val = new Xoroshiro128Plus(seed); _itemTakeOrderGenerator = new OrderedTransformationGenerator(val.nextUlong, (IEnumerable)_availableInputItems); _tierTransformationGenerators = new Dictionary> { { (ItemTier)0, new OrderedTransformationGenerator(val.nextUlong, dropListToItemIndices(run.availableTier2DropList)) }, { (ItemTier)1, new OrderedTransformationGenerator(val.nextUlong, dropListToItemIndices(run.availableTier3DropList)) } }; static IEnumerable dropListToItemIndices(IEnumerable pickupIndices) { return from pickupIndex in pickupIndices select (ItemIndex)(((??)PickupCatalog.GetPickupDef(pickupIndex)?.itemIndex) ?? (-1)) into i where (int)i != -1 select i; } } public bool IsValidItemToTake(ItemIndex itemIndex) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return _itemTakeOrderGenerator.Contains(itemIndex); } public bool TryGetNextItemToTake(ICollection availableItems, out ItemIndex nextItemToTake) { if (!availableItems.Any(IsValidItemToTake)) { nextItemToTake = (ItemIndex)(-1); return false; } return _itemTakeOrderGenerator.TryGetNextTransformation(availableItems.Contains, out nextItemToTake); } public bool TryGetNextTransformation(ItemIndex original, out ItemIndex transformation) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) ItemDef originalItemDef = ItemCatalog.GetItemDef(original); if (!Object.op_Implicit((Object)(object)originalItemDef)) { transformation = (ItemIndex)(-1); return false; } if (!_tierTransformationGenerators.TryGetValue(originalItemDef.tier, out var value)) { transformation = (ItemIndex)(-1); return false; } if (!value.TryGetNextTransformation(matchTags, out transformation)) { return value.TryGetNextTransformation(out transformation); } return true; bool matchTags(ItemIndex itemIndex) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) ItemDef itemDef = ItemCatalog.GetItemDef(itemIndex); if (!Object.op_Implicit((Object)(object)itemDef)) { return false; } bool num = originalItemDef.ContainsTag((ItemTag)1) && itemDef.ContainsTag((ItemTag)1); bool flag = originalItemDef.ContainsTag((ItemTag)2) && itemDef.ContainsTag((ItemTag)2); bool flag2 = originalItemDef.ContainsTag((ItemTag)3) && itemDef.ContainsTag((ItemTag)3); return num || flag || flag2; } } } public sealed class ConcedeService { private static void ShowConcedeNotAllowed(PauseScreenController pauseScreen) { //IL_0011: 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) SimpleDialogBox obj = SimpleDialogBox.Create((MPEventSystem)null); obj.headerToken = new TokenParamsPair("No times submitted", Array.Empty()); string text = "You cannot concede as nobody has submitted a time yet"; if (pauseScreen == null) { text += " Use info screen button (usually tab/select) to move cursor."; } obj.descriptionToken = new TokenParamsPair(text, Array.Empty()); obj.AddCancelButton("Cancel", Array.Empty()); } private static void ShowConcedeConfirmationDialog(PauseScreenController pauseScreen) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown SimpleDialogBox obj = SimpleDialogBox.Create((MPEventSystem)null); obj.headerToken = new TokenParamsPair("Are you sure?", Array.Empty()); string text = "Are you sure you want to concede this run?"; if (pauseScreen == null) { text += " Use info screen button (usually tab/select) to move cursor."; } obj.descriptionToken = new TokenParamsPair(text, Array.Empty()); obj.AddActionButton((UnityAction)delegate { ActuallyConcedeGame(pauseScreen); }, "Yes", true, Array.Empty()); obj.AddCancelButton("Cancel", Array.Empty()); } private static void ActuallyConcedeGame(PauseScreenController pauseScreen) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)pauseScreen)) { Object.Destroy((Object)(object)((Component)pauseScreen).gameObject); } if (Object.op_Implicit((Object)(object)Run.instance)) { Main.ConcedeCheck = true; GameEndingDef val = ScriptableObject.CreateInstance(); val.isWin = false; val.showCredits = false; val.lunarCoinReward = 0u; RunReport.Generate(Run.instance, val); Run.CCRunEnd(default(ConCommandArgs)); Main.ConcedeCheck = false; } } public void ConcedeGame(PauseScreenController pauseScreen) { string lobbyCode = LoadoutHandler.Instance.Race.LobbyCode; int currentLoadout = Main.CurrentLoadout.Value; ((MonoBehaviour)Main.instance).StartCoroutine(RaceV2Api.Instance.GetRaceData(lobbyCode, delegate(Race race) { if (!race.Sanctioned) { ShowConcedeConfirmationDialog(pauseScreen); } else { List list = (from s in race.RunSubmissions ?? new List() where s != null where s.LoadoutId == currentLoadout select s).ToList(); if (SimpleDialogBox.instancesList.Count <= 0) { if (list.Count > 0) { Log.Info("Found submission(s) from other player(s); concede is allowed", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/ConcedeService.cs", "ConcedeGame", 90); ShowConcedeConfirmationDialog(pauseScreen); } else { Log.Info("Can't concede when no other players have submitted their run", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/ConcedeService.cs", "ConcedeGame", 95); ShowConcedeNotAllowed(pauseScreen); } } } })); } } public sealed class ConcedeUI : MonoBehaviour { private readonly ConcedeService _concedeService = new ConcedeService(); public void OnEnable() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown PauseScreenController.Awake += new hook_Awake(PauseScreenControllerOnAwake); } public void OnDisable() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown PauseScreenController.Awake -= new hook_Awake(PauseScreenControllerOnAwake); } private void PauseScreenControllerOnAwake(orig_Awake orig, PauseScreenController self) { //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Expected O, but got Unknown //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Expected O, but got Unknown orig.Invoke(self); ButtonSkinController componentInChildren = ((Component)self).GetComponentInChildren(); if (!Object.op_Implicit((Object)(object)componentInChildren)) { Debug.LogWarning((object)"Failed to get button skin controller"); return; } GameObject gameObject = ((Component)componentInChildren).gameObject; GameObject obj = Object.Instantiate(gameObject, gameObject.transform.parent); ((Object)obj).name = "Concede Button"; LanguageTextMeshController val = default(LanguageTextMeshController); if (obj.TryGetComponent(ref val)) { val.token = "Concede Run"; } HGButton val2 = default(HGButton); if (!obj.TryGetComponent(ref val2)) { Debug.LogWarning((object)"Failed to setup concede button"); Object.Destroy((Object)(object)gameObject); return; } ((Button)val2).onClick = new ButtonClickedEvent(); ((UnityEvent)((Button)val2).onClick).AddListener((UnityAction)delegate { _concedeService.ConcedeGame(self); }); } } public sealed class ConfigurablePillars : MonoBehaviour { [CompilerGenerated] private static class <>O { public static hook_Awake <0>__OnMoonBatteryMissionControllerOnAwake; } private void OnEnable() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown object obj = <>O.<0>__OnMoonBatteryMissionControllerOnAwake; if (obj == null) { hook_Awake val = OnMoonBatteryMissionControllerOnAwake; <>O.<0>__OnMoonBatteryMissionControllerOnAwake = val; obj = (object)val; } MoonBatteryMissionController.Awake += (hook_Awake)obj; } private void OnDisable() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown object obj = <>O.<0>__OnMoonBatteryMissionControllerOnAwake; if (obj == null) { hook_Awake val = OnMoonBatteryMissionControllerOnAwake; <>O.<0>__OnMoonBatteryMissionControllerOnAwake = val; obj = (object)val; } MoonBatteryMissionController.Awake -= (hook_Awake)obj; } private static void OnMoonBatteryMissionControllerOnAwake(orig_Awake orig, MoonBatteryMissionController self) { orig.Invoke(self); self._numRequiredBatteries = Main.PillarNum.Value; } } internal static class DebugCommands { [ConCommand(/*Could not decode attribute arguments.*/)] private static void NextLoadout(ConCommandArgs args) { if (Main.CurrentLoadout.Value < LoadoutHandler.Instance.GetLoadouts().Count - 1) { ConfigEntry currentLoadout = Main.CurrentLoadout; int value = currentLoadout.Value; currentLoadout.Value = value + 1; } Log.Info("Progressed to loadout " + Main.CurrentLoadout.Value, "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/Configuration/DebugCommands.cs", "NextLoadout", 15); } [ConCommand(/*Could not decode attribute arguments.*/)] private static void SetLoadout(ConCommandArgs args) { Main.CurrentLoadout.Value = ((ConCommandArgs)(ref args)).GetArgInt(0); Debug.Log((object)$"Loadout number has been set to : {Main.CurrentLoadout.Value}"); } [ConCommand(/*Could not decode attribute arguments.*/)] private static void SetDifficulty(ConCommandArgs args) { string argString = ((ConCommandArgs)(ref args)).GetArgString(0); string[] obj = new string[12] { "Eclipse8", "Eclipse7", "Eclipse6", "Eclipse5", "Eclipse4", "Eclipse3", "Eclipse2", "Eclipse1", "Hard", "Normal", "Easy", "Any" }; bool flag = false; string[] array = obj; foreach (string text in array) { if (argString == text) { flag = true; } } if (flag) { Main.DifficultySelect.Value = argString; Log.Info("Set difficulty config to to " + argString, "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/Configuration/DebugCommands.cs", "SetDifficulty", 45); } } [ConCommand(/*Could not decode attribute arguments.*/)] private static void ListNameTokens(ConCommandArgs args) { Debug.Log((object)"Available Survivor Tokens"); foreach (SurvivorDef allSurvivorDef in SurvivorCatalog.allSurvivorDefs) { Debug.Log((object)allSurvivorDef.displayNameToken); } } [ConCommand(/*Could not decode attribute arguments.*/)] private static void SubmitRun(ConCommandArgs args) { SubmitRun componentInChildren = ((Component)Main.instance).GetComponentInChildren(true); if (componentInChildren.RunSubmission != null) { RaceV2Api.Instance.SubmitRun(componentInChildren.RunSubmission); } else { Debug.LogWarning((object)"No run submission found"); } } } internal static class SetupCommands { [ConCommand(/*Could not decode attribute arguments.*/)] private static void SignIn(ConCommandArgs args) { LogEnv(); RaceV2Api instance = RaceV2Api.Instance; string text = ((ConCommandArgs)(ref args)).TryGetArgString(0); if (string.IsNullOrEmpty(text)) { instance.SignInWeb(); } else { instance.SignIn(text); } } [ConCommand(/*Could not decode attribute arguments.*/)] private static void SetEnvironment(ConCommandArgs args) { LogEnv(); string text = ((ConCommandArgs)(ref args)).GetArgString(0).ToLower(); Main.EnvironmentName.Value = text; if (!text.Equals("prd") && !text.Equals("dev") && !text.Equals("dbg")) { Debug.LogError((object)"Invalid environment. Use 'prd' or 'dev'"); } else { Debug.Log((object)("Environment set to : " + text)); } } [ConCommand(/*Could not decode attribute arguments.*/)] private static void SetTeam(ConCommandArgs args) { LogEnv(); int argInt = ((ConCommandArgs)(ref args)).GetArgInt(0); Log.Info($"Team number has been set to : {argInt}", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/Configuration/SetupCommands.cs", "SetTeam", 48); } [ConCommand(/*Could not decode attribute arguments.*/)] private static async void JoinRace(ConCommandArgs args) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) LogEnv(); RaceV2Api instance = RaceV2Api.Instance; string lobbyCode = ((ConCommandArgs)(ref args)).TryGetArgString(0); int? team = ((ConCommandArgs)(ref args)).TryGetArgInt(1); string password = ((ConCommandArgs)(ref args)).TryGetArgString(2); bool flag = string.IsNullOrEmpty(Main.UserId.Value) || string.IsNullOrEmpty(Main.instance.authorization); if (string.IsNullOrEmpty(lobbyCode)) { if (flag) { Debug.Log((object)"Can't join active lobby without a user ID; please `sign_in` first"); return; } Debug.Log((object)"Joining current race"); instance.JoinCurrentRace(delegate(Race race) { LoadoutHandler.Instance.RegisterRace(race); Console.instance.SubmitCmd((NetworkUser)null, "transition_command \"gamemode ClassicRun; host 0; \"", false); }); return; } if (flag) { Debug.Log((object)"No user session: signing in first"); await instance.SignInWeb(); } ((MonoBehaviour)Main.instance).StartCoroutine(instance.JoinLobby(lobbyCode, password, delegate(Race race) { LoadoutHandler.Instance.RegisterRace(race); Console.instance.SubmitCmd((NetworkUser)null, "transition_command \"gamemode ClassicRun; host 0; \"", false); }, team.GetValueOrDefault(0))); } [ConCommand(/*Could not decode attribute arguments.*/)] private static void AuditRace(ConCommandArgs args) { RaceV2Api instance = RaceV2Api.Instance; ulong argULong = ((ConCommandArgs)(ref args)).GetArgULong(0); instance.AuditLobby((long)argULong); } [ConCommand(/*Could not decode attribute arguments.*/)] private static void SignOut(ConCommandArgs args) { Main.UserId.Value = ""; } private static void LogEnv() { string value = Main.EnvironmentName.Value; Debug.Log((object)("Current environment : " + value)); } } public sealed class ContainInArenaHandler : MonoBehaviour { private sealed class ContainInArena : MonoBehaviour { private const float MinHeight = 485f; private Vector3 _startPosition; private CharacterMotor _characterMotor; private void Awake() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) _characterMotor = ((Component)this).gameObject.GetComponent(); if (!Object.op_Implicit((Object)(object)_characterMotor)) { Log.Warning("No character motor so character won't TP back to arena", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/ContainInArenaHandler.cs", "Awake", 66); ((Behaviour)this).enabled = false; return; } Scene activeScene = SceneManager.GetActiveScene(); string name = ((Scene)(ref activeScene)).name; _startPosition = ((Component)this).gameObject.transform.position; ((Behaviour)this).enabled = _startPosition.y > 450f && name == "moon2"; } public void TeleportBack() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001c: 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_0039: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)this).gameObject.transform.position; ((BaseCharacterController)_characterMotor).Motor.SetPosition(new Vector3(position.x, _startPosition.y + 7f, position.z), true); } private void FixedUpdate() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) if (((Component)this).gameObject.transform.position.y < 485f) { TeleportBack(); } } } public string key = "RoR2/Base/Brother/BrotherBody.prefab"; private ContainInArena _containInArena; private AsyncOperationHandle _handle; private void Start() { //IL_0007: 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) _handle = Addressables.LoadAssetAsync((object)key); _handle.Completed += OnLoadBody; } private void OnDisable() { Object.Destroy((Object)(object)_containInArena); } private void OnDestroy() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) Addressables.Release(_handle); } private void OnEnable() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Invalid comparison between Unknown and I4 //IL_001d: Unknown result type (might be due to invalid IL or missing references) if (_handle.IsValid() && (int)_handle.Status == 1) { OnLoadBody(_handle); } } private void OnLoadBody(AsyncOperationHandle obj) { CharacterBody val = default(CharacterBody); if (!obj.Result.TryGetComponent(ref val)) { Log.Warning("No Character body", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/ContainInArenaHandler.cs", "OnLoadBody", 43); } else if (!((Behaviour)this).isActiveAndEnabled) { Log.Warning("ContainInArenaHandler not enabled!", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/ContainInArenaHandler.cs", "OnLoadBody", 48); } else { _containInArena = ((Component)val).gameObject.AddComponent(); } } } public sealed class DLC2 : MonoBehaviour { private static Xoroshiro128Plus stage; private static Xoroshiro128Plus item; private event Action _onDisable; private void OnEnable() { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected O, but got Unknown //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Expected O, but got Unknown //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Expected O, but got Unknown //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Expected O, but got Unknown AddSceneToGroup("RoR2/Base/SceneGroups/sgStage2.asset", "RoR2/DLC2/lemuriantemple/lemuriantemple.asset"); AddSceneToGroup("RoR2/Base/SceneGroups/sgStage3.asset", "RoR2/DLC2/habitat/habitat.asset"); AddSceneToGroup("RoR2/Base/SceneGroups/loopSgStage3.asset", "RoR2/DLC2/habitatfall/habitatfall.asset"); ChangeDestination("RoR2/DLC2/PortalColossus.prefab"); ReplacePortals("RoR2/DLC2/ShrineHalcyonite.prefab", "RoR2/DLC2/iscColossusPortal.asset"); Run.onRunStartGlobal += MarkFalseSonComplete; PurchaseInteraction.OnInteractionBegin += new Manipulator(ReplaceItemGenerator); PurchaseInteraction.OnInteractionBegin += new Manipulator(SeedSaleStarRoll); Run.GenerateStageRNG += new hook_GenerateStageRNG(OnGenerateStageRng); ChestBehavior.BaseItemDrop += new hook_BaseItemDrop(FixEdgeCase); HalcyoniteShrineInteractable.DrainConditionMet += new Manipulator(SkipHalcyonRoll); PickupPickerController.GenerateOptionsFromDropTablePlusForcedStorm += new Manipulator(GenerateAll); HalcyoniteShrineInteractable.Start += new hook_Start(OnHalcyoniteShrineInteractableOnStart); } private void OnDisable() { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Expected O, but got Unknown //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Expected O, but got Unknown //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Expected O, but got Unknown try { this._onDisable?.Invoke(); } catch (Exception arg) { Debug.LogError((object)$"Failed to revert gauntlet changes for DLC2, things may be broken until restart: {arg}"); } finally { this._onDisable = null; } Run.onRunStartGlobal -= MarkFalseSonComplete; PurchaseInteraction.OnInteractionBegin -= new Manipulator(ReplaceItemGenerator); PurchaseInteraction.OnInteractionBegin -= new Manipulator(SeedSaleStarRoll); Run.GenerateStageRNG -= new hook_GenerateStageRNG(OnGenerateStageRng); ChestBehavior.BaseItemDrop -= new hook_BaseItemDrop(FixEdgeCase); HalcyoniteShrineInteractable.DrainConditionMet -= new Manipulator(SkipHalcyonRoll); PickupPickerController.GenerateOptionsFromDropTablePlusForcedStorm -= new Manipulator(GenerateAll); HalcyoniteShrineInteractable.Start -= new hook_Start(OnHalcyoniteShrineInteractableOnStart); } private void OnHalcyoniteShrineInteractableOnStart(orig_Start orig, HalcyoniteShrineInteractable self) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown orig.Invoke(self); if (NetworkServer.active) { self.rng = new Xoroshiro128Plus(stage.nextUlong); } } private void OnGenerateStageRng(orig_GenerateStageRNG orig, Run self) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown orig.Invoke(self); stage = new Xoroshiro128Plus(self.spawnRng.nextUlong); item = new Xoroshiro128Plus(stage.nextUlong); } private void MarkFalseSonComplete(Run instance) { instance.SetEventFlag("FalseSonBossComplete"); } private void ReplaceItemGenerator(ILContext context) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown //IL_0063: 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_00a2: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(context); VariableDefinition val2 = new VariableDefinition(context.Import(typeof(int))); val.GotoNext(new Func[1] { (Instruction i) => ILPatternMatchingExt.MatchStfld(i, "dropCount") }); context.Method.Body.Variables.Add(val2); val.Emit(OpCodes.Stloc, val2); val.Emit(OpCodes.Dup); val.EmitDelegate>((Action)delegate(ChestBehavior chest) { chest.rng = item; }); val.Emit(OpCodes.Ldloc, val2); } private void SeedSaleStarRoll(ILContext context) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(context); VariableDefinition val2 = new VariableDefinition(context.Import(typeof(Xoroshiro128Plus))); val.GotoNext((MoveType)2, new Func[1] { (Instruction i) => ILPatternMatchingExt.MatchLdfld(i, "saleStarCompatible") }); val.Emit(OpCodes.Dup); val.EmitDelegate>((Func)((bool compatible) => compatible ? new Xoroshiro128Plus(stage.nextUlong) : new Xoroshiro128Plus(0uL))); context.Method.Body.Variables.Add(val2); val.Emit(OpCodes.Stloc, val2); MethodInfo method = SymbolExtensions.GetMethodInfo((Expression)(() => Util.CheckRoll(0f, (CharacterMaster)null))); while (val.TryGotoNext(new Func[1] { (Instruction i) => ILPatternMatchingExt.MatchCall(i, (MethodBase)method) })) { val.Remove(); val.Emit(OpCodes.Ldloc, val2); val.Emit(OpCodes.Call, (MethodBase)((object)this).GetType().GetMethod("CheckRoll")); } } private void FixEdgeCase(orig_BaseItemDrop orig, ChestBehavior self) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown if (self.rng == item) { self.rng = new Xoroshiro128Plus(item); orig.Invoke(self); for (int i = 1; i < self.dropCount; i++) { item.Next(); } } else { orig.Invoke(self); } } private void SkipHalcyonRoll(ILContext context) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_002c: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Expected O, but got Unknown //IL_00b6: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(context); FieldInfo field = typeof(HalcyoniteShrineInteractable).GetField("rng", BindingFlags.Instance | BindingFlags.NonPublic); while (val.TryGotoNext(new Func[1] { (Instruction i) => ILPatternMatchingExt.MatchStfld(i, field) })) { val.Emit(OpCodes.Pop); val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldfld, field); ILCursor obj = val; int index = obj.Index + 1; obj.Index = index; } val = new ILCursor(context); field = typeof(Run).GetField("treasureRng"); while (val.TryGotoNext(new Func[1] { (Instruction i) => ILPatternMatchingExt.MatchLdfld(i, field) })) { ILCursor obj2 = val; int index = obj2.Index + 1; obj2.Index = index; val.Emit(OpCodes.Pop); val.EmitDelegate>((Func)(() => new Xoroshiro128Plus(0uL))); } } private void GenerateAll(ILContext context) { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown ParameterDefinition numOptionsParameter = ((IEnumerable)((MethodReference)context.Method).Parameters).FirstOrDefault((Func)((ParameterDefinition p) => ((ParameterReference)p).Name == "numOptions")); if (numOptionsParameter == null) { Log.Error("Failed to find numOptions parameter", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/DLC2.cs", "GenerateAll", 186); return; } ILCursor val = new ILCursor(context); while (val.TryGotoNext(new Func[1] { (Instruction i) => ILPatternMatchingExt.MatchCallOrCallvirt(i, "GenerateDistinctPickups") })) { ILCursor val2 = val.Clone(); if (val2.TryGotoPrev((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, ((ParameterReference)numOptionsParameter).Index) })) { val2.EmitDelegate>((Func)getNumOptionsToGenerate); } val.SearchTarget = (SearchTarget)1; } static int getNumOptionsToGenerate(int numOptions) { return Math.Max(5, numOptions); } } private async void AddSceneToGroup(string collection, string stage) { AsyncOperationHandle group = Addressables.LoadAssetAsync((object)collection); AsyncOperationHandle scene = Addressables.LoadAssetAsync((object)stage); await group.Task; await scene.Task; if (((Behaviour)this).isActiveAndEnabled) { SceneEntry[] original = group.Result._sceneEntries; ref SceneEntry[] sceneEntries = ref group.Result._sceneEntries; SceneEntry val = new SceneEntry { sceneDef = scene.Result }; ArrayUtils.ArrayAppend(ref sceneEntries, ref val); _onDisable += delegate { group.Result._sceneEntries = original; }; } } private async void ChangeDestination(string portal) { AsyncOperationHandle prefab = Addressables.LoadAssetAsync((object)portal); await prefab.Task; if (((Behaviour)this).isActiveAndEnabled) { SceneExitController controller = prefab.Result.GetComponent(); bool useRunNextStageScene = controller.useRunNextStageScene; bool isAlternatePath = controller.isAlternatePath; controller.useRunNextStageScene = true; controller.isAlternatePath = false; _onDisable += delegate { controller.useRunNextStageScene = useRunNextStageScene; controller.isAlternatePath = isAlternatePath; }; } } private async void ReplacePortals(string parent, string replacement) { AsyncOperationHandle prefab = Addressables.LoadAssetAsync((object)parent); AsyncOperationHandle card = Addressables.LoadAssetAsync((object)replacement); await prefab.Task; await card.Task; if (!((Behaviour)this).isActiveAndEnabled) { return; } PortalSpawner[] components = prefab.Result.GetComponents(); foreach (PortalSpawner portal in components) { string spawnMessageToken = portal.spawnMessageToken; portal.spawnMessageToken = "PORTAL_STORM_OPEN"; string spawnPreviewMessageToken = portal.spawnPreviewMessageToken; portal.spawnPreviewMessageToken = "PORTAL_STORM_WILL_OPEN"; InteractableSpawnCard portalSpawnCard = portal.portalSpawnCard; portal.portalSpawnCard = card.Result; string previewChildName = portal.previewChildName; portal.previewChildName = "StormPortalIndicator"; string[] invalidStages = portal.invalidStages; portal.invalidStages = Array.Empty(); _onDisable += delegate { portal.spawnMessageToken = spawnMessageToken; portal.spawnPreviewMessageToken = spawnPreviewMessageToken; portal.portalSpawnCard = portalSpawnCard; portal.previewChildName = previewChildName; portal.invalidStages = invalidStages; }; } } public static bool CheckRoll(float percent, CharacterMaster master, Xoroshiro128Plus generator) { if (!(percent >= 100f)) { if (percent <= 0f) { return false; } return CheckForLuck(percent, master, generator.nextNormalizedFloat * 100f); } return true; } public static bool CheckForLuck(float percent, CharacterMaster master, float roll) { float num = (Object.op_Implicit((Object)(object)master) ? Mathf.Ceil(master.luck) : 0f); float num2 = percent / 100f; if (!(num > 0f)) { if (num < 0f) { num2 = Mathf.Pow(num2, 1f - num); } } else { num2 = 1f - Mathf.Pow(1f - num2, 1f + num); } if (roll < num2 * 100f) { if (roll >= percent) { GameObject bodyObject = master.GetBodyObject(); CharacterBody val = default(CharacterBody); if (Object.op_Implicit((Object)(object)bodyObject) && bodyObject.TryGetComponent(ref val)) { val.wasLucky = true; } } return true; } return false; } } public sealed class DLC3 : MonoBehaviour { private sealed class TeleporterAccessCodesLockController : MonoBehaviour { private TeleporterInteraction _teleporterInteraction; private void Awake() { _teleporterInteraction = ((Component)this).GetComponent(); } private void FixedUpdate() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Invalid comparison between Unknown and I4 if (NetworkServer.active) { _teleporterInteraction.locked = InstanceTracker.Any() || ((int)TeleporterInteraction.instance.activationState <= 1 && !TeleporterInteraction.instance.isAccessingCodes); } } } private sealed class SolusHeartOfferingBodyController : MonoBehaviour { private CharacterBody _body; private void Awake() { _body = ((Component)this).GetComponent(); } private void OnEnable() { _body.AddBuff(Buffs.Intangible); } private void OnDisable() { _body.RemoveBuff(Buffs.Intangible); } } private sealed class EyePortalLockController : MonoBehaviour { private GenericInteraction _interaction; [SystemInitializer(new Type[] { typeof(CraftableCatalog), typeof(PickupCatalog) })] private static void Init() { //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) AsyncOperationHandle val = Addressables.LoadAssetAsync((object)"RoR2/DLC3/EyePortal/EyePortal.prefab"); val.Completed += delegate(AsyncOperationHandle handle) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Invalid comparison between Unknown and I4 if (!handle.IsValid() || (int)handle.Status != 1 || !Object.op_Implicit((Object)(object)handle.Result)) { Log.Error(string.Format("Failed to load eye portal prefab: {0}", handle.IsValid() ? ((object)handle.OperationException) : ((object)"invalid handle")), "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/DLC3.cs", "Init", 666); } else { UnityObjectExtensions.EnsureComponent(handle.Result); } }; } private void Awake() { _interaction = ((Component)this).GetComponent(); } private void OnEnable() { Inventory.onInventoryChangedGlobal += onInventoryChangedGlobal; ((UnityEvent)(object)_interaction.onActivation).AddListener((UnityAction)onInteract); refreshInteractability(); } private void OnDisable() { Inventory.onInventoryChangedGlobal -= onInventoryChangedGlobal; ((UnityEvent)(object)_interaction.onActivation).RemoveListener((UnityAction)onInteract); } private void onInventoryChangedGlobal(Inventory inventory) { CharacterMaster val = default(CharacterMaster); if (((Component)inventory).TryGetComponent(ref val) && Object.op_Implicit((Object)(object)val.playerCharacterMasterController)) { refreshInteractability(); } } private void refreshInteractability() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) bool flag = false; if (CraftableCatalog.resultToRecipeSearchTable.TryGetValue(PickupCatalog.FindPickupIndex(Items.MasterCore.itemIndex), out var value)) { foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances) { if (!instance.isConnected) { continue; } CharacterMaster master = instance.master; if (!Object.op_Implicit((Object)(object)master) || !Object.op_Implicit((Object)(object)master.inventory)) { continue; } foreach (RecipeEntry item in value) { if (item.ValidateSelection(master.inventory)) { flag = true; break; } } if (flag) { break; } } } _interaction.Networkinteractability = (Interactability)((!flag) ? 1 : 2); } private void onInteract(Interactor interactor) { ((Behaviour)this).enabled = false; } } [CompilerGenerated] private static class <>O { public static Func <0>__pickupIsValidTempItemFallback; public static Manipulator <1>__AccessCodesMissionController_OnStartServer; public static OrderedPickupTransmutationProvider.AllowPickupTransmutationDelegate <2>__allowTransmuteTemporaryItem; public static Func <3>__getSalvageRng; public static Func <4>__getItemRng; public static Func <5>__getRandomDebuffIndex; public static <>F{00000010} <6>__tryGetSeededReroll; public static Func <7>__seededReroll; public static Func <8>__overrideRng; } private static SceneIndex _solusWebSceneIndex = (SceneIndex)(-1); private static SceneIndex _computationalExchangeSceneIndex = (SceneIndex)(-1); private static Func _pickupIsValidTempItemFunc; private static DLC3 _instance; private Xoroshiro128Plus _drifterItemRng; private Xoroshiro128Plus _drifterProjectileRng; private Xoroshiro128Plus _drifterTinkerRngGenerator; private Xoroshiro128Plus _junkDroneRng; private Xoroshiro128Plus _solusHeartBossRngGenerator; private OrderedPickupTransmutationProvider _temporaryItemRollTransmutationProvider; private ulong _tinkerInteractableBaseRerollSeed; private readonly Dictionary _interactableTinkerRerollProviders = new Dictionary(); private OrderedPickupTransmutationProvider _pickupPickerTinkerRerollProvider; private SolusHeartOfferingBodyController _solusHeartOfferingBodyPrefabController; public static bool UseDLC3Path => Main.UseDLC3Path.Value; public static DLC3 Instance => _instance; [SystemInitializer(new Type[] { typeof(SceneCatalog) })] private static void Init() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Invalid comparison between Unknown and I4 //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Invalid comparison between Unknown and I4 _solusWebSceneIndex = SceneCatalog.FindSceneIndex("solusweb"); if ((int)_solusWebSceneIndex == -1) { Log.Error("Failed to find solus web scene index", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/DLC3.cs", "Init", 39); } _computationalExchangeSceneIndex = SceneCatalog.FindSceneIndex("computationalexchange"); if ((int)_computationalExchangeSceneIndex == -1) { Log.Error("Failed to find computational exchange scene index", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/DLC3.cs", "Init", 45); } MethodInfo methodInfo = typeof(Util).GetMethods(BindingFlags.Static | BindingFlags.NonPublic).FirstOrDefault((MethodInfo m) => m.Name.StartsWith("g__PickupIsNonBlacklistedItem|") && m.ReturnType == typeof(bool) && m.GetParameters().Length == 1 && m.GetParameters()[0].ParameterType == typeof(PickupIndex)); if (methodInfo != null) { try { _pickupIsValidTempItemFunc = Extensions.CreateDelegate>((MethodBase)methodInfo); } catch (Exception data) { Log.Error_NoCallerPrefix(data); } } else { Log.Error("Failed to find PickupIsNonBlacklistedItem local function", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/DLC3.cs", "Init", 62); } if (_pickupIsValidTempItemFunc == null) { Log.Warning("Failed to get temporary pickup validator method, using fallback", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/DLC3.cs", "Init", 67); _pickupIsValidTempItemFunc = pickupIsValidTempItemFallback; } static bool pickupIsValidTempItemFallback(PickupIndex pickupIndex) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) PickupDef pickupDef = PickupCatalog.GetPickupDef(pickupIndex); if (pickupDef == null) { return false; } ItemDef itemDef = ItemCatalog.GetItemDef(pickupDef.itemIndex); if (!Object.op_Implicit((Object)(object)itemDef)) { return false; } if (itemDef.DoesNotContainTag((ItemTag)33) && itemDef.DoesNotContainTag((ItemTag)10) && itemDef.DoesNotContainTag((ItemTag)9)) { return itemDef.ContainsTag((ItemTag)31); } return false; } } private void OnEnable() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Expected O, but got Unknown //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Expected O, but got Unknown //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Expected O, but got Unknown //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Expected O, but got Unknown //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Expected O, but got Unknown //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Expected O, but got Unknown //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Expected O, but got Unknown SingletonHelper.Assign(ref _instance, this); RunHooks.OnRunPostStartGlobal += onRunPostStartGlobal; Stage.onStageStartGlobal += onStageStartGlobal; Salvage.OnEnter += new Manipulator(Salvage_OnEnter); DrifterCleanupController.InitRng += new hook_InitRng(DrifterCleanupController_InitRng); Surprise.DropTempItemServer += new Manipulator(Surprise_DropTempItemServer); TinkerProjectile.ManageMonster += new Manipulator(TinkerProjectile_ManageMonster); BossGroup.Awake += new hook_Awake(BossGroup_Awake); Util.RollTemporaryItemFromItemIndex += new hook_RollTemporaryItemFromItemIndex(Util_RollTemporaryItemFromItemIndex); ShopTerminalBehavior.RerollPickup += new Manipulator(SeededTinkerRerollInteractablePatch); PickupDistributorBehavior.RerollPickup += new Manipulator(SeededTinkerRerollInteractablePatch); PickupPickerController.RerollCurrentOptions += new Manipulator(PickupPickerController_RerollCurrentOptions); CraftingController.CanTakePickupAfterUseByIngredientSlots += new hook_CanTakePickupAfterUseByIngredientSlots(CraftingController_CanTakePickupAfterUseByIngredientSlots); object obj = <>O.<1>__AccessCodesMissionController_OnStartServer; if (obj == null) { Manipulator val = AccessCodesMissionController_OnStartServer; <>O.<1>__AccessCodesMissionController_OnStartServer = val; obj = (object)val; } AccessCodesMissionController.OnStartServer += (Manipulator)obj; GameObject val2 = Addressables.LoadAssetAsync((object)"RoR2/DLC3/SolusHeart/SolusHeartBody_Offering.prefab").WaitForCompletion(); if (Object.op_Implicit((Object)(object)val2)) { _solusHeartOfferingBodyPrefabController = UnityObjectExtensions.EnsureComponent(val2); } } private void OnDisable() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Expected O, but got Unknown //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Expected O, but got Unknown //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Expected O, but got Unknown //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Expected O, but got Unknown //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Expected O, but got Unknown //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Expected O, but got Unknown RunHooks.OnRunPostStartGlobal -= onRunPostStartGlobal; Stage.onStageStartGlobal -= onStageStartGlobal; Salvage.OnEnter -= new Manipulator(Salvage_OnEnter); DrifterCleanupController.InitRng -= new hook_InitRng(DrifterCleanupController_InitRng); Surprise.DropTempItemServer -= new Manipulator(Surprise_DropTempItemServer); TinkerProjectile.ManageMonster -= new Manipulator(TinkerProjectile_ManageMonster); BossGroup.Awake -= new hook_Awake(BossGroup_Awake); Util.RollTemporaryItemFromItemIndex -= new hook_RollTemporaryItemFromItemIndex(Util_RollTemporaryItemFromItemIndex); ShopTerminalBehavior.RerollPickup -= new Manipulator(SeededTinkerRerollInteractablePatch); PickupDistributorBehavior.RerollPickup -= new Manipulator(SeededTinkerRerollInteractablePatch); PickupPickerController.RerollCurrentOptions -= new Manipulator(PickupPickerController_RerollCurrentOptions); CraftingController.CanTakePickupAfterUseByIngredientSlots -= new hook_CanTakePickupAfterUseByIngredientSlots(CraftingController_CanTakePickupAfterUseByIngredientSlots); object obj = <>O.<1>__AccessCodesMissionController_OnStartServer; if (obj == null) { Manipulator val = AccessCodesMissionController_OnStartServer; <>O.<1>__AccessCodesMissionController_OnStartServer = val; obj = (object)val; } AccessCodesMissionController.OnStartServer -= (Manipulator)obj; if (Object.op_Implicit((Object)(object)_solusHeartOfferingBodyPrefabController)) { Object.Destroy((Object)(object)_solusHeartOfferingBodyPrefabController); _solusHeartOfferingBodyPrefabController = null; } SingletonHelper.Unassign(ref _instance, this); } public Xoroshiro128Plus GetNextTinkerProjectileRng() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown if (_drifterTinkerRngGenerator == null) { return null; } return new Xoroshiro128Plus(_drifterTinkerRngGenerator.nextUlong); } private void onRunPostStartGlobal(Run run) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown Xoroshiro128Plus val = new Xoroshiro128Plus(run.seed ^ 0x2AC3027042EuL); _drifterItemRng = new Xoroshiro128Plus(val.nextUlong); _junkDroneRng = new Xoroshiro128Plus(val.nextUlong); _drifterTinkerRngGenerator = new Xoroshiro128Plus(val.nextUlong); _solusHeartBossRngGenerator = new Xoroshiro128Plus(val.nextUlong); _temporaryItemRollTransmutationProvider = new OrderedPickupTransmutationProvider(val.nextUlong, allowTransmuteTemporaryItem); _tinkerInteractableBaseRerollSeed = val.nextUlong; _interactableTinkerRerollProviders.Clear(); _pickupPickerTinkerRerollProvider = new OrderedPickupTransmutationProvider(val.nextUlong); if (!UseDLC3Path) { run.SetEventFlag("NoSolusHeartOffer"); } static bool allowTransmuteTemporaryItem(PickupIndex from, PickupIndex to) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) if (_pickupIsValidTempItemFunc != null) { return _pickupIsValidTempItemFunc(to); } return true; } } private void onStageStartGlobal(Stage stage) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Invalid comparison between Unknown and I4 //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) _drifterProjectileRng = new Xoroshiro128Plus((Run.instance.seed + (ulong)Run.instance.stageClearCount) ^ 0xD9A45D7187uL); SceneDef val = (Object.op_Implicit((Object)(object)stage) ? stage.sceneDef : null); SceneIndex val2 = (SceneIndex)((!Object.op_Implicit((Object)(object)val)) ? (-1) : ((int)val.sceneDefIndex)); if ((int)val2 == -1) { return; } if (val2 == _solusWebSceneIndex) { setupSolusWeb(); } if (NetworkServer.active) { if (UseDLC3Path) { if (!Object.op_Implicit((Object)(object)AccessCodesMissionController.instance) && Run.instance.stageClearCountInCurrentLoop == 2) { NetworkIdentity[] componentsInChildren = Object.Instantiate(Addressables.LoadAssetAsync((object)"RoR2/DLC3/AccessCodesNode/GROUP_ Access Codes.prefab").WaitForCompletion()).GetComponentsInChildren(); for (int i = 0; i < componentsInChildren.Length; i++) { NetworkServer.Spawn(((Component)componentsInChildren[i]).gameObject); } if (Object.op_Implicit((Object)(object)AccessCodesMissionController.instance)) { AccessCodesMissionController.instance.ActivateCode(); } } } else if (Object.op_Implicit((Object)(object)AccessCodesMissionController.instance)) { AccessCodesNodeData[] nodes = AccessCodesMissionController.instance.nodes; foreach (AccessCodesNodeData val3 in nodes) { if (Object.op_Implicit((Object)(object)val3.node)) { val3.node.SetActive(false); } } } } if (UseDLC3Path && Object.op_Implicit((Object)(object)AccessCodesMissionController.instance) && Object.op_Implicit((Object)(object)TeleporterInteraction.instance)) { UnityObjectExtensions.EnsureComponent(((Component)TeleporterInteraction.instance).gameObject); } } private void setupSolusWeb() { SolusWebMissionController val = InstanceTracker.FirstOrNull(); if (Object.op_Implicit((Object)(object)val)) { if (UseDLC3Path) { val.PortalPrefab = null; } val.VoidPrefab = null; } else { Log.Error("Failed to find mission controller", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/DLC3.cs", "setupSolusWeb", 277); } } private void Salvage_OnEnter(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "treasureRng") })) { Log.Error("Failed to find patch location", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/DLC3.cs", "Salvage_OnEnter", 288); } else { val.EmitDelegate>((Func)getSalvageRng); } static Xoroshiro128Plus getSalvageRng(Xoroshiro128Plus rng) { if (Object.op_Implicit((Object)(object)_instance) && _instance._drifterItemRng != null) { rng = _instance._drifterItemRng; } return rng; } } private void DrifterCleanupController_InitRng(orig_InitRng orig, DrifterCleanupController self) { orig.Invoke(self); if (_drifterProjectileRng != null) { self.rng = _drifterProjectileRng; } } private void Surprise_DropTempItemServer(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "rng") })) { Log.Error("Failed to find patch location", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/DLC3.cs", "Surprise_DropTempItemServer", 322); } else { val.EmitDelegate>((Func)getItemRng); } static Xoroshiro128Plus getItemRng(Xoroshiro128Plus rng) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown if (Object.op_Implicit((Object)(object)_instance) && _instance._junkDroneRng != null) { rng = new Xoroshiro128Plus(_instance._junkDroneRng.nextUlong); } return rng; } } private void TinkerProjectile_ManageMonster(ILContext il) { //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Expected O, but got Unknown //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Expected O, but got Unknown //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Expected O, but got Unknown //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: 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_01e0: Unknown result type (might be due to invalid IL or missing references) MethodInfo randomRangeIntMethod = SymbolExtensions.GetMethodInfo((Expression)(() => Random.Range(0, 0))); if (randomRangeIntMethod == null) { Log.Error("Failed to find Random.Range method", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/DLC3.cs", "TinkerProjectile_ManageMonster", 344); return; } ILCursor val = new ILCursor(il); ILCursor[] array = default(ILCursor[]); if (!val.TryFindNext(ref array, new Func[3] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(BuffCatalog), "debuffIndiciesRandomEligible"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)randomRangeIntMethod), (Instruction x) => ILPatternMatchingExt.MatchLdelemI4(x) })) { Log.Error("Failed to find patch location", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/DLC3.cs", "TinkerProjectile_ManageMonster", 355); return; } val.Goto(array[1].Next, (MoveType)0, false); VariableDefinition val2 = new VariableDefinition(il.Import(typeof(int))); il.Method.Body.Variables.Add(val2); VariableDefinition val3 = new VariableDefinition(il.Import(typeof(int))); il.Method.Body.Variables.Add(val3); val.Emit(OpCodes.Stloc, val3); val.Emit(OpCodes.Stloc, val2); val.Emit(OpCodes.Ldloc, val2); val.Emit(OpCodes.Ldloc, val3); val.Goto(array[1].Next, (MoveType)2, false); val.Emit(OpCodes.Ldloc, val2); val.Emit(OpCodes.Ldloc, val3); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getRandomDebuffIndex); static int getRandomDebuffIndex(int debuffIndex, int min, int max, TinkerProjectile tinkerProjectile) { TinkerProjectileRngProvider tinkerProjectileRngProvider = default(TinkerProjectileRngProvider); if (min < max && Object.op_Implicit((Object)(object)tinkerProjectile) && ((Component)tinkerProjectile).TryGetComponent(ref tinkerProjectileRngProvider) && tinkerProjectileRngProvider.DebuffRng != null) { debuffIndex = tinkerProjectileRngProvider.DebuffRng.RangeInt(min, max); } return debuffIndex; } } private void BossGroup_Awake(orig_Awake orig, BossGroup self) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Expected O, but got Unknown if (!NetworkServer.active || _solusHeartBossRngGenerator == null || !Object.op_Implicit((Object)(object)Run.instance) || !Object.op_Implicit((Object)(object)self) || !Object.op_Implicit((Object)(object)SceneCatalog.mostRecentSceneDef) || SceneCatalog.mostRecentSceneDef.sceneDefIndex != _solusWebSceneIndex || !Object.op_Implicit((Object)(object)((Component)self).GetComponent())) { if (orig != null) { orig.Invoke(self); } return; } Xoroshiro128Plus bossRewardRng = Run.instance.bossRewardRng; try { Run.instance.bossRewardRng = new Xoroshiro128Plus(_solusHeartBossRngGenerator.nextUlong); if (orig != null) { orig.Invoke(self); } } finally { Run.instance.bossRewardRng = bossRewardRng; } } private ItemIndex Util_RollTemporaryItemFromItemIndex(orig_RollTemporaryItemFromItemIndex orig, ItemIndex itemIndex) { //IL_0046: 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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: 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_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Invalid comparison between Unknown and I4 //IL_0039: Unknown result type (might be due to invalid IL or missing references) if (_temporaryItemRollTransmutationProvider != null) { PickupIndex val = PickupCatalog.FindPickupIndex(itemIndex); PickupIndex nextTransmutation = _temporaryItemRollTransmutationProvider.GetNextTransmutation(val); if (val != nextTransmutation) { PickupDef pickupDef = PickupCatalog.GetPickupDef(nextTransmutation); if (pickupDef == null || (int)pickupDef.itemIndex == -1) { return (ItemIndex)(-1); } return pickupDef.itemIndex; } } Log.Warning($"Failed to perform seeded roll temporary item for {ItemCatalog.GetItemDef(itemIndex)}, non-seeded roll will be used", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/DLC3.cs", "Util_RollTemporaryItemFromItemIndex", 439); return orig.Invoke(itemIndex); } private void SeededTinkerRerollInteractablePatch(ILContext il) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_0065: 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_00a5: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)0, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "GenerateReroll") })) { Log.Error("Failed to find patch location", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/DLC3.cs", "SeededTinkerRerollInteractablePatch", 450); return; } VariableDefinition newPickupVar = il.AddVariable(); val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldloca, newPickupVar); val.EmitDelegate<<>F{00000010}>((<>F{00000010})tryGetSeededReroll); val.EmitSkipMethodCall(OpCodes.Brtrue, delegate(ILCursor c) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) c.Emit(OpCodes.Ldloc, newPickupVar); }); static bool tryGetSeededReroll(MonoBehaviour self, out UniquePickup? newPickup) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) newPickup = null; SeededTinkerRerollController seededTinkerRerollController = default(SeededTinkerRerollController); if (!Object.op_Implicit((Object)(object)_instance) || !Object.op_Implicit((Object)(object)self) || !((Component)self).TryGetComponent(ref seededTinkerRerollController)) { return false; } PickupDropTable val2 = null; UniquePickup originalPickup = UniquePickup.none; ShopTerminalBehavior val3 = (ShopTerminalBehavior)(object)((self is ShopTerminalBehavior) ? self : null); if (val3 == null) { PickupDistributorBehavior val4 = (PickupDistributorBehavior)(object)((self is PickupDistributorBehavior) ? self : null); if (val4 != null) { originalPickup = val4.pickup; val2 = val4.dropTable; } else { Log.Error(((object)self).GetType().FullName + " is not implemented", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/DLC3.cs", "SeededTinkerRerollInteractablePatch", 480); } } else { originalPickup = val3.pickup; val2 = val3.dropTable; } int rngId = seededTinkerRerollController.RngId; Dictionary interactableTinkerRerollProviders = _instance._interactableTinkerRerollProviders; if (!interactableTinkerRerollProviders.TryGetValue(rngId, out var value)) { if (Object.op_Implicit((Object)(object)val2)) { value = new OrderedDropTableTransmutationProvider(_instance._tinkerInteractableBaseRerollSeed + (ulong)rngId, val2); interactableTinkerRerollProviders.Add(rngId, value); } else { Log.Warning("Null droptable on " + Util.GetGameObjectHierarchyName(((Component)self).gameObject) + " (" + ((object)self).GetType().FullName + ")", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/DLC3.cs", "SeededTinkerRerollInteractablePatch", 495); } } if (value == null) { return false; } newPickup = value.GetNextTransmutation(originalPickup); return newPickup.HasValue; } } private void PickupPickerController_RerollCurrentOptions(ILContext il) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_00a5: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)0, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "WithPickupIndex") })) { Log.Error("Failed to find patch location", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/DLC3.cs", "PickupPickerController_RerollCurrentOptions", 514); return; } int originalPickupVarIndex = -1; ILCursor[] array = default(ILCursor[]); if (!val.TryFindPrev(ref array, new Func[1] { (Instruction x) => x.MatchLdloca(typeof(UniquePickup), il, out originalPickupVarIndex) })) { Log.Error("Failed to find original pickup variable index", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/DLC3.cs", "PickupPickerController_RerollCurrentOptions", 522); return; } val.Emit(OpCodes.Ldloc, originalPickupVarIndex); val.EmitDelegate>((Func)seededReroll); if (!val.TryGotoPrev((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "treasureRng") })) { Log.Error("Failed to find recycle rng override patch location", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/DLC3.cs", "PickupPickerController_RerollCurrentOptions", 541); } else { val.EmitDelegate>((Func)overrideRng); } static Xoroshiro128Plus overrideRng(Xoroshiro128Plus original) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown return new Xoroshiro128Plus(original); } static PickupIndex seededReroll(PickupIndex rerollPickupIndex, UniquePickup originalPickup) { //IL_002f: 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_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)_instance) && _instance._pickupPickerTinkerRerollProvider != null) { rerollPickupIndex = _instance._pickupPickerTinkerRerollProvider.GetNextTransmutation(originalPickup.pickupIndex); } return rerollPickupIndex; } } private bool CraftingController_CanTakePickupAfterUseByIngredientSlots(orig_CanTakePickupAfterUseByIngredientSlots orig, CraftingController self, PickupIndex pickupIndex, PickupIndex[] consumedIngredients) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Invalid comparison between Unknown and I4 //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: 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_0110: Unknown result type (might be due to invalid IL or missing references) bool flag = orig.Invoke(self, pickupIndex, consumedIngredients); if (flag && UseDLC3Path) { SceneDef val = (Object.op_Implicit((Object)(object)Stage.instance) ? Stage.instance.sceneDef : SceneCatalog.mostRecentSceneDef); SceneIndex val2 = (SceneIndex)((!Object.op_Implicit((Object)(object)val)) ? (-1) : ((int)val.sceneDefIndex)); if ((int)val2 != -1 && val2 == _computationalExchangeSceneIndex) { bool flag2 = false; foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances) { if (instance.isConnected && Object.op_Implicit((Object)(object)instance.master) && Object.op_Implicit((Object)(object)instance.master.inventory) && instance.master.inventory.GetItemCountPermanent(Items.MasterCore) > 0) { flag2 = true; break; } } if (!flag2 && CraftableCatalog.resultToRecipeSearchTable.TryGetValue(PickupCatalog.FindPickupIndex(Items.MasterCore.itemIndex), out var value)) { bool flag3 = false; foreach (RecipeEntry item in value) { if (item.GetOtherIngredients(consumedIngredients).Contains(pickupIndex)) { flag3 = true; break; } } if (!flag3) { return false; } } } } return flag; } private static void AccessCodesMissionController_OnStartServer(ILContext il) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_00df: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); ILLabel val2 = default(ILLabel); if (!val.TryGotoNext((MoveType)2, new Func[5] { (Instruction x) => x.MatchLdloc(typeof(PointOfInterest[]), il, out var _), (Instruction x) => ILPatternMatchingExt.MatchLdlen(x), (Instruction x) => ILPatternMatchingExt.MatchConvI4(x), (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 0), (Instruction x) => ILPatternMatchingExt.MatchBlt(x, ref val2) })) { Log.Error("Failed to find patch location", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/DLC3.cs", "AccessCodesMissionController_OnStartServer", 612); } else { val.Prev.OpCode = OpCodes.Ble_Un; } } } public sealed class TinkerProjectileRngProvider : MonoBehaviour { public Xoroshiro128Plus DebuffRng; [SystemInitializer(new Type[] { typeof(ProjectileCatalog) })] private static void Init() { GameObject projectilePrefab = ProjectileCatalog.GetProjectilePrefab(ProjectileCatalog.FindProjectileIndex("TinkerWave")); if (Object.op_Implicit((Object)(object)projectilePrefab)) { UnityObjectExtensions.EnsureComponent(projectilePrefab); } else { Log.Error("Failed to find Tinker projectile", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/DLC3.cs", "Init", 759); } } private void Awake() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown if (Object.op_Implicit((Object)(object)DLC3.Instance)) { Xoroshiro128Plus nextTinkerProjectileRng = DLC3.Instance.GetNextTinkerProjectileRng(); if (nextTinkerProjectileRng != null) { DebuffRng = new Xoroshiro128Plus(nextTinkerProjectileRng.nextUlong); } } if (DebuffRng == null) { Log.Warning("Failed to initialize tinker projectile rng", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/DLC3.cs", "Awake", 778); } } } public sealed class SeededTinkerRerollController : MonoBehaviour { [SerializeField] private int _rngId; public int RngId => _rngId; [SystemInitializer(new Type[] { })] private static void Init() { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Expected O, but got Unknown Xoroshiro128Plus val = new Xoroshiro128Plus(38645098456uL); GameObject[] networkedObjectPrefabs = ContentManager.networkedObjectPrefabs; foreach (GameObject val2 in networkedObjectPrefabs) { if (Object.op_Implicit((Object)(object)val2.GetComponent()) && !Object.op_Implicit((Object)(object)val2.GetComponent())) { val2.AddComponent()._rngId = val.nextInt; } } } } public sealed class SolusPathPortalTracker : MonoBehaviour { [SystemInitializer(new Type[] { })] private static void Init() { //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) AsyncOperationHandle val = Addressables.LoadAssetAsync((object)"RoR2/DLC3/HardwareProgPortal.prefab"); val.Completed += delegate(AsyncOperationHandle handle) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Invalid comparison between Unknown and I4 if (!handle.IsValid() || (int)handle.Status != 1 || !Object.op_Implicit((Object)(object)handle.Result)) { Log.Error(string.Format("Failed to load solus portal prefab: {0}", handle.IsValid() ? ((object)handle.OperationException) : ((object)"invalid handle")), "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/DLC3.cs", "Init", 819); } else { UnityObjectExtensions.EnsureComponent(handle.Result); } }; } private void OnEnable() { InstanceTracker.Add(this); } private void OnDisable() { InstanceTracker.Remove(this); } } public static class GameObjectExtensions { public static T GetCopyOf(this Component comp, T other) where T : Component { Type type = ((object)comp).GetType(); if (type != ((object)other).GetType()) { return default(T); } BindingFlags bindingAttr = BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; PropertyInfo[] properties = type.GetProperties(bindingAttr); foreach (PropertyInfo propertyInfo in properties) { if (propertyInfo.CanWrite) { try { propertyInfo.SetValue(comp, propertyInfo.GetValue(other, null), null); } catch { } } } FieldInfo[] fields = type.GetFields(bindingAttr); foreach (FieldInfo fieldInfo in fields) { fieldInfo.SetValue(comp, fieldInfo.GetValue(other)); } return (T)(object)((comp is T) ? comp : null); } public static GameObject FindObject(this GameObject parent, string name) { Transform[] componentsInChildren = parent.GetComponentsInChildren(true); foreach (Transform val in componentsInChildren) { if (((Object)val).name == name) { return ((Component)val).gameObject; } } return null; } } public static class GauntletCatalog { private static readonly Dictionary LexicalToDisplayToken = new Dictionary { { "bandit", "BANDIT2_BODY_NAME" }, { "captain", "CAPTAIN_BODY_NAME" }, { "commando", "COMMANDO_BODY_NAME" }, { "acrid", "CROCO_BODY_NAME" }, { "engineer", "ENGI_BODY_NAME" }, { "huntress", "HUNTRESS_BODY_NAME" }, { "loader", "LOADER_BODY_NAME" }, { "artificer", "MAGE_BODY_NAME" }, { "mercenary", "MERC_BODY_NAME" }, { "mult", "TOOLBOT_BODY_NAME" }, { "rex", "TREEBOT_BODY_NAME" }, { "railgunner", "RAILGUNNER_BODY_NAME" }, { "viend", "VOIDSURVIVOR_BODY_NAME" }, { "seeker", "SEEKER_BODY_NAME" }, { "chef", "CHEF_BODY_NAME" }, { "falseson", "FALSESON_BODY_NAME" } }; public static string GetDisplayTokenFromLexicalName(string name) { if (LexicalToDisplayToken.TryGetValue(name, out var value)) { return value; } foreach (SurvivorDef allSurvivorDef in SurvivorCatalog.allSurvivorDefs) { if (string.Equals(allSurvivorDef.cachedName, name, StringComparison.OrdinalIgnoreCase)) { return allSurvivorDef.displayNameToken; } } return name; } } public struct GenericCountPair : IEquatable> { public T Value; public int Count; public GenericCountPair(T value, int count) { Value = value; Count = count; } public override readonly bool Equals(object obj) { if (obj is GenericCountPair other) { return Equals(other); } return false; } public readonly bool Equals(GenericCountPair other) { if (Count == other.Count) { return EqualityComparer.Default.Equals(Value, other.Value); } return false; } public override readonly int GetHashCode() { return HashCode.Combine(Value, Count); } public static bool operator ==(GenericCountPair left, GenericCountPair right) { return left.Equals(right); } public static bool operator !=(GenericCountPair left, GenericCountPair right) { return !(left == right); } } public sealed class IgnoreFallDamage : MonoBehaviour { private static CharacterBody body; private void Awake() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) AsyncOperationHandle handle = Addressables.LoadAssetAsync((object)"RoR2/Base/Brother/BrotherBody.prefab"); handle.Completed += delegate { body = handle.Result.GetComponent(); if (((Behaviour)this).isActiveAndEnabled) { OnEnable(); } }; } private void OnEnable() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)body)) { CharacterBody obj = body; obj.bodyFlags = (BodyFlags)(obj.bodyFlags | 1); } } private void OnDisable() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)body)) { CharacterBody obj = body; obj.bodyFlags = (BodyFlags)(obj.bodyFlags & -2); } } } public sealed class LazarusResurrection : MonoBehaviour { public delegate void RespawnedDelegate(CharacterMaster respawnedMaster); [CompilerGenerated] private static class <>O { public static Manipulator <0>__Stage_Update; public static hook_Update <1>__RunTimerUIController_Update; public static Action <2>__onStageStartGlobal; public static Func <3>__tryRespawnPlayers; } [CompilerGenerated] private sealed class d__12 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public CharacterMaster master; public Vector3 respawnPosition; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__12(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_003a: 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_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Expected O, but got Unknown if (<>1__state != 0) { return false; } <>1__state = -1; Stage instance = Stage.instance; if (SceneExitController.isRunning || (Object)(object)instance != (Object)(object)Stage.instance) { return false; } master.inventory.GiveItemPermanent(itemIndex, 1); CharacterMasterNotificationQueue.PushItemNotification(master, itemIndex); deathCount++; master.Respawn(respawnPosition, Quaternion.Euler(0f, Random.Range(0f, 360f), 0f), true); master.GetBody().AddTimedBuff(Buffs.Immune, 5f); if (Object.op_Implicit((Object)(object)master.inventory)) { master.inventory.SetEquipmentDisabled(false); } GameObject val = Assets.lazarusResurrectionEffect; if (!Object.op_Implicit((Object)(object)val)) { val = LegacyResourcesAPI.Load("Prefabs/Effects/HippoRezEffect"); } if (Object.op_Implicit((Object)(object)master.bodyInstanceObject)) { EntityStateMachine[] components = master.bodyInstanceObject.GetComponents(); foreach (EntityStateMachine obj in components) { obj.initialStateType = obj.mainStateType; } if (Object.op_Implicit((Object)(object)val)) { EffectManager.SpawnEffect(val, new EffectData { origin = respawnPosition, rotation = master.bodyInstanceObject.transform.rotation }, true); } Util.PlaySound("Play_item_proc_deathMark", master.bodyInstanceObject.gameObject); } LazarusResurrection.OnPlayerRespawned?.Invoke(master); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public static int deathCount; private static ItemIndex itemIndex => LazarusWings.lazarusWingsItemDef.itemIndex; public static event RespawnedDelegate OnPlayerRespawned; private void OnEnable() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown object obj = <>O.<0>__Stage_Update; if (obj == null) { Manipulator val = Stage_Update; <>O.<0>__Stage_Update = val; obj = (object)val; } Stage.Update += (Manipulator)obj; object obj2 = <>O.<1>__RunTimerUIController_Update; if (obj2 == null) { hook_Update val2 = RunTimerUIController_Update; <>O.<1>__RunTimerUIController_Update = val2; obj2 = (object)val2; } RunTimerUIController.Update += (hook_Update)obj2; Stage.onStageStartGlobal += onStageStartGlobal; } private void OnDisable() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown object obj = <>O.<0>__Stage_Update; if (obj == null) { Manipulator val = Stage_Update; <>O.<0>__Stage_Update = val; obj = (object)val; } Stage.Update -= (Manipulator)obj; object obj2 = <>O.<1>__RunTimerUIController_Update; if (obj2 == null) { hook_Update val2 = RunTimerUIController_Update; <>O.<1>__RunTimerUIController_Update = val2; obj2 = (object)val2; } RunTimerUIController.Update -= (hook_Update)obj2; Stage.onStageStartGlobal -= onStageStartGlobal; } private static void Stage_Update(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0072: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)0, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "BeginGameOver") })) { Log.Error("Failed to find patch location", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/LazarusResurrection.cs", "Stage_Update", 43); return; } val.EmitDelegate>((Func)tryRespawnPlayers); val.EmitSkipMethodCall(OpCodes.Brtrue); } private static bool tryRespawnPlayers() { //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: 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_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Expected O, but got Unknown //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_0329: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Unknown result type (might be due to invalid IL or missing references) List list = new List(PlayerCharacterMasterController.instances.Count); foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances) { if (Object.op_Implicit((Object)(object)instance) && instance.isConnected) { CharacterMaster master = instance.master; if (Object.op_Implicit((Object)(object)master)) { list.Add(master); } } } CharacterMaster val = null; FixedTimeStamp val2 = FixedTimeStamp.negativeInfinity; MasterDeathInfoProvider masterDeathInfoProvider = default(MasterDeathInfoProvider); foreach (CharacterMaster item in list) { FixedTimeStamp val3 = FixedTimeStamp.negativeInfinity; if (((Component)item).TryGetComponent(ref masterDeathInfoProvider)) { val3 = masterDeathInfoProvider.LastDeathTime; } if (!Object.op_Implicit((Object)(object)val) || (!((FixedTimeStamp)(ref val3)).isInfinity && val3 > val2)) { val = item; val2 = val3; } } Vector3? val4 = null; if (Object.op_Implicit((Object)(object)val)) { val4 = val.deathFootPosition; if (val.killedByUnsafeArea) { CharacterBody component = val.bodyPrefab.GetComponent(); Vector3? val5 = TeleportHelper.FindSafeTeleportDestination(val4.Value, component, RoR2Application.rng); if (val5.HasValue) { val4 = val5; } } } HashSet usedSpawnNodes = new HashSet(list.Count); Vector3 val14 = default(Vector3); foreach (CharacterMaster item2 in list) { CharacterBody val6 = null; if (Object.op_Implicit((Object)(object)item2.bodyPrefab)) { val6 = item2.bodyPrefab.GetComponent(); } GraphType val7 = (GraphType)0; if (Object.op_Implicit((Object)(object)val6)) { val7 = (GraphType)((!Object.op_Implicit((Object)(object)((Component)val6).GetComponent())) ? 1 : 0); } NodeGraph spawnNodeGraph = null; if (Object.op_Implicit((Object)(object)SceneInfo.instance)) { spawnNodeGraph = SceneInfo.instance.GetNodeGraph(val7); if (!Object.op_Implicit((Object)(object)spawnNodeGraph)) { spawnNodeGraph = SceneInfo.instance.groundNodes; } if (!Object.op_Implicit((Object)(object)spawnNodeGraph)) { spawnNodeGraph = SceneInfo.instance.airNodes; } } HullClassification val8 = (HullClassification)0; if (Object.op_Implicit((Object)(object)val6)) { val8 = val6.hullClassification; } NodeGraphSpider val9 = null; if (Object.op_Implicit((Object)(object)spawnNodeGraph)) { val9 = new NodeGraphSpider(spawnNodeGraph, (HullMask)(1 << (int)val8)); } NodeIndex val10 = NodeIndex.invalid; Vector3 val11 = item2.deathFootPosition; if (val9 != null) { NodeIndex val12 = spawnNodeGraph.FindClosestNodeWithFlagConditions(val4.GetValueOrDefault(val11), val8, (NodeFlags)0, (NodeFlags)4, false); if (val12 != NodeIndex.invalid) { val9.AddNodeForNextStep(val12); NodeIndex val13 = findNextRespawnNode(val9, respawnNodeCheck); if (spawnNodeGraph.GetNodePosition(val13, ref val14)) { val10 = val13; if (item2.killedByUnsafeArea || (Object)(object)item2 != (Object)(object)val) { val11 = val14; } } } } if (val10 != NodeIndex.invalid) { usedSpawnNodes.Add(new NodeReference(spawnNodeGraph, val10)); } item2.preventGameOver = true; item2.preventRespawnUntilNextStageServer = false; MonoBehaviour val15 = (MonoBehaviour)(object)Stage.instance; if (!Object.op_Implicit((Object)(object)val15)) { val15 = (MonoBehaviour)(object)item2; } val15.StartCoroutine(reviveRoutine(item2, val11)); bool respawnNodeCheck(NodeIndex nodeIndex) { //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_0014: 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_0019: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) NodeFlags val16 = default(NodeFlags); if (!spawnNodeGraph.GetNodeFlags(nodeIndex, ref val16)) { return false; } if ((val16 & 0) != 0 || (val16 & 4) != 0) { return false; } if (usedSpawnNodes.Contains(new NodeReference(spawnNodeGraph, nodeIndex))) { return false; } return true; } } return true; } private static NodeIndex findNextRespawnNode(NodeGraphSpider nodeGraphSpider, Predicate nodePredicate = null) { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) while (nodeGraphSpider.PerformStep()) { foreach (StepInfo collectedStep in nodeGraphSpider.collectedSteps) { if (nodePredicate == null || nodePredicate(collectedStep.node)) { return collectedStep.node; } } nodeGraphSpider.collectedSteps.Clear(); } return NodeIndex.invalid; } [IteratorStateMachine(typeof(d__12))] private static IEnumerator reviveRoutine(CharacterMaster master, Vector3 respawnPosition) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__12(0) { master = master, respawnPosition = respawnPosition }; } public static float GetTotalPenalty() { return 300 * deathCount; } private static void RunTimerUIController_Update(orig_Update orig, RunTimerUIController self) { orig.Invoke(self); TimerText runStopwatchTimerTextController = self.runStopwatchTimerTextController; runStopwatchTimerTextController.seconds += (double)GetTotalPenalty(); } private static void onStageStartGlobal(Stage stage) { //IL_005c: Unknown result type (might be due to invalid IL or missing references) stage.gameOverCheckTimerDuration = 1.5f; deathCount = 0; foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances) { if (Object.op_Implicit((Object)(object)instance) && Object.op_Implicit((Object)(object)instance.master) && Object.op_Implicit((Object)(object)instance.master.inventory)) { deathCount += instance.master.inventory.GetItemCount(itemIndex); } } } } public sealed class LazarusWings { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func <>9__8_1; public static Func <>9__8_2; public static Manipulator <>9__8_0; internal void b__8_0(ILContext context) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: 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) <>c__DisplayClass8_0 CS$<>8__locals0 = new <>c__DisplayClass8_0(); ILCursor val = new ILCursor(context); CS$<>8__locals0.failed = null; if (val.TryGotoNext((MoveType)0, new Func[3] { (Instruction i) => ILPatternMatchingExt.MatchLdfld(i, "followerPrefabAddress"), (Instruction i) => ILPatternMatchingExt.MatchCallOrCallvirt(i, "RuntimeKeyIsValid"), (Instruction i) => ILPatternMatchingExt.MatchBrfalse(i, ref CS$<>8__locals0.failed) })) { int index = val.Index + 1; val.Index = index; Instruction next = val.Next; val.Emit(OpCodes.Dup); val.Emit(OpCodes.Brtrue, next); val.Emit(OpCodes.Pop); val.Emit(OpCodes.Br, (object)CS$<>8__locals0.failed); } } internal bool b__8_1(Instruction i) { return ILPatternMatchingExt.MatchLdfld(i, "followerPrefabAddress"); } internal bool b__8_2(Instruction i) { return ILPatternMatchingExt.MatchCallOrCallvirt(i, "RuntimeKeyIsValid"); } } [CompilerGenerated] private sealed class <>c__DisplayClass8_0 { public ILLabel failed; internal bool b__3(Instruction i) { return ILPatternMatchingExt.MatchBrfalse(i, ref failed); } } internal static GameObject lunarWingsDisplayPrefab = Addressables.LoadAssetAsync((object)"RoR2/DLC1/LunarWings/DisplayLunarWings.prefab").WaitForCompletion(); internal static GameObject lunarWingsPickupPrefab = Addressables.LoadAssetAsync((object)"RoR2/DLC1/LunarWings/PickupLunarWings.prefab").WaitForCompletion(); internal static Sprite lunarWingsIcon = Addressables.LoadAssetAsync((object)"RoR2/DLC1/LunarWings/texLunarWingsIcon.png").WaitForCompletion(); internal static ItemDef lazarusWingsItemDef = ScriptableObject.CreateInstance(); private const string LAZARUSWINGS_NAME = "Lazarus Wings"; private const string LAZARUSWINGS_PICKUP = "Adds a 5 minute time penalty to the run timer (+5 minutes per stack)"; private const string LAZARUSWINGS_DESC = "Adds a 5 minute time penalty to the run timer (+5 minutes per stack)"; private const string LAZARUSWINGS_LORE = "The resurrection is a never-ending cycle, one of ongoing torment and despair. \nLife and death are intertwined in a continuous loop, like two sides of a single blade. We are all given a chance at life, but at what cost? \nWe are cast away from the living, and into the darkness, our souls forever wandering, searching for an escape from the deathly embrace. \nWe are doomed to eternal suffering, unless we can learn to accept the resurrection, and overcome our fear of the unknown."; public static void Initialize() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected O, but got Unknown //IL_00b0: 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_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0184: 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_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: 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_0213: Unknown result type (might be due to invalid IL or missing references) //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_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: 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_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Unknown result type (might be due to invalid IL or missing references) //IL_033d: Unknown result type (might be due to invalid IL or missing references) //IL_0342: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Unknown result type (might be due to invalid IL or missing references) //IL_0348: Unknown result type (might be due to invalid IL or missing references) //IL_0362: Unknown result type (might be due to invalid IL or missing references) //IL_0391: Unknown result type (might be due to invalid IL or missing references) //IL_0396: Unknown result type (might be due to invalid IL or missing references) //IL_03ac: Unknown result type (might be due to invalid IL or missing references) //IL_03b1: Unknown result type (might be due to invalid IL or missing references) //IL_03c7: Unknown result type (might be due to invalid IL or missing references) //IL_03cc: Unknown result type (might be due to invalid IL or missing references) //IL_03d1: Unknown result type (might be due to invalid IL or missing references) //IL_03d2: Unknown result type (might be due to invalid IL or missing references) //IL_03ec: Unknown result type (might be due to invalid IL or missing references) //IL_041b: Unknown result type (might be due to invalid IL or missing references) //IL_0420: Unknown result type (might be due to invalid IL or missing references) //IL_0436: Unknown result type (might be due to invalid IL or missing references) //IL_043b: Unknown result type (might be due to invalid IL or missing references) //IL_0451: Unknown result type (might be due to invalid IL or missing references) //IL_0456: Unknown result type (might be due to invalid IL or missing references) //IL_045b: Unknown result type (might be due to invalid IL or missing references) //IL_045c: 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_04a5: Unknown result type (might be due to invalid IL or missing references) //IL_04aa: Unknown result type (might be due to invalid IL or missing references) //IL_04c0: Unknown result type (might be due to invalid IL or missing references) //IL_04c5: Unknown result type (might be due to invalid IL or missing references) //IL_04db: Unknown result type (might be due to invalid IL or missing references) //IL_04e0: Unknown result type (might be due to invalid IL or missing references) //IL_04e5: Unknown result type (might be due to invalid IL or missing references) //IL_04e6: Unknown result type (might be due to invalid IL or missing references) //IL_0500: Unknown result type (might be due to invalid IL or missing references) //IL_052f: Unknown result type (might be due to invalid IL or missing references) //IL_0534: Unknown result type (might be due to invalid IL or missing references) //IL_054a: Unknown result type (might be due to invalid IL or missing references) //IL_054f: Unknown result type (might be due to invalid IL or missing references) //IL_0565: Unknown result type (might be due to invalid IL or missing references) //IL_056a: Unknown result type (might be due to invalid IL or missing references) //IL_056f: Unknown result type (might be due to invalid IL or missing references) //IL_0570: Unknown result type (might be due to invalid IL or missing references) //IL_058a: Unknown result type (might be due to invalid IL or missing references) //IL_05b9: Unknown result type (might be due to invalid IL or missing references) //IL_05be: Unknown result type (might be due to invalid IL or missing references) //IL_05d4: Unknown result type (might be due to invalid IL or missing references) //IL_05d9: Unknown result type (might be due to invalid IL or missing references) //IL_05ef: Unknown result type (might be due to invalid IL or missing references) //IL_05f4: Unknown result type (might be due to invalid IL or missing references) //IL_05f9: Unknown result type (might be due to invalid IL or missing references) //IL_05fa: Unknown result type (might be due to invalid IL or missing references) //IL_0614: Unknown result type (might be due to invalid IL or missing references) //IL_0643: Unknown result type (might be due to invalid IL or missing references) //IL_0648: Unknown result type (might be due to invalid IL or missing references) //IL_065e: Unknown result type (might be due to invalid IL or missing references) //IL_0663: Unknown result type (might be due to invalid IL or missing references) //IL_0679: Unknown result type (might be due to invalid IL or missing references) //IL_067e: Unknown result type (might be due to invalid IL or missing references) //IL_0683: Unknown result type (might be due to invalid IL or missing references) //IL_0684: Unknown result type (might be due to invalid IL or missing references) //IL_069e: Unknown result type (might be due to invalid IL or missing references) //IL_06cd: Unknown result type (might be due to invalid IL or missing references) //IL_06d2: Unknown result type (might be due to invalid IL or missing references) //IL_06e8: Unknown result type (might be due to invalid IL or missing references) //IL_06ed: Unknown result type (might be due to invalid IL or missing references) //IL_0703: Unknown result type (might be due to invalid IL or missing references) //IL_0708: Unknown result type (might be due to invalid IL or missing references) //IL_070d: Unknown result type (might be due to invalid IL or missing references) //IL_070e: Unknown result type (might be due to invalid IL or missing references) //IL_0728: Unknown result type (might be due to invalid IL or missing references) //IL_0757: Unknown result type (might be due to invalid IL or missing references) //IL_075c: Unknown result type (might be due to invalid IL or missing references) //IL_0772: Unknown result type (might be due to invalid IL or missing references) //IL_0777: Unknown result type (might be due to invalid IL or missing references) //IL_078d: Unknown result type (might be due to invalid IL or missing references) //IL_0792: Unknown result type (might be due to invalid IL or missing references) //IL_0797: Unknown result type (might be due to invalid IL or missing references) //IL_0798: Unknown result type (might be due to invalid IL or missing references) //IL_07a8: Unknown result type (might be due to invalid IL or missing references) //IL_07b2: Expected O, but got Unknown //IL_07c7: Unknown result type (might be due to invalid IL or missing references) //IL_07cc: Unknown result type (might be due to invalid IL or missing references) //IL_07d2: Expected O, but got Unknown ((Object)lazarusWingsItemDef).name = "LazarusWings"; lazarusWingsItemDef.tier = (ItemTier)5; lazarusWingsItemDef.deprecatedTier = (ItemTier)5; lazarusWingsItemDef.pickupModelPrefab = lunarWingsPickupPrefab; lazarusWingsItemDef.pickupIconSprite = lunarWingsIcon; lazarusWingsItemDef.canRemove = false; lazarusWingsItemDef.nameToken = "Lazarus Wings"; lazarusWingsItemDef.pickupToken = "Adds a 5 minute time penalty to the run timer (+5 minutes per stack)"; lazarusWingsItemDef.descriptionToken = "Adds a 5 minute time penalty to the run timer (+5 minutes per stack)"; lazarusWingsItemDef.loreToken = "The resurrection is a never-ending cycle, one of ongoing torment and despair. \nLife and death are intertwined in a continuous loop, like two sides of a single blade. We are all given a chance at life, but at what cost? \nWe are cast away from the living, and into the darkness, our souls forever wandering, searching for an escape from the deathly embrace. \nWe are doomed to eternal suffering, unless we can learn to accept the resurrection, and overcome our fear of the unknown."; lunarWingsDisplayPrefab.AddComponent(); ItemDisplayRuleDict val = new ItemDisplayRuleDict(Array.Empty()); val.Add("mdlCommandoDualies", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { followerPrefab = lunarWingsDisplayPrefab, childName = "Chest", localPos = new Vector3(0.00015f, 0.35673f, -0.13908f), localAngles = new Vector3(29.83448f, 2.96739f, 1.53991f), localScale = new Vector3(0.66405f, 0.66405f, 0.66405f) } }); val.Add("mdlHuntress", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { followerPrefab = lunarWingsDisplayPrefab, childName = "Chest", localPos = new Vector3(0.03159f, 0.12506f, -0.11253f), localAngles = new Vector3(2.02883f, 320.887f, 2.59241f), localScale = new Vector3(0.67117f, 0.67117f, 0.67117f) } }); val.Add("mdlBandit2", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { followerPrefab = lunarWingsDisplayPrefab, childName = "Chest", localPos = new Vector3(0.0186f, 0.19022f, -0.17056f), localAngles = new Vector3(21.46973f, 4.22358f, 350.7856f), localScale = new Vector3(0.63697f, 0.63697f, 0.63697f) } }); val.Add("mdlToolbot", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { followerPrefab = lunarWingsDisplayPrefab, childName = "Chest", localPos = new Vector3(0.26714f, 1.0237f, -1.86616f), localAngles = new Vector3(19.8663f, 356.4091f, 358.1597f), localScale = new Vector3(7.19914f, 7.19914f, 7.19914f) } }); val.Add("mdlEngi", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { followerPrefab = lunarWingsDisplayPrefab, childName = "Chest", localPos = new Vector3(-0.00569f, 0.08394f, -0.2341f), localAngles = new Vector3(354.0963f, 358.2862f, 358.6038f), localScale = new Vector3(0.79185f, 0.79185f, 0.79185f) } }); val.Add("mdlMage", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { followerPrefab = lunarWingsDisplayPrefab, childName = "Chest", localPos = new Vector3(-0.00942f, 0.03686f, -0.27844f), localAngles = new Vector3(0.14453f, 355.3709f, 1.70079f), localScale = new Vector3(0.74458f, 0.74458f, 0.74458f) } }); val.Add("mdlMerc", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { followerPrefab = lunarWingsDisplayPrefab, childName = "Chest", localPos = new Vector3(-0.00667f, 0.12215f, -0.21273f), localAngles = new Vector3(12.88405f, 355.9306f, 357.45f), localScale = new Vector3(0.76865f, 0.76865f, 0.76865f) } }); val.Add("mdlTreebot", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { followerPrefab = lunarWingsDisplayPrefab, childName = "HeadBase", localPos = new Vector3(0.02836f, -1.29261f, 0.70876f), localAngles = new Vector3(9.15137f, 176.2903f, 182.9521f), localScale = new Vector3(1.60994f, 1.60994f, 1.60994f) } }); val.Add("mdlLoader", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { followerPrefab = lunarWingsDisplayPrefab, childName = "Chest", localPos = new Vector3(-0.00592f, 0.18198f, -0.26041f), localAngles = new Vector3(3.79341f, 3.28101f, 0.27247f), localScale = new Vector3(0.85237f, 0.85237f, 0.85237f) } }); val.Add("mdlCroco", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { followerPrefab = lunarWingsDisplayPrefab, childName = "Chest", localPos = new Vector3(-0.02597f, 0.34623f, 3.17591f), localAngles = new Vector3(335.5031f, 177.2755f, 3.44059f), localScale = new Vector3(7.35741f, 7.35741f, 7.35741f) } }); val.Add("mdlCaptain", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { followerPrefab = lunarWingsDisplayPrefab, childName = "Chest", localPos = new Vector3(-0.01571f, 0.24481f, -0.16307f), localAngles = new Vector3(18.78144f, 7.25192f, 1.65195f), localScale = new Vector3(0.89055f, 0.89055f, 0.89055f) } }); val.Add("mdlRailGunner", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { followerPrefab = lunarWingsDisplayPrefab, childName = "Chest", localPos = new Vector3(-0.0457f, -0.12092f, -0.27414f), localAngles = new Vector3(353.748f, 10.2935f, 349.5002f), localScale = new Vector3(0.74962f, 0.74962f, 0.74962f) } }); val.Add("mdlVoidSurvivor", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { followerPrefab = lunarWingsDisplayPrefab, childName = "Chest", localPos = new Vector3(0.02643f, 0.0461f, -0.17402f), localAngles = new Vector3(353.6433f, 5.13739f, 6.10527f), localScale = new Vector3(0.87425f, 0.87425f, 0.87425f) } }); ItemAPI.Add(new CustomItem(lazarusWingsItemDef, val)); object obj = <>c.<>9__8_0; if (obj == null) { Manipulator val2 = delegate(ILContext context) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: 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) ILCursor val3 = new ILCursor(context); ILLabel failed = null; if (val3.TryGotoNext((MoveType)0, new Func[3] { (Instruction i) => ILPatternMatchingExt.MatchLdfld(i, "followerPrefabAddress"), (Instruction i) => ILPatternMatchingExt.MatchCallOrCallvirt(i, "RuntimeKeyIsValid"), (Instruction i) => ILPatternMatchingExt.MatchBrfalse(i, ref failed) })) { int index = val3.Index + 1; val3.Index = index; Instruction next = val3.Next; val3.Emit(OpCodes.Dup); val3.Emit(OpCodes.Brtrue, next); val3.Emit(OpCodes.Pop); val3.Emit(OpCodes.Br, (object)failed); } }; <>c.<>9__8_0 = val2; obj = (object)val2; } CharacterModel.InstantiateDisplayRuleGroup += (Manipulator)obj; } } public sealed class LoadoutHandler { private readonly ManualLogSource _log = Logger.CreateLogSource("LoadoutHandler"); public static LoadoutHandler Instance { get; } = new LoadoutHandler(); public Race Race { get; private set; } public Loadout GetLoadout(int loadoutNumber) { _log.LogInfo((object)$"GetLoadout({loadoutNumber})"); Loadout loadout = null; if (loadoutNumber <= Race.Loadouts.Count) { loadout = Race.Loadouts.FirstOrDefault((Loadout l) => l.Id == loadoutNumber); _log.LogDebug((object)$"Found Loadout : {loadout}"); } if (loadout == null) { _log.LogWarning((object)$"`{loadoutNumber}` not found or out of bounds of {Race.Loadouts.Count} loadout(s)"); } return loadout; } public List GetLoadouts() { return Race?.Loadouts ?? new List(); } public void RegisterRace(Race race) { _log.LogDebug((object)("Keeping track of race : " + race.ToJson())); Race = race; } } public sealed class LobbyHandler : MonoBehaviour { [CompilerGenerated] private static class <>O { public static Manipulator <0>__HookCharacterBuild; public static hook_OverrideRuleChoices <1>__OverrideRuleChoices; public static hook_OnCreateSurvivorIcon <2>__OnCreateSurvivorIcon; public static hook_Rebuild <3>__LoadoutPanelControllerOnRebuild; public static hook_FromSkillSlot <4>__OnFromSkillSlot; public static hook_AddButton <5>__RowOnAddButton; } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static hook_RecalculateModifierAvailability <>9__1_1; public static hook_IsUnlockableUnlocked_UnlockableDef <>9__2_0; public static hook_CanUnlockableBeGrantedThisRun_UnlockableDef <>9__2_1; public static hook_DoesEveryoneHaveThisUnlockableUnlocked_UnlockableDef <>9__2_2; public static hook_AnyUserHasUnlockable <>9__2_3; public static Func <>9__7_0; public static Func <>9__7_2; public static Func <>9__7_3; public static Action> <>9__7_1; internal void b__1_1(orig_RecalculateModifierAvailability orig, PreGameController self) { orig.Invoke(self); orig.Invoke(self); } internal bool b__2_0(orig_IsUnlockableUnlocked_UnlockableDef _, Run _, UnlockableDef _) { return true; } internal bool b__2_1(orig_CanUnlockableBeGrantedThisRun_UnlockableDef _, Run _, UnlockableDef _) { return false; } internal bool b__2_2(orig_DoesEveryoneHaveThisUnlockableUnlocked_UnlockableDef _, Run _, UnlockableDef _) { return true; } internal bool b__2_3(orig_AnyUserHasUnlockable _, UnlockableDef _) { return true; } internal bool b__7_0(Instruction i) { return ILPatternMatchingExt.MatchCallvirt(i, (MethodBase)(typeof(List).GetProperty("Count")?.GetMethod)); } internal void b__7_1(List survivors) { List loadouts = LoadoutHandler.Instance.GetLoadouts(); if (loadouts.Count == 0) { return; } Dictionary dictionary = SurvivorCatalog.allSurvivorDefs.ToDictionary((SurvivorDef s) => s.displayNameToken, (SurvivorDef s) => s); survivors.Clear(); foreach (Loadout item in loadouts) { string displayTokenFromLexicalName = GauntletCatalog.GetDisplayTokenFromLexicalName(item.Survivor); if (dictionary.TryGetValue(displayTokenFromLexicalName, out var value)) { survivors.Add(value); } } } internal string b__7_2(SurvivorDef s) { return s.displayNameToken; } internal SurvivorDef b__7_3(SurvivorDef s) { return s; } } private ILHook _scrollableLobbyUIHook; private void Start() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown if (Chainloader.PluginInfos.ContainsKey("com.KingEnderBrine.ScrollableLobbyUI")) { patch(); } object obj = <>c.<>9__1_1; if (obj == null) { hook_RecalculateModifierAvailability val = delegate(orig_RecalculateModifierAvailability orig, PreGameController self) { orig.Invoke(self); orig.Invoke(self); }; <>c.<>9__1_1 = val; obj = (object)val; } PreGameController.RecalculateModifierAvailability += (hook_RecalculateModifierAvailability)obj; [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] void patch() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown MethodBase method = typeof(CharacterSelectBarControllerExtra).GetMethod("GatherSurvivorsInfo", BindingFlags.Instance | BindingFlags.NonPublic); object obj2 = <>O.<0>__HookCharacterBuild; if (obj2 == null) { Manipulator val2 = HookCharacterBuild; <>O.<0>__HookCharacterBuild = val2; obj2 = (object)val2; } _scrollableLobbyUIHook = new ILHook(method, (Manipulator)obj2); } } private void OnEnable() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //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_0043: Expected O, but got Unknown //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_0067: Expected O, but got Unknown //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Expected O, but got Unknown //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Expected O, but got Unknown //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Expected O, but got Unknown //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Expected O, but got Unknown //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Expected O, but got Unknown //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Expected O, but got Unknown object obj = <>c.<>9__2_0; if (obj == null) { hook_IsUnlockableUnlocked_UnlockableDef val = (orig_IsUnlockableUnlocked_UnlockableDef _, Run _, UnlockableDef _) => true; <>c.<>9__2_0 = val; obj = (object)val; } Run.IsUnlockableUnlocked_UnlockableDef += (hook_IsUnlockableUnlocked_UnlockableDef)obj; object obj2 = <>c.<>9__2_1; if (obj2 == null) { hook_CanUnlockableBeGrantedThisRun_UnlockableDef val2 = (orig_CanUnlockableBeGrantedThisRun_UnlockableDef _, Run _, UnlockableDef _) => false; <>c.<>9__2_1 = val2; obj2 = (object)val2; } Run.CanUnlockableBeGrantedThisRun_UnlockableDef += (hook_CanUnlockableBeGrantedThisRun_UnlockableDef)obj2; object obj3 = <>c.<>9__2_2; if (obj3 == null) { hook_DoesEveryoneHaveThisUnlockableUnlocked_UnlockableDef val3 = (orig_DoesEveryoneHaveThisUnlockableUnlocked_UnlockableDef _, Run _, UnlockableDef _) => true; <>c.<>9__2_2 = val3; obj3 = (object)val3; } Run.DoesEveryoneHaveThisUnlockableUnlocked_UnlockableDef += (hook_DoesEveryoneHaveThisUnlockableUnlocked_UnlockableDef)obj3; object obj4 = <>c.<>9__2_3; if (obj4 == null) { hook_AnyUserHasUnlockable val4 = (orig_AnyUserHasUnlockable _, UnlockableDef _) => true; <>c.<>9__2_3 = val4; obj4 = (object)val4; } PreGameController.AnyUserHasUnlockable += (hook_AnyUserHasUnlockable)obj4; object obj5 = <>O.<1>__OverrideRuleChoices; if (obj5 == null) { hook_OverrideRuleChoices val5 = OverrideRuleChoices; <>O.<1>__OverrideRuleChoices = val5; obj5 = (object)val5; } Run.OverrideRuleChoices += (hook_OverrideRuleChoices)obj5; object obj6 = <>O.<2>__OnCreateSurvivorIcon; if (obj6 == null) { hook_OnCreateSurvivorIcon val6 = OnCreateSurvivorIcon; <>O.<2>__OnCreateSurvivorIcon = val6; obj6 = (object)val6; } CharacterSelectBarController.OnCreateSurvivorIcon += (hook_OnCreateSurvivorIcon)obj6; object obj7 = <>O.<3>__LoadoutPanelControllerOnRebuild; if (obj7 == null) { hook_Rebuild val7 = LoadoutPanelControllerOnRebuild; <>O.<3>__LoadoutPanelControllerOnRebuild = val7; obj7 = (object)val7; } LoadoutPanelController.Rebuild += (hook_Rebuild)obj7; object obj8 = <>O.<4>__OnFromSkillSlot; if (obj8 == null) { hook_FromSkillSlot val8 = OnFromSkillSlot; <>O.<4>__OnFromSkillSlot = val8; obj8 = (object)val8; } Row.FromSkillSlot += (hook_FromSkillSlot)obj8; object obj9 = <>O.<0>__HookCharacterBuild; if (obj9 == null) { Manipulator val9 = HookCharacterBuild; <>O.<0>__HookCharacterBuild = val9; obj9 = (object)val9; } CharacterSelectBarController.Build += (Manipulator)obj9; ILHook scrollableLobbyUIHook = _scrollableLobbyUIHook; if (scrollableLobbyUIHook != null) { scrollableLobbyUIHook.Apply(); } } private void OnDisable() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Expected O, but got Unknown object obj = <>O.<1>__OverrideRuleChoices; if (obj == null) { hook_OverrideRuleChoices val = OverrideRuleChoices; <>O.<1>__OverrideRuleChoices = val; obj = (object)val; } Run.OverrideRuleChoices -= (hook_OverrideRuleChoices)obj; object obj2 = <>O.<2>__OnCreateSurvivorIcon; if (obj2 == null) { hook_OnCreateSurvivorIcon val2 = OnCreateSurvivorIcon; <>O.<2>__OnCreateSurvivorIcon = val2; obj2 = (object)val2; } CharacterSelectBarController.OnCreateSurvivorIcon -= (hook_OnCreateSurvivorIcon)obj2; object obj3 = <>O.<3>__LoadoutPanelControllerOnRebuild; if (obj3 == null) { hook_Rebuild val3 = LoadoutPanelControllerOnRebuild; <>O.<3>__LoadoutPanelControllerOnRebuild = val3; obj3 = (object)val3; } LoadoutPanelController.Rebuild -= (hook_Rebuild)obj3; object obj4 = <>O.<0>__HookCharacterBuild; if (obj4 == null) { Manipulator val4 = HookCharacterBuild; <>O.<0>__HookCharacterBuild = val4; obj4 = (object)val4; } CharacterSelectBarController.Build -= (Manipulator)obj4; object obj5 = <>O.<4>__OnFromSkillSlot; if (obj5 == null) { hook_FromSkillSlot val5 = OnFromSkillSlot; <>O.<4>__OnFromSkillSlot = val5; obj5 = (object)val5; } Row.FromSkillSlot -= (hook_FromSkillSlot)obj5; ILHook scrollableLobbyUIHook = _scrollableLobbyUIHook; if (scrollableLobbyUIHook != null) { scrollableLobbyUIHook.Undo(); } } private static Row OnFromSkillSlot(orig_FromSkillSlot orig, LoadoutPanelController owner, BodyIndex bodyIndex, int skillSlotIndex, GenericSkill skillSlot) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown object obj = <>O.<5>__RowOnAddButton; if (obj == null) { hook_AddButton val = RowOnAddButton; <>O.<5>__RowOnAddButton = val; obj = (object)val; } Row.AddButton += (hook_AddButton)obj; Row result = orig.Invoke(owner, bodyIndex, skillSlotIndex, skillSlot); object obj2 = <>O.<5>__RowOnAddButton; if (obj2 == null) { hook_AddButton val2 = RowOnAddButton; <>O.<5>__RowOnAddButton = val2; obj2 = (object)val2; } Row.AddButton -= (hook_AddButton)obj2; return result; static void RowOnAddButton(orig_AddButton origAddButton, Row self, LoadoutPanelController loadoutPanelController, Sprite icon, string titleToken, string bodyToken, Color tooltipColor, UnityAction callback, string unlockableName, Node viewableNode, bool isWip, int defIndex) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) origAddButton.Invoke(self, loadoutPanelController, icon, titleToken, bodyToken, tooltipColor, callback, unlockableName, viewableNode, true, defIndex); } } private static void LoadoutPanelControllerOnRebuild(orig_Rebuild orig, LoadoutPanelController self) { orig.Invoke(self); try { SelectAbilitiesForLoadout(LoadoutHandler.Instance.GetLoadout(Main.CurrentLoadout.Value), self.eventSystemLocator.eventSystem?.localUser); } catch (Exception arg) { Debug.LogWarning((object)$"Failed to set loadout: {arg}"); } } private static void OverrideRuleChoices(orig_OverrideRuleChoices orig, Run self, RuleChoiceMask mustInclude, RuleChoiceMask mustExclude, ulong runSeed) { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, mustInclude, mustExclude, runSeed); if (Main.DifficultySelect.Value != "Any") { self.ForceChoice(mustInclude, mustExclude, "Difficulty." + Main.DifficultySelect.Value); } IEnumerator enumerator = LoadoutHandler.Instance.GetLoadout(Main.CurrentLoadout.Value).Expansions.GetEnumerator(); Enumerator enumerator2 = ExpansionCatalog.expansionDefs.GetEnumerator(); try { while (enumerator2.MoveNext()) { ExpansionDef current = enumerator2.Current; RuleChoiceDef val = current.enabledChoice; if (enumerator.MoveNext()) { if (enumerator.Current) { if (((BaseUserEntitlementTracker)(object)EntitlementManager.networkUserEntitlementTracker).AnyUserHasEntitlement(current.requiredEntitlement)) { self.ForceChoice(mustInclude, mustExclude, val); } else { Log.Warning("Missing entitlement for required expansion.", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/LobbyHandler.cs", "OverrideRuleChoices", 130); } continue; } foreach (RuleChoiceDef choice in val.ruleDef.choices) { if (val == null) { Log.Warning("Too many, or invalid expansion choices.", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/LobbyHandler.cs", "OverrideRuleChoices", 138); } else if (choice != val) { self.ForceChoice(mustInclude, mustExclude, choice); val = null; } } if (val != null) { Log.Error("Unable to find choice to disable expansion.", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/LobbyHandler.cs", "OverrideRuleChoices", 149); } continue; } Log.Error("Length mismatch between website and client in expansion array.", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/LobbyHandler.cs", "OverrideRuleChoices", 155); break; } } finally { ((IDisposable)enumerator2).Dispose(); } } private static void HookCharacterBuild(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_003b: Unknown result type (might be due to invalid IL or missing references) try { ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)0, new Func[1] { (Instruction i) => ILPatternMatchingExt.MatchCallvirt(i, (MethodBase)(typeof(List).GetProperty("Count")?.GetMethod)) })) { return; } val.Emit(OpCodes.Dup); val.EmitDelegate>>((Action>)delegate(List survivors) { List loadouts = LoadoutHandler.Instance.GetLoadouts(); if (loadouts.Count == 0) { return; } Dictionary dictionary = SurvivorCatalog.allSurvivorDefs.ToDictionary((SurvivorDef s) => s.displayNameToken, (SurvivorDef s) => s); survivors.Clear(); foreach (Loadout item in loadouts) { string displayTokenFromLexicalName = GauntletCatalog.GetDisplayTokenFromLexicalName(item.Survivor); if (dictionary.TryGetValue(displayTokenFromLexicalName, out var value)) { survivors.Add(value); } } }); } catch (Exception ex) { Debug.Log((object)ex); } } private static void OnCreateSurvivorIcon(orig_OnCreateSurvivorIcon orig, CharacterSelectBarController self, int index, SurvivorIconController controller) { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected O, but got Unknown orig.Invoke(self, index, controller); ((UnityEvent)(object)self.onSurvivorPicked).AddListener((UnityAction)OnPick); if (controller == null) { return; } ButtonClickedEvent onClick = ((Button)controller.hgButton).onClick; if (onClick != null) { ((UnityEvent)onClick).AddListener((UnityAction)delegate { Main.CurrentLoadout.Value = index + 1; Loadout loadout = LoadoutHandler.Instance.GetLoadout(Main.CurrentLoadout.Value); PreGameController.instance.RecalculateModifierAvailability(); SelectAbilitiesForLoadout(loadout, self.currentLocalUser); }); } void OnPick(SurvivorPickInfo s) { if (Main.CurrentLoadout.Value == index + 1) { self.PickIcon(self.survivorIconControllers.elements[index]); } ((UnityEvent)(object)self.onSurvivorPicked).RemoveListener((UnityAction)OnPick); } } private static void SelectAbilitiesForLoadout(Loadout loadout, LocalUser currentLocalUser) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) string token = GauntletCatalog.GetDisplayTokenFromLexicalName(loadout.Survivor); BodyIndex val = BodyCatalog.FindBodyIndex(SurvivorCatalog.allSurvivorDefs.First((SurvivorDef s) => s.displayNameToken == token).bodyPrefab); GenericSkill[] bodyPrefabSkillSlots = BodyCatalog.GetBodyPrefabSkillSlots(val); if (bodyPrefabSkillSlots == null) { Debug.Log((object)"body prefab skill slots are null"); return; } int i = 0; int num = 0; for (; i < bodyPrefabSkillSlots.Length; i++) { long num2 = ((bodyPrefabSkillSlots[i].skillFamily.variants.Length > 1) ? loadout.Skills[num++] : 0); currentLocalUser.userProfile.loadout.bodyLoadoutManager.SetSkillVariant(val, i, (uint)num2); } currentLocalUser.userProfile.OnLoadoutChanged(); } } internal static class Log { private static readonly StringBuilder _sharedStringBuilder; private static readonly int _cachedCallerPathPrefixLength; private static readonly object _logLock; private static ManualLogSource _logSource; static Log() { _sharedStringBuilder = new StringBuilder(256); _logLock = new object(); _cachedCallerPathPrefixLength = getCallerPathPrefixLength("/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/Log.cs"); static int getCallerPathPrefixLength([CallerFilePath] string callerPath = null) { int num = callerPath.LastIndexOf("Gauntlet\\src\\"); if (num >= 0) { return num + "Gauntlet\\src\\".Length; } Console.WriteLine("[Warning : Gauntlet]: [RoRGauntlet] Logger failed to determine caller path prefix length"); return 0; } } internal static void Init(ManualLogSource logSource) { _logSource = logSource; } private static StringBuilder buildCallerLogString(string callerPath, string callerMemberName, int callerLineNumber, object data) { return _sharedStringBuilder.Clear().Append(callerPath, _cachedCallerPathPrefixLength, callerPath.Length - _cachedCallerPathPrefixLength).Append(":") .Append(callerLineNumber) .Append(" (") .Append(callerMemberName) .Append("):") .Append(" ") .Append(data); } [Conditional("DEBUG")] internal static void Debug(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1) { lock (_logLock) { string text = buildCallerLogString(callerPath, callerMemberName, callerLineNumber, data).ToString(); if (_logSource != null) { _logSource.LogDebug((object)text); } else { Console.WriteLine("[Debug : Gauntlet]: " + text); } } } [Conditional("DEBUG")] internal static void Debug_NoCallerPrefix(object data) { lock (_logLock) { if (_logSource != null) { _logSource.LogDebug(data); } else { Console.WriteLine("[Debug : Gauntlet]: " + data); } } } internal static void Error(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1) { lock (_logLock) { string text = buildCallerLogString(callerPath, callerMemberName, callerLineNumber, data).ToString(); if (_logSource != null) { _logSource.LogError((object)text); } else { Console.WriteLine("[Error : Gauntlet]: " + text); } } } internal static void Error_NoCallerPrefix(object data) { lock (_logLock) { if (_logSource != null) { _logSource.LogError(data); } else { Console.WriteLine("[Error : Gauntlet]: " + data); } } } internal static void Fatal(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1) { lock (_logLock) { string text = buildCallerLogString(callerPath, callerMemberName, callerLineNumber, data).ToString(); if (_logSource != null) { _logSource.LogFatal((object)text); } else { Console.WriteLine("[Fatal : Gauntlet]: " + text); } } } internal static void Fatal_NoCallerPrefix(object data) { lock (_logLock) { if (_logSource != null) { _logSource.LogFatal(data); } else { Console.WriteLine("[Fatal : Gauntlet]: " + data); } } } internal static void Info(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1) { lock (_logLock) { string text = buildCallerLogString(callerPath, callerMemberName, callerLineNumber, data).ToString(); if (_logSource != null) { _logSource.LogInfo((object)text); } else { Console.WriteLine("[Info : Gauntlet]: " + text); } } } internal static void Info_NoCallerPrefix(object data) { lock (_logLock) { if (_logSource != null) { _logSource.LogInfo(data); } else { Console.WriteLine("[Info : Gauntlet]: " + data); } } } internal static void Message(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1) { lock (_logLock) { string text = buildCallerLogString(callerPath, callerMemberName, callerLineNumber, data).ToString(); if (_logSource != null) { _logSource.LogMessage((object)text); } else { Console.WriteLine("[Message : Gauntlet]: " + text); } } } internal static void Message_NoCallerPrefix(object data) { lock (_logLock) { if (_logSource != null) { _logSource.LogMessage(data); } else { Console.WriteLine("[Message : Gauntlet]: " + data); } } } internal static void Warning(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1) { lock (_logLock) { string text = buildCallerLogString(callerPath, callerMemberName, callerLineNumber, data).ToString(); if (_logSource != null) { _logSource.LogWarning((object)text); } else { Console.WriteLine("[Warning : Gauntlet]: " + text); } } } internal static void Warning_NoCallerPrefix(object data) { lock (_logLock) { if (_logSource != null) { _logSource.LogWarning(data); } else { Console.WriteLine("[Warning : Gauntlet]: " + data); } } } internal static void LogType(LogLevel level, object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0003: 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_0033: Unknown result type (might be due to invalid IL or missing references) if ((level & 0x20) != 0) { return; } lock (_logLock) { string text = buildCallerLogString(callerPath, callerMemberName, callerLineNumber, data).ToString(); if (_logSource != null) { _logSource.Log(level, (object)text); } else { Console.WriteLine($"[{level} : Gauntlet]: {text}"); } } } internal static void LogType_NoCallerPrefix(LogLevel level, object data) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) if ((level & 0x20) != 0) { return; } lock (_logLock) { if (_logSource != null) { _logSource.Log(level, data); } else { Console.WriteLine($"[{level} : Gauntlet]: {data}"); } } } } public sealed class Loop : MonoBehaviour { [CompilerGenerated] private static class <>O { public static hook_OnEnter <0>__UnlockInteraction; } private ConfigEntry entry; private void Awake() { entry = ((BaseUnityPlugin)Main.instance).Config.Bind("Run", "Loop Protection", true, "Keep the player from accidentally looping. Still allowed via Newt/Reliquary."); } private void OnEnable() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown //IL_0021: 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_002c: Expected O, but got Unknown ActiveToIdle.OnEnter += new hook_OnEnter(LockInteraction); object obj = <>O.<0>__UnlockInteraction; if (obj == null) { hook_OnEnter val = UnlockInteraction; <>O.<0>__UnlockInteraction = val; obj = (object)val; } IdleToActive.OnEnter += (hook_OnEnter)obj; TeleporterInteraction.Start += new Manipulator(NoBlueOrb); } private void OnDisable() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown //IL_0021: 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_002c: Expected O, but got Unknown ActiveToIdle.OnEnter -= new hook_OnEnter(LockInteraction); object obj = <>O.<0>__UnlockInteraction; if (obj == null) { hook_OnEnter val = UnlockInteraction; <>O.<0>__UnlockInteraction = val; obj = (object)val; } IdleToActive.OnEnter -= (hook_OnEnter)obj; TeleporterInteraction.Start -= new Manipulator(NoBlueOrb); } private void LockInteraction(orig_OnEnter orig, ActiveToIdle self) { orig.Invoke(self); TeleporterInteraction teleporterInteraction = ((LunarTeleporterBaseState)self).teleporterInteraction; teleporterInteraction.locked |= entry.Value; } private static void UnlockInteraction(orig_OnEnter orig, IdleToActive self) { orig.Invoke(self); ((LunarTeleporterBaseState)self).teleporterInteraction.locked = false; } private void NoBlueOrb(ILContext context) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) MethodInfo method = typeof(TeleporterInteraction).GetProperty("shouldAttemptToSpawnShopPortal").SetMethod; ILCursor val = new ILCursor(context); val.GotoNext(new Func[1] { (Instruction i) => ILPatternMatchingExt.MatchCallOrCallvirt(i, (MethodBase)method) }); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)((bool portal, TeleporterInteraction teleporter) => (!portal || !entry.Value || !((Object)teleporter).name.StartsWith("LunarTeleporter")) && portal)); } } public sealed class LunarShopConfiguration : MonoBehaviour { private bool lunar; private bool seer; private bool limited; private void Awake() { ConfigFile config = ((BaseUnityPlugin)Main.instance).Config; lunar = config.Bind("Bazaar & Lunar Items", "Lunar Shop Terminal", false, "Enable to purchase lunar items at the Bazaar Between Time.").Value; seer = config.Bind("Bazaar & Lunar Items", "Seer Station", false, "Determines if the next stage can be chosen here.").Value; limited = config.Bind("Bazaar & Lunar Items", "Lunar Lockdown", true, "Only valid for use at a Cleansing Pool on the same stage.").Value; } private void OnEnable() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown Stage.onServerStageBegin += SetupBazaar; Run.RefreshLunarCombinedDropList += new hook_RefreshLunarCombinedDropList(OnRunOnRefreshLunarCombinedDropList); SceneExitController.Begin += new hook_Begin(OnSceneExitControllerOnBegin); } private void OnDisable() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown Stage.onServerStageBegin -= SetupBazaar; Run.RefreshLunarCombinedDropList -= new hook_RefreshLunarCombinedDropList(OnRunOnRefreshLunarCombinedDropList); SceneExitController.Begin -= new hook_Begin(OnSceneExitControllerOnBegin); } private void OnRunOnRefreshLunarCombinedDropList(orig_RefreshLunarCombinedDropList orig, Run self) { orig.Invoke(self); if (limited) { LimitLunarItems(self); } } private void OnSceneExitControllerOnBegin(orig_Begin orig, SceneExitController self) { if (limited) { RemoveLunarItems(); } orig.Invoke(self); } private void SetupBazaar(Stage stage) { SceneDef sceneDef = stage.sceneDef; if ("bazaar" == ((sceneDef != null) ? sceneDef.baseSceneName : null)) { SetActive("LunarShopTerminal", lunar); SetActive("LunarTable", lunar); SetActive("LunarRecycler", lunar && !limited); SetActive("SeerStation", seer); } } private static void LimitLunarItems(Run run) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) PickupIndex item = PickupCatalog.FindPickupIndex(Items.LunarTrinket.itemIndex); run.availableLunarEquipmentDropList.Clear(); run.availableLunarItemDropList.Clear(); run.availableLunarCombinedDropList.Clear(); run.availableLunarItemDropList.Add(item); run.availableLunarCombinedDropList.Add(item); } private static void RemoveLunarItems() { //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_0029: 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) ItemIndex itemIndex = Items.LunarTrinket.itemIndex; foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances) { instance.master.inventory.ResetItemPermanent(itemIndex); instance.master.inventory.ResetItemTemp(itemIndex); } } private static void SetActive(string name, bool state) { GameObject[] array = Object.FindObjectsOfType(); foreach (GameObject val in array) { if (((Object)val).name.StartsWith(name)) { val.SetActive(state); } } } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("RiskOfResources.RoRGauntlet", "RoRGauntlet", "2.7.3")] public sealed class Main : BaseUnityPlugin { public const string PluginGUID = "RiskOfResources.RoRGauntlet"; public const string PluginAuthor = "RiskOfResources"; public const string PluginName = "RoRGauntlet"; public const string PluginVersion = "2.7.3"; public static bool ConcedeCheck; internal string authorization; private GameObject _gauntletGameObject; public static Main instance; public static ConfigEntry UserId { get; set; } public static ConfigEntry EnvironmentName { get; set; } public static ConfigEntry CurrentLoadout { get; set; } public static ConfigEntry PillarNum { get; set; } public static ConfigEntry DifficultySelect { get; set; } public static ConfigEntry UseDLC3Path { get; private set; } private void Awake() { //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Expected O, but got Unknown instance = this; Log.Init(((BaseUnityPlugin)this).Logger); LazarusWings.Initialize(); InitConfig(); Assets.Initialize(((BaseUnityPlugin)this).Info.Location); ((Component)this).gameObject.AddComponent(); ((Component)this).gameObject.AddComponent(); ((Component)this).gameObject.AddComponent(); ((Component)this).gameObject.AddComponent(); Type[] array = new Type[17] { typeof(ConcedeUI), typeof(StagePreviewUI), typeof(StageRNG), typeof(SeededPrinter), typeof(SeededRecycler), typeof(SeededChanceDoll), typeof(SeededSonorousWhispers), typeof(LobbyHandler), typeof(SubmitRun), typeof(LunarShopConfiguration), typeof(BenthicBloomSeeding), typeof(Loop), typeof(DLC2), typeof(DLC3), typeof(IgnoreFallDamage), typeof(ContainInArenaHandler), typeof(AntiCheat) }; _gauntletGameObject = new GameObject("Gauntlet", array); _gauntletGameObject.transform.SetParent(((Component)this).transform); _gauntletGameObject.AddComponent().key = "RoR2/DLC1/AcidLarva/AcidLarvaBody.prefab"; } public void InitConfig() { //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Expected O, but got Unknown //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Expected O, but got Unknown //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Expected O, but got Unknown UserId = ((BaseUnityPlugin)this).Config.Bind("Player", "User Id", "", "Resolved by the API. Not something you should mess with"); CurrentLoadout = ((BaseUnityPlugin)this).Config.Bind("Player", "Loadout Number", 1, "Specifies which loadout number will be employed."); EnvironmentName = ((BaseUnityPlugin)this).Config.Bind("Run", "Environment", "prd", new ConfigDescription("Sets the environment, use 'prd' unless told otherwise.", (AcceptableValueBase)(object)new AcceptableValueList(new string[3] { "prd", "dev", "dbg" }), Array.Empty())); PillarNum = ((BaseUnityPlugin)this).Config.Bind("Game Rules", "Number of Pillars", 2, "Port of RiskyMod's number of pillars, simply how many pillars you have to charge before the launchpads get enabled -- it is recommended all players have a consistent pillar requirement"); DifficultySelect = ((BaseUnityPlugin)this).Config.Bind("Game Rules", "Race Difficulty", "Eclipse8", new ConfigDescription("The difficulty all racers will be forced to play on", (AcceptableValueBase)(object)new AcceptableValueList(new string[5] { "Easy", "Normal", "Hard", "Eclipse8", "Any" }), Array.Empty())); UseDLC3Path = ((BaseUnityPlugin)this).Config.Bind("Game Rules", "Solus Heart Ending", false, new ConfigDescription("If enabled, access node on stage 3 is activated automatically, and exiting stage 3 brings you to Conduit Canyon. Run ends after beating Solus Heart.", (AcceptableValueBase)null, Array.Empty())); } public void EnableGauntlet() { _gauntletGameObject.SetActive(true); } public void DisableGauntlet() { _gauntletGameObject.SetActive(false); } public async void JoinLobby(string lobbyCodeUserInput) { EnableGauntlet(); try { bool num = string.IsNullOrEmpty(UserId.Value) || string.IsNullOrEmpty(instance.authorization); RaceV2Api raceV2Api = RaceV2Api.Instance; if (num) { await raceV2Api.SignInWeb(); } if (!string.IsNullOrEmpty(lobbyCodeUserInput)) { ((MonoBehaviour)this).StartCoroutine(raceV2Api.JoinLobby(lobbyCodeUserInput, null, delegate(Race race) { CurrentLoadout.Value = race.GetCurrentLoadoutIndex(UserId.Value); LoadoutHandler.Instance.RegisterRace(race); Console.instance.SubmitCmd((NetworkUser)null, "transition_command \"gamemode ClassicRun; host 0; \"", false); })); return; } Debug.Log((object)"No lobby code found"); raceV2Api.JoinCurrentRace(delegate(Race race) { CurrentLoadout.Value = race.GetCurrentLoadoutIndex(UserId.Value); LoadoutHandler.Instance.RegisterRace(race); Console.instance.SubmitCmd((NetworkUser)null, "transition_command \"gamemode ClassicRun; host 0; \"", false); }); } catch (Exception arg) { Debug.LogError((object)$"Failed to join lobby: {arg}"); } } } public sealed class MainMenuLobbyUI : MonoBehaviour { [CompilerGenerated] private sealed class <g__none|6_2>d : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <g__none|6_2>d(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = null; <>1__state = 1; return true; case 1: <>1__state = -1; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private static class <>O { public static hook_Init <0>__Language_Init; } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Predicate <>9__1_1; public static hook_FromDifficulty <>9__1_0; public static UnityAction <>9__5_0; internal RuleDef b__1_0(orig_FromDifficulty orig) { RuleDef obj = orig.Invoke(); RuleChoiceDef val = obj.choices.Find((RuleChoiceDef choice) => (int)choice.difficultyIndex == 10); val.excludeByDefault = false; obj.defaultChoiceIndex = val.localIndex; return obj; } internal bool b__1_1(RuleChoiceDef choice) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 return (int)choice.difficultyIndex == 10; } internal void b__5_0() { Main.instance.DisableGauntlet(); } } [CompilerGenerated] private sealed class d__3 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public orig_Init orig; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__3(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = orig.Invoke(); <>1__state = 1; return true; case 1: <>1__state = -1; Language.currentLanguage.SetStringByToken("TITLE_SINGLEPLAYER", "Play Offline"); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private string _lobbyCodeUserInput; private void Awake() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown object obj = <>O.<0>__Language_Init; if (obj == null) { hook_Init val = Language_Init; <>O.<0>__Language_Init = val; obj = (object)val; } Language.Init += (hook_Init)obj; MainMenuController.Start += new hook_Start(MainMenuController_Start); object obj2 = <>c.<>9__1_0; if (obj2 == null) { hook_FromDifficulty val2 = delegate(orig_FromDifficulty orig) { RuleDef obj3 = orig.Invoke(); RuleChoiceDef val3 = obj3.choices.Find((RuleChoiceDef choice) => (int)choice.difficultyIndex == 10); val3.excludeByDefault = false; obj3.defaultChoiceIndex = val3.localIndex; return obj3; }; <>c.<>9__1_0 = val2; obj2 = (object)val2; } RuleDef.FromDifficulty += (hook_FromDifficulty)obj2; } private void MainMenuController_Start(orig_Start orig, MainMenuController self) { MainMenuController.wasInMultiplayer = false; orig.Invoke(self); MakeJoinRaceButton(self.titleMenuScreen, self); CreateInputField(self.titleMenuScreen); RemoveUselessButtons(self.titleMenuScreen); } [IteratorStateMachine(typeof(d__3))] private static IEnumerator Language_Init(orig_Init orig) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__3(0) { orig = orig }; } private static void RemoveUselessButtons(BaseMainMenuScreen self) { GameObject val = self.myMainMenuController.mainMenuButtonPanel.FindObject("GenericMenuButton (Music&More)"); GameObject val2 = self.myMainMenuController.mainMenuButtonPanel.FindObject("GenericMenuButton (Extra Game Mode)"); if (!((Object)(object)val == (Object)null) && !((Object)(object)val2 == (Object)null)) { Object.Destroy((Object)(object)val); Object.Destroy((Object)(object)val2); } } private void MakeJoinRaceButton(BaseMainMenuScreen self, MainMenuController controller) { //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Expected O, but got Unknown //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Expected O, but got Unknown //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Expected O, but got Unknown ButtonSkinController val = default(ButtonSkinController); if (!((Component)controller.singlePlayerButton).TryGetComponent(ref val)) { Debug.Log((object)"No Buttons Found, skipping UI creation."); return; } GameObject val2 = Object.Instantiate(((Component)val).gameObject, ((Component)val).gameObject.transform.parent); ((Object)val2).name = "JoinRaceButton"; val2.transform.SetSiblingIndex(1); LanguageTextMeshController val3 = default(LanguageTextMeshController); if (val2.TryGetComponent(ref val3)) { val3.token = "Join Race"; } HGButton val4 = default(HGButton); if (val2.TryGetComponent(ref val4)) { val4.hoverToken = "Enter a lobby code to compete against other players."; ButtonClickedEvent onClick = ((Button)controller.singlePlayerButton).onClick; object obj = <>c.<>9__5_0; if (obj == null) { UnityAction val5 = delegate { Main.instance.DisableGauntlet(); }; <>c.<>9__5_0 = val5; obj = (object)val5; } ((UnityEvent)onClick).AddListener((UnityAction)obj); ((Button)val4).onClick = new ButtonClickedEvent(); ((UnityEvent)((Button)val4).onClick).AddListener((UnityAction)delegate { Main.instance.JoinLobby(_lobbyCodeUserInput); }); } else { Object.Destroy((Object)(object)val2); } } private void CreateInputField(BaseMainMenuScreen self) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown //IL_009c: 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_00d7: Expected O, but got Unknown //IL_00ed: Unknown result type (might be due to invalid IL or missing references) GameObject val = self.myMainMenuController.mainMenuButtonPanel.FindObject("GenericMenuButton (Multiplayer)"); if ((Object)(object)val == (Object)null) { Debug.Log((object)"genericMenuButtonMultiplayer Not here"); return; } CanvasScaler component = ((Component)self).GetComponent(); ((Behaviour)component).enabled = false; GameObject val2 = new GameObject("GenericMenuButton (LobbyInput)"); val2.SetActive(false); ((Component)(object)val2.AddComponent()).GetCopyOf(val.GetComponent()); ((Component)(object)val2.AddComponent()).GetCopyOf(val.GetComponent()); Image obj = val2.AddComponent(); ((Component)(object)obj).GetCopyOf(val.GetComponent()); ((Graphic)obj).color = new Color(0.3f, 0.3f, 0.3f); Transform transform = val2.transform; transform.SetParent(val.transform.parent); Object.Destroy((Object)(object)val); transform.SetSiblingIndex(2); GameObject val3 = new GameObject("LobbyInput Text"); ((Transform)val3.AddComponent()).localPosition = new Vector3(-48f, -12f, 0f); val3.AddComponent(); TextMeshProUGUI textComponent = val3.AddComponent(); ((TMP_Text)textComponent).text = "Input Code..."; ((TMP_Text)textComponent).alpha = 0.4f; ((TMP_Text)textComponent).overflowMode = (TextOverflowModes)1; ((TMP_Text)textComponent).fontSize = 24f; val3.transform.SetParent(transform); TMP_InputField inputField = val2.AddComponent(); inputField.textComponent = (TMP_Text)(object)textComponent; ((UnityEvent)(object)inputField.onEndEdit).AddListener((UnityAction)delegate(string input) { _lobbyCodeUserInput = input; }); ((UnityEvent)(object)inputField.onSelect).AddListener((UnityAction)delegate { ((TMP_Text)textComponent).alpha = 0.75f; inputField.m_PreventCallback = false; }); inputField.m_PreventCallback = true; inputField.m_DragCoroutine = ((MonoBehaviour)this).StartCoroutine(none()); val2.SetActive(true); ((Behaviour)component).enabled = true; [IteratorStateMachine(typeof(<g__none|6_2>d))] static IEnumerator none() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <g__none|6_2>d(0); } } } public sealed class MasterDeathInfoProvider : NetworkBehaviour { [CompilerGenerated] private sealed class d__10 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public MasterDeathInfoProvider <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__10(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_004a: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; MasterDeathInfoProvider masterDeathInfoProvider = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <>2__current = null; <>1__state = 1; return true; case 1: <>1__state = -1; if (NetworkServer.active && masterDeathInfoProvider._master.IsDeadAndOutOfLivesServer()) { masterDeathInfoProvider.LastDeathTime = FixedTimeStamp.now; } return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private CharacterMaster _master; [SyncVar] private float _lastDeathTimeInternal = float.NegativeInfinity; public FixedTimeStamp LastDeathTime { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return new FixedTimeStamp(_lastDeathTimeInternal); } [MethodImpl(MethodImplOptions.AggressiveInlining)] [Server] set { //IL_0001: Unknown result type (might be due to invalid IL or missing references) _lastDeathTimeInternal = value.t; } } [SystemInitializer(new Type[] { typeof(MasterCatalog) })] private static void Init() { foreach (CharacterMaster allMaster in MasterCatalog.allMasters) { if (Object.op_Implicit((Object)(object)allMaster)) { UnityObjectExtensions.EnsureComponent(((Component)allMaster).gameObject); } } } private void Awake() { _master = ((Component)this).GetComponent(); } private void OnEnable() { GlobalEventManager.onCharacterDeathGlobal += onCharacterDeathGlobal; if (Object.op_Implicit((Object)(object)_master)) { _master.onBodyStart += onBodyStart; } } private void OnDisable() { GlobalEventManager.onCharacterDeathGlobal -= onCharacterDeathGlobal; if (Object.op_Implicit((Object)(object)_master)) { _master.onBodyStart -= onBodyStart; } ((MonoBehaviour)this).StopAllCoroutines(); } private void onCharacterDeathGlobal(DamageReport damageReport) { if ((Object)(object)damageReport.victimMaster == (Object)(object)_master) { ((MonoBehaviour)this).StartCoroutine(onDeath(damageReport)); } } [IteratorStateMachine(typeof(d__10))] private IEnumerator onDeath(DamageReport damageReport) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__10(0) { <>4__this = this }; } private void onBodyStart(CharacterBody body) { onRevive(); } private void onRevive() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active) { LastDeathTime = FixedTimeStamp.negativeInfinity; } } } public struct NodeReference : IEquatable { public NodeGraph NodeGraph; public NodeIndex NodeIndex; public NodeReference(NodeGraph nodeGraph, NodeIndex nodeIndex) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) NodeGraph = nodeGraph; NodeIndex = nodeIndex; } public override readonly bool Equals(object obj) { if (obj is NodeReference other) { return Equals(other); } return false; } public readonly bool Equals(NodeReference other) { //IL_0014: 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) if ((Object)(object)NodeGraph == (Object)(object)other.NodeGraph) { return NodeIndex == other.NodeIndex; } return false; } public override readonly int GetHashCode() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) return HashCode.Combine(NodeGraph, NodeIndex); } public override readonly string ToString() { return $"{(Object.op_Implicit((Object)(object)NodeGraph) ? ((Object)NodeGraph).name : string.Empty)}: {NodeIndex.nodeIndex}"; } public static bool operator ==(NodeReference left, NodeReference right) { return left.Equals(right); } public static bool operator !=(NodeReference left, NodeReference right) { return !(left == right); } } public sealed class OrderedDropTableTransmutationProvider { private static readonly Dictionary _dropTableWeightedSelectionFieldCache = new Dictionary(); private readonly OrderedTransformationGenerator _transmutationGenerator; public OrderedDropTableTransmutationProvider(ulong seed, PickupDropTable dropTable) { if (!Object.op_Implicit((Object)(object)dropTable)) { throw new ArgumentNullException("dropTable"); } Type type = ((object)dropTable).GetType(); if (!_dropTableWeightedSelectionFieldCache.TryGetValue(type, out var value)) { FieldInfo[] fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (FieldInfo fieldInfo in fields) { if (fieldInfo.FieldType == typeof(WeightedSelection)) { value = fieldInfo; _dropTableWeightedSelectionFieldCache.Add(type, fieldInfo); break; } } } if (value?.GetValue(dropTable) is WeightedSelection availableValues) { _transmutationGenerator = new OrderedTransformationGenerator(seed, availableValues); } else { Log.Error($"No drop table selector on {dropTable}", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/OrderedDropTableTransmutationProvider.cs", ".ctor", 40); } } public UniquePickup GetNextTransmutation(UniquePickup originalPickup) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) if (_transmutationGenerator == null) { return originalPickup; } if (!_transmutationGenerator.TryGetNextTransformation((UniquePickup i) => i != originalPickup, out var result)) { return originalPickup; } return ((UniquePickup)(ref originalPickup)).WithPickupIndex(result.pickupIndex); } } public sealed class OrderedPickupTransmutationProvider { public delegate bool AllowPickupTransmutationDelegate(PickupIndex from, PickupIndex to); private readonly OrderedTransformationGenerator[] _transmutationGenerators = Array.Empty>(); public OrderedPickupTransmutationProvider(ulong seed, AllowPickupTransmutationDelegate allowTransmutationPredicate = null) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Expected O, but got Unknown //IL_00b7: 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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) Dictionary, List> dictionary = new Dictionary, List>(SequenceComparer.Default); Enumerator enumerator = PickupCatalog.allPickupIndices.GetEnumerator(); try { while (((Enumerator)(ref enumerator)).MoveNext()) { PickupIndex current = ((Enumerator)(ref enumerator)).Current; IReadOnlyList readOnlyList = PickupTransmutationManager.GetAvailableGroupFromPickupIndex(current); if (readOnlyList == null) { continue; } if (allowTransmutationPredicate != null && readOnlyList.Count > 0) { List list = null; for (int num = readOnlyList.Count - 1; num >= 0; num--) { if (!allowTransmutationPredicate(current, readOnlyList[num])) { if (list == null) { list = readOnlyList.ToList(); } list.RemoveAt(num); } } if (list != null) { list.TrimExcess(); readOnlyList = list; } } if (readOnlyList.Count > 1) { dictionary.GetOrAddNew(readOnlyList).Add(current); } } } finally { ((IDisposable)(Enumerator)(ref enumerator)).Dispose(); } _transmutationGenerators = new OrderedTransformationGenerator[PickupCatalog.pickupCount]; Xoroshiro128Plus val = new Xoroshiro128Plus(seed); foreach (KeyValuePair, List> item in dictionary) { item.Deconstruct(out var key, out var value); IReadOnlyList availableValues = key; List list2 = value; OrderedTransformationGenerator orderedTransformationGenerator = new OrderedTransformationGenerator(val.nextUlong, (IEnumerable)availableValues); foreach (PickupIndex item2 in list2) { if (ArrayUtils.IsInBounds>(_transmutationGenerators, item2.value)) { if (_transmutationGenerators[item2.value] != null) { Log.Error($"Duplicate group for {item2}", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/OrderedPickupTransmutationProvider.cs", ".ctor", 69); } else { _transmutationGenerators[item2.value] = orderedTransformationGenerator; } } } } } public PickupIndex GetNextTransmutation(PickupIndex originalPickupIndex) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0028: 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_0045: Unknown result type (might be due to invalid IL or missing references) OrderedTransformationGenerator safe = ArrayUtils.GetSafe>(_transmutationGenerators, originalPickupIndex.value); if (safe == null) { return originalPickupIndex; } if (!safe.TryGetNextTransformation((PickupIndex i) => i != originalPickupIndex, out var result)) { return originalPickupIndex; } return result; } } public sealed class OrderedTransformationGenerator { private readonly WeightedSelection _availableValuesSelection; private readonly List _queuedTransformations = new List(); private readonly Xoroshiro128Plus _rng; public OrderedTransformationGenerator(ulong seed, IEnumerable availableValues) : this(seed, createWrapperSelection(availableValues)) { } public OrderedTransformationGenerator(ulong seed, WeightedSelection availableValues) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown if (availableValues == null) { throw new ArgumentNullException("availableValues"); } _rng = new Xoroshiro128Plus(seed); _availableValuesSelection = availableValues; } public bool Contains(T value, IEqualityComparer equalityComparer = null) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) if (equalityComparer == null) { equalityComparer = EqualityComparer.Default; } for (int i = 0; i < _availableValuesSelection.Count; i++) { if (equalityComparer.Equals(_availableValuesSelection.GetChoice(i).value, value)) { return true; } } return false; } public bool TryGetNextTransformation(out T result) { return TryGetNextTransformation(null, out result); } public bool TryGetNextTransformation(Predicate selector, out T result) { for (int i = 0; i < _queuedTransformations.Count; i++) { if (selector == null || selector(_queuedTransformations[i])) { result = _queuedTransformations.GetAndRemoveAt(i); return true; } } if (_availableValuesSelection.Count <= 0) { Log.Error("No available values", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/OrderedTransformationGenerator.cs", "TryGetNextTransformation", 61); result = default(T); return false; } int num = _availableValuesSelection.Count * _availableValuesSelection.Count; int num2 = 0; T val = generateNext(); while (selector != null && !selector(val)) { if (num2 >= num) { result = default(T); return false; } _queuedTransformations.Add(val); val = generateNext(); num2++; } result = val; return true; } private T generateNext() { return _availableValuesSelection.Evaluate(_rng.nextNormalizedFloat); } private static WeightedSelection createWrapperSelection(IEnumerable values) { WeightedSelection val = new WeightedSelection(8); if (values is ICollection collection) { val.EnsureCapacity(collection.Count); } foreach (T value in values) { val.AddChoice(value, 1f); } return val; } } public sealed class ProperSaveDependencyWrapper { private const string SAVE_NAME_PATH = "RoRGauntlet."; private static bool? _enabled; private static StageRNG rngData; public static bool enabled { get { if (!_enabled.HasValue) { _enabled = Chainloader.PluginInfos.ContainsKey("com.KingEnderBrine.ProperSave"); } return _enabled.Value; } } public static bool loadingSave { get; set; } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void SaveProperRng() { SaveFile.OnGatherSaveData += AddLockboxRngs; Loading.OnLoadingStarted += ExportRngsToSave; } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static void ExportRngsToSave(SaveFile obj) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown loadingSave = true; Dictionary dictionary = new Dictionary(); string[] namedRngs = rngData.NamedRngs; foreach (string text in namedRngs) { Xoroshiro128Plus value = new Xoroshiro128Plus(0uL); obj.GetModdedData("RoRGauntlet." + text).LoadDataRef(ref value); dictionary.Add(text, value); } rngData.ImportRNGs(dictionary); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void LoadProperRng(StageRNG rng) { rngData = rng; } private static void AddLockboxRngs(Dictionary obj) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown Dictionary dictionary = rngData.ExportRNGs(); foreach (string key in dictionary.Keys) { RngData value = new RngData(dictionary[key]); obj.Add("RoRGauntlet." + key, value); } } } internal static class RunHooks { public delegate void RunDelegate(Run run); [CompilerGenerated] private sealed class d__6 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__6(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = null; <>1__state = 1; return true; case 1: <>1__state = -1; RunHooks.OnRunPostStartGlobal?.Invoke(Run.instance); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public static event RunDelegate OnRunPostStartGlobal; [SystemInitializer(new Type[] { })] private static void Init() { Run.onRunStartGlobal += onRunStartGlobal; } private static void onRunStartGlobal(Run run) { ((MonoBehaviour)run).StartCoroutine(waitThenInvokePostRunStartEvent()); } [IteratorStateMachine(typeof(d__6))] private static IEnumerator waitThenInvokePostRunStartEvent() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__6(0); } } internal sealed class RuntimeCloudMaterialMapper { public enum _CullEnum { Off, Front, Back } public enum _ZTestEnum { Disabled, Never, Less, Equal, LessEqual, Greater, NotEqual, GreaterEqual, Always } private static readonly string[] _keywordStrings = new string[11] { "DISABLEREMAP", "USE_UV1", "FADECLOSE", "USE_CLOUDS", "CLOUDOFFSET", "VERTEXCOLOR", "VERTEXALPHA", "CALCTEXTUREALPHA", "VERTEXOFFSET", "FRESNEL", "SKYBOX_ONLY" }; public string[] shaderKeywords; public Color _Tint = Color.white; public Texture _MainTex; public Vector2 _MainTexScale = Vector2.one; public Vector2 _MainTexOffset = Vector2.zero; public Texture _RemapTex; public Vector2 _RemapTexScale = Vector2.one; public Vector2 _RemapTexOffset = Vector2.zero; [Range(0f, 2f)] public float _InvFade = 0.1f; [Range(1f, 20f)] public float _BrightnessBoost = 1f; [Range(0f, 20f)] public float _AlphaBoost = 1f; [Range(0f, 1f)] public float _AlphaBias; [Range(0f, 1f)] public float _FadeCloseDistance = 0.5f; public _CullEnum _Cull_Mode; public _ZTestEnum _ZTest_Mode = _ZTestEnum.LessEqual; [Range(-10f, 10f)] public float _DepthOffset; [Range(-2f, 2f)] public float _DistortionStrength = 0.1f; public Texture _Cloud1Tex; public Vector2 _Cloud1TexScale; public Vector2 _Cloud1TexOffset; public Texture _Cloud2Tex; public Vector2 _Cloud2TexScale; public Vector2 _Cloud2TexOffset; public Vector4 _CutoffScroll; [Range(-20f, 20f)] public float _FresnelPower; [Range(0f, 3f)] public float _VertexOffsetAmount; public RuntimeCloudMaterialMapper(Material material) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) GetMaterialValues(material); } public void GetMaterialValues(Material material) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_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_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_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_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_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) shaderKeywords = material.shaderKeywords; _Tint = material.GetColor("_TintColor"); _MainTex = material.GetTexture("_MainTex"); _MainTexScale = material.GetTextureScale("_MainTex"); _MainTexOffset = material.GetTextureOffset("_MainTex"); _RemapTex = material.GetTexture("_RemapTex"); _RemapTexScale = material.GetTextureScale("_RemapTex"); _RemapTexOffset = material.GetTextureOffset("_RemapTex"); _InvFade = material.GetFloat("_InvFade"); _BrightnessBoost = material.GetFloat("_Boost"); _AlphaBoost = material.GetFloat("_AlphaBoost"); _AlphaBias = material.GetFloat("_AlphaBias"); _FadeCloseDistance = material.GetFloat("_FadeCloseDistance"); _Cull_Mode = (_CullEnum)material.GetFloat("_Cull"); _ZTest_Mode = (_ZTestEnum)material.GetFloat("_ZTest"); _DepthOffset = material.GetFloat("_DepthOffset"); _DistortionStrength = material.GetFloat("_DistortionStrength"); _Cloud1Tex = material.GetTexture("_Cloud1Tex"); _Cloud1TexScale = material.GetTextureScale("_Cloud1Tex"); _Cloud1TexOffset = material.GetTextureOffset("_Cloud1Tex"); _Cloud2Tex = material.GetTexture("_Cloud2Tex"); _Cloud2TexScale = material.GetTextureScale("_Cloud2Tex"); _Cloud2TexOffset = material.GetTextureOffset("_Cloud2Tex"); _CutoffScroll = material.GetVector("_CutoffScroll"); _FresnelPower = material.GetFloat("_FresnelPower"); _VertexOffsetAmount = material.GetFloat("_OffsetAmount"); } public void SetMaterialValues(ref Material material) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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_00e8: 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_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) string[] keywordStrings = _keywordStrings; foreach (string text in keywordStrings) { if (material.IsKeywordEnabled(text)) { material.DisableKeyword(text); } } keywordStrings = shaderKeywords; foreach (string text2 in keywordStrings) { material.EnableKeyword(text2); } material.SetColor("_TintColor", _Tint); if (Object.op_Implicit((Object)(object)_MainTex)) { material.SetTexture("_MainTex", _MainTex); material.SetTextureScale("_MainTex", _MainTexScale); material.SetTextureOffset("_MainTex", _MainTexOffset); } else { material.SetTexture("_MainTex", (Texture)null); } if (Object.op_Implicit((Object)(object)_RemapTex)) { material.SetTexture("_RemapTex", _RemapTex); material.SetTextureScale("_RemapTex", _RemapTexScale); material.SetTextureOffset("_RemapTex", _RemapTexOffset); } else { material.SetTexture("_RemapTex", (Texture)null); } material.SetFloat("_InvFade", _InvFade); material.SetFloat("_Boost", _BrightnessBoost); material.SetFloat("_AlphaBoost", _AlphaBoost); material.SetFloat("_AlphaBias", _AlphaBias); material.SetFloat("_FadeCloseDistance", _FadeCloseDistance); material.SetFloat("_Cull", Convert.ToSingle(_Cull_Mode)); material.SetFloat("_ZTest", Convert.ToSingle(_ZTest_Mode)); material.SetFloat("_DepthOffset", _DepthOffset); material.SetFloat("_DistortionStrength", _DistortionStrength); if (Object.op_Implicit((Object)(object)_Cloud1Tex)) { material.SetTexture("_Cloud1Tex", _Cloud1Tex); material.SetTextureScale("_Cloud1Tex", _Cloud1TexScale); material.SetTextureOffset("_Cloud1Tex", _Cloud1TexOffset); } else { material.SetTexture("_Cloud1Tex", (Texture)null); } if (Object.op_Implicit((Object)(object)_Cloud2Tex)) { material.SetTexture("_Cloud2Tex", _Cloud2Tex); material.SetTextureScale("_Cloud2Tex", _Cloud2TexScale); material.SetTextureOffset("_Cloud2Tex", _Cloud2TexOffset); } else { material.SetTexture("_Cloud2Tex", (Texture)null); } material.SetVector("_CutoffScroll", _CutoffScroll); material.SetFloat("_FresnelPower", _FresnelPower); material.SetFloat("_OffsetAmount", _VertexOffsetAmount); } } public sealed class SeededChanceDoll : MonoBehaviour { [DisallowMultipleComponent] private class ShrineDollRNGProvider : MonoBehaviour { public Xoroshiro128Plus ChanceDollRNG; } [CompilerGenerated] private static class <>O { public static hook_Start <0>__ShrineChanceBehavior_Start; public static Manipulator <1>__ShrineChanceBehavior_AddShrineStack; public static Func <2>__getChanceDollRollThreshold; } private void OnEnable() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown object obj = <>O.<0>__ShrineChanceBehavior_Start; if (obj == null) { hook_Start val = ShrineChanceBehavior_Start; <>O.<0>__ShrineChanceBehavior_Start = val; obj = (object)val; } ShrineChanceBehavior.Start += (hook_Start)obj; object obj2 = <>O.<1>__ShrineChanceBehavior_AddShrineStack; if (obj2 == null) { Manipulator val2 = ShrineChanceBehavior_AddShrineStack; <>O.<1>__ShrineChanceBehavior_AddShrineStack = val2; obj2 = (object)val2; } ShrineChanceBehavior.AddShrineStack += (Manipulator)obj2; } private void OnDisable() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown object obj = <>O.<0>__ShrineChanceBehavior_Start; if (obj == null) { hook_Start val = ShrineChanceBehavior_Start; <>O.<0>__ShrineChanceBehavior_Start = val; obj = (object)val; } ShrineChanceBehavior.Start -= (hook_Start)obj; object obj2 = <>O.<1>__ShrineChanceBehavior_AddShrineStack; if (obj2 == null) { Manipulator val2 = ShrineChanceBehavior_AddShrineStack; <>O.<1>__ShrineChanceBehavior_AddShrineStack = val2; obj2 = (object)val2; } ShrineChanceBehavior.AddShrineStack -= (Manipulator)obj2; } private static void ShrineChanceBehavior_Start(orig_Start orig, ShrineChanceBehavior self) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown orig.Invoke(self); if (self.rng != null) { ((Component)self).gameObject.AddComponent().ChanceDollRNG = new Xoroshiro128Plus(self.rng.nextUlong); } } private static void ShrineChanceBehavior_AddShrineStack(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); VariableDefinition val2 = il.AddVariable(); ILCursor[] array = default(ILCursor[]); ILLabel val5 = default(ILLabel); if (val.TryFindNext(ref array, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "failureChance"), (Instruction x) => ILPatternMatchingExt.MatchBleUn(x, ref val5) })) { ILCursor obj = array[1]; int index = obj.Index; obj.Index = index + 1; obj.Emit(OpCodes.Ldarg_0); obj.EmitDelegate>((Func)getChanceDollRollThreshold); obj.Emit(OpCodes.Stloc, val2); if (val.TryGotoNext((MoveType)0, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)SymbolExtensions.GetMethodInfo((Expression)(() => Util.CheckRoll(0f, (CharacterMaster)null)))) })) { VariableDefinition val3 = il.AddVariable(); VariableDefinition val4 = il.AddVariable(); val.Emit(OpCodes.Stloc, val3); val.Emit(OpCodes.Stloc, val4); val.Emit(OpCodes.Ldloc, val4); val.Emit(OpCodes.Ldnull); index = val.Index; val.Index = index + 1; val.Emit(OpCodes.Pop); val.Emit(OpCodes.Ldloc, val4); val.Emit(OpCodes.Ldloc, val3); val.Emit(OpCodes.Ldloc, val2); val.Emit(OpCodes.Call, (MethodBase)typeof(DLC2).GetMethod("CheckForLuck")); } else { Log.Error("Failed to find chance doll roll hook location", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/SeededChanceDoll.cs", "ShrineChanceBehavior_AddShrineStack", 94); } } else { Log.Error("Failed to find shrine success hook location", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/SeededChanceDoll.cs", "ShrineChanceBehavior_AddShrineStack", 67); } static float getChanceDollRollThreshold(ShrineChanceBehavior shrineChanceBehavior) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) ShrineDollRNGProvider shrineDollRNGProvider = default(ShrineDollRNGProvider); if (((Component)shrineChanceBehavior).TryGetComponent(ref shrineDollRNGProvider)) { return shrineDollRNGProvider.ChanceDollRNG.nextNormalizedFloat * 100f; } Log.Error($"Shrine ({((NetworkBehaviour)shrineChanceBehavior).netId}) is missing Chance Doll RNG provider", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/SeededChanceDoll.cs", "ShrineChanceBehavior_AddShrineStack", 58); return float.PositiveInfinity; } } } public sealed class SeededPrinter : MonoBehaviour { [CompilerGenerated] private static class <>O { public static Manipulator <0>__PayCostItemsManipulator; public static Func <1>__matchTakeItemsFromWeightedSelectionCall; public static Func, WeightedSelection, WeightedSelection, WeightedSelection, bool> <2>__tryOverrideTakeItems; } private static MethodInfo _payCostItemsMethod; private bool _hooksActive; private readonly List _detours = new List(); [SystemInitializer(new Type[] { typeof(CostTypeCatalog) })] private static void Init() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Invalid comparison between Unknown and I4 for (int i = 0; i < CostTypeCatalog.costTypeCount; i++) { CostTypeDef costTypeDef = CostTypeCatalog.GetCostTypeDef((CostTypeIndex)i); if (costTypeDef != null && (int)costTypeDef.itemTier != 5 && ((Delegate)(object)costTypeDef.payCost)?.Method != null) { _payCostItemsMethod = ((Delegate)(object)costTypeDef.payCost).Method; break; } } if (_payCostItemsMethod == null) { Log.Error("Failed to find PayCostItems method", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/SeededPrinter.cs", "Init", 37); } } private void OnEnable() { if (RoR2Application.loadFinished) { setHooks(active: true); } else { RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(onLoad)); } } private void OnDisable() { setHooks(active: false); RoR2Application.onLoad = (Action)Delegate.Remove(RoR2Application.onLoad, new Action(onLoad)); } private void onLoad() { if (((Behaviour)this).isActiveAndEnabled) { setHooks(active: true); } RoR2Application.onLoad = (Action)Delegate.Remove(RoR2Application.onLoad, new Action(onLoad)); } private void setHooks(bool active) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown if (_hooksActive == active) { return; } if (active) { if (_payCostItemsMethod != null) { List detours = _detours; MethodInfo payCostItemsMethod = _payCostItemsMethod; object obj = <>O.<0>__PayCostItemsManipulator; if (obj == null) { Manipulator val = PayCostItemsManipulator; <>O.<0>__PayCostItemsManipulator = val; obj = (object)val; } detours.Add((IDetour)new ILHook((MethodBase)payCostItemsMethod, (Manipulator)obj)); } } else { foreach (IDetour detour in _detours) { ((IDisposable)detour)?.Dispose(); } _detours.Clear(); } _hooksActive = active; } private static bool matchTakeItemsFromWeightedSelectionCall(Instruction instruction) { MethodReference val = default(MethodReference); if (ILPatternMatchingExt.MatchCallOrCallvirt(instruction, ref val) && Extensions.Is((MemberReference)(object)((MemberReference)val).DeclaringType, (MemberInfo)typeof(CostTypeCatalog))) { return ((MemberReference)val).Name.StartsWith("g__TakeItemsFromWeightedSelection|"); } return false; } private static void PayCostItemsManipulator(ILContext il) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_0313: Unknown result type (might be due to invalid IL or missing references) //IL_0320: Unknown result type (might be due to invalid IL or missing references) //IL_032e: Unknown result type (might be due to invalid IL or missing references) //IL_034f: Unknown result type (might be due to invalid IL or missing references) //IL_039f: Unknown result type (might be due to invalid IL or missing references) //IL_03cf: Unknown result type (might be due to invalid IL or missing references) //IL_03d4: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); ParameterDefinition val2 = ((IEnumerable)((MethodReference)il.Method).Parameters).FirstOrDefault((Func)((ParameterDefinition p) => Extensions.Is((MemberReference)(object)((ParameterReference)p).ParameterType, (MemberInfo)typeof(PayCostContext)))); if (val2 == null) { Log.Error("Failed to find PayCostContext parameter", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/SeededPrinter.cs", "PayCostItemsManipulator", 111); return; } ParameterDefinition val3 = ((IEnumerable)((MethodReference)il.Method).Parameters).FirstOrDefault((Func)((ParameterDefinition p) => Extensions.Is((MemberReference)(object)((ParameterReference)p).ParameterType, (MemberInfo)typeof(PayCostResults)))); if (val3 == null) { Log.Error("Failed to find PayCostResults parameter", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/SeededPrinter.cs", "PayCostItemsManipulator", 118); return; } VariableDefinition val4 = null; FieldDefinition val5 = null; Enumerator enumerator = il.Body.Variables.GetEnumerator(); try { while (enumerator.MoveNext()) { VariableDefinition current = enumerator.Current; TypeDefinition val6 = Extensions.SafeResolve(((VariableReference)current).VariableType); if (val6 != null && val4 == null) { FieldDefinition val7 = Extensions.FindField(val6, "itemsToTake"); if (val7 != null && Extensions.Is((MemberReference)(object)((FieldReference)val7).FieldType, (MemberInfo)typeof(List))) { val4 = current; val5 = val7; } } } } finally { ((IDisposable)enumerator).Dispose(); } if (val4 == null || val5 == null) { Log.Error("Failed to find itemsToTake container local", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/SeededPrinter.cs", "PayCostItemsManipulator", 144); return; } List list = new List(); Instruction val8 = null; Instruction val9 = null; while (val.TryGotoNext((MoveType)0, new Func[1] { matchTakeItemsFromWeightedSelectionCall })) { int itemSelectionLocalIndex = -1; ILCursor val10 = val.Clone(); if (val10.TryGotoPrev((MoveType)0, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref itemSelectionLocalIndex) && Extensions.Is((MemberReference)(object)((VariableReference)il.Body.Variables[itemSelectionLocalIndex]).VariableType, (MemberInfo)typeof(WeightedSelection)) })) { list.Add(il.Body.Variables[itemSelectionLocalIndex]); if (val8 == null || val10.IsBefore(val8)) { val8 = val10.Next; } } if (val9 == null || val.IsAfter(val9)) { val9 = val.Next; } val.SearchTarget = (SearchTarget)1; } if (list.Count < 3) { Log.Error($"Failed to find all item WeightedSelection variables: {list.Count} found, {3} expected", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/SeededPrinter.cs", "PayCostItemsManipulator", 179); return; } if (list.Count > 3) { Log.Error($"Found too many item WeightedSelection variables: {list.Count} found, {3} expected", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/SeededPrinter.cs", "PayCostItemsManipulator", 185); } if (val8 == null) { Log.Error("Failed to find TakeItems start location", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/SeededPrinter.cs", "PayCostItemsManipulator", 190); return; } if (val9 == null) { Log.Error("Failed to find TakeItems end location", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/SeededPrinter.cs", "PayCostItemsManipulator", 196); return; } val.Goto(val8, (MoveType)1, false); val.Emit(OpCodes.Ldarg, val2); Instruction prev = val.Prev; val.Emit(OpCodes.Ldarg, val3); val.Emit(OpCodes.Ldloc, val4); val.Emit(OpCodes.Ldfld, (FieldReference)(object)val5); for (int i = Mathf.Max(0, list.Count - 3); i < list.Count; i++) { val.Emit(OpCodes.Ldloc, list[i]); } val.EmitDelegate, WeightedSelection, WeightedSelection, WeightedSelection, bool>>((Func, WeightedSelection, WeightedSelection, WeightedSelection, bool>)tryOverrideTakeItems); ILLabel val11 = val.DefineLabel(); val.Emit(OpCodes.Brtrue, (object)val11); val.Goto(val9, (MoveType)2, false); val.MarkLabel(val11); Enumerator enumerator2 = il.Body.ExceptionHandlers.GetEnumerator(); try { while (enumerator2.MoveNext()) { ExceptionHandler current2 = enumerator2.Current; if (current2.HandlerEnd == val8) { current2.HandlerEnd = prev; } } } finally { ((IDisposable)enumerator2).Dispose(); } } private static bool tryOverrideTakeItems(PayCostContext context, PayCostResults results, List itemsToTake, WeightedSelection priorityScrapSelection, WeightedSelection scrapSelection, WeightedSelection itemSelection) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown //IL_0064: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)Run.instance)) { return false; } Xoroshiro128Plus rng2 = new Xoroshiro128Plus(context.rng.nextUlong); Xoroshiro128Plus rng3 = new Xoroshiro128Plus(context.rng.nextUlong); Xoroshiro128Plus rng4 = new Xoroshiro128Plus(context.rng.nextUlong); IEnumerable enumerable = ((IEnumerable)(object)ItemCatalog.allItemDefs).Where((ItemDef item) => item.tier == context.costTypeDef.itemTier); tryTakeItemsFrom(priorityScrapSelection, rng2, enumerable.Where((ItemDef item) => item.ContainsTag((ItemTag)14))); tryTakeItemsFrom(scrapSelection, rng3, enumerable.Where((ItemDef item) => item.ContainsTag((ItemTag)10))); tryTakeItemsFrom(itemSelection, rng4, enumerable); return true; void tryTakeItemsFrom(WeightedSelection items, Xoroshiro128Plus rng, IEnumerable availableItems) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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_0027: 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_0051: Expected O, but got Unknown //IL_00d3: 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_00e5: Unknown result type (might be due to invalid IL or missing references) GenericCountPair[] array = new GenericCountPair[items.Count]; for (int j = 0; j < items.Count; j++) { ChoiceInfo choice = items.GetChoice(j); int count = (int)choice.weight; array[j] = new GenericCountPair(choice.value, count); } Xoroshiro128Plus rng5 = new Xoroshiro128Plus(rng.nextUlong); List list = new List(); list.AddRange(availableItems.Select((ItemDef item) => item.itemIndex)); StackItemPicker stackItemPicker = new StackItemPicker(new <>z__ReadOnlyList(list), array, rng5); ItemIndex result; while (itemsToTake.Count < context.cost && stackItemPicker.TryTakeNext((ItemIndex i) => i != context.avoidedItemIndex, out result)) { int num = items.FindChoiceIndex(result); if (num != -1) { int num2 = (int)items.GetChoice(num).weight; num2--; if (num2 <= 0) { items.RemoveChoice(num); } else { items.ModifyChoiceWeight(num, (float)num2); } } itemsToTake.Add(result); } } } } public sealed class SeededRecycler : MonoBehaviour { private OrderedPickupTransmutationProvider _recycleProvider; private void OnEnable() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown RunHooks.OnRunPostStartGlobal += onRunPostStartGlobal; EquipmentSlot.FireRecycle += new Manipulator(EquipmentSlot_FireRecycle); } private void OnDisable() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown RunHooks.OnRunPostStartGlobal -= onRunPostStartGlobal; EquipmentSlot.FireRecycle -= new Manipulator(EquipmentSlot_FireRecycle); } private void onRunPostStartGlobal(Run run) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown Xoroshiro128Plus val = new Xoroshiro128Plus(run.seed ^ 0xE1881A2D53403uL); _recycleProvider = new OrderedPickupTransmutationProvider(val.nextUlong); } private void EquipmentSlot_FireRecycle(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)0, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "set_pickup") })) { Log.Error("Failed to find recycle result override patch location", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/SeededRecycler.cs", "EquipmentSlot_FireRecycle", 41); return; } VariableDefinition val2 = il.AddVariable(); val.Emit(OpCodes.Stloc, val2); val.Emit(OpCodes.Dup); val.Emit(OpCodes.Ldloc, val2); val.EmitDelegate>((Func)overrideRecyclePickup); if (!val.TryGotoPrev((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "treasureRng") })) { Log.Error("Failed to find recycle rng override patch location", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/SeededRecycler.cs", "EquipmentSlot_FireRecycle", 67); } else { val.EmitDelegate>((Func)overrideRng); } UniquePickup overrideRecyclePickup(GenericPickupController pickupController, UniquePickup newPickup) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_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) if (Object.op_Implicit((Object)(object)pickupController)) { UniquePickup pickup = pickupController.pickup; newPickup = ((UniquePickup)(ref pickup)).WithPickupIndex(_recycleProvider.GetNextTransmutation(pickupController.pickup.pickupIndex)); } return newPickup; } static Xoroshiro128Plus overrideRng(Xoroshiro128Plus original) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown return new Xoroshiro128Plus(original); } } } public sealed class SeededSonorousWhispers : MonoBehaviour { private sealed class DropList { public readonly PickupDropTable DropTable; public readonly Xoroshiro128Plus DropChanceRng; public readonly Xoroshiro128Plus ItemDropRng; private int _numDropsAttempted; private int _numDropsDone; public DropList(PickupDropTable dropTable, Xoroshiro128Plus rng) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown DropTable = dropTable; DropChanceRng = new Xoroshiro128Plus(rng.nextUlong); ItemDropRng = new Xoroshiro128Plus(rng.nextUlong); } public UniquePickup GetNextDrop(float dropChance, string debugIdentifier = null, CharacterMaster master = null) { //IL_0022: 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_0027: 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) UniquePickup result = (DLC2.CheckRoll(dropChance, master, DropChanceRng) ? DropTable.GeneratePickup(ItemDropRng) : UniquePickup.none); _numDropsAttempted++; if (((UniquePickup)(ref result)).isValid) { _numDropsDone++; } return result; } } [CompilerGenerated] private static class <>O { public static Manipulator <0>__GlobalEventManager_OnCharacterDeath; public static Action <1>__Run_onRunStartGlobal; public static Action <2>__seededItemDrop; } private static DropList _dropList; public void OnEnable() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown object obj = <>O.<0>__GlobalEventManager_OnCharacterDeath; if (obj == null) { Manipulator val = GlobalEventManager_OnCharacterDeath; <>O.<0>__GlobalEventManager_OnCharacterDeath = val; obj = (object)val; } GlobalEventManager.OnCharacterDeath += (Manipulator)obj; Run.onRunStartGlobal += Run_onRunStartGlobal; } public void OnDisable() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown object obj = <>O.<0>__GlobalEventManager_OnCharacterDeath; if (obj == null) { Manipulator val = GlobalEventManager_OnCharacterDeath; <>O.<0>__GlobalEventManager_OnCharacterDeath = val; obj = (object)val; } GlobalEventManager.OnCharacterDeath -= (Manipulator)obj; Run.onRunStartGlobal -= Run_onRunStartGlobal; } private static void Run_onRunStartGlobal(Run run) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown Xoroshiro128Plus val = new Xoroshiro128Plus(run.treasureRng); _dropList = new DropList(CommonAssets.dtSonorousEchoPath, new Xoroshiro128Plus(val.nextUlong)); } private static void GlobalEventManager_OnCharacterDeath(ILContext il) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); ILLabel afterSonorousBlockLabel = null; ILCursor[] array = default(ILCursor[]); if (val.TryFindNext(ref array, new Func[3] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "ItemDropChanceOnKill"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)SymbolExtensions.GetMethodInfo((Expression>)((Inventory _) => _.GetItemCountEffective((ItemDef)null)))), (Instruction x) => ILPatternMatchingExt.MatchBle(x, ref afterSonorousBlockLabel) })) { ILCursor obj = array[2]; int index = obj.Index; obj.Index = index + 1; obj.Emit(OpCodes.Ldarg_1); obj.EmitDelegate>((Action)seededItemDrop); obj.Emit(OpCodes.Br, (object)afterSonorousBlockLabel); } else { Log.Error("Failed to find item drop patch location", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/SeededSonorousWhispers.cs", "GlobalEventManager_OnCharacterDeath", 93); } static void seededItemDrop(DamageReport damageReport) { //IL_005b: 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_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: 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_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_00ee: 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_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) CharacterBody victimBody = damageReport.victimBody; CharacterBody attackerBody = damageReport.attackerBody; if (Object.op_Implicit((Object)(object)victimBody) && Object.op_Implicit((Object)(object)attackerBody)) { Inventory inventory = attackerBody.inventory; if (Object.op_Implicit((Object)(object)inventory)) { int itemCountEffective = inventory.GetItemCountEffective(Items.ItemDropChanceOnKill); List list = new List(2); if (victimBody.isChampion) { UniquePickup nextDrop = _dropList.GetNextDrop(100f, "Champion"); if (nextDrop != UniquePickup.none) { list.Add(nextDrop); } } if (victimBody.isElite) { UniquePickup nextDrop2 = _dropList.GetNextDrop(4f + 1f * (float)itemCountEffective, "Elite", attackerBody.master); if (nextDrop2 != UniquePickup.none) { list.Add(nextDrop2); } } foreach (UniquePickup item in list) { PickupDropletController.CreatePickupDroplet(item, victimBody.transform.position + Vector3.up * 1.5f, Vector3.up * 20f + Random.onUnitSphere * 2f, false); } } } } } } public sealed class StackItemPicker { private readonly IReadOnlyCollection _allAvailableValues; private readonly GenericCountPair[] _availableStacks; private readonly Xoroshiro128Plus _rng; private readonly IEqualityComparer _comparer; public StackItemPicker(IReadOnlyCollection allAvailableValues, IEnumerable> stacks, Xoroshiro128Plus rng, IEqualityComparer comparer = null) { if (allAvailableValues == null) { throw new ArgumentNullException("allAvailableValues"); } if (stacks == null) { throw new ArgumentNullException("stacks"); } if (rng == null) { throw new ArgumentNullException("rng"); } _allAvailableValues = allAvailableValues; _availableStacks = stacks.ToArray(); _rng = rng; _comparer = comparer ?? EqualityComparer.Default; } private int findStackIndex(T value) { for (int i = 0; i < _availableStacks.Length; i++) { GenericCountPair genericCountPair = _availableStacks[i]; if (_comparer.Equals(genericCountPair.Value, value)) { return i; } } return -1; } public bool TryTakeNext(out T result) { return TryTakeNext(null, out result); } public bool TryTakeNext(Predicate selector, out T result) { int num = 0; GenericCountPair[] availableStacks = _availableStacks; for (int i = 0; i < availableStacks.Length; i++) { GenericCountPair genericCountPair = availableStacks[i]; num = Mathf.Max(num, genericCountPair.Count); } List> list = new List>(_allAvailableValues.Count * num); for (int j = 0; j < num; j++) { foreach (T allAvailableValue in _allAvailableValues) { list.Insert(item: new GenericCountPair(allAvailableValue, j + 1), index: _rng.RangeInt(0, list.Count + 1)); } } foreach (GenericCountPair item2 in list) { int num2 = findStackIndex(item2.Value); if (num2 >= 0) { ref GenericCountPair reference = ref _availableStacks[num2]; if (reference.Count > 0 && reference.Count >= item2.Count && (selector == null || selector(item2.Value))) { reference.Count--; result = item2.Value; return true; } } } result = default(T); return false; } } public sealed class StagePreviewUI : MonoBehaviour { private readonly List stagePreviewImages = new List(); private void OnEnable() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown HUD.Awake += new hook_Awake(OnHUDOnAwake); } private void OnDisable() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown HUD.Awake -= new hook_Awake(OnHUDOnAwake); } private void OnHUDOnAwake(orig_Awake orig, HUD self) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Expected O, but got Unknown //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) stagePreviewImages.Clear(); orig.Invoke(self); SetStagePreviews(); GameObject val = self.mainContainer.FindObject("MainUIArea").FindObject("ScoreboardPanel"); if (!((Object)(object)val != (Object)null)) { return; } GameObject val2 = new GameObject("StagePreviewPanel"); ((Transform)val2.AddComponent()).SetParent(val.transform, false); int num = -600; int num2 = -300; int num3 = 0; int num4 = 300; int num5 = 600; for (int i = 0; i < stagePreviewImages.Count; i++) { GameObject val3 = new GameObject($"Stage{i + 1}Preview"); RectTransform val4 = val3.AddComponent(); ((Transform)val4).SetParent(val2.transform, false); val4.sizeDelta = new Vector2(240f, 144f); switch (i) { case 0: val4.anchoredPosition = new Vector2((float)num, 80f); break; case 1: val4.anchoredPosition = new Vector2((float)num2, 80f); break; case 2: val4.anchoredPosition = new Vector2((float)num3, 80f); break; case 3: val4.anchoredPosition = new Vector2((float)num4, 80f); break; case 4: val4.anchoredPosition = new Vector2((float)num5, 80f); break; } val3.AddComponent().sprite = stagePreviewImages[i]; } } public void SetStagePreviews() { Loadout loadout = LoadoutHandler.Instance.GetLoadout(Main.CurrentLoadout.Value); if (loadout != null) { for (int i = 0; i < loadout.Stages.Count; i++) { Sprite item = TextureToSprite(SceneCatalog.GetSceneDefFromSceneName(loadout.Stages[i]).previewTexture); stagePreviewImages.Add(item); } } } private static Sprite TextureToSprite(Texture texture) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0020: 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) Texture2D val = (Texture2D)texture; return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f)); } } public sealed class StageRNG : MonoBehaviour { [CompilerGenerated] private static class <>O { public static hook_PickNextStageScene <0>__PickStage; public static hook_CheckForLunarReplacement_UniquePickup_Xoroshiro128Plus <1>__SeedEulogyIndex; public static hook_CheckForLunarReplacementUniqueArray <2>__SeedEulogyArray; public static hook_GetRandomEquipment <3>__RandomizeEquipment; public static hook_OnServerEquipmentActivated <4>__ActivateEquipment; } public readonly string[] NamedRngs = new string[3] { "lockbox", "voidbox", "stage" }; private Xoroshiro128Plus lockboxRng = new Xoroshiro128Plus(0uL); private Xoroshiro128Plus voidboxRng = new Xoroshiro128Plus(0uL); private Xoroshiro128Plus stageRng = new Xoroshiro128Plus(0uL); private Xoroshiro128Plus requestRng = new Xoroshiro128Plus(0uL); private void Awake() { ProperSaveIfNeeded(); } private void OnEnable() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Expected O, but got Unknown //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Expected O, but got Unknown //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Expected O, but got Unknown //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Expected O, but got Unknown //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Expected O, but got Unknown //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_0103: Expected O, but got Unknown //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Expected O, but got Unknown //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Expected O, but got Unknown //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Expected O, but got Unknown object obj = <>O.<0>__PickStage; if (obj == null) { hook_PickNextStageScene val = PickStage; <>O.<0>__PickStage = val; obj = (object)val; } Run.PickNextStageScene += (hook_PickNextStageScene)obj; Run.Start += new hook_Start(StartRun); ChestBehavior.Start += new Manipulator(SeedLockBox); OptionChestBehavior.Start += new Manipulator(SeedVoidBox); PurchaseInteraction.Awake += new Manipulator(SeedBoxes); MultiShopController.Awake += new Manipulator(SeedShippingRequest); ShopTerminalBehavior.Start += new Manipulator(SeedShippingRequest); PurchaseInteraction.Awake += new Manipulator(SeedShippingRequest); PurchaseInteraction.Awake += new Manipulator(SeedVendingMachine); object obj2 = <>O.<1>__SeedEulogyIndex; if (obj2 == null) { hook_CheckForLunarReplacement_UniquePickup_Xoroshiro128Plus val2 = SeedEulogyIndex; <>O.<1>__SeedEulogyIndex = val2; obj2 = (object)val2; } RandomlyLunarUtils.CheckForLunarReplacement_UniquePickup_Xoroshiro128Plus += (hook_CheckForLunarReplacement_UniquePickup_Xoroshiro128Plus)obj2; object obj3 = <>O.<2>__SeedEulogyArray; if (obj3 == null) { hook_CheckForLunarReplacementUniqueArray val3 = SeedEulogyArray; <>O.<2>__SeedEulogyArray = val3; obj3 = (object)val3; } RandomlyLunarUtils.CheckForLunarReplacementUniqueArray += (hook_CheckForLunarReplacementUniqueArray)obj3; object obj4 = <>O.<3>__RandomizeEquipment; if (obj4 == null) { hook_GetRandomEquipment val4 = RandomizeEquipment; <>O.<3>__RandomizeEquipment = val4; obj4 = (object)val4; } EnigmaArtifactManager.GetRandomEquipment += (hook_GetRandomEquipment)obj4; object obj5 = <>O.<4>__ActivateEquipment; if (obj5 == null) { hook_OnServerEquipmentActivated val5 = ActivateEquipment; <>O.<4>__ActivateEquipment = val5; obj5 = (object)val5; } EnigmaArtifactManager.OnServerEquipmentActivated += (hook_OnServerEquipmentActivated)obj5; Run.AdvanceStage += new Manipulator(AdvanceStage); Run.GenerateStageRNG += new hook_GenerateStageRNG(GenerateStage); } private void OnDisable() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Expected O, but got Unknown //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Expected O, but got Unknown //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Expected O, but got Unknown //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Expected O, but got Unknown //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Expected O, but got Unknown //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_0103: Expected O, but got Unknown //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Expected O, but got Unknown //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Expected O, but got Unknown //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Expected O, but got Unknown object obj = <>O.<0>__PickStage; if (obj == null) { hook_PickNextStageScene val = PickStage; <>O.<0>__PickStage = val; obj = (object)val; } Run.PickNextStageScene -= (hook_PickNextStageScene)obj; Run.Start -= new hook_Start(StartRun); ChestBehavior.Start -= new Manipulator(SeedLockBox); OptionChestBehavior.Start -= new Manipulator(SeedVoidBox); PurchaseInteraction.Awake -= new Manipulator(SeedBoxes); MultiShopController.Awake -= new Manipulator(SeedShippingRequest); ShopTerminalBehavior.Start -= new Manipulator(SeedShippingRequest); PurchaseInteraction.Awake -= new Manipulator(SeedShippingRequest); PurchaseInteraction.Awake -= new Manipulator(SeedVendingMachine); object obj2 = <>O.<1>__SeedEulogyIndex; if (obj2 == null) { hook_CheckForLunarReplacement_UniquePickup_Xoroshiro128Plus val2 = SeedEulogyIndex; <>O.<1>__SeedEulogyIndex = val2; obj2 = (object)val2; } RandomlyLunarUtils.CheckForLunarReplacement_UniquePickup_Xoroshiro128Plus -= (hook_CheckForLunarReplacement_UniquePickup_Xoroshiro128Plus)obj2; object obj3 = <>O.<2>__SeedEulogyArray; if (obj3 == null) { hook_CheckForLunarReplacementUniqueArray val3 = SeedEulogyArray; <>O.<2>__SeedEulogyArray = val3; obj3 = (object)val3; } RandomlyLunarUtils.CheckForLunarReplacementUniqueArray -= (hook_CheckForLunarReplacementUniqueArray)obj3; object obj4 = <>O.<3>__RandomizeEquipment; if (obj4 == null) { hook_GetRandomEquipment val4 = RandomizeEquipment; <>O.<3>__RandomizeEquipment = val4; obj4 = (object)val4; } EnigmaArtifactManager.GetRandomEquipment -= (hook_GetRandomEquipment)obj4; object obj5 = <>O.<4>__ActivateEquipment; if (obj5 == null) { hook_OnServerEquipmentActivated val5 = ActivateEquipment; <>O.<4>__ActivateEquipment = val5; obj5 = (object)val5; } EnigmaArtifactManager.OnServerEquipmentActivated -= (hook_OnServerEquipmentActivated)obj5; Run.AdvanceStage -= new Manipulator(AdvanceStage); Run.GenerateStageRNG -= new hook_GenerateStageRNG(GenerateStage); } private void AdvanceStage(ILContext context) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_003f: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(context); val.GotoNext((MoveType)0, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(Run), "GenerateStageRNG") }); val.Remove(); val.Emit(OpCodes.Ldarg_1); val.EmitDelegate>((Action)delegate(Run instance, SceneDef scene) { if (scene.stageOrder > 0 && scene.stageOrder <= 6) { instance.GenerateStageRNG(); } else { GenerateHiddenRealm(instance, scene.baseSceneName); } }); } private void GenerateHiddenRealm(Run instance, string stage) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown Xoroshiro128Plus stageRngGenerator = instance.stageRngGenerator; ulong num = instance.seed ^ Hash128.Compute(stage).u64_0; instance.stageRngGenerator = new Xoroshiro128Plus(num); ulong num2 = 0uL; foreach (PlayerStatsComponent instances in PlayerStatsComponent.instancesList) { for (ulong statValueULong = instances.currentStats.GetStatValueULong(PerStageStatDef.totalTimesVisited.FindStatDef(stage)); statValueULong > num2; num2++) { instance.stageRngGenerator.Next(); } } instance.GenerateStageRNG(); instance.stageRngGenerator = stageRngGenerator; } private void SetSeed(ILContext context, string identifier, Func hook) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown //IL_00a3: Unknown result type (might be due to invalid IL or missing references) MethodInfo generate = typeof(Xoroshiro128Plus).GetProperty("nextUlong").GetMethod; ILCursor val = new ILCursor(context); string text = "`" + ((MemberReference)context.Method).Name.Split('.').Last() + "`"; if (val.TryGotoNext((MoveType)0, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)generate), (Instruction x) => ILPatternMatchingExt.MatchNewobj(x) })) { val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)((Xoroshiro128Plus orig, Component obj) => ((Object)obj).name.StartsWith(identifier) ? hook() : orig)); } else { Log.Error("Unable to apply IL hook to " + text + ".", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/StageRNG.cs", "SetSeed", 151); } } private void SeedLockBox(ILContext context) { SetSeed(context, "Lockbox", () => lockboxRng); } private void SeedVoidBox(ILContext context) { SetSeed(context, "LockboxVoid", () => voidboxRng); } private void SeedBoxes(ILContext context) { SeedLockBox(context); SeedVoidBox(context); } private void SeedShippingRequest(ILContext context) { SetSeed(context, "FreeChest", () => requestRng); } private void SeedVendingMachine(ILContext context) { SetSeed(context, "VendingMachine", () => new Xoroshiro128Plus(0uL)); } private static UniquePickup SeedEulogyIndex(orig_CheckForLunarReplacement_UniquePickup_Xoroshiro128Plus orig, UniquePickup pickup, Xoroshiro128Plus rng) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_0008: Unknown result type (might be due to invalid IL or missing references) return orig.Invoke(pickup, new Xoroshiro128Plus(rng)); } private static void SeedEulogyArray(orig_CheckForLunarReplacementUniqueArray orig, PickupIndex[] array, Xoroshiro128Plus rng) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown orig.Invoke(array, new Xoroshiro128Plus(rng)); } private static EquipmentIndex RandomizeEquipment(orig_GetRandomEquipment orig, Xoroshiro128Plus rng, int offset) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) return orig.Invoke(rng, 0); } private static void ActivateEquipment(orig_OnServerEquipmentActivated _, EquipmentSlot slot, EquipmentIndex index) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) Xoroshiro128Plus val = EnigmaArtifactManager.serverActivationEquipmentRng; if (slot.characterBody.isPlayerControlled) { val = EnigmaArtifactManager.serverInitialEquipmentRng; } index = EnigmaArtifactManager.GetRandomEquipment(val, 0); slot.characterBody.inventory.SetEquipmentIndex(index, false); } private void StartRun(orig_Start orig, Run self) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Expected O, but got Unknown if (ProperSaveDependencyWrapper.loadingSave) { ProperSaveDependencyWrapper.loadingSave = false; orig.Invoke(self); self.stageRngGenerator = stageRng; } else { self.seed = LoadoutHandler.Instance.GetLoadout(Main.CurrentLoadout.Value).Seed; orig.Invoke(self); stageRng = self.stageRngGenerator; voidboxRng = new Xoroshiro128Plus(self.runRNG.nextUlong); lockboxRng = new Xoroshiro128Plus(self.runRNG.nextUlong); } } private void GenerateStage(orig_GenerateStageRNG orig, Run self) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown orig.Invoke(self); requestRng = new Xoroshiro128Plus(self.spawnRng.nextUlong); } private static void PickStage(orig_PickNextStageScene orig, Run self, WeightedSelection selection) { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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_0087: Unknown result type (might be due to invalid IL or missing references) Loadout loadout = LoadoutHandler.Instance.GetLoadout(Main.CurrentLoadout.Value); Log.Info($"Selecting the next stage for loadout:\n{loadout}", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/StageRNG.cs", "PickStage", 237); IEnumerable stages = loadout.Stages; WeightedSelection val = new WeightedSelection(selection.Count); ChoiceInfo[] choices = selection.choices; for (int i = 0; i < choices.Length; i++) { ChoiceInfo val2 = choices[i]; if (val2.weight > 0f) { SceneDef value = val2.value; if (stages.Contains((value != null) ? value.baseSceneName : null)) { val.AddChoice(val2); } } } if (val.Count > 0) { selection = val; } else { Log.Warning("No valid stage found.", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/StageRNG.cs", "PickStage", 251); } orig.Invoke(self, selection); } private void ProperSaveIfNeeded() { UpdateProperSave(); if (ProperSaveDependencyWrapper.enabled) { ProperSaveDependencyWrapper.SaveProperRng(); } } private void UpdateProperSave() { if (ProperSaveDependencyWrapper.enabled) { ProperSaveDependencyWrapper.LoadProperRng(this); } } public Dictionary ExportRNGs() { Dictionary dictionary = new Dictionary(); string[] namedRngs = NamedRngs; foreach (string text in namedRngs) { dictionary.Add(text, GetRng(text)); } return dictionary; } public void ImportRNGs(Dictionary rngs) { foreach (string key in rngs.Keys) { GetRng(key).state0 = rngs[key].state0; GetRng(key).state1 = rngs[key].state1; } } public Xoroshiro128Plus GetRng(string rngName) { return (Xoroshiro128Plus)(rngName switch { "lockbox" => lockboxRng, "voidbox" => voidboxRng, "stage" => stageRng, _ => null, }); } } public sealed class Stopwatch : MonoBehaviour { [CompilerGenerated] private static class <>O { public static hook_SetRunStopwatchPaused <0>__OnRunOnSetRunStopwatchPaused; } private void OnEnable() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown object obj = <>O.<0>__OnRunOnSetRunStopwatchPaused; if (obj == null) { hook_SetRunStopwatchPaused val = OnRunOnSetRunStopwatchPaused; <>O.<0>__OnRunOnSetRunStopwatchPaused = val; obj = (object)val; } Run.SetRunStopwatchPaused += (hook_SetRunStopwatchPaused)obj; } private void OnDisable() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown object obj = <>O.<0>__OnRunOnSetRunStopwatchPaused; if (obj == null) { hook_SetRunStopwatchPaused val = OnRunOnSetRunStopwatchPaused; <>O.<0>__OnRunOnSetRunStopwatchPaused = val; obj = (object)val; } Run.SetRunStopwatchPaused -= (hook_SetRunStopwatchPaused)obj; } private static void OnRunOnSetRunStopwatchPaused(orig_SetRunStopwatchPaused orig, Run self, bool isPaused) { orig.Invoke(self, false); } } public sealed class SubmitRun : MonoBehaviour { public RunSubmission RunSubmission { get; private set; } private void OnEnable() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown RunReport.Generate += new hook_Generate(OnRunReportOnGenerate); } private void OnDisable() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown RunReport.Generate -= new hook_Generate(OnRunReportOnGenerate); } private RunReport OnRunReportOnGenerate(orig_Generate orig, Run run, GameEndingDef gameEnding) { //IL_00e5: 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) RunReport val; if (!Main.ConcedeCheck) { if (!gameEnding.isWin) { LazarusResurrection.deathCount++; } Log.Info("Victory generating", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/SubmitRun.cs", "OnRunReportOnGenerate", 34); gameEnding.showCredits = false; val = orig.Invoke(run, gameEnding); } else { Log.Info("Concession generating", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/SubmitRun.cs", "OnRunReportOnGenerate", 41); gameEnding.isWin = false; gameEnding.showCredits = false; gameEnding.lunarCoinReward = 0u; gameEnding.showCredits = false; val = orig.Invoke(run, gameEnding); } RunReport obj = val; obj.runStopwatchValue += LazarusResurrection.GetTotalPenalty(); RunSubmission = new RunSubmission { LazarusCount = LazarusResurrection.deathCount, LoadoutId = Main.CurrentLoadout.Value }; PlayerInfo[] playerInfos = val.playerInfos; for (int i = 0; i < playerInfos.Length; i++) { playerInfos[i].statSheet.fields[StatDef.totalTimeAlive.index].value = ValueUnion.op_Implicit((double)val.runStopwatchValue); } float num = val.runStopwatchValue * 1000f; RunSubmission.RunTime = (long)num; RunSubmission.UserId = Main.UserId.Value; RunSubmission.DidConcede = Main.ConcedeCheck; RaceV2Api.Instance.SubmitRun(RunSubmission); Log.Info("Advancing to next loadout...", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/SubmitRun.cs", "OnRunReportOnGenerate", 76); ConfigEntry currentLoadout = Main.CurrentLoadout; currentLoadout.Value += 1; return val; } } } namespace RoRGauntlet.Web { public sealed class WebService { private delegate void HttpHandler(HttpListenerRequest request, HttpListenerResponse response); public static readonly WebService Instance = new WebService(); private HttpListener _listener; private string _username; public int NegotiatedPort { get; private set; } public event EventHandler JoinRace; public event EventHandler SignedIn; private WebService() { } public async void Startup() { _listener = new HttpListener(); bool flag = false; for (int i = 49152; i < 65536 && !flag; i++) { try { _listener.Prefixes.Add($"http://*:{i}/"); _listener.Start(); flag = true; Log.Info($"Listening for user on port {i}", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/Web/WebService.cs", "Startup", 41); NegotiatedPort = i; } catch (Exception data) { _listener.Prefixes.Clear(); Log.Error_NoCallerPrefix(data); continue; } break; } if (!flag) { Log.Error("Failed to bind any port for server", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/Web/WebService.cs", "Startup", 54); return; } try { do { HttpListenerContext obj = await _listener.GetContextAsync(); HttpListenerRequest request = obj.Request; HttpListenerResponse response = obj.Response; addCorsHeaders(request, response); Handle(request, response); } while (_listener.IsListening); } catch (ObjectDisposedException) { } } public void Shutdown() { _listener.Close(); } private void Handle(HttpListenerRequest request, HttpListenerResponse response) { if (request.HttpMethod == HttpMethod.Options.Method) { response.OutputStream.Close(); return; } string resource = request.Url.Segments[request.Url.Segments.Length - 1]; HttpHandler handlerForResource = GetHandlerForResource(resource); try { handlerForResource(request, response); } catch (Exception arg) { Log.Error_NoCallerPrefix($"Failed to handle request {arg}"); } } private HttpHandler GetHandlerForResource(string resource) { return resource switch { "authorize" => HandleAuthorize, "joinRace" => HandleJoinRace, "ping" => delegate(HttpListenerRequest _, HttpListenerResponse response) { byte[] bytes = Encoding.UTF8.GetBytes("pong"); response.OutputStream.Write(bytes, 0, bytes.Length); response.OutputStream.Close(); }, _ => delegate(HttpListenerRequest _, HttpListenerResponse response) { response.StatusCode = 404; response.OutputStream.Close(); }, }; } private void HandleAuthorize(HttpListenerRequest request, HttpListenerResponse response) { using StreamReader streamReader = new StreamReader(request.InputStream, request.ContentEncoding); UserInfo userInfo = JsonConvert.DeserializeObject(streamReader.ReadToEnd()); this.SignedIn?.Invoke(this, userInfo); _username = userInfo.User.Username; response.OutputStream.Close(); } private void HandleJoinRace(HttpListenerRequest request, HttpListenerResponse response) { string text = request.Headers["Authorization"]; if (string.IsNullOrEmpty(_username) || string.IsNullOrEmpty(text)) { response.StatusCode = 401; byte[] bytes = Encoding.UTF8.GetBytes("No authorization, call /authorize first"); response.OutputStream.Write(bytes, 0, bytes.Length); response.OutputStream.Close(); return; } if (_username != text) { response.StatusCode = 403; byte[] bytes2 = Encoding.UTF8.GetBytes("Authorization changed, need to re-authorize mod"); response.OutputStream.Write(bytes2, 0, bytes2.Length); response.OutputStream.Close(); return; } using StreamReader streamReader = new StreamReader(request.InputStream, request.ContentEncoding); var anon = JsonConvert.DeserializeAnonymousType(streamReader.ReadToEnd(), new { lobbyCode = "" }); if (!string.IsNullOrEmpty(anon.lobbyCode)) { this.JoinRace?.Invoke(this, anon.lobbyCode); } else { response.StatusCode = 400; } response.OutputStream.Close(); } private void addCorsHeaders(HttpListenerRequest request, HttpListenerResponse response) { string text = request.Headers.Get("origin"); if (text != null && (text.EndsWith("riskofresources.com") || text.EndsWith("localhost"))) { response.AddHeader("Access-Control-Allow-Headers", "Authorization,Content-Type"); response.AddHeader("Access-Control-Allow-Methods", "POST,OPTIONS"); response.AddHeader("Access-Control-Allow-Origin", text); } } } public sealed class WebServiceComponent : MonoBehaviour { [CompilerGenerated] private static class <>O { public static EventHandler <0>__OnSignedIn; public static EventHandler <1>__OnJoinRace; public static hook_OnEnter <2>__onEnter; } private void OnEnable() { WebService.Instance.Startup(); WebService.Instance.SignedIn += OnSignedIn; WebService.Instance.JoinRace += OnJoinRace; } private void OnDisable() { WebService.Instance.Shutdown(); WebService.Instance.SignedIn -= OnSignedIn; WebService.Instance.JoinRace -= OnJoinRace; } private static void OnJoinRace(object sender, string lobbyCode) { string userId = Main.UserId.Value; ((MonoBehaviour)Main.instance).StartCoroutine(RaceV2Api.Instance.JoinLobby(lobbyCode, null, delegate(Race race) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown //IL_006f: 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_007a: Expected O, but got Unknown Main.CurrentLoadout.Value = race.GetCurrentLoadoutIndex(userId); LoadoutHandler.Instance.RegisterRace(race); if (Object.op_Implicit((Object)(object)MainMenuController.instance)) { Console.instance.SubmitCmd((NetworkUser)null, "transition_command \"gamemode ClassicRun; host 0; \"", true); } else { object obj2 = <>O.<2>__onEnter; if (obj2 == null) { hook_OnEnter val2 = onEnter; <>O.<2>__onEnter = val2; obj2 = (object)val2; } BaseMainMenuScreen.OnEnter -= (hook_OnEnter)obj2; object obj3 = <>O.<2>__onEnter; if (obj3 == null) { hook_OnEnter val3 = onEnter; <>O.<2>__onEnter = val3; obj3 = (object)val3; } BaseMainMenuScreen.OnEnter += (hook_OnEnter)obj3; Console.instance.SubmitCmd((NetworkUser)null, "transition_command \"disconnect; \"", true); } })); static void onEnter(orig_OnEnter orig, BaseMainMenuScreen self, MainMenuController controller) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown orig.Invoke(self, controller); Console.instance.SubmitCmd((NetworkUser)null, "transition_command \"gamemode ClassicRun; host 0; \"", true); object obj = <>O.<2>__onEnter; if (obj == null) { hook_OnEnter val = onEnter; <>O.<2>__onEnter = val; obj = (object)val; } BaseMainMenuScreen.OnEnter -= (hook_OnEnter)obj; } } private static void OnSignedIn(object sender, UserInfo e) { Log.Info("Received user Id from web: " + e.User.Id, "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/Web/WebServiceComponent.cs", "OnSignedIn", 60); string authorization = Convert.ToBase64String(Encoding.UTF8.GetBytes(e.Auth.ToJson())).Replace("=", ""); Main.instance.authorization = authorization; Main.UserId.Value = e.User.Id; } } } namespace RoRGauntlet.Utilities { public sealed class SequenceComparer : IEqualityComparer> { private readonly IEqualityComparer _elementComparer; public static SequenceComparer Default { get; } = new SequenceComparer(); public SequenceComparer() : this((IEqualityComparer)EqualityComparer.Default) { } public SequenceComparer(IEqualityComparer elementComparer) { if (elementComparer == null) { throw new ArgumentNullException("elementComparer"); } _elementComparer = elementComparer; } public bool Equals(IEnumerable x, IEnumerable y) { return x.SequenceEqual(y, _elementComparer); } public int GetHashCode(IEnumerable obj) { HashCode hashCode = default(HashCode); foreach (T item in obj) { hashCode.Add(item, _elementComparer); } return hashCode.ToHashCode(); } } } namespace RoRGauntlet.Utilities.Extensions { public static class CollectionExtensions { public static void EnsureCapacity(this List list, int capacity) { if (list == null) { throw new ArgumentNullException("list"); } if (list.Capacity < capacity) { list.Capacity = capacity; } } public static T GetAndRemoveAt(this IList list, int index) { if (list == null) { throw new ArgumentNullException("list"); } T result = list[index]; list.RemoveAt(index); return result; } public static TValue GetOrAddNew(this IDictionary dictionary, TKey key) where TValue : new() { if (!dictionary.TryGetValue(key, out var value)) { value = new TValue(); dictionary.Add(key, value); } return value; } } public static class PatchExtensions { public static void EmitSkipMethodCall(this ILCursor c) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) c.EmitSkipMethodCall(OpCodes.Br); } public static void EmitSkipMethodCall(this ILCursor c, OpCode branchOpCode) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) c.EmitSkipMethodCall(branchOpCode, null); } public static void EmitSkipMethodCall(this ILCursor c, OpCode branchOpCode, Action emitSkippedReturnValue) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Invalid comparison between Unknown and I4 //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Invalid comparison between Unknown and I4 //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) if (c == null) { throw new ArgumentNullException("c"); } if ((int)((OpCode)(ref branchOpCode)).FlowControl != 0 && (int)((OpCode)(ref branchOpCode)).FlowControl != 3) { throw new ArgumentException($"Invalid branch OpCode: {branchOpCode}"); } MethodReference val = default(MethodReference); if (c.Next == null || !ILPatternMatchingExt.MatchCallOrCallvirt(c.Next, ref val)) { Log.Error($"Failed to find method call to skip: {((MemberReference)c.Context.Method).FullName} at instruction {c.Next.SafeToString()} ({c.Index})", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/Utilities/Extensions/PatchExtensions.cs", "EmitSkipMethodCall", 61); return; } MethodDefinition val2 = Extensions.SafeResolve(val); if (val2 == null) { Log.Error($"Failed to resolve method '{((MemberReference)val).FullName}': {((MemberReference)c.Context.Method).FullName} at instruction {c.Next.SafeToString()} ({c.Index})", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/Utilities/Extensions/PatchExtensions.cs", "EmitSkipMethodCall", 69); return; } int num = ((MethodReference)val2).Parameters.Count + ((!val2.IsStatic) ? 1 : 0); bool flag = Extensions.Is((MemberReference)(object)((MethodReference)val2).ReturnType, (MemberInfo)typeof(void)); ILLabel val3 = c.DefineLabel(); if ((int)((OpCode)(ref branchOpCode)).FlowControl == 0) { c.Emit(OpCodes.Ldc_I4_0); c.Emit(((int)((OpCode)(ref branchOpCode)).OperandType == 15) ? OpCodes.Brfalse_S : OpCodes.Brfalse, (object)val3); } else { c.Emit(branchOpCode, (object)val3); } int index = c.Index; c.Index = index + 1; if (num == 0 && flag) { c.MarkLabel(val3); return; } ILLabel val4 = c.DefineLabel(); c.Emit(OpCodes.Br, (object)val4); c.MarkLabel(val3); for (int i = 0; i < num; i++) { c.Emit(OpCodes.Pop); } if (emitSkippedReturnValue != null) { emitSkippedReturnValue(c); } else if (!flag) { Log.Warning($"Skipped method ({((MemberReference)val2).FullName}) is not void, emitting default value: {((MemberReference)c.Context.Method).FullName} at instruction {c.Next.SafeToString()} ({c.Index})", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/Utilities/Extensions/PatchExtensions.cs", "EmitSkipMethodCall", 115); c.EmitDefaultValue(((MethodReference)val2).ReturnType); } c.MarkLabel(val4); } public static void EmitDefaultValue(this ILCursor cursor, TypeReference type) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) if (type == null || Extensions.Is((MemberReference)(object)type, (MemberInfo)typeof(void))) { return; } if (!type.IsValueType) { cursor.Emit(OpCodes.Ldnull); return; } switch (type.GetTypeCode()) { case TypeCode.Boolean: case TypeCode.Char: case TypeCode.SByte: case TypeCode.Byte: case TypeCode.Int16: case TypeCode.UInt16: case TypeCode.Int32: case TypeCode.UInt32: cursor.Emit(OpCodes.Ldc_I4_0); break; case TypeCode.Int64: case TypeCode.UInt64: cursor.Emit(OpCodes.Ldc_I4_0); cursor.Emit(OpCodes.Conv_I8); break; case TypeCode.Single: cursor.Emit(OpCodes.Ldc_R4, 0f); break; case TypeCode.Double: cursor.Emit(OpCodes.Ldc_R8, 0.0); break; case TypeCode.Decimal: cursor.Emit(OpCodes.Ldsfld, typeof(decimal).GetField("Zero")); break; default: { VariableDefinition val = cursor.Context.AddVariable(type); cursor.Emit(OpCodes.Ldloca, val); cursor.Emit(OpCodes.Initobj, type); cursor.Emit(OpCodes.Ldloc, val); break; } } } public static TypeCode GetTypeCode(this TypeReference type) { if (type == null) { return TypeCode.Empty; } TypeReference val = null; TypeDefinition val2 = Extensions.SafeResolve(type); if (val2 != null && val2.IsEnum) { try { val = TypeDefinitionRocks.GetEnumUnderlyingType(val2); } catch { } } return ((MemberReference)(val ?? type)).FullName switch { "System.DBNull" => TypeCode.DBNull, "System.Boolean" => TypeCode.Boolean, "System.Char" => TypeCode.Char, "System.SByte" => TypeCode.SByte, "System.Byte" => TypeCode.Byte, "System.Int16" => TypeCode.Int16, "System.UInt16" => TypeCode.UInt16, "System.Int32" => TypeCode.Int32, "System.UInt32" => TypeCode.UInt32, "System.Int64" => TypeCode.Int64, "System.UInt64" => TypeCode.UInt64, "System.Single" => TypeCode.Single, "System.Double" => TypeCode.Double, "System.Decimal" => TypeCode.Decimal, "System.DateTime" => TypeCode.DateTime, "System.String" => TypeCode.String, _ => TypeCode.Object, }; } public static bool TryFindForeachContinueLabel(this ILCursor cursor, out ILLabel continueLabel) { ILCursor val = cursor.Clone(); int enumeratorLocalIndex = -1; MethodReference method2 = default(MethodReference); if (!val.TryGotoPrev(new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, ref method2) && isEnumerableGetEnumerator(method2) }) || !val.TryGotoNext(new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref enumeratorLocalIndex) })) { Log.Warning("Failed to find GetEnumerator call", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/Utilities/Extensions/PatchExtensions.cs", "TryFindForeachContinueLabel", 256); continueLabel = null; return false; } val = cursor.Clone(); if (!val.TryGotoNext((MoveType)0, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, enumeratorLocalIndex), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "MoveNext") })) { Log.Warning("Failed to find matching MoveNext call", "/home/runner/work/GauntletMod/GauntletMod/Gauntlet/src/Utilities/Extensions/PatchExtensions.cs", "TryFindForeachContinueLabel", 266); continueLabel = null; return false; } continueLabel = val.MarkLabel(); return true; static bool isEnumerableGetEnumerator(MethodReference method) { if (method == null) { return false; } if (!string.Equals(((MemberReference)method).Name, "GetEnumerator")) { return false; } return true; } } public static string SafeToString(this Instruction instruction) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) if (instruction == null) { return "NULL"; } try { return ((object)instruction).ToString(); } catch { } StringBuilder stringBuilder = StringBuilderPool.RentStringBuilder(); try { StringBuilder stringBuilder2 = stringBuilder.Append(formatLabel(instruction)).Append(": "); OpCode opCode = instruction.OpCode; stringBuilder2.Append(((OpCode)(ref opCode)).Name); if (instruction.Operand != null) { stringBuilder.Append(' '); object operand = instruction.Operand; Instruction val = (Instruction)((operand is Instruction) ? operand : null); if (val == null) { if (operand is IEnumerable source) { stringBuilder.Append('[').Append(string.Join(", ", source.Select(formatLabel))).Append(']'); } else { stringBuilder.Append(instruction.Operand); } } else { stringBuilder.Append(formatLabel(val)); } } return stringBuilder.ToString(); } finally { stringBuilder = StringBuilderPool.ReturnStringBuilder(stringBuilder); } static string formatLabel(Instruction instruction) { if (instruction == null) { return "IL_????"; } return $"IL_{instruction.Offset:x4}"; } } public static bool TryFindParameter(this MethodReference method, Type parameterType, string parameterName, out ParameterDefinition parameter) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) if (method == null) { throw new ArgumentNullException("method"); } if (parameterType == null && string.IsNullOrEmpty(parameterName)) { throw new ArgumentException("Cannot find parameter for method " + ((MemberReference)method).FullName + ": Neither parameter type or name specified"); } if (method.HasParameters) { Enumerator enumerator = method.Parameters.GetEnumerator(); try { while (enumerator.MoveNext()) { ParameterDefinition current = enumerator.Current; if ((string.IsNullOrEmpty(parameterName) || ((ParameterReference)current).Name == parameterName) && (parameterType == null || Extensions.Is((MemberReference)(object)((ParameterReference)current).ParameterType, (MemberInfo)parameterType))) { parameter = current; return true; } } } finally { ((IDisposable)enumerator).Dispose(); } } parameter = null; return false; } public static bool TryFindParameter(this MethodReference method, string name, out ParameterDefinition parameter) { return method.TryFindParameter(null, name, out parameter); } public static bool TryFindParameter(this MethodReference method, Type type, out ParameterDefinition parameter) { return method.TryFindParameter(type, null, out parameter); } public static bool TryFindParameter(this MethodReference method, string name, out ParameterDefinition parameter) { return method.TryFindParameter(typeof(T), name, out parameter); } public static bool TryFindParameter(this MethodReference method, out ParameterDefinition parameter) { return method.TryFindParameter(typeof(T), null, out parameter); } public static VariableDefinition AddVariable(this ILContext context, TypeReference variableType) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown VariableDefinition val = new VariableDefinition(variableType); context.Method.Body.Variables.Add(val); return val; } public static VariableDefinition AddVariable(this ILContext context, Type variableType) { return context.AddVariable(context.Import(variableType)); } public static VariableDefinition AddVariable(this ILContext context) { return context.AddVariable(context.Import(typeof(T))); } public static void EmitStoreStack(this ILCursor cursor, [ParamCollection] IReadOnlyList variables) { //IL_0031: 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_0058: 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) if (cursor == null) { throw new ArgumentNullException("cursor"); } if (variables == null) { throw new ArgumentNullException("variables"); } if (variables.Count != 0) { for (int num = variables.Count - 1; num >= 1; num--) { cursor.Emit(OpCodes.Stloc, variables[num]); } cursor.Emit(OpCodes.Dup); cursor.Emit(OpCodes.Stloc, variables[0]); for (int i = 1; i < variables.Count; i++) { cursor.Emit(OpCodes.Ldloc, variables[i]); } } } private static bool matchLocalIndex(int localIndex, Type variableType, ILContext ilContext) { if ((object)variableType == null) { throw new ArgumentNullException("variableType"); } if (ilContext == null) { throw new ArgumentNullException("ilContext"); } if (ilContext.Method == null || !ilContext.Method.HasBody) { return false; } if (localIndex < ilContext.Method.Body.Variables.Count) { return Extensions.Is((MemberReference)(object)((VariableReference)ilContext.Method.Body.Variables[localIndex]).VariableType, (MemberInfo)variableType); } return false; } public static bool MatchLdloc(this Instruction instruction, Type variableType, ILContext ilContext, out int localIndex) { if (instruction == null) { throw new ArgumentNullException("instruction"); } if (ILPatternMatchingExt.MatchLdloc(instruction, ref localIndex)) { return matchLocalIndex(localIndex, variableType, ilContext); } return false; } public static bool MatchLdloca(this Instruction instruction, Type variableType, ILContext ilContext, out int localIndex) { if (instruction == null) { throw new ArgumentNullException("instruction"); } if (ILPatternMatchingExt.MatchLdloca(instruction, ref localIndex)) { return matchLocalIndex(localIndex, variableType, ilContext); } return false; } public static bool MatchStloc(this Instruction instruction, Type variableType, ILContext ilContext, out int localIndex) { if (instruction == null) { throw new ArgumentNullException("instruction"); } if (ILPatternMatchingExt.MatchStloc(instruction, ref localIndex)) { return matchLocalIndex(localIndex, variableType, ilContext); } return false; } } public static class RngExtensions { public static T NextElementUniform(this Xoroshiro128Plus rng, IReadOnlyList elements) { if (rng == null) { throw new ArgumentNullException("rng"); } if (elements == null) { throw new ArgumentNullException("elements"); } if (elements.Count == 0) { throw new ArgumentException("Cannot select an element from an empty list", "elements"); } return elements[rng.RangeInt(0, elements.Count)]; } } public static class WeightedSelectionExtensions { public static int FindChoiceIndex(this WeightedSelection weightedSelection, T value, IEqualityComparer comparer = null) { //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_0025: Unknown result type (might be due to invalid IL or missing references) if (weightedSelection == null) { throw new ArgumentNullException("weightedSelection"); } if (comparer == null) { comparer = EqualityComparer.Default; } for (int i = 0; i < weightedSelection.Count; i++) { if (comparer.Equals(weightedSelection.GetChoice(i).value, value)) { return i; } } return -1; } public static void EnsureCapacity(this WeightedSelection weightedSelection, int capacity) { if (weightedSelection == null) { throw new ArgumentNullException("weightedSelection"); } if (weightedSelection.Capacity < capacity) { weightedSelection.Capacity = capacity; } } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { internal IgnoresAccessChecksToAttribute(string assemblyName) { } } }