Decompiled source of MiscModpackUtils v1.0.1

MiscModpackUtils.dll

Decompiled 4 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
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 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.AddressableAssets;
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+26de3fe9940fbb619231fd345ee9e61c5ae4b700")]
[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
{
	[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();
			SkillOrder.Init();
			PickupLogbookOrder.Init();
			MonsterLogbookOrder.Init();
			StageLogbookOrder.Init();
			SurvivorLogbookOrder.Init();
			AchievementLogbookOrder.Init();
			PauseScreen.Init();
			MainScreen.Init();
			AddArtifactCodes.Init();
			RMTemp.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_0239: Unknown result type (might be due to invalid IL or missing references)
				//IL_02ce: 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(", ", SkillCatalog.allSkillFamilies.Select((SkillFamily x) => string.Join(", ", x.variants.Select((Variant x) => x.skillDef.skillNameToken))))));
					Log.LogInfo((object)("Skins: " + string.Join(", ", SkinCatalog.allSkinDefs.Select((SkinDef 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)("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);
		}
	}
}
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_SetUnlockableDefs <>9__2_0;

			internal bool <Init>b__2_1(string x)
			{
				return !string.IsNullOrWhiteSpace(x);
			}

			internal void <Init>b__2_0(orig_SetUnlockableDefs orig, UnlockableDef[] unlockableDefs)
			{
				orig.Invoke(unlockableDefs);
				for (int i = 0; i < UnlockableCatalog.unlockableCount; i++)
				{
					UnlockableDef unlockableDef = UnlockableCatalog.GetUnlockableDef((UnlockableIndex)i);
					int num = Overrides.IndexOf(unlockableDef.nameToken.Trim().ToUpper());
					if (num != -1)
					{
						unlockableDef.sortScore = num;
					}
				}
			}
		}

		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 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_SetUnlockableDefs val = delegate(orig_SetUnlockableDefs orig, UnlockableDef[] unlockableDefs)
				{
					orig.Invoke(unlockableDefs);
					for (int i = 0; i < UnlockableCatalog.unlockableCount; i++)
					{
						UnlockableDef unlockableDef = UnlockableCatalog.GetUnlockableDef((UnlockableIndex)i);
						int num = Overrides.IndexOf(unlockableDef.nameToken.Trim().ToUpper());
						if (num != -1)
						{
							unlockableDef.sortScore = num;
						}
					}
				};
				<>c.<>9__2_0 = val;
				obj = (object)val;
			}
			UnlockableCatalog.SetUnlockableDefs += (hook_SetUnlockableDefs)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 EliteLookSwap
	{
		[HarmonyPatch]
		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;
					});
				}
			}

			public static MethodBase TargetMethod()
			{
				return AccessTools.GetDeclaredMethods(typeof(EliteRamp)).Find((MethodInfo x) => x.Name.StartsWith("<UpdateRampProperly>g"));
			}
		}

		[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__1_0;

			internal void <Init>b__1_0(orig_OnEnter orig, BaseMainMenuScreen self, MainMenuController mainMenuController)
			{
				//IL_003a: 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_0071: Unknown result type (might be due to invalid IL or missing references)
				//IL_0077: Expected O, but got Unknown
				//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
				orig.Invoke(self, mainMenuController);
				GameObject val = GameObject.Find("LogoImage");
				if (!((Object)(object)val == (Object)null))
				{
					val.transform.localPosition = new Vector3(0f, 20f, 0f);
					val.transform.localScale = new Vector3(1.5f, 1.5f, 1.5f);
					Texture2D val2 = new Texture2D(1589, 964, (TextureFormat)3, false);
					((Texture)val2).filterMode = (FilterMode)2;
					ImageConversion.LoadImage(val2, File.ReadAllBytes(Path.Combine(Paths.ConfigPath, "logo.png")));
					val.GetComponent<Image>().sprite = Sprite.Create(val2, new Rect(0f, 0f, 1589f, 964f), new Vector2(0.5f, 0.5f), 3f);
					Main.Log.LogInfo((object)"Changed Logo Image");
				}
			}
		}

		public static ConfigEntry<bool> Override;

		public static void Init()
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Expected O, but got Unknown
			Override = Main.Config.Bind<bool>("General", "Enable Custom Logo", false, "change the logo at config/logo.png, then set this to true");
			if (!Override.Value)
			{
				return;
			}
			object obj = <>c.<>9__1_0;
			if (obj == null)
			{
				hook_OnEnter val = delegate(orig_OnEnter orig, BaseMainMenuScreen self, MainMenuController mainMenuController)
				{
					//IL_003a: 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_0071: Unknown result type (might be due to invalid IL or missing references)
					//IL_0077: Expected O, but got Unknown
					//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
					//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
					orig.Invoke(self, mainMenuController);
					GameObject val2 = GameObject.Find("LogoImage");
					if (!((Object)(object)val2 == (Object)null))
					{
						val2.transform.localPosition = new Vector3(0f, 20f, 0f);
						val2.transform.localScale = new Vector3(1.5f, 1.5f, 1.5f);
						Texture2D val3 = new Texture2D(1589, 964, (TextureFormat)3, false);
						((Texture)val3).filterMode = (FilterMode)2;
						ImageConversion.LoadImage(val3, File.ReadAllBytes(Path.Combine(Paths.ConfigPath, "logo.png")));
						val2.GetComponent<Image>().sprite = Sprite.Create(val3, new Rect(0f, 0f, 1589f, 964f), new Vector2(0.5f, 0.5f), 3f);
						Main.Log.LogInfo((object)"Changed Logo Image");
					}
				};
				<>c.<>9__1_0 = val;
				obj = (object)val;
			}
			BaseMainMenuScreen.OnEnter += (hook_OnEnter)obj;
		}
	}
	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 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[] array = Overrides.ToArray();
				string[] array2 = array;
				for (int i = 0; i < array2.Length; i++)
				{
					Entry item = list.Find(new <>c__DisplayClass2_0
					{
						entry = array2[i]
					}.<Init>b__2);
					list.Remove(item);
					list.Insert(0, item);
				}
				return list.ToArray();
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass2_0
		{
			public string entry;

			internal bool <Init>b__2(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[] array = Overrides.ToArray();
					string[] array2 = array;
					foreach (string entry in array2)
					{
						Entry item = list.Find((Entry x) => x.nameToken.Trim().ToUpper() == entry);
						list.Remove(item);
						list.Insert(0, item);
					}
					return list.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();
				string[] array2 = array;
				foreach (string key in array2)
				{
					dictionary[key].SetAsFirstSibling();
				}
			}
		}

		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();
					string[] array2 = array;
					foreach (string key in array2)
					{
						dictionary[key].SetAsFirstSibling();
					}
				};
				<>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 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[] array = Overrides.ToArray();
				string[] array2 = array;
				for (int i = 0; i < array2.Length; i++)
				{
					Entry item = list.Find(new <>c__DisplayClass2_0
					{
						entry = array2[i]
					}.<Init>b__2);
					list.Remove(item);
					list.Insert(0, item);
				}
				return list.ToArray();
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass2_0
		{
			public string entry;

			internal bool <Init>b__2(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[] array = Overrides.ToArray();
					string[] array2 = array;
					foreach (string entry in array2)
					{
						Entry item = list.Find((Entry x) => x.nameToken.Trim().ToUpper() == entry);
						list.Remove(item);
						list.Insert(0, item);
					}
					return list.ToArray();
				};
				<>c.<>9__2_0 = val;
				obj = (object)val;
			}
			LogBookController.BuildPickupEntries += (hook_BuildPickupEntries)obj;
		}
	}
	public class RMTemp
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_OnEnter <>9__0_0;

			public static Converter<string, int> <>9__0_2;

			public static hook_Start <>9__0_1;

			internal void <Init>b__0_0(orig_OnEnter orig, BaseMainMenuScreen self, MainMenuController mainMenuController)
			{
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				//IL_006f: Unknown result type (might be due to invalid IL or missing references)
				//IL_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)
				orig.Invoke(self, mainMenuController);
				if ((Object)(object)mainMenuController.titleMenuScreen != (Object)null)
				{
					Main.Log.LogDebug((object)"Changing Title Camera");
					mainMenuController.titleMenuScreen.desiredCameraTransform.position = new Vector3(-20f, 5f, -10f);
					mainMenuController.titleMenuScreen.desiredCameraTransform.rotation = new Quaternion(-0.104f, 0.13f, -0.014f, 0.986f);
				}
				GameObject val = GameObject.Find("GlobalPostProcessVolume");
				if (!((Object)(object)val == (Object)null))
				{
					ColorGrading setting = val.GetComponent<PostProcessVolume>().profile.GetSetting<ColorGrading>();
					if ((Object)(object)setting != (Object)null)
					{
						Main.Log.LogDebug((object)"Changing PostProcessing");
						((ParameterOverride<Vector4>)(object)setting.gain).value = new Vector4(1f, 1f, 1f, 0f);
						((ParameterOverride)setting.gain).overrideState = true;
						((ParameterOverride<float>)(object)setting.hueShift).value = -200f;
						((ParameterOverride)setting.hueShift).overrideState = true;
						((ParameterOverride<float>)(object)setting.saturation).value = 100f;
						((ParameterOverride)setting.saturation).overrideState = true;
						((ParameterOverride<float>)(object)setting.contrast).value = 150f;
						((ParameterOverride)setting.contrast).overrideState = true;
					}
				}
			}

			internal void <Init>b__0_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 + " <style=cIsDamage>+ RM 2.0 Pre-Release Candidate 1</style>";
			}

			internal int <Init>b__0_2(string x)
			{
				return int.Parse(x);
			}
		}

		public static void Init()
		{
			//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_0044: Expected O, but got Unknown
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Expected O, but got Unknown
			if (!Main.Config.Bind<bool>("General", "Enable RM", false, "will be moved to rmbase in next version probably").Value)
			{
				return;
			}
			object obj = <>c.<>9__0_0;
			if (obj == null)
			{
				hook_OnEnter val = delegate(orig_OnEnter orig, BaseMainMenuScreen self, MainMenuController mainMenuController)
				{
					//IL_0045: Unknown result type (might be due to invalid IL or missing references)
					//IL_006f: Unknown result type (might be due to invalid IL or missing references)
					//IL_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)
					orig.Invoke(self, mainMenuController);
					if ((Object)(object)mainMenuController.titleMenuScreen != (Object)null)
					{
						Main.Log.LogDebug((object)"Changing Title Camera");
						mainMenuController.titleMenuScreen.desiredCameraTransform.position = new Vector3(-20f, 5f, -10f);
						mainMenuController.titleMenuScreen.desiredCameraTransform.rotation = new Quaternion(-0.104f, 0.13f, -0.014f, 0.986f);
					}
					GameObject val3 = GameObject.Find("GlobalPostProcessVolume");
					if (!((Object)(object)val3 == (Object)null))
					{
						ColorGrading setting = val3.GetComponent<PostProcessVolume>().profile.GetSetting<ColorGrading>();
						if ((Object)(object)setting != (Object)null)
						{
							Main.Log.LogDebug((object)"Changing PostProcessing");
							((ParameterOverride<Vector4>)(object)setting.gain).value = new Vector4(1f, 1f, 1f, 0f);
							((ParameterOverride)setting.gain).overrideState = true;
							((ParameterOverride<float>)(object)setting.hueShift).value = -200f;
							((ParameterOverride)setting.hueShift).overrideState = true;
							((ParameterOverride<float>)(object)setting.saturation).value = 100f;
							((ParameterOverride)setting.saturation).overrideState = true;
							((ParameterOverride<float>)(object)setting.contrast).value = 150f;
							((ParameterOverride)setting.contrast).overrideState = true;
						}
					}
				};
				<>c.<>9__0_0 = val;
				obj = (object)val;
			}
			BaseMainMenuScreen.OnEnter += (hook_OnEnter)obj;
			object obj2 = <>c.<>9__0_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 + " <style=cIsDamage>+ RM 2.0 Pre-Release Candidate 1</style>";
				};
				<>c.<>9__0_1 = val2;
				obj2 = (object)val2;
			}
			SteamBuildIdLabel.Start += (hook_Start)obj2;
		}
	}
	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
	{
		public static ConfigEntry<string> OverridesRaw;

		public static List<string> Overrides = new List<string>();

		public static void Init()
		{
			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 item2 in from x in OverridesRaw.Value.Split(",")
				where !string.IsNullOrWhiteSpace(x)
				select x)
			{
				Overrides.Add(item2.Trim().ToUpper());
			}
			RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, (Action)delegate
			{
				//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_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_004d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0050: Invalid comparison between Unknown and I4
				//IL_005d: Unknown result type (might be due to invalid IL or missing references)
				//IL_063c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0641: Unknown result type (might be due to invalid IL or missing references)
				//IL_0643: Unknown result type (might be due to invalid IL or missing references)
				//IL_0743: Unknown result type (might be due to invalid IL or missing references)
				//IL_0752: Unknown result type (might be due to invalid IL or missing references)
				//IL_0151: Unknown result type (might be due to invalid IL or missing references)
				//IL_0156: Unknown result type (might be due to invalid IL or missing references)
				//IL_0195: Unknown result type (might be due to invalid IL or missing references)
				//IL_019f: Unknown result type (might be due to invalid IL or missing references)
				//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
				//IL_0202: Unknown result type (might be due to invalid IL or missing references)
				ExpansionDef val = Addressables.LoadAssetAsync<ExpansionDef>((object)"RoR2/DLC1/Common/DLC1.asset").WaitForCompletion();
				try
				{
					IEnumerable<GameObject> allBodyPrefabs = BodyCatalog.allBodyPrefabs;
					foreach (GameObject item3 in allBodyPrefabs)
					{
						if (!((Object)(object)item3 == (Object)null))
						{
							BodyIndex val2 = BodyCatalog.FindBodyIndex(item3);
							if ((int)val2 != -1)
							{
								GenericSkill[] bodyPrefabSkillSlots = BodyCatalog.GetBodyPrefabSkillSlots(val2);
								if (bodyPrefabSkillSlots != null)
								{
									for (int i = 0; i < bodyPrefabSkillSlots.Length; i++)
									{
										GenericSkill skill = bodyPrefabSkillSlots[i];
										GenericSkill obj = skill;
										if (((obj == null) ? null : obj.skillFamily?.variants) != null)
										{
											List<Variant> list = skill.skillFamily.variants.ToList();
											if (list.Count != 0)
											{
												bool flag = false;
												uint num = skill.skillFamily.defaultVariantIndex;
												foreach (string name2 in Overrides)
												{
													int num2 = list.FindIndex((Variant variant) => variant.skillDef?.skillNameToken.Trim().ToUpper() == name2);
													if (num2 != -1)
													{
														Variant item = list[num2];
														if (num == num2)
														{
															num = (uint)(skill.skillFamily.variants.Length - 1);
														}
														else if (num > num2)
														{
															num--;
														}
														list.Remove(item);
														list.Add(item);
														flag = true;
													}
												}
												List<string> list2 = new List<string>();
												foreach (Variant item4 in list)
												{
													if (item4.skillDef?.skillNameToken != null)
													{
														list2.Add(item4.skillDef.skillNameToken.Trim().ToUpper());
													}
												}
												if (flag)
												{
													int num3 = SkillCatalog.allSkillFamilies.ToList().FindIndex((SkillFamily x) => x.variants == skill.skillFamily.variants);
													if (num3 != -1)
													{
														SkillCatalog._allSkillFamilies[num3].variants = list.ToArray();
														SkillCatalog._allSkillFamilies[num3].defaultVariantIndex = num;
													}
													skill._skillFamily.variants = list.ToArray();
													bodyPrefabSkillSlots[i] = skill;
													SkillLocator component = item3.GetComponent<SkillLocator>();
													if ((Object)(object)component.primary != (Object)null && component.allSkills != null && component.allSkills.Length >= i && (Object)(object)component.primary == (Object)(object)((component != null) ? component.allSkills[i] : null))
													{
														component.primary = skill;
													}
													if ((Object)(object)component.secondary != (Object)null && component.allSkills != null && component.allSkills.Length >= i && (Object)(object)component.secondary == (Object)(object)((component != null) ? component.allSkills[i] : null))
													{
														component.secondary = skill;
													}
													if ((Object)(object)component.utility != (Object)null && component.allSkills != null && component.allSkills.Length >= i && (Object)(object)component.utility == (Object)(object)((component != null) ? component.allSkills[i] : null))
													{
														component.utility = skill;
													}
													if ((Object)(object)component.special != (Object)null && component.allSkills != null && component.allSkills.Length >= i && (Object)(object)component.special == (Object)(object)((component != null) ? component.allSkills[i] : null))
													{
														component.special = skill;
													}
													if ((Object)(object)component.primaryBonusStockOverrideSkill != (Object)null && component.allSkills != null && component.allSkills.Length >= i && (Object)(object)component.primaryBonusStockOverrideSkill == (Object)(object)((component != null) ? component.allSkills[i] : null))
													{
														component.primaryBonusStockOverrideSkill = skill;
													}
													if ((Object)(object)component.secondaryBonusStockOverrideSkill != (Object)null && component.allSkills != null && component.allSkills.Length >= i && (Object)(object)component.secondaryBonusStockOverrideSkill == (Object)(object)((component != null) ? component.allSkills[i] : null))
													{
														component.secondaryBonusStockOverrideSkill = skill;
													}
													if ((Object)(object)component.utilityBonusStockOverrideSkill != (Object)null && component.allSkills != null && component.allSkills.Length >= i && (Object)(object)component.utilityBonusStockOverrideSkill == (Object)(object)((component != null) ? component.allSkills[i] : null))
													{
														component.utilityBonusStockOverrideSkill = skill;
													}
													if ((Object)(object)component.specialBonusStockOverrideSkill != (Object)null && component.allSkills != null && component.allSkills.Length >= i && (Object)(object)component.specialBonusStockOverrideSkill == (Object)(object)((component != null) ? component.allSkills[i] : null))
													{
														component.specialBonusStockOverrideSkill = skill;
													}
													if (component.allSkills != null && component.allSkills.Length >= i)
													{
														component.allSkills[i] = skill;
													}
												}
											}
										}
									}
								}
							}
						}
					}
				}
				catch (Exception ex)
				{
					Main.Log.LogError((object)ex);
				}
				try
				{
					IEnumerable<GameObject> allBodyPrefabs2 = BodyCatalog.allBodyPrefabs;
					foreach (GameObject item5 in allBodyPrefabs2)
					{
						if (!((Object)(object)item5 == (Object)null))
						{
							BodyIndex val3 = BodyCatalog.FindBodyIndex(item5);
							SkinDef[] bodySkins = BodyCatalog.GetBodySkins(val3);
							if (bodySkins.Length != 0)
							{
								List<SkinDef> list3 = new List<SkinDef>(bodySkins);
								bool flag2 = false;
								foreach (string name in Overrides)
								{
									SkinDef val4 = list3.Find((SkinDef skin) => skin.nameToken.Trim().ToUpper() == name);
									if (!((Object)(object)val4 == (Object)null))
									{
										list3.Remove(val4);
										list3.Add(val4);
										flag2 = true;
									}
								}
								List<string> list4 = new List<string>();
								foreach (SkinDef item6 in list3)
								{
									list4.Add(item6.nameToken.Trim().ToUpper());
								}
								if (flag2)
								{
									BodyCatalog.skins[val3] = list3.ToArray();
									SkinCatalog.skinsByBody[val3] = list3.ToArray();
									((Component)item5.GetComponent<ModelLocator>().modelTransform).GetComponent<ModelSkinController>().skins = list3.ToArray();
								}
							}
						}
					}
				}
				catch (Exception ex2)
				{
					Main.Log.LogError((object)ex2);
				}
			});
		}
	}
	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 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[] array = Overrides.ToArray();
				string[] array2 = array;
				for (int i = 0; i < array2.Length; i++)
				{
					Entry item = list.Find(new <>c__DisplayClass2_0
					{
						entry = array2[i]
					}.<Init>b__2);
					list.Remove(item);
					list.Insert(0, item);
				}
				return list.ToArray();
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass2_0
		{
			public string entry;

			internal bool <Init>b__2(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", "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[] array = Overrides.ToArray();
					string[] array2 = array;
					foreach (string entry in array2)
					{
						Entry item = list.Find((Entry x) => x.nameToken.Trim().ToUpper() == entry);
						list.Remove(item);
						list.Insert(0, item);
					}
					return list.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 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[] array = Overrides.ToArray();
				string[] array2 = array;
				for (int i = 0; i < array2.Length; i++)
				{
					Entry item = list.Find(new <>c__DisplayClass2_0
					{
						entry = array2[i]
					}.<Init>b__2);
					list.Remove(item);
					list.Insert(0, item);
				}
				return list.ToArray();
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass2_0
		{
			public string entry;

			internal bool <Init>b__2(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", "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[] array = Overrides.ToArray();
					string[] array2 = array;
					foreach (string entry in array2)
					{
						Entry item = list.Find((Entry x) => x.nameToken.Trim().ToUpper() == entry);
						list.Remove(item);
						list.Insert(0, item);
					}
					return list.ToArray();
				};
				<>c.<>9__2_0 = val;
				obj = (object)val;
			}
			LogBookController.BuildSurvivorEntries += (hook_BuildSurvivorEntries)obj;
		}
	}
}