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 ProperLoop v1.0.13
ProperLoop.dll
Decompiled 5 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using EntityStates.ScavBackpack; using HarmonyLib; using IL.RoR2; using IL.RoR2.Achievements; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using On.RoR2; using ProperSave; using RoR2; using TPDespair.ZetArtifacts; using UnityEngine; [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("ProperLoop")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+097271e5f88eda83074e834bf81b922ebe9835a0")] [assembly: AssemblyProduct("ProperLoop")] [assembly: AssemblyTitle("ProperLoop")] [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 ProperLoop { internal class J { public static void load() { Loading.OnLoadingEnded += delegate { load(Main.savePath); }; static void load(string path) { string[][] source = File.ReadAllLines(path).ToList().ConvertAll((string x) => x.Split(',')) .ToArray(); Main.loops = int.Parse(source.FirstOrDefault((string[] x) => x[0] == "loops")[1]); Main.stage = int.Parse(source.FirstOrDefault((string[] x) => x[0] == "stage")[1]); if (Main.ScavItemCountScale.Value) { Opening.maxItemDropCount = Main.loops * 5 + Main.stage + 1; } } } } [BepInPlugin("prodzpod.ProperLoop", "ProperLoop", "1.0.13")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*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 Main : BaseUnityPlugin { [HarmonyPatch] public class PatchLoopGetter { public static bool Prefix(ref int __result) { __result = loops; return false; } public static MethodBase TargetMethod() { return typeof(Run).GetProperty("loopClearCount").GetGetMethod(); } } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static hook_Start <>9__30_0; public static Func<Instruction, bool> <>9__30_9; public static Func<int> <>9__30_10; public static Manipulator <>9__30_1; public static Func<GameObject, bool> <>9__30_11; public static Action<Stage> <>9__30_2; public static hook_PlaceTeleporter <>9__30_3; public static Func<Instruction, bool> <>9__30_12; public static Func<int> <>9__30_13; public static Manipulator <>9__30_4; public static Func<Instruction, bool> <>9__30_14; public static Func<DirectorCard, string> <>9__30_17; public static Func<Category, string> <>9__30_16; public static Func<Instruction, bool> <>9__30_18; public static Func<Instruction, bool> <>9__30_19; public static Func<DirectorCard, int> <>9__30_20; public static Manipulator <>9__30_6; public static Func<Instruction, bool> <>9__30_21; public static Func<Instruction, bool> <>9__30_22; public static Func<FamilyDirectorCardCategorySelection, int> <>9__30_23; public static Func<Instruction, bool> <>9__30_24; public static Func<Instruction, bool> <>9__30_25; public static Func<FamilyDirectorCardCategorySelection, int> <>9__30_26; public static Manipulator <>9__30_7; public static hook_SetEquipmentIndexForSlot_EquipmentIndex_uint_uint <>9__30_8; public static Action<Dictionary<string, object>> <>9__36_0; internal void <Awake>b__30_0(orig_Start orig, Run self) { loops = 0; stage = 0; if (ScavItemCountScale.Value) { Opening.maxItemDropCount = 1; } orig.Invoke(self); } internal void <Awake>b__30_1(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<Run>(x, "get_stageClearCountInCurrentLoop") }); val.Emit(OpCodes.Pop); val.EmitDelegate<Func<int>>((Func<int>)(() => stage)); } internal bool <Awake>b__30_9(Instruction x) { return ILPatternMatchingExt.MatchCallOrCallvirt<Run>(x, "get_stageClearCountInCurrentLoop"); } internal int <Awake>b__30_10() { return stage; } internal void <Awake>b__30_2(Stage _) { GameObject? obj = ((IEnumerable<GameObject>)Object.FindObjectsOfType<GameObject>()).FirstOrDefault((Func<GameObject, bool>)((GameObject x) => (Object)(object)x.GetComponent<TeleporterInteraction>() != (Object)null)); TeleporterInteraction val = ((obj != null) ? obj.GetComponent<TeleporterInteraction>() : null); if (!((Object)(object)val == (Object)null) && !((Object)(object)val == (Object)null)) { stage++; if (((Object)((Component)val).gameObject).name.Contains("LunarTeleporter")) { stage = 0; loops++; } if (ScavItemCountScale.Value) { Opening.maxItemDropCount = loops * 5 + stage + 1; } } } internal bool <Awake>b__30_11(GameObject x) { return (Object)(object)x.GetComponent<TeleporterInteraction>() != (Object)null; } internal void <Awake>b__30_3(orig_PlaceTeleporter orig, SceneDirector self) { if ((Object)(object)self.teleporterSpawnCard != (Object)null) { self.teleporterSpawnCard = (SpawnCard)(object)((stage == 4) ? lunarTP : TP); } orig.Invoke(self); } internal void <Awake>b__30_4(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) ILCursor val = new ILCursor(il); val.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 0) }); val.Emit(OpCodes.Pop); val.EmitDelegate<Func<int>>((Func<int>)(() => loops)); } internal bool <Awake>b__30_12(Instruction x) { return ILPatternMatchingExt.MatchLdcI4(x, 0); } internal int <Awake>b__30_13() { return loops; } internal bool <Awake>b__30_14(Instruction x) { return ILPatternMatchingExt.MatchStfld<ClassicStageInfo>(x, "modifiableMonsterCategories"); } internal string <Awake>b__30_16(Category x) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return GeneralExtensions.Join<DirectorCard>((IEnumerable<DirectorCard>)x.cards, (Func<DirectorCard, string>)delegate(DirectorCard y) { SpawnCard spawnCard = y.spawnCard; return (((spawnCard != null) ? ((Object)spawnCard).name : null) ?? "Null") + $" ({y.minimumStageCompletions})"; }, ", "); } internal string <Awake>b__30_17(DirectorCard y) { SpawnCard spawnCard = y.spawnCard; return (((spawnCard != null) ? ((Object)spawnCard).name : null) ?? "Null") + $" ({y.minimumStageCompletions})"; } internal void <Awake>b__30_6(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0067: 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) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); val.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld<DirectorCard>(x, "minimumStageCompletions") }); val.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchClt(x) }); val.Emit(OpCodes.Pop); val.Emit(OpCodes.Pop); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Func<DirectorCard, int>>((Func<DirectorCard, int>)((DirectorCard self) => StageCheck(self.minimumStageCompletions + 1) ? 1 : 0)); val.Emit(OpCodes.Ldc_I4_1); } internal bool <Awake>b__30_18(Instruction x) { return ILPatternMatchingExt.MatchLdfld<DirectorCard>(x, "minimumStageCompletions"); } internal bool <Awake>b__30_19(Instruction x) { return ILPatternMatchingExt.MatchClt(x); } internal int <Awake>b__30_20(DirectorCard self) { return StageCheck(self.minimumStageCompletions + 1) ? 1 : 0; } internal void <Awake>b__30_7(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0067: 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) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0165: 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.MatchLdfld<FamilyDirectorCardCategorySelection>(x, "minimumStageCompletion") }); ILLabel val2 = default(ILLabel); val.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchBgt(x, ref val2) }); val.Emit(OpCodes.Pop); val.Emit(OpCodes.Pop); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Func<FamilyDirectorCardCategorySelection, int>>((Func<FamilyDirectorCardCategorySelection, int>)((FamilyDirectorCardCategorySelection self) => (!StageCheck(self.minimumStageCompletion + 1)) ? 2 : 0)); val.Emit(OpCodes.Ldc_I4_1); val.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld<FamilyDirectorCardCategorySelection>(x, "maximumStageCompletion") }); val.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCgt(x) }); val.Emit(OpCodes.Pop); val.Emit(OpCodes.Pop); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Func<FamilyDirectorCardCategorySelection, int>>((Func<FamilyDirectorCardCategorySelection, int>)((FamilyDirectorCardCategorySelection self) => (!StageCheckMax(self.maximumStageCompletion + 1)) ? 2 : 0)); val.Emit(OpCodes.Ldc_I4_1); } internal bool <Awake>b__30_21(Instruction x) { return ILPatternMatchingExt.MatchLdfld<FamilyDirectorCardCategorySelection>(x, "minimumStageCompletion"); } internal bool <Awake>b__30_22(Instruction x) { ILLabel val = default(ILLabel); return ILPatternMatchingExt.MatchBgt(x, ref val); } internal int <Awake>b__30_23(FamilyDirectorCardCategorySelection self) { return (!StageCheck(self.minimumStageCompletion + 1)) ? 2 : 0; } internal bool <Awake>b__30_24(Instruction x) { return ILPatternMatchingExt.MatchLdfld<FamilyDirectorCardCategorySelection>(x, "maximumStageCompletion"); } internal bool <Awake>b__30_25(Instruction x) { return ILPatternMatchingExt.MatchCgt(x); } internal int <Awake>b__30_26(FamilyDirectorCardCategorySelection self) { return (!StageCheckMax(self.maximumStageCompletion + 1)) ? 2 : 0; } internal void <Awake>b__30_8(orig_SetEquipmentIndexForSlot_EquipmentIndex_uint_uint orig, Inventory self, EquipmentIndex equipmentIndex, uint a, uint b) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) CharacterMaster component = ((Component)self).gameObject.GetComponent<CharacterMaster>(); Log.LogDebug((object)("setting equipment for:" + ((Object)component).name)); if (!(((Object)component).name == "ArtifactShellMaster") || equipmentIndex != Equipment.AffixLunar.equipmentIndex) { orig.Invoke(self, equipmentIndex, a, b); } } internal void <ProperlySave>b__36_0(Dictionary<string, object> _) { <ProperlySave>g__save|36_1(savePath); } } public const string PluginGUID = "prodzpod.ProperLoop"; public const string PluginAuthor = "prodzpod"; public const string PluginName = "ProperLoop"; public const string PluginVersion = "1.0.13"; public static ManualLogSource Log; public static PluginInfo pluginInfo; public static Harmony Harmony; public static ConfigFile Config; public static ConfigEntry<int> ScavCost; public static ConfigEntry<int> ScavOnLevel; public static ConfigEntry<bool> ScavItemCountScale; public static ConfigEntry<string> EliteDisables; public static ConfigEntry<float> T1Cost; public static ConfigEntry<int> T1OnLevel; public static ConfigEntry<float> T2Cost; public static ConfigEntry<int> T2OnLevel; public static ConfigEntry<bool> T2OnHonor; public static ConfigEntry<int> LoopBossesOnLevel; public static ConfigEntry<int> LoopEnemiesOnLevel; public static ConfigEntry<int> PerfectedOnLevel; public static ConfigEntry<bool> PerfectedOnHonor; public static ConfigEntry<float> PerfectedCost; public static ConfigEntry<float> HonorMultiplier; public static ConfigEntry<float> SanctionMultiplier; public static InteractableSpawnCard TP; public static InteractableSpawnCard lunarTP; private static bool _thisInitialized = false; private static WeightedSelection<EliteTierDef> EliteSelection = new WeightedSelection<EliteTierDef>(8); public static int loops = 0; public static int stage = 0; public static string savePath = Path.Combine(Application.persistentDataPath, "ProperSave", "Saves") + "\\ProperLoop.csv"; public void Awake() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Expected O, but got Unknown //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Expected O, but got Unknown //IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_0311: Unknown result type (might be due to invalid IL or missing references) //IL_0317: Expected O, but got Unknown //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Expected O, but got Unknown //IL_0331: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Unknown result type (might be due to invalid IL or missing references) //IL_033c: Expected O, but got Unknown //IL_0378: Unknown result type (might be due to invalid IL or missing references) //IL_037d: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Expected O, but got Unknown //IL_039d: Unknown result type (might be due to invalid IL or missing references) //IL_03a2: Unknown result type (might be due to invalid IL or missing references) //IL_03a8: Expected O, but got Unknown //IL_03d7: Unknown result type (might be due to invalid IL or missing references) //IL_03dc: Unknown result type (might be due to invalid IL or missing references) //IL_03e2: Expected O, but got Unknown pluginInfo = ((BaseUnityPlugin)this).Info; Log = ((BaseUnityPlugin)this).Logger; Harmony = new Harmony("prodzpod.ProperLoop"); Config = new ConfigFile(Path.Combine(Paths.ConfigPath, "prodzpod.ProperLoop.cfg"), true); ScavCost = Config.Bind<int>("General", "Scavenger Cost", 2000, "Lower if you want scavs to spawn early. Vanilla by default."); ScavOnLevel = Config.Bind<int>("General", "Scavenger Stage", 6, "5 per Proper Loop. 0 to disable."); ScavItemCountScale = Config.Bind<bool>("General", "Scavenger Item Count Scale", true, "Make scavenger sacks drop items proportional to current stage number."); T1Cost = Config.Bind<float>("General", "Tier 1 Director Cost Multiplier", 1f, "Perfected on Moon also uses this."); T1OnLevel = Config.Bind<int>("General", "Tier 1 Elites Stage", 1, "5 per Proper Loop. 0 to disable. May break modded artifacts if changed."); T2Cost = Config.Bind<float>("General", "Tier 2 Director Cost Multiplier", 6f, "Vanilla value: 6."); T2OnLevel = Config.Bind<int>("General", "Tier 2 Elites Stage", 6, "5 per Proper Loop. 0 to disable. May break modded artifacts if changed."); T2OnHonor = Config.Bind<bool>("General", "Tier 2 on Honor", true, "add T2 Elites to Honor. extra chaos!"); LoopBossesOnLevel = Config.Bind<int>("General", "Loop Bosses Stage", 6, "5 per Proper Loop. 0 to disable."); LoopEnemiesOnLevel = Config.Bind<int>("General", "Loop Enemies Stage", 6, "5 per Proper Loop. 0 to disable."); PerfectedOnLevel = Config.Bind<int>("General", "Perfected Elite Stage", 6, "5 per Proper Loop. 0 to disable. Enables perfected loop by default."); PerfectedOnHonor = Config.Bind<bool>("General", "Perfected on Honor", true, "add Perfected Elites to Honor. extra chaos!"); PerfectedCost = Config.Bind<float>("General", "Perfected Director Cost Multiplier", 6f, "By default, equal to T2."); HonorMultiplier = Config.Bind<float>("General", "Artifact of Honor Stage Multiplier", 1f, "Rounded up."); SanctionMultiplier = Config.Bind<float>("General", "Artifact of Sanction Stage Multiplier", 0.5f, "Epic zetartifacts compat"); EliteDisables = Config.Bind<string>("General", "Elite Disables", "", "List of EliteDef names to blacklist, separated by comma. Check log for names."); object obj = <>c.<>9__30_0; if (obj == null) { hook_Start val = delegate(orig_Start orig, Run self) { loops = 0; stage = 0; if (ScavItemCountScale.Value) { Opening.maxItemDropCount = 1; } orig.Invoke(self); }; <>c.<>9__30_0 = val; obj = (object)val; } Run.Start += (hook_Start)obj; if (Chainloader.PluginInfos.ContainsKey("com.KingEnderBrine.ProperSave")) { ProperlySave(); } object obj2 = <>c.<>9__30_1; if (obj2 == null) { Manipulator val2 = 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 val16 = new ILCursor(il); val16.GotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Run>(x, "get_stageClearCountInCurrentLoop") }); val16.Emit(OpCodes.Pop); val16.EmitDelegate<Func<int>>((Func<int>)(() => stage)); }; <>c.<>9__30_1 = val2; obj2 = (object)val2; } TeleporterInteraction.Start += (Manipulator)obj2; TP = LegacyResourcesAPI.Load<InteractableSpawnCard>("SpawnCards/InteractableSpawnCard/iscTeleporter"); lunarTP = LegacyResourcesAPI.Load<InteractableSpawnCard>("SpawnCards/InteractableSpawnCard/iscLunarTeleporter"); Stage.onServerStageComplete += delegate { GameObject? obj8 = ((IEnumerable<GameObject>)Object.FindObjectsOfType<GameObject>()).FirstOrDefault((Func<GameObject, bool>)((GameObject x) => (Object)(object)x.GetComponent<TeleporterInteraction>() != (Object)null)); TeleporterInteraction val15 = ((obj8 != null) ? obj8.GetComponent<TeleporterInteraction>() : null); if (!((Object)(object)val15 == (Object)null) && !((Object)(object)val15 == (Object)null)) { stage++; if (((Object)((Component)val15).gameObject).name.Contains("LunarTeleporter")) { stage = 0; loops++; } if (ScavItemCountScale.Value) { Opening.maxItemDropCount = loops * 5 + stage + 1; } } }; object obj3 = <>c.<>9__30_3; if (obj3 == null) { hook_PlaceTeleporter val3 = delegate(orig_PlaceTeleporter orig, SceneDirector self) { if ((Object)(object)self.teleporterSpawnCard != (Object)null) { self.teleporterSpawnCard = (SpawnCard)(object)((stage == 4) ? lunarTP : TP); } orig.Invoke(self); }; <>c.<>9__30_3 = val3; obj3 = (object)val3; } SceneDirector.PlaceTeleporter += (hook_PlaceTeleporter)obj3; object obj4 = <>c.<>9__30_4; if (obj4 == null) { Manipulator val4 = 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_0038: Unknown result type (might be due to invalid IL or missing references) ILCursor val14 = new ILCursor(il); val14.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 0) }); val14.Emit(OpCodes.Pop); val14.EmitDelegate<Func<int>>((Func<int>)(() => loops)); }; <>c.<>9__30_4 = val4; obj4 = (object)val4; } LoopOnceAchievement.Check += (Manipulator)obj4; CharacterSpawnCard scav = LegacyResourcesAPI.Load<CharacterSpawnCard>("SpawnCards/CharacterSpawnCards/cscScav"); ClassicStageInfo.RebuildCards += (Manipulator)delegate(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown ILCursor val11 = new ILCursor(il); val11.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld<ClassicStageInfo>(x, "modifiableMonsterCategories") }); val11.EmitDelegate<Func<DirectorCardCategorySelection, DirectorCardCategorySelection>>((Func<DirectorCardCategorySelection, DirectorCardCategorySelection>)delegate(DirectorCardCategorySelection orig) { //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_00e4: 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_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < orig.categories.Length; i++) { Category val12 = orig.categories[i]; for (int j = 0; j < val12.cards.Length; j++) { DirectorCard val13 = val12.cards[j]; if (val13.spawnCard is CharacterSpawnCard) { if ((Object)(object)val13.spawnCard == (Object)(object)scav) { val13.minimumStageCompletions = ScavOnLevel.Value - 1; val13.spawnCard.directorCreditCost = ScavCost.Value; } else if (val13.minimumStageCompletions > stage) { val13.minimumStageCompletions = Mathf.Max(0, val13.minimumStageCompletions + ((val12.name == "Champions") ? LoopBossesOnLevel.Value : LoopEnemiesOnLevel.Value) - 6); } val12.cards[j] = val13; } } orig.categories[i] = val12; } Log.LogDebug((object)("Enemy Stage Completion\n" + GeneralExtensions.Join<Category>((IEnumerable<Category>)orig.categories, (Func<Category, string>)((Category x) => GeneralExtensions.Join<DirectorCard>((IEnumerable<DirectorCard>)x.cards, (Func<DirectorCard, string>)delegate(DirectorCard y) { SpawnCard spawnCard = y.spawnCard; return (((spawnCard != null) ? ((Object)spawnCard).name : null) ?? "Null") + $" ({y.minimumStageCompletions})"; }, ", ")), "\n"))); return orig; }); }; object obj5 = <>c.<>9__30_6; if (obj5 == null) { Manipulator val5 = 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_0067: 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) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) ILCursor val10 = new ILCursor(il); val10.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld<DirectorCard>(x, "minimumStageCompletions") }); val10.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchClt(x) }); val10.Emit(OpCodes.Pop); val10.Emit(OpCodes.Pop); val10.Emit(OpCodes.Ldarg_0); val10.EmitDelegate<Func<DirectorCard, int>>((Func<DirectorCard, int>)((DirectorCard self) => StageCheck(self.minimumStageCompletions + 1) ? 1 : 0)); val10.Emit(OpCodes.Ldc_I4_1); }; <>c.<>9__30_6 = val5; obj5 = (object)val5; } DirectorCard.IsAvailable += (Manipulator)obj5; object obj6 = <>c.<>9__30_7; if (obj6 == null) { Manipulator val6 = 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_0067: 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) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) ILCursor val8 = new ILCursor(il); val8.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld<FamilyDirectorCardCategorySelection>(x, "minimumStageCompletion") }); ILLabel val9 = default(ILLabel); val8.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchBgt(x, ref val9) }); val8.Emit(OpCodes.Pop); val8.Emit(OpCodes.Pop); val8.Emit(OpCodes.Ldarg_0); val8.EmitDelegate<Func<FamilyDirectorCardCategorySelection, int>>((Func<FamilyDirectorCardCategorySelection, int>)((FamilyDirectorCardCategorySelection self) => (!StageCheck(self.minimumStageCompletion + 1)) ? 2 : 0)); val8.Emit(OpCodes.Ldc_I4_1); val8.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld<FamilyDirectorCardCategorySelection>(x, "maximumStageCompletion") }); val8.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCgt(x) }); val8.Emit(OpCodes.Pop); val8.Emit(OpCodes.Pop); val8.Emit(OpCodes.Ldarg_0); val8.EmitDelegate<Func<FamilyDirectorCardCategorySelection, int>>((Func<FamilyDirectorCardCategorySelection, int>)((FamilyDirectorCardCategorySelection self) => (!StageCheckMax(self.maximumStageCompletion + 1)) ? 2 : 0)); val8.Emit(OpCodes.Ldc_I4_1); }; <>c.<>9__30_7 = val6; obj6 = (object)val6; } FamilyDirectorCardCategorySelection.IsAvailable += (Manipulator)obj6; Harmony.PatchAll(typeof(PatchLoopGetter)); object obj7 = <>c.<>9__30_8; if (obj7 == null) { hook_SetEquipmentIndexForSlot_EquipmentIndex_uint_uint val7 = delegate(orig_SetEquipmentIndexForSlot_EquipmentIndex_uint_uint orig, Inventory self, EquipmentIndex equipmentIndex, uint a, uint b) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) CharacterMaster component = ((Component)self).gameObject.GetComponent<CharacterMaster>(); Log.LogDebug((object)("setting equipment for:" + ((Object)component).name)); if (!(((Object)component).name == "ArtifactShellMaster") || equipmentIndex != Equipment.AffixLunar.equipmentIndex) { orig.Invoke(self, equipmentIndex, a, b); } }; <>c.<>9__30_8 = val7; obj7 = (object)val7; } Inventory.SetEquipmentIndexForSlot_EquipmentIndex_uint_uint += (hook_SetEquipmentIndexForSlot_EquipmentIndex_uint_uint)obj7; } public static bool StageCheck(int onLevel, float multiplier = 1f) { if (onLevel == 0) { return false; } if (Chainloader.PluginInfos.ContainsKey("com.TPDespair.ZetArtifacts") && EarlifactActive()) { multiplier *= SanctionMultiplier.Value; } onLevel = Mathf.CeilToInt((float)onLevel * multiplier) - 1; return loops > onLevel / 5 || (loops == onLevel / 5 && stage >= onLevel % 5); } public static bool StageCheckMax(int onLevel, float multiplier = 1f) { if (onLevel == 0) { return false; } if (Chainloader.PluginInfos.ContainsKey("com.TPDespair.ZetArtifacts") && EarlifactActive()) { multiplier *= SanctionMultiplier.Value; } onLevel = Mathf.CeilToInt((float)onLevel * multiplier) - 1; return loops < onLevel / 5 || (loops == onLevel / 5 && stage < onLevel % 5); } public static bool EarlifactActive() { return RunArtifactManager.instance.IsArtifactEnabled(ZetEarlifact.ArtifactDef); } public static void ProperlySave() { SaveFile.OnGatherSaveData += delegate { save(savePath); }; if (File.Exists(savePath)) { J.load(); } static void save(string path) { File.WriteAllText(path, $"loops,{loops}\nstage,{stage}"); } } [CompilerGenerated] internal static void <ProperlySave>g__save|36_1(string path) { File.WriteAllText(path, $"loops,{loops}\nstage,{stage}"); } } }