using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
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 HardcoreMode.Compat;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using Photon.Realtime;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
using Zorro.Core;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("HardcoreMode")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.3.1.0")]
[assembly: AssemblyInformationalVersion("1.3.1")]
[assembly: AssemblyProduct("HardcoreMode")]
[assembly: AssemblyTitle("Hardcore Mode")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.3.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace BepInEx
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
[Embedded]
internal sealed class BepInAutoPluginAttribute : Attribute
{
public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
{
}
}
}
namespace BepInEx.Preloader.Core.Patching
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
[Embedded]
internal sealed class PatcherAutoPluginAttribute : Attribute
{
public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
{
}
}
}
namespace Microsoft.CodeAnalysis
{
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace HardcoreMode
{
internal sealed class BoardingPassButtonTinter : MonoBehaviour
{
private sealed class Entry
{
public Color Original;
public Color Applied;
}
private const float FallbackPurpleHue = 0.75f;
private const float TintableHueMin = 0.45f;
private const float TintableHueMax = 0.9f;
private const float TintableMinSaturation = 0.2f;
private BoardingPass? _pass;
private Graphic[]? _pencilGraphics;
private readonly Dictionary<Graphic, Entry> _entries = new Dictionary<Graphic, Entry>();
private bool _titleTinted;
private readonly List<Graphic> _otherModGraphics = new List<Graphic>();
private readonly HashSet<Graphic> _otherModTinted = new HashSet<Graphic>();
private float _nextOtherModScan;
private void Awake()
{
_pass = ((Component)this).GetComponent<BoardingPass>();
}
private void LateUpdate()
{
//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_003f: 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)
if ((Object)(object)_pass == (Object)null)
{
return;
}
if (!PluginConfig.EnableModeButtonColors.Value || HardcoreModeState.Tier == HardcoreModeTier.Off || RunSettings.IsCustomRun)
{
Restore();
return;
}
Color purple = GetPurple();
float hue = default(float);
float num = default(float);
float num2 = default(float);
Color.RGBToHSV(purple, ref hue, ref num, ref num2);
TintTitle(purple);
TintGraphic(((Object)(object)_pass.incrementAscentButton != (Object)null) ? ((Selectable)_pass.incrementAscentButton).targetGraphic : null, hue);
TintGraphic(((Object)(object)_pass.decrementAscentButton != (Object)null) ? ((Selectable)_pass.decrementAscentButton).targetGraphic : null, hue);
if ((Object)(object)_pass.customRunButton != (Object)null)
{
if (_pencilGraphics == null)
{
_pencilGraphics = ((Component)_pass.customRunButton).GetComponentsInChildren<Graphic>(true);
}
Graphic[] pencilGraphics = _pencilGraphics;
foreach (Graphic graphic in pencilGraphics)
{
TintGraphic(graphic, hue);
}
}
if (PluginConfig.EnableOtherModButtonColors.Value)
{
RefreshOtherModGraphics();
{
foreach (Graphic otherModGraphic in _otherModGraphics)
{
TintGraphic(otherModGraphic, hue);
_otherModTinted.Add(otherModGraphic);
}
return;
}
}
RestoreOtherMods();
}
private void RefreshOtherModGraphics()
{
if (Time.unscaledTime < _nextOtherModScan)
{
return;
}
_nextOtherModScan = Time.unscaledTime + 0.5f;
_otherModGraphics.Clear();
Transform val = (((Object)(object)_pass.closeButton != (Object)null) ? ((Component)_pass.closeButton).transform.parent : null);
if ((Object)(object)val != (Object)null)
{
for (int i = 0; i < val.childCount; i++)
{
Transform child = val.GetChild(i);
if (((Object)child).name.StartsWith("Button_") || ((Object)child).name == "CustomDropdown")
{
AddRootGraphic(child);
}
}
}
Transform val2 = (((Object)(object)_pass.startGameButton != (Object)null) ? ((Component)_pass.startGameButton).transform.parent : null);
Transform val3 = (((Object)(object)val2 != (Object)null) ? val2.Find("SkipBiome_BiomeDropdown") : null);
if ((Object)(object)val3 != (Object)null)
{
AddRootGraphic(val3);
}
}
private void AddRootGraphic(Transform transform)
{
Graphic component = ((Component)transform).GetComponent<Graphic>();
if ((Object)(object)component != (Object)null)
{
_otherModGraphics.Add(component);
}
}
private void RestoreOtherMods()
{
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
foreach (Graphic item in _otherModTinted)
{
if ((Object)(object)item != (Object)null && _entries.TryGetValue(item, out Entry value))
{
if (Approximately(item.color, value.Applied))
{
item.color = value.Original;
}
_entries.Remove(item);
}
}
_otherModTinted.Clear();
}
private void OnDisable()
{
Restore();
}
private Color GetPurple()
{
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
Transform val = (((Object)(object)_pass.closeButton != (Object)null) ? ((Component)_pass.closeButton).transform.parent : null);
HardcoreModeOptionMulti hardcoreModeOptionMulti = (((Object)(object)val != (Object)null) ? ((Component)val).GetComponentInChildren<HardcoreModeOptionMulti>(true) : null);
if (!((Object)(object)hardcoreModeOptionMulti != (Object)null))
{
return Color.HSVToRGB(0.75f, 0.6f, 0.9f);
}
return hardcoreModeOptionMulti.AdjustedColor;
}
private void TintTitle(Color purple)
{
//IL_000e: 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_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
Graphic ascentTitle = (Graphic)(object)_pass.ascentTitle;
Color val = default(Color);
((Color)(ref val))..ctor(purple.r, purple.g, purple.b, ascentTitle.color.a);
if (ascentTitle.color != val)
{
ascentTitle.color = val;
}
_titleTinted = true;
}
private void TintGraphic(Graphic? graphic, float hue)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: 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_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: 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)
if ((Object)(object)graphic == (Object)null)
{
return;
}
Color color = graphic.color;
if (_entries.TryGetValue(graphic, out Entry value))
{
if (Approximately(color, value.Applied))
{
return;
}
_entries.Remove(graphic);
}
if (IsTintable(color))
{
Color val = WithHue(color, hue);
_entries[graphic] = new Entry
{
Original = color,
Applied = val
};
graphic.color = val;
}
}
private void Restore()
{
//IL_003b: 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_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
if (_titleTinted && (Object)(object)_pass != (Object)null)
{
((Graphic)_pass.ascentTitle).color = (RunSettings.IsCustomRun ? _pass.customColor : _pass.defaultColor);
_titleTinted = false;
}
foreach (KeyValuePair<Graphic, Entry> entry in _entries)
{
if ((Object)(object)entry.Key != (Object)null && Approximately(entry.Key.color, entry.Value.Applied))
{
entry.Key.color = entry.Value.Original;
}
}
_entries.Clear();
_otherModTinted.Clear();
}
private static bool IsTintable(Color color)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
float num = default(float);
float num2 = default(float);
float num3 = default(float);
Color.RGBToHSV(color, ref num, ref num2, ref num3);
if (num2 >= 0.2f && num >= 0.45f)
{
return num <= 0.9f;
}
return false;
}
private static bool Approximately(Color a, Color b)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
if (Mathf.Abs(a.r - b.r) < 0.01f && Mathf.Abs(a.g - b.g) < 0.01f && Mathf.Abs(a.b - b.b) < 0.01f)
{
return Mathf.Abs(a.a - b.a) < 0.01f;
}
return false;
}
internal static Color WithHue(Color source, float hue)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
float num = default(float);
float num2 = default(float);
float num3 = default(float);
Color.RGBToHSV(source, ref num, ref num2, ref num3);
Color result = Color.HSVToRGB(hue, num2, num3);
result.a = source.a;
return result;
}
}
internal class BoardingPassCleanup : MonoBehaviour
{
private void OnEnable()
{
HardcoreModeSettings.Revert();
}
}
internal static class HardcoreModeClearTracking
{
public readonly struct StarDisplay
{
public readonly bool HasStar1;
public readonly bool Star1Gold;
public readonly bool HasStar2;
public readonly bool Star2Gold;
public readonly int RedStarCount;
public StarDisplay(bool hasStar1, bool star1Gold, bool hasStar2, bool star2Gold, int redStarCount)
{
HasStar1 = hasStar1;
Star1Gold = star1Gold;
HasStar2 = hasStar2;
Star2Gold = star2Gold;
RedStarCount = redStarCount;
}
}
private const string ShadowSilverKey = "Hardcore_ShadowSilverMaxAscent";
private const string ShadowGoldKey = "Hardcore_ShadowGoldMaxAscent";
private const string ExtremeSilverKey = "Hardcore_ExtremeSilverMaxAscent";
private const string ExtremeGoldKey = "Hardcore_ExtremeGoldMaxAscent";
private const string ShadowFastKey = "Hardcore_ShadowFastMaxAscent";
private const string ExtremeFastKey = "Hardcore_ExtremeFastMaxAscent";
private const int NotAchievedDefault = -2;
public const float FastClearSeconds = 3600f;
public static StarDisplay GetStars(int ascent)
{
int qualityAtOrAbove = GetQualityAtOrAbove("Hardcore_ShadowSilverMaxAscent", "Hardcore_ShadowGoldMaxAscent", ascent);
int qualityAtOrAbove2 = GetQualityAtOrAbove("Hardcore_ExtremeSilverMaxAscent", "Hardcore_ExtremeGoldMaxAscent", ascent);
bool flag = IsAtOrAbove("Hardcore_ExtremeFastMaxAscent", ascent);
bool flag2 = IsAtOrAbove("Hardcore_ShadowFastMaxAscent", ascent);
int redStarCount = (flag ? 2 : (flag2 ? 1 : 0));
if (qualityAtOrAbove2 > 0)
{
int num = Mathf.Max(qualityAtOrAbove, qualityAtOrAbove2);
return new StarDisplay(hasStar1: true, num == 2, hasStar2: true, qualityAtOrAbove2 == 2, redStarCount);
}
if (qualityAtOrAbove > 0)
{
return new StarDisplay(hasStar1: true, qualityAtOrAbove == 2, hasStar2: false, star2Gold: false, redStarCount);
}
return new StarDisplay(hasStar1: false, star1Gold: false, hasStar2: false, star2Gold: false, 0);
}
public static void MarkCleared(int ascent, HardcoreModeTier tier, bool hasBingBong, bool clearedWithinOneHour)
{
string key = ((tier != HardcoreModeTier.Extreme) ? (hasBingBong ? "Hardcore_ShadowGoldMaxAscent" : "Hardcore_ShadowSilverMaxAscent") : (hasBingBong ? "Hardcore_ExtremeGoldMaxAscent" : "Hardcore_ExtremeSilverMaxAscent"));
if (MarkCleared(ascent, key))
{
Plugin.Log.LogInfo((object)$"[HardcoreMode] Recorded Ascent {ascent} as cleared in {tier} (carrying Bing Bong: {hasBingBong}).");
}
if (clearedWithinOneHour)
{
string key2 = ((tier == HardcoreModeTier.Extreme) ? "Hardcore_ExtremeFastMaxAscent" : "Hardcore_ShadowFastMaxAscent");
if (MarkCleared(ascent, key2))
{
Plugin.Log.LogInfo((object)$"[HardcoreMode] Recorded Ascent {ascent} in {tier} as cleared within one hour.");
}
}
}
private static bool MarkCleared(int ascent, string key)
{
int num = PlayerPrefs.GetInt(key, -2);
if (ascent > num)
{
PlayerPrefs.SetInt(key, ascent);
PlayerPrefs.Save();
return true;
}
return false;
}
private static int GetQualityAtOrAbove(string silverKey, string goldKey, int ascent)
{
if (ascent <= PlayerPrefs.GetInt(goldKey, -2))
{
return 2;
}
if (ascent <= PlayerPrefs.GetInt(silverKey, -2))
{
return 1;
}
return 0;
}
private static bool IsAtOrAbove(string key, int ascent)
{
return ascent <= PlayerPrefs.GetInt(key, -2);
}
public static void DebugForceRecord(int ascent, int shadowQuality, int extremeQuality, bool shadowFast, bool extremeFast)
{
switch (shadowQuality)
{
case 2:
MarkCleared(ascent, "Hardcore_ShadowGoldMaxAscent");
break;
case 1:
MarkCleared(ascent, "Hardcore_ShadowSilverMaxAscent");
break;
}
switch (extremeQuality)
{
case 2:
MarkCleared(ascent, "Hardcore_ExtremeGoldMaxAscent");
break;
case 1:
MarkCleared(ascent, "Hardcore_ExtremeSilverMaxAscent");
break;
}
if (shadowFast)
{
MarkCleared(ascent, "Hardcore_ShadowFastMaxAscent");
}
if (extremeFast)
{
MarkCleared(ascent, "Hardcore_ExtremeFastMaxAscent");
}
Plugin.Log.LogInfo((object)$"[HardcoreMode] [Debug] Upgraded the record for Ascent {ascent}: Shadow={shadowQuality}, Extreme={extremeQuality}, ShadowFast={shadowFast}, ExtremeFast={extremeFast}");
}
public static void DebugResetAll()
{
PlayerPrefs.SetInt("Hardcore_ShadowSilverMaxAscent", -2);
PlayerPrefs.SetInt("Hardcore_ShadowGoldMaxAscent", -2);
PlayerPrefs.SetInt("Hardcore_ExtremeSilverMaxAscent", -2);
PlayerPrefs.SetInt("Hardcore_ExtremeGoldMaxAscent", -2);
PlayerPrefs.SetInt("Hardcore_ShadowFastMaxAscent", -2);
PlayerPrefs.SetInt("Hardcore_ExtremeFastMaxAscent", -2);
PlayerPrefs.Save();
Plugin.Log.LogInfo((object)"[HardcoreMode] [Debug] Cleared every star record.");
}
}
internal static class HardcoreModeLabels
{
public static string BuildLabel(int ascent)
{
string text = ((HardcoreModeState.Tier == HardcoreModeTier.Extreme) ? "Extreme" : "Hardcore");
switch (ascent)
{
case -1:
return text + " Tenderfoot";
case 0:
return text + " Peak";
default:
if (MoreAscentsCompat.IsChaosAscent(ascent))
{
return text + " Chaos " + MoreAscentsCompat.ChaosNumber(ascent);
}
return text + " Ascent " + ascent;
}
}
}
internal class HardcoreModeNetwork : MonoBehaviour
{
[PunRPC]
private void RPC_SetHardcoreMode(int tier)
{
HardcoreModeState.SetTier((HardcoreModeTier)tier);
}
}
internal class HardcoreModeOptionMulti : CustomOptionBase
{
private static readonly string[] Labels = new string[3] { "Normal", "Hardcore", "Extreme" };
private TMP_Text? _buttonText;
private Image? _buttonImage;
private Color _defaultColor;
private Color _adjustedColor;
private readonly List<(Graphic graphic, Color defaultColor, Color tintedColor)> _tintTargets = new List<(Graphic, Color, Color)>();
internal Color AdjustedColor => _adjustedColor;
public void Setup(Button button, LocalizedText? buttonText, Image? buttonImage, Color defaultColor, Color adjustedColor)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: 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_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Expected O, but got Unknown
if ((Object)(object)buttonText != (Object)null)
{
_buttonText = ((Component)buttonText).GetComponent<TMP_Text>();
Object.Destroy((Object)(object)buttonText);
}
_buttonImage = buttonImage;
_defaultColor = defaultColor;
_adjustedColor = adjustedColor;
CollectTintTargets();
((UnityEventBase)button.onClick).RemoveAllListeners();
((UnityEvent)button.onClick).AddListener(new UnityAction(((CustomOptionBase)this).OnClick));
HardcoreModeState.OnChanged += OnStateChanged;
ApplyPositionFromConfig();
Refresh();
}
private void CollectTintTargets()
{
Transform parent = ((Component)this).transform.parent;
if (!((Object)(object)parent == (Object)null))
{
AddTintTarget(parent, "BlueTop");
AddTintTarget(parent, "BlueBot");
AddTintTarget(parent, "StartGameButton");
}
}
private float GetAdjustedHue()
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
float result = default(float);
float num = default(float);
float num2 = default(float);
Color.RGBToHSV(_adjustedColor, ref result, ref num, ref num2);
return result;
}
private void AddTintTarget(Transform parent, string childName)
{
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
Transform val = parent.Find(childName);
Graphic val2 = (((Object)(object)val != (Object)null) ? ((Component)val).GetComponent<Graphic>() : null);
if ((Object)(object)val2 != (Object)null)
{
_tintTargets.Add((val2, val2.color, BoardingPassButtonTinter.WithHue(val2.color, GetAdjustedHue())));
}
}
private void OnDestroy()
{
HardcoreModeState.OnChanged -= OnStateChanged;
}
private void OnDisable()
{
//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_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
foreach (var (val, color, val2) in _tintTargets)
{
if ((Object)(object)val != (Object)null)
{
val.color = color;
}
}
}
public void ApplyPositionFromConfig()
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
RectTransform val = default(RectTransform);
if (((Component)this).TryGetComponent<RectTransform>(ref val))
{
val.anchoredPosition = new Vector2(PluginConfig.ModeButtonOffsetX.Value, PluginConfig.ModeButtonOffsetY.Value);
}
}
internal static void ReapplyPositionToAllInstances()
{
HardcoreModeOptionMulti[] array = FindAllInstances();
foreach (HardcoreModeOptionMulti hardcoreModeOptionMulti in array)
{
hardcoreModeOptionMulti.ApplyPositionFromConfig();
}
}
internal static void RefreshAllInstances()
{
HardcoreModeOptionMulti[] array = FindAllInstances();
foreach (HardcoreModeOptionMulti hardcoreModeOptionMulti in array)
{
hardcoreModeOptionMulti.Refresh();
}
}
private static HardcoreModeOptionMulti[] FindAllInstances()
{
return Object.FindObjectsByType<HardcoreModeOptionMulti>((FindObjectsInactive)1, (FindObjectsSortMode)0);
}
private void OnStateChanged(HardcoreModeTier tier)
{
Refresh();
}
public override void OnClick()
{
((CustomOptionBase)this).OnClick();
HardcoreModeTier tier = (HardcoreModeTier)((int)(HardcoreModeState.Tier + 1) % 3);
HardcoreModeState.SetTier(tier);
BroadcastState(tier);
Refresh();
}
public override void RestoreDefault()
{
((CustomOptionBase)this).RestoreDefault();
HardcoreModeState.SetTier(HardcoreModeTier.Off);
BroadcastState(HardcoreModeTier.Off);
Refresh();
}
private void Refresh()
{
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)_buttonText != (Object)null)
{
_buttonText.text = Labels[(int)HardcoreModeState.Tier];
}
bool flag = HardcoreModeState.Tier != HardcoreModeTier.Off;
if ((Object)(object)_buttonImage != (Object)null)
{
((Graphic)_buttonImage).color = (flag ? _adjustedColor : _defaultColor);
}
if (flag && PluginConfig.EnableModeBackgroundColor.Value)
{
return;
}
foreach (var (val, color, val2) in _tintTargets)
{
val.color = color;
}
}
private void LateUpdate()
{
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//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_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
if (HardcoreModeState.Tier == HardcoreModeTier.Off || !PluginConfig.EnableModeBackgroundColor.Value)
{
return;
}
foreach (var (val, b, color) in _tintTargets)
{
if (ColorsApproximatelyEqual(val.color, b))
{
val.color = color;
}
}
}
private static bool ColorsApproximatelyEqual(Color a, Color b)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
if (Mathf.Abs(a.r - b.r) < 0.05f && Mathf.Abs(a.g - b.g) < 0.05f)
{
return Mathf.Abs(a.b - b.b) < 0.05f;
}
return false;
}
private static void BroadcastState(HardcoreModeTier tier)
{
if ((Object)(object)GameUtils.instance != (Object)null)
{
GameUtils.instance.photonView.RPC("RPC_SetHardcoreMode", (RpcTarget)0, new object[1] { (int)tier });
}
}
}
internal static class HardcoreModeSettings
{
private static bool _weEnabledCustomRun;
private static bool _pendingCustomRun;
private static Dictionary<SETTINGTYPE, int>? _settingSnapshot;
private static Dictionary<string, int>? _itemSnapshot;
public static void ApplyForAscent(int ascent)
{
RevertLocal();
SnapshotAndResetToDefaults();
RunSettings.SetValue((SETTINGTYPE)100, (ascent != -1) ? 1 : 0);
RunSettings.SetValue((SETTINGTYPE)200, (ascent == -1) ? 1 : ((ascent >= 2) ? 3 : 2));
RunSettings.SetValue((SETTINGTYPE)600, (ascent < 3) ? 1 : 2);
RunSettings.SetValue((SETTINGTYPE)700, (ascent < 4) ? 1 : 0);
RunSettings.SetValue((SETTINGTYPE)500, (ascent >= 5) ? 1 : 0);
RunSettings.SetValue((SETTINGTYPE)800, (ascent >= 6) ? 3 : ((ascent == -1) ? 1 : 2));
RunSettings.SetValue((SETTINGTYPE)2700, (ascent != -1) ? 1 : 0);
RunSettings.SetValue((SETTINGTYPE)20000, 1);
if (HardcoreModeState.Tier == HardcoreModeTier.Extreme)
{
RunSettings.SetValue((SETTINGTYPE)400, 3);
}
_pendingCustomRun = !RunSettings.IsCustomRun;
}
public static void CommitCustomRun()
{
if (_pendingCustomRun)
{
_pendingCustomRun = false;
if (!RunSettings.IsCustomRun)
{
RunSettings.IsCustomRun = true;
_weEnabledCustomRun = true;
}
}
}
public static void Revert()
{
if (RevertLocal())
{
PushRevertToClients();
}
}
private static bool RevertLocal()
{
_pendingCustomRun = false;
bool result = _settingSnapshot != null || _itemSnapshot != null || _weEnabledCustomRun;
RestoreSnapshot();
if (_weEnabledCustomRun)
{
RunSettings.IsCustomRun = false;
_weEnabledCustomRun = false;
}
return result;
}
private static void PushRevertToClients()
{
try
{
if (PhotonNetwork.IsMasterClient && PhotonNetwork.InRoom && !((Object)(object)GameUtils.instance == (Object)null))
{
RunSettings.PushRunSettings((Player)null);
Plugin.Log.LogInfo((object)"[HardcoreMode] Restored the run settings and sent them to everyone in the room, so players without this mod do not keep the Hardcore Mode values.");
}
}
catch (Exception arg)
{
Plugin.Log.LogWarning((object)$"[HardcoreMode] Could not send the restored run settings to the other players (ignored, continuing): {arg}");
}
}
private static void SnapshotAndResetToDefaults()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: 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_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
_settingSnapshot = new Dictionary<SETTINGTYPE, int>();
foreach (SETTINGTYPE value in Enum.GetValues(typeof(SETTINGTYPE)))
{
_settingSnapshot[value] = RunSettings.GetValue(value, true);
RunSettings.SetValue(value, RunSettings.GetDefaultValue(value));
}
_itemSnapshot = new Dictionary<string, int>();
foreach (Item modifiableItemPrefab in RunSettings.ModifiableItemPrefabs)
{
string name = ((Object)((Component)modifiableItemPrefab).gameObject).name;
_itemSnapshot[name] = RunSettings.GetItemValue(name, true);
RunSettings.SetItemValue(name, 1);
}
}
private static void RestoreSnapshot()
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
if (_settingSnapshot != null)
{
foreach (KeyValuePair<SETTINGTYPE, int> item in _settingSnapshot)
{
RunSettings.SetValue(item.Key, item.Value);
}
_settingSnapshot = null;
}
if (_itemSnapshot == null)
{
return;
}
foreach (KeyValuePair<string, int> item2 in _itemSnapshot)
{
RunSettings.SetItemValue(item2.Key, item2.Value);
}
_itemSnapshot = null;
}
}
internal enum HardcoreModeTier
{
Off,
Shadow,
Extreme
}
internal static class HardcoreModeState
{
public static HardcoreModeTier Tier { get; private set; }
public static bool Enabled => Tier != HardcoreModeTier.Off;
public static event Action<HardcoreModeTier>? OnChanged;
public static void SetTier(HardcoreModeTier tier)
{
if (Tier == tier)
{
return;
}
Tier = tier;
if (HardcoreModeState.OnChanged == null)
{
return;
}
Delegate[] invocationList = HardcoreModeState.OnChanged.GetInvocationList();
foreach (Delegate obj in invocationList)
{
try
{
((Action<HardcoreModeTier>)obj)(tier);
}
catch (Exception arg)
{
Plugin.Log.LogWarning((object)$"[HardcoreMode] HardcoreModeState.SetTier: an OnChanged subscriber threw (ignored, continuing): {arg}");
}
}
}
}
[BepInPlugin("HardcoreMode", "Hardcore Mode", "1.3.1")]
public class Plugin : BaseUnityPlugin
{
private Harmony? _harmony;
public const string Id = "HardcoreMode";
internal static ManualLogSource Log { get; private set; }
public static string Name => "Hardcore Mode";
public static string Version => "1.3.1";
private void Awake()
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Expected O, but got Unknown
Log = ((BaseUnityPlugin)this).Logger;
PluginConfig.Bind(((BaseUnityPlugin)this).Config);
_harmony = new Harmony("HardcoreMode");
_harmony.PatchAll();
Log.LogInfo((object)("Plugin " + Name + " is loaded!"));
}
}
public enum AirportStaminaTestMode
{
Off,
Casual,
Extreme
}
internal static class PluginConfig
{
private const string UiSection = "UI";
public static ConfigEntry<AirportStaminaTestMode> StaminaDrainInAirport { get; private set; }
public static ConfigEntry<bool> EnableAchievementsInHardcoreMode { get; private set; }
public static ConfigEntry<bool> EnableClimbCountInHardcoreMode { get; private set; }
public static ConfigEntry<float> ModeButtonOffsetX { get; private set; }
public static ConfigEntry<float> ModeButtonOffsetY { get; private set; }
public static ConfigEntry<bool> EnableModeBackgroundColor { get; private set; }
public static ConfigEntry<bool> EnableModeButtonColors { get; private set; }
public static ConfigEntry<bool> EnableOtherModButtonColors { get; private set; }
public static ConfigEntry<bool> EnableFakeClusterShroom { get; private set; }
public static void Bind(ConfigFile config)
{
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Expected O, but got Unknown
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Expected O, but got Unknown
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_0140: Expected O, but got Unknown
//IL_0180: Unknown result type (might be due to invalid IL or missing references)
//IL_018a: Expected O, but got Unknown
//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
//IL_01ab: Expected O, but got Unknown
EnableFakeClusterShroom = config.Bind<bool>("Hardcore Mode", "EnableFakeClusterShroom", false, "When ON, some things you pick up during Hardcore/Extreme runs can turn out to be items that cure your curse. Medicinal Roots in every biome work the same way the ones in Roots already do, Cluster Shrooms (poisonous ones included) can do the same, and something in Alpine can rarely be a Mandrake. Only a plant you pick straight from the ground counts. A cooked Mandrake removes a good part of your curse, but vanilla grows them in the Roots biome only, so higher ascents give you almost no way to deal with the curse you start with. A Mandrake does not fit in your pockets, so you have to carry it in your hand all the way to a campfire. Only the host needs this setting.");
StaminaDrainInAirport = config.Bind<AirportStaminaTestMode>("Hardcore Mode", "StaminaDrainInAirport", AirportStaminaTestMode.Off, "Lets you preview climbing stamina drain inside the airport lobby only. Has no effect on an actual run (after pressing \"Start\" at the kiosk). Casual = same as \"Grapple Mode\" (4x), Extreme = same as Ascent 6+ (5.6x).");
EnableAchievementsInHardcoreMode = config.Bind<bool>("Hardcore Mode", "EnableAchievementsInHardcoreMode", true, "When ON, unblocks your own Steam achievements while a run has Hardcore Mode (Hardcore/Extreme) enabled. The climb-count stat is handled separately by EnableClimbCountInHardcoreMode below and is not affected by this setting. Vanilla normally blocks all achievements during a Custom Run, but Hardcore Mode only borrows the Custom Run mechanism and otherwise plays like a normal ascent run, so this setting only applies to yourself if you have this mod installed (it has no effect on other players' achievements).");
EnableClimbCountInHardcoreMode = config.Bind<bool>("Hardcore Mode", "EnableClimbCountInHardcoreMode", true, "When ON, unblocks your own climb-count stat (STEAMSTATTYPE.TimesPeaked) while a run has Hardcore Mode (Hardcore/Extreme) enabled. Achievements themselves are handled separately by EnableAchievementsInHardcoreMode above and are not affected by this setting. This also only applies to yourself if you have this mod installed.");
ModeButtonOffsetX = BindUi(config, "ModeButtonOffsetX", 0f, new ConfigDescription("X position of the Normal/Hardcore/Extreme toggle button on the ascent select screen (offset from the top-left of the header row). The header text width changes depending on the game's language, so adjust this if the button overlaps or overflows.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-2000f, 2000f), Array.Empty<object>()));
ModeButtonOffsetY = BindUi(config, "ModeButtonOffsetY", -460f, new ConfigDescription("Y position of the Normal/Hardcore/Extreme toggle button on the ascent select screen (offset from the top-left of the header row).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-1000f, 1000f), Array.Empty<object>()));
ModeButtonOffsetX.SettingChanged += delegate
{
HardcoreModeOptionMulti.ReapplyPositionToAllInstances();
};
ModeButtonOffsetY.SettingChanged += delegate
{
HardcoreModeOptionMulti.ReapplyPositionToAllInstances();
};
EnableModeBackgroundColor = BindUi(config, "EnableModeBackgroundColor", defaultValue: true, new ConfigDescription("When ON, tints the ascent select screen's header background (the \"Boarding Pass\" banner) the same color as the toggle button while Hardcore/Extreme mode is selected. When OFF, the background always stays the vanilla color.", (AcceptableValueBase)null, Array.Empty<object>()));
EnableModeBackgroundColor.SettingChanged += delegate
{
HardcoreModeOptionMulti.RefreshAllInstances();
};
EnableModeButtonColors = BindUi(config, "EnableModeButtonColors", defaultValue: true, new ConfigDescription("When ON, while Hardcore/Extreme is selected, the ascent name text and the ascent arrow buttons on the Boarding Pass screen are also colored purple, and the pencil (Custom Run) icon becomes purple instead of blue. While Custom Run is on (after clicking the pencil), everything returns to vanilla colors. Other mods that recolor these elements may conflict; turn this OFF if that happens.", (AcceptableValueBase)null, Array.Empty<object>()));
EnableOtherModButtonColors = BindUi(config, "EnableOtherModButtonColors", defaultValue: true, new ConfigDescription("Only used when EnableModeButtonColors is ON. When ON, buttons added by other mods (PeakLevelSelect's Random/Daily buttons and level dropdown, SkipBiome's biome dropdown) are also colored purple while Hardcore/Extreme is selected. Turn this OFF if it conflicts with those mods.", (AcceptableValueBase)null, Array.Empty<object>()));
}
private static ConfigEntry<T> BindUi<T>(ConfigFile config, string key, T defaultValue, ConfigDescription description)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Expected O, but got Unknown
ConfigDefinition val = new ConfigDefinition("UI", key);
ConfigDefinition key2 = new ConfigDefinition("Hardcore Mode", key);
Dictionary<ConfigDefinition, string> dictionary = AccessTools.Property(typeof(ConfigFile), "OrphanedEntries")?.GetValue(config) as Dictionary<ConfigDefinition, string>;
bool flag = dictionary?.ContainsKey(val) ?? false;
ConfigEntry<T> val2 = config.Bind<T>(val, defaultValue, description);
if (dictionary != null && dictionary.TryGetValue(key2, out var value))
{
if (!flag)
{
((ConfigEntryBase)val2).SetSerializedValue(value);
}
dictionary.Remove(key2);
config.Save();
}
return val2;
}
}
}
namespace HardcoreMode.Patches
{
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
internal static class AchievementUnblockPatch
{
[HarmonyPrefix]
private static bool Prefix(ref bool __result)
{
if (!HardcoreModeState.Enabled)
{
return true;
}
if (!(AchievementIncrementStatContextPatch.InClimbCountStat ? PluginConfig.EnableClimbCountInHardcoreMode.Value : PluginConfig.EnableAchievementsInHardcoreMode.Value))
{
return true;
}
__result = false;
return false;
}
}
[HarmonyPatch(typeof(AchievementManager), "IncrementSteamStat")]
internal static class AchievementIncrementStatContextPatch
{
internal static bool InClimbCountStat;
[HarmonyPrefix]
private static void Prefix(STEAMSTATTYPE steamStatType)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Invalid comparison between Unknown and I4
InClimbCountStat = (int)steamStatType == 14;
}
[HarmonyPostfix]
private static void Postfix()
{
InClimbCountStat = false;
}
}
[HarmonyPatch(typeof(AirportCheckInKiosk))]
internal static class AirportCheckInKioskPatches
{
[HarmonyPatch("StartGame")]
[HarmonyPrefix]
private static void StartGame_Prefix()
{
try
{
if (!LoadingScreenHandler.loading)
{
HardcoreModeSettings.CommitCustomRun();
}
}
catch (Exception arg)
{
Plugin.Log.LogWarning((object)$"[HardcoreMode] AirportCheckInKioskPatches.StartGame_Prefix: unexpected exception (ignored, continuing): {arg}");
}
}
[HarmonyPatch("BeginIslandLoadRPC")]
[HarmonyPrefix]
private static bool BeginIslandLoadRPC_Prefix(string sceneName)
{
try
{
if (LoadingScreenHandler.loading)
{
Plugin.Log.LogWarning((object)("[HardcoreMode] BeginIslandLoadRPC(\"" + sceneName + "\") arrived again while a scene was already loading, so it was dropped. Another mod may be sending the departure RPC twice. Loading continues as normal."));
return false;
}
}
catch (Exception arg)
{
Plugin.Log.LogWarning((object)$"[HardcoreMode] BeginIslandLoadRPC_Prefix: could not check for a duplicate call (continuing as normal): {arg}");
}
return true;
}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
internal static class AirportStaminaTestPatch
{
private const float CasualMultiplier = 4f;
private const float ExtremeMultiplier = 5.6f;
[HarmonyPrefix]
private static bool Prefix(ref float __result)
{
if ((Object)(object)GameUtils.instance == (Object)null || !GameUtils.instance.m_inAirport)
{
return true;
}
switch (PluginConfig.StaminaDrainInAirport.Value)
{
case AirportStaminaTestMode.Casual:
__result = 4f;
return false;
case AirportStaminaTestMode.Extreme:
__result = 5.6f;
return false;
default:
return true;
}
}
}
[HarmonyPatch(typeof(AscentUI), "Start")]
internal static class AscentUIPatch
{
[HarmonyPrefix]
private static bool Prefix(AscentUI __instance)
{
if (!HardcoreModeState.Enabled)
{
return true;
}
((TMP_Text)__instance.text).text = HardcoreModeLabels.BuildLabel(Ascents.currentAscent);
return false;
}
}
[HarmonyPatch(typeof(BoardingPass))]
internal static class BoardingPassPatches
{
private const float CompactWidth = 200f;
[HarmonyPatch("Initialize")]
[HarmonyPostfix]
private static void Initialize_Postfix(BoardingPass __instance)
{
TryInject(__instance);
if ((Object)(object)((Component)__instance).gameObject.GetComponent<BoardingPassCleanup>() == (Object)null)
{
((Component)__instance).gameObject.AddComponent<BoardingPassCleanup>();
}
if ((Object)(object)((Component)__instance).gameObject.GetComponent<BoardingPassButtonTinter>() == (Object)null)
{
((Component)__instance).gameObject.AddComponent<BoardingPassButtonTinter>();
}
}
[HarmonyPatch("OnOpen")]
[HarmonyPostfix]
private static void OnOpen_Postfix(BoardingPass __instance)
{
TryInject(__instance);
HardcoreModeSettings.Revert();
}
private static void TryInject(BoardingPass boardingPass)
{
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: 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_00e4: 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_015b: Unknown result type (might be due to invalid IL or missing references)
//IL_0152: Unknown result type (might be due to invalid IL or missing references)
//IL_0160: Unknown result type (might be due to invalid IL or missing references)
//IL_0175: Unknown result type (might be due to invalid IL or missing references)
//IL_016c: Unknown result type (might be due to invalid IL or missing references)
//IL_017a: Unknown result type (might be due to invalid IL or missing references)
//IL_0211: Unknown result type (might be due to invalid IL or missing references)
//IL_0213: Unknown result type (might be due to invalid IL or missing references)
Transform parent = ((Component)boardingPass.closeButton).transform.parent;
if ((Object)(object)((Component)parent).GetComponentInChildren<HardcoreModeOptionMulti>(true) != (Object)null)
{
return;
}
CustomOptionsWindow customOptionsWindow = boardingPass.customOptionsWindow;
if ((Object)(object)customOptionsWindow == (Object)null)
{
return;
}
CustomOptionMulti val = ((IEnumerable<CustomOptionMulti>)((Component)customOptionsWindow).GetComponentsInChildren<CustomOptionMulti>(true)).FirstOrDefault((Func<CustomOptionMulti, bool>)((CustomOptionMulti t) => (int)t.settingType == 600));
if ((Object)(object)val == (Object)null)
{
Plugin.Log.LogWarning((object)"[HardcoreMode] Could not find the CustomOptionMulti for ItemWeight, so the toggle was not added.");
return;
}
GameObject val2 = Object.Instantiate<GameObject>(((Component)val).gameObject, parent);
((Object)val2).name = "HardcoreModeToggle";
RectTransform val3 = default(RectTransform);
if (val2.TryGetComponent<RectTransform>(ref val3))
{
val3.anchorMin = new Vector2(0f, 1f);
val3.anchorMax = new Vector2(0f, 1f);
val3.pivot = new Vector2(0f, 1f);
val3.sizeDelta = new Vector2(200f, val3.sizeDelta.y);
}
CustomOptionMulti component = val2.GetComponent<CustomOptionMulti>();
Button val4 = (((Object)(object)component != (Object)null) ? component.button : val2.GetComponentInChildren<Button>(true));
LocalizedText buttonText = (((Object)(object)component != (Object)null) ? component.buttonText : null);
Image buttonImage = (((Object)(object)component != (Object)null) ? component.buttonImage : null);
Color defaultColor = (((Object)(object)component != (Object)null) ? component.defaultColor : Color.white);
Color adjustedColor = (((Object)(object)component != (Object)null) ? component.adjustedColor : Color.white);
SFX_Instance sfxClick = (((Object)(object)component != (Object)null) ? ((CustomOptionBase)component).sfxClick : null);
SFX_Instance sfxHover = (((Object)(object)component != (Object)null) ? ((CustomOptionBase)component).sfxHover : null);
LocalizedText val5 = (((Object)(object)component != (Object)null) ? component.label : null);
if ((Object)(object)val4 == (Object)null)
{
Plugin.Log.LogWarning((object)"[HardcoreMode] The cloned GameObject has no Button, so the toggle was not added.");
Object.Destroy((Object)(object)val2);
return;
}
if ((Object)(object)component != (Object)null)
{
Object.Destroy((Object)(object)component);
}
HardcoreModeOptionMulti hardcoreModeOptionMulti = val2.AddComponent<HardcoreModeOptionMulti>();
((CustomOptionBase)hardcoreModeOptionMulti).sfxClick = sfxClick;
((CustomOptionBase)hardcoreModeOptionMulti).sfxHover = sfxHover;
hardcoreModeOptionMulti.Setup(val4, buttonText, buttonImage, defaultColor, adjustedColor);
if ((Object)(object)val5 != (Object)null)
{
((Component)val5).gameObject.SetActive(false);
}
val2.SetActive(!RunSettings.IsCustomRun);
Plugin.Log.LogInfo((object)"[HardcoreMode] Added the Hardcore Mode toggle to the ascent select screen.");
}
}
[HarmonyPatch(typeof(BoardingPass), "UpdateAscent")]
internal static class BoardingPassCustomPlayVisibilityPatch
{
[HarmonyPostfix]
private static void Postfix(BoardingPass __instance)
{
HardcoreModeOptionMulti componentInChildren = ((Component)((Component)__instance.closeButton).transform.parent).GetComponentInChildren<HardcoreModeOptionMulti>(true);
if ((Object)(object)componentInChildren != (Object)null)
{
((Component)componentInChildren).gameObject.SetActive(!RunSettings.IsCustomRun);
}
}
}
[HarmonyPatch(typeof(BoardingPass), "UpdateAscent")]
internal static class BoardingPassClearStarPatch
{
private const string GoldStar = "<color=#C9A227>★</color>";
private const string SilverStar = "<color=#7D7D7D>★</color>";
private const string RedStar = "<color=#E0115F>★</color>";
[HarmonyPostfix]
private static void Postfix(BoardingPass __instance)
{
if (RunSettings.IsCustomRun)
{
return;
}
HardcoreModeClearTracking.StarDisplay stars = HardcoreModeClearTracking.GetStars(__instance.ascentIndex);
if (stars.HasStar1)
{
string text = " " + (stars.Star1Gold ? "<color=#C9A227>★</color>" : "<color=#7D7D7D>★</color>");
if (stars.HasStar2)
{
text += (stars.Star2Gold ? "<color=#C9A227>★</color>" : "<color=#7D7D7D>★</color>");
}
for (int i = 0; i < stars.RedStarCount; i++)
{
text += "<color=#E0115F>★</color>";
}
TMP_Text ascentTitle = __instance.ascentTitle;
ascentTitle.text += text;
}
}
}
[HarmonyPatch(typeof(BoardingPass), "StartGame")]
internal static class BoardingPassStartGamePatch
{
[HarmonyPrefix]
private static void Prefix(BoardingPass __instance)
{
if (!TrueFinalAscentCompat.ShouldDeferToFinalAscentSetup(__instance))
{
Reconcile.NotifyDeparture(HardcoreModeState.Enabled);
if (HardcoreModeState.Enabled && !RunSettings.IsCustomRun)
{
int ascent = TrueFinalAscentCompat.TryGetChosenDifficulty(__instance) ?? __instance.ascentIndex;
HardcoreModeSettings.ApplyForAscent(ascent);
}
}
}
}
[HarmonyPatch(typeof(CharacterItems), "RPC_SpawnItemInHandMaster")]
internal static class CharacterItemsPatch
{
private const string BingBongItemName = "BingBong";
[HarmonyPrefix]
private static void Prefix(ref string objName)
{
if (HardcoreModeState.Enabled && objName == RunSettings.GRAPPLE_MODE_ITEM)
{
objName = "BingBong";
}
}
}
internal static class ClearTrackingPatch
{
private static bool _handlerRegistered;
public static void EnsureSubscribed()
{
if (_handlerRegistered)
{
GlobalEvents.OnLocalCharacterWonRun = (Action)Delegate.Remove(GlobalEvents.OnLocalCharacterWonRun, new Action(HandleWonRun));
}
GlobalEvents.OnLocalCharacterWonRun = (Action)Delegate.Combine(GlobalEvents.OnLocalCharacterWonRun, new Action(HandleWonRun));
_handlerRegistered = true;
}
private static void HandleWonRun()
{
if (HardcoreModeState.Tier != HardcoreModeTier.Off)
{
HardcoreModeClearTracking.MarkCleared(Ascents.currentAscent, HardcoreModeState.Tier, HasBingBong(Character.localCharacter), ClearedWithinOneHour());
}
}
private static bool ClearedWithinOneHour()
{
if ((Object)(object)RunManager.Instance == (Object)null)
{
return false;
}
return RunManager.Instance.TimeSinceRunStarted <= 3600f;
}
private static bool HasBingBong(Character character)
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)character == (Object)null)
{
return false;
}
if (Object.op_Implicit((Object)(object)character.data.currentItem) && ((Enum)character.data.currentItem.itemTags).HasFlag((Enum)(object)(ItemTags)16))
{
return true;
}
ItemSlot[] itemSlots = character.player.itemSlots;
foreach (ItemSlot val in itemSlots)
{
if (val != null && (Object)(object)val.prefab != (Object)null && ((Enum)val.prefab.itemTags).HasFlag((Enum)(object)(ItemTags)16))
{
return true;
}
}
BackpackData val2 = default(BackpackData);
if (!((ItemSlot)character.player.backpackSlot).IsEmpty() && ((ItemSlot)character.player.backpackSlot).data.TryGetDataEntry<BackpackData>((DataEntryKey)7, ref val2))
{
ItemSlot[] itemSlots2 = val2.itemSlots;
foreach (ItemSlot val3 in itemSlots2)
{
if (val3 != null && (Object)(object)val3.prefab != (Object)null && ((Enum)val3.prefab.itemTags).HasFlag((Enum)(object)(ItemTags)16))
{
return true;
}
}
}
return false;
}
}
[HarmonyPatch(typeof(Item), "RequestPickup")]
internal static class FakeClusterShroomPatch
{
private const float DefaultChancePercent = 33f;
private const float DefaultPandoraChancePercent = 1f;
private const float DefaultSnowChancePercent = 3f;
private const string MedicinalRootName = "MedicinalRoot";
private const string ClusterName = "Mushroom Cluster";
private const string ClusterPoisonName = "Mushroom Cluster Poison";
private const string HiddenMandrakeName = "Mandrake_Hidden";
private const string PandoraName = "PandorasBox";
private static bool _mandrakeResolved;
private static Item? _mandrakePrefab;
private static bool _pandoraResolved;
private static Item? _pandoraPrefab;
public static float? DebugChancePercent { get; set; }
public static float? DebugPandoraChancePercent { get; set; }
public static float? DebugSnowChancePercent { get; set; }
public static string[]? DebugTargetNames { get; set; }
public static bool DebugIgnoreHardcoreCheck { get; set; }
internal static float SnowChancePercent => DebugSnowChancePercent ?? 3f;
[HarmonyPrefix]
private static void Prefix(Item __instance)
{
try
{
if (PluginConfig.EnableFakeClusterShroom.Value && (HardcoreModeState.Enabled || DebugIgnoreHardcoreCheck) && PhotonNetwork.IsMasterClient && !((Object)(object)__instance.isSecretlyOtherItemPrefab != (Object)null))
{
string text = ((Object)((Component)__instance).gameObject).name.Replace("(Clone)", string.Empty).Trim();
if (text == "MedicinalRoot")
{
TryMedicinalRoot(__instance);
}
else if (IsClusterShroom(text))
{
TryClusterShroom(__instance);
}
}
}
catch (Exception arg)
{
Plugin.Log.LogWarning((object)$"[HardcoreMode] FakeClusterShroomPatch: could not evaluate a pickup (ignored, continuing): {arg}");
}
}
private static void TryClusterShroom(Item item)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
if ((int)item.itemState == 0 && !((Object)(object)item.rig == (Object)null) && item.rig.isKinematic && !TryApplyPandora(item) && !(Random.Range(0f, 100f) >= (DebugChancePercent ?? 33f)))
{
ApplyMandrake(item);
}
}
private static void TryMedicinalRoot(Item item)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Invalid comparison between Unknown and I4
if ((int)GetCurrentBiome() != 7)
{
TryClusterShroom(item);
}
}
private static BiomeType GetCurrentBiome()
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
try
{
MapHandler instance = Singleton<MapHandler>.Instance;
if ((Object)(object)instance != (Object)null)
{
return instance.GetCurrentBiome();
}
}
catch (Exception arg)
{
Plugin.Log.LogWarning((object)$"[HardcoreMode] Fake Cluster Shroom: could not read the current biome: {arg}");
}
return (BiomeType)(-1);
}
internal static Item? GetMandrakePrefab()
{
return ResolveMandrakePrefab();
}
private static void ApplyMandrake(Item item)
{
Item val = ResolveMandrakePrefab();
if (!((Object)(object)val == (Object)null))
{
ResetInstanceData(item);
item.isSecretlyOtherItemPrefab = val;
}
}
private static void ResetInstanceData(Item item)
{
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Invalid comparison between Unknown and I4
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
try
{
if (item.data?.data == null)
{
return;
}
List<DataEntryKey> list = new List<DataEntryKey>(item.data.data.Keys);
foreach (DataEntryKey item2 in list)
{
if ((int)item2 != 6)
{
item.data.data.Remove(item2);
}
}
}
catch (Exception arg)
{
Plugin.Log.LogWarning((object)$"[HardcoreMode] Fake Cluster Shroom: could not clear the carried-over item state (continuing): {arg}");
}
}
private static bool TryApplyPandora(Item item)
{
Item val = ResolvePandoraPrefab();
if ((Object)(object)val == (Object)null)
{
return false;
}
if (Random.Range(0f, 100f) >= (DebugPandoraChancePercent ?? 1f))
{
return false;
}
ResetInstanceData(item);
OptionableIntItemData data = item.GetData<OptionableIntItemData>((DataEntryKey)2);
data.HasData = true;
data.Value = 1;
if (val.totalUses > 0)
{
item.SetUseRemainingPercentage(1f / (float)val.totalUses);
}
item.isSecretlyOtherItemPrefab = val;
return true;
}
private static Item? ResolvePandoraPrefab()
{
if (_pandoraResolved)
{
return _pandoraPrefab;
}
_pandoraResolved = true;
try
{
Item val = default(Item);
if (ItemDatabase.TryGetItem("PandorasBox", ref val) && (Object)(object)val != (Object)null)
{
_pandoraPrefab = val;
}
else
{
Plugin.Log.LogWarning((object)"[HardcoreMode] Fake Cluster Shroom: could not find 'PandorasBox'. The hidden item stays off for this session.");
}
}
catch (Exception arg)
{
Plugin.Log.LogWarning((object)string.Format("[HardcoreMode] Fake Cluster Shroom: could not resolve '{0}' (hidden item disabled): {1}", "PandorasBox", arg));
_pandoraPrefab = null;
}
return _pandoraPrefab;
}
private static bool IsClusterShroom(string name)
{
string[] debugTargetNames = DebugTargetNames;
if (debugTargetNames != null)
{
string[] array = debugTargetNames;
foreach (string b in array)
{
if (string.Equals(name, b, StringComparison.OrdinalIgnoreCase))
{
return true;
}
}
return false;
}
if (!(name == "Mushroom Cluster"))
{
return name == "Mushroom Cluster Poison";
}
return true;
}
private static Item? ResolveMandrakePrefab()
{
if (_mandrakeResolved)
{
return _mandrakePrefab;
}
_mandrakeResolved = true;
try
{
Item val = default(Item);
if (ItemDatabase.TryGetItem("Mandrake_Hidden", ref val) && (Object)(object)val != (Object)null)
{
_mandrakePrefab = val.isSecretlyOtherItemPrefab;
}
if ((Object)(object)_mandrakePrefab == (Object)null)
{
Plugin.Log.LogWarning((object)"[HardcoreMode] Fake Cluster Shroom: could not find the real mandrake behind 'Mandrake_Hidden'. The feature stays off for this session.");
}
}
catch (Exception arg)
{
Plugin.Log.LogWarning((object)$"[HardcoreMode] Fake Cluster Shroom: could not resolve the mandrake prefab (feature disabled): {arg}");
_mandrakePrefab = null;
}
return _mandrakePrefab;
}
}
internal static class StableRollHelper
{
internal static float From(Guid instanceId)
{
byte[] value = instanceId.ToByteArray();
uint num = BitConverter.ToUInt32(value, 0) ^ BitConverter.ToUInt32(value, 4) ^ BitConverter.ToUInt32(value, 8) ^ BitConverter.ToUInt32(value, 12);
return (float)(num % 10000) / 100f;
}
}
[HarmonyPatch(typeof(GameUtils))]
internal static class GameUtilsPatches
{
private static bool _loggedTableSize;
[HarmonyPatch("Awake")]
[HarmonyPostfix]
private static void Awake_Postfix(GameUtils __instance)
{
try
{
if ((Object)(object)((Component)__instance).gameObject.GetComponent<HardcoreModeNetwork>() == (Object)null)
{
((Component)__instance).gameObject.AddComponent<HardcoreModeNetwork>();
}
LogSettingTableSizeOnce();
Reconcile.TryRun();
ClearTrackingPatch.EnsureSubscribed();
}
catch (Exception arg)
{
Plugin.Log.LogWarning((object)$"[HardcoreMode] GameUtilsPatches.Awake_Postfix: unexpected exception (ignored, continuing): {arg}");
}
}
private static void LogSettingTableSizeOnce()
{
if (!_loggedTableSize)
{
string[] alphabetizedIndices = RunSettings.alphabetizedIndices;
if (alphabetizedIndices != null)
{
_loggedTableSize = true;
Plugin.Log.LogInfo((object)($"[HardcoreMode] My run-setting table holds {alphabetizedIndices.Length} entries. " + "Every player in a lobby needs the same number here. If they differ, someone has item-adding mods the others do not."));
}
}
}
[HarmonyPatch("OnPlayerEnteredRoom")]
[HarmonyPostfix]
private static void OnPlayerEnteredRoom_Postfix(GameUtils __instance)
{
try
{
if (PhotonNetwork.IsMasterClient && (Object)(object)__instance.photonView != (Object)null)
{
__instance.photonView.RPC("RPC_SetHardcoreMode", (RpcTarget)0, new object[1] { (int)HardcoreModeState.Tier });
}
}
catch (Exception arg)
{
Plugin.Log.LogWarning((object)$"[HardcoreMode] OnPlayerEnteredRoom_Postfix: could not resend HardcoreModeState (ignored, continuing): {arg}");
}
}
}
[HarmonyPatch(typeof(GameUtils), "ApplySerializedRunSettings")]
internal static class RunSettingsSyncPatch
{
[HarmonyPostfix]
private static void Postfix()
{
if (RunSettingsTableSizePatch.ConsumeMismatch())
{
TryRebuildLocally();
}
Reconcile.TryRun();
}
[HarmonyFinalizer]
private static Exception? Finalizer(Exception? __exception)
{
if (__exception == null)
{
return null;
}
int num = -1;
try
{
string[] alphabetizedIndices = RunSettings.alphabetizedIndices;
num = ((alphabetizedIndices != null) ? alphabetizedIndices.Length : (-1));
}
catch
{
}
Plugin.Log.LogError((object)("[HardcoreMode] Could not restore RunSettings. Continuing anyway so that scene loading is not blocked. " + $"My own setting table size is {num}. " + "This happens when the player who started the run and you have a different set of item-adding mods (PEAKLib-based). " + $"Using the same mods on every player fixes it. Original exception: {__exception}"));
TryRebuildLocally();
return null;
}
private static void TryRebuildLocally()
{
try
{
if (HardcoreModeState.Enabled)
{
SceneSwitchingStatus val = default(SceneSwitchingStatus);
if (!GameHandler.TryGetStatus<SceneSwitchingStatus>(ref val))
{
Plugin.Log.LogInfo((object)"[HardcoreMode] Not in the departure sequence, so the local RunSettings rebuild is skipped.");
return;
}
int currentAscent = Ascents.currentAscent;
HardcoreModeSettings.ApplyForAscent(currentAscent);
HardcoreModeSettings.CommitCustomRun();
Plugin.Log.LogWarning((object)($"[HardcoreMode] The RunSettings we received could not be trusted, so the settings for Ascent {currentAscent} " + $"({HardcoreModeState.Tier}) were rebuilt locally. The difficulty should match the player who started the run. " + "However, if that player added extra settings through a manual Custom Run, those are not applied on this machine."));
}
}
catch (Exception arg)
{
Plugin.Log.LogWarning((object)$"[HardcoreMode] The local RunSettings rebuild failed (ignored, continuing): {arg}");
}
}
}
[HarmonyPatch(typeof(RunSettings), "SetDataFromSyncData")]
internal static class RunSettingsTableSizePatch
{
private static bool _mismatch;
internal static bool ConsumeMismatch()
{
bool mismatch = _mismatch;
_mismatch = false;
return mismatch;
}
[HarmonyPrefix]
private static void Prefix(ref RunSettingSyncData syncData)
{
_mismatch = false;
try
{
int num = syncData.settingValues?.Count ?? (-1);
string[] alphabetizedIndices = RunSettings.alphabetizedIndices;
int num2 = ((alphabetizedIndices != null) ? alphabetizedIndices.Length : (-1));
if (num >= 0 && num2 >= 0 && num != num2)
{
_mismatch = true;
Plugin.Log.LogError((object)($"[HardcoreMode] The setting table size does not match the other player (them={num} / me={num2}). " + "This is caused by a different set of item-adding mods (PEAKLib-based). While this lasts, the game's own sync applies some settings to the wrong entries. Using the same mods on every player fixes it."));
}
}
catch (Exception arg)
{
Plugin.Log.LogWarning((object)$"[HardcoreMode] Could not compare the setting table sizes (ignored, continuing): {arg}");
}
}
}
[HarmonyPatch(typeof(GlobalEvents), "ResetAllRunEvents")]
internal static class ResetAllRunEventsPatch
{
[HarmonyPostfix]
private static void Postfix()
{
Reconcile.ClearSuppression();
SnowPileMandrakePatch.ClearForNewRun();
}
}
internal static class Reconcile
{
private static bool _suppressUntilNextDeparture;
public static void NotifyDeparture(bool hardcoreModeApplied)
{
_suppressUntilNextDeparture = !hardcoreModeApplied;
}
public static void ClearSuppression()
{
_suppressUntilNextDeparture = false;
}
public static void TryRun()
{
try
{
if ((Object)(object)GameUtils.instance == (Object)null)
{
Plugin.Log.LogInfo((object)"[HardcoreMode] Reconcile.TryRun: skipped because GameUtils.instance is still null.");
return;
}
if (_suppressUntilNextDeparture)
{
Plugin.Log.LogInfo((object)"[HardcoreMode] Reconcile.TryRun: the last departure was already confirmed as non-Hardcore, so the guess is skipped.");
return;
}
bool flag = RunSettings.IsCustomRun && RunSettings.GetValue((SETTINGTYPE)20000, true) == 1;
if (flag && HardcoreModeState.Tier == HardcoreModeTier.Off)
{
Plugin.Log.LogInfo((object)"[HardcoreMode] RunSettings were restored, so HardcoreModeState is re-synced: Off -> Shadow");
HardcoreModeState.SetTier(HardcoreModeTier.Shadow);
}
else if (!flag && HardcoreModeState.Tier != HardcoreModeTier.Off)
{
Plugin.Log.LogInfo((object)$"[HardcoreMode] RunSettings were restored, so HardcoreModeState is re-synced: {HardcoreModeState.Tier} -> Off");
HardcoreModeState.SetTier(HardcoreModeTier.Off);
}
}
catch (Exception arg)
{
Plugin.Log.LogWarning((object)$"[HardcoreMode] Reconcile.TryRun: unexpected exception (ignored and continuing, so that scene loading is not blocked): {arg}");
}
}
}
[HarmonyPatch(typeof(FakeItemManager), "RPC_RequestFakeItemPickup")]
internal static class SnowPileMandrakePatch
{
private const string SnowballName = "Snowball";
private static readonly HashSet<int> Rolled = new HashSet<int>();
[HarmonyPrefix]
private static void Prefix(FakeItemManager __instance, int fakeItemIndex)
{
try
{
FakeItem val = default(FakeItem);
if (!PluginConfig.EnableFakeClusterShroom.Value || (!HardcoreModeState.Enabled && !FakeClusterShroomPatch.DebugIgnoreHardcoreCheck) || !__instance.TryGetFakeItem(fakeItemIndex, ref val) || (Object)(object)val == (Object)null)
{
return;
}
Item realItemPrefab = val.realItemPrefab;
if (!((Object)(object)realItemPrefab == (Object)null) && !(((Object)((Component)realItemPrefab).gameObject).name != "Snowball") && Rolled.Add(fakeItemIndex) && !(Random.Range(0f, 100f) >= FakeClusterShroomPatch.SnowChancePercent))
{
Item mandrakePrefab = FakeClusterShroomPatch.GetMandrakePrefab();
if (!((Object)(object)mandrakePrefab == (Object)null))
{
val.realItemPrefab = mandrakePrefab;
}
}
}
catch (Exception arg)
{
Plugin.Log.LogWarning((object)$"[HardcoreMode] SnowPileMandrakePatch: could not evaluate a pickup (ignored, continuing): {arg}");
}
}
internal static void ClearForNewRun()
{
Rolled.Clear();
}
}
[HarmonyPatch(typeof(Spawner), "TrySpawnItems")]
internal static class SpawnerPatch
{
private static bool _overrodeIsCustomRun;
[HarmonyPrefix]
private static void Prefix()
{
if (PhotonNetwork.IsMasterClient && HardcoreModeState.Enabled && RunSettings.IsCustomRun)
{
RunSettings.IsCustomRun = false;
_overrodeIsCustomRun = true;
}
}
[HarmonyPostfix]
private static void Postfix()
{
if (_overrodeIsCustomRun)
{
RunSettings.IsCustomRun = true;
_overrodeIsCustomRun = false;
}
}
}
}
namespace HardcoreMode.Compat
{
internal static class MoreAscentsCompat
{
internal const int ChaosStartAscent = 14;
internal static bool IsChaosAscent(int ascent)
{
return ascent >= 14;
}
internal static int ChaosNumber(int ascent)
{
return ascent - 14 + 1;
}
}
internal static class TrueFinalAscentCompat
{
private const string AssemblyName = "TrueFinalAscent";
private static bool _resolved;
private static MethodInfo? _isChosenMethod;
private static PropertyInfo? _confirmedProperty;
private static PropertyInfo? _chosenDifficultyProperty;
internal static bool ShouldDeferToFinalAscentSetup(BoardingPass pass)
{
try
{
EnsureResolved();
if (_isChosenMethod == null || _confirmedProperty == null)
{
return false;
}
if (!(bool)_isChosenMethod.Invoke(null, new object[1] { pass }))
{
return false;
}
bool flag = (bool)_confirmedProperty.GetValue(null);
return !flag;
}
catch (Exception arg)
{
Plugin.Log.LogWarning((object)$"[HardcoreMode] TrueFinalAscentCompat: the check failed (continuing as normal): {arg}");
return false;
}
}
internal static int? TryGetChosenDifficulty(BoardingPass pass)
{
try
{
EnsureResolved();
if (_isChosenMethod == null || _chosenDifficultyProperty == null)
{
return null;
}
if (!(bool)_isChosenMethod.Invoke(null, new object[1] { pass }))
{
return null;
}
return (int)_chosenDifficultyProperty.GetValue(null);
}
catch (Exception arg)
{
Plugin.Log.LogWarning((object)$"[HardcoreMode] TrueFinalAscentCompat: could not read the chosen difficulty (falling back to ascentIndex): {arg}");
return null;
}
}
private static void EnsureResolved()
{
if (!_resolved)
{
_resolved = true;
Type type = Type.GetType("TrueFinalAscent.FinalAscentMode, TrueFinalAscent");
Type type2 = Type.GetType("TrueFinalAscent.FinalAscentSetupWindow, TrueFinalAscent");
Type type3 = Type.GetType("TrueFinalAscent.FinalAscentDifficulty, TrueFinalAscent");
_isChosenMethod = type?.GetMethod("IsChosen", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
_confirmedProperty = type2?.GetProperty("Confirmed", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
_chosenDifficultyProperty = type3?.GetProperty("Chosen", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
}
}
}
}
namespace System.Diagnostics.CodeAnalysis
{
[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class ConstantExpectedAttribute : Attribute
{
public object? Min { get; set; }
public object? Max { get; set; }
}
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class ExperimentalAttribute : Attribute
{
public string DiagnosticId { get; }
public string? UrlFormat { get; set; }
public ExperimentalAttribute(string diagnosticId)
{
DiagnosticId = diagnosticId;
}
}
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
[ExcludeFromCodeCoverage]
internal sealed class MemberNotNullAttribute : Attribute
{
public string[] Members { get; }
public MemberNotNullAttribute(string member)
{
Members = new string[1] { member };
}
public MemberNotNullAttribute(params string[] members)
{
Members = members;
}
}
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
[ExcludeFromCodeCoverage]
internal sealed class MemberNotNullWhenAttribute : Attribute
{
public bool ReturnValue { get; }
public string[] Members { get; }
public MemberNotNullWhenAttribute(bool returnValue, string member)
{
ReturnValue = returnValue;
Members = new string[1] { member };
}
public MemberNotNullWhenAttribute(bool returnValue, params string[] members)
{
ReturnValue = returnValue;
Members = members;
}
}
[AttributeUsage(AttributeTargets.Constructor, AllowMultiple = false, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class SetsRequiredMembersAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class StringSyntaxAttribute : Attribute
{
public const string CompositeFormat = "CompositeFormat";
public const string DateOnlyFormat = "DateOnlyFormat";
public const string DateTimeFormat = "DateTimeFormat";
public const string EnumFormat = "EnumFormat";
public const string GuidFormat = "GuidFormat";
public const string Json = "Json";
public const string NumericFormat = "NumericFormat";
public const string Regex = "Regex";
public const string TimeOnlyFormat = "TimeOnlyFormat";
public const string TimeSpanFormat = "TimeSpanFormat";
public const string Uri = "Uri";
public const string Xml = "Xml";
public string Syntax { get; }
public object?[] Arguments { get; }
public StringSyntaxAttribute(string syntax)
{
Syntax = syntax;
Arguments = new object[0];
}
public StringSyntaxAttribute(string syntax, params object?[] arguments)
{
Syntax = syntax;
Arguments = arguments;
}
}
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class UnscopedRefAttribute : Attribute
{
}
}
namespace System.Runtime.Versioning
{
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class RequiresPreviewFeaturesAttribute : Attribute
{
public string? Message { get; }
public string? Url { get; set; }
public RequiresPreviewFeaturesAttribute()
{
}
public RequiresPreviewFeaturesAttribute(string? message)
{
Message = message;
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class CallerArgumentExpressionAttribute : Attribute
{
public string ParameterName { get; }
public CallerArgumentExpressionAttribute(string parameterName)
{
ParameterName = parameterName;
}
}
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class CollectionBuilderAttribute : Attribute
{
public Type BuilderType { get; }
public string MethodName { get; }
public CollectionBuilderAttribute(Type builderType, string methodName)
{
BuilderType = builderType;
MethodName = methodName;
}
}
[AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class CompilerFeatureRequiredAttribute : Attribute
{
public const string RefStructs = "RefStructs";
public const string RequiredMembers = "RequiredMembers";
public string FeatureName { get; }
public bool IsOptional { get; set; }
public CompilerFeatureRequiredAttribute(string featureName)
{
FeatureName = featureName;
}
}
[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class InterpolatedStringHandlerArgumentAttribute : Attribute
{
public string[] Arguments { get; }
public InterpolatedStringHandlerArgumentAttribute(string argument)
{
Arguments = new string[1] { argument };
}
public InterpolatedStringHandlerArgumentAttribute(params string[] arguments)
{
Arguments = arguments;
}
}
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class InterpolatedStringHandlerAttribute : Attribute
{
}
[EditorBrowsable(EditorBrowsableState.Never)]
[ExcludeFromCodeCoverage]
internal static class IsExternalInit
{
}
[AttributeUsage(AttributeTargets.Method, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class ModuleInitializerAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property, AllowMultiple = false, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class OverloadResolutionPriorityAttribute : Attribute
{
public int Priority { get; }
public OverloadResolutionPriorityAttribute(int priority)
{
Priority = priority;
}
}
[AttributeUsage(AttributeTargets.Parameter, Inherited = true, AllowMultiple = false)]
[ExcludeFromCodeCoverage]
internal sealed class ParamCollectionAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class RequiredMemberAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
[EditorBrowsable(EditorBrowsableState.Never)]
[ExcludeFromCodeCoverage]
internal sealed class RequiresLocationAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Event | AttributeTargets.Interface, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class SkipLocalsInitAttribute : Attribute
{
}
}