Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of WeatherIndex v0.1.0
WeatherIndex/WeatherIndex.dll
Decompiled 17 hours agousing System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Net; using System.Net.Http; using System.Net.Http.Headers; 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.Configuration; using BepInEx.Logging; using EntityStates; using EntityStates.GameOver; using HG; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using On.EntityStates.GameOver; using On.RoR2; using On.RoR2.UI; using RiskOfOptions; using RiskOfOptions.OptionConfigs; using RiskOfOptions.Options; using RoR2; using RoR2.Skills; using RoR2.Stats; using RoR2.UI; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("WeatherIndex")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.1.0.0")] [assembly: AssemblyInformationalVersion("0.1.0+ed565b6118117398c85a2a84e1e9b115c66fafd7")] [assembly: AssemblyProduct("WeatherIndex")] [assembly: AssemblyTitle("WeatherIndex")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.1.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace WeatherIndex { internal enum SubmitRunResult { Success, NotLoggedIn, ServerError, NetworkError, AlreadyUploaded } public class WIBridge { private static bool connecting; internal static async Task<SubmitRunResult> SubmitRun() { if (WeatherIndex.uploadedRun) { return SubmitRunResult.AlreadyUploaded; } WeatherIndex.uploadedRun = true; if (string.IsNullOrEmpty(WIConfig.accessToken?.Value)) { WeatherIndex.uploadedRun = false; return SubmitRunResult.NotLoggedIn; } try { string requestUri = WIConfig.backendURL?.Value + "/runs/new"; StringContent content = new StringContent(WeatherIndex.lastRun, Encoding.UTF8, "application/json"); HttpRequestMessage httpRequestMessage = new HttpRequestMessage(HttpMethod.Post, requestUri) { Content = content }; if (!string.IsNullOrEmpty(WIConfig.accessToken?.Value)) { httpRequestMessage.Headers.Authorization = new AuthenticationHeaderValue("Bearer", WIConfig.accessToken.Value); } HttpResponseMessage response = await WeatherIndex.http.SendAsync(httpRequestMessage); Log.Info(await response.Content.ReadAsStringAsync(), "/home/shuflduf/Projects/Weather-Index/mod/Bridge.cs", 56); if (response.IsSuccessStatusCode) { return SubmitRunResult.Success; } WeatherIndex.uploadedRun = false; return SubmitRunResult.ServerError; } catch (Exception data) { Log.Error(data, "/home/shuflduf/Projects/Weather-Index/mod/Bridge.cs", 67); WeatherIndex.uploadedRun = false; return SubmitRunResult.NetworkError; } } internal static async void RefreshStatus(bool popupEnabled = true) { ConfigEntry<string>? connectionStatus = WIConfig.connectionStatus; if (connectionStatus != null) { connectionStatus.Value = "LOADING"; } string requestUri = WIConfig.backendURL?.Value + "/auth/get-session"; HttpRequestMessage httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri); if (!string.IsNullOrEmpty(WIConfig.accessToken?.Value)) { httpRequestMessage.Headers.Authorization = new AuthenticationHeaderValue("Bearer", WIConfig.accessToken.Value); } HttpResponseMessage httpResponseMessage = await WeatherIndex.http.SendAsync(httpRequestMessage); switch (httpResponseMessage.StatusCode) { case HttpStatusCode.Unauthorized: { if (popupEnabled) { WIPopup.ShowMessage("Not connected. Please try again."); } ConfigEntry<string>? connectionStatus4 = WIConfig.connectionStatus; if (connectionStatus4 != null) { connectionStatus4.Value = "NOT CONNECTED"; } break; } case HttpStatusCode.OK: { var anon = JsonConvert.DeserializeAnonymousType(await httpResponseMessage.Content.ReadAsStringAsync(), new { user = new { username = "" } }); if (popupEnabled) { WIPopup.ShowMessage("Connected succesfully as @" + anon.user.username + "!"); } ConfigEntry<string>? connectionStatus3 = WIConfig.connectionStatus; if (connectionStatus3 != null) { connectionStatus3.Value = "CONNECTED AS @" + anon.user.username; } break; } default: { string text = await httpResponseMessage.Content.ReadAsStringAsync(); if (popupEnabled) { WIPopup.ShowMessage("An error occured: " + text); } ConfigEntry<string>? connectionStatus2 = WIConfig.connectionStatus; if (connectionStatus2 != null) { connectionStatus2.Value = "ERROR"; } break; } } } internal static async void StartConnection() { if (connecting) { return; } connecting = true; ConfigEntry<string>? connectionStatus = WIConfig.connectionStatus; if (connectionStatus != null) { connectionStatus.Value = "CONNECTING"; } string requestUri = WIConfig.backendURL?.Value + "/auth/device/code"; var body = JsonConvert.DeserializeAnonymousType(await (await WeatherIndex.http.PostAsync(requestUri, new StringContent(JsonConvert.SerializeObject((object)new { client_id = "weather-index-mod" }), Encoding.UTF8, "application/json"))).Content.ReadAsStringAsync(), new { device_code = "", user_code = "", verification_uri = "", interval = 5, expires_in = 1800 }); Application.OpenURL(body.verification_uri + "?user_code=" + body.user_code); Task.Run(async delegate { HttpResponseMessage poll; do { await Task.Delay(body.interval * 1000); poll = await WeatherIndex.http.PostAsync(WIConfig.backendURL?.Value + "/auth/device/token", new StringContent(JsonConvert.SerializeObject((object)new { grant_type = "urn:ietf:params:oauth:grant-type:device_code", device_code = body.device_code, client_id = "weather-index-mod" }), Encoding.UTF8, "application/json")); Log.Info(await poll.Content.ReadAsStringAsync(), "/home/shuflduf/Projects/Weather-Index/mod/Bridge.cs", 164); } while (!poll.IsSuccessStatusCode); var anon = JsonConvert.DeserializeAnonymousType(await poll.Content.ReadAsStringAsync(), new { access_token = "" }); Log.Info(JsonConvert.SerializeObject((object)anon), "/home/shuflduf/Projects/Weather-Index/mod/Bridge.cs", 173); ConfigEntry<string>? accessToken = WIConfig.accessToken; if (accessToken != null) { accessToken.Value = anon.access_token; } connecting = false; RefreshStatus(); }); } } public class WIConfig { [CompilerGenerated] private static class <>O { public static UnityAction <0>__StartConnection; } internal static ConfigEntry<KeyboardShortcut>? endRunKeybind; internal static ConfigEntry<string>? accessToken; internal static ConfigEntry<string>? backendURL; internal static ConfigEntry<string>? connectionStatus; private static Sprite loadIcon() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown //IL_003e: 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) byte[] array = File.ReadAllBytes(Path.Combine(WeatherIndex.pluginDir, "icon_full.png")); Texture2D val = new Texture2D(2, 2); ImageConversion.LoadImage(val, array); return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f)); } internal static void Init(BaseUnityPlugin plugin) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Expected O, but got Unknown //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_00f2: 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_010d: Expected O, but got Unknown //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Expected O, but got Unknown //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Expected O, but got Unknown //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Expected O, but got Unknown //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Expected O, but got Unknown ModSettingsManager.SetModIcon(loadIcon()); endRunKeybind = plugin.Config.Bind<KeyboardShortcut>("Debug", "End Run", new KeyboardShortcut((KeyCode)291, Array.Empty<KeyCode>()), "fucking"); accessToken = plugin.Config.Bind<string>("Account", "Access Token", "", "Weather Index access token"); backendURL = plugin.Config.Bind<string>("Debug", "Backend URL", "https://wi-api.shuflduf.xyz", "Weather Index backend URL"); connectionStatus = plugin.Config.Bind<string>("Account", "Status", "NOT CONNECTED", "Status of Weather Index connection"); object obj = <>O.<0>__StartConnection; if (obj == null) { UnityAction val = WIBridge.StartConnection; <>O.<0>__StartConnection = val; obj = (object)val; } ModSettingsManager.AddOption((BaseOption)new GenericButtonOption("Link Account", "General", "Connects your Weather Index account to Risk of Rain 2. \n\nWill open your browser for authentication.", "Connect", (UnityAction)obj)); ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(connectionStatus, new InputFieldConfig { name = "Status", category = "General", description = "Status of Weather Index connection.\n\nPossible values: NOT CONNECTED, CONNECTED AS [username], CONNECTING, LOADING, ERROR\n\n Automatically updated when this page is loaded. Exit settings and re-open this page for the proper updated value." })); ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(backendURL, new InputFieldConfig { name = "Backend URL", category = "Debug", description = "URL of Weather Index server." })); } } internal class DataDumper { [CompilerGenerated] private static class <>O { public static UnityAction <0>__DumpItems; public static UnityAction <1>__DumpEquipment; public static UnityAction <2>__DumpBodies; public static UnityAction <3>__DumpEndings; public static UnityAction <4>__DumpDifficulties; public static UnityAction <5>__DumpItemTiers; public static UnityAction <6>__DumpArtifacts; public static UnityAction <7>__DumpEnvironments; public static UnityAction <8>__DumpInteractables; public static UnityAction <9>__DumpSkills; } public static void Init() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown //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_002f: 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_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_0068: Expected O, but got Unknown //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Expected O, but got Unknown //IL_0096: 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_00a1: Expected O, but got Unknown //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Expected O, but got Unknown //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Expected O, but got Unknown //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Expected O, but got Unknown //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_0113: Expected O, but got Unknown //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Expected O, but got Unknown //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Expected O, but got Unknown //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Expected O, but got Unknown //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_0185: Expected O, but got Unknown //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Expected O, but got Unknown //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Expected O, but got Unknown //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Expected O, but got Unknown //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Expected O, but got Unknown //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Expected O, but got Unknown //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Expected O, but got Unknown object obj = <>O.<0>__DumpItems; if (obj == null) { UnityAction val = DumpItems; <>O.<0>__DumpItems = val; obj = (object)val; } ModSettingsManager.AddOption((BaseOption)new GenericButtonOption("Dump Items", "Debug", "Dumps all item data into the plugin folder", "Dump", (UnityAction)obj)); object obj2 = <>O.<1>__DumpEquipment; if (obj2 == null) { UnityAction val2 = DumpEquipment; <>O.<1>__DumpEquipment = val2; obj2 = (object)val2; } ModSettingsManager.AddOption((BaseOption)new GenericButtonOption("Dump Equipment", "Debug", "Dumps all equipments data into the plugin folder", "Dump", (UnityAction)obj2)); object obj3 = <>O.<2>__DumpBodies; if (obj3 == null) { UnityAction val3 = DumpBodies; <>O.<2>__DumpBodies = val3; obj3 = (object)val3; } ModSettingsManager.AddOption((BaseOption)new GenericButtonOption("Dump Bodies", "Debug", "Dumps all body data (survivors/enemies/etc) into the plugin folder", "Dump", (UnityAction)obj3)); object obj4 = <>O.<3>__DumpEndings; if (obj4 == null) { UnityAction val4 = DumpEndings; <>O.<3>__DumpEndings = val4; obj4 = (object)val4; } ModSettingsManager.AddOption((BaseOption)new GenericButtonOption("Dump Endings", "Debug", "Dumps all game endings into the plugin folder", "Dump", (UnityAction)obj4)); object obj5 = <>O.<4>__DumpDifficulties; if (obj5 == null) { UnityAction val5 = DumpDifficulties; <>O.<4>__DumpDifficulties = val5; obj5 = (object)val5; } ModSettingsManager.AddOption((BaseOption)new GenericButtonOption("Dump Difficulties", "Debug", "i frogot", "Dump", (UnityAction)obj5)); object obj6 = <>O.<5>__DumpItemTiers; if (obj6 == null) { UnityAction val6 = DumpItemTiers; <>O.<5>__DumpItemTiers = val6; obj6 = (object)val6; } ModSettingsManager.AddOption((BaseOption)new GenericButtonOption("Dump Item Tiers", "Debug", "\ud83d\udc38\ud83d\ude80", "Dump", (UnityAction)obj6)); object obj7 = <>O.<6>__DumpArtifacts; if (obj7 == null) { UnityAction val7 = DumpArtifacts; <>O.<6>__DumpArtifacts = val7; obj7 = (object)val7; } ModSettingsManager.AddOption((BaseOption)new GenericButtonOption("Dump Artifacts", "Debug", "artifacts", "Dump", (UnityAction)obj7)); object obj8 = <>O.<7>__DumpEnvironments; if (obj8 == null) { UnityAction val8 = DumpEnvironments; <>O.<7>__DumpEnvironments = val8; obj8 = (object)val8; } ModSettingsManager.AddOption((BaseOption)new GenericButtonOption("Dump Environments", "Debug", "environemtns/stages/scenes", "Dump", (UnityAction)obj8)); object obj9 = <>O.<8>__DumpInteractables; if (obj9 == null) { UnityAction val9 = DumpInteractables; <>O.<8>__DumpInteractables = val9; obj9 = (object)val9; } ModSettingsManager.AddOption((BaseOption)new GenericButtonOption("Dump Interactables", "Debug", "Dump interactables", "Dump", (UnityAction)obj9)); object obj10 = <>O.<9>__DumpSkills; if (obj10 == null) { UnityAction val10 = DumpSkills; <>O.<9>__DumpSkills = val10; obj10 = (object)val10; } ModSettingsManager.AddOption((BaseOption)new GenericButtonOption("Dump Skills", "Debug", "skills/abilites", "Dump", (UnityAction)obj10)); } public unsafe static void DumpItems() { //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_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Invalid comparison between Unknown and I4 //IL_003e: 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_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Expected I4, but got Unknown string text = Path.Combine(WeatherIndex.pluginDir, "items"); Directory.CreateDirectory(text); List<object> list = new List<object>(); AllItemsEnumerator enumerator = ItemCatalog.allItems.GetEnumerator(); try { while (((AllItemsEnumerator)(ref enumerator)).MoveNext()) { ItemIndex current = ((AllItemsEnumerator)(ref enumerator)).Current; if ((int)current == -1) { continue; } ItemDef itemDef = ItemCatalog.GetItemDef(current); if ((Object)(object)itemDef == (Object)null) { continue; } string text2 = null; Sprite pickupIconSprite = itemDef.pickupIconSprite; if (!((Object)(object)pickupIconSprite == (Object)null) && !((Object)(object)pickupIconSprite.texture == (Object)null)) { Texture2D texture = pickupIconSprite.texture; if ((Object)(object)texture != (Object)null) { text2 = ((Object)itemDef).name + ".png"; writeTexture(Path.Combine(text, text2), texture); } string text3 = Language.GetString(itemDef.nameToken); bool helper = string.IsNullOrEmpty(itemDef.nameToken) || text3 == itemDef.nameToken; string name = ((Object)itemDef).name; string nameToken = itemDef.nameToken; ItemTierDef itemTierDef = ItemTierCatalog.GetItemTierDef(itemDef.tier); list.Add(new { id = (int)current, name = name, nameToken = nameToken, displayName = text3, tier = ((itemTierDef != null) ? ((Object)itemTierDef).name : null), helper = helper, icon = text2 }); } } } finally { ((IDisposable)(*(AllItemsEnumerator*)(&enumerator))/*cast due to .constrained prefix*/).Dispose(); } string contents = JsonConvert.SerializeObject((object)list); File.WriteAllText(Path.Combine(text, "items.json"), contents); } public unsafe static void DumpEquipment() { //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_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Invalid comparison between Unknown and I4 //IL_003e: 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_00d6: Expected I4, but got Unknown string text = Path.Combine(WeatherIndex.pluginDir, "equipment"); Directory.CreateDirectory(text); List<object> list = new List<object>(); AllEquipmentEnumerator enumerator = EquipmentCatalog.allEquipment.GetEnumerator(); try { while (((AllEquipmentEnumerator)(ref enumerator)).MoveNext()) { EquipmentIndex current = ((AllEquipmentEnumerator)(ref enumerator)).Current; if ((int)current == -1) { continue; } EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef(current); if ((Object)(object)equipmentDef == (Object)null) { continue; } string text2 = null; Sprite pickupIconSprite = equipmentDef.pickupIconSprite; if (!((Object)(object)pickupIconSprite == (Object)null) && !((Object)(object)pickupIconSprite.texture == (Object)null)) { Texture2D texture = pickupIconSprite.texture; if ((Object)(object)texture != (Object)null) { text2 = ((Object)equipmentDef).name + ".png"; writeTexture(Path.Combine(text, text2), texture); } string displayName = Language.GetString(equipmentDef.nameToken); list.Add(new { id = (int)current, name = ((Object)equipmentDef).name, nameToken = equipmentDef.nameToken, displayName = displayName, icon = text2 }); } } } finally { ((IDisposable)(*(AllEquipmentEnumerator*)(&enumerator))/*cast due to .constrained prefix*/).Dispose(); } string contents = JsonConvert.SerializeObject((object)list); File.WriteAllText(Path.Combine(text, "equipment.json"), contents); } public static void DumpBodies() { //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Expected O, but got Unknown string text = Path.Combine(WeatherIndex.pluginDir, "bodies"); Directory.CreateDirectory(text); List<object> list = new List<object>(); Dictionary<string, string> dictionary = new Dictionary<string, string> { { "CommandoBody", "#cb812e" }, { "HuntressBody", "#a12a29" }, { "BanditBody", "#3cd4cb" }, { "ToolbotBody", "#938929" }, { "EngiBody", "#6b399e" }, { "MageBody", "#d7dad8" }, { "MercBody", "#464669" }, { "TreebotBody", "#9a9f84" }, { "LoaderBody", "#b38931" }, { "CrocoBody", "#894352" }, { "CaptainBody", "#2b2e41" }, { "RailgunnerBody", "#f94c7f" }, { "VoidSurvivorBody", "#facdf5" }, { "SeekerBody", "#e3b46e" }, { "FalseSonBody", "#b78224" }, { "ChefBody", "#c1c7d9" }, { "DroneTechBody", "#0b0d0b" }, { "DrifterBody", "#ac883c" } }; foreach (GameObject allBodyPrefab in BodyCatalog.allBodyPrefabs) { CharacterBody component = allBodyPrefab.GetComponent<CharacterBody>(); if (!((Object)(object)component == (Object)null)) { Texture2D val = (Texture2D)component.portraitIcon; string text2 = null; if ((Object)(object)val != (Object)null) { text2 = ((Object)allBodyPrefab).name + ".png"; writeTexture(Path.Combine(text, text2), val); } Dictionary<string, object> dictionary2 = new Dictionary<string, object> { { "name", ((Object)component).name }, { "nameToken", component.baseNameToken }, { "displayName", Language.GetString(component.baseNameToken) }, { "icon", text2 } }; if (dictionary.TryGetValue(((Object)component).name, out var value)) { dictionary2["survivorColor"] = value; } list.Add(dictionary2); } } string contents = JsonConvert.SerializeObject((object)list); File.WriteAllText(Path.Combine(text, "bodies.json"), contents); } public static void DumpEndings() { //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) string text = Path.Combine(WeatherIndex.pluginDir, "endings"); Directory.CreateDirectory(text); List<object> list = new List<object>(); GameEndingDef[] gameEndingDefs = GameEndingCatalog.gameEndingDefs; foreach (GameEndingDef val in gameEndingDefs) { if ((Object)(object)val == (Object)null) { continue; } Sprite icon = val.icon; if (!((Object)(object)icon == (Object)null) && !((Object)(object)icon.texture == (Object)null)) { Texture2D texture = icon.texture; if (!((Object)(object)texture == (Object)null)) { string text2 = val.cachedName + ".png"; writeEndingTexture(Path.Combine(text, text2), texture, val.foregroundColor); list.Add(new { name = val.cachedName, nameToken = val.endingTextToken, endingMessage = Language.GetString(val.endingTextToken), isWin = val.isWin, icon = text2, colorFg = ToHex(val.foregroundColor), colorBg = ToHex(val.backgroundColor) }); } } } string contents = JsonConvert.SerializeObject((object)list); File.WriteAllText(Path.Combine(text, "endings.json"), contents); } public static void DumpDifficulties() { //IL_00f5: 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_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Invalid comparison between Unknown and I4 //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Invalid comparison between Unknown and I4 //IL_010d: Unknown result type (might be due to invalid IL or missing references) string text = Path.Combine(WeatherIndex.pluginDir, "difficulties"); Directory.CreateDirectory(text); List<object> list = new List<object>(); Dictionary<string, string> dictionary = new Dictionary<string, string> { { "DIFFICULTY_EASY_NAME", "#4ade80" }, { "DIFFICULTY_NORMAL_NAME", "#fb923c" }, { "DIFFICULTY_HARD_NAME", "#ef4444" }, { "ECLIPSE_1_NAME", "#f1f5f9" }, { "ECLIPSE_2_NAME", "#e2e8f0" }, { "ECLIPSE_3_NAME", "#cbd5e1" }, { "ECLIPSE_4_NAME", "#94a3b8" }, { "ECLIPSE_5_NAME", "#64748b" }, { "ECLIPSE_6_NAME", "#475569" }, { "ECLIPSE_7_NAME", "#334155" }, { "ECLIPSE_8_NAME", "#1e293b" } }; foreach (DifficultyIndex value in Enum.GetValues(typeof(DifficultyIndex))) { if ((int)value == -1 || (int)value == 11) { continue; } DifficultyDef difficultyDef = DifficultyCatalog.GetDifficultyDef(value); if (difficultyDef == null) { continue; } Sprite iconSprite = difficultyDef.GetIconSprite(); if (!((Object)(object)iconSprite == (Object)null)) { string text2 = null; Texture2D texture = iconSprite.texture; if ((Object)(object)texture != (Object)null) { text2 = difficultyDef.nameToken + ".png"; writeTexture(Path.Combine(text, text2), texture); } list.Add(new { nameToken = difficultyDef.nameToken, displayName = Language.GetString(difficultyDef.nameToken), color = dictionary[difficultyDef.nameToken], icon = text2 }); } } string contents = JsonConvert.SerializeObject((object)list); File.WriteAllText(Path.Combine(text, "difficulties.json"), contents); } public static void DumpItemTiers() { //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_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) string text = Path.Combine(WeatherIndex.pluginDir, "tiers"); Directory.CreateDirectory(text); List<object> list = new List<object>(); ItemTier[] array = new ItemTier[12]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); ItemTier[] array2 = (ItemTier[])(object)array; Enumerator<ItemTierDef> enumerator = ItemTierCatalog.allItemTierDefs.GetEnumerator(); try { while (enumerator.MoveNext()) { ItemTierDef current = enumerator.Current; list.Add(new { name = ((Object)current).name, sort = Array.IndexOf(array2, current.tier) }); } } finally { ((IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose(); } string contents = JsonConvert.SerializeObject((object)list); File.WriteAllText(Path.Combine(text, "tiers.json"), contents); } public static void DumpArtifacts() { string text = Path.Combine(WeatherIndex.pluginDir, "artifacts"); Directory.CreateDirectory(text); List<object> list = new List<object>(); ArtifactDef[] artifactDefs = ArtifactCatalog.artifactDefs; foreach (ArtifactDef val in artifactDefs) { if ((Object)(object)val == (Object)null) { continue; } Sprite smallIconSelectedSprite = val.smallIconSelectedSprite; if (!((Object)(object)smallIconSelectedSprite == (Object)null)) { string text2 = null; Texture2D texture = smallIconSelectedSprite.texture; if ((Object)(object)texture != (Object)null) { text2 = val.cachedName + ".png"; writeTexture(Path.Combine(text, text2), texture); } list.Add(new { name = val.cachedName, nameToken = val.nameToken, displayName = Language.GetString(val.nameToken), icon = text2 }); } } string contents = JsonConvert.SerializeObject((object)list); File.WriteAllText(Path.Combine(text, "artifacts.json"), contents); } public static void DumpEnvironments() { //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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) string text = Path.Combine(WeatherIndex.pluginDir, "environments"); Directory.CreateDirectory(text); List<object> list = new List<object>(); Enumerator<SceneDef> enumerator = SceneCatalog.allStageSceneDefs.GetEnumerator(); try { while (enumerator.MoveNext()) { SceneDef current = enumerator.Current; if (!((Object)(object)current == (Object)null)) { Texture previewTexture = current.previewTexture; Texture2D val = (Texture2D)(object)((previewTexture is Texture2D) ? previewTexture : null); string text2 = null; if ((Object)(object)val != (Object)null) { text2 = current.cachedName + ".png"; writeTexture(Path.Combine(text, text2), val); } list.Add(new { name = current.cachedName, nameToken = current.nameToken, displayName = Language.GetString(current.nameToken), icon = text2 }); } } } finally { ((IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose(); } string contents = JsonConvert.SerializeObject((object)list); File.WriteAllText(Path.Combine(text, "environments.json"), contents); } public static void DumpInteractables() { string text = Path.Combine(WeatherIndex.pluginDir, "interactables"); Directory.CreateDirectory(text); List<object> list = new List<object>(); InteractableSpawnCard[] array = Resources.LoadAll<InteractableSpawnCard>("SpawnCards/InteractableSpawnCard/"); foreach (InteractableSpawnCard val in array) { if (!((Object)(object)val == (Object)null)) { PurchaseInteraction component = ((SpawnCard)val).prefab.GetComponent<PurchaseInteraction>(); list.Add(new { nameToken = component.displayNameToken, displayName = component.GetDisplayName(), cost = component.cost }); } } string contents = JsonConvert.SerializeObject((object)list); File.WriteAllText(Path.Combine(text, "interactables.json"), contents); } public static void DumpSkills() { string text = Path.Combine(WeatherIndex.pluginDir, "skills"); Directory.CreateDirectory(text); List<object> list = new List<object>(); Dictionary<string, string> dictionary = new Dictionary<string, string>(); foreach (SkillDef allSkillDef in SkillCatalog.allSkillDefs) { if ((Object)(object)allSkillDef == (Object)null) { continue; } Sprite icon = allSkillDef.icon; if ((Object)(object)icon == (Object)null || (Object)(object)icon.texture == (Object)null) { continue; } if (string.IsNullOrEmpty(allSkillDef.skillNameToken) || !dictionary.TryGetValue(allSkillDef.skillNameToken, out var value)) { value = (string.IsNullOrEmpty(allSkillDef.skillNameToken) ? $"skill_{allSkillDef.skillIndex}" : allSkillDef.skillNameToken) + ".png"; writeSprite(Path.Combine(text, value), icon); if (!string.IsNullOrEmpty(allSkillDef.skillNameToken)) { dictionary[allSkillDef.skillNameToken] = value; } } list.Add(new { id = allSkillDef.skillIndex, name = allSkillDef.skillName, nameToken = allSkillDef.skillNameToken, displayName = Language.GetString(allSkillDef.skillNameToken), icon = value }); } string contents = JsonConvert.SerializeObject((object)list); File.WriteAllText(Path.Combine(text, "skills.json"), contents); } private static void writeSprite(string path, Sprite sprite) { //IL_0008: 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) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown //IL_0077: Unknown result type (might be due to invalid IL or missing references) Texture2D texture = sprite.texture; Rect textureRect = sprite.textureRect; Texture2D val = new Texture2D((int)((Rect)(ref textureRect)).width, (int)((Rect)(ref textureRect)).height, (TextureFormat)4, false); RenderTexture active = RenderTexture.active; RenderTexture temporary = RenderTexture.GetTemporary(((Texture)texture).width, ((Texture)texture).height); Graphics.Blit((Texture)(object)texture, temporary); RenderTexture.active = temporary; val.ReadPixels(new Rect(((Rect)(ref textureRect)).x, (float)((Texture)texture).height - ((Rect)(ref textureRect)).y - ((Rect)(ref textureRect)).height, ((Rect)(ref textureRect)).width, ((Rect)(ref textureRect)).height), 0, 0); val.Apply(); RenderTexture.active = active; RenderTexture.ReleaseTemporary(temporary); File.WriteAllBytes(path, ImageConversion.EncodeToPNG(val)); Object.Destroy((Object)(object)val); } private static void writeEndingTexture(string path, Texture2D tex, Color color) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected O, but got Unknown //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(((Texture)tex).width, ((Texture)tex).height, (TextureFormat)4, false); RenderTexture active = RenderTexture.active; RenderTexture temporary = RenderTexture.GetTemporary(((Texture)tex).width, ((Texture)tex).height); Graphics.Blit((Texture)(object)tex, temporary); RenderTexture.active = temporary; val.ReadPixels(new Rect(0f, 0f, (float)((Texture)temporary).width, (float)((Texture)temporary).height), 0, 0); val.Apply(); RenderTexture.active = active; RenderTexture.ReleaseTemporary(temporary); Color32[] pixels = val.GetPixels32(); for (int i = 0; i < pixels.Length; i++) { float num = (float)(pixels[i].r + pixels[i].g + pixels[i].b) / 765f; pixels[i] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)(num * 255f)); } val.SetPixels32(pixels); val.Apply(); File.WriteAllBytes(path, ImageConversion.EncodeToPNG(val)); Object.Destroy((Object)(object)val); } private static void writeTexture(string path, Texture2D tex) { //IL_000e: 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_0051: 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_0071: Expected O, but got Unknown Texture2D val = new Texture2D(((Texture)tex).width, ((Texture)tex).height, (TextureFormat)4, false); RenderTexture active = RenderTexture.active; RenderTexture temporary = RenderTexture.GetTemporary(((Texture)tex).width, ((Texture)tex).height); Graphics.Blit((Texture)(object)tex, temporary); RenderTexture.active = temporary; val.ReadPixels(new Rect(0f, 0f, (float)((Texture)temporary).width, (float)((Texture)temporary).height), 0, 0); val.Apply(); RenderTexture.active = active; RenderTexture.ReleaseTemporary(temporary); tex = val; File.WriteAllBytes(path, ImageConversion.EncodeToPNG(tex)); Object.Destroy((Object)(object)tex); } private static string ToHex(Color c) { //IL_0005: 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_0029: Unknown result type (might be due to invalid IL or missing references) return $"#{(byte)(c.r * 255f):X2}{(byte)(c.g * 255f):X2}{(byte)(c.b * 255f):X2}"; } } internal class Debug { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static hook_FixedUpdate <>9__1_0; public static hook_OnEnter <>9__1_1; internal void <Init>b__1_0(orig_FixedUpdate orig, RoR2MainEndingPlayCutscene self) { orig.Invoke(self); if (enabled) { ((EntityState)self).outer.SetNextStateToMain(); } } internal void <Init>b__1_1(orig_OnEnter orig, ShowCredits self) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown orig.Invoke(self); if (enabled) { ((EntityState)self).outer.SetNextState((EntityState)new ShowReport()); } } } public static bool enabled = true; public static void Init() { //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 object obj = <>c.<>9__1_0; if (obj == null) { hook_FixedUpdate val = delegate(orig_FixedUpdate orig, RoR2MainEndingPlayCutscene self) { orig.Invoke(self); if (enabled) { ((EntityState)self).outer.SetNextStateToMain(); } }; <>c.<>9__1_0 = val; obj = (object)val; } RoR2MainEndingPlayCutscene.FixedUpdate += (hook_FixedUpdate)obj; object obj2 = <>c.<>9__1_1; if (obj2 == null) { hook_OnEnter val2 = delegate(orig_OnEnter orig, ShowCredits self) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown orig.Invoke(self); if (enabled) { ((EntityState)self).outer.SetNextState((EntityState)new ShowReport()); } }; <>c.<>9__1_1 = val2; obj2 = (object)val2; } ShowCredits.OnEnter += (hook_OnEnter)obj2; } internal static void SkipKeybind() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)Run.instance)) { KeyboardShortcut value = WIConfig.endRunKeybind.Value; if (((KeyboardShortcut)(ref value)).IsDown() && enabled) { Run.instance.BeginGameOver(GameEndings.MainEnding); } } } } internal static class Log { private static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } private static string Format(object data, string file, int line) { string fileName = Path.GetFileName(file); return $"[{fileName}:{line}] {data}"; } internal static void Debug(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0) { _logSource.LogDebug((object)Format(data, file, line)); } internal static void Error(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0) { _logSource.LogError((object)Format(data, file, line)); } internal static void Fatal(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0) { _logSource.LogFatal((object)Format(data, file, line)); } internal static void Info(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0) { _logSource.LogInfo((object)Format(data, file, line)); } internal static void Message(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0) { _logSource.LogMessage((object)Format(data, file, line)); } internal static void Warning(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0) { _logSource.LogWarning((object)Format(data, file, line)); } } public class WIPopup { public static void ShowMessage(string message) { WeatherIndex.MainThread(delegate { //IL_0009: 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_0032: 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) SimpleDialogBox obj = SimpleDialogBox.Create((MPEventSystem)null); TokenParamsPair headerToken = new TokenParamsPair { token = "Weather Index" }; object[] formatParams = Array.Empty<Object>(); headerToken.formatParams = formatParams; obj.headerToken = headerToken; headerToken = new TokenParamsPair { token = message }; formatParams = Array.Empty<Object>(); headerToken.formatParams = formatParams; obj.descriptionToken = headerToken; obj.AddCancelButton("Proceed", Array.Empty<object>()); }); } } internal class ItemEvent { public ItemIndex? id; public int? count; public int? time; } internal class EquipmentEvent { public EquipmentIndex? id; public int? time; } internal class StageInteractable { public string? name; public int? time; public int? item; } internal class StageInfo { public string name = ""; public List<StageInteractable> interactables = new List<StageInteractable>(); } internal class RunTracker { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static hook_OnClientGameOver <>9__8_0; public static hook_AdvanceStage <>9__8_1; public static hook_OnStageStartGlobal <>9__8_2; public static Action<Inventory> <>9__8_3; internal void <Init>b__8_0(orig_OnClientGameOver orig, Run self, RunReport runReport) { addCurrentStage(); orig.Invoke(self, runReport); } internal void <Init>b__8_1(orig_AdvanceStage orig, Run self, SceneDef stage) { orig.Invoke(self, stage); addCurrentStage(); } internal void <Init>b__8_2(orig_OnStageStartGlobal orig, Run self, Stage stage) { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Invalid comparison between Unknown and I4 //IL_0094: 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_009e: Expected I4, but got Unknown orig.Invoke(self, stage); currentStage = new Dictionary<int, StageInteractable>(); PurchaseInteraction[] array = InstanceTracker.GetInstancesList<PurchaseInteraction>().ToArray(); ChestBehavior val2 = default(ChestBehavior); for (int i = 0; i < array.Length; i++) { <>c__DisplayClass8_0 CS$<>8__locals3 = new <>c__DisplayClass8_0 { id = i }; PurchaseInteraction val = array[i]; ((UnityEvent<PayCostContext, PayCostResults>)(object)val.onDetailedPurchaseServer).AddListener((UnityAction<PayCostContext, PayCostResults>)delegate { if (currentStage.TryGetValue(CS$<>8__locals3.id, out StageInteractable value2)) { value2.time = timestamp(); currentStage[CS$<>8__locals3.id] = value2; Log.Info(JsonConvert.SerializeObject((object)currentStage), "/home/shuflduf/Projects/Weather-Index/mod/RunTracker.cs", 93); } }); if (((Component)val).TryGetComponent<ChestBehavior>(ref val2)) { PickupDef pickupDef = PickupCatalog.GetPickupDef(val2.currentPickup.pickupIndex); StageInteractable value = new StageInteractable { name = val.displayNameToken, item = (int)(((int)pickupDef.itemIndex != -1) ? pickupDef.itemIndex : pickupDef.equipmentIndex) }; currentStage.Add(CS$<>8__locals3.id, value); } } currentStageName = SceneCatalog.GetSceneDefForCurrentScene().cachedName; } internal void <Init>b__8_3(Inventory inv) { //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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) <>c__DisplayClass8_1 CS$<>8__locals2 = new <>c__DisplayClass8_1 { master = ((Component)inv).GetComponent<CharacterMaster>() }; if (!((Object)(object)CS$<>8__locals2.master == (Object)null) && NetworkUser.localPlayers.Exists((NetworkUser nu) => (Object)(object)nu.master == (Object)(object)CS$<>8__locals2.master)) { Dictionary<ItemIndex, int> dictionary = itemList(inv.permanentItemStacks); EquipmentIndex equipmentIndex = inv.GetEquipmentIndex(); if (equipmentIndex != oldEquip) { equipments.Add(new EquipmentEvent { id = equipmentIndex, time = timestamp() }); oldEquip = equipmentIndex; } addItemEvents(itemDifference(oldItems, dictionary)); Log.Info(JsonConvert.SerializeObject((object)items), "/home/shuflduf/Projects/Weather-Index/mod/RunTracker.cs", 139); oldItems = dictionary; } } } [CompilerGenerated] private sealed class <>c__DisplayClass8_0 { public int id; internal void <Init>b__4(PayCostContext ctx, PayCostResults res) { if (currentStage.TryGetValue(id, out StageInteractable value)) { value.time = timestamp(); currentStage[id] = value; Log.Info(JsonConvert.SerializeObject((object)currentStage), "/home/shuflduf/Projects/Weather-Index/mod/RunTracker.cs", 93); } } } [CompilerGenerated] private sealed class <>c__DisplayClass8_1 { public CharacterMaster master; internal bool <Init>b__5(NetworkUser nu) { return (Object)(object)nu.master == (Object)(object)master; } } internal static List<StageInfo> stages = new List<StageInfo>(); internal static List<ItemEvent> items = new List<ItemEvent>(); internal static List<EquipmentEvent> equipments = new List<EquipmentEvent>(); private static Dictionary<ItemIndex, int> oldItems = new Dictionary<ItemIndex, int>(); private static EquipmentIndex oldEquip = (EquipmentIndex)(-1); private static Dictionary<int, StageInteractable>? currentStage; private static string? currentStageName; public static void Reset() { stages = new List<StageInfo>(); items = new List<ItemEvent>(); equipments = new List<EquipmentEvent>(); oldItems = new Dictionary<ItemIndex, int>(); } public static void Init() { //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 object obj = <>c.<>9__8_0; if (obj == null) { hook_OnClientGameOver val = delegate(orig_OnClientGameOver orig, Run self, RunReport runReport) { addCurrentStage(); orig.Invoke(self, runReport); }; <>c.<>9__8_0 = val; obj = (object)val; } Run.OnClientGameOver += (hook_OnClientGameOver)obj; object obj2 = <>c.<>9__8_1; if (obj2 == null) { hook_AdvanceStage val2 = delegate(orig_AdvanceStage orig, Run self, SceneDef stage) { orig.Invoke(self, stage); addCurrentStage(); }; <>c.<>9__8_1 = val2; obj2 = (object)val2; } Run.AdvanceStage += (hook_AdvanceStage)obj2; object obj3 = <>c.<>9__8_2; if (obj3 == null) { hook_OnStageStartGlobal val3 = delegate(orig_OnStageStartGlobal orig, Run self, Stage stage) { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Invalid comparison between Unknown and I4 //IL_0094: 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_009e: Expected I4, but got Unknown orig.Invoke(self, stage); currentStage = new Dictionary<int, StageInteractable>(); PurchaseInteraction[] array = InstanceTracker.GetInstancesList<PurchaseInteraction>().ToArray(); ChestBehavior val5 = default(ChestBehavior); for (int i = 0; i < array.Length; i++) { int id = i; PurchaseInteraction val4 = array[i]; ((UnityEvent<PayCostContext, PayCostResults>)(object)val4.onDetailedPurchaseServer).AddListener((UnityAction<PayCostContext, PayCostResults>)delegate { if (currentStage.TryGetValue(id, out StageInteractable value2)) { value2.time = timestamp(); currentStage[id] = value2; Log.Info(JsonConvert.SerializeObject((object)currentStage), "/home/shuflduf/Projects/Weather-Index/mod/RunTracker.cs", 93); } }); if (((Component)val4).TryGetComponent<ChestBehavior>(ref val5)) { PickupDef pickupDef = PickupCatalog.GetPickupDef(val5.currentPickup.pickupIndex); StageInteractable value = new StageInteractable { name = val4.displayNameToken, item = (int)(((int)pickupDef.itemIndex != -1) ? pickupDef.itemIndex : pickupDef.equipmentIndex) }; currentStage.Add(id, value); } } currentStageName = SceneCatalog.GetSceneDefForCurrentScene().cachedName; }; <>c.<>9__8_2 = val3; obj3 = (object)val3; } Run.OnStageStartGlobal += (hook_OnStageStartGlobal)obj3; Inventory.onInventoryChangedGlobal += delegate(Inventory inv) { //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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) CharacterMaster master = ((Component)inv).GetComponent<CharacterMaster>(); if (!((Object)(object)master == (Object)null) && NetworkUser.localPlayers.Exists((NetworkUser nu) => (Object)(object)nu.master == (Object)(object)master)) { Dictionary<ItemIndex, int> newItems = itemList(inv.permanentItemStacks); EquipmentIndex equipmentIndex = inv.GetEquipmentIndex(); if (equipmentIndex != oldEquip) { equipments.Add(new EquipmentEvent { id = equipmentIndex, time = timestamp() }); oldEquip = equipmentIndex; } addItemEvents(itemDifference(oldItems, newItems)); Log.Info(JsonConvert.SerializeObject((object)items), "/home/shuflduf/Projects/Weather-Index/mod/RunTracker.cs", 139); oldItems = newItems; } }; } private static void addCurrentStage() { StageInfo stageInfo = new StageInfo(); stageInfo.name = currentStageName; stageInfo.interactables = new List<StageInteractable>(currentStage.Count); foreach (StageInteractable value in currentStage.Values) { stageInfo.interactables.Add(value); } stages.Add(stageInfo); } private static void addItemEvents(List<ItemEvent> diffs) { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) if (items.Count == 0) { items.AddRange(diffs); return; } foreach (ItemEvent diff in diffs) { ItemEvent itemEvent = items[items.Count - 1]; if (itemEvent.id == diff.id) { items[items.Count - 1] = new ItemEvent { id = itemEvent.id, count = itemEvent.count + diff.count, time = itemEvent.time }; } else { items.Add(diff); } } } private static Dictionary<ItemIndex, int> itemList(ItemCollection stacks) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) Dictionary<ItemIndex, int> dictionary = new Dictionary<ItemIndex, int>(); for (int i = 0; i < ItemCatalog.itemCount; i++) { ItemIndex val = (ItemIndex)i; int stackValue = ((ItemCollection)(ref stacks)).GetStackValue(val); if (stackValue != 0) { dictionary[val] = stackValue; } } return dictionary; } private static List<ItemEvent> itemDifference(Dictionary<ItemIndex, int> oldItems, Dictionary<ItemIndex, int> newItems) { //IL_000e: 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_0025: 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_0076: 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_00c3: 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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: 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_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) List<ItemEvent> list = new List<ItemEvent>(); for (int i = 0; i < ItemCatalog.itemCount; i++) { ItemIndex val = (ItemIndex)i; if (oldItems.ContainsKey(val) || newItems.ContainsKey(val)) { if (oldItems.ContainsKey(val) && !newItems.ContainsKey(val)) { list.Add(new ItemEvent { id = val, count = -oldItems[val], time = timestamp() }); } else if (!oldItems.ContainsKey(val) && newItems.ContainsKey(val)) { list.Add(new ItemEvent { id = val, count = newItems[val], time = timestamp() }); } else if (oldItems[val] != newItems[val]) { list.Add(new ItemEvent { id = val, count = newItems[val] - oldItems[val], time = timestamp() }); } } } return list; } private static int timestamp() { return (int)Math.Floor(TimeStamp.tNow); } } public class SubmitButton : MonoBehaviour { private GameEndReportPanelController? panel; public void Init(GameEndReportPanelController panelController) { panel = panelController; CreateButton(); } private void CreateButton() { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Expected O, but got Unknown //IL_00b8: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)panel == (Object)null) { return; } MPButton continueButton = panel.continueButton; if (!((Object)(object)continueButton == (Object)null)) { GameObject obj = Object.Instantiate<GameObject>(((Component)continueButton).gameObject, ((Component)continueButton).transform.parent); obj.transform.SetAsFirstSibling(); ((Object)obj).name = "WeatherIndexSubmitButton"; HGButton component = obj.GetComponent<HGButton>(); ((UnityEventBase)((Button)component).onClick).RemoveAllListeners(); ((UnityEvent)((Button)component).onClick).AddListener(new UnityAction(OnSubmitClicked)); LanguageTextMeshController componentInChildren = obj.GetComponentInChildren<LanguageTextMeshController>(); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.token = "Submit"; } Image componentInChildren2 = obj.GetComponentInChildren<Image>(); if ((Object)(object)componentInChildren2 != (Object)null) { ((Graphic)componentInChildren2).color = new Color(0.5f, 0.9f, 1f, 1f); } Transform val = obj.transform.Find("GenericGlyph"); if ((Object)(object)val != (Object)null) { ((Component)val).gameObject.SetActive(false); } } } private async void OnSubmitClicked() { switch (await WIBridge.SubmitRun()) { case SubmitRunResult.Success: WIPopup.ShowMessage("Run submitted succesfully!"); break; case SubmitRunResult.AlreadyUploaded: WIPopup.ShowMessage("Run already submitted!"); break; case SubmitRunResult.NotLoggedIn: WIPopup.ShowMessage("Not signed in. Sign in from the settings page and re-submit!"); break; case SubmitRunResult.NetworkError: WIPopup.ShowMessage("Could not reach the server. Please try again later."); break; case SubmitRunResult.ServerError: WIPopup.ShowMessage("Server error. Please try again later."); break; } } } [BepInPlugin("Shuflduf.WeatherIndex", "WeatherIndex", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class WeatherIndex : BaseUnityPlugin { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Action<Run> <>9__9_0; public static hook_Awake <>9__9_2; internal void <Awake>b__9_0(Run run) { RunTracker.Reset(); uploadedRun = false; } internal void <Awake>b__9_2(orig_Awake orig, GameEndReportPanelController self) { orig.Invoke(self); ((Component)self).gameObject.AddComponent<SubmitButton>().Init(self); } } public const string PluginGUID = "Shuflduf.WeatherIndex"; public const string PluginAuthor = "Shuflduf"; public const string PluginName = "WeatherIndex"; public const string PluginVersion = "1.0.0"; internal static readonly ConcurrentQueue<Action> mainThreadQueue = new ConcurrentQueue<Action>(); internal static readonly HttpClient http = new HttpClient(); internal static string? lastRun; internal static bool uploadedRun = true; internal static string pluginDir = Path.Combine(Paths.PluginPath, "WeatherIndex"); public void Awake() { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown Log.Init(((BaseUnityPlugin)this).Logger); Run.onRunStartGlobal += delegate { RunTracker.Reset(); uploadedRun = false; }; Run.onClientGameOverGlobal += delegate(Run run, RunReport report) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0064: 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_00b9: 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_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0247: 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_025a: Expected O, but got Unknown Log.Info(JsonConvert.SerializeObject((object)RunTracker.equipments), "/home/shuflduf/Projects/Weather-Index/mod/WeatherIndex.cs", 42); PlayerInfo[] playerInfos = report.playerInfos; PlayerInfo val2 = ((playerInfos != null) ? playerInfos[0] : null); StatSheet statSheet = val2.statSheet; Dictionary<int, int> itemCounts = getItemCounts(val2.itemStacks); List<string> list = new List<string>(); ArtifactDef[] artifactDefs = ArtifactCatalog.artifactDefs; foreach (ArtifactDef val3 in artifactDefs) { ArtifactMask val4 = report.ruleBook.GenerateArtifactMask(); if (((ArtifactMask)(ref val4)).HasArtifact(val3.artifactIndex)) { list.Add(val3.cachedName); } } List<int> list2 = new List<int>(); BodyLoadoutManager bodyLoadoutManager = val2.master.loadout.bodyLoadoutManager; GenericSkill[] bodyPrefabSkillSlots = BodyCatalog.GetBodyPrefabSkillSlots(val2.bodyIndex); for (int j = 0; j < bodyPrefabSkillSlots.Length; j++) { uint skillVariant = bodyLoadoutManager.GetSkillVariant(val2.bodyIndex, j); SkillDef skillDef = bodyPrefabSkillSlots[j].skillFamily.variants[skillVariant].skillDef; list2.Add(skillDef.skillIndex); } string data = JsonConvert.SerializeObject((object)new { survivor = val2.bodyName, skills = list2, ending = report.gameEnding.cachedName, startTime = report.runStartTimeUtc, difficulty = DifficultyCatalog.GetDifficultyDef(report.ruleBook.FindDifficulty()).nameToken, timeAliveSeconds = (ulong)statSheet.GetStatValueAsDouble(StatDef.totalTimeAlive), artifacts = list, stagesCompleted = statSheet.GetStatValueULong(StatDef.totalStagesCompleted), stageHistory = RunTracker.stages, items = itemCounts, equipment = (EquipmentIndex)((val2.equipment.Length != 0) ? ((int)val2.equipment[0]) : (-1)), itemsCollected = statSheet.GetStatValueULong(StatDef.totalItemsCollected), itemHistory = RunTracker.items, equipmentHistory = RunTracker.equipments, dronesPurchased = statSheet.GetStatValueULong(StatDef.totalDronesPurchased), turretsPurchased = statSheet.GetStatValueULong(StatDef.totalTurretsPurchased), kills = statSheet.GetStatValueULong(StatDef.totalKills), eliteKills = statSheet.GetStatValueULong(StatDef.totalEliteKills), minionKills = statSheet.GetStatValueULong(StatDef.totalMinionKills), deaths = statSheet.GetStatValueULong(StatDef.totalDeaths), damageDealt = statSheet.GetStatValueULong(StatDef.totalDamageDealt), minionDamageDealt = statSheet.GetStatValueULong(StatDef.totalMinionDamageDealt), damageTaken = statSheet.GetStatValueULong(StatDef.totalDamageTaken), highestDamageDealt = statSheet.GetStatValueULong(StatDef.highestDamageDealt), healingRecieved = statSheet.GetStatValueULong(StatDef.totalHealthHealed), highestLevel = statSheet.GetStatValueULong(StatDef.highestLevel), goldCollected = statSheet.GetStatValueULong(StatDef.goldCollected), purchases = statSheet.GetStatValueULong(StatDef.totalPurchases), goldPurchases = statSheet.GetStatValueULong(StatDef.totalGoldPurchases), bloodPurchases = statSheet.GetStatValueULong(StatDef.totalBloodPurchases), lunarPurchases = statSheet.GetStatValueULong(StatDef.totalLunarPurchases), distanceTraveled = (ulong)statSheet.GetStatValueAsDouble(StatDef.totalDistanceTraveled) }, (Formatting)0, new JsonSerializerSettings { ReferenceLoopHandling = (ReferenceLoopHandling)1, NullValueHandling = (NullValueHandling)1 }); Log.Info(data, "/home/shuflduf/Projects/Weather-Index/mod/WeatherIndex.cs", 132); lastRun = data; }; object obj = <>c.<>9__9_2; if (obj == null) { hook_Awake val = delegate(orig_Awake orig, GameEndReportPanelController self) { orig.Invoke(self); ((Component)self).gameObject.AddComponent<SubmitButton>().Init(self); }; <>c.<>9__9_2 = val; obj = (object)val; } GameEndReportPanelController.Awake += (hook_Awake)obj; WIConfig.Init((BaseUnityPlugin)(object)this); RunTracker.Init(); Debug.Init(); DataDumper.Init(); WIBridge.RefreshStatus(popupEnabled: false); } internal static void MainThread(Action action) { mainThreadQueue.Enqueue(action); } private Dictionary<int, int> getItemCounts(int[] itemStacks) { Dictionary<int, int> dictionary = new Dictionary<int, int>(); for (int i = 0; i < itemStacks.Length; i++) { if (itemStacks[i] > 0) { dictionary[i] = itemStacks[i]; } } return dictionary; } private void Update() { Action result; while (mainThreadQueue.TryDequeue(out result)) { result(); } Debug.SkipKeybind(); } } }