using System; using System.Collections; using System.Collections.Generic; using System.Reflection; using System.Runtime.CompilerServices; using BepInEx; using BepInEx.Logging; using HarmonyLib; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; using Zorro.Core; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: AssemblyVersion("0.0.0.0")] namespace PeakRandomCustomRunMod; [BepInPlugin("peak.dailyexpeditions", "PEAK: Daily Expeditions", "1.0.0")] public class RandomCustomRunPlugin : BaseUnityPlugin { public const string MOD_GUID = "peak.dailyexpeditions"; public const string MOD_NAME = "PEAK: Daily Expeditions"; public const string MOD_VERSION = "1.0.0"; internal static ManualLogSource Logger; internal static RandomCustomRunPlugin Instance; private Harmony _harmony; private static bool _isChallengeRunActive = false; public static bool IsChallengeRunActive { get { if (_isChallengeRunActive) { return true; } if (RunSettings.IsCustomRun && RunSettings.GetValue((SETTINGTYPE)10050, true) == 777) { return true; } return false; } set { _isChallengeRunActive = value; if (value) { RunSettings.SetValue((SETTINGTYPE)10050, 777); } else if (RunSettings.GetValue((SETTINGTYPE)10050, true) == 777) { RunSettings.SetValue((SETTINGTYPE)10050, 0); } } } private void Awake() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown Instance = this; Logger = ((BaseUnityPlugin)this).Logger; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; try { _harmony = new Harmony("peak.dailyexpeditions"); _harmony.PatchAll(); } catch (Exception arg) { Logger.LogError((object)$"Ошибка Harmony: {arg}"); } } public static void RandomizeSettings(CustomOptionsWindow window) { //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) try { Random random = new Random(); if (RunSettings.alphabetizedIndices != null) { string[] alphabetizedIndices = RunSettings.alphabetizedIndices; foreach (string text in alphabetizedIndices) { switch (text) { case "MiniRun": case "MiniRunBiome": case "GameMode": case "GrappleMode": case "ChaosItems": case "HelpingHand": case "TimeScale": { if (Enum.TryParse(text, out SETTINGTYPE result)) { RunSettings.SetValue(result, 0); } continue; } } SETTINGTYPE result2; if (text.StartsWith("Item_")) { string text2 = text.Substring("Item_".Length); int num = random.Next(0, 2); RunSettings.SetItemValue(text2, num); } else if (Enum.TryParse(text, out result2)) { int maxValue = RunSettings.GetMaxValue(result2); if (maxValue > 0) { int num2 = random.Next(0, maxValue + 1); RunSettings.SetValue(result2, num2); } } } } RunSettings.SaveToDisk(); if (!((Object)(object)window != (Object)null)) { return; } CustomOptionBase[] componentsInChildren = ((Component)window).GetComponentsInChildren(true); for (int j = 0; j < componentsInChildren.Length; j++) { if ((Object)(object)componentsInChildren[j] != (Object)null) { componentsInChildren[j].RestoreDefault(); } } if ((Object)(object)window.miniRunOptions != (Object)null) { window.miniRunOptions.SetActive(RunSettings.GetValue((SETTINGTYPE)10000, true) != RunSettings.GetDefaultValue((SETTINGTYPE)10000)); } } catch (Exception ex) { if (Logger != null) { Logger.LogError((object)("Ошибка рандомизации: " + ex)); } } } } [HarmonyPatch(typeof(NextLevelUI))] public static class NextLevelUIPatch { private static GameObject _randomRunBoardObj; private static TMP_Text _randomRunTimerTmp; private static TMP_Text _randomRunHeaderTmp; [HarmonyPatch("Start")] [HarmonyPostfix] public static void Postfix_Start(NextLevelUI __instance) { //IL_00e6: 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_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) try { if ((Object)(object)__instance == (Object)null) { return; } Transform parent = ((Component)__instance).transform.parent; if ((Object)(object)parent == (Object)null) { return; } Transform val = parent.Find("RandomRunFlightBoardBlock"); if ((Object)(object)val != (Object)null) { _randomRunBoardObj = ((Component)val).gameObject; } else { _randomRunBoardObj = Object.Instantiate(((Component)__instance).gameObject, parent); ((Object)_randomRunBoardObj).name = "RandomRunFlightBoardBlock"; NextLevelUI component = _randomRunBoardObj.GetComponent(); if ((Object)(object)component != (Object)null) { Object.DestroyImmediate((Object)(object)component); } LocalizedText[] componentsInChildren = _randomRunBoardObj.GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { if ((Object)(object)componentsInChildren[i] != (Object)null) { Object.DestroyImmediate((Object)(object)componentsInChildren[i]); } } RectTransform component2 = _randomRunBoardObj.GetComponent(); RectTransform component3 = ((Component)__instance).GetComponent(); if ((Object)(object)component2 != (Object)null && (Object)(object)component3 != (Object)null) { component2.anchorMin = component3.anchorMin; component2.anchorMax = component3.anchorMax; component2.pivot = component3.pivot; float num = Mathf.Max(55f, component3.sizeDelta.y + 16f); component2.anchoredPosition = new Vector2(component3.anchoredPosition.x, component3.anchoredPosition.y - num); } _randomRunBoardObj.transform.SetSiblingIndex(((Component)__instance).transform.GetSiblingIndex() + 1); } if (!((Object)(object)_randomRunBoardObj != (Object)null)) { return; } _randomRunBoardObj.SetActive(false); TMP_Text[] componentsInChildren2 = _randomRunBoardObj.GetComponentsInChildren(true); if (componentsInChildren2 != null && componentsInChildren2.Length > 0) { if (componentsInChildren2.Length >= 2) { _randomRunHeaderTmp = componentsInChildren2[0]; _randomRunTimerTmp = componentsInChildren2[1]; } else { _randomRunTimerTmp = componentsInChildren2[0]; } } } catch (Exception ex) { RandomCustomRunPlugin.Logger.LogError((object)("Error in NextLevelUI Postfix_Start: " + ex)); } } [HarmonyPatch("Update")] [HarmonyPostfix] public static void Postfix_Update(NextLevelUI __instance) { //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Invalid comparison between Unknown and I4 //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) try { if ((Object)(object)__instance == (Object)null || (Object)(object)__instance.timer == (Object)null || (Object)(object)_randomRunBoardObj == (Object)null) { return; } bool flag = ((Component)__instance).gameObject.activeInHierarchy && ((Component)__instance.timer).gameObject.activeInHierarchy && !string.IsNullOrEmpty(((TMP_Text)__instance.timer).text) && ((TMP_Text)__instance.timer).text != "-- -- --"; if (_randomRunBoardObj.activeSelf != flag) { _randomRunBoardObj.SetActive(flag); } if (flag) { bool flag2 = (int)LocalizedText.CURRENT_LANGUAGE == 7; string text = ((TMP_Text)__instance.timer).text; if ((Object)(object)_randomRunHeaderTmp != (Object)null && (Object)(object)_randomRunTimerTmp != (Object)null) { _randomRunHeaderTmp.text = (flag2 ? "НОВЫЙ СЛУЧАЙНЫЙ ЗАБЕГ ЧЕРЕЗ" : "NEW RANDOM RUN IN"); ((Graphic)_randomRunHeaderTmp).color = ((Graphic)__instance.timer).color; _randomRunTimerTmp.text = text; ((Graphic)_randomRunTimerTmp).color = ((Graphic)__instance.timer).color; } else if ((Object)(object)_randomRunTimerTmp != (Object)null) { _randomRunTimerTmp.text = (flag2 ? ("НОВЫЙ СЛУЧАЙНЫЙ ЗАБЕГ ЧЕРЕЗ " + text) : ("NEW RANDOM RUN IN " + text)); ((Graphic)_randomRunTimerTmp).color = ((Graphic)__instance.timer).color; } } } catch { } } } [HarmonyPatch(typeof(AscentUI), "Start")] public static class AscentUIPatch { public static void Postfix(AscentUI __instance) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Invalid comparison between Unknown and I4 try { if (!((Object)(object)__instance == (Object)null) && !((Object)(object)__instance.text == (Object)null) && RunSettings.IsCustomRun && RandomCustomRunPlugin.IsChallengeRunActive) { bool flag = (int)LocalizedText.CURRENT_LANGUAGE == 7; ((TMP_Text)__instance.text).text = (flag ? "СЛУЧАЙНЫЙ ЗАБЕГ" : "RANDOM RUN"); } } catch { } } } [HarmonyPatch(typeof(BoardingPass), "UpdateAscent")] public static class BoardingPassPatch { private static float _originalAscentDescFontSize; private static bool _originalFontSizeCaptured; public static void Postfix(BoardingPass __instance) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Invalid comparison between Unknown and I4 try { if (!((Object)(object)__instance == (Object)null) && !((Object)(object)__instance.ascentDesc == (Object)null)) { if (!_originalFontSizeCaptured) { _originalAscentDescFontSize = __instance.ascentDesc.fontSize; _originalFontSizeCaptured = true; } if (RunSettings.IsCustomRun) { bool flag = (int)LocalizedText.CURRENT_LANGUAGE == 7; __instance.ascentDesc.text = (flag ? "НАСТРОЙТЕ ЭКСПЕДИЦИЮ ПО СВОЕМУ ВКУСУ ИЛИ ИСПЫТАЙТЕ СЕБЯ В ЕЖЕДНЕВНОМ СЛУЧАЙНОМ ЗАБЕГЕ!" : "CUSTOMIZE YOUR EXPEDITION TO YOUR LIKING OR CHALLENGE YOURSELF IN THE DAILY RANDOM RUN!"); __instance.ascentDesc.fontSize = Mathf.Max(10f, _originalAscentDescFontSize - 3f); } else { __instance.ascentDesc.fontSize = _originalAscentDescFontSize; } } } catch { } } } [HarmonyPatch(typeof(MenuWindow))] public static class MenuWindowTestClosePatch { [HarmonyPrefix] [HarmonyPatch("TestCloseViaInput")] public static bool Prefix_TestCloseViaInput(MenuWindow __instance) { if (CustomOptionsWindowPatch.IsCountingDown && __instance is CustomOptionsWindow) { if (Object.op_Implicit((Object)(object)Character.localCharacter) && (Object)(object)Character.localCharacter.input != (Object)null) { Character.localCharacter.input.pauseWasPressed = false; } if ((Object)(object)Singleton.Instance != (Object)null) { Singleton.Instance.cancelWasPressed = false; } return false; } return true; } } [HarmonyPatch(typeof(AchievementManager))] public static class AchievementManagerChallengePatch { [HarmonyPostfix] [HarmonyPatch("TryCompleteAscent")] public static void Postfix_TryCompleteAscent() { try { if (RandomCustomRunPlugin.IsChallengeRunActive) { CustomOptionsWindowPatch.CompletedRandomRunsCount++; int num = DateTime.UtcNow.Year * 10000 + DateTime.UtcNow.Month * 100 + DateTime.UtcNow.Day; int num2 = PlayerPrefs.GetInt("PeakMod_CompletedToday_" + num, 0); PlayerPrefs.SetInt("PeakMod_CompletedToday_" + num, num2 + 1); PlayerPrefs.DeleteKey("PeakMod_Challenge_Saved"); PlayerPrefs.DeleteKey("PeakMod_ChallengeDay"); PlayerPrefs.Save(); RandomCustomRunPlugin.IsChallengeRunActive = false; } } catch { } } } [HarmonyPatch(typeof(RunSettings))] public static class RunSettingsBlockingAchievementsPatch { [HarmonyPrefix] [HarmonyPatch(/*Could not decode attribute arguments.*/)] public static bool Prefix_blockingAchievements(ref bool __result) { if (RandomCustomRunPlugin.IsChallengeRunActive) { __result = false; return false; } return true; } } [HarmonyPatch(typeof(LootData))] public static class LootDataPatch { [HarmonyPostfix] [HarmonyPatch("PopulateLootData")] public static void Postfix_PopulateLootData() { //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) try { if (LootData.AllSpawnWeightData == null) { LootData.AllSpawnWeightData = new Dictionary>(); } Dictionary dictionary = new Dictionary(); if ((Object)(object)SingletonAsset.Instance != (Object)null && SingletonAsset.Instance.itemLookup != null) { foreach (KeyValuePair item in SingletonAsset.Instance.itemLookup) { if ((Object)(object)item.Value != (Object)null) { LootData component = ((Component)item.Value).GetComponent(); int value = 50; if ((Object)(object)component != (Object)null && LootData.RarityWeights != null && LootData.RarityWeights.ContainsKey(component.Rarity)) { value = LootData.RarityWeights[component.Rarity]; } dictionary[item.Key] = value; } } } LootData.AllSpawnWeightData[(SpawnPool)134217728] = dictionary; } catch (Exception ex) { RandomCustomRunPlugin.Logger.LogError((object)("Ошибка в LootDataPatch.Postfix_PopulateLootData: " + ex)); } } [HarmonyPatch("GetRandomItems")] [HarmonyPrefix] public static void Prefix_GetRandomItems() { try { if (LootData.AllSpawnWeightData == null || !LootData.AllSpawnWeightData.ContainsKey((SpawnPool)134217728) || LootData.AllSpawnWeightData[(SpawnPool)134217728].Count == 0) { LootData.PopulateLootData(); } } catch (Exception ex) { RandomCustomRunPlugin.Logger.LogError((object)("Ошибка в LootDataPatch.Prefix_GetRandomItems: " + ex)); } } } [HarmonyPatch(typeof(CharacterAfflictions))] public static class PetrifyDamagePatch { [HarmonyPatch("AddStatus", new Type[] { typeof(STATUSTYPE), typeof(float), typeof(bool), typeof(bool), typeof(bool), typeof(bool) })] [HarmonyPrefix] public static void Prefix_AddStatus(STATUSTYPE statusType, ref float amount) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 try { if ((int)statusType == 13 && RunSettings.IsCustomRun) { switch (RunSettings.GetValue((SETTINGTYPE)450, false)) { case 0: amount = 0f; break; case 1: amount *= 0.5f; break; case 3: amount *= 1.6f; break; case 2: break; } } } catch { } } [HarmonyPatch("AddPetrify", new Type[] { typeof(int) })] [HarmonyPrefix] public static void Prefix_AddPetrify(ref int petrify) { try { if (RunSettings.IsCustomRun) { switch (RunSettings.GetValue((SETTINGTYPE)450, false)) { case 0: petrify = 0; break; case 1: petrify = Mathf.RoundToInt((float)petrify * 0.5f); break; case 3: petrify = Mathf.RoundToInt((float)petrify * 1.6f); break; case 2: break; } } } catch { } } } [HarmonyPatch(typeof(CustomOptionTooltip))] public static class CustomOptionTooltipPatch { [HarmonyPrefix] [HarmonyPatch("ShowTooltip")] public static bool Prefix_ShowTooltip(CustomOptionTooltip __instance) { //IL_0099: 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_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Invalid comparison between Unknown and I4 try { if ((Object)(object)__instance == (Object)null) { return true; } CustomOptionToggle componentInParent = ((Component)__instance).GetComponentInParent(); CustomOptionMulti componentInParent2 = ((Component)__instance).GetComponentInParent(); string text = ((Object)((Component)__instance).gameObject).name; if ((Object)(object)((Component)__instance).transform.parent != (Object)null) { text = text + " " + ((Object)((Component)__instance).transform.parent).name; } if ((Object)(object)componentInParent != (Object)null) { string text2 = text; text = text2 + " " + ((Object)((Component)componentInParent).gameObject).name + " " + ((object)componentInParent.settingType).ToString(); } if ((Object)(object)componentInParent2 != (Object)null) { string text3 = text; text = text3 + " " + ((Object)((Component)componentInParent2).gameObject).name + " " + ((object)componentInParent2.settingType).ToString(); } if (text.IndexOf("Petrification", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("Revival", StringComparison.OrdinalIgnoreCase) >= 0) { if ((Object)(object)__instance.text != (Object)null) { ((Component)__instance.text).gameObject.SetActive(false); } return false; } if ((Object)(object)__instance.text == (Object)null) { CustomOptionTooltip[] array = Object.FindObjectsOfType(); for (int i = 0; i < array.Length; i++) { if ((Object)(object)array[i] != (Object)null && (Object)(object)array[i] != (Object)(object)__instance && (Object)(object)array[i].text != (Object)null) { __instance.text = array[i].text; break; } } } bool flag = (int)LocalizedText.CURRENT_LANGUAGE == 7; if (text.IndexOf("Chaos", StringComparison.OrdinalIgnoreCase) >= 0 && (Object)(object)__instance.text != (Object)null) { __instance.text.SetText(flag ? "В любых чемоданах может выпасть абсолютно любой предмет из всей игры." : "Any luggage can drop absolutely any item in the game."); ((Component)__instance.text).gameObject.SetActive(true); return false; } if ((text.IndexOf("TimeScale", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("Speed", StringComparison.OrdinalIgnoreCase) >= 0) && (Object)(object)__instance.text != (Object)null) { __instance.text.SetText(flag ? "Все движется в два раза быстрее, а голоса в микрофоне становятся писклявыми." : "Everything moves twice as fast, and players' voices become high-pitched squeaks."); ((Component)__instance.text).gameObject.SetActive(true); return false; } } catch (Exception ex) { RandomCustomRunPlugin.Logger.LogError((object)("Ошибка в CustomOptionTooltipPatch: " + ex)); } return true; } } [HarmonyPatch(typeof(LocalizedText))] public static class LocalizedTextPatch { [HarmonyPrefix] [HarmonyPatch("GetText", new Type[] { typeof(string), typeof(bool) })] public static bool Prefix_GetText(string id, ref string __result) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Invalid comparison between Unknown and I4 if (string.IsNullOrEmpty(id)) { return true; } string text = id.ToUpperInvariant(); bool flag = (int)LocalizedText.CURRENT_LANGUAGE == 7; if (text.Contains("CHAOS")) { __result = (flag ? "В любых чемоданах может выпасть абсолютно любой предмет из всей игры." : "Any luggage can drop absolutely any item in the game."); return false; } if (text.Contains("TIMESCALE") || text.Contains("SPEED")) { __result = (flag ? "Все движется в два раза быстрее, а голоса в микрофоне становятся писклявыми." : "Everything moves twice as fast, and players' voices become high-pitched squeaks."); return false; } return true; } } [HarmonyPatch(typeof(CustomOptionsWindow))] public static class CustomOptionsWindowPatch { private static GameObject _randomBtnObj; private static GameObject _randomRunBtnObj; private static bool _layoutDone = false; private static Vector2 _originalDefPos; private static Vector2 _originalDefSize; private static Vector2 _originalTitlePos; private static Vector2 _originalBadgesPos; private static Coroutine _countdownCoroutine; private static bool _isCountingDown = false; private static Dictionary _backupSettings = new Dictionary(); private static Dictionary _backupItems = new Dictionary(); private static TMP_Text _badgesTextComponent; private static Color _originalBadgesColor = Color.white; private static bool _originalBadgesColorCaptured = false; private static CanvasGroup _panelsCanvasGroup; public static bool IsCountingDown => _isCountingDown; public static int CompletedRandomRunsCount { get { return PlayerPrefs.GetInt("PeakMod_CompletedRandomRunsCount", 0); } set { PlayerPrefs.SetInt("PeakMod_CompletedRandomRunsCount", value); PlayerPrefs.Save(); } } [HarmonyPatch("Initialize")] [HarmonyPostfix] public static void Postfix_Initialize(CustomOptionsWindow __instance) { EnsureDefaultRevivalSetting(); SetupButtons(__instance); InjectHiddenFeatureToggles(__instance); } [HarmonyPostfix] [HarmonyPatch("OnOpen")] public static void Postfix_OnOpen(CustomOptionsWindow __instance) { EnsureDefaultRevivalSetting(); SetupButtons(__instance); InjectHiddenFeatureToggles(__instance); } private static void EnsureDefaultRevivalSetting() { try { int value = RunSettings.GetValue((SETTINGTYPE)900, true); if (value <= 0) { RunSettings.SetValue((SETTINGTYPE)900, 1); } } catch { } } public static void UpdateBadgesDisclaimerText() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Invalid comparison between Unknown and I4 //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_badgesTextComponent == (Object)null) { return; } bool flag = (int)LocalizedText.CURRENT_LANGUAGE == 7; int completedRandomRunsCount = CompletedRandomRunsCount; if (_isCountingDown) { string text = (flag ? "ЗНАЧКИ ВКЛЮЧЕНЫ (СЛУЧАЙНЫЙ ЗАБЕГ)" : "BADGES ENABLED (RANDOM RUN)"); string text2 = (flag ? (" | Пройдено случайных забегов: " + completedRandomRunsCount) : (" | Completed random runs: " + completedRandomRunsCount)); _badgesTextComponent.text = text + text2; ((Graphic)_badgesTextComponent).color = new Color(0.2f, 1f, 0.3f); return; } LocalizedText component = ((Component)_badgesTextComponent).GetComponent(); if ((Object)(object)component != (Object)null) { component.RefreshText(); } string text3 = _badgesTextComponent.text; if (string.IsNullOrEmpty(text3)) { text3 = (flag ? "В своих экспедициях нельзя получить значки." : "Custom runs disable badges."); } if (text3.Contains(" | ")) { text3 = text3.Substring(0, text3.IndexOf(" | ")); } string text4 = (flag ? (" | Пройдено случайных забегов: " + completedRandomRunsCount) : (" | Completed random runs: " + completedRandomRunsCount)); _badgesTextComponent.text = text3 + text4; ((Graphic)_badgesTextComponent).color = _originalBadgesColor; } public static void SetupButtons(CustomOptionsWindow window) { //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Invalid comparison between Unknown and I4 //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Expected O, but got Unknown //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Expected O, but got Unknown //IL_0337: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Expected O, but got Unknown //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Expected O, but got Unknown //IL_03bb: Unknown result type (might be due to invalid IL or missing references) //IL_03e3: Unknown result type (might be due to invalid IL or missing references) //IL_03f1: Unknown result type (might be due to invalid IL or missing references) //IL_0407: Unknown result type (might be due to invalid IL or missing references) //IL_0413: Unknown result type (might be due to invalid IL or missing references) //IL_041f: Unknown result type (might be due to invalid IL or missing references) //IL_042b: Unknown result type (might be due to invalid IL or missing references) //IL_043f: Unknown result type (might be due to invalid IL or missing references) //IL_044f: Unknown result type (might be due to invalid IL or missing references) //IL_0465: Unknown result type (might be due to invalid IL or missing references) //IL_0492: Unknown result type (might be due to invalid IL or missing references) //IL_0497: Unknown result type (might be due to invalid IL or missing references) //IL_04ab: Unknown result type (might be due to invalid IL or missing references) UnityAction val = null; UnityAction val2 = null; try { if ((Object)(object)window == (Object)null) { return; } Transform val3 = ((Component)window).transform.Find("CustomOptions/Panel"); if ((Object)(object)val3 == (Object)null) { return; } Transform val4 = val3.Find("RestoreDefaultsButton"); if ((Object)(object)val4 == (Object)null) { return; } RectTransform component = ((Component)val4).GetComponent(); if ((Object)(object)component == (Object)null) { return; } Transform val5 = val3.Find("Title"); RectTransform val6 = (((Object)(object)val5 != (Object)null) ? ((Component)val5).GetComponent() : null); Transform val7 = val3.Find("BadgesDisabled"); RectTransform val8 = (((Object)(object)val7 != (Object)null) ? ((Component)val7).GetComponent() : null); if (!_layoutDone) { _originalDefPos = component.anchoredPosition; _originalDefSize = component.sizeDelta; if ((Object)(object)val6 != (Object)null) { _originalTitlePos = val6.anchoredPosition; } if ((Object)(object)val8 != (Object)null) { _originalBadgesPos = val8.anchoredPosition; } _layoutDone = true; } float x = _originalDefSize.x; _ = _originalDefSize.y; float num = 12f; float num2 = x + num; component.sizeDelta = _originalDefSize; component.anchoredPosition = new Vector2(_originalDefPos.x - num2, _originalDefPos.y); bool flag = (int)LocalizedText.CURRENT_LANGUAGE == 7; Transform val9 = val3.Find("RandomSettingsButton"); if ((Object)(object)val9 != (Object)null) { _randomBtnObj = ((Component)val9).gameObject; } else { _randomBtnObj = Object.Instantiate(((Component)val4).gameObject, val3); ((Object)_randomBtnObj).name = "RandomSettingsButton"; LocalizedText componentInChildren = _randomBtnObj.GetComponentInChildren(); if ((Object)(object)componentInChildren != (Object)null) { Object.DestroyImmediate((Object)(object)componentInChildren); } Button component2 = _randomBtnObj.GetComponent