Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Downpour v1.0.13
Downpour.dll
Decompiled a year agousing System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using IL.RoR2; using Inferno; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using On.RoR2; using R2API; using R2API.Utils; using RiskOfOptions; using RiskOfOptions.OptionConfigs; using RiskOfOptions.Options; using RoR2; using UnityEngine; using UnityEngine.AddressableAssets; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Downpour")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+c327a5f615a36cf20d784d7718a9e55b8037a90a")] [assembly: AssemblyProduct("Downpour")] [assembly: AssemblyTitle("Downpour")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Downpour { [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("prodzpod.Downpour", "Downpour", "1.0.13")] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class DownpourPlugin : BaseUnityPlugin { public const string PluginGUID = "prodzpod.Downpour"; public const string PluginAuthor = "prodzpod"; public const string PluginName = "Downpour"; public const string PluginVersion = "1.0.13"; public static ManualLogSource Log; public static Harmony Harmony; internal static PluginInfo pluginInfo; public static ConfigFile Config; private static AssetBundle _assetBundle; public static ConfigEntry<bool> EnableRework; public static ConfigEntry<bool> EnableInferno; public static ConfigEntry<bool> EnableDownpour; public static ConfigEntry<bool> EnableBrimstone; public static ConfigEntry<bool> FasterSimulacrum; public static ConfigEntry<bool> GupNerf; public static ConfigEntry<float> ScalingDrizzle; public static ConfigEntry<float> ScalingMonsoon; public static ConfigEntry<float> ScalingInferno; public static ConfigEntry<float> ScalingMax; public static ConfigEntry<float> TempScaling; public static ConfigEntry<float> InitialScaling; public static ConfigEntry<float> StageScaling; public static ConfigEntry<float> SimulacrumBase; public static ConfigEntry<float> SimulacrumScaling; public static ConfigEntry<float> SimulacrumTempScaling; public static ConfigEntry<float> SimulacrumStageScaling; public static ConfigEntry<float> SimulacrumCountdown; public static ConfigEntry<float> SimulacrumBossHealth; public static ConfigEntry<float> ScalingDownpour; public static ConfigEntry<float> TempScalingDownpour; public static ConfigEntry<float> InitialScalingDownpour; public static ConfigEntry<float> StageScalingDownpour; public static ConfigEntry<float> SimulacrumBaseDownpour; public static ConfigEntry<float> SimulacrumScalingDownpour; public static ConfigEntry<float> SimulacrumTempScalingDownpour; public static ConfigEntry<float> SimulacrumStageScalingDownpour; public static ConfigEntry<float> SimulacrumCountdownDownpour; public static ConfigEntry<float> ScalingBrimstone; public static ConfigEntry<float> TempScalingBrimstone; public static ConfigEntry<float> InitialScalingBrimstone; public static ConfigEntry<float> StageScalingBrimstone; public static ConfigEntry<float> SimulacrumBaseBrimstone; public static ConfigEntry<float> SimulacrumScalingBrimstone; public static ConfigEntry<float> SimulacrumTempScalingBrimstone; public static ConfigEntry<float> SimulacrumStageScalingBrimstone; public static List<ConfigEntry<float>> AutoAdvance = new List<ConfigEntry<float>>(); public static DifficultyDef Downpour; public static DifficultyIndex DownpourIndex; public static DifficultyDef Brimstone; public static DifficultyIndex BrimstoneIndex; public static List<DifficultyDef> DownpourList = new List<DifficultyDef>(); public static List<DifficultyDef> BrimstoneList = new List<DifficultyDef>(); public const bool DEBUG = false; public static AssetBundle AssetBundle { get { if ((Object)(object)_assetBundle == (Object)null) { _assetBundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(pluginInfo.Location), "downpour")); } return _assetBundle; } } public void Awake() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown pluginInfo = ((BaseUnityPlugin)this).Info; Log = ((BaseUnityPlugin)this).Logger; Harmony = new Harmony("prodzpod.Downpour"); Config = new ConfigFile(Path.Combine(Paths.ConfigPath, "prodzpod.Downpour.cfg"), true); EnableRework = Config.Bind<bool>("Modules", "Enable All Difficulty Reworks", true, "Non-inferno, downpour, brimstone difficulty scaling will be reworked."); EnableInferno = Config.Bind<bool>("Modules", "Enable Inferno Reworks", true, "Inferno difficulty scaling will be reworked."); EnableDownpour = Config.Bind<bool>("Modules", "Enable Downpour Difficulty", true, "Downpour will be added."); EnableBrimstone = Config.Bind<bool>("Modules", "Enable Brimstone Difficulty", true, "Brimstone will be added."); FasterSimulacrum = Config.Bind<bool>("Modules", "Faster Simulacrum", true, "Force spawns more enemies upon all kill mid-wave."); GupNerf = Config.Bind<bool>("Modules", "Gup Rework", true, "Hopoo why (disables base regen and reduces health. Damage/speed increase for split versions instead.)"); ScalingDrizzle = Config.Bind<float>("Difficulty Rework", "Drizzle Scaling Seconds", 600f, "Will be used with monsoon to calculate all difficulty."); ScalingMonsoon = Config.Bind<float>("Difficulty Rework", "Monsoon Scaling Seconds", 300f, "Will be used with drizzle to calculate all difficulty."); ScalingInferno = Config.Bind<float>("Difficulty Rework", "Inferno Scaling Seconds", 300f, "Special exception. set to 0 to disable."); ScalingMax = Config.Bind<float>("Difficulty Rework", "Max Scaling Seconds", 1200f, "Any def above it won't increase. Used to mitigate negative/zero."); TempScaling = Config.Bind<float>("Difficulty Rework", "Temporary Scaling Multiplier", 1f, "Scaling value that dissipates on next stage. Lower = harder."); InitialScaling = Config.Bind<float>("Difficulty Rework", "Initial Scaling", -0.5f, "Default: Monsoon starts as thunderstorm, and ends(stage 5) on typhoon"); StageScaling = Config.Bind<float>("Downpour", "Stage Scaling Multiplier", 0.25f, "Default: rainstorm will become monsoon on stage 5."); SimulacrumBase = Config.Bind<float>("Difficulty Rework", "Simulacrum Scaling Seconds Base", 0f, "Base seconds to add/remove for simulacrum."); SimulacrumScaling = Config.Bind<float>("Difficulty Rework", "Simulacrum Scaling Multiplier", 2.5f, "Multiplied to normal game scaling time. Lower = harder"); SimulacrumTempScaling = Config.Bind<float>("Difficulty Rework", "Simulacrum Temporary Scaling Multiplier", 0f, "Temporary scaling multiplier for simulacrum, takes simulacrum scaling."); SimulacrumStageScaling = Config.Bind<float>("Difficulty Rework", "Simulacrum Stage Scaling Multiplier", 1f, "Stage scaling multiplier for simulacrum, takes simulacrum scaling."); SimulacrumCountdown = Config.Bind<float>("Difficulty Rework", "Simulacrum Countdown", 3f, "Instead of the usual 10 seconds."); SimulacrumBossHealth = Config.Bind<float>("Difficulty Rework", "Simulacrum Special Boss Health before Wave 50", 0.33f, "It kills your run on full health"); ScalingDownpour = Config.Bind<float>("Downpour", "Downpour Scaling Seconds", 180f, "Special exception. set to 0 to disable."); TempScalingDownpour = Config.Bind<float>("Downpour", "Downpour Temporary Scaling Multiplier", 0.5f, "Special exception."); InitialScalingDownpour = Config.Bind<float>("Downpour", "Downpour Initial Scaling", 2f, "Default: start identical to rainstorm."); StageScalingDownpour = Config.Bind<float>("Downpour", "Downpour Stage Scaling Multiplier", 0f, "Default: will become monsoon on stage 5."); SimulacrumBaseDownpour = Config.Bind<float>("Downpour", "Downpour Simulacrum Scaling Base", 0f, "Special exception."); SimulacrumScalingDownpour = Config.Bind<float>("Downpour", "Downpour Simulacrum Scaling Multiplier", 2.5f, "Special exception."); SimulacrumTempScalingDownpour = Config.Bind<float>("Downpour", "Downpour Simulacrum Temporary Scaling Multiplier", 2f, "Special exception."); SimulacrumStageScalingDownpour = Config.Bind<float>("Downpour", "Downpour Simulacrum Stage Scaling Multiplier", 1f, "Special exception."); SimulacrumCountdownDownpour = Config.Bind<float>("Downpour", "Downpour Simulacrum Countdown", 0f, "Instead of the usual 10 seconds."); ScalingBrimstone = Config.Bind<float>("Downpour", "Brimstone Scaling Seconds", 240f, "Special exception. set to 0 to disable."); TempScalingBrimstone = Config.Bind<float>("Downpour", "Brimstone Temporary Scaling Multiplier", 0.5f, "Special exception."); InitialScalingBrimstone = Config.Bind<float>("Downpour", "Brimstone Initial Scaling", 3f, "Default: start identical to rainstorm."); StageScalingBrimstone = Config.Bind<float>("Downpour", "Brimstone Stage Scaling Multiplier", 0f, "Default: will become monsoon on stage 5."); SimulacrumBaseBrimstone = Config.Bind<float>("Downpour", "Brimstone Simulacrum Scaling Seconds Base", 0f, "Special exception."); SimulacrumScalingBrimstone = Config.Bind<float>("Downpour", "Brimstone Simulacrum Scaling Seconds Multiplier", 2.5f, "Special exception."); SimulacrumTempScalingBrimstone = Config.Bind<float>("Downpour", "Brimstone Simulacrum Temporary Scaling Seconds Multiplier", 2f, "Special exception."); SimulacrumStageScalingBrimstone = Config.Bind<float>("Downpour", "Brimstone Simulacrum Temporary Stage Seconds Multiplier", 1f, "Special exception."); bool flag = false; if (Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions")) { Options.Patch(); } Harmony.PatchAll(typeof(Hooks.PatchOrder)); if (EnableDownpour.Value) { AddDifficulty(); } if (Chainloader.PluginInfos.ContainsKey("HIFU.Inferno") && EnableBrimstone.Value) { AddInfernoVariant(); } Hooks.Patch(); Run.onRunStartGlobal += Hooks.PatchRun; Run.onRunDestroyGlobal -= Hooks.PatchRun; Run.onRunStartGlobal += Hooks.PatchSimulacrum; Run.onRunDestroyGlobal -= Hooks.PatchSimulacrum; if (GupNerf.Value) { Hooks.PatchGup(); } RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(Token.Patch)); } public static void AddDifficulty() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) Downpour = new DifficultyDef(2f, "DOWNPOUR_NAME", "DOWNPOUR_ICON", "DOWNPOUR_DESC", Color32.op_Implicit(new Color32((byte)98, (byte)157, (byte)230, byte.MaxValue)), "DP", false); Downpour.iconSprite = AssetBundle.LoadAsset<Sprite>("Assets/downpour.png"); Downpour.foundIconSprite = true; DownpourIndex = DifficultyAPI.AddDifficulty(Downpour); DownpourList.Add(Downpour); } public static void AddInfernoVariant() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) Brimstone = new DifficultyDef(Main.Scaling.Value, "BRIMSTONE_NAME", "BRIMSTONE_ICON", "BRIMSTONE_DESC", Color32.op_Implicit(new Color32((byte)213, (byte)145, (byte)242, byte.MaxValue)), "BS", false); Brimstone.iconSprite = AssetBundle.LoadAsset<Sprite>("Assets/brimstone.png"); Brimstone.foundIconSprite = true; BrimstoneIndex = DifficultyAPI.AddDifficulty(Brimstone); DownpourList.Add(Brimstone); BrimstoneList.Add(Brimstone); Token.PatchBrimstone(); } } public class Hooks { [HarmonyPatch(typeof(DifficultyAPI), "InitialiseRuleBookAndFinalizeList")] public class PatchOrder { public static void Postfix(ref RuleDef __result) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) Token.descs.Clear(); foreach (RuleChoiceDef choice in __result.choices) { DifficultyDef difficultyDef = DifficultyCatalog.GetDifficultyDef(choice.difficultyIndex); Token.descs.Add(difficultyDef.descriptionToken, difficultyDef); } if (DownpourPlugin.EnableDownpour.Value || DownpourPlugin.EnableBrimstone.Value) { __result.choices.Sort((RuleChoiceDef x, RuleChoiceDef y) => GetSortValue(DifficultyCatalog.GetDifficultyDef(x.difficultyIndex)).CompareTo(GetSortValue(DifficultyCatalog.GetDifficultyDef(y.difficultyIndex)))); } } public static float GetSortValue(DifficultyDef def) { return def.scalingValue + 5.9f * (float)((def.nameToken == "INFERNO_NAME") ? 1 : 0) + (float)(1000 * (DownpourPlugin.DownpourList.Contains(def) ? 1 : 0)) + (float)(1000 * (DownpourPlugin.BrimstoneList.Contains(def) ? 1 : 0)); } } [CompilerGenerated] private static class <>O { public static hook_FixedUpdate <0>__Run_FixedUpdate; public static Manipulator <1>__Run_RecalculateDifficultyCoefficentInternal; public static Manipulator <2>__InfiniteTowerRun_RecalculateDifficultyCoefficentInternal; public static Func<float, Run, float> <3>__GetCoeff; public static Func<float, Run, float> <4>__GetAmbient; public static hook_Initialize <5>__InfiniteTowerWaveController_Initialize; public static hook_FixedUpdate <6>__InfiniteTowerWaveController_FixedUpdate; public static Action<CharacterBody> <7>__CharacterBody_OnBodyStartGlobal; } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Action<Run> <>9__5_0; public static Action<Stage> <>9__5_1; public static hook_OnRunAmbientLevelUp <>9__5_2; public static hook_OnCharacterLevelUp <>9__5_3; public static Func<Instruction, bool> <>9__8_0; public static Func<Instruction, bool> <>9__8_1; public static Func<Instruction, bool> <>9__8_2; public static Func<Instruction, bool> <>9__9_0; public static Func<Instruction, bool> <>9__9_1; public static Func<Run, float> <>9__9_2; public static Func<Instruction, bool> <>9__26_1; public static Func<ReadOnlyCollection<TeamComponent>, int, int> <>9__26_2; public static Manipulator <>9__26_0; internal void <Patch>b__5_0(Run run) { bool flag = false; lastStageTime = 0f; trueAmbientLevelFloor = -1; previousAmbientLevelFloor = -1; Run.ambientLevelCap = int.MaxValue; } internal void <Patch>b__5_1(Stage stage) { lastStageTime = Run.instance.GetRunStopwatch(); } internal void <Patch>b__5_2(orig_OnRunAmbientLevelUp orig, Run run) { if (run.ambientLevelFloor <= 100) { orig.Invoke(run); } } internal void <Patch>b__5_3(orig_OnCharacterLevelUp orig, CharacterBody body) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Invalid comparison between Unknown and I4 if (body != null) { TeamComponent teamComponent = body.teamComponent; if (teamComponent != null) { _ = teamComponent.teamIndex; if (true && (int)body.teamComponent.teamIndex != 1 && Run.instance.ambientLevelFloor > 100) { return; } } } orig.Invoke(body); } internal bool <Run_RecalculateDifficultyCoefficentInternal>b__8_0(Instruction x) { return ILPatternMatchingExt.MatchStfld<Run>(x, "compensatedDifficultyCoefficient"); } internal bool <Run_RecalculateDifficultyCoefficentInternal>b__8_1(Instruction x) { return ILPatternMatchingExt.MatchStfld<Run>(x, "difficultyCoefficient"); } internal bool <Run_RecalculateDifficultyCoefficentInternal>b__8_2(Instruction x) { return ILPatternMatchingExt.MatchCallOrCallvirt<Run>(x, "set_ambientLevel"); } internal bool <InfiniteTowerRun_RecalculateDifficultyCoefficentInternal>b__9_0(Instruction x) { return ILPatternMatchingExt.MatchStfld<Run>(x, "difficultyCoefficient"); } internal bool <InfiniteTowerRun_RecalculateDifficultyCoefficentInternal>b__9_1(Instruction x) { return ILPatternMatchingExt.MatchCallOrCallvirt<Run>(x, "set_ambientLevel"); } internal float <InfiniteTowerRun_RecalculateDifficultyCoefficentInternal>b__9_2(Run self) { return (self.compensatedDifficultyCoefficient - 1f) * 3f + 1f; } internal void <PatchGup>b__26_0(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); val.GotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<TeamComponent>(x, "GetTeamMembers") }); val.Emit(OpCodes.Dup); int index = val.Index; val.Index = index + 1; val.EmitDelegate<Func<ReadOnlyCollection<TeamComponent>, int, int>>((Func<ReadOnlyCollection<TeamComponent>, int, int>)delegate(ReadOnlyCollection<TeamComponent> list, int orig) { foreach (TeamComponent item in list) { if ((Object)(object)item.body != (Object)null && ((Object)item.body).name.Contains("GupBody")) { orig += 2; } } return orig; }); } internal bool <PatchGup>b__26_1(Instruction x) { return ILPatternMatchingExt.MatchCallOrCallvirt<TeamComponent>(x, "GetTeamMembers"); } internal int <PatchGup>b__26_2(ReadOnlyCollection<TeamComponent> list, int orig) { foreach (TeamComponent item in list) { if ((Object)(object)item.body != (Object)null && ((Object)item.body).name.Contains("GupBody")) { orig += 2; } } return orig; } } public static float lastStageTime = 0f; public static int trueAmbientLevelFloor = -1; public static int previousAmbientLevelFloor = -1; public static bool onAmbientLevelUpEnabled = false; public static float targetTime = 0f; public static string[] targetStage = new string[5] { "golemplains", "goolake", "frozenwall", "shipgraveyard", "slumberingsatellite" }; public static void Patch() { //IL_005f: 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) //IL_006a: Expected O, but got Unknown //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown Run.onRunStartGlobal += delegate { bool flag = false; lastStageTime = 0f; trueAmbientLevelFloor = -1; previousAmbientLevelFloor = -1; Run.ambientLevelCap = int.MaxValue; }; Stage.onStageStartGlobal += delegate { lastStageTime = Run.instance.GetRunStopwatch(); }; object obj = <>c.<>9__5_2; if (obj == null) { hook_OnRunAmbientLevelUp val = delegate(orig_OnRunAmbientLevelUp orig, Run run) { if (run.ambientLevelFloor <= 100) { orig.Invoke(run); } }; <>c.<>9__5_2 = val; obj = (object)val; } LevelUpEffectManager.OnRunAmbientLevelUp += (hook_OnRunAmbientLevelUp)obj; object obj2 = <>c.<>9__5_3; if (obj2 == null) { hook_OnCharacterLevelUp val2 = delegate(orig_OnCharacterLevelUp orig, CharacterBody body) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Invalid comparison between Unknown and I4 if (body != null) { TeamComponent teamComponent = body.teamComponent; if (teamComponent != null) { _ = teamComponent.teamIndex; if (true && (int)body.teamComponent.teamIndex != 1 && Run.instance.ambientLevelFloor > 100) { return; } } } orig.Invoke(body); }; <>c.<>9__5_3 = val2; obj2 = (object)val2; } LevelUpEffectManager.OnCharacterLevelUp += (hook_OnCharacterLevelUp)obj2; } public static void PatchRun(Run run) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown bool flag = false; if (Enabled(run)) { object obj = <>O.<1>__Run_RecalculateDifficultyCoefficentInternal; if (obj == null) { Manipulator val = Run_RecalculateDifficultyCoefficentInternal; <>O.<1>__Run_RecalculateDifficultyCoefficentInternal = val; obj = (object)val; } Run.RecalculateDifficultyCoefficentInternal += (Manipulator)obj; object obj2 = <>O.<2>__InfiniteTowerRun_RecalculateDifficultyCoefficentInternal; if (obj2 == null) { Manipulator val2 = InfiniteTowerRun_RecalculateDifficultyCoefficentInternal; <>O.<2>__InfiniteTowerRun_RecalculateDifficultyCoefficentInternal = val2; obj2 = (object)val2; } InfiniteTowerRun.RecalculateDifficultyCoefficentInternal += (Manipulator)obj2; } } public static void UnpatchRun(Run _) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown bool flag = false; object obj = <>O.<1>__Run_RecalculateDifficultyCoefficentInternal; if (obj == null) { Manipulator val = Run_RecalculateDifficultyCoefficentInternal; <>O.<1>__Run_RecalculateDifficultyCoefficentInternal = val; obj = (object)val; } Run.RecalculateDifficultyCoefficentInternal -= (Manipulator)obj; object obj2 = <>O.<2>__InfiniteTowerRun_RecalculateDifficultyCoefficentInternal; if (obj2 == null) { Manipulator val2 = InfiniteTowerRun_RecalculateDifficultyCoefficentInternal; <>O.<2>__InfiniteTowerRun_RecalculateDifficultyCoefficentInternal = val2; obj2 = (object)val2; } InfiniteTowerRun.RecalculateDifficultyCoefficentInternal -= (Manipulator)obj2; } public static void Run_RecalculateDifficultyCoefficentInternal(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); val.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld<Run>(x, "compensatedDifficultyCoefficient") }); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Func<float, Run, float>>((Func<float, Run, float>)GetCoeff); val.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld<Run>(x, "difficultyCoefficient") }); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Func<float, Run, float>>((Func<float, Run, float>)GetCoeff); val.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Run>(x, "set_ambientLevel") }); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Func<float, Run, float>>((Func<float, Run, float>)GetAmbient); } public static void InfiniteTowerRun_RecalculateDifficultyCoefficentInternal(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); val.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld<Run>(x, "difficultyCoefficient") }); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Func<float, Run, float>>((Func<float, Run, float>)GetCoeff); val.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Run>(x, "set_ambientLevel") }); val.Emit(OpCodes.Pop); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Func<Run, float>>((Func<Run, float>)((Run self) => (self.compensatedDifficultyCoefficient - 1f) * 3f + 1f)); } public static void Run_FixedUpdate(orig_FixedUpdate orig, Run self) { orig.Invoke(self); if (self.GetRunStopwatch() >= targetTime) { int num = (self.stageClearCount + 1) % 5; targetTime += DownpourPlugin.AutoAdvance[num].Value * 60f; Console.instance.SubmitCmd((NetworkUser)null, "next_stage " + targetStage[num], false); } } public static void PatchSimulacrum(Run run) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown if (run is InfiniteTowerRun) { object obj = <>O.<5>__InfiniteTowerWaveController_Initialize; if (obj == null) { hook_Initialize val = InfiniteTowerWaveController_Initialize; <>O.<5>__InfiniteTowerWaveController_Initialize = val; obj = (object)val; } InfiniteTowerWaveController.Initialize += (hook_Initialize)obj; object obj2 = <>O.<6>__InfiniteTowerWaveController_FixedUpdate; if (obj2 == null) { hook_FixedUpdate val2 = InfiniteTowerWaveController_FixedUpdate; <>O.<6>__InfiniteTowerWaveController_FixedUpdate = val2; obj2 = (object)val2; } InfiniteTowerWaveController.FixedUpdate += (hook_FixedUpdate)obj2; CharacterBody.onBodyStartGlobal += CharacterBody_OnBodyStartGlobal; } } public static void UnpatchSimulacrum(Run run) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown if (run is InfiniteTowerRun) { object obj = <>O.<5>__InfiniteTowerWaveController_Initialize; if (obj == null) { hook_Initialize val = InfiniteTowerWaveController_Initialize; <>O.<5>__InfiniteTowerWaveController_Initialize = val; obj = (object)val; } InfiniteTowerWaveController.Initialize -= (hook_Initialize)obj; object obj2 = <>O.<6>__InfiniteTowerWaveController_FixedUpdate; if (obj2 == null) { hook_FixedUpdate val2 = InfiniteTowerWaveController_FixedUpdate; <>O.<6>__InfiniteTowerWaveController_FixedUpdate = val2; obj2 = (object)val2; } InfiniteTowerWaveController.FixedUpdate -= (hook_FixedUpdate)obj2; CharacterBody.onBodyStartGlobal -= CharacterBody_OnBodyStartGlobal; } } public static void InfiniteTowerWaveController_Initialize(orig_Initialize orig, InfiniteTowerWaveController self, int index, Inventory inv, GameObject target) { //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) if (DownpourPlugin.FasterSimulacrum.Value) { self.wavePeriodSeconds = 30f / Mathf.Clamp(GetScale(DifficultyCatalog.GetDifficultyDef(Run.instance.selectedDifficulty), Run.instance.GetRunStopwatch(), simulacrum: true), 1f, 10f); self.squadDefeatGracePeriod = 0f; self.secondsBeforeSuddenDeath = 180f; self.secondsBeforeFailsafe = 10f; } self.secondsAfterWave = (int)(DownpourPlugin.DownpourList.Contains(DifficultyCatalog.GetDifficultyDef(Run.instance.selectedDifficulty)) ? DownpourPlugin.SimulacrumCountdownDownpour.Value : DownpourPlugin.SimulacrumCountdown.Value); orig.Invoke(self, index, inv, target); } public static void InfiniteTowerWaveController_FixedUpdate(orig_FixedUpdate orig, InfiniteTowerWaveController self) { orig.Invoke(self); if (DownpourPlugin.FasterSimulacrum.Value && (Object)(object)self.combatSquad != (Object)null && self.combatSquad.memberCount == 0 && !self.haveAllEnemiesBeenDefeated) { self.totalWaveCredits -= self.creditsPerSecond; CombatDirector combatDirector = self.combatDirector; combatDirector.monsterCredit += self.creditsPerSecond; self.combatDirector.monsterSpawnTimer = 0f; } } public static void CharacterBody_OnBodyStartGlobal(CharacterBody body) { if ((((Object)body).name.Contains("Brother") || ((Object)body).name.Contains("TitanGold") || ((Object)body).name.Contains("EquipmentDrone") || ((Object)body).name.Contains("SuperRoboBallBoss")) && ((InfiniteTowerRun)/*isinst with value type is only supported in some contexts*/).waveIndex < 50) { body.baseMaxHealth *= DownpourPlugin.SimulacrumBossHealth.Value; body.RecalculateStats(); body.healthComponent.Networkhealth = body.maxHealth; } } public static bool Enabled(Run run) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return Enabled(DifficultyCatalog.GetDifficultyDef(run.selectedDifficulty), run is InfiniteTowerRun); } public static bool Enabled(DifficultyDef def, bool isSimulacrum) { if (!DownpourPlugin.DownpourList.Contains(def)) { if (def.nameToken == "SUNNY_NAME") { return false; } if (def.nameToken == "INFERNO_NAME") { if (!DownpourPlugin.EnableInferno.Value) { return false; } } else if (!DownpourPlugin.EnableRework.Value) { return false; } } DownpourPlugin.Log.LogDebug((object)("Downpour is enabled for " + Language.GetString(def.nameToken))); return true; } public static float GetCoeff(float _, Run self) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) float runStopwatch = self.GetRunStopwatch(); float num = Mathf.Floor(runStopwatch * 0.01666667f); DifficultyDef difficultyDef = DifficultyCatalog.GetDifficultyDef(self.selectedDifficulty); float num2 = 0.3f * (float)self.participatingPlayerCount + 0.7f; float stageScale = GetStageScale(difficultyDef, (self is InfiniteTowerRun) ? (((InfiniteTowerRun)((self is InfiniteTowerRun) ? self : null)).waveIndex / 5) : self.stageClearCount, self.participatingPlayerCount, self is InfiniteTowerRun); float scale = GetScale(difficultyDef, runStopwatch, self is InfiniteTowerRun); return Mathf.Clamp((stageScale * num + num2) * scale, 0f, 715827900f); } public static float GetAmbient(float _, Run self) { float num = 0.3f * (float)self.participatingPlayerCount + 0.7f; return (self.difficultyCoefficient - num) * 3f + 1f; } public static float GetScale(DifficultyDef def, float sec, bool simulacrum = false) { if (def == null) { return 1f; } float num; float num2; if (DownpourPlugin.BrimstoneList.Contains(def)) { num = DownpourPlugin.ScalingBrimstone.Value; if (simulacrum) { num = (num + DownpourPlugin.SimulacrumBaseBrimstone.Value) * DownpourPlugin.SimulacrumScalingBrimstone.Value; } num2 = num * DownpourPlugin.TempScalingBrimstone.Value; if (simulacrum) { num2 *= DownpourPlugin.SimulacrumTempScalingBrimstone.Value; } } else if (DownpourPlugin.DownpourList.Contains(def)) { num = DownpourPlugin.ScalingDownpour.Value; if (simulacrum) { num = (num + DownpourPlugin.SimulacrumBaseDownpour.Value) * DownpourPlugin.SimulacrumScalingDownpour.Value; } num2 = num * DownpourPlugin.TempScalingDownpour.Value; if (simulacrum) { num2 *= DownpourPlugin.SimulacrumTempScalingDownpour.Value; } } else if (def.nameToken == "INFERNO_NAME") { num = DownpourPlugin.ScalingInferno.Value; if (simulacrum) { num = (num + DownpourPlugin.SimulacrumBase.Value) * DownpourPlugin.SimulacrumScaling.Value; } num2 = num * DownpourPlugin.TempScaling.Value; if (simulacrum) { num2 *= DownpourPlugin.SimulacrumTempScaling.Value; } } else { float num3 = (DownpourPlugin.ScalingDrizzle.Value - DownpourPlugin.ScalingMonsoon.Value) / 2f; float num4 = DownpourPlugin.ScalingDrizzle.Value + num3; num = Mathf.Max(DownpourPlugin.ScalingMax.Value, num4 - num3 * def.scalingValue); if (simulacrum) { num = (num + DownpourPlugin.SimulacrumBase.Value) * DownpourPlugin.SimulacrumScaling.Value; } num2 = num * DownpourPlugin.TempScaling.Value; if (simulacrum) { num2 *= DownpourPlugin.SimulacrumTempScaling.Value; } } return GetScaleInternal(num, num2, sec); } public static float GetScaleInternal(float diff, float temp, float sec) { return Mathf.Pow(1.15f, ((diff == 0f) ? 0f : (sec / diff)) + ((temp == 0f) ? 0f : ((sec - lastStageTime) / temp))); } public static float GetStageScale(DifficultyDef def, int stage, int people, bool simulacrum = false) { if (def == null) { return 1f; } if (DownpourPlugin.BrimstoneList.Contains(def)) { return GetStageScaleInternal(DownpourPlugin.InitialScalingBrimstone.Value + (float)stage * DownpourPlugin.StageScalingBrimstone.Value, people) * (simulacrum ? DownpourPlugin.SimulacrumStageScalingBrimstone.Value : 1f); } if (DownpourPlugin.DownpourList.Contains(def)) { return GetStageScaleInternal(DownpourPlugin.InitialScalingDownpour.Value + (float)stage * DownpourPlugin.StageScalingDownpour.Value, people) * (simulacrum ? DownpourPlugin.SimulacrumStageScalingDownpour.Value : 1f); } return GetStageScaleInternal(def.scalingValue + DownpourPlugin.InitialScaling.Value + (float)stage * DownpourPlugin.StageScaling.Value, people) * (simulacrum ? DownpourPlugin.SimulacrumStageScaling.Value : 1f); } public static float GetStageScaleInternal(float coeff, int people) { return 0.0506f * coeff * Mathf.Pow((float)people, 0.2f); } public static void PatchGup() { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Expected O, but got Unknown string[] array = new string[3] { "Gup", "Geep", "Gip" }; foreach (string text in array) { CharacterBody component = Addressables.LoadAssetAsync<GameObject>((object)("RoR2/DLC1/Gup/" + text + "Body.prefab")).WaitForCompletion().GetComponent<CharacterBody>(); component.baseMaxHealth *= 0.75f; component.levelMaxHealth *= 0.75f; component.baseRegen = 0f; component.levelRegen = 0f; if (text != "Gup") { component.baseDamage *= 1.3333334f; component.levelDamage *= 1.3333334f; component.baseMoveSpeed *= 1.5f; component.levelMoveSpeed *= 1.5f; } } object obj = <>c.<>9__26_0; if (obj == null) { Manipulator val = delegate(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) ILCursor val2 = new ILCursor(il); val2.GotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<TeamComponent>(x, "GetTeamMembers") }); val2.Emit(OpCodes.Dup); int index = val2.Index; val2.Index = index + 1; val2.EmitDelegate<Func<ReadOnlyCollection<TeamComponent>, int, int>>((Func<ReadOnlyCollection<TeamComponent>, int, int>)delegate(ReadOnlyCollection<TeamComponent> list, int orig) { foreach (TeamComponent item in list) { if ((Object)(object)item.body != (Object)null && ((Object)item.body).name.Contains("GupBody")) { orig += 2; } } return orig; }); }; <>c.<>9__26_0 = val; obj = (object)val; } MasterSummon.Perform += (Manipulator)obj; } } public class Options { public static void Patch() { ModSettingsManager.SetModIcon(DownpourPlugin.AssetBundle.LoadAsset<Sprite>("Assets/iconDownpour.png"), "prodzpod.Downpour", "Downpour"); AddOption(DownpourPlugin.EnableRework, restart: true); AddOption(DownpourPlugin.EnableInferno, restart: true); AddOption(DownpourPlugin.EnableDownpour, restart: true); AddOption(DownpourPlugin.EnableBrimstone, restart: true); AddOption(DownpourPlugin.FasterSimulacrum, restart: true); AddOption(DownpourPlugin.ScalingDrizzle, 0f, 1200f, 15f); AddOption(DownpourPlugin.ScalingMonsoon, 0f, 1200f, 15f); AddOption(DownpourPlugin.ScalingInferno, 0f, 1200f, 15f); AddOption(DownpourPlugin.ScalingMax, 0f, 1200f, 15f); AddOption(DownpourPlugin.TempScaling, 0f, 5f, 0.05f); AddOption(DownpourPlugin.InitialScaling, 0f, 5f, 0.05f); AddOption(DownpourPlugin.StageScaling, -5f, 5f, 0.05f); AddOption(DownpourPlugin.SimulacrumBase, -600f, 600f, 15f); AddOption(DownpourPlugin.SimulacrumScaling, 0f, 5f, 0.05f); AddOption(DownpourPlugin.SimulacrumTempScaling, 0f, 5f, 0.05f); AddOption(DownpourPlugin.SimulacrumStageScaling, -5f, 5f, 0.05f); AddOption(DownpourPlugin.SimulacrumCountdown, 0f, 20f, 1f); AddOption(DownpourPlugin.SimulacrumBossHealth, 0f, 5f, 0.05f); AddOption(DownpourPlugin.ScalingDownpour, 0f, 1200f, 15f); AddOption(DownpourPlugin.TempScalingDownpour, 0f, 5f, 0.05f); AddOption(DownpourPlugin.InitialScalingDownpour, 0f, 5f, 0.05f); AddOption(DownpourPlugin.StageScalingDownpour, -5f, 5f, 0.05f); AddOption(DownpourPlugin.SimulacrumBaseDownpour, -600f, 600f, 15f); AddOption(DownpourPlugin.SimulacrumScalingDownpour, 0f, 5f, 0.05f); AddOption(DownpourPlugin.SimulacrumTempScalingDownpour, 0f, 5f, 0.05f); AddOption(DownpourPlugin.SimulacrumStageScalingDownpour, -5f, 5f, 0.05f); AddOption(DownpourPlugin.ScalingBrimstone, 0f, 1200f, 15f); AddOption(DownpourPlugin.TempScalingBrimstone, 0f, 5f, 0.05f); AddOption(DownpourPlugin.InitialScalingBrimstone, 0f, 5f, 0.05f); AddOption(DownpourPlugin.StageScalingBrimstone, -5f, 5f, 0.05f); AddOption(DownpourPlugin.SimulacrumBaseBrimstone, -600f, 600f, 15f); AddOption(DownpourPlugin.SimulacrumScalingBrimstone, 0f, 5f, 0.05f); AddOption(DownpourPlugin.SimulacrumTempScalingBrimstone, 0f, 5f, 0.05f); AddOption(DownpourPlugin.SimulacrumStageScalingBrimstone, -5f, 5f, 0.05f); AddOption(DownpourPlugin.SimulacrumCountdownDownpour, 0f, 20f, 1f); bool flag = false; } public static void AddOption(ConfigEntry<bool> entry, bool restart = false) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(entry, restart), "prodzpod.Downpour", "Downpour"); } public static void AddOption(ConfigEntry<float> entry, float min, float max, float step) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown StepSliderConfig val = new StepSliderConfig(); ((SliderConfig)val).max = max; ((SliderConfig)val).min = min; val.increment = step; ModSettingsManager.AddOption((BaseOption)new StepSliderOption(entry, val), "prodzpod.Downpour", "Downpour"); } } public class Token { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static hook_GetLocalizedStringByToken <>9__1_0; public static hook_GetLocalizedStringByToken <>9__2_0; internal string <Patch>b__1_0(orig_GetLocalizedStringByToken orig, Language self, string token) { if (descs.ContainsKey(token)) { return GetDescription(orig.Invoke(self, token), descs[token]); } return orig.Invoke(self, token); } internal string <PatchBrimstone>b__2_0(orig_GetLocalizedStringByToken orig, Language self, string token) { if (token == "BRIMSTONE_DESC") { string text = "<style=cStack>>Player Health Regeneration: <style=cDeath>-40%</style>\n"; if (Main.Scaling.Value > 0f && Main.Scaling.Value != 100f) { text = text + ">Difficulty Scaling: <style=" + ((Main.Scaling.Value < 100f) ? "cIsHealing" : "cDeath") + ">" + PercentFormat((Main.Scaling.Value - 100f) / 100f) + "% + Endless</style>\n"; } if (Main.LevelAttackSpeed.Value > 0f || Main.LevelMoveSpeed.Value > 0f || Main.LevelRegen.Value > 0f) { text += ">Enemy Stats: <style=cDeath>Constantly Increasing</style>\n"; } if (Main.ProjectileSpeed.Value > 1f) { text = text + ">Enemy Projectile Speed: <style=cDeath>+" + (Main.ProjectileSpeed.Value - 1f) * 100f + "%</style>\n"; } if (Main.EnableCDirector.Value) { text += ">Combat Director: <style=cDeath>Resourceful</style>\n"; } if (Main.LevelDiffBoost.Value > 0f) { text += ">Starting Difficulty: <style=cDeath>Increased</style>\n"; } if (Main.EnableSkills.Value || Main.EnableStats.Value) { text += ">Enemy Abilities: <style=cDeath>Improved</style>\n"; } if (Main.EnableAI.Value) { text = text + ">Enemy AI: <style=cDeath>Refined" + ((Main.AIScaling.Value > 0f) ? " + Evolving</style>\n" : "</style>\n"); } if ((float)Main.MonsterLimit.Value != 40f) { text = text + ">Enemy Cap: <style=cDeath>" + (((float)Main.MonsterLimit.Value > 40f) ? "+" : "") + ((float)Main.MonsterLimit.Value - 40f) * 2.5f + "%</style>\n"; } if (Main.AllyPermanentDamage.Value > 0f) { text += ">Allies receive <style=cDeath>permanent damage</style>\n"; } return orig.Invoke(self, token).Replace("{INFERNO}", text + "</style>"); } return orig.Invoke(self, token); } } public static Dictionary<string, DifficultyDef> descs = new Dictionary<string, DifficultyDef>(); public static List<string> extraSpaces = new List<string> { "INFERNO_NAME", "BRIMSTONE_NAME", "CALYPSO_NAME", "TEMPEST_NAME", "SCYLLA_NAME", "SS2_DIFFICULTY_TYPHOON_DESC" }; public static void Patch() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown object obj = <>c.<>9__1_0; if (obj == null) { hook_GetLocalizedStringByToken val = (orig_GetLocalizedStringByToken orig, Language self, string token) => descs.ContainsKey(token) ? GetDescription(orig.Invoke(self, token), descs[token]) : orig.Invoke(self, token); <>c.<>9__1_0 = val; obj = (object)val; } Language.GetLocalizedStringByToken += (hook_GetLocalizedStringByToken)obj; } public static void PatchBrimstone() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown object obj = <>c.<>9__2_0; if (obj == null) { hook_GetLocalizedStringByToken val = delegate(orig_GetLocalizedStringByToken orig, Language self, string token) { if (token == "BRIMSTONE_DESC") { string text = "<style=cStack>>Player Health Regeneration: <style=cDeath>-40%</style>\n"; if (Main.Scaling.Value > 0f && Main.Scaling.Value != 100f) { text = text + ">Difficulty Scaling: <style=" + ((Main.Scaling.Value < 100f) ? "cIsHealing" : "cDeath") + ">" + PercentFormat((Main.Scaling.Value - 100f) / 100f) + "% + Endless</style>\n"; } if (Main.LevelAttackSpeed.Value > 0f || Main.LevelMoveSpeed.Value > 0f || Main.LevelRegen.Value > 0f) { text += ">Enemy Stats: <style=cDeath>Constantly Increasing</style>\n"; } if (Main.ProjectileSpeed.Value > 1f) { text = text + ">Enemy Projectile Speed: <style=cDeath>+" + (Main.ProjectileSpeed.Value - 1f) * 100f + "%</style>\n"; } if (Main.EnableCDirector.Value) { text += ">Combat Director: <style=cDeath>Resourceful</style>\n"; } if (Main.LevelDiffBoost.Value > 0f) { text += ">Starting Difficulty: <style=cDeath>Increased</style>\n"; } if (Main.EnableSkills.Value || Main.EnableStats.Value) { text += ">Enemy Abilities: <style=cDeath>Improved</style>\n"; } if (Main.EnableAI.Value) { text = text + ">Enemy AI: <style=cDeath>Refined" + ((Main.AIScaling.Value > 0f) ? " + Evolving</style>\n" : "</style>\n"); } if ((float)Main.MonsterLimit.Value != 40f) { text = text + ">Enemy Cap: <style=cDeath>" + (((float)Main.MonsterLimit.Value > 40f) ? "+" : "") + ((float)Main.MonsterLimit.Value - 40f) * 2.5f + "%</style>\n"; } if (Main.AllyPermanentDamage.Value > 0f) { text += ">Allies receive <style=cDeath>permanent damage</style>\n"; } return orig.Invoke(self, token).Replace("{INFERNO}", text + "</style>"); } return orig.Invoke(self, token); }; <>c.<>9__2_0 = val; obj = (object)val; } Language.GetLocalizedStringByToken += (hook_GetLocalizedStringByToken)obj; } public static string GetDescription(string orig, DifficultyDef def) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) PreGameController instance = PreGameController.instance; int num; if (instance != null) { _ = instance.gameModeIndex; if (true) { num = (GameModeCatalog.GetGameModeName(PreGameController.instance.gameModeIndex).Contains("InfiniteTowerRun") ? 1 : 0); goto IL_0032; } } num = 0; goto IL_0032; IL_0032: bool flag = (byte)num != 0; if (!Hooks.Enabled(def, flag)) { return orig; } if (def.nameToken.StartsWith("ECLIPSE_")) { return orig; } DownpourPlugin.Log.LogDebug((object)("Applying downpour description for Difficulty " + def.nameToken)); Match match = Regex.Match(orig.ToLower(), ">\\s*difficulty\\s*scaling:\\s*<style=\\w+>.+?</style>"); string text = orig; int num2; if (match.Success) { num2 = match.Index; text = orig.Slice(0, match.Index) + orig.Slice(match.Index + match.Length); } else { num2 = orig.IndexOf("\n\n") + 2; if (num2 == 1) { num2 = orig.IndexOf("\r\n\r\n") + 4; if (num2 == 3) { text += "\n\n"; num2 = text.Length; } } } string text2 = "<style=cStack>"; string text3 = ((def.nameToken == "INFERNO_NAME" || def.nameToken == "BRIMSTONE_NAME") ? "cDeath" : "cIsHealth"); float baseScaling = GetBaseScaling(def); if (baseScaling != 0f) { text2 = text2 + ">Difficulty Scaling: <style=" + ((baseScaling < 0f) ? "cIsHealing" : text3) + ">" + PercentFormat(baseScaling) + "%</style>\n"; } float stageScaling = GetStageScaling(def, flag); if (stageScaling != 0f) { text2 = text2 + ">Linear Difficulty Scaling: <style=" + ((stageScaling < 0f) ? "cIsHealing" : text3) + ">" + PercentFormat(stageScaling) + "% per stage</style>\n"; } float scaling = GetScaling(def, flag); if (scaling != 0f) { text2 += string.Format(">Exponential Difficulty Scaling:\n <style={0}>x115% every {1} minute{2}</style>\n", text3, scaling / 60f, (scaling > 60f) ? "s" : ""); } float tempScaling = GetTempScaling(def, flag); if (tempScaling != 0f) { text2 += string.Format(">Temporary Difficulty Scaling:\n <style={0}>x115% every {1} minute{2}, resets every stage</style>\n", text3, tempScaling / 60f, (tempScaling > 60f) ? "s" : ""); } if (extraSpaces.Contains(def.nameToken)) { text2 = text2.Substring(0, text2.Length - 1); } text2 += "</style>"; return text.Slice(0, num2) + text2 + text.Slice(num2); } public static string PercentFormat(float val) { return ((val > 0f) ? "+" : "") + val * 100f; } public static float GetBaseScaling(DifficultyDef def, bool simulacrum = false) { if (DownpourPlugin.BrimstoneList.Contains(def)) { return (DownpourPlugin.InitialScalingBrimstone.Value - 2f) * 0.5f; } if (DownpourPlugin.DownpourList.Contains(def)) { return (DownpourPlugin.InitialScalingDownpour.Value - 2f) * 0.5f; } return (def.scalingValue + DownpourPlugin.InitialScaling.Value - 2f) * 0.5f; } public static float GetStageScaling(DifficultyDef def, bool simulacrum = false) { if (DownpourPlugin.BrimstoneList.Contains(def)) { return DownpourPlugin.StageScalingBrimstone.Value * (simulacrum ? DownpourPlugin.SimulacrumStageScalingBrimstone.Value : 1f); } if (DownpourPlugin.DownpourList.Contains(def)) { return DownpourPlugin.StageScalingDownpour.Value * (simulacrum ? DownpourPlugin.SimulacrumStageScalingDownpour.Value : 1f); } return DownpourPlugin.StageScaling.Value * (simulacrum ? DownpourPlugin.SimulacrumStageScaling.Value : 1f) * 0.25f; } public static float GetScaling(DifficultyDef def, bool simulacrum = false) { if (DownpourPlugin.BrimstoneList.Contains(def)) { return GetScalingInternal(DownpourPlugin.ScalingBrimstone.Value, simulacrum, DownpourPlugin.SimulacrumBaseBrimstone.Value, DownpourPlugin.SimulacrumScalingBrimstone.Value); } if (DownpourPlugin.DownpourList.Contains(def)) { return GetScalingInternal(DownpourPlugin.ScalingDownpour.Value, simulacrum, DownpourPlugin.SimulacrumBaseDownpour.Value, DownpourPlugin.SimulacrumScalingDownpour.Value); } if (def.nameToken == "INFERNO_NAME") { return GetScalingInternal(DownpourPlugin.ScalingInferno.Value, simulacrum, DownpourPlugin.SimulacrumBase.Value, DownpourPlugin.SimulacrumScaling.Value); } float num = (DownpourPlugin.ScalingDrizzle.Value - DownpourPlugin.ScalingMonsoon.Value) / 2f; float num2 = DownpourPlugin.ScalingDrizzle.Value + num; return GetScalingInternal(Mathf.Min(DownpourPlugin.ScalingMax.Value, num2 - num * def.scalingValue), simulacrum, DownpourPlugin.SimulacrumBase.Value, DownpourPlugin.SimulacrumScaling.Value); } public static float GetScalingInternal(float orig, bool simulacrum, float simulinit, float simulmult) { if (simulacrum) { return (orig + simulinit) * simulmult; } return orig; } public static float GetTempScaling(DifficultyDef def, bool simulacrum = false) { if (DownpourPlugin.BrimstoneList.Contains(def)) { return GetScalingInternal(DownpourPlugin.ScalingBrimstone.Value, simulacrum, DownpourPlugin.SimulacrumBaseBrimstone.Value, DownpourPlugin.SimulacrumScalingBrimstone.Value) * DownpourPlugin.TempScalingBrimstone.Value * (simulacrum ? DownpourPlugin.SimulacrumTempScalingBrimstone.Value : 1f); } if (DownpourPlugin.DownpourList.Contains(def)) { return GetScalingInternal(DownpourPlugin.ScalingDownpour.Value, simulacrum, DownpourPlugin.SimulacrumBaseDownpour.Value, DownpourPlugin.SimulacrumScalingDownpour.Value) * DownpourPlugin.TempScalingDownpour.Value * (simulacrum ? DownpourPlugin.SimulacrumTempScalingDownpour.Value : 1f); } if (def.nameToken == "INFERNO_NAME") { return GetScalingInternal(DownpourPlugin.ScalingInferno.Value, simulacrum, DownpourPlugin.SimulacrumBase.Value, DownpourPlugin.SimulacrumScaling.Value) * DownpourPlugin.TempScaling.Value * (simulacrum ? DownpourPlugin.SimulacrumTempScaling.Value : 1f); } float num = (DownpourPlugin.ScalingDrizzle.Value - DownpourPlugin.ScalingMonsoon.Value) / 2f; float num2 = DownpourPlugin.ScalingDrizzle.Value + num; return GetScalingInternal(Mathf.Min(DownpourPlugin.ScalingMax.Value, num2 - num * def.scalingValue), simulacrum, DownpourPlugin.SimulacrumBase.Value, DownpourPlugin.SimulacrumScaling.Value) * DownpourPlugin.TempScaling.Value * (simulacrum ? DownpourPlugin.SimulacrumTempScaling.Value : 1f); } } public static class Extension { public static string Slice(this string orig, int begin, int length = -1) { if (begin >= orig.Length) { return ""; } begin = (begin % orig.Length + orig.Length) % orig.Length; if (length < 0 || begin + length >= orig.Length) { return orig.Substring(begin); } return orig.Substring(begin, length); } } }