Decompiled source of BossChallengeMod v0.1.0
BossChallengeMod.dll
Decompiled 7 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Threading.Tasks; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using BossChallengeMod.BossPatches; using BossChallengeMod.Configuration; using BossChallengeMod.Configuration.Repositories; using BossChallengeMod.CustomActions; using BossChallengeMod.CustomMonsterStates; using BossChallengeMod.CustomMonsterStates.Configuration; using BossChallengeMod.Extensions; using BossChallengeMod.Global; using BossChallengeMod.Helpers; using BossChallengeMod.KillCounting; using BossChallengeMod.Modifiers; using BossChallengeMod.UI; using HarmonyLib; using I2.Loc; using Microsoft.CodeAnalysis; using MonoMod.Utils; using MonsterLove.StateMachine; using NineSolsAPI; using NineSolsAPI.Utils; using RCGFSM.Monster; using RCGMaker.Core; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("BossChallengeMod")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Bosses don't die")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+7fb3c98050c440686b1e736393d6fd62ccce0748")] [assembly: AssemblyProduct("BossChallengeMod")] [assembly: AssemblyTitle("BossChallengeMod")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.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] [Microsoft.CodeAnalysis.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] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace BossChallengeMod { [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("BossChallengeMod", "BossChallengeMod", "1.0.0")] public class BossChallengeMod : BaseUnityPlugin { private ConfigEntry<bool> isCyclingEnabled; private ConfigEntry<int> maxCycles; private ConfigEntry<bool> isSpeedScalingEnabled; private ConfigEntry<float> minSpeedScalingValue; private ConfigEntry<float> maxSpeedScalingValue; private ConfigEntry<int> maxSpeedScalingCycleValue; private ConfigEntry<bool> isModifiersScalingEnabled; private ConfigEntry<int> maxModifiersNumber; private ConfigEntry<int> maxModifiersNumberScalingValue; private ConfigEntry<bool> isModifiersEnabled; private ConfigEntry<bool> isModifiersRepeatingEnabled; private ConfigEntry<bool> isSpeedModifierEnabled; private ConfigEntry<bool> isTimerModifierEnabled; private ConfigEntry<bool> isParryDamageModifierEnabled; private ConfigEntry<bool> isDamageBuildupModifierEnabled; private ConfigEntry<bool> isRegenerationModifierEnabled; private ConfigEntry<bool> isKnockbackModifierEnabled; private ConfigEntry<bool> isRandomArrowModifierEnabled; private ConfigEntry<bool> isRandomTalismanModifierEnabled; private ConfigEntry<bool> isEnduranceModifierEnabled; private bool isToastsDisplayed; private bool UnloadRequested; private Harmony harmony; public CustomMonsterStateValuesResolver MonsterStateValuesResolver { get; private set; } public EventTypesResolver EventTypesResolver { get; private set; } public Dictionary<string, GeneralBossPatch> BossPatches { get; private set; } = new Dictionary<string, GeneralBossPatch>(); public UIController UIController { get; private set; } public MonsterUIController MonsterUIController { get; private set; } public LocalizationResolver LocalizationResolver { get; private set; } public ChallengeConfigurationManager ChallengeConfigurationManager { get; private set; } public GlobalModifiersFlags GlobalModifiersFlags { get; private set; } public static BossChallengeMod Instance { get; private set; } public BossChallengeMod() { MonsterStateValuesResolver = new CustomMonsterStateValuesResolver(); EventTypesResolver = new EventTypesResolver(); } private void Awake() { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown Instance = this; Log.Init(((BaseUnityPlugin)this).Logger); RCGLifeCycle.DontDestroyForever(((Component)this).gameObject); LocalizationResolver = new LocalizationResolver(); LocalizationResolver.LoadLanguage(GetLanguageCode()); IRecordsRepository recordsRepository = new JsonRecordsRepository(); ChallengeConfigurationManager = new ChallengeConfigurationManager(recordsRepository); GlobalModifiersFlags = new GlobalModifiersFlags(); InitializeConfiguration(); HandleConfigurationValues(); LocalizationManager.OnLocalizeEvent += new OnLocalizeCallback(OnLocalizationChange); UIController = new UIController(); MonsterUIController = new MonsterUIController(); InitializePatches(); SceneManager.sceneLoaded += OnSceneLoaded; harmony = Harmony.CreateAndPatchAll(typeof(BossChallengeMod).Assembly, (string)null); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin BossChallengeMod is loaded1!"); } private string GetLanguageCode() { return LocalizationManager.CurrentLanguageCode switch { "ru" => "ru-ru", "en-US" => "en-us", "zh-CN" => "zh-cn", "zh-TW" => "zh-tw", _ => "en-us", }; } private void OnLocalizationChange() { LocalizationResolver.LoadLanguage(GetLanguageCode()); InitializeConfiguration(); } private void OnDestroy() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown UnloadRequested = true; UIController.Unload(); LocalizationManager.OnLocalizeEvent -= new OnLocalizeCallback(OnLocalizationChange); SceneManager.sceneLoaded -= OnSceneLoaded; harmony.UnpatchSelf(); } private void InitializePatches() { BossPatches.Add("StealthGameMonster_伏羲_新", GetFuxiBossPatch()); BossPatches.Add("StealthGameMonster_新女媧 Variant", GetNuwaBossPatch()); BossPatches.Add("StealthGameMonster_GouMang Variant", GetGoumangBossPatch()); BossPatches.Add("Monster_GiantMechClaw", GetClawBossPatch()); ButterflyBossPatch butterflyBossPatch = GetButterflyBossPatch(); BossPatches.Add("StealthGameMonster_Boss_ButterFly Variant", butterflyBossPatch); BossPatches.Add("StealthGameMonster_Boss_ButterFly Variant (1)", new RevivalChallengeBossClonePatch()); BossPatches.Add("StealthGameMonster_Boss_ButterFly Variant (2)", new RevivalChallengeBossClonePatch()); BossPatches.Add("StealthGameMonster_Boss_ButterFly Variant (3)", new RevivalChallengeBossClonePatch()); BossPatches.Add("StealthGameMonster_Boss_ButterFly Variant (4)", new RevivalChallengeBossClonePatch()); BossPatches.Add("Boss_Yi Gung", GetEigongBossPatch()); BossPatches.Add("Default", GetDefaultBossPatch()); } private FuxiBossPatch GetFuxiBossPatch() { //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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) States state = MonsterStateValuesResolver.GetState("BossRevive"); FuxiBossPatch obj = new FuxiBossPatch { DieStates = new List<States>(3) { (States)131, (States)169, (States)110 } }; ResetBossStateConfiguration resetStateConfiguration = obj.ResetStateConfiguration; resetStateConfiguration.ExitState = (States)3; resetStateConfiguration.Animations = new List<string>(1) { "PostureBreak" }; resetStateConfiguration.StateType = state; resetStateConfiguration.TargetDamageReceivers = new List<string>(3) { "Attack", "Foo", "JumpKick" }; return obj; } private GeneralBossPatch GetNuwaBossPatch() { //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_005d: 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_0064: Unknown result type (might be due to invalid IL or missing references) States state = MonsterStateValuesResolver.GetState("BossRevive"); RevivalChallengeBossPatch obj = new RevivalChallengeBossPatch { DieStates = new List<States>(3) { (States)131, (States)169, (States)110 }, UseKillCounter = false, UseModifiers = false, UseRecording = false }; ResetBossStateConfiguration resetStateConfiguration = obj.ResetStateConfiguration; resetStateConfiguration.ExitState = (States)3; resetStateConfiguration.StateType = state; resetStateConfiguration.TargetDamageReceivers = new List<string>(3) { "Attack", "Foo", "JumpKick" }; return obj; } private GeneralBossPatch GetGoumangBossPatch() { //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_003e: 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_0045: Unknown result type (might be due to invalid IL or missing references) States state = MonsterStateValuesResolver.GetState("BossRevive"); GoumangBossPatch obj = new GoumangBossPatch { DieStates = new List<States>(2) { (States)169, (States)110 } }; ResetBossStateConfiguration resetStateConfiguration = obj.ResetStateConfiguration; resetStateConfiguration.ExitState = (States)103; resetStateConfiguration.StateType = state; resetStateConfiguration.TargetDamageReceivers = new List<string>(3) { "Attack", "Foo", "JumpKick" }; return obj; } private GeneralBossPatch GetClawBossPatch() { //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_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) States state = MonsterStateValuesResolver.GetState("BossRevive"); RevivalChallengeBossPatch obj = new RevivalChallengeBossPatch { DieStates = new List<States>(3) { (States)131, (States)169, (States)110 } }; ResetBossStateConfiguration resetStateConfiguration = obj.ResetStateConfiguration; resetStateConfiguration.Animations = new List<string>(1) { "PostureBreak" }; resetStateConfiguration.ExitState = (States)129; resetStateConfiguration.StateType = state; resetStateConfiguration.TargetDamageReceivers = new List<string>(3) { "Attack", "Foo", "JumpKick" }; return obj; } private ButterflyBossPatch GetButterflyBossPatch() { //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_001e: 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_0061: 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) States state = MonsterStateValuesResolver.GetState("BossRevive"); ButterflyBossPatch obj = new ButterflyBossPatch { DieStates = new List<States>(3) { state, (States)169, (States)110 } }; ResetBossStateConfiguration resetStateConfiguration = obj.ResetStateConfiguration; resetStateConfiguration.Animations = new List<string>(1) { "Hurt" }; resetStateConfiguration.ExitState = (States)3; resetStateConfiguration.StateType = state; resetStateConfiguration.TargetDamageReceivers = new List<string>(3) { "Attack", "Foo", "JumpKick" }; return obj; } private GeneralBossPatch GetEigongBossPatch() { //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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) States state = MonsterStateValuesResolver.GetState("BossRevive"); RevivalChallengeBossPatch obj = new RevivalChallengeBossPatch { DieStates = new List<States>(4) { (States)131, (States)146, (States)169, (States)110 } }; ResetBossStateConfiguration resetStateConfiguration = obj.ResetStateConfiguration; resetStateConfiguration.ExitState = (States)3; resetStateConfiguration.Animations = new List<string>(1) { "BossAngry" }; resetStateConfiguration.StateType = state; resetStateConfiguration.TargetDamageReceivers = new List<string>(3) { "Attack", "Foo", "JumpKick" }; return obj; } private GeneralBossPatch GetDefaultBossPatch() { //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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) States state = MonsterStateValuesResolver.GetState("BossRevive"); RevivalChallengeBossPatch obj = new RevivalChallengeBossPatch { DieStates = new List<States>(3) { (States)131, (States)169, (States)110 } }; ResetBossStateConfiguration resetStateConfiguration = obj.ResetStateConfiguration; resetStateConfiguration.ExitState = (States)3; resetStateConfiguration.Animations = new List<string>(1) { "PostureBreak" }; resetStateConfiguration.StateType = state; resetStateConfiguration.TargetDamageReceivers = new List<string>(3) { "Attack", "Foo", "JumpKick" }; return obj; } private void InitializeConfiguration() { isCyclingEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("1. General", "1.1 Enable Boss Revival", true, LocalizationResolver.Localize("config_cycling_enabled_description")); isCyclingEnabled.SettingChanged += delegate { ChallengeConfiguration challengeConfiguration20 = ChallengeConfigurationManager.ChallengeConfiguration; challengeConfiguration20.EnableRestoration = isCyclingEnabled.Value; ChallengeConfigurationManager.ChallengeConfiguration = challengeConfiguration20; }; maxCycles = ((BaseUnityPlugin)this).Config.Bind<int>("1. General", "1.2 Boss deaths number", -1, LocalizationResolver.Localize("config_cycles_number_description")); maxCycles.SettingChanged += delegate { ChallengeConfiguration challengeConfiguration19 = ChallengeConfigurationManager.ChallengeConfiguration; challengeConfiguration19.MaxCycles = maxCycles.Value; ChallengeConfigurationManager.ChallengeConfiguration = challengeConfiguration19; }; isSpeedScalingEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("2. Scaling", "2.1 Enable Speed Scaling", false, LocalizationResolver.Localize("config_scaling_enabled_description")); isSpeedScalingEnabled.SettingChanged += delegate { ChallengeConfiguration challengeConfiguration18 = ChallengeConfigurationManager.ChallengeConfiguration; challengeConfiguration18.EnableSpeedScaling = isSpeedScalingEnabled.Value; ChallengeConfigurationManager.ChallengeConfiguration = challengeConfiguration18; }; minSpeedScalingValue = ((BaseUnityPlugin)this).Config.Bind<float>("2. Scaling", "2.1.1 Scaling: Initial Speed", 1f, LocalizationResolver.Localize("config_scaling_minspeed_description")); minSpeedScalingValue.SettingChanged += delegate { ChallengeConfiguration challengeConfiguration17 = ChallengeConfigurationManager.ChallengeConfiguration; challengeConfiguration17.MinSpeedScalingValue = minSpeedScalingValue.Value; ChallengeConfigurationManager.ChallengeConfiguration = challengeConfiguration17; }; maxSpeedScalingValue = ((BaseUnityPlugin)this).Config.Bind<float>("2. Scaling", "2.1.2 Scaling: Maximum Speed", 1.35f, LocalizationResolver.Localize("config_scaling_maxspeed_description")); maxSpeedScalingValue.SettingChanged += delegate { ChallengeConfiguration challengeConfiguration16 = ChallengeConfigurationManager.ChallengeConfiguration; challengeConfiguration16.MaxSpeedScalingValue = maxSpeedScalingValue.Value; ChallengeConfigurationManager.ChallengeConfiguration = challengeConfiguration16; }; maxSpeedScalingCycleValue = ((BaseUnityPlugin)this).Config.Bind<int>("2. Scaling", "2.1.3 Maximum Speed Scaling After Deaths", 5, LocalizationResolver.Localize("config_scaling_scaling_cycle_description")); maxSpeedScalingCycleValue.SettingChanged += delegate { ChallengeConfiguration challengeConfiguration15 = ChallengeConfigurationManager.ChallengeConfiguration; challengeConfiguration15.MaxSpeedScalingCycle = maxSpeedScalingCycleValue.Value; ChallengeConfigurationManager.ChallengeConfiguration = challengeConfiguration15; }; isModifiersScalingEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("2. Scaling", "2.2 Enable Modifiers Scaling", false, LocalizationResolver.Localize("config_scaling_modifiers_enabled_description")); isModifiersScalingEnabled.SettingChanged += delegate { ChallengeConfiguration challengeConfiguration14 = ChallengeConfigurationManager.ChallengeConfiguration; challengeConfiguration14.EnableModifiersScaling = isModifiersScalingEnabled.Value; ChallengeConfigurationManager.ChallengeConfiguration = challengeConfiguration14; }; maxModifiersNumber = ((BaseUnityPlugin)this).Config.Bind<int>("2. Scaling", "2.2.1 Scaling: Maximum Modifiers Number", 3, LocalizationResolver.Localize("config_scaling_maxmodifiers_description")); maxModifiersNumber.SettingChanged += delegate { ChallengeConfiguration challengeConfiguration13 = ChallengeConfigurationManager.ChallengeConfiguration; challengeConfiguration13.MaxModifiersNumber = maxModifiersNumber.Value; ChallengeConfigurationManager.ChallengeConfiguration = challengeConfiguration13; }; maxModifiersNumberScalingValue = ((BaseUnityPlugin)this).Config.Bind<int>("2. Scaling", "2.2.2 Maximum Modifiers Number Scaling After Deaths", 3, LocalizationResolver.Localize("config_scaling_modifiers_scaling_cycle_description")); maxModifiersNumberScalingValue.SettingChanged += delegate { ChallengeConfiguration challengeConfiguration12 = ChallengeConfigurationManager.ChallengeConfiguration; challengeConfiguration12.MaxModifiersScalingCycle = maxModifiersNumberScalingValue.Value; ChallengeConfigurationManager.ChallengeConfiguration = challengeConfiguration12; }; isModifiersEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("3. Modifiers", "3.1 Enable Modifiers", false, LocalizationResolver.Localize("config_modifiers_enabled_description")); isModifiersEnabled.SettingChanged += delegate { ChallengeConfiguration challengeConfiguration11 = ChallengeConfigurationManager.ChallengeConfiguration; challengeConfiguration11.ModifiersEnabled = isModifiersEnabled.Value; ChallengeConfigurationManager.ChallengeConfiguration = challengeConfiguration11; }; isModifiersRepeatingEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("3. Modifiers", "3.2 Enable Modifiers Repeating", false, LocalizationResolver.Localize("config_repeating_enabled_description")); isModifiersRepeatingEnabled.SettingChanged += delegate { ChallengeConfiguration challengeConfiguration10 = ChallengeConfigurationManager.ChallengeConfiguration; challengeConfiguration10.ModifiersEnabled = isModifiersRepeatingEnabled.Value; ChallengeConfigurationManager.ChallengeConfiguration = challengeConfiguration10; }; isSpeedModifierEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("3. Modifiers", "3.M Speed Modifier", true, LocalizationResolver.Localize("config_modifiers_speed_enabled_description")); isSpeedModifierEnabled.SettingChanged += delegate { ChallengeConfiguration challengeConfiguration9 = ChallengeConfigurationManager.ChallengeConfiguration; challengeConfiguration9.SpeedModifierEnabled = isSpeedModifierEnabled.Value; ChallengeConfigurationManager.ChallengeConfiguration = challengeConfiguration9; }; isTimerModifierEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("3. Modifiers", "3.M Timer Modifier", true, LocalizationResolver.Localize("config_modifiers_timer_enabled_description")); isTimerModifierEnabled.SettingChanged += delegate { ChallengeConfiguration challengeConfiguration8 = ChallengeConfigurationManager.ChallengeConfiguration; challengeConfiguration8.TimerModifierEnabled = isTimerModifierEnabled.Value; ChallengeConfigurationManager.ChallengeConfiguration = challengeConfiguration8; }; isParryDamageModifierEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("3. Modifiers", "3.M Precice parry only modifier", true, LocalizationResolver.Localize("config_modifiers_parry_damage_enabled_description")); isParryDamageModifierEnabled.SettingChanged += delegate { ChallengeConfiguration challengeConfiguration7 = ChallengeConfigurationManager.ChallengeConfiguration; challengeConfiguration7.ParryDirectDamageModifierEnabled = isParryDamageModifierEnabled.Value; ChallengeConfigurationManager.ChallengeConfiguration = challengeConfiguration7; }; isDamageBuildupModifierEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("3. Modifiers", "3.M Internal damage buildup modifier", true, LocalizationResolver.Localize("config_modifiers_internal_damage_enabled_description")); isDamageBuildupModifierEnabled.SettingChanged += delegate { ChallengeConfiguration challengeConfiguration6 = ChallengeConfigurationManager.ChallengeConfiguration; challengeConfiguration6.DamageBuildupModifierEnabled = isDamageBuildupModifierEnabled.Value; ChallengeConfigurationManager.ChallengeConfiguration = challengeConfiguration6; }; isRegenerationModifierEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("3. Modifiers", "3.M Regeneration modiifer", true, LocalizationResolver.Localize("config_modifiers_regeneration_enabled_description")); isRegenerationModifierEnabled.SettingChanged += delegate { ChallengeConfiguration challengeConfiguration5 = ChallengeConfigurationManager.ChallengeConfiguration; challengeConfiguration5.RegenerationModifierEnabled = isRegenerationModifierEnabled.Value; ChallengeConfigurationManager.ChallengeConfiguration = challengeConfiguration5; }; isKnockbackModifierEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("3. Modifiers", "3.M Knockback modiifer", true, LocalizationResolver.Localize("config_modifiers_knockback_enabled_description")); isKnockbackModifierEnabled.SettingChanged += delegate { ChallengeConfiguration challengeConfiguration4 = ChallengeConfigurationManager.ChallengeConfiguration; challengeConfiguration4.KnockbackModifierEnabled = isKnockbackModifierEnabled.Value; ChallengeConfigurationManager.ChallengeConfiguration = challengeConfiguration4; }; isRandomArrowModifierEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("3. Modifiers", "3.M Random arrow modiifer", true, LocalizationResolver.Localize("config_modifiers_random_arrow_enabled_description")); isRandomArrowModifierEnabled.SettingChanged += delegate { ChallengeConfiguration challengeConfiguration3 = ChallengeConfigurationManager.ChallengeConfiguration; challengeConfiguration3.RandomArrowModifierEnabled = isRandomArrowModifierEnabled.Value; ChallengeConfigurationManager.ChallengeConfiguration = challengeConfiguration3; }; isRandomTalismanModifierEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("3. Modifiers", "3.M Random talisman modiifer", true, LocalizationResolver.Localize("config_modifiers_random_talisman_enabled_description")); isRandomTalismanModifierEnabled.SettingChanged += delegate { ChallengeConfiguration challengeConfiguration2 = ChallengeConfigurationManager.ChallengeConfiguration; challengeConfiguration2.RandomTalismanModifierEnabled = isRandomTalismanModifierEnabled.Value; ChallengeConfigurationManager.ChallengeConfiguration = challengeConfiguration2; }; isEnduranceModifierEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("3. Modifiers", "3.M Endurance modiifer", true, LocalizationResolver.Localize("config_modifiers_endurance_enabled_description")); isEnduranceModifierEnabled.SettingChanged += delegate { ChallengeConfiguration challengeConfiguration = ChallengeConfigurationManager.ChallengeConfiguration; challengeConfiguration.EnduranceModifierEnabled = isEnduranceModifierEnabled.Value; ChallengeConfigurationManager.ChallengeConfiguration = challengeConfiguration; }; } private void IsCyclingEnabled_SettingChanged(object sender, EventArgs e) { throw new NotImplementedException(); } private void HandleConfigurationValues() { ChallengeConfiguration challengeConfiguration = ChallengeConfigurationManager.ChallengeConfiguration; challengeConfiguration.EnableRestoration = isCyclingEnabled.Value; challengeConfiguration.MaxCycles = maxCycles.Value; challengeConfiguration.EnableSpeedScaling = isSpeedScalingEnabled.Value; challengeConfiguration.MinSpeedScalingValue = minSpeedScalingValue.Value; challengeConfiguration.MaxSpeedScalingValue = maxSpeedScalingValue.Value; challengeConfiguration.MaxSpeedScalingCycle = maxSpeedScalingCycleValue.Value; challengeConfiguration.EnableModifiersScaling = isModifiersScalingEnabled.Value; challengeConfiguration.MaxModifiersNumber = maxModifiersNumber.Value; challengeConfiguration.MaxModifiersScalingCycle = maxModifiersNumberScalingValue.Value; challengeConfiguration.ModifiersEnabled = isModifiersEnabled.Value; challengeConfiguration.AllowRepeatModifiers = isModifiersRepeatingEnabled.Value; challengeConfiguration.SpeedModifierEnabled = isSpeedModifierEnabled.Value; challengeConfiguration.TimerModifierEnabled = isTimerModifierEnabled.Value; challengeConfiguration.ParryDirectDamageModifierEnabled = isParryDamageModifierEnabled.Value; challengeConfiguration.DamageBuildupModifierEnabled = isDamageBuildupModifierEnabled.Value; challengeConfiguration.RegenerationModifierEnabled = isRegenerationModifierEnabled.Value; challengeConfiguration.KnockbackModifierEnabled = isKnockbackModifierEnabled.Value; challengeConfiguration.RandomArrowModifierEnabled = isRandomArrowModifierEnabled.Value; challengeConfiguration.RandomTalismanModifierEnabled = isRandomTalismanModifierEnabled.Value; challengeConfiguration.EnduranceModifierEnabled = isEnduranceModifierEnabled.Value; ChallengeConfigurationManager.ChallengeConfiguration = challengeConfiguration; } private void OnSceneLoaded(Scene scene, LoadSceneMode loadSceneMode) { UIController.FixUI(); if (!isToastsDisplayed) { isToastsDisplayed = true; ((MonoBehaviour)this).StartCoroutine(ShowToasts()); } } private IEnumerator ShowToasts() { yield return (object)new WaitForSeconds(5f); for (int i = 1; i < 5; i++) { if (UnloadRequested) { break; } ToastManager.Toast((object)LocalizationResolver.Localize($"toast_message{i}")); yield return (object)new WaitForSeconds(4f); } } } internal static class Log { private static ManualLogSource? logSource; internal static void Init(ManualLogSource logSource) { Log.logSource = logSource; } internal static void Debug(object data) { ManualLogSource? obj = logSource; if (obj != null) { obj.LogDebug(data); } } internal static void Error(object data) { ManualLogSource? obj = logSource; if (obj != null) { obj.LogError(data); } } internal static void Fatal(object data) { ManualLogSource? obj = logSource; if (obj != null) { obj.LogFatal(data); } } internal static void Info(object data) { ManualLogSource? obj = logSource; if (obj != null) { obj.LogInfo(data); } } internal static void Message(object data) { ManualLogSource? obj = logSource; if (obj != null) { obj.LogMessage(data); } } internal static void Warning(object data) { ManualLogSource? obj = logSource; if (obj != null) { obj.LogWarning(data); } } } [HarmonyPatch] public class Patches { [HarmonyPatch(typeof(MonsterBase), "CheckInit")] [HarmonyPrefix] public static void CheckInit_Prefix(MonsterBase __instance, out IEnumerable<MonsterState> __state) { __state = new List<MonsterState>(); if (((Component)__instance).tag == "Boss") { GeneralBossPatch value = null; if (!BossChallengeMod.Instance.BossPatches.TryGetValue(((Object)__instance).name, out value)) { value = BossChallengeMod.Instance.BossPatches["Default"]; } if (value != null) { value.PatchMonsterPostureSystem(__instance); __state = value.PatchMonsterStates(__instance); IEnumerable<RCGEventSender> senders = value.CreateSenders(__instance, __state); IEnumerable<RCGEventReceiver> receivers = value.CreateReceivers(__instance, __state); value.ProcessEventHandlers(receivers, senders); } } } [HarmonyPatch(typeof(MonsterBase), "CheckInit")] [HarmonyPostfix] public static void CheckInit_Postfix(MonsterBase __instance, IEnumerable<MonsterState> __state) { if (((Component)__instance).tag == "Boss") { GeneralBossPatch value = null; if (!BossChallengeMod.Instance.BossPatches.TryGetValue(((Object)__instance).name, out value)) { value = BossChallengeMod.Instance.BossPatches["Default"]; } value?.PatchMonsterFsmLookupStates(__instance, __state); value?.PostfixPatch(__instance); } } [HarmonyPatch(typeof(ButterflyBossFightLogic), "SetPhase")] [HarmonyPostfix] public static void SetPhase_Postfix(ButterflyBossFightLogic __instance, int targetPhase) { if (targetPhase == 2) { GeneralBossPatch generalBossPatch = BossChallengeMod.Instance.BossPatches["StealthGameMonster_Boss_ButterFly Variant"]; MonsterBase obj = __instance.allMonsters[0]; obj.postureSystem.DieHandleingStates.Clear(); obj.postureSystem.DieHandleingStates.AddRange(generalBossPatch.DieStates); obj.postureSystem.GenerateCurrentDieHandleStacks(); } } [HarmonyPatch(typeof(ButterflyBossFightLogic), "SetPhase")] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> SetPhaseTranspiler(IEnumerable<CodeInstruction> instructions) { List<CodeInstruction> list = instructions.ToList(); if (list.Count >= 219) { list[213].opcode = OpCodes.Nop; list[214].opcode = OpCodes.Nop; list[215].opcode = OpCodes.Nop; list[216].opcode = OpCodes.Nop; list[217].opcode = OpCodes.Nop; list[218].opcode = OpCodes.Nop; } return instructions; } [HarmonyPatch(typeof(ButterflyBossFightLogic), "ChangingPhase")] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> ChangingPhaseTranspiler(IEnumerable<CodeInstruction> instructions) { List<CodeInstruction> list = instructions.ToList(); if (list.Count >= 6) { list[0].opcode = OpCodes.Nop; list[1].opcode = OpCodes.Nop; list[2].opcode = OpCodes.Nop; list[3].opcode = OpCodes.Nop; list[4].opcode = OpCodes.Nop; list[5].opcode = OpCodes.Nop; } return instructions; } [HarmonyPatch(typeof(PlayerParryState), "NonAccurateParry")] [HarmonyPostfix] public static void ParryDamageModifier_Patch(PlayerParryState __instance, ref EffectHitData hitData, ref ParryParam param, ref DamageDealer bindDamage) { if ((Object)(object)bindDamage.Owner == (Object)null) { return; } ModifierBase[] componentsInChildren = ((Component)bindDamage.Owner).GetComponentsInChildren<ModifierBase>(); if (componentsInChildren != null) { ModifierBase? modifierBase = componentsInChildren.FirstOrDefault((ModifierBase m) => m.Key == "parry_damage"); if (modifierBase != null && ((Behaviour)modifierBase).enabled) { PlayerHealth health = Player.i.health; health.CurrentInternalInjury = 0f; health.ResetRecoverableTime(); } ModifierBase? modifierBase2 = componentsInChildren.FirstOrDefault((ModifierBase m) => m.Key == "damage_buildup"); if (modifierBase2 != null && ((Behaviour)modifierBase2).enabled) { PlayerHealth health2 = Player.i.health; float damageAmount = bindDamage.DamageAmount; health2.RecoverInternalInjury(damageAmount / 2f); } } } [HarmonyPatch(typeof(PlayerParryState), "Parried")] [HarmonyPrefix] public static void ParryMethodPatch(ref ParryParam param, ref DamageDealer bindDamage) { if ((Object)(object)bindDamage.Owner == (Object)null) { return; } ModifierBase[] componentsInChildren = ((Component)bindDamage.Owner).GetComponentsInChildren<ModifierBase>(); if (componentsInChildren != null) { ModifierBase? modifierBase = componentsInChildren.FirstOrDefault((ModifierBase m) => m.Key == "knockback"); if (modifierBase != null && ((Behaviour)modifierBase).enabled) { param.knockBackValue *= 2f; } } } [HarmonyPatch(typeof(Player), "NextItemCheck")] [HarmonyPrefix] public static bool NextItemPatch() { if (BossChallengeMod.Instance.GlobalModifiersFlags.BlockArrowVotes.Any()) { return false; } return true; } [HarmonyPatch(typeof(Player), "PreviousItemCheck")] [HarmonyPrefix] public static bool PrevItemPatch() { if (BossChallengeMod.Instance.GlobalModifiersFlags.BlockArrowVotes.Any()) { return false; } return true; } [HarmonyPatch(typeof(PlayerWeaponState), "OnStateExit")] [HarmonyPostfix] public static void WeaponCheckPatch() { if (BossChallengeMod.Instance.GlobalModifiersFlags.BlockArrowVotes.Any()) { Random random = new Random(); int acquiredCount = ((AbstractGameFlagCollection)Player.i.weaponDataCollection).AcquiredCount; int num = random.Next(1, acquiredCount); for (int i = 0; i < num; i++) { ((AbstractGameFlagCollection)Player.i.weaponDataCollection).Next(); } } } [HarmonyPatch(typeof(FooManager), "ExplodeWithDealer")] [HarmonyPostfix] public static void FooExplodePatch() { Random random = new Random(); if (!BossChallengeMod.Instance.GlobalModifiersFlags.BlockTalismanVotes.Any()) { return; } CollectionRotateSelectorButton component = GameObject.Find("GameCore(Clone)/RCG LifeCycle/UIManager/GameplayUICamera/UI-Canvas/[Tab] MenuTab/CursorProvider/Menu Vertical Layout/Panels/PlayerStatus Panel/Description Provider/LeftPart/PlayerStatusSelectableButton_ControlStyle").GetComponent<CollectionRotateSelectorButton>(); if ((Object)(object)component != (Object)null) { AbstractGameFlagCollection collection = ((SelectFromCollectionButton)component).collection; int acquiredCount = collection.AcquiredCount; int num = random.Next(1, acquiredCount); for (int i = 0; i < num; i++) { collection.Next(); } ((UIControlButton)component).UpdateView(); BossChallengeMod.Instance.UIController.UpdateTalisman(((SelectFromCollectionButton)component).image.sprite); } } [HarmonyPatch(typeof(MonsterBase), "HurtInterruptCheck")] [HarmonyPrefix] public static bool HurtInterruptPatch(MonsterBase __instance) { if (((Object)__instance).name.Contains("Boss_ButterFly")) { return true; } ModifierBase[] componentsInChildren = ((Component)__instance).GetComponentsInChildren<ModifierBase>(); if (componentsInChildren != null) { ModifierBase? modifierBase = componentsInChildren.FirstOrDefault((ModifierBase m) => m.Key == "endurance"); if (modifierBase != null && ((Behaviour)modifierBase).enabled) { return false; } } return true; } [HarmonyPatch(typeof(PlayerFooExplodeState), "AnimationEvent")] [HarmonyPostfix] public static void FooExplodeAnimationEventPatch() { if (((AbilityWrapper)(ref Player.i.mainAbilities.FooExplodeAutoStyle)).IsActivated) { Player.i.ChangeState((PlayerStateType)0, false); } } [HarmonyPatch(typeof(CollectionRotateSelectorButton), "SubmitImplementation")] [HarmonyPrefix] public static bool FooSelectionPatchPrefix(CollectionRotateSelectorButton __instance) { if (((Object)((Component)__instance).gameObject).name == "PlayerStatusSelectableButton_ControlStyle" && BossChallengeMod.Instance.GlobalModifiersFlags.BlockTalismanVotes.Any()) { return false; } return true; } [HarmonyPatch(typeof(CollectionRotateSelectorButton), "SubmitImplementation")] [HarmonyPostfix] public static void FooSelectionPatchPostfix(CollectionRotateSelectorButton __instance) { if (((Object)((Component)__instance).gameObject).name == "PlayerStatusSelectableButton_ControlStyle") { BossChallengeMod.Instance.UIController.UpdateTalisman(((SelectFromCollectionButton)__instance).image.sprite); } } } public static class PluginInfo { public const string PLUGIN_GUID = "BossChallengeMod"; public const string PLUGIN_NAME = "BossChallengeMod"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace BossChallengeMod.UI { public class CurrentTalismanUIContoller : MonoBehaviour { private Image talismanImage; public void Awake() { talismanImage = CreateImage(); ValidateImage(); } public void UpdateCurrentTalisman(Sprite sprite) { _ = Player.i; talismanImage.sprite = sprite; ValidateImage(); } private Image CreateImage() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("CurrentTalisman"); val.transform.SetParent(((Component)this).transform, false); Image obj = val.AddComponent<Image>(); ((Transform)((Graphic)obj).rectTransform).localScale = new Vector3(1.5f, 1.5f, 1f); return obj; } private Sprite GetTalismanSprite(AbilityWrapper style, AbilityWrapper upgrade, Sprite baseSprite, Sprite upgradedSprite) { if (((AbilityWrapper)(ref style)).IsActivated) { if (!((AbilityWrapper)(ref upgrade)).IsActivated) { return baseSprite; } return upgradedSprite; } return null; } private void ValidateImage() { ((Behaviour)talismanImage).enabled = (Object)(object)talismanImage.sprite != (Object)null; } } public class KillCounterController : MonoBehaviour { private TMP_FontAsset font; private LocalizationResolver localizer = BossChallengeMod.Instance.LocalizationResolver; private bool needToShow; private bool needToShowExpanded; public TMP_Text MainCounterText; public TMP_Text HightScoreText; public TMP_Text LastAttemptText; public float labelSpacing = 10f; public float animationChangeDuration = 1f; public float labelTextAnimationShowDuration = 1f; public float labelTextAnimationHideDuration = 1f; public float labelTextDefaultAlpha = 1f; public float expandedTextAnimationShowDuration = 1f; public float expandedTextAnimationHideDuration = 1f; public float expandedTextDefaultAlpha = 1f; public UIControllerAnimationState UIControllerAnimationState { get; set; } public void Awake() { //IL_000d: 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_00a9: Unknown result type (might be due to invalid IL or missing references) font = LoadFont(); MainCounterText = UIController.InitializeText(Vector2.zero, ((Component)this).gameObject, string.Format("{0} {1}", localizer.Localize("kill_counter"), 0), active: false, 32, font, (TextAlignmentOptions)260); HightScoreText = UIController.InitializeText(new Vector2(0f, -36f), ((Component)this).gameObject, string.Format("{0} {1}", localizer.Localize("kill_counter_hs"), 0), active: false, 20, font, (TextAlignmentOptions)260); LastAttemptText = UIController.InitializeText(new Vector2(0f, -56f), ((Component)this).gameObject, string.Format("{0} {1}", localizer.Localize("kill_counter_last"), 0), active: false, 20, font, (TextAlignmentOptions)260); labelTextDefaultAlpha = MainCounterText.alpha; expandedTextDefaultAlpha = HightScoreText.alpha; MainCounterText.alpha = 0f; } public void ChangeNumber(int number) { MainCounterText.text = localizer.Localize("kill_counter") + " " + number; } public void Show() { needToShow = true; ((MonoBehaviour)this).StartCoroutine(AnimateTextShow(MainCounterText, needToShow, labelTextDefaultAlpha, labelTextAnimationShowDuration, EasingFunctions.Linear)); } public void Hide(Action? callback = null) { needToShow = false; ((MonoBehaviour)this).StartCoroutine(AnimateTextHide(MainCounterText, needToShow, labelTextDefaultAlpha, labelTextAnimationHideDuration, EasingFunctions.Linear, callback)); } public void UpdateHighScore(int number) { HightScoreText.text = localizer.Localize("kill_counter_hs") + " " + number; } public void UpdatePrevResult(int number) { LastAttemptText.text = localizer.Localize("kill_counter_last") + " " + number; } public void ShowExtraText(Action? callback = null) { if (UIControllerAnimationState == UIControllerAnimationState.ModifiersLowered) { needToShowExpanded = true; ((MonoBehaviour)this).StartCoroutine(AnimateTextShow(HightScoreText, needToShowExpanded, expandedTextDefaultAlpha, expandedTextAnimationShowDuration, EasingFunctions.Linear, callback)); ((MonoBehaviour)this).StartCoroutine(AnimateTextShow(LastAttemptText, needToShowExpanded, expandedTextDefaultAlpha, expandedTextAnimationShowDuration, EasingFunctions.Linear)); } } public void HideExtraText(Action? callback = null) { if (UIControllerAnimationState == UIControllerAnimationState.KillCounterExpanded) { needToShowExpanded = false; ((MonoBehaviour)this).StartCoroutine(AnimateTextHide(HightScoreText, needToShowExpanded, expandedTextDefaultAlpha, expandedTextAnimationHideDuration, EasingFunctions.Linear, callback)); ((MonoBehaviour)this).StartCoroutine(AnimateTextHide(LastAttemptText, needToShowExpanded, expandedTextDefaultAlpha, expandedTextAnimationHideDuration, EasingFunctions.Linear)); } } private IEnumerator AnimateTextShow(TMP_Text text, bool flag, float defaultAlpha, float showDuration, Func<float, float> easingFunction, Action? callback = null) { if (flag) { ((Component)text).gameObject.SetActive(true); float startingAlpha = text.alpha; float num = startingAlpha / defaultAlpha; float elapsedTime = showDuration * num; while (flag && elapsedTime < showDuration) { elapsedTime += Time.unscaledDeltaTime; float arg = elapsedTime / showDuration; text.alpha = Mathf.Lerp(startingAlpha, defaultAlpha, easingFunction(arg)); yield return null; } if (flag) { callback?.Invoke(); } } } private IEnumerator AnimateTextHide(TMP_Text text, bool flag, float defaultAlpha, float hideDuration, Func<float, float> easingFunction, Action? callback = null) { if (!flag) { float startingAlpha = text.alpha; float num = 1f - startingAlpha / defaultAlpha; float elapsedTime = hideDuration * num; while (!flag && elapsedTime < hideDuration) { elapsedTime += Time.unscaledDeltaTime; float arg = elapsedTime / hideDuration; text.alpha = Mathf.Lerp(startingAlpha, 0f, easingFunction(arg)); yield return null; } if (!flag) { ((Component)text).gameObject.SetActive(false); callback?.Invoke(); } } } private TMP_FontAsset? LoadFont() { TMP_FontAsset[] array = Resources.FindObjectsOfTypeAll<TMP_FontAsset>(); foreach (TMP_FontAsset val in array) { if (((Object)val).name == "LiberationSans SDF") { return val; } } return null; } } public class ModifiersUIController : MonoBehaviour { private enum ModifiersUIState { Hidden, UnfoldingLine, LineUnfolded, UnfoldingModifiers, ModifiersUnfolded, CollapsingModifiers, ModifiersCollapsed, CollapsingLine } private RectTransform line; private List<string> modifiers = new List<string>(); private List<TMP_Text> items = new List<TMP_Text>(); private LocalizationResolver localizer = BossChallengeMod.Instance.LocalizationResolver; public float lineDefaultLength = 200f; public float lineUnfoldAnimationDuration = 0.75f; public float lineFoldAnimationDuration = 0.75f; public float modifierTextAnimationShowDuration = 1f; public float modifierTextAnimationHideDuration = 1f; public float modifierTextDefaultAlpha = 0.79f; private float modifiersDefaultHeight = -21f; private float modifiersLoweredHeight = -66f; private float modifiersRaisingAnimationDuration = 1f; private float modifiersLoweringAnimationDuration = 1f; private bool forceHide; public UIControllerAnimationState UIControllerAnimationState; private ModifiersUIState currentState; private ModifiersUIState CurrentState { get { return currentState; } set { switch (value) { case ModifiersUIState.Hidden: currentState = value; break; case ModifiersUIState.UnfoldingLine: currentState = value; break; case ModifiersUIState.LineUnfolded: currentState = value; if (modifiers.Any()) { ((MonoBehaviour)this).StartCoroutine(UnfoldModifiers()); } else { ((MonoBehaviour)this).StartCoroutine(CollapseLineAnimation()); } break; case ModifiersUIState.UnfoldingModifiers: currentState = value; break; case ModifiersUIState.ModifiersUnfolded: currentState = value; break; case ModifiersUIState.CollapsingModifiers: currentState = value; break; case ModifiersUIState.ModifiersCollapsed: currentState = value; if (modifiers.Any() && !forceHide) { ((MonoBehaviour)this).StartCoroutine(UnfoldModifiers()); } else { ((MonoBehaviour)this).StartCoroutine(CollapseLineAnimation()); } break; case ModifiersUIState.CollapsingLine: currentState = value; break; default: currentState = value; break; } } } public void Awake() { line = CreateLine(); ((Component)line).gameObject.SetActive(false); } public void Show(bool force = false) { if (modifiers.Any() || force) { forceHide = false; switch (CurrentState) { case ModifiersUIState.Hidden: ((MonoBehaviour)this).StartCoroutine(UnfoldLineAnimation()); break; case ModifiersUIState.CollapsingLine: CurrentState = ModifiersUIState.UnfoldingLine; break; case ModifiersUIState.UnfoldingLine: case ModifiersUIState.LineUnfolded: case ModifiersUIState.UnfoldingModifiers: case ModifiersUIState.ModifiersUnfolded: case ModifiersUIState.CollapsingModifiers: case ModifiersUIState.ModifiersCollapsed: break; } } } public void Hide(bool force = false) { forceHide = force; switch (CurrentState) { case ModifiersUIState.UnfoldingLine: CurrentState = ModifiersUIState.CollapsingLine; break; case ModifiersUIState.LineUnfolded: ((MonoBehaviour)this).StartCoroutine(CollapseLineAnimation()); break; case ModifiersUIState.UnfoldingModifiers: CurrentState = ModifiersUIState.CollapsingModifiers; break; case ModifiersUIState.ModifiersUnfolded: ((MonoBehaviour)this).StartCoroutine(CollapseModifiers()); break; case ModifiersUIState.Hidden: case ModifiersUIState.CollapsingModifiers: case ModifiersUIState.ModifiersCollapsed: case ModifiersUIState.CollapsingLine: break; } } public void SetModifiers(IEnumerable<string> modifiers) { this.modifiers.Clear(); this.modifiers.AddRange(modifiers); Hide(); } public void Reset() { SetModifiers(Array.Empty<string>()); } public void RaiseModifiers(Action? callback = null) { ((MonoBehaviour)this).StartCoroutine(AnimateModifiersRaising(callback)); } public void LowerModifiers(Action? callback = null) { ((MonoBehaviour)this).StartCoroutine(AnimateModifiersLowering(callback)); } private IEnumerator UnfoldModifiers() { if (CurrentState == ModifiersUIState.LineUnfolded || CurrentState == ModifiersUIState.ModifiersCollapsed || CurrentState == ModifiersUIState.CollapsingModifiers) { CurrentState = ModifiersUIState.UnfoldingModifiers; Queue<string> modifiersQueue = new Queue<string>(modifiers); int counter = 1; while (items.Any()) { yield return (object)new WaitForSecondsRealtime(0.1f); } while (modifiersQueue.Any() && CurrentState == ModifiersUIState.UnfoldingModifiers) { string key = modifiersQueue.Dequeue(); TMP_Text val = UIController.InitializeText(new Vector2(0f, (float)(-31 * counter)), ((Component)this).gameObject, localizer.Localize(key), active: true, 21, null, (TextAlignmentOptions)260); counter++; val.alpha = 0f; items.Add(val); ((MonoBehaviour)this).StartCoroutine(AnimateModifierShow(val, !modifiersQueue.Any())); yield return (object)new WaitForSecondsRealtime(0.33f); } } } private IEnumerator CollapseModifiers() { if (CurrentState == ModifiersUIState.ModifiersUnfolded || CurrentState == ModifiersUIState.UnfoldingModifiers) { CurrentState = ModifiersUIState.CollapsingModifiers; while (items.Any()) { TMP_Text textItem = ListExtensions.Pop<TMP_Text>(items); ((MonoBehaviour)this).StartCoroutine(AnimateModifierHide(textItem, !items.Any())); yield return (object)new WaitForSecondsRealtime(0.33f); } } } private IEnumerator UnfoldLineAnimation() { if (CurrentState == ModifiersUIState.Hidden || CurrentState == ModifiersUIState.CollapsingLine) { CurrentState = ModifiersUIState.UnfoldingLine; ((Component)line).gameObject.SetActive(true); float startingLength = line.sizeDelta.x; float num = startingLength / lineDefaultLength; float elapsedTime = lineUnfoldAnimationDuration * num; while (CurrentState == ModifiersUIState.UnfoldingLine && elapsedTime < lineUnfoldAnimationDuration) { elapsedTime += Time.unscaledDeltaTime; float t = elapsedTime / lineUnfoldAnimationDuration; float num2 = Mathf.Lerp(startingLength, lineDefaultLength, EasingFunctions.EaseOut(t)); line.sizeDelta = new Vector2(num2, line.sizeDelta.y); yield return null; } if (CurrentState == ModifiersUIState.UnfoldingLine) { CurrentState = ModifiersUIState.LineUnfolded; } } } private IEnumerator CollapseLineAnimation() { if (CurrentState == ModifiersUIState.LineUnfolded || CurrentState == ModifiersUIState.UnfoldingLine || CurrentState == ModifiersUIState.ModifiersCollapsed) { CurrentState = ModifiersUIState.CollapsingLine; float startingLength = line.sizeDelta.x; float num = 1f - startingLength / lineDefaultLength; float elapsedTime = lineFoldAnimationDuration * num; while (CurrentState == ModifiersUIState.CollapsingLine && elapsedTime < lineFoldAnimationDuration) { elapsedTime += Time.unscaledDeltaTime; float t = elapsedTime / lineFoldAnimationDuration; float num2 = Mathf.Lerp(startingLength, 0f, EasingFunctions.EaseOut(t)); line.sizeDelta = new Vector2(num2, line.sizeDelta.y); yield return null; } if (CurrentState == ModifiersUIState.CollapsingLine) { CurrentState = ModifiersUIState.Hidden; } } } private IEnumerator AnimateModifierShow(TMP_Text textItem, bool last = false) { if (CurrentState == ModifiersUIState.UnfoldingModifiers) { ((Component)textItem).gameObject.SetActive(true); float startingAlpha = textItem.alpha; float num = startingAlpha / modifierTextDefaultAlpha; float elapsedTime = modifierTextAnimationShowDuration * num; while (CurrentState == ModifiersUIState.UnfoldingModifiers && elapsedTime < modifierTextAnimationShowDuration) { elapsedTime += Time.unscaledDeltaTime; float num2 = elapsedTime / modifierTextAnimationShowDuration; textItem.alpha = Mathf.Lerp(startingAlpha, modifierTextDefaultAlpha, num2); yield return null; } if (CurrentState == ModifiersUIState.UnfoldingModifiers && last) { CurrentState = ModifiersUIState.ModifiersUnfolded; } } } private IEnumerator AnimateModifierHide(TMP_Text textItem, bool last = false) { float startingAlpha = textItem.alpha; float num = 1f - startingAlpha / modifierTextDefaultAlpha; float elapsedTime = modifierTextAnimationHideDuration * num; while (elapsedTime < modifierTextAnimationHideDuration) { elapsedTime += Time.unscaledDeltaTime; float num2 = elapsedTime / modifierTextAnimationHideDuration; textItem.alpha = Mathf.Lerp(startingAlpha, 0f, num2); yield return null; } if (CurrentState == ModifiersUIState.CollapsingModifiers && last) { CurrentState = ModifiersUIState.ModifiersCollapsed; } Object.Destroy((Object)(object)((Component)textItem).gameObject); } private IEnumerator AnimateModifiersLowering(Action? callback = null) { if (UIControllerAnimationState == UIControllerAnimationState.KillCounterCollapsed) { float elapsedTime = 0f; Vector3 localPosition = default(Vector3); while (elapsedTime < modifiersLoweringAnimationDuration) { elapsedTime += Time.unscaledDeltaTime; float t = elapsedTime / modifiersLoweringAnimationDuration; ((Vector3)(ref localPosition))..ctor(((Component)this).transform.localPosition.x, Mathf.Lerp(modifiersDefaultHeight, modifiersLoweredHeight, EasingFunctions.EaseOut(t))); ((Component)this).transform.localPosition = localPosition; yield return null; } if (UIControllerAnimationState == UIControllerAnimationState.KillCounterCollapsed) { callback?.Invoke(); } } } private IEnumerator AnimateModifiersRaising(Action? callback = null) { if (UIControllerAnimationState == UIControllerAnimationState.KillCounterExpandedTextHidden) { float elapsedTime = 0f; Vector3 localPosition = default(Vector3); while (elapsedTime < modifiersRaisingAnimationDuration) { elapsedTime += Time.unscaledDeltaTime; float t = elapsedTime / modifiersRaisingAnimationDuration; ((Vector3)(ref localPosition))..ctor(((Component)this).transform.localPosition.x, Mathf.Lerp(modifiersLoweredHeight, modifiersDefaultHeight, EasingFunctions.EaseOut(t))); ((Component)this).transform.localPosition = localPosition; yield return null; } if (UIControllerAnimationState == UIControllerAnimationState.KillCounterExpandedTextHidden) { callback?.Invoke(); } } } private RectTransform CreateLine() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) Color color = default(Color); ((Color)(ref color))..ctor(0.941f, 0.862f, 0.588f, 0.79f); float num = 1f; float num2 = 0f; GameObject val = new GameObject("HorizontalLine"); val.transform.SetParent(((Component)this).transform, false); ((Graphic)val.AddComponent<Image>()).color = color; RectTransform component = val.GetComponent<RectTransform>(); component.sizeDelta = new Vector2(num2, num); component.anchorMin = new Vector2(0.5f, 0.5f); component.anchorMax = new Vector2(0.5f, 0.5f); component.pivot = new Vector2(1f, 0.5f); component.anchoredPosition = Vector2.zero; val.transform.localPosition = Vector2.op_Implicit(new Vector2(100f, 0f)); return component; } } public class MonsterUIController { private MonsterKillCounter? trackedKillCounter; private MonsterModifierController? trackedModifiersController; private UIController UIController = BossChallengeMod.Instance.UIController; private bool isHidingKillCounter; private bool isHidingRecordsText; public bool IsHidingKillCounter { get { return isHidingKillCounter; } set { isHidingKillCounter = value; if ((Object)(object)trackedKillCounter != (Object)null && !isHidingKillCounter) { UpdateKillCounterUI(); } } } public bool IsHidingRecordsText { get { return isHidingRecordsText; } set { isHidingRecordsText = value; if ((Object)(object)trackedKillCounter != (Object)null && !isHidingRecordsText) { UpdateKillCounterUI(); } } } public MonsterUIController() { UIController uIController = UIController; uIController.OnModifiersRaisedAnimationDone = (Action)Delegate.Combine(uIController.OnModifiersRaisedAnimationDone, (Action)delegate { IsHidingRecordsText = false; }); SceneManager.sceneUnloaded += ValidateOnSceneUnload; } public void ChangeKillCounter(MonsterKillCounter? monsterKillCounter) { if ((Object)(object)trackedKillCounter != (Object)null) { MonsterKillCounter? monsterKillCounter2 = trackedKillCounter; monsterKillCounter2.OnUpdate = (Action)Delegate.Remove(monsterKillCounter2.OnUpdate, new Action(UpdateKillCounterUI)); MonsterKillCounter? monsterKillCounter3 = trackedKillCounter; monsterKillCounter3.OnDestroyActions = (Action)Delegate.Remove(monsterKillCounter3.OnDestroyActions, new Action(ResetKillCounter)); } trackedKillCounter = monsterKillCounter; if ((Object)(object)trackedKillCounter != (Object)null) { MonsterKillCounter? monsterKillCounter4 = trackedKillCounter; monsterKillCounter4.OnUpdate = (Action)Delegate.Combine(monsterKillCounter4.OnUpdate, new Action(UpdateKillCounterUI)); MonsterKillCounter? monsterKillCounter5 = trackedKillCounter; monsterKillCounter5.OnDestroyActions = (Action)Delegate.Combine(monsterKillCounter5.OnDestroyActions, new Action(ResetKillCounter)); } UpdateKillCounterUI(); } public void ChangeModifiersController(MonsterModifierController? monsterModifierController) { if ((Object)(object)trackedModifiersController != (Object)null) { MonsterModifierController? monsterModifierController2 = trackedModifiersController; monsterModifierController2.OnModifiersRoll = (Action)Delegate.Remove(monsterModifierController2.OnModifiersRoll, new Action(UpdateModifierUI)); MonsterModifierController? monsterModifierController3 = trackedModifiersController; monsterModifierController3.OnDestroyActions = (Action)Delegate.Remove(monsterModifierController3.OnDestroyActions, new Action(ResetModifierController)); } trackedModifiersController = monsterModifierController; if ((Object)(object)trackedModifiersController != (Object)null) { MonsterModifierController? monsterModifierController4 = trackedModifiersController; monsterModifierController4.OnModifiersRoll = (Action)Delegate.Combine(monsterModifierController4.OnModifiersRoll, new Action(UpdateModifierUI)); MonsterModifierController? monsterModifierController5 = trackedModifiersController; monsterModifierController5.OnDestroyActions = (Action)Delegate.Combine(monsterModifierController5.OnDestroyActions, new Action(ResetModifierController)); } UpdateModifierUI(); } private void UpdateKillCounterUI() { if ((Object)(object)trackedKillCounter == (Object)null) { IsHidingKillCounter = true; UIController.HideText(delegate { IsHidingKillCounter = false; }); if (UIController.CurrentAnimationState != 0) { IsHidingRecordsText = true; UIController.HideExpandedKillNumbersText(); } return; } if (!isHidingKillCounter) { UIController.UpdateBossCounterNumber(trackedKillCounter.KillCounter); UIController.ShowText(); } if (!isHidingRecordsText && (trackedKillCounter.BestCount > 0 || trackedKillCounter.LastCount > 0)) { UIController.UpdateBossRecordValues(trackedKillCounter.BestCount, trackedKillCounter.LastCount); UIController.ShowExpandedKillNumbersText(); } } private void UpdateModifierUI() { if ((Object)(object)trackedModifiersController == (Object)null) { UIController.HideModifiers(); } else if (trackedModifiersController.Selected.Any()) { UIController.UpdateModifiers(trackedModifiersController.Selected.Select((ModifierConfig m) => m.Key)); } else { UIController.HideModifiers(); } } public void ResetKillCounter() { ChangeKillCounter(null); } public void ResetModifierController() { ChangeModifiersController(null); } public void ValidateOnSceneUnload(Scene scene) { UpdateKillCounterUI(); UpdateModifierUI(); } public void Unload() { SceneManager.sceneUnloaded -= ValidateOnSceneUnload; } } public class TimerController : MonoBehaviour { private enum UIAnimationStates { Show, Hide } private TMP_Text timerText; private TMP_FontAsset font; private float animationShowDuration = 0.75f; private float animationHideDuration = 0.75f; private float hiddenYPosition; private float visibleYPosition; private UIAnimationStates state = UIAnimationStates.Hide; public void Awake() { //IL_000d: 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_0073: Unknown result type (might be due to invalid IL or missing references) font = LoadFont(); timerText = UIController.InitializeText(Vector2.zero, ((Component)this).gameObject, "00:00:000", active: false, 32, font, (TextAlignmentOptions)514); visibleYPosition = GetVisiblePosition(); hiddenYPosition = GetHiddenPosition(); timerText.transform.localPosition = new Vector3(timerText.transform.localPosition.x, hiddenYPosition); } public void Show() { state = UIAnimationStates.Show; ((MonoBehaviour)this).StartCoroutine(AnimateTimerShow()); } public void Hide() { state = UIAnimationStates.Hide; ((MonoBehaviour)this).StartCoroutine(AnimateTimerHide()); } public void UpdateTimer(int milliseconds) { timerText.text = FormatMilliseconds(milliseconds); } private string FormatMilliseconds(int milliseconds) { TimeSpan timeSpan = TimeSpan.FromMilliseconds(milliseconds); return $"{timeSpan.Minutes:D2}:{timeSpan.Seconds:D2}.{timeSpan.Milliseconds:D3}"; } private IEnumerator AnimateTimerShow() { if (state == UIAnimationStates.Show) { ((Component)timerText).gameObject.SetActive(true); float elapsedTime = 0f; while (elapsedTime < animationShowDuration && state == UIAnimationStates.Show) { elapsedTime += Time.unscaledDeltaTime; float t = elapsedTime / animationShowDuration; float num = Mathf.Lerp(hiddenYPosition, visibleYPosition, EasingFunctions.EaseOut(t)); timerText.transform.localPosition = new Vector3(timerText.transform.localPosition.x, num); yield return null; } } } private IEnumerator AnimateTimerHide() { if (state == UIAnimationStates.Hide) { float elapsedTime = 0f; while (elapsedTime < animationHideDuration && state == UIAnimationStates.Hide) { elapsedTime += Time.unscaledDeltaTime; float t = elapsedTime / animationShowDuration; float num = Mathf.Lerp(visibleYPosition, hiddenYPosition, EasingFunctions.EaseOut(t)); timerText.transform.localPosition = new Vector3(timerText.transform.localPosition.x, num); yield return null; } if (state == UIAnimationStates.Hide) { ((Component)timerText).gameObject.SetActive(false); } } } private TMP_FontAsset? LoadFont() { TMP_FontAsset[] array = Resources.FindObjectsOfTypeAll<TMP_FontAsset>(); foreach (TMP_FontAsset val in array) { if (((Object)val).name == "LiberationSans SDF") { return val; } } return null; } private float GetVisiblePosition() { //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) Rect rect = ((Component)((Component)NineSolsAPICore.FullscreenCanvas).transform).GetComponent<RectTransform>().rect; return ((Rect)(ref rect)).height * 0.03f; } private float GetHiddenPosition() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return 0f - ((Component)this).transform.position.y - timerText.preferredHeight; } } public class UIController { private KillCounterController bossCounterTextController; private ModifiersUIController modifiersController; private TimerController timerController; private CurrentTalismanUIContoller talismanUIController; public Action? OnModifiersRaisedAnimationDone; private UIControllerAnimationState animationState; private GameObject rightPanel; private GameObject bottomPanel; private GameObject bottomLeftPanel; public UIControllerAnimationState CurrentAnimationState { get { return animationState; } private set { animationState = value; modifiersController.UIControllerAnimationState = value; bossCounterTextController.UIControllerAnimationState = value; switch (value) { case UIControllerAnimationState.ModifiersLowered: bossCounterTextController.ShowExtraText(delegate { CurrentAnimationState = UIControllerAnimationState.KillCounterExpanded; }); break; case UIControllerAnimationState.KillCounterExpandedTextHidden: modifiersController.RaiseModifiers(delegate { CurrentAnimationState = UIControllerAnimationState.KillCounterCollapsed; OnModifiersRaisedAnimationDone?.Invoke(); }); break; case UIControllerAnimationState.KillCounterCollapsed: case UIControllerAnimationState.KillCounterExpanded: break; } } } public UIController() { rightPanel = CreateRightPanelObject(); bottomPanel = CreateBottomPanelObject(); bottomLeftPanel = CreateBottomLeftPanelObject(); bossCounterTextController = MonoNodeExtension.AddChildrenComponent<KillCounterController>(rightPanel, "KillCounter"); modifiersController = CreateModifiersControllerGUI(); timerController = MonoNodeExtension.AddChildrenComponent<TimerController>(bottomPanel, "TimerUI"); talismanUIController = MonoNodeExtension.AddChildrenComponent<CurrentTalismanUIContoller>(bottomLeftPanel, "TalismanUI"); } private void RestoreUI() { rightPanel = CreateRightPanelObject(); bottomPanel = CreateBottomPanelObject(); bossCounterTextController = MonoNodeExtension.AddChildrenComponent<KillCounterController>(rightPanel, "KillCounter"); modifiersController = CreateModifiersControllerGUI(); timerController = MonoNodeExtension.AddChildrenComponent<TimerController>(bottomPanel, "TimerUI"); } public GameObject CreateRightPanelObject() { //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_002d: 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_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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown Transform transform = ((Component)NineSolsAPICore.FullscreenCanvas).transform; GameObject val = new GameObject("BossChallenge_RightPanelUI"); val.transform.parent = ((Component)transform).transform; RectTransform component = ((Component)transform).GetComponent<RectTransform>(); Rect rect = component.rect; float width = ((Rect)(ref rect)).width; rect = component.rect; float height = ((Rect)(ref rect)).height; float num = width - width / 10f; float num2 = height - height / 4.5f; val.transform.position = new Vector3(num, num2); return val; } public GameObject CreateBottomPanelObject() { //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_002d: 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_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_005b: 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: Expected O, but got Unknown Transform transform = ((Component)NineSolsAPICore.FullscreenCanvas).transform; GameObject val = new GameObject("BossChallenge_BottomPanelUI"); val.transform.parent = ((Component)transform).transform; RectTransform component = ((Component)transform).GetComponent<RectTransform>(); Rect rect = component.rect; float width = ((Rect)(ref rect)).width; rect = component.rect; float height = ((Rect)(ref rect)).height; float num = width - width / 2f; float num2 = height / 10f; val.transform.position = new Vector3(num, num2); return val; } public GameObject CreateBottomLeftPanelObject() { //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_002d: 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_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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown Transform transform = ((Component)NineSolsAPICore.FullscreenCanvas).transform; GameObject val = new GameObject("BossChallenge_BottomLeftPanelUI"); val.transform.parent = ((Component)transform).transform; RectTransform component = ((Component)transform).GetComponent<RectTransform>(); Rect rect = component.rect; float width = ((Rect)(ref rect)).width; rect = component.rect; float height = ((Rect)(ref rect)).height; float num = width / 13.71f; float num2 = height / 4.15f; val.transform.position = new Vector3(num, num2); return val; } private ModifiersUIController CreateModifiersControllerGUI() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) ModifiersUIController modifiersUIController = MonoNodeExtension.AddChildrenComponent<ModifiersUIController>(rightPanel, "ModifiersUI"); ((Component)modifiersUIController).transform.localPosition = new Vector3(0f, -21f); return modifiersUIController; } public static TMP_Text InitializeText(Vector2 localPosition, GameObject parent, string text = "Test", bool active = false, int fontSize = 32, TMP_FontAsset? font = null, TextAlignmentOptions alignment = 260) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) TextMeshProUGUI val = MonoNodeExtension.AddChildrenComponent<TextMeshProUGUI>(((Component)((Component)NineSolsAPICore.FullscreenCanvas).transform).gameObject, "BossCounter_Text"); ((TMP_Text)val).fontSize = fontSize; if ((Object)(object)font != (Object)null) { ((TMP_Text)val).font = font; } ((Graphic)val).color = new Color(0.941f, 0.862f, 0.588f, 0.79f); ((TMP_Text)val).alignment = alignment; ((TMP_Text)val).text = text; ((TMP_Text)val).transform.localPosition = Vector2.op_Implicit(localPosition); ((TMP_Text)val).transform.SetParent(parent.transform, false); MonoLifeTimeExtension.SetActive((MonoBehaviour)(object)val, active); return (TMP_Text)(object)val; } public void UpdateTalisman(Sprite sprite) { talismanUIController.UpdateCurrentTalisman(sprite); } public void UpdateBossCounterNumber(int number) { if ((Object)(object)rightPanel == (Object)null || (Object)(object)bottomPanel == (Object)null || (Object)(object)timerController == (Object)null) { RestoreUI(); } bossCounterTextController.ChangeNumber(number); ShowText(); } public void UpdateModifiers(IEnumerable<string> modifiers) { modifiersController.SetModifiers(modifiers); modifiersController.Show(); } public void ShowText() { bossCounterTextController.Show(); } public void HideText(Action? callback = null) { bossCounterTextController.Hide(callback); } public void HideModifiers() { modifiersController.Reset(); } public void ShowExpandedKillNumbersText() { modifiersController.LowerModifiers(delegate { CurrentAnimationState = UIControllerAnimationState.ModifiersLowered; }); } public void HideExpandedKillNumbersText(Action? callback = null) { Action callback2 = callback; bossCounterTextController.HideExtraText(delegate { CurrentAnimationState = UIControllerAnimationState.KillCounterExpandedTextHidden; callback2?.Invoke(); }); } public void UpdateBossRecordValues(int highScore, int prevResult) { if ((Object)(object)rightPanel == (Object)null || (Object)(object)bottomPanel == (Object)null || (Object)(object)timerController == (Object)null) { RestoreUI(); } bossCounterTextController.UpdateHighScore(highScore); bossCounterTextController.UpdatePrevResult(prevResult); } public void ShowTimer() { timerController.Show(); } public void HideTimer() { timerController.Hide(); } public void UpdateTimer(int milliseconds) { timerController.UpdateTimer(milliseconds); } private TMP_FontAsset? LoadFont() { TMP_FontAsset[] array = Resources.FindObjectsOfTypeAll<TMP_FontAsset>(); foreach (TMP_FontAsset val in array) { if (((Object)val).name == "LiberationSans SDF") { return val; } } return null; } public void Unload() { if ((Object)(object)rightPanel != (Object)null) { Object.Destroy((Object)(object)rightPanel); } if ((Object)(object)bottomPanel != (Object)null) { Object.Destroy((Object)(object)bottomPanel); } if ((Object)(object)bottomLeftPanel != (Object)null) { Object.Destroy((Object)(object)bottomLeftPanel); } if ((Object)(object)modifiersController != (Object)null) { Object.Destroy((Object)(object)modifiersController); } if (OnModifiersRaisedAnimationDone != null) { OnModifiersRaisedAnimationDone = null; } } public void FixUI() { if ((Object)(object)rightPanel == (Object)null || (Object)(object)bottomPanel == (Object)null || (Object)(object)timerController == (Object)null) { RestoreUI(); } } } public enum UIControllerAnimationState { KillCounterCollapsed, ModifiersLowered, KillCounterExpanded, KillCounterExpandedTextHidden } } namespace BossChallengeMod.Modifiers { public class DamageBuildupModifier : ModifierBase { private bool started; public float damage = 0.025f; public float delay = 0.006f; public override void Awake() { base.Awake(); base.Key = "damage_buildup"; } public override void Notify(IEnumerable<string> keys, int iteration) { base.Notify(keys, iteration); bool flag2 = (((Behaviour)this).enabled = keys.Contains(base.Key)); started = flag2; if (started) { ((MonoBehaviour)this).StartCoroutine(StartBuildup()); } } public IEnumerator StartBuildup() { while (started) { if (!Monster.postureSystem.IsMonsterEmptyPosture) { PlayerHealth health = Player.i.health; if (((Health)health).currentValue - damage > 1f) { ((Health)health).currentValue = ((Health)health).currentValue - damage; health.CurrentInternalInjury += Mathf.Min(damage, ((Health)health).maxHealth.Value - (((Health)health).currentValue - health.CurrentInternalInjury)); health.ResetRecoverableTime(); } } yield return (object)new WaitForSeconds(delay); } } } public class EnduranceModifier : ModifierBase { public override void Awake() { base.Awake(); base.Key = "endurance"; } public override void Notify(IEnumerable<string> keys, int iteration) { base.Notify(keys, iteration); ((Behaviour)this).enabled = keys.Contains(base.Key); } } public class KnockbackModifier : ModifierBase { public override void Awake() { base.Awake(); base.Key = "knockback"; } public override void Notify(IEnumerable<string> keys, int iteration) { base.Notify(keys, iteration); ((Behaviour)this).enabled = keys.Contains(base.Key); } } public class KnockoutModifier : ModifierBase { public override void Awake() { base.Awake(); base.Key = "knockout"; } public override void Notify(IEnumerable<string> keys, int iteration) { base.Notify(keys, iteration); ((Behaviour)this).enabled = keys.Contains(base.Key); } } public class ModifierBase : MonoBehaviour { public MonsterBase? Monster; public ChallengeConfiguration challengeConfiguration; public string Key { get; protected set; } = string.Empty; public virtual void Awake() { Monster = ((Component)this).GetComponentInParent<MonsterBase>(); DisableComponent(); } public virtual void OnEnable() { } public virtual void OnDisable() { } public void DisableComponent() { ((Behaviour)this).enabled = false; } public virtual void Notify(IEnumerable<string> keys, int iteration) { } } public class ModifierConfig { public string Key { get; set; } = string.Empty; public List<string> Incompatibles { get; } = new List<string>(); } public class MonsterModifierController : MonoBehaviour { public List<ModifierBase> Modifiers = new List<ModifierBase>(); public List<ModifierConfig> ModifierConfigs = new List<ModifierConfig>(); public List<ModifierConfig> Available = new List<ModifierConfig>(); public List<ModifierConfig> Selected = new List<ModifierConfig>(); private readonly Random random; private readonly ChallengeConfiguration challengeConfiguration = BossChallengeMod.Instance.ChallengeConfigurationManager.ChallengeConfiguration; public Action? OnModifiersRoll; public Action? OnDestroyActions; private int modifiersNumber = 1; public bool AllowRepeating { get; set; } public MonsterModifierController() { random = new Random(); } public void Awake() { FindModifiers(); modifiersNumber = CalculateModifiersNumber(1); AllowRepeating = challengeConfiguration.AllowRepeatModifiers; } public void GenerateAvailableMods() { Available.Clear(); Available.AddRange(ModifierConfigs); } public void RollModifiers() { List<ModifierConfig> list = new List<ModifierConfig>(Available); if (!AllowRepeating) { list = list.Except(Selected).ToList(); } Selected.Clear(); if (list.Any()) { for (int j = 0; j < modifiersNumber; j++) { if (!list.Any()) { break; } ModifierConfig selected = list[random.Next(0, list.Count)]; list.RemoveAll((ModifierConfig am) => selected.Incompatibles.Select((string i) => i).Contains(am.Key)); Selected.Add(selected); } } OnModifiersRoll?.Invoke(); } public void ApplyModifiers(int iteration) { foreach (ModifierBase modifier in Modifiers) { modifier.Notify(Selected.Select((ModifierConfig m) => m.Key), iteration); } modifiersNumber = CalculateModifiersNumber(iteration + 1); } public void FindModifiers() { Modifiers.AddRange(((Component)this).GetComponentsInChildren<ModifierBase>()); } public void OnDestroy() { OnDestroyActions?.Invoke(); } private int CalculateModifiersNumber(int iteration) { if (!challengeConfiguration.EnableModifiersScaling) { return 1; } float y = (float)iteration / MathF.Max(challengeConfiguration.MaxModifiersScalingCycle, 1f); float num = MathF.Min(1f, y); int num2 = Math.Abs(challengeConfiguration.MaxModifiersNumber - 1); return 1 + (int)((float)num2 * num); } } public class ParryDirectDamageModifier : ModifierBase { public override void Awake() { base.Awake(); base.Key = "parry_damage"; } public override void Notify(IEnumerable<string> keys, int iteration) { base.Notify(keys, iteration); ((Behaviour)this).enabled = keys.Contains(base.Key); } } public class RandomArrowModifier : ModifierBase { public override void Awake() { base.Awake(); base.Key = "random_arrow"; } public override void Notify(IEnumerable<string> keys, int iteration) { base.Notify(keys, iteration); ((Behaviour)this).enabled = keys.Contains(base.Key); if (((Behaviour)this).enabled) { BossChallengeMod.Instance.GlobalModifiersFlags.BlockArrowVotes.Add(this); } else { BossChallengeMod.Instance.GlobalModifiersFlags.BlockArrowVotes.Remove(this); } } public void OnDestroy() { BossChallengeMod.Instance.GlobalModifiersFlags.BlockArrowVotes.Remove(this); } } public class RandomTaliModifier : ModifierBase { public override void Awake() { base.Awake(); base.Key = "random_talisman"; } public override void Notify(IEnumerable<string> keys, int iteration) { base.Notify(keys, iteration); ((Behaviour)this).enabled = keys.Contains(base.Key); if (((Behaviour)this).enabled) { BossChallengeMod.Instance.GlobalModifiersFlags.BlockTalismanVotes.Add(this); } else { BossChallengeMod.Instance.GlobalModifiersFlags.BlockTalismanVotes.Remove(this); } } public void OnDestroy() { BossChallengeMod.Instance.GlobalModifiersFlags.BlockTalismanVotes.Remove(this); } } public class RegenerationModifier : ModifierBase { private int regenerationPool; private bool started; private float pausedFor; public float pauseTime = 1f; public int heal = 1; public float delay = 0.04f; public override void Awake() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown base.Awake(); base.Key = "regeneration"; MonsterBase? monster = Monster; if (monster != null) { monster.postureSystem.OnPostureDecrease.AddListener(new UnityAction(PauseRegeneration)); } } public override void Notify(IEnumerable<string> keys, int iteration) { base.Notify(keys, iteration); bool flag2 = (((Behaviour)this).enabled = keys.Contains(base.Key)); started = flag2; if (started) { regenerationPool = CalculateTotalHp() / 2; ((MonoBehaviour)this).StartCoroutine(StartRegeneration()); } } public void Update() { if (pausedFor > 0f) { pausedFor = Mathf.Max(0f, pausedFor - Time.deltaTime); } } private void PauseRegeneration() { pausedFor = pauseTime; } private IEnumerator StartRegeneration() { MonsterBase? monster = Monster; PostureSystem postureSystem = ((monster != null) ? monster.postureSystem : null) ?? null; while (started && regenerationPool > 0 && (Object)(object)postureSystem != (Object)null) { if (!postureSystem.IsMonsterEmptyPosture && postureSystem.MaxPostureValue > postureSystem.CurrentHealthValue && pausedFor <= 0f) { int num = Mathf.Min((int)(postureSystem.MaxPostureValue - postureSystem.CurrentHealthValue), heal); postureSystem.GainPosture(num); regenerationPool -= num; } yield return (object)new WaitForSeconds(delay); } } private int CalculateTotalHp() { int num = 0; if ((Object)(object)Monster != (Object)null) { MonsterStat monsterStat = Monster.monsterStat; num = (int)monsterStat.HealthValue; if (monsterStat.PhaseCount > 1) { num += (int)monsterStat.HealthValue * (int)monsterStat.Phase2HealthRatio; } if (monsterStat.PhaseCount > 2) { num += (int)monsterStat.HealthValue * (int)monsterStat.Phase3HealthRatio; } } return num; } public void OnDestroy() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown MonsterBase? monster = Monster; if (monster != null) { monster.postureSystem.OnPostureDecrease.RemoveListener(new UnityAction(PauseRegeneration)); } started = false; } } public class ScalingSpeedModifier : ModifierBase { private float modifier = 1f; public override void Awake() { base.Awake(); base.Key = "speed_perm"; ((Behaviour)this).enabled = true; } public override void Notify(IEnumerable<string> keys, int iteration) { modifier = CalculateModifier(iteration); if ((Object)(object)Monster != (Object)null && challengeConfiguration.EnableSpeedScaling) { ((Actor)Monster).animator.SetFloat("AnimationSpeed", ((Actor)Monster).animator.speed * modifier); } } public void Update() { if ((Object)(object)Monster != (Object)null && challengeConfiguration.EnableSpeedScaling && ((Actor)Monster).animator.speed < ((Actor)Monster).animator.speed * modifier) { ((Actor)Monster).animator.SetFloat("AnimationSpeed", ((Actor)Monster).animator.speed * modifier); } } public override void OnDisable() { } private float CalculateModifier(int iteration) { float minSpeedScalingValue = challengeConfiguration.MinSpeedScalingValue; float num = (float)iteration / (float)Mathf.Max(challengeConfiguration.MaxSpeedScalingCycle, 1); float num2 = Mathf.Min(1f, num); float num3 = Mathf.Abs(challengeConfiguration.MaxSpeedScalingValue - challengeConfiguration.MinSpeedScalingValue); return minSpeedScalingValue + num3 * num2; } } public class SpeedModifier : ModifierBase { public override void Awake() { base.Awake(); base.Key = "speed_temp"; } public override void Notify(IEnumerable<string> keys, int iteration) { ((Behaviour)this).enabled = keys.Contains(base.Key); } public override void OnEnable() { } public void Update() { if ((Object)(object)Monster != (Object)null) { ((Actor)Monster).animator.speed = ((Actor)Monster).animator.speed * 1.2f; } } public override void OnDisable() { } } public class TimerModifier : ModifierBase { private bool start; private int time = 10000; private UIController UIController = BossChallengeMod.Instance.UIController; private List<int> attempts = new List<int>(); private int stopwatch; private bool startStopwatch; public bool ForcePause { get; set; } public override void Awake() { base.Awake(); base.Key = "timer"; ((Behaviour)this).enabled = true; startStopwatch = true; } public void Update() { if (startStopwatch && !Monster.postureSystem.IsMonsterEmptyPosture) { stopwatch += (int)(Time.deltaTime * 1000f); } } public override void Notify(IEnumerable<string> keys, int iteration) { if ((Object)(object)Monster != (Object)null) { attempts.Add(stopwatch); stopwatch = 0; start = keys.Contains(base.Key); if (start) { time = (int)CalculateTime(attempts.ToArray(), iteration); ((MonoBehaviour)this).StartCoroutine(StartTimer()); } } } public IEnumerator StartTimer() { UIController.ShowTimer(); int remainingTime = time; UIController.UpdateTimer(remainingTime); while (remainingTime > 0 && start) { if (!Monster.postureSystem.IsMonsterEmptyPosture && !ForcePause) { remainingTime -= (int)(Time.deltaTime * 1000f); } UIController.UpdateTimer((remainingTime >= 0) ? remainingTime : 0); yield return null; } if (remainingTime <= 0) { Player.i.Suicide(); } yield return (object)new WaitForSeconds(2f); UIController.HideTimer(); } public void OnDestroy() { start = false; UIController.HideTimer(); } private double CalculateTime(int[] previousTimes, int attempts, double kMax = 5.0, double kMin = 2.0, int threshold = 10) { if (previousTimes == null || previousTimes.Length == 0) { throw new ArgumentException("Previous times array cannot be null or empty."); } if (attempts <= 0) { throw new ArgumentException("Attempts must be greater than zero."); } double mean = previousTimes.Average(); double num = Math.Sqrt(previousTimes.Select((int t) => Math.Pow((double)t - mean, 2.0)).Average()); if (num == 0.0) { num = mean * 0.1; } double num2 = Math.Max(kMax - (kMax - kMin) / (double)threshold * (double)attempts, kMin); return mean + num2 * num; } } } namespace BossChallengeMod.KillCounting { public class MonsterKillCounter : MonoBehaviour { private ChallengeConfigurationManager challengeConfigurationManager = BossChallengeMod.Instance.ChallengeConfigurationManager; private ChallengeConfiguration challengeConfiguration = BossChallengeMod.Instance.ChallengeConfigurationManager.ChallengeConfiguration; private MonsterBase monster; private int killCounter; private int bestCount; private int lastCount; public Action? OnUpdate; public Action? OnDestroyActions; public int KillCounter { get { return killCounter; } private set { killCounter = value; OnUpdate?.Invoke(); } } public int BestCount { get { return bestCount; } private set { bestCount = value; OnUpdate?.Invoke(); } } public int LastCount { get { return lastCount; } private set { lastCount = value; OnUpdate?.Invoke(); } } public bool UseRecording { get; set; } public MonsterKillCounter() { monster = ((Component)this).GetComponent<MonsterBase>(); } public bool CheckLoad() { if (UseRecording) { BossEntry result = Task.Run(() => challengeConfigurationManager.GetRecordForBoss(monster, challengeConfiguration)).GetAwaiter().GetResult(); BestCount = result.BestValue; LastCount = result.LastValue; } return UseRecording; } public void IncrementCounter() { KillCounter++; if (KillCounter > BestCount) { BestCount = KillCounter; } if (UseRecording) { ((MonoBehaviour)this).StartCoroutine(challengeConfigurationManager.SaveRecordForBoss(monster, challengeConfiguration, BestCount, KillCounter)); } } public void OnDestroy() { OnDestroyActions?.Invoke(); } } } namespace BossChallengeMod.Helpers { public static class EasingFunctions { public static float Linear(float t) { return t; } public static float EaseIn(float t) { return t * t; } public static float EaseOut(float t) { return t * (2f - t); } public static float EaseInOut(float t) { if (!(t < 0.5f)) { return -1f + (4f - 2f * t) * t; } return 2f * t * t; } } public static class RecordsEncoder { public static string EncodeToBase64(ChallengeConfiguration config) { return Convert.ToBase64String(EncodeChallengeConfiguration(config)); } public static ChallengeConfiguration DecodeFromBase64(string base64String) { return DecodeChallengeConfiguration(Convert.FromBase64String(base64String)); } public static byte[] EncodeChallengeConfiguration(ChallengeConfiguration config) { using MemoryStream memoryStream = new MemoryStream(); using BinaryWriter binaryWriter = new BinaryWriter(memoryStream); binaryWriter.Write(config.MaxCycles); binaryWriter.Write(config.EnableSpeedScaling); binaryWriter.Write(config.MinSpeedScalingValue); binaryWriter.Write(config.MaxSpeedScalingValue); binaryWriter.Write(config.MaxSpeedScalingCycle); binaryWriter.Write(config.EnableModifiersScaling); binaryWriter.Write(config.MaxModifiersNumber); binaryWriter.Write(config.MaxModifiersScalingCycle); binaryWriter.Write(config.ModifiersEnabled); binaryWriter.Write(config.AllowRepeatModifiers); binaryWriter.Write(config.SpeedModifierEnabled); binaryWriter.Write(config.TimerModifierEnabled); binaryWriter.Write(config.ParryDirectDamageModifierEnabled); binaryWriter.Write(config.DamageBuildupModifierEnabled); binaryWriter.Write(config.RegenerationModifierEnabled); binaryWriter.Write(config.KnockbackModifierEnabled); binaryWriter.Write(config.RandomArrowModifierEnabled); binaryWriter.Write(config.RandomTalismanModifierEnabled); binaryWriter.Write(config.EnduranceModifierEnabled); return memoryStream.ToArray(); } public static ChallengeConfiguration DecodeChallengeConfiguration(byte[] data) { using MemoryStream input = new MemoryStream(data); using BinaryReader binaryReader = new BinaryReader(input); ChallengeConfiguration result = default(ChallengeConfiguration); result.MaxCycles = binaryReader.ReadInt32(); result.EnableSpeedScaling = binaryReader.ReadBoolean(); result.MinSpeedScalingValue = binaryReader.ReadSingle(); result.MaxSpeedScalingValue = binaryReader.ReadSingle(); result.MaxSpeedScalingCycle = binaryReader.ReadInt32(); result.EnableModifiersScaling = binaryReader.ReadBoolean(); result.MaxModifiersNumber = binaryReader.ReadInt32(); result.MaxModifiersScalingCycle = binaryReader.ReadInt32(); result.ModifiersEnabled = binaryReader.ReadBoolean(); result.AllowRepeatModifiers = binaryReader.ReadBoolean(); result.SpeedModifierEnabled = binaryReader.ReadBoolean(); result.TimerModifierEnabled = binaryReader.ReadBoolean(); result.ParryDirectDamageModifierEnabled = binaryReader.ReadBoolean(); result.DamageBuildupModifierEnabled = binaryReader.ReadBoolean(); result.RegenerationModifierEnabled = binaryReader.ReadBoolean(); result.KnockbackModifierEnabled = binaryReader.ReadBoolean(); result.RandomArrowModifierEnabled = binaryReader.ReadBoolean(); result.RandomTalismanModifierEnabled = binaryReader.ReadBoolean(); result.EnduranceModifierEnabled = binaryReader.ReadBoolean(); return result; } } } namespace BossChallengeMod.Global { public class CustomMonsterStateValuesResolver { private Dictionary<string, States> statesDictionary = new Dictionary<string, States>(); private List<int> originalValuesCast = Enum.GetValues(typeof(States)).Cast<int>().ToList(); public States GetState(string name) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) if (statesDictionary.TryGetValue(name, out var value)) { return value; } int val = (originalValuesCast.Any() ? originalValuesCast.Max() : 0); int val2 = (statesDictionary.Any() ? statesDictionary.Values.Max((States s) => (int)s) : 0); States val3 = (States)(Math.Max(val, val2) + 1); statesDictionary.Add(name, val3); return val3; } } public class EventTypesResolver { private Dictionary<string, RCGEventType> types = new Dictionary<string, RCGEventType>(); public RCGEventType RequestType(string type) { RCGEventType val = types.GetValueOrDefault(type); if ((Object)(object)val == (Object)null) { val = ScriptableObject.CreateInstance<RCGEventType>(); ((Object)val).name = type; types.Add(type, val); } return val; } } public class GlobalModifiersFlags { public HashSet<object> BlockArrowVotes { get; set; } = new HashSet<object>(); public HashSet<object> BlockTalismanVotes { get; set; } = new HashSet<object>(); } public class LocalizationResolver { private Dictionary<string, string> translationDictionary = new Dictionary<string, string>(); public void LoadLanguage(string language = "en-us") { translationDictionary.Clear(); string path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "translations_" + language + ".json"); if (File.Exists(path)) { string text = File.ReadAllText(path); Extensions.AddRange<string, string>(translationDictionary, JsonUtils.Deserialize<Dictionary<string, string>>(text)); } } public string Localize(string key) { if (translationDictionary.TryGetValue(key, out string value)) { return value; } return key; } } } namespace BossChallengeMod.Extensions { public static class RCGEventReceiverExtensions { private static FieldInfo transitionReceiverIReceiversRef = AccessTools.Field(typeof(RCGEventReceiver), "iReceivers"); public static void AddSubscriber(this RCGEventReceiver receiver, IRCGArgEventReceiver subscriber) { IRCGArgEventReceiver[] source = (IRCGArgEventReceiver[])transitionReceiverIReceiversRef.GetValue(receiver); transitionReceiverIReceiversRef.SetValue(receiver, source.Append(subscriber).ToArray()); } } public static class UnityEventExtensions { private static readonly FieldInfo UnityEventCallsFieldRef = AccessTools.Field(typeof(UnityEvent), "m_Calls"); private static readonly FieldInfo InvokableCallListRuntimeCallsFieldRef = AccessTools.Field(typeof(InvokableCallList), "m_RuntimeCalls"); private static readonly FieldInfo InvokableCallDelegateFieldRef = AccessTools.Field(typeof(InvokableCall), "Delegate"); public static void AddUniqueListener(this UnityEvent unityEvent, UnityAction method) { if (!unityEvent.HasListener(method)) { unityEvent.AddListener(method); } } private static bool HasListener(this UnityEvent unityEvent, UnityAction method) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown InvokableCallList val = (InvokableCallList)UnityEventCallsFieldRef.GetValue(unityEvent); if (val == null) { return false; } List<BaseInvokableCall> list = (List<BaseInvokableCall>)InvokableCallListRuntimeCallsFieldRef.GetValue(val); if (list == null) { return false; } foreach (BaseInvokableCall item in list) { Delegate @delegate = (Delegate)InvokableCallDelegateFieldRef.GetValue(item); if ((object)@delegate != null && @delegate?.Method == ((Delegate)(object)method).Method && @delegate.Target == ((Delegate)(object)method).Target) { return true; } } return false; } } } namespace BossChallengeMod.CustomMonsterStates { public class ResetBossState : MonsterState { protected ChallengeConfiguration challengeConfig