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 MiscModpackUtils v1.2.0
MiscModpackUtils.dll
Decompiled 5 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Drawing; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HG.Reflection; using HarmonyLib; using IL.RoR2; using Microsoft.CodeAnalysis; using MiscModpackUtils.Patches; using Mono.Cecil.Cil; using MonoMod.Cil; using On.RoR2; using On.RoR2.UI; using On.RoR2.UI.LogBook; using On.RoR2.UI.MainMenu; using R2API; using R2API.ScriptableObjects; using RoR2; using RoR2.Achievements; using RoR2.ExpansionManagement; using RoR2.Skills; using RoR2.UI; using RoR2.UI.LogBook; using RoR2.UI.MainMenu; using RoR2.UI.SkinControllers; using TMPro; using UnityEngine; using UnityEngine.Rendering.PostProcessing; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: OptIn] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("MiscModpackUtils")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+9b2a3e95ef60d211fd34fd6e93222c913788fb3f")] [assembly: AssemblyProduct("MiscModpackUtils")] [assembly: AssemblyTitle("MiscModpackUtils")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [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 MiscModpackUtils { public static class ImageHelper { private const string errorMessage = "Could not recognize image format."; private static Dictionary<byte[], Func<BinaryReader, Size>> imageFormatDecoders = new Dictionary<byte[], Func<BinaryReader, Size>> { { new byte[2] { 66, 77 }, DecodeBitmap }, { new byte[6] { 71, 73, 70, 56, 55, 97 }, DecodeGif }, { new byte[6] { 71, 73, 70, 56, 57, 97 }, DecodeGif }, { new byte[8] { 137, 80, 78, 71, 13, 10, 26, 10 }, DecodePng }, { new byte[2] { 255, 216 }, DecodeJfif } }; public static Size GetDimensions(string path) { using BinaryReader binaryReader = new BinaryReader(File.OpenRead(path)); try { return GetDimensions(binaryReader); } catch (ArgumentException ex) { if (ex.Message.StartsWith("Could not recognize image format.")) { throw new ArgumentException("Could not recognize image format.", "path", ex); } throw ex; } } public static Size GetDimensions(BinaryReader binaryReader) { int num = imageFormatDecoders.Keys.OrderByDescending((byte[] x) => x.Length).First().Length; byte[] array = new byte[num]; for (int i = 0; i < num; i++) { array[i] = binaryReader.ReadByte(); foreach (KeyValuePair<byte[], Func<BinaryReader, Size>> imageFormatDecoder in imageFormatDecoders) { if (array.StartsWith(imageFormatDecoder.Key)) { return imageFormatDecoder.Value(binaryReader); } } } throw new ArgumentException("Could not recognize image format.", "binaryReader"); } private static bool StartsWith(this byte[] thisBytes, byte[] thatBytes) { for (int i = 0; i < thatBytes.Length; i++) { if (thisBytes[i] != thatBytes[i]) { return false; } } return true; } private static short ReadLittleEndianInt16(this BinaryReader binaryReader) { byte[] array = new byte[2]; for (int i = 0; i < 2; i++) { array[1 - i] = binaryReader.ReadByte(); } return BitConverter.ToInt16(array, 0); } private static int ReadLittleEndianInt32(this BinaryReader binaryReader) { byte[] array = new byte[4]; for (int i = 0; i < 4; i++) { array[3 - i] = binaryReader.ReadByte(); } return BitConverter.ToInt32(array, 0); } private static Size DecodeBitmap(BinaryReader binaryReader) { binaryReader.ReadBytes(16); int width = binaryReader.ReadInt32(); int height = binaryReader.ReadInt32(); return new Size(width, height); } private static Size DecodeGif(BinaryReader binaryReader) { int width = binaryReader.ReadInt16(); int height = binaryReader.ReadInt16(); return new Size(width, height); } private static Size DecodePng(BinaryReader binaryReader) { binaryReader.ReadBytes(8); int width = binaryReader.ReadLittleEndianInt32(); int height = binaryReader.ReadLittleEndianInt32(); return new Size(width, height); } private static Size DecodeJfif(BinaryReader binaryReader) { while (binaryReader.ReadByte() == byte.MaxValue) { byte b = binaryReader.ReadByte(); short num = binaryReader.ReadLittleEndianInt16(); if (b == 192) { binaryReader.ReadByte(); int height = binaryReader.ReadLittleEndianInt16(); int width = binaryReader.ReadLittleEndianInt16(); return new Size(width, height); } binaryReader.ReadBytes(num - 2); } throw new ArgumentException("Could not recognize image format."); } } [BepInPlugin("zzz.prodzpod.MiscModpackUtils", "MiscModpackUtils", "1.0.0")] public class Main : BaseUnityPlugin { public const string PluginGUID = "zzz.prodzpod.MiscModpackUtils"; public const string PluginAuthor = "prodzpod"; public const string PluginName = "MiscModpackUtils"; public const string PluginVersion = "1.0.0"; public static ManualLogSource Log; public static PluginInfo pluginInfo; public static Harmony Harmony; public static ConfigFile Config; public static ConfigEntry<bool> Debug; public void Awake() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown pluginInfo = ((BaseUnityPlugin)this).Info; Log = ((BaseUnityPlugin)this).Logger; Harmony = new Harmony("zzz.prodzpod.MiscModpackUtils"); Config = new ConfigFile(Path.Combine(Paths.ConfigPath, "zzz.prodzpod.MiscModpackUtils.cfg"), true); Debug = Config.Bind<bool>("General", "Debug Mode", true, "Prints necessary info"); LanguageOverride.Init(); ItemLookSwap.Init(); ItemAchievementSwap.Init(); EquipmentCooldown.Init(); SkillAchievementSwap.Init(); EliteLookSwap.Init(); DifficultyOrder.Init(); SkillOrder.Init(); ArtifactOrder.Init(); PickupLogbookOrder.Init(); MonsterLogbookOrder.Init(); DroneLogbookOrder.Init(); StageLogbookOrder.Init(); SurvivorLogbookOrder.Init(); AchievementLogbookOrder.Init(); PauseScreen.Init(); MainScreen.Init(); AddArtifactCodes.Init(); RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, (Action)delegate { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_0387: Unknown result type (might be due to invalid IL or missing references) OnBasicallyEverythingLoaded(); if (Debug.Value) { Log.LogInfo((object)"Debug Dumped"); Log.LogInfo((object)("Items: " + string.Join(", ", ((IEnumerable<ItemDef>)(object)ItemCatalog.allItemDefs).Select((ItemDef x) => x.nameToken)))); Log.LogInfo((object)("Equipments: " + string.Join(", ", EquipmentCatalog.equipmentDefs.Select((EquipmentDef x) => x.nameToken)))); Log.LogInfo((object)("Entities: " + string.Join(", ", BodyCatalog.allBodyPrefabBodyBodyComponents.Select((CharacterBody x) => x.baseNameToken)))); Log.LogInfo((object)("Survivors: " + string.Join(", ", SurvivorCatalog.cachedSurvivorNames))); Log.LogInfo((object)("Elites: " + string.Join(", ", from x in EquipmentCatalog.equipmentDefs where (Object)(object)x.passiveBuffDef?.eliteDef != (Object)null select ((Object)x).name))); Log.LogInfo((object)("Skills: " + string.Join(", ", from x in SkillCatalog.allSkillFamilies where (Object)(object)x != (Object)null select string.Join(", ", from x in x.variants where (Object)(object)x.skillDef != (Object)null select x.skillDef.skillNameToken)))); Log.LogInfo((object)("Skins: " + string.Join(", ", SkinCatalog.allSkinDefs.Select((SkinDef x) => x.nameToken)))); Log.LogInfo((object)("Drones: " + string.Join(", ", DroneCatalog.allDroneDefs.Select((DroneDef x) => x.nameToken)))); Log.LogInfo((object)("Stages: " + string.Join(", ", ((IEnumerable<SceneDef>)(object)SceneCatalog.allStageSceneDefs).Select((SceneDef x) => x.cachedName)))); Log.LogInfo((object)("Artifacts: " + string.Join(", ", ArtifactCatalog.artifactDefs.Select((ArtifactDef x) => x.nameToken)))); Log.LogInfo((object)("Difficulties: " + string.Join(", ", DifficultyAPI.difficultyDefinitions.Values.Select((DifficultyDef x) => x.nameToken)))); Log.LogInfo((object)("Achievements: " + string.Join(", ", ((IEnumerable<AchievementDef>)(object)AchievementManager.allAchievementDefs).Select((AchievementDef x) => x.nameToken)))); } }); } public static void OnBasicallyEverythingLoaded() { ItemLookSwap.OnBasicallyEverythingLoaded(); ItemAchievementSwap.OnBasicallyEverythingLoaded(); SkillAchievementSwap.OnBasicallyEverythingLoaded(); AddArtifactCodes.OnBasicallyEverythingLoaded(); } } public class Utils { public static Color TRANSPARENT = new Color(0f, 0f, 0f, 0f); public static Sprite GetComposite(Texture2D bg, Texture2D fg) { //IL_0035: 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_006e: 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) //IL_009e: 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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Expected O, but got Unknown //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0139: 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_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0109: 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_00cf: 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_00df: 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_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor((float)Mathf.Max(((Texture)bg).width, ((Texture)fg).width), (float)Mathf.Max(((Texture)bg).height, ((Texture)fg).height)); Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(Mathf.Floor(((float)((Texture)bg).width - val.x) / 2f), Mathf.Floor(((float)((Texture)bg).width - val.y) / 2f)); Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(Mathf.Floor(((float)((Texture)fg).width - val.x) / 2f), Mathf.Floor(((float)((Texture)fg).width - val.y) / 2f)); Texture2D val4 = new Texture2D((int)val.x, (int)val.y); for (int i = 0; (float)i < val.x; i++) { for (int j = 0; (float)j < val.y; j++) { val4.SetPixel(i, j, Over(Pixel(bg, (float)i + val2.x, (float)j + val2.y), Pixel(fg, (float)i + val3.x, (float)j + val3.y))); } } return Sprite.Create(val4, new Rect(0f, 0f, val.x, val.y), new Vector2(0.5f, 0.5f), 3f); } public static Color Pixel(Texture2D img, float x, float y) { //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_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_0044: Unknown result type (might be due to invalid IL or missing references) if (0f > x || x >= (float)((Texture)img).width || 0f > y || y >= (float)((Texture)img).height) { return TRANSPARENT; } return img.GetPixel((int)x, (int)y); } public static Color Over(Color bg, Color fg) { //IL_0001: 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_0014: 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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004a: 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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: 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) float num = bg.a * (1f - fg.a) + fg.a; return Color.op_Implicit((Color.op_Implicit(fg) * fg.a + Color.op_Implicit(bg) * bg.a * (1f - fg.a)) / num); } public static Sprite Load(params string[] path) { //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_0037: Expected O, but got Unknown //IL_005a: 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) Size dimensions = ImageHelper.GetDimensions(Path.Combine(path)); byte[] array = File.ReadAllBytes(Path.Combine(path)); Texture2D val = new Texture2D(dimensions.Width, dimensions.Height, (TextureFormat)3, false) { filterMode = (FilterMode)2 }; ImageConversion.LoadImage(val, array); return Sprite.Create(val, new Rect(0f, 0f, (float)dimensions.Width, (float)dimensions.Height), new Vector2(0.5f, 0.5f), 3f); } } } namespace MiscModpackUtils.Patches { public class AchievementLogbookOrder { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func<string, bool> <>9__2_1; public static hook_SortAchievements <>9__2_0; internal bool <Init>b__2_1(string x) { return !string.IsNullOrWhiteSpace(x); } internal void <Init>b__2_0(orig_SortAchievements orig, AchievementDef[] array) { orig.Invoke(array); List<AchievementDef> list = array.ToList(); string[] source = Overrides.ToArray(); using (IEnumerator<string> enumerator = source.Reverse().GetEnumerator()) { while (enumerator.MoveNext()) { AchievementDef item = list.Find(new <>c__DisplayClass2_0 { entry = enumerator.Current }.<Init>b__2); list.Remove(item); list.Insert(0, item); } } for (int i = 0; i < list.Count; i++) { array[i] = list[i]; } } } [CompilerGenerated] private sealed class <>c__DisplayClass2_0 { public string entry; internal bool <Init>b__2(AchievementDef x) { return x.nameToken.Trim().ToUpper() == entry; } } public static ConfigEntry<string> OverridesRaw; public static List<string> Overrides = new List<string>(); public static void Init() { //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Expected O, but got Unknown OverridesRaw = Main.Config.Bind<string>("Reordering", "Achievement Logbook Ordering", "", "achievement names, separated by commas. ones that does not appear on the list keeps its original ordering."); if (string.IsNullOrWhiteSpace(OverridesRaw.Value)) { return; } foreach (string item2 in from x in OverridesRaw.Value.Split(",") where !string.IsNullOrWhiteSpace(x) select x) { Overrides.Add(item2.Trim().ToUpper()); } object obj = <>c.<>9__2_0; if (obj == null) { hook_SortAchievements val = delegate(orig_SortAchievements orig, AchievementDef[] array) { orig.Invoke(array); List<AchievementDef> list = array.ToList(); string[] source = Overrides.ToArray(); foreach (string entry in source.Reverse()) { AchievementDef item = list.Find((AchievementDef x) => x.nameToken.Trim().ToUpper() == entry); list.Remove(item); list.Insert(0, item); } for (int i = 0; i < list.Count; i++) { array[i] = list[i]; } }; <>c.<>9__2_0 = val; obj = (object)val; } AchievementManager.SortAchievements += (hook_SortAchievements)obj; } } public class AddArtifactCodes { public static ConfigEntry<string> OverridesRaw; public static Dictionary<string, string> Overrides = new Dictionary<string, string>(); public static Sprite artifactBG; public static bool patched = false; public static Dictionary<char, int> Codes = new Dictionary<char, int> { { 'X', 11 }, { 'C', 1 }, { 'R', 7 }, { 'T', 3 }, { 'D', 5 }, { 'S', 4 }, { 'G', 15 } }; public static void Init() { OverridesRaw = Main.Config.Bind<string>("General", "Add Artifact Codes", "", "FROM=TO, artifact names to code. X = Empty, C = Circle, R = Rectangle, T = Triangle, D = Diamond, S = Star(SS2), G = Gene(GeneticsArtifact)"); if (string.IsNullOrWhiteSpace(OverridesRaw.Value)) { return; } foreach (string item in from x in OverridesRaw.Value.Split(",") where !string.IsNullOrWhiteSpace(x) select x) { string[] array = item.Split("="); if (array.Length != 2) { Main.Log.LogWarning((object)("Entry is malformed, skipping: " + item)); } else { Overrides.Add(array[0].Trim().ToUpper(), array[1].Trim().ToUpper()); } } AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Main.pluginInfo.Location), "miscmodpackutils")); artifactBG = val.LoadAsset<Sprite>("assets/artifactbg.png"); } public static void OnBasicallyEverythingLoaded() { //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Expected O, but got Unknown if (patched || string.IsNullOrWhiteSpace(OverridesRaw.Value)) { return; } List<ArtifactDef> list = ArtifactCatalog.artifactDefs.ToList(); foreach (string key in Overrides.Keys) { int num = list.FindIndex((ArtifactDef x) => x.nameToken.Trim().ToUpper() == key); if (num == -1) { Main.Log.LogWarning((object)("key " + key + " is not valid!")); continue; } UnlockableDef val = ScriptableObject.CreateInstance<UnlockableDef>(); val.cachedName = "Artifacts." + list[num].cachedName; list[num].unlockableDef = val; ContentAddition.AddUnlockableDef(val); AddCode(list[num], Overrides[key].Trim().ToUpper()); AchievementDef val2 = new AchievementDef(); val2.identifier = "ObtainArtifact" + list[num].cachedName; val2.unlockableRewardIdentifier = val.cachedName; val2.prerequisiteAchievementIdentifier = null; val2.nameToken = "ACHIEVEMENT_" + ("ObtainArtifact" + list[num].cachedName).ToUpper(CultureInfo.InvariantCulture) + "_NAME"; val2.descriptionToken = "ACHIEVEMENT_" + ("ObtainArtifact" + list[num].cachedName).ToUpper(CultureInfo.InvariantCulture) + "_DESCRIPTION"; val2.type = typeof(BaseAchievement); val2.serverTrackerType = null; val2.lunarCoinReward = 3u; AchievementDef achievement = val2; val.achievementIcon = Utils.GetComposite(artifactBG.texture, list[num].smallIconSelectedSprite.texture); achievement.SetAchievedIcon(val.achievementIcon); AchievementDef[] achievementDefs = AchievementManager.achievementDefs; int num2 = 0; AchievementDef[] array = (AchievementDef[])(object)new AchievementDef[1 + achievementDefs.Length]; ReadOnlySpan<AchievementDef> readOnlySpan = new ReadOnlySpan<AchievementDef>(achievementDefs); readOnlySpan.CopyTo(new Span<AchievementDef>(array).Slice(num2, readOnlySpan.Length)); num2 += readOnlySpan.Length; array[num2] = achievement; num2++; AchievementManager.achievementDefs = array; AchievementManager.achievementIdentifiers.Add(achievement.identifier); AchievementManager.achievementNamesToDefs.Add(achievement.identifier, achievement); val.getHowToUnlockString = () => Language.GetStringFormatted("UNLOCK_VIA_ACHIEVEMENT_FORMAT", new object[2] { Language.GetString(achievement.nameToken), Language.GetString(achievement.descriptionToken) }); val.getUnlockedString = () => Language.GetStringFormatted("UNLOCKED_FORMAT", new object[2] { Language.GetString(achievement.nameToken), Language.GetString(achievement.descriptionToken) }); } Main.Log.LogInfo((object)$"Added {Overrides.Keys.Count} artifact codes!"); patched = true; } public static void AddCode(ArtifactDef def, string code) { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) if (code == null || code.Length != 9) { Main.Log.LogWarning((object)("Artifact code is malformed: " + code + ", skipping")); return; } ArtifactCode val = ScriptableObject.CreateInstance<ArtifactCode>(); val.topRow = new Vector3Int(Codes[code[0]], Codes[code[1]], Codes[code[2]]); val.middleRow = new Vector3Int(Codes[code[3]], Codes[code[4]], Codes[code[5]]); val.bottomRow = new Vector3Int(Codes[code[6]], Codes[code[7]], Codes[code[8]]); ArtifactCodeAPI.AddCode(def, val); } } public class ArtifactOrder { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func<string, bool> <>9__2_1; public static Func<Instruction, bool> <>9__2_3; public static Manipulator <>9__2_0; internal bool <Init>b__2_1(string x) { return !string.IsNullOrWhiteSpace(x); } internal void <Init>b__2_0(ILContext il) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown <>c__DisplayClass2_0 CS$<>8__locals0 = new <>c__DisplayClass2_0 { idxs = new List<ArtifactIndex>() }; ILCursor val = new ILCursor(il); val.EmitDelegate<Action>((Action)delegate { //IL_0077: 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_00d4: Unknown result type (might be due to invalid IL or missing references) using (List<string>.Enumerator enumerator = Overrides.GetEnumerator()) { while (enumerator.MoveNext()) { <>c__DisplayClass2_1 CS$<>8__locals1 = new <>c__DisplayClass2_1 { entry = enumerator.Current }; int num = ArtifactCatalog.artifactDefs.ToList().FindIndex((ArtifactDef x) => x.nameToken.Trim().ToUpper() == CS$<>8__locals1.entry); if (num == -1) { Main.Log.LogWarning((object)("Entry " + CS$<>8__locals1.entry + " does not exist!")); } else { CS$<>8__locals0.idxs.Add(ArtifactCatalog.artifactDefs[num].artifactIndex); } } } ArtifactDef[] artifactDefs = ArtifactCatalog.artifactDefs; foreach (ArtifactDef val2 in artifactDefs) { if (!CS$<>8__locals0.idxs.Contains(val2.artifactIndex)) { CS$<>8__locals0.idxs.Add(val2.artifactIndex); } } }); val.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(RuleDef), "FromArtifact") }); val.EmitDelegate<Func<ArtifactIndex, ArtifactIndex>>((Func<ArtifactIndex, ArtifactIndex>)((ArtifactIndex i) => CS$<>8__locals0.idxs[(int)i])); } internal bool <Init>b__2_3(Instruction x) { return ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(RuleDef), "FromArtifact"); } } [CompilerGenerated] private sealed class <>c__DisplayClass2_0 { public List<ArtifactIndex> idxs; internal void <Init>b__2() { //IL_0077: 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_00d4: Unknown result type (might be due to invalid IL or missing references) using (List<string>.Enumerator enumerator = Overrides.GetEnumerator()) { while (enumerator.MoveNext()) { <>c__DisplayClass2_1 CS$<>8__locals0 = new <>c__DisplayClass2_1 { entry = enumerator.Current }; int num = ArtifactCatalog.artifactDefs.ToList().FindIndex((ArtifactDef x) => x.nameToken.Trim().ToUpper() == CS$<>8__locals0.entry); if (num == -1) { Main.Log.LogWarning((object)("Entry " + CS$<>8__locals0.entry + " does not exist!")); } else { idxs.Add(ArtifactCatalog.artifactDefs[num].artifactIndex); } } } ArtifactDef[] artifactDefs = ArtifactCatalog.artifactDefs; foreach (ArtifactDef val in artifactDefs) { if (!idxs.Contains(val.artifactIndex)) { idxs.Add(val.artifactIndex); } } } internal ArtifactIndex <Init>b__4(ArtifactIndex i) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected I4, but got Unknown //IL_0007: Unknown result type (might be due to invalid IL or missing references) return idxs[(int)i]; } } [CompilerGenerated] private sealed class <>c__DisplayClass2_1 { public string entry; internal bool <Init>b__5(ArtifactDef x) { return x.nameToken.Trim().ToUpper() == entry; } } public static ConfigEntry<string> OverridesRaw; public static List<string> Overrides = new List<string>(); public static void Init() { //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Expected O, but got Unknown OverridesRaw = Main.Config.Bind<string>("Reordering", "Artifact Ordering", "", "artifact names, separated by commas. ones that does not appear on the list keeps its original ordering."); if (string.IsNullOrWhiteSpace(OverridesRaw.Value)) { return; } foreach (string item in from x in OverridesRaw.Value.Split(",") where !string.IsNullOrWhiteSpace(x) select x) { Overrides.Add(item.Trim().ToUpper()); } object obj = <>c.<>9__2_0; if (obj == null) { Manipulator val = delegate(ILContext il) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown List<ArtifactIndex> idxs = new List<ArtifactIndex>(); ILCursor val2 = new ILCursor(il); val2.EmitDelegate<Action>((Action)delegate { //IL_0077: 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_00d4: Unknown result type (might be due to invalid IL or missing references) foreach (string entry in Overrides) { int num = ArtifactCatalog.artifactDefs.ToList().FindIndex((ArtifactDef x) => x.nameToken.Trim().ToUpper() == entry); if (num == -1) { Main.Log.LogWarning((object)("Entry " + entry + " does not exist!")); } else { idxs.Add(ArtifactCatalog.artifactDefs[num].artifactIndex); } } ArtifactDef[] artifactDefs = ArtifactCatalog.artifactDefs; foreach (ArtifactDef val3 in artifactDefs) { if (!idxs.Contains(val3.artifactIndex)) { idxs.Add(val3.artifactIndex); } } }); val2.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(RuleDef), "FromArtifact") }); val2.EmitDelegate<Func<ArtifactIndex, ArtifactIndex>>((Func<ArtifactIndex, ArtifactIndex>)((ArtifactIndex i) => idxs[(int)i])); }; <>c.<>9__2_0 = val; obj = (object)val; } RuleCatalog.Init += (Manipulator)obj; } } public class DifficultyOrder { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func<string, bool> <>9__2_1; public static hook_FromDifficulty <>9__2_0; internal bool <Init>b__2_1(string x) { return !string.IsNullOrWhiteSpace(x); } internal RuleDef <Init>b__2_0(orig_FromDifficulty orig) { RuleDef val = orig.Invoke(); List<string> list = Overrides.ToList(); list.Reverse(); using (List<string>.Enumerator enumerator = list.GetEnumerator()) { while (enumerator.MoveNext()) { <>c__DisplayClass2_0 CS$<>8__locals0 = new <>c__DisplayClass2_0 { entry = enumerator.Current }; int num = val.choices.FindIndex((RuleChoiceDef x) => DifficultyAPI.difficultyDefinitions[x.difficultyIndex]?.nameToken.Trim().ToUpper() == CS$<>8__locals0.entry); if (num == -1) { Main.Log.LogWarning((object)("Entry " + CS$<>8__locals0.entry + " does not exist!")); continue; } RuleChoiceDef item = val.choices[num]; val.choices.RemoveAt(num); val.choices.Insert(0, item); } } return val; } } [CompilerGenerated] private sealed class <>c__DisplayClass2_0 { public string entry; internal bool <Init>b__2(RuleChoiceDef x) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return DifficultyAPI.difficultyDefinitions[x.difficultyIndex]?.nameToken.Trim().ToUpper() == entry; } } public static ConfigEntry<string> OverridesRaw; public static List<string> Overrides = new List<string>(); public static void Init() { //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Expected O, but got Unknown OverridesRaw = Main.Config.Bind<string>("Reordering", "Difficulty Ordering", "", "difficulty names, separated by commas. ones that does not appear on the list keeps its original ordering."); if (string.IsNullOrWhiteSpace(OverridesRaw.Value)) { return; } foreach (string item2 in from x in OverridesRaw.Value.Split(",") where !string.IsNullOrWhiteSpace(x) select x) { Overrides.Add(item2.Trim().ToUpper()); } object obj = <>c.<>9__2_0; if (obj == null) { hook_FromDifficulty val = delegate(orig_FromDifficulty orig) { RuleDef val2 = orig.Invoke(); List<string> list = Overrides.ToList(); list.Reverse(); foreach (string entry in list) { int num = val2.choices.FindIndex((RuleChoiceDef x) => DifficultyAPI.difficultyDefinitions[x.difficultyIndex]?.nameToken.Trim().ToUpper() == entry); if (num == -1) { Main.Log.LogWarning((object)("Entry " + entry + " does not exist!")); } else { RuleChoiceDef item = val2.choices[num]; val2.choices.RemoveAt(num); val2.choices.Insert(0, item); } } return val2; }; <>c.<>9__2_0 = val; obj = (object)val; } RuleDef.FromDifficulty += (hook_FromDifficulty)obj; } } public class DroneLogbookOrder { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func<string, bool> <>9__2_1; public static Func<Entry, bool> <>9__2_2; public static hook_BuildDroneEntries <>9__2_0; internal bool <Init>b__2_1(string x) { return !string.IsNullOrWhiteSpace(x); } internal Entry[] <Init>b__2_0(orig_BuildDroneEntries orig, Dictionary<ExpansionDef, bool> self) { List<Entry> list = orig.Invoke(self).ToList(); string[] source = Overrides.ToArray(); using (IEnumerator<string> enumerator = source.Reverse().GetEnumerator()) { while (enumerator.MoveNext()) { Entry item = list.Find(new <>c__DisplayClass2_0 { entry = enumerator.Current }.<Init>b__3); list.Remove(item); list.Insert(0, item); } } return list.Where((Entry x) => x != null).ToArray(); } internal bool <Init>b__2_2(Entry x) { return x != null; } } [CompilerGenerated] private sealed class <>c__DisplayClass2_0 { public string entry; internal bool <Init>b__3(Entry x) { return x.nameToken.Trim().ToUpper() == entry; } } public static ConfigEntry<string> OverridesRaw; public static List<string> Overrides = new List<string>(); public static void Init() { //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Expected O, but got Unknown OverridesRaw = Main.Config.Bind<string>("Reordering", "Drone Logbook Ordering", "", "drone names, separated by commas. ones that does not appear on the list keeps its original ordering."); if (string.IsNullOrWhiteSpace(OverridesRaw.Value)) { return; } foreach (string item2 in from x in OverridesRaw.Value.Split(",") where !string.IsNullOrWhiteSpace(x) select x) { Overrides.Add(item2.Trim().ToUpper()); } object obj = <>c.<>9__2_0; if (obj == null) { hook_BuildDroneEntries val = delegate(orig_BuildDroneEntries orig, Dictionary<ExpansionDef, bool> self) { List<Entry> list = orig.Invoke(self).ToList(); string[] source = Overrides.ToArray(); foreach (string entry in source.Reverse()) { Entry item = list.Find((Entry x) => x.nameToken.Trim().ToUpper() == entry); list.Remove(item); list.Insert(0, item); } return list.Where((Entry x) => x != null).ToArray(); }; <>c.<>9__2_0 = val; obj = (object)val; } LogBookController.BuildDroneEntries += (hook_BuildDroneEntries)obj; } } public class EliteLookSwap { [HarmonyPatch(typeof(EliteRamp), "UpdateRampFromModel")] public class PatchR2API { public static void ILManipulator(ILContext il, MethodBase original, ILLabel retLabel) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown ILCursor val = new ILCursor(il); while (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterModel>(x, "myEliteIndex") })) { val.EmitDelegate<Func<EliteIndex, EliteIndex>>((Func<EliteIndex, EliteIndex>)delegate(EliteIndex idx) { //IL_0008: 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_0024: 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_0082: 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_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) EliteDef def = EliteCatalog.GetEliteDef(idx); if ((Object)(object)def == (Object)null) { return idx; } return Overrides.ContainsKey(((Object)def.eliteEquipmentDef).name.ToUpper()) ? (((IEnumerable<EquipmentDef>)EquipmentCatalog.equipmentDefs).FirstOrDefault((Func<EquipmentDef, bool>)((EquipmentDef x) => ((Object)x).name.ToUpper() == Overrides[((Object)def.eliteEquipmentDef).name.ToUpper()])) ?? def.eliteEquipmentDef).passiveBuffDef.eliteDef.eliteIndex : idx; }); } } } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func<string, bool> <>9__2_1; public static hook_SetEquipmentDisplay <>9__2_0; internal bool <Init>b__2_1(string x) { return !string.IsNullOrWhiteSpace(x); } internal void <Init>b__2_0(orig_SetEquipmentDisplay orig, CharacterModel self, EquipmentIndex idx) { //IL_0008: 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_0061: 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) <>c__DisplayClass2_0 CS$<>8__locals0 = new <>c__DisplayClass2_0 { def = EquipmentCatalog.GetEquipmentDef(idx) }; if ((Object)(object)CS$<>8__locals0.def != (Object)null && Overrides.ContainsKey(((Object)CS$<>8__locals0.def).name.ToUpper())) { EquipmentDef? obj = ((IEnumerable<EquipmentDef>)EquipmentCatalog.equipmentDefs).FirstOrDefault((Func<EquipmentDef, bool>)((EquipmentDef x) => ((Object)x).name.ToUpper() == Overrides[((Object)CS$<>8__locals0.def).name.ToUpper()])); orig.Invoke(self, (obj != null) ? obj.equipmentIndex : idx); } else { orig.Invoke(self, idx); } } } [CompilerGenerated] private sealed class <>c__DisplayClass2_0 { public EquipmentDef def; internal bool <Init>b__2(EquipmentDef x) { return ((Object)x).name.ToUpper() == Overrides[((Object)def).name.ToUpper()]; } } public static ConfigEntry<string> OverridesRaw; public static Dictionary<string, string> Overrides = new Dictionary<string, string>(); public static void Init() { //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Expected O, but got Unknown OverridesRaw = Main.Config.Bind<string>("Overrides", "Elite Look Swap", "", "FROM=TO, elite names, separated by commas. Elite ramp and crown from TO will be replaced with the one from FROM. see the log for list of valid input for your pack."); if (string.IsNullOrWhiteSpace(OverridesRaw.Value)) { return; } foreach (string item in from x in OverridesRaw.Value.Split(",") where !string.IsNullOrWhiteSpace(x) select x) { string[] array = item.Split("="); if (array.Length != 2) { Main.Log.LogWarning((object)("Entry is malformed, skipping: " + item)); } else { Overrides.Add(array[0].Trim().ToUpper(), array[1].Trim().ToUpper()); } } Main.Harmony.PatchAll(typeof(PatchR2API)); object obj = <>c.<>9__2_0; if (obj == null) { hook_SetEquipmentDisplay val = delegate(orig_SetEquipmentDisplay orig, CharacterModel self, EquipmentIndex idx) { //IL_0008: 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_0061: 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) EquipmentDef def = EquipmentCatalog.GetEquipmentDef(idx); if ((Object)(object)def != (Object)null && Overrides.ContainsKey(((Object)def).name.ToUpper())) { EquipmentDef? obj2 = ((IEnumerable<EquipmentDef>)EquipmentCatalog.equipmentDefs).FirstOrDefault((Func<EquipmentDef, bool>)((EquipmentDef x) => ((Object)x).name.ToUpper() == Overrides[((Object)def).name.ToUpper()])); orig.Invoke(self, (obj2 != null) ? obj2.equipmentIndex : idx); } else { orig.Invoke(self, idx); } }; <>c.<>9__2_0 = val; obj = (object)val; } CharacterModel.SetEquipmentDisplay += (hook_SetEquipmentDisplay)obj; } } public class EquipmentCooldown { public static ConfigEntry<string> OverridesRaw; public static Dictionary<string, float> Overrides = new Dictionary<string, float>(); public static bool patched = false; public static void Init() { OverridesRaw = Main.Config.Bind<string>("Overrides", "Equipment Cooldown Overrides", "", "FROM=TO, FROM equipment's cooldown will be set to TO in seconds."); } [SystemInitializer(new Type[] { typeof(EquipmentCatalog) })] public static void SI() { if (patched || string.IsNullOrWhiteSpace(OverridesRaw.Value)) { return; } foreach (string item in from x in OverridesRaw.Value.Split(",") where !string.IsNullOrWhiteSpace(x) select x) { string[] array = item.Split("="); if (array.Length != 2 || !float.TryParse(array[1], out var result)) { Main.Log.LogWarning((object)("Entry is malformed, skipping: " + item)); } else { Overrides.Add(array[0].Trim().ToUpper(), result); } } foreach (string key in Overrides.Keys) { EquipmentDef val = ((IEnumerable<EquipmentDef>)EquipmentCatalog.equipmentDefs).FirstOrDefault((Func<EquipmentDef, bool>)((EquipmentDef x) => x.nameToken.Trim().ToUpper() == key)); if ((Object)(object)val == (Object)null) { Main.Log.LogWarning((object)("Equipment " + key + " does not exist, skipping")); } else { val.cooldown = Overrides[key]; } } Main.Log.LogInfo((object)$"Patched {Overrides.Keys.Count} equipment cooldowns!"); patched = true; } } public class ItemAchievementSwap { public static ConfigEntry<string> OverridesRaw; public static Dictionary<string, string> Overrides = new Dictionary<string, string>(); public static bool patched = false; public static void Init() { OverridesRaw = Main.Config.Bind<string>("Overrides", "Item Achievement Override", "", "FROM=TO, item names to achievement name. also swaps icons."); if (string.IsNullOrWhiteSpace(OverridesRaw.Value)) { return; } foreach (string item in from x in OverridesRaw.Value.Split(",") where !string.IsNullOrWhiteSpace(x) select x) { string[] array = item.Split("="); if (array.Length != 2) { Main.Log.LogWarning((object)("Entry is malformed, skipping: " + item)); } else { Overrides.Add(array[0].Trim().ToUpper(), array[1].Trim().ToUpper()); } } } public static void OnBasicallyEverythingLoaded() { //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Invalid comparison between Unknown and I4 //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Invalid comparison between Unknown and I4 //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) if (patched || string.IsNullOrWhiteSpace(OverridesRaw.Value)) { return; } List<UnlockableDef> list = new List<UnlockableDef>(); List<UnlockableDef> list2 = UnlockableCatalog.indexToDefTable.ToList(); List<PickupDef> list3 = PickupCatalog.allPickups.ToList(); foreach (string key in Overrides.Keys) { int num = list3.FindIndex((PickupDef x) => x.nameToken.Trim().ToUpper() == key); if (num == -1) { Main.Log.LogWarning((object)("key " + key + " is not valid!")); continue; } PickupDef val = list3[num]; string text = val.nameToken.Trim().ToUpper(); num = list2.FindIndex((UnlockableDef x) => x.nameToken.Trim().ToUpper() == Overrides[key]); UnlockableDef val2 = (val.unlockableDef = ((num == -1) ? null : list2[num])); Sprite val3 = null; if ((int)val.itemIndex != -1) { ItemDef itemDef = ItemCatalog.GetItemDef(val.itemIndex); itemDef.unlockableDef = val2; Texture bgIconTexture = itemDef._itemTierDef.bgIconTexture; val3 = Utils.GetComposite((Texture2D)(object)((bgIconTexture is Texture2D) ? bgIconTexture : null), itemDef.pickupIconSprite.texture); } else { if ((int)val.equipmentIndex == -1) { Main.Log.LogWarning((object)("key " + key + " is not valid!")); continue; } EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef(val.equipmentIndex); equipmentDef.unlockableDef = val2; Texture bgIconTexture2 = equipmentDef.bgIconTexture; val3 = Utils.GetComposite((Texture2D)(object)((bgIconTexture2 is Texture2D) ? bgIconTexture2 : null), equipmentDef.pickupIconSprite.texture); } if (Object.op_Implicit((Object)(object)val2) && !list.Contains(val2) && AchievementManager.GetAchievementDef(val2.cachedName) != null) { list.Add(val2); AchievementDef achievementDef = AchievementManager.GetAchievementDef(val2.cachedName); achievementDef.SetAchievedIcon(val3); } } patched = true; } } public class ItemLookSwap { public static ConfigEntry<string> OverridesRaw; public static Dictionary<string, string> Overrides = new Dictionary<string, string>(); public static bool patched = false; public static void Init() { OverridesRaw = Main.Config.Bind<string>("Overrides", "Item Look Overrides", "", "FROM=TO, item name to another item name. swaps 1 item's pickup, icon and name with another."); if (string.IsNullOrWhiteSpace(OverridesRaw.Value)) { return; } foreach (string item in from x in OverridesRaw.Value.Split(",") where !string.IsNullOrWhiteSpace(x) select x) { string[] array = item.Split("="); if (array.Length != 2) { Main.Log.LogWarning((object)("Entry is malformed, skipping: " + item)); } else { Overrides.Add(array[0].Trim().ToUpper(), array[1].Trim().ToUpper()); } } } public static void OnBasicallyEverythingLoaded() { //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Invalid comparison between Unknown and I4 //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Invalid comparison between Unknown and I4 //IL_0114: 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_03ff: Unknown result type (might be due to invalid IL or missing references) //IL_0405: Invalid comparison between Unknown and I4 //IL_0487: Unknown result type (might be due to invalid IL or missing references) //IL_048d: Invalid comparison between Unknown and I4 //IL_041a: Unknown result type (might be due to invalid IL or missing references) //IL_04a2: Unknown result type (might be due to invalid IL or missing references) //IL_05cf: Unknown result type (might be due to invalid IL or missing references) //IL_05d5: Invalid comparison between Unknown and I4 //IL_0602: Unknown result type (might be due to invalid IL or missing references) //IL_0608: Invalid comparison between Unknown and I4 //IL_05e9: Unknown result type (might be due to invalid IL or missing references) //IL_061c: Unknown result type (might be due to invalid IL or missing references) if (patched || string.IsNullOrWhiteSpace(OverridesRaw.Value)) { return; } Dictionary<string, string> dictionary = new Dictionary<string, string>(); Dictionary<string, string> dictionary2 = new Dictionary<string, string>(); Dictionary<string, Sprite> dictionary3 = new Dictionary<string, Sprite>(); Dictionary<string, Texture> dictionary4 = new Dictionary<string, Texture>(); Dictionary<string, GameObject> dictionary5 = new Dictionary<string, GameObject>(); Dictionary<string, GameObject> dictionary6 = new Dictionary<string, GameObject>(); Dictionary<string, UnlockableDef> dictionary7 = new Dictionary<string, UnlockableDef>(); List<PickupDef> list = PickupCatalog.allPickups.ToList(); foreach (string key3 in Overrides.Keys) { int num = list.FindIndex((PickupDef x) => x.nameToken.Trim().ToUpper() == key3); if (num == -1) { Main.Log.LogWarning((object)("key " + key3 + " is not valid!")); continue; } string key4 = list[num].nameToken.Trim().ToUpper(); if ((int)list[num].itemIndex != -1) { ItemDef itemDef = ItemCatalog.GetItemDef(list[num].itemIndex); dictionary.Add(key4, itemDef.nameToken); dictionary2.Add(key4, itemDef.loreToken); dictionary3.Add(key4, itemDef.pickupIconSprite); dictionary4.Add(key4, itemDef.pickupIconTexture); dictionary5.Add(key4, itemDef.pickupModelPrefab); dictionary6.Add(key4, itemDef._itemTierDef?.dropletDisplayPrefab); } else { if ((int)list[num].equipmentIndex == -1) { Main.Log.LogWarning((object)("key " + key3 + " is not valid!")); continue; } EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef(list[num].equipmentIndex); dictionary.Add(key4, equipmentDef.nameToken); dictionary2.Add(key4, equipmentDef.loreToken); dictionary3.Add(key4, equipmentDef.pickupIconSprite); dictionary4.Add(key4, equipmentDef.pickupIconTexture); dictionary5.Add(key4, equipmentDef.pickupModelPrefab); dictionary6.Add(key4, EquipmentDef.dropletDisplayPrefab); } if (Object.op_Implicit((Object)(object)list[num].unlockableDef)) { dictionary7.Add(key4, list[num].unlockableDef); } } foreach (string key2 in Overrides.Keys) { int num2 = list.FindIndex((PickupDef x) => x.nameToken.Trim().ToUpper() == key2); if (num2 == -1) { continue; } string key5 = list[num2].nameToken.Trim().ToUpper(); num2 = list.FindIndex((PickupDef x) => x.nameToken.Trim().ToUpper() == Overrides[key2]); if (num2 == -1) { Main.Log.LogWarning((object)("key " + key2 + " is not valid!")); continue; } list[num2].nameToken = dictionary[key5]; list[num2].iconSprite = dictionary3[key5]; list[num2].iconTexture = dictionary4[key5]; list[num2].displayPrefab = dictionary5[key5]; list[num2].dropletDisplayPrefab = dictionary6[key5]; if (dictionary7.TryGetValue(key2, out var value)) { list[num2].unlockableDef = value; } else { list[num2].unlockableDef = null; } if ((int)list[num2].itemIndex != -1) { ItemDef itemDef2 = ItemCatalog.GetItemDef(list[num2].itemIndex); itemDef2.nameToken = dictionary[key5]; itemDef2.loreToken = dictionary2[key5]; itemDef2.pickupIconSprite = dictionary3[key5]; itemDef2.pickupModelPrefab = dictionary5[key5]; itemDef2.unlockableDef = list[num2].unlockableDef; } else if ((int)list[num2].equipmentIndex != -1) { EquipmentDef equipmentDef2 = EquipmentCatalog.GetEquipmentDef(list[num2].equipmentIndex); equipmentDef2.nameToken = dictionary[key5]; equipmentDef2.loreToken = dictionary2[key5]; equipmentDef2.pickupIconSprite = dictionary3[key5]; equipmentDef2.pickupModelPrefab = dictionary5[key5]; equipmentDef2.unlockableDef = list[num2].unlockableDef; } else { Main.Log.LogWarning((object)("key " + key2 + " is not valid!")); } } foreach (string key in Overrides.Keys) { if (Overrides.Values.Contains(key)) { continue; } int num3 = list.FindIndex((PickupDef x) => x.nameToken.Trim().ToUpper() == key); if (num3 != -1) { list[num3].unlockableDef = null; if ((int)list[num3].itemIndex != -1) { ItemCatalog.GetItemDef(list[num3].itemIndex).unlockableDef = null; } if ((int)list[num3].equipmentIndex != -1) { EquipmentCatalog.GetEquipmentDef(list[num3].equipmentIndex).unlockableDef = null; } } } patched = true; } } public class LanguageOverride { public static void Init() { string[] files = Directory.GetFiles(Paths.PluginPath, "*.overlaylanguage", SearchOption.AllDirectories); string[] files2 = Directory.GetFiles(Paths.ConfigPath, "*.overlaylanguage", SearchOption.AllDirectories); int num = 0; string[] array = new string[files.Length + files2.Length]; ReadOnlySpan<string> readOnlySpan = new ReadOnlySpan<string>(files); readOnlySpan.CopyTo(new Span<string>(array).Slice(num, readOnlySpan.Length)); num += readOnlySpan.Length; ReadOnlySpan<string> readOnlySpan2 = new ReadOnlySpan<string>(files2); readOnlySpan2.CopyTo(new Span<string>(array).Slice(num, readOnlySpan2.Length)); num += readOnlySpan2.Length; string[] array2 = array; string[] array3 = array2; foreach (string text in array3) { LanguageAPI.AddOverlayPath(text); } Main.Log.LogInfo((object)$"Added {array2.Length} .overlanguage files"); } } public class MainScreen { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static hook_OnEnter <>9__7_0; public static Converter<string, int> <>9__7_2; public static hook_Start <>9__7_1; public static Func<string, float> <>9__8_0; public static Func<string, float> <>9__9_0; public static Func<string, float> <>9__10_0; internal void <Init>b__7_0(orig_OnEnter orig, BaseMainMenuScreen self, MainMenuController mainMenuController) { //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_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: 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) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: 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_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: 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_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0215: 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_0240: Unknown result type (might be due to invalid IL or missing references) //IL_022c: 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_0277: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, mainMenuController); if (Override.Value) { GameObject val = GameObject.Find("LogoImage"); if ((Object)(object)val == (Object)null) { return; } val.transform.localPosition = new Vector3(0f, 20f, 0f); val.transform.localScale = new Vector3(1.5f, 1.5f, 1.5f); val.GetComponent<Image>().sprite = Utils.Load(Path.Combine(Paths.ConfigPath, "logo.png")); Main.Log.LogInfo((object)"Changed Logo Image"); } if ((Object)(object)mainMenuController.titleMenuScreen != (Object)null) { Main.Log.LogDebug((object)"Changing Title Camera"); Vector3 val2 = ToVector3(CameraPosition.Value); Vector3 val3 = ToVector3(CameraRotation.Value); if (val2 != new Vector3(0f, 1f, -10f)) { mainMenuController.titleMenuScreen.desiredCameraTransform.position = val2; } if (val3 != Vector3.zero) { mainMenuController.titleMenuScreen.desiredCameraTransform.eulerAngles = val3; } } GameObject val4 = GameObject.Find("GlobalPostProcessVolume"); if ((Object)(object)val4 == (Object)null) { return; } ColorGrading setting = val4.GetComponent<PostProcessVolume>().profile.GetSetting<ColorGrading>(); if ((Object)(object)setting != (Object)null) { Main.Log.LogDebug((object)"Changing PostProcessing"); Vector3 val5 = ToVector3(ColorHSV.Value); Vector4 val6 = ToVector4(ColorGain.Value); Vector2 val7 = ToVector2(ColorBC.Value); Vector4 val8 = val6 + new Vector4(val5.z, val5.z, val5.z, 0f); if (val8 != new Vector4(1f, 1f, 1f, 0f)) { ((ParameterOverride<Vector4>)(object)setting.gain).value = val8; ((ParameterOverride)setting.gain).overrideState = true; } if (val5.x != 0f) { ((ParameterOverride<float>)(object)setting.hueShift).value = val5.x; ((ParameterOverride)setting.hueShift).overrideState = true; } if (val5.y != -2.5f) { ((ParameterOverride<float>)(object)setting.saturation).value = val5.y; ((ParameterOverride)setting.saturation).overrideState = true; } if (val7.x != 0f) { ((ParameterOverride<float>)(object)setting.brightness).value = val7.x; ((ParameterOverride)setting.brightness).overrideState = true; } if (val7.y != 42.2f) { ((ParameterOverride<float>)(object)setting.contrast).value = val7.y; ((ParameterOverride)setting.contrast).overrideState = true; } } } internal void <Init>b__7_1(orig_Start orig, SteamBuildIdLabel self) { orig.Invoke(self); int[] array = "1.0.0".Split('.').ToList().ConvertAll((string x) => int.Parse(x)) .ToArray(); TextMeshProUGUI component = ((Component)self).GetComponent<TextMeshProUGUI>(); ((TMP_Text)component).text = ((TMP_Text)component).text + " " + VersionAddition.Value; } internal int <Init>b__7_2(string x) { return int.Parse(x); } internal float <ToVector2>b__8_0(string x) { return float.Parse(x.Trim()); } internal float <ToVector3>b__9_0(string x) { return float.Parse(x.Trim()); } internal float <ToVector4>b__10_0(string x) { return float.Parse(x.Trim()); } } public static ConfigEntry<bool> Override; public static ConfigEntry<string> CameraPosition; public static ConfigEntry<string> CameraRotation; public static ConfigEntry<string> ColorHSV; public static ConfigEntry<string> ColorGain; public static ConfigEntry<string> ColorBC; public static ConfigEntry<string> VersionAddition; public static void Init() { //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_00ee: 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 Override = Main.Config.Bind<bool>("Main Screen", "Enable Custom Logo", true, "change the logo at config/logo.png, then set this to true"); CameraPosition = Main.Config.Bind<string>("Main Screen", "Camera Position", "0, 1, -10", "RM: -20, 5, -10"); CameraRotation = Main.Config.Bind<string>("Main Screen", "Camera Rotation", "0, 0, 0", "RM: 348, 4, 357"); ColorHSV = Main.Config.Bind<string>("Main Screen", "Color HSV addition", "0, -2.5, 0", "RM: -200, 100, 0"); ColorGain = Main.Config.Bind<string>("Main Screen", "Color Gain addition", "1, 1, 1, 0", "RM: 1, 1, 1, 0"); ColorBC = Main.Config.Bind<string>("Main Screen", "Color Brightness/Contrast", "0, 42.2", "RM: 0, 150"); object obj = <>c.<>9__7_0; if (obj == null) { hook_OnEnter val = delegate(orig_OnEnter orig, BaseMainMenuScreen self, MainMenuController mainMenuController) { //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_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: 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) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: 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_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: 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_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0215: 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_0240: Unknown result type (might be due to invalid IL or missing references) //IL_022c: 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_0277: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, mainMenuController); if (Override.Value) { GameObject val3 = GameObject.Find("LogoImage"); if ((Object)(object)val3 == (Object)null) { return; } val3.transform.localPosition = new Vector3(0f, 20f, 0f); val3.transform.localScale = new Vector3(1.5f, 1.5f, 1.5f); val3.GetComponent<Image>().sprite = Utils.Load(Path.Combine(Paths.ConfigPath, "logo.png")); Main.Log.LogInfo((object)"Changed Logo Image"); } if ((Object)(object)mainMenuController.titleMenuScreen != (Object)null) { Main.Log.LogDebug((object)"Changing Title Camera"); Vector3 val4 = ToVector3(CameraPosition.Value); Vector3 val5 = ToVector3(CameraRotation.Value); if (val4 != new Vector3(0f, 1f, -10f)) { mainMenuController.titleMenuScreen.desiredCameraTransform.position = val4; } if (val5 != Vector3.zero) { mainMenuController.titleMenuScreen.desiredCameraTransform.eulerAngles = val5; } } GameObject val6 = GameObject.Find("GlobalPostProcessVolume"); if (!((Object)(object)val6 == (Object)null)) { ColorGrading setting = val6.GetComponent<PostProcessVolume>().profile.GetSetting<ColorGrading>(); if ((Object)(object)setting != (Object)null) { Main.Log.LogDebug((object)"Changing PostProcessing"); Vector3 val7 = ToVector3(ColorHSV.Value); Vector4 val8 = ToVector4(ColorGain.Value); Vector2 val9 = ToVector2(ColorBC.Value); Vector4 val10 = val8 + new Vector4(val7.z, val7.z, val7.z, 0f); if (val10 != new Vector4(1f, 1f, 1f, 0f)) { ((ParameterOverride<Vector4>)(object)setting.gain).value = val10; ((ParameterOverride)setting.gain).overrideState = true; } if (val7.x != 0f) { ((ParameterOverride<float>)(object)setting.hueShift).value = val7.x; ((ParameterOverride)setting.hueShift).overrideState = true; } if (val7.y != -2.5f) { ((ParameterOverride<float>)(object)setting.saturation).value = val7.y; ((ParameterOverride)setting.saturation).overrideState = true; } if (val9.x != 0f) { ((ParameterOverride<float>)(object)setting.brightness).value = val9.x; ((ParameterOverride)setting.brightness).overrideState = true; } if (val9.y != 42.2f) { ((ParameterOverride<float>)(object)setting.contrast).value = val9.y; ((ParameterOverride)setting.contrast).overrideState = true; } } } }; <>c.<>9__7_0 = val; obj = (object)val; } BaseMainMenuScreen.OnEnter += (hook_OnEnter)obj; VersionAddition = Main.Config.Bind<string>("Main Screen", "Version Suffix", "", "version text to add after the ror version."); if (string.IsNullOrWhiteSpace(VersionAddition.Value)) { return; } object obj2 = <>c.<>9__7_1; if (obj2 == null) { hook_Start val2 = delegate(orig_Start orig, SteamBuildIdLabel self) { orig.Invoke(self); int[] array = "1.0.0".Split('.').ToList().ConvertAll((string x) => int.Parse(x)) .ToArray(); TextMeshProUGUI component = ((Component)self).GetComponent<TextMeshProUGUI>(); ((TMP_Text)component).text = ((TMP_Text)component).text + " " + VersionAddition.Value; }; <>c.<>9__7_1 = val2; obj2 = (object)val2; } SteamBuildIdLabel.Start += (hook_Start)obj2; } public static Vector2 ToVector2(string raw) { //IL_0063: 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_006b: 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_0043: Unknown result type (might be due to invalid IL or missing references) try { float[] array = (from x in raw.Split(",") select float.Parse(x.Trim())).ToArray(); return new Vector2(array[0], array[1]); } catch { Main.Log.LogWarning((object)("Malformed config " + raw + "!")); return Vector2.zero; } } public static Vector3 ToVector3(string raw) { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_006e: 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) try { float[] array = (from x in raw.Split(",") select float.Parse(x.Trim())).ToArray(); return new Vector3(array[0], array[1], array[2]); } catch { Main.Log.LogWarning((object)("Malformed config " + raw + "!")); return Vector3.zero; } } public static Vector4 ToVector4(string raw) { //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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_0049: Unknown result type (might be due to invalid IL or missing references) try { float[] array = (from x in raw.Split(",") select float.Parse(x.Trim())).ToArray(); return new Vector4(array[0], array[1], array[2], array[3]); } catch { Main.Log.LogWarning((object)("Malformed config " + raw + "!")); return Vector4.zero; } } } public class MonsterLogbookOrder { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func<string, bool> <>9__2_1; public static Func<Entry, bool> <>9__2_2; public static hook_BuildMonsterEntries <>9__2_0; internal bool <Init>b__2_1(string x) { return !string.IsNullOrWhiteSpace(x); } internal Entry[] <Init>b__2_0(orig_BuildMonsterEntries orig, Dictionary<ExpansionDef, bool> self) { List<Entry> list = orig.Invoke(self).ToList(); string[] source = Overrides.ToArray(); using (IEnumerator<string> enumerator = source.Reverse().GetEnumerator()) { while (enumerator.MoveNext()) { Entry item = list.Find(new <>c__DisplayClass2_0 { entry = enumerator.Current }.<Init>b__3); list.Remove(item); list.Insert(0, item); } } return list.Where((Entry x) => x != null).ToArray(); } internal bool <Init>b__2_2(Entry x) { return x != null; } } [CompilerGenerated] private sealed class <>c__DisplayClass2_0 { public string entry; internal bool <Init>b__3(Entry x) { return x.nameToken.Trim().ToUpper() == entry; } } public static ConfigEntry<string> OverridesRaw; public static List<string> Overrides = new List<string>(); public static void Init() { //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Expected O, but got Unknown OverridesRaw = Main.Config.Bind<string>("Reordering", "Monster Logbook Ordering", "", "monster names, separated by commas. ones that does not appear on the list keeps its original ordering."); if (string.IsNullOrWhiteSpace(OverridesRaw.Value)) { return; } foreach (string item2 in from x in OverridesRaw.Value.Split(",") where !string.IsNullOrWhiteSpace(x) select x) { Overrides.Add(item2.Trim().ToUpper()); } object obj = <>c.<>9__2_0; if (obj == null) { hook_BuildMonsterEntries val = delegate(orig_BuildMonsterEntries orig, Dictionary<ExpansionDef, bool> self) { List<Entry> list = orig.Invoke(self).ToList(); string[] source = Overrides.ToArray(); foreach (string entry in source.Reverse()) { Entry item = list.Find((Entry x) => x.nameToken.Trim().ToUpper() == entry); list.Remove(item); list.Insert(0, item); } return list.Where((Entry x) => x != null).ToArray(); }; <>c.<>9__2_0 = val; obj = (object)val; } LogBookController.BuildMonsterEntries += (hook_BuildMonsterEntries)obj; } } public class PauseScreen { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func<string, bool> <>9__2_1; public static hook_Awake <>9__2_0; internal bool <Init>b__2_1(string x) { return !string.IsNullOrWhiteSpace(x); } internal void <Init>b__2_0(orig_Awake orig, PauseScreenController self) { orig.Invoke(self); Dictionary<string, Transform> dictionary = new Dictionary<string, Transform>(); Transform parent = ((Component)((Component)self).GetComponentInChildren<ButtonSkinController>()).gameObject.transform.parent; for (int i = 0; i < parent.childCount; i++) { Transform child = parent.GetChild(i); if (Object.op_Implicit((Object)(object)child) && ((Component)child).gameObject.activeSelf) { string text = ((TMP_Text)((Component)child).GetComponentInChildren<HGTextMeshProUGUI>()).text.Trim().ToUpper(); if (Overrides.Contains(text)) { dictionary.Add(text, child); } else { ((Component)child).gameObject.SetActive(false); } } } string[] array = Overrides.ToArray(); for (int j = 0; j < array.Length; j++) { dictionary[array[j]].SetSiblingIndex(j); } } } public static ConfigEntry<string> OverridesRaw; public static List<string> Overrides = new List<string>(); public static void Init() { //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Expected O, but got Unknown OverridesRaw = Main.Config.Bind<string>("Overrides", "Pause Menu Overrides", "", "the words written in pause menu, separated by commas. pause menu buttons are rearranged in that order and everything else is deleted."); if (string.IsNullOrWhiteSpace(OverridesRaw.Value)) { return; } foreach (string item in from x in OverridesRaw.Value.Split(",") where !string.IsNullOrWhiteSpace(x) select x) { Overrides.Add(item.Trim().ToUpper()); } object obj = <>c.<>9__2_0; if (obj == null) { hook_Awake val = delegate(orig_Awake orig, PauseScreenController self) { orig.Invoke(self); Dictionary<string, Transform> dictionary = new Dictionary<string, Transform>(); Transform parent = ((Component)((Component)self).GetComponentInChildren<ButtonSkinController>()).gameObject.transform.parent; for (int i = 0; i < parent.childCount; i++) { Transform child = parent.GetChild(i); if (Object.op_Implicit((Object)(object)child) && ((Component)child).gameObject.activeSelf) { string text = ((TMP_Text)((Component)child).GetComponentInChildren<HGTextMeshProUGUI>()).text.Trim().ToUpper(); if (Overrides.Contains(text)) { dictionary.Add(text, child); } else { ((Component)child).gameObject.SetActive(false); } } } string[] array = Overrides.ToArray(); for (int j = 0; j < array.Length; j++) { dictionary[array[j]].SetSiblingIndex(j); } }; <>c.<>9__2_0 = val; obj = (object)val; } PauseScreenController.Awake += (hook_Awake)obj; } } public class PickupLogbookOrder { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func<string, bool> <>9__2_1; public static Func<Entry, string> <>9__2_2; public static Func<Entry, bool> <>9__2_3; public static hook_BuildPickupEntries <>9__2_0; internal bool <Init>b__2_1(string x) { return !string.IsNullOrWhiteSpace(x); } internal Entry[] <Init>b__2_0(orig_BuildPickupEntries orig, Dictionary<ExpansionDef, bool> self) { List<Entry> list = orig.Invoke(self).ToList(); string[] source = Overrides.ToArray(); using (IEnumerator<string> enumerator = source.Reverse().GetEnumerator()) { while (enumerator.MoveNext()) { <>c__DisplayClass2_0 CS$<>8__locals0 = new <>c__DisplayClass2_0 { entry = enumerator.Current }; Main.Log.LogInfo((object)("adding:" + CS$<>8__locals0.entry)); Entry item = list.Find((Entry x) => x.nameToken.Trim().ToUpper() == CS$<>8__locals0.entry); list.Remove(item); list.Insert(0, item); } } Main.Log.LogInfo((object)GeneralExtensions.Join<string>(list.Select((Entry x) => x.nameToken), (Func<string, string>)null, ", ")); return list.Where((Entry x) => x != null).ToArray(); } internal string <Init>b__2_2(Entry x) { return x.nameToken; } internal bool <Init>b__2_3(Entry x) { return x != null; } } [CompilerGenerated] private sealed class <>c__DisplayClass2_0 { public string entry; internal bool <Init>b__4(Entry x) { return x.nameToken.Trim().ToUpper() == entry; } } public static ConfigEntry<string> OverridesRaw; public static List<string> Overrides = new List<string>(); public static void Init() { //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Expected O, but got Unknown OverridesRaw = Main.Config.Bind<string>("Reordering", "Pickup Logbook Ordering", "", "achievement names, separated by commas. ones that does not appear on the list keeps its original ordering."); if (string.IsNullOrWhiteSpace(OverridesRaw.Value)) { return; } foreach (string item2 in from x in OverridesRaw.Value.Split(",") where !string.IsNullOrWhiteSpace(x) select x) { Overrides.Add(item2.Trim().ToUpper()); } object obj = <>c.<>9__2_0; if (obj == null) { hook_BuildPickupEntries val = delegate(orig_BuildPickupEntries orig, Dictionary<ExpansionDef, bool> self) { List<Entry> list = orig.Invoke(self).ToList(); string[] source = Overrides.ToArray(); foreach (string entry in source.Reverse()) { Main.Log.LogInfo((object)("adding:" + entry)); Entry item = list.Find((Entry x) => x.nameToken.Trim().ToUpper() == entry); list.Remove(item); list.Insert(0, item); } Main.Log.LogInfo((object)GeneralExtensions.Join<string>(list.Select((Entry x) => x.nameToken), (Func<string, string>)null, ", ")); return list.Where((Entry x) => x != null).ToArray(); }; <>c.<>9__2_0 = val; obj = (object)val; } LogBookController.BuildPickupEntries += (hook_BuildPickupEntries)obj; } } public class SkillAchievementSwap { public static ConfigEntry<string> OverridesRaw; public static Dictionary<string, string> Overrides = new Dictionary<string, string>(); public static bool patched = false; public static void Init() { OverridesRaw = Main.Config.Bind<string>("Overrides", "Skill Achievement Override", "", "FROM=TO, skill or skin to achievement name. also swaps icons."); if (string.IsNullOrWhiteSpace(OverridesRaw.Value)) { return; } foreach (string item in from x in OverridesRaw.Value.Split(",") where !string.IsNullOrWhiteSpace(x) select x) { string[] array = item.Split("="); if (array.Length != 2) { Main.Log.LogWarning((object)("Entry is malformed, skipping: " + item)); } else { Overrides.Add(array[0].Trim().ToUpper(), array[1].Trim().ToUpper()); } } } public static void OnBasicallyEverythingLoaded() { if (patched || string.IsNullOrWhiteSpace(OverridesRaw.Value)) { return; } List<UnlockableDef> list = new List<UnlockableDef>(); List<UnlockableDef> list2 = UnlockableCatalog.indexToDefTable.ToList(); List<SkillFamily> list3 = SkillCatalog.allSkillFamilies.ToList(); List<SkinDef> list4 = SkinCatalog.allSkinDefs.ToList(); foreach (string key in Overrides.Keys) { int num = list2.FindIndex((UnlockableDef x) => x.nameToken.Trim().ToUpper() == Overrides[key]); UnlockableDef val = ((num == -1) ? null : list2[num]); SkillFamily val2 = null; SkinDef val3 = null; num = list3.FindIndex((SkillFamily x) => x.variants.Any((Variant y) => y.skillDef.skillNameToken.Trim().ToUpper() == key)); if (num != -1) { val2 = list3[num]; } num = list4.FindIndex((SkinDef x) => x.nameToken.Trim().ToUpper() == key); if (num != -1) { val3 = list4[num]; } if (!Object.op_Implicit((Object)(object)val2) && !Object.op_Implicit((Object)(object)val3)) { Main.Log.LogWarning((object)("key " + key + " is not valid!")); continue; } Sprite val4 = null; if (Object.op_Implicit((Object)(object)val2)) { num = val2.variants.ToList().FindIndex((Variant x) => x.skillDef.skillNameToken.Trim().ToUpper() == key); val2.variants[num].unlockableDef = val; val2.variants[num].unlockableName = ((val != null) ? val.cachedName : null) ?? ""; val4 = val2.variants[num].skillDef.icon; } if (Object.op_Implicit((Object)(object)val3)) { val3.unlockableDef = val; val3.unlockableName = ((val != null) ? val.cachedName : null) ?? ""; val4 = val3.icon; if (Object.op_Implicit((Object)(object)val) && !list.Contains(val) && AchievementManager.GetAchievementDef(val.cachedName) != null) { list.Add(val); AchievementDef achievementDef = AchievementManager.GetAchievementDef(val.cachedName); achievementDef.SetAchievedIcon(val4); } } else { Main.Log.LogWarning((object)("key " + key + " is not valid!")); } } patched = true; } } public class SkillOrder { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func<string, bool> <>9__2_2; public static Func<Variant, string> <>9__2_3; public static hook_FromSkillSlot <>9__2_0; public static Func<SkinDef, string> <>9__2_4; public static hook_FromSkin <>9__2_1; internal bool <Init>b__2_2(string x) { return !string.IsNullOrWhiteSpace(x); } internal Row <Init>b__2_0(orig_FromSkillSlot orig, LoadoutPanelController owner, BodyIndex bodyIndex, int skillSlotIndex, GenericSkill skillSlot) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) Row ret = orig.Invoke(owner, bodyIndex, skillSlotIndex, skillSlot); List<string> names = skillSlot.skillFamily.variants.Select((Variant x) => x.skillDef.skillNameToken).ToList(); return TransformRow(ret, Overrides.ToArray().Reverse(), names); } internal string <Init>b__2_3(Variant x) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return x.skillDef.skillNameToken; } internal Row <Init>b__2_1(orig_FromSkin orig, LoadoutPanelController owner, BodyIndex bodyIndex) { //IL_0003: 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) Row ret = orig.Invoke(owner, bodyIndex); List<string> names = (from x in SkinCatalog.GetBodySkinDefs(bodyIndex) select x.nameToken).ToList(); return TransformRow(ret, Overrides.ToArray().Reverse(), names); } internal string <Init>b__2_4(SkinDef x) { return x.nameToken; } } public static ConfigEntry<string> OverridesRaw; public static List<string> Overrides = new List<string>(); public static void Init() { //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Expected O, but got Unknown //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_00f4: Expected O, but got Unknown OverridesRaw = Main.Config.Bind<string>("Reordering", "Skill Ordering", "", "skill names, separated by commas. ones that does not appear on the list keeps its original ordering."); if (string.IsNullOrWhiteSpace(OverridesRaw.Value)) { return; } foreach (string item in from x in OverridesRaw.Value.Split(",") where !string.IsNullOrWhiteSpace(x) select x) { Overrides.Add(item.Trim().ToUpper()); } object obj = <>c.<>9__2_0; if (obj == null) { hook_FromSkillSlot val = delegate(orig_FromSkillSlot orig, LoadoutPanelController owner, BodyIndex bodyIndex, int skillSlotIndex, GenericSkill skillSlot) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) Row ret2 = orig.Invoke(owner, bodyIndex, skillSlotIndex, skillSlot); List<string> names2 = skillSlot.skillFamily.variants.Select((Variant x) => x.skillDef.skillNameToken).ToList(); return TransformRow(ret2, Overrides.ToArray().Reverse(), names2); }; <>c.<>9__2_0 = val; obj = (object)val; } Row.FromSkillSlot += (hook_FromSkillSlot)obj; object obj2 = <>c.<>9__2_1; if (obj2 == null) { hook_FromSkin val2 = delegate(orig_FromSkin orig, LoadoutPanelController owner, BodyIndex bodyIndex) { //IL_0003: 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) Row ret = orig.Invoke(owner, bodyIndex); List<string> names = (from x in SkinCatalog.GetBodySkinDefs(bodyIndex) select x.nameToken).ToList(); return TransformRow(ret, Overrides.ToArray().Reverse(), names); }; <>c.<>9__2_1 = val2; obj2 = (object)val2; } Row.FromSkin += (hook_FromSkin)obj2; } public static Row TransformRow(Row ret, IEnumerable<string> overrides, List<string> names) { //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_0055: 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_006a: Unknown result type (might be due to invalid IL or missing references) foreach (string @override in overrides) { int idx = names.IndexOf(@override); if (idx != -1) { RowData val = ret.rowData.Find((RowData x) => x.defIndex == idx); ret.rowData.Remove(val); ret.rowData.Insert(0, val); ((Component)val.button).transform.SetAsFirstSibling(); } } return ret; } } public class StageLogbookOrder { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func<string, bool> <>9__2_1; public static Func<Entry, bool> <>9__2_2; public static hook_BuildStageEntries <>9__2_0; internal bool <Init>b__2_1(string x) { return !string.IsNullOrWhiteSpace(x); } internal Entry[] <Init>b__2_0(orig_BuildStageEntries orig, Dictionary<ExpansionDef, bool> self) { List<Entry> list = orig.Invoke(self).ToList(); string[] source = Overrides.ToArray(); using (IEnumerator<string> enumerator = source.Reverse().GetEnumerator()) { while (enumerator.MoveNext()) { Entry item = list.Find(new <>c__DisplayClass2_0 { entry = enumerator.Current }.<Init>b__3); list.Remove(item); list.Insert(0, item); } } return list.Where((Entry x) => x != null).ToArray(); } internal bool <Init>b__2_2(Entry x) { return x != null; } } [CompilerGenerated] private sealed class <>c__DisplayClass2_0 { public string entry; internal bool <Init>b__3(Entry x) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return ((SceneDef)x.extraData).cachedName.Trim().ToUpper() == entry; } } public static ConfigEntry<string> OverridesRaw; public static List<string> Overrides = new List<string>(); public static void Init() { //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Expected O, but got Unknown OverridesRaw = Main.Config.Bind<string>("Reordering", "Stage Logbook Ordering", "", "stage names, separated by commas. ones that does not appear on the list keeps its original ordering."); if (string.IsNullOrWhiteSpace(OverridesRaw.Value)) { return; } foreach (string item2 in from x in OverridesRaw.Value.Split(",") where !string.IsNullOrWhiteSpace(x) select x) { Overrides.Add(item2.Trim().ToUpper()); } object obj = <>c.<>9__2_0; if (obj == null) { hook_BuildStageEntries val = delegate(orig_BuildStageEntries orig, Dictionary<ExpansionDef, bool> self) { List<Entry> list = orig.Invoke(self).ToList(); string[] source = Overrides.ToArray(); foreach (string entry in source.Reverse()) { Entry item = list.Find((Entry x) => ((SceneDef)x.extraData).cachedName.Trim().ToUpper() == entry); list.Remove(item); list.Insert(0, item); } return list.Where((Entry x) => x != null).ToArray(); }; <>c.<>9__2_0 = val; obj = (object)val; } LogBookController.BuildStageEntries += (hook_BuildStageEntries)obj; } } public class SurvivorLogbookOrder { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func<string, bool> <>9__2_1; public static Func<Entry, bool> <>9__2_2; public static hook_BuildSurvivorEntries <>9__2_0; internal bool <Init>b__2_1(string x) { return !string.IsNullOrWhiteSpace(x); } internal Entry[] <Init>b__2_0(orig_BuildSurvivorEntries orig, Dictionary<ExpansionDef, bool> self) { List<Entry> list = orig.Invoke(self).ToList(); string[] source = Overrides.ToArray(); using (IEnumerator<string> enumerator = source.Reverse().GetEnumerator()) { while (enumerator.MoveNext()) { Entry item = list.Find(new <>c__DisplayClass2_0 { entry = enumerator.Current }.<Init>b__3); list.Remove(item); list.Insert(0, item); } } return list.Where((Entry x) => x != null).ToArray(); } internal bool <Init>b__2_2(Entry x) { return x != null; } } [CompilerGenerated] private sealed class <>c__DisplayClass2_0 { public string entry; internal bool <Init>b__3(Entry x) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) return SurvivorCatalog.GetSurvivorDef(SurvivorCatalog.GetSurvivorIndexFromBodyIndex(((CharacterBody)x.extraData).bodyIndex)).cachedName.Trim().ToUpper() == entry; } } public static ConfigEntry<string> OverridesRaw; public static List<string> Overrides = new List<string>(); public static void Init() { //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Expected O, but got Unknown OverridesRaw = Main.Config.Bind<string>("Reordering", "Survivor Logbook Ordering", "", "survivor names, separated by commas. ones that does not appear on the list keeps its original ordering."); if (string.IsNullOrWhiteSpace(OverridesRaw.Value)) { return; } foreach (string item2 in from x in OverridesRaw.Value.Split(",") where !string.IsNullOrWhiteSpace(x) select x) { Overrides.Add(item2.Trim().ToUpper()); } object obj = <>c.<>9__2_0; if (obj == null) { hook_BuildSurvivorEntries val = delegate(orig_BuildSurvivorEntries orig, Dictionary<ExpansionDef, bool> self) { List<Entry> list = orig.Invoke(self).ToList(); string[] source = Overrides.ToArray(); foreach (string entry in source.Reverse()) { Entry item = list.Find((Entry x) => SurvivorCatalog.GetSurvivorDef(SurvivorCatalog.GetSurvivorIndexFromBodyIndex(((CharacterBody)x.extraData).bodyIndex)).cachedName.Trim().ToUpper() == entry); list.Remove(item); list.Insert(0, item); } return list.Where((Entry x) => x != null).ToArray(); }; <>c.<>9__2_0 = val; obj = (object)val; } LogBookController.BuildSurvivorEntries += (hook_BuildSurvivorEntries)obj; } } }