Some mods may be broken due to the recent Alloyed Collective update.
Decompiled source of ExpansionManager v1.1.2
plugins/ExpansionManager.dll
Decompiled a week agousing System; using System.Collections; 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.Logging; using ExpansionManager.Util; using HG; using HG.Reflection; using IL.RoR2; using Microsoft.CodeAnalysis; using Mono.Cecil; using Mono.Cecil.Cil; using MonoMod.Cil; using On.RoR2; using On.RoR2.UI; using RoR2; using RoR2.ContentManagement; using RoR2.ExpansionManagement; using RoR2.UI; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.ResourceManagement.AsyncOperations; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: OptIn] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("ExpansionManager")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+faf31643e5d7d3312eab767e1ef1db25e1492553")] [assembly: AssemblyProduct("ExpansionManager")] [assembly: AssemblyTitle("ExpansionManager")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] [module: UnverifiableCode] 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 ExpansionManager { public static class ExpansionManagerAssets { public static string assetsPath; private static AssetBundleCreateRequest assetBundleCreateRequest; private static AssetBundle assetBundle; public static AssetBundle Bundle { get { if (!Object.op_Implicit((Object)(object)assetBundle)) { AssetBundleCreateRequest obj = assetBundleCreateRequest; assetBundle = ((obj != null) ? obj.assetBundle : null); } return assetBundle; } } public static void ModInit() { assetBundleCreateRequest = AssetBundle.LoadFromFileAsync(assetsPath); } } [BepInPlugin("groovesalad.ExpansionManager", "ExpansionManager", "1.1.2")] public class ExpansionManagerPlugin : BaseUnityPlugin { public const string GUID = "groovesalad.ExpansionManager"; public const string NAME = "ExpansionManager"; public const string VERSION = "1.1.2"; public static ManualLogSource Logger { get; private set; } protected void Awake() { Logger = ((BaseUnityPlugin)this).Logger; string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); ExpansionManagerAssets.assetsPath = Path.Combine(directoryName, "AssetBundles", "expansionmanagerassets.bundle"); ExpansionManagerAssets.ModInit(); Language.collectLanguageRootFolders += delegate(List<string> list) { list.Add(Path.Combine(directoryName, "Language")); }; ExpansionRulesCatalog.ModInit(); ExpansionManagerUI.ModInit(); } } public static class ExpansionManagerUI { public class FadedOutMeshEffect : BaseMeshEffect { public Color color = new Color(1f, 1f, 1f, 0f); public override void ModifyMesh(VertexHelper vh) { //IL_000b: 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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_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_004f: 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) if (!((UIBehaviour)this).IsActive()) { return; } UIVertex val = default(UIVertex); for (int i = 0; i < vh.currentVertCount; i++) { vh.PopulateUIVertex(ref val, i); if (val.position.y > 0f && val.position.x > 0f) { val.color = Color32.op_Implicit(color); vh.SetUIVertex(val, i); } } } } [CompilerGenerated] private static class <>O { public static hook_SetChoice <0>__RuleChoiceController_SetChoice; public static hook_UpdateChoiceDisplay <1>__RuleChoiceController_UpdateChoiceDisplay; public static hook_SetData <2>__RuleCategoryController_SetData; } [CompilerGenerated] private sealed class <Init>d__4 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; private AssetBundleRequest <load_texUIHeaderSharp>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <Init>d__4(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <load_texUIHeaderSharp>5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <load_texUIHeaderSharp>5__2 = ExpansionManagerAssets.Bundle.LoadAssetAsync<Sprite>("texUIHeaderSharp"); break; case 1: <>1__state = -1; break; } if (!((AsyncOperation)<load_texUIHeaderSharp>5__2).isDone) { <>2__current = null; <>1__state = 1; return true; } texUIHeaderSharp = (Sprite)<load_texUIHeaderSharp>5__2.asset; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private const string EXPANSIONS_DISPLAY_TOKEN = "RULE_HEADER_EXPANSIONS"; public static Sprite texUIHeaderSharp; public static void ModInit() { //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_001b: Expected O, but got Unknown //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_0050: 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_005b: Expected O, but got Unknown object obj = <>O.<0>__RuleChoiceController_SetChoice; if (obj == null) { hook_SetChoice val = RuleChoiceController_SetChoice; <>O.<0>__RuleChoiceController_SetChoice = val; obj = (object)val; } RuleChoiceController.SetChoice += (hook_SetChoice)obj; object obj2 = <>O.<1>__RuleChoiceController_UpdateChoiceDisplay; if (obj2 == null) { hook_UpdateChoiceDisplay val2 = RuleChoiceController_UpdateChoiceDisplay; <>O.<1>__RuleChoiceController_UpdateChoiceDisplay = val2; obj2 = (object)val2; } RuleChoiceController.UpdateChoiceDisplay += (hook_UpdateChoiceDisplay)obj2; object obj3 = <>O.<2>__RuleCategoryController_SetData; if (obj3 == null) { hook_SetData val3 = RuleCategoryController_SetData; <>O.<2>__RuleCategoryController_SetData = val3; obj3 = (object)val3; } RuleCategoryController.SetData += (hook_SetData)obj3; } [IteratorStateMachine(typeof(<Init>d__4))] [SystemInitializer(new Type[] { })] private static IEnumerator Init() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <Init>d__4(0); } private static void RuleChoiceController_SetChoice(orig_SetChoice orig, RuleChoiceController self, RuleChoiceDef newChoiceDef) { if (self.choiceDef?.extraData is ExpansionDef && !(newChoiceDef?.extraData is ExpansionDef)) { self.tooltipProvider.overrideBodyText = null; Transform val = ((Component)self).transform.Find("NotificationIcon"); if (Object.op_Implicit((Object)(object)val)) { ((Component)val).gameObject.SetActive(false); } if (Object.op_Implicit((Object)(object)self.image)) { FadedOutMeshEffect component = ((Component)self.image).gameObject.GetComponent<FadedOutMeshEffect>(); if (Object.op_Implicit((Object)(object)component)) { ((Behaviour)component).enabled = false; } } } orig.Invoke(self, newChoiceDef); } private static void RuleChoiceController_UpdateChoiceDisplay(orig_UpdateChoiceDisplay orig, RuleChoiceController self, RuleChoiceDef displayChoiceDef) { //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_011f: 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_039a: Unknown result type (might be due to invalid IL or missing references) //IL_03ee: Unknown result type (might be due to invalid IL or missing references) //IL_03f3: Unknown result type (might be due to invalid IL or missing references) //IL_040f: Unknown result type (might be due to invalid IL or missing references) //IL_0428: Unknown result type (might be due to invalid IL or missing references) //IL_0470: Unknown result type (might be due to invalid IL or missing references) //IL_04b3: Unknown result type (might be due to invalid IL or missing references) //IL_04cf: Unknown result type (might be due to invalid IL or missing references) //IL_04e8: Unknown result type (might be due to invalid IL or missing references) //IL_05dc: Unknown result type (might be due to invalid IL or missing references) //IL_0618: Unknown result type (might be due to invalid IL or missing references) //IL_061d: Unknown result type (might be due to invalid IL or missing references) //IL_0632: Unknown result type (might be due to invalid IL or missing references) //IL_0637: Unknown result type (might be due to invalid IL or missing references) //IL_065b: Unknown result type (might be due to invalid IL or missing references) //IL_0660: Unknown result type (might be due to invalid IL or missing references) //IL_067c: Unknown result type (might be due to invalid IL or missing references) //IL_0690: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, displayChoiceDef); if (displayChoiceDef.extraData is ExpansionRulesCatalog.ExpansionContentRule expansionContentRule) { if (Object.op_Implicit((Object)(object)self.image)) { Transform val = ((Component)self.image).transform.parent.Find("SubIcon"); Image val2 = (Object.op_Implicit((Object)(object)val) ? ((Component)val).GetComponent<Image>() : null); if (!Object.op_Implicit((Object)(object)val2)) { val2 = new GameObject("SubIcon", new Type[3] { typeof(RectTransform), typeof(CanvasRenderer), typeof(Image) }).GetComponent<Image>(); ((Component)val2).transform.SetParent(((Component)self.image).transform.parent, false); Transform val3 = ((Component)val2).transform.parent.Find("HoverOutline"); if (Object.op_Implicit((Object)(object)val3)) { ((Component)val2).transform.SetSiblingIndex(((Component)val3).transform.GetSiblingIndex()); } ((Component)val2).gameObject.layer = LayerIndex.ui.intVal; RectTransform component = ((Component)val2).GetComponent<RectTransform>(); component.sizeDelta = new Vector2(32f, 32f); ((Transform)component).localPosition = new Vector3(-20f, 20f); } val2.sprite = (expansionContentRule.enabled ? expansionContentRule.expansionDef.iconSprite : expansionContentRule.expansionDef.disabledIconSprite); } { foreach (RuleChoiceController instances in RuleChoiceController.instancesList) { if (instances.choiceDef != null && (Object)/*isinst with value type is only supported in some contexts*/ == (Object)(object)expansionContentRule.expansionDef) { instances.UpdateChoiceDisplay(instances.choiceDef); } } return; } } object extraData = displayChoiceDef.extraData; ExpansionDef val4 = (ExpansionDef)((extraData is ExpansionDef) ? extraData : null); if (val4 == null || !ExpansionRulesCatalog.expansionByRuleCategory.TryGetValue(val4.expansionIndex, out var value)) { return; } if (Object.op_Implicit((Object)(object)PreGameController.instance) && Object.op_Implicit((Object)(object)self.tooltipProvider) && value.children.Count > 0) { self.tooltipProvider.overrideBodyText = null; string bodyText = self.tooltipProvider.bodyText; bodyText += "\n"; foreach (RuleDef item in value.children.OrderByDescending((RuleDef x) => PreGameController.instance.readOnlyRuleBook.GetRuleChoiceIndex(x) == x.defaultChoiceIndex)) { RuleChoiceDef ruleChoice = PreGameController.instance.readOnlyRuleBook.GetRuleChoice(item); if (ruleChoice != null) { bodyText += Language.GetStringFormatted("EXPANSION_CONTENT_" + ruleChoice.localName.ToUpperInvariant(), new object[1] { ruleChoice.getTooltipName(ruleChoice) }); } } self.tooltipProvider.overrideBodyText = bodyText; } if (!Object.op_Implicit((Object)(object)((Component)self).GetComponentInParent<RuleCategoryController>())) { return; } Transform val5 = ((Component)self).transform.Find("BaseOutline"); Image val6 = (Object.op_Implicit((Object)(object)val5) ? ((Component)val5).GetComponent<Image>() : null); Transform val7 = ((Component)self).transform.Find("HoverOutline"); Image val8 = (Object.op_Implicit((Object)(object)val7) ? ((Component)val7).GetComponent<Image>() : null); if (!Object.op_Implicit((Object)(object)val6)) { val6 = new GameObject("BaseOutline", new Type[3] { typeof(RectTransform), typeof(CanvasRenderer), typeof(Image) }).GetComponent<Image>(); ((Component)val6).transform.SetParent(((Component)self).transform, false); ((Component)val6).gameObject.layer = LayerIndex.ui.intVal; val6.sprite = texUIHeaderSharp; ((Graphic)val6).color = Color32.op_Implicit(new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)30)); RectTransform component2 = ((Component)val6).GetComponent<RectTransform>(); component2.sizeDelta = new Vector2(48f, 8f); ((Transform)component2).localPosition = new Vector3(0f, -30f, 0f); } if (!Object.op_Implicit((Object)(object)val8)) { val8 = new GameObject("HoverOutline", new Type[3] { typeof(RectTransform), typeof(CanvasRenderer), typeof(Image) }).GetComponent<Image>(); ((Component)val8).transform.SetParent(((Component)self).transform, false); ((Component)val8).gameObject.layer = LayerIndex.ui.intVal; val8.sprite = texUIHeaderSharp; ((Graphic)val8).color = Color.white; RectTransform component3 = ((Component)val8).GetComponent<RectTransform>(); component3.sizeDelta = new Vector2(48f, 8f); ((Transform)component3).localPosition = new Vector3(0f, -32f, 0f); } if (Object.op_Implicit((Object)(object)self.hgButton)) { self.hgButton.showImageOnHover = true; self.hgButton.imageOnInteractable = val6; self.hgButton.imageOnHover = val8; } Transform val9 = ((Component)self).transform.Find("NotificationIcon"); Image val10 = (Object.op_Implicit((Object)(object)val9) ? ((Component)val9).GetComponent<Image>() : null); bool flag = false; if (Object.op_Implicit((Object)(object)PreGameController.instance) && value.children.Count > 0) { flag = value.children.Any((RuleDef x) => PreGameController.instance.readOnlyRuleBook.GetRuleChoiceIndex(x) != x.defaultChoiceIndex); } if (flag && !Object.op_Implicit((Object)(object)val10)) { val10 = new GameObject("NotificationIcon", new Type[3] { typeof(RectTransform), typeof(CanvasRenderer), typeof(Image) }).GetComponent<Image>(); ((Component)val10).transform.SetParent(((Component)self).transform, false); ((Component)val10).gameObject.layer = LayerIndex.ui.intVal; val10.sprite = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/UI/texPlayerVoteStatus.png").WaitForCompletion(); ((Graphic)val10).material = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/UI/matUIOverbrighten2x.mat").WaitForCompletion(); ((Graphic)val10).color = Color32.op_Implicit(new Color32((byte)235, (byte)235, (byte)235, (byte)200)); RectTransform component4 = ((Component)val10).GetComponent<RectTransform>(); component4.sizeDelta = new Vector2(20f, 30f); ((Transform)component4).localPosition = new Vector3(16f, 16f); } if (Object.op_Implicit((Object)(object)val10)) { ((Component)val10).gameObject.SetActive(flag); } if (Object.op_Implicit((Object)(object)self.image)) { FadedOutMeshEffect fadedOutMeshEffect = ((Component)self.image).gameObject.GetComponent<FadedOutMeshEffect>(); if (flag && !Object.op_Implicit((Object)(object)fadedOutMeshEffect)) { fadedOutMeshEffect = ((Component)self.image).gameObject.AddComponent<FadedOutMeshEffect>(); } if (Object.op_Implicit((Object)(object)fadedOutMeshEffect)) { ((Behaviour)fadedOutMeshEffect).enabled = flag; } } } private static void RuleCategoryController_SetData(orig_SetData orig, RuleCategoryController self, RuleCategoryDef categoryDef, RuleChoiceMask availability, RuleBook ruleBook) { //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Expected O, but got Unknown //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Expected O, but got Unknown //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Expected O, but got Unknown //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, categoryDef, availability, ruleBook); if (ExpansionRulesCatalog.ruleCategoryByExpansion.TryGetValue(categoryDef, out var expansionDef)) { if (Object.op_Implicit((Object)(object)self.popoutPanelInstance)) { self.popoutPanelInstance.popoutPanelDescriptionText.formatArgs = new object[1] { Language.GetString(expansionDef.nameToken) }; } if (self.rulesToDisplay != null && self.popoutButtonIconAllocator?.elements != null) { for (int i = 0; i < self.rulesToDisplay.Count; i++) { self.popoutButtonIconAllocator.elements[i].UpdateFromVotes(); } } RuleBookViewer componentInParent = ((Component)self).GetComponentInParent<RuleBookViewer>(); if (!Object.op_Implicit((Object)(object)componentInParent) || componentInParent.categoryElementAllocator == null) { return; } RuleCategoryController val = componentInParent.categoryElementAllocator?.elements?.FirstOrDefault((Func<RuleCategoryController, bool>)((RuleCategoryController x) => x.currentCategory != null && x.currentCategory.displayToken == "RULE_HEADER_EXPANSIONS")); if (!Object.op_Implicit((Object)(object)val) || val.rulesToDisplay == null) { return; } int num = val.rulesToDisplay.FindIndex(delegate(RuleDef x) { object extraData = x.choices[x.defaultChoiceIndex].extraData; return (Object)((extraData is ExpansionDef) ? extraData : null) == (Object)(object)expansionDef; }); if (num >= 0) { RuleChoiceController val2 = val.voteResultIconAllocator?.elements?[num]; HGButton val3 = default(HGButton); if (Object.op_Implicit((Object)(object)val2) && ((Component)val2).TryGetComponent<HGButton>(ref val3)) { ((UnityEvent)((Button)val3).onClick).RemoveListener(new UnityAction(self.TogglePopoutPanel)); ((UnityEvent)((Button)val3).onClick).AddListener(new UnityAction(self.TogglePopoutPanel)); ((MPButton)val3).allowAllEventSystems = true; ((MPButton)val3).submitOnPointerUp = true; ((MPButton)val3).selectOnPointerEnter = true; ((MPButton)val3).disablePointerClick = false; ((MPButton)val3).disableGamepadClick = false; ((MPButton)val3).defaultFallbackButton = true; HGButton obj = val3; Navigation navigation = default(Navigation); ((Navigation)(ref navigation)).mode = (Mode)3; ((Selectable)obj).navigation = navigation; } } } else if (categoryDef.displayToken == "RULE_HEADER_EXPANSIONS") { GridLayoutGroup val4 = (Object.op_Implicit((Object)(object)self.voteResultGridContainer) ? ((Component)self.voteResultGridContainer).GetComponent<GridLayoutGroup>() : null); if (Object.op_Implicit((Object)(object)val4)) { ((LayoutGroup)val4).padding = new RectOffset(6, 6, 12, 12); val4.spacing = Vector2.zero; } } } } public static class ExpansionRulesCatalog { public struct ExpansionContentRule { public bool enabled; public ExpansionDef expansionDef; } [CompilerGenerated] private static class <>O { public static Manipulator <0>__RuleCatalog_Init; public static Action <1>__AddExpansionRules; public static Func<bool> <2>__HiddenTestTrue; public static Func<RuleChoiceDef, string> <3>__GetOffTooltipNameFromToken; } public static readonly Dictionary<ExpansionIndex, RuleCategoryDef> expansionByRuleCategory = new Dictionary<ExpansionIndex, RuleCategoryDef>(); public static readonly Dictionary<RuleCategoryDef, ExpansionDef> ruleCategoryByExpansion = new Dictionary<RuleCategoryDef, ExpansionDef>(); public static readonly Dictionary<ExpansionIndex, RuleChoiceDef> disableExpansionItemsChoices = new Dictionary<ExpansionIndex, RuleChoiceDef>(); public static readonly Dictionary<ExpansionIndex, RuleChoiceDef> disableExpansionElitesChoices = new Dictionary<ExpansionIndex, RuleChoiceDef>(); public static readonly Dictionary<ExpansionIndex, RuleChoiceDef> disableExpansionStagesChoices = new Dictionary<ExpansionIndex, RuleChoiceDef>(); public static readonly Dictionary<ExpansionIndex, RuleChoiceDef> disableExpansionMonstersChoices = new Dictionary<ExpansionIndex, RuleChoiceDef>(); public static readonly Dictionary<ExpansionIndex, RuleChoiceDef> disableExpansionInteractablesChoices = new Dictionary<ExpansionIndex, RuleChoiceDef>(); public static event Action<ExpansionDef, RuleCategoryDef> GenerateRulesForExpansion; public static void ModInit() { //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_001b: Expected O, but got Unknown object obj = <>O.<0>__RuleCatalog_Init; if (obj == null) { Manipulator val = RuleCatalog_Init; <>O.<0>__RuleCatalog_Init = val; obj = (object)val; } RuleCatalog.Init += (Manipulator)obj; } private static void RuleCatalog_Init(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<RuleDef>(x, "FromExpansion") }) && val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(RuleCatalog), "AddCategory") })) { val.EmitDelegate<Action>((Action)AddExpansionRules); } else { ExpansionManagerPlugin.Logger.LogError((object)"ExpansionRulesCatalog: RuleCatalog_Init IL match failed"); } } private static void AddExpansionRules() { //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) Sprite enabledIcon = ExpansionManagerAssets.Bundle.LoadAsset<Sprite>("texRuleExpansionStagesOn"); Sprite disabledIcon = ExpansionManagerAssets.Bundle.LoadAsset<Sprite>("texRuleExpansionStagesOff"); Sprite enabledIcon2 = ExpansionManagerAssets.Bundle.LoadAsset<Sprite>("texRuleExpansionInteractablesOn"); Sprite disabledIcon2 = ExpansionManagerAssets.Bundle.LoadAsset<Sprite>("texRuleExpansionInteractablesOff"); Sprite enabledIcon3 = ExpansionManagerAssets.Bundle.LoadAsset<Sprite>("texRuleExpansionElitesOn"); Sprite disabledIcon3 = ExpansionManagerAssets.Bundle.LoadAsset<Sprite>("texRuleExpansionElitesOff"); Sprite enabledIcon4 = ExpansionManagerAssets.Bundle.LoadAsset<Sprite>("texRuleExpansionMonstersOn"); Sprite disabledIcon4 = ExpansionManagerAssets.Bundle.LoadAsset<Sprite>("texRuleExpansionMonstersOff"); Sprite enabledIcon5 = ExpansionManagerAssets.Bundle.LoadAsset<Sprite>("texRuleExpansionItemsOn"); Sprite disabledIcon5 = ExpansionManagerAssets.Bundle.LoadAsset<Sprite>("texRuleExpansionItemsOff"); Enumerator<ExpansionDef> enumerator = ExpansionCatalog.expansionDefs.GetEnumerator(); try { while (enumerator.MoveNext()) { ExpansionDef expansionDef = enumerator.Current; RuleCategoryDef val = RuleCatalog.AddCategory(expansionDef.nameToken, expansionDef.descriptionToken, Color32.op_Implicit(new Color32((byte)219, (byte)114, (byte)114, byte.MaxValue)), (string)null, "RULE_HEADER_EXPANSIONS_EDIT", (Func<bool>)RuleCatalog.HiddenTestTrue, (RuleCategoryType)1); expansionByRuleCategory[expansionDef.expansionIndex] = val; ruleCategoryByExpansion[val] = expansionDef; if (Array.Exists(ContentManager.sceneDefs, StageMatchesExpansion)) { RuleCatalog.AddRule(GenerateContentRule(expansionDef, "Stages", enabledIcon, disabledIcon, disableExpansionStagesChoices)); } if (Array.Exists(ContentManager.networkedObjectPrefabs, InteractableMatchesExpansion)) { RuleCatalog.AddRule(GenerateContentRule(expansionDef, "Interactables", enabledIcon2, disabledIcon2, disableExpansionInteractablesChoices)); } if (Array.Exists(ContentManager.eliteDefs, EliteMatchesExpansion)) { RuleCatalog.AddRule(GenerateContentRule(expansionDef, "Elites", enabledIcon3, disabledIcon3, disableExpansionElitesChoices)); } if (Array.Exists(ContentManager.masterPrefabs, MonsterMatchesExpansion)) { RuleCatalog.AddRule(GenerateContentRule(expansionDef, "Monsters", enabledIcon4, disabledIcon4, disableExpansionMonstersChoices)); } if (Array.Exists(ContentManager.itemDefs, ItemMatchesExpansion) || Array.Exists(ContentManager.equipmentDefs, EquipmentMatchesExpansion)) { RuleCatalog.AddRule(GenerateContentRule(expansionDef, "Items", enabledIcon5, disabledIcon5, disableExpansionItemsChoices)); } if (ExpansionRulesCatalog.GenerateRulesForExpansion != null) { ExpansionRulesCatalog.GenerateRulesForExpansion(expansionDef, val); ExpansionRulesCatalog.GenerateRulesForExpansion = null; } bool EliteMatchesExpansion(EliteDef eliteDef) { if (Object.op_Implicit((Object)(object)eliteDef.eliteEquipmentDef)) { return (Object)(object)eliteDef.eliteEquipmentDef.requiredExpansion == (Object)(object)expansionDef; } return false; } bool EquipmentMatchesExpansion(EquipmentDef equipmentDef) { if ((Object)(object)equipmentDef.requiredExpansion == (Object)(object)expansionDef) { return !equipmentDef.IsElite(); } return false; } bool InteractableMatchesExpansion(GameObject networkedObjectPrefab) { ExpansionRequirementComponent val4 = default(ExpansionRequirementComponent); if (networkedObjectPrefab.TryGetComponent<ExpansionRequirementComponent>(ref val4)) { return (Object)(object)val4.requiredExpansion == (Object)(object)expansionDef; } return false; } bool ItemMatchesExpansion(ItemDef itemDef) { return (Object)(object)itemDef.requiredExpansion == (Object)(object)expansionDef; } bool MonsterMatchesExpansion(GameObject masterPrefab) { ExpansionRequirementComponent val2 = default(ExpansionRequirementComponent); if (masterPrefab.TryGetComponent<ExpansionRequirementComponent>(ref val2)) { if ((Object)(object)val2.requiredExpansion == (Object)(object)expansionDef) { return !val2.requireEntitlementIfPlayerControlled; } return false; } CharacterMaster val3 = default(CharacterMaster); if (masterPrefab.TryGetComponent<CharacterMaster>(ref val3) && Object.op_Implicit((Object)(object)val3.bodyPrefab) && val3.bodyPrefab.TryGetComponent<ExpansionRequirementComponent>(ref val2)) { if ((Object)(object)val2.requiredExpansion == (Object)(object)expansionDef) { return !val2.requireEntitlementIfPlayerControlled; } return false; } return false; } bool StageMatchesExpansion(SceneDef sceneDef) { //IL_0016: 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) //IL_001c: 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_0020: Invalid comparison between Unknown and I4 //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Invalid comparison between Unknown and I4 bool flag = (Object)(object)sceneDef.requiredExpansion == (Object)(object)expansionDef; if (flag) { SceneType sceneType = sceneDef.sceneType; bool flag2 = ((sceneType - 1 <= 1 || sceneType - 4 <= 1) ? true : false); flag = flag2; } return flag; } } } finally { ((IDisposable)enumerator).Dispose(); } } public static RuleDef GenerateContentRule(ExpansionDef expansionDef, string contentName, Sprite enabledIcon, Sprite disabledIcon, Dictionary<ExpansionIndex, RuleChoiceDef> disableExpansionContentChoices = null) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Expected O, but got Unknown //IL_013e: Unknown result type (might be due to invalid IL or missing references) RuleDef val = new RuleDef("Expansions." + ((Object)expansionDef).name + "." + contentName, expansionDef.nameToken) { forceLobbyDisplay = true }; string text = "EXPANSION_" + contentName.ToUpperInvariant(); string text2 = text + "_DESC"; RuleChoiceDef obj = val.AddChoice("On", (object)new ExpansionContentRule { enabled = true, expansionDef = expansionDef }, false); obj.sprite = enabledIcon; obj.tooltipNameToken = text; obj.tooltipNameColor = Color32.op_Implicit(new Color32((byte)219, (byte)114, (byte)114, byte.MaxValue)); obj.tooltipBodyToken = text2; obj.requiredEntitlementDef = expansionDef.requiredEntitlement; obj.requiredExpansionDef = expansionDef; val.MakeNewestChoiceDefault(); RuleChoiceDef val2 = val.AddChoice("Off", (object)new ExpansionContentRule { enabled = false, expansionDef = expansionDef }, false); val2.sprite = disabledIcon; val2.tooltipNameToken = text; val2.tooltipNameColor = Color32.op_Implicit(ColorCatalog.GetColor((ColorIndex)10)); val2.getTooltipName = RuleChoiceDef.GetOffTooltipNameFromToken; val2.tooltipBodyToken = text2 + "_OFF"; if (disableExpansionContentChoices != null) { disableExpansionContentChoices[expansionDef.expansionIndex] = val2; } return val; } public static bool IsExpansionContentDisabled(RuleBook ruleBook, ExpansionDef expansionDef, Dictionary<ExpansionIndex, RuleChoiceDef> disableExpansionContentChoices) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)expansionDef) && disableExpansionContentChoices.TryGetValue(expansionDef.expansionIndex, out var value)) { return ruleBook.IsChoiceActive(value); } return false; } public static bool AreExpansionItemsDisabled(this Run run, ExpansionDef expansionDef) { return IsExpansionContentDisabled(run.ruleBook, expansionDef, disableExpansionItemsChoices); } public static bool AreExpansionElitesDisabled(this Run run, ExpansionDef expansionDef) { return IsExpansionContentDisabled(run.ruleBook, expansionDef, disableExpansionElitesChoices); } public static bool AreExpansionStagesDisabled(this Run run, ExpansionDef expansionDef) { return IsExpansionContentDisabled(run.ruleBook, expansionDef, disableExpansionStagesChoices); } public static bool AreExpansionMonstersDisabled(this Run run, ExpansionDef expansionDef) { return IsExpansionContentDisabled(run.ruleBook, expansionDef, disableExpansionMonstersChoices); } public static bool AreExpansionInteractablesDisabled(this Run run, ExpansionDef expansionDef) { return IsExpansionContentDisabled(run.ruleBook, expansionDef, disableExpansionInteractablesChoices); } } } namespace ExpansionManager.Util { public static class EquipmentUtil { public static bool IsElite(this EquipmentDef equipmentDef) { if (Object.op_Implicit((Object)(object)equipmentDef.passiveBuffDef)) { return equipmentDef.passiveBuffDef.isElite; } return false; } } public static class PickupUtil { public static ExpansionDef GetRequiredExpansion(this PickupDef pickupDef) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Invalid comparison between Unknown and I4 //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Invalid comparison between Unknown and I4 //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Invalid comparison between Unknown and I4 //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) ExpansionDef result = null; if ((int)pickupDef.itemIndex != -1) { ItemDef itemDef = ItemCatalog.GetItemDef(pickupDef.itemIndex); if (Object.op_Implicit((Object)(object)itemDef)) { result = itemDef.requiredExpansion; } } else if ((int)pickupDef.equipmentIndex != -1) { EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef(pickupDef.equipmentIndex); if (Object.op_Implicit((Object)(object)equipmentDef)) { result = equipmentDef.requiredExpansion; } } else if ((int)pickupDef.artifactIndex != -1) { ArtifactDef artifactDef = ArtifactCatalog.GetArtifactDef(pickupDef.artifactIndex); if (Object.op_Implicit((Object)(object)artifactDef)) { result = artifactDef.requiredExpansion; } } return result; } } } namespace ExpansionManager.Fixes { public static class AlternatePathEncounter { [CompilerGenerated] private static class <>O { public static hook_OverrideCurrentMonsterCard <0>__CombatDirector_OverrideCurrentMonsterCard; public static hook_OverrideBossFight <1>__SolusFight_OverrideBossFight; } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static orig_OverrideCurrentMonsterCard <>9__2_0; internal void <SolusFight_OverrideBossFight>b__2_0(CombatDirector combatDirector, DirectorCard overrideMonsterCard) { combatDirector.OverrideNextBossCard(overrideMonsterCard, false); } } [SystemInitializer(new Type[] { })] private static void Init() { //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_001b: Expected O, but got Unknown //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown object obj = <>O.<0>__CombatDirector_OverrideCurrentMonsterCard; if (obj == null) { hook_OverrideCurrentMonsterCard val = CombatDirector_OverrideCurrentMonsterCard; <>O.<0>__CombatDirector_OverrideCurrentMonsterCard = val; obj = (object)val; } CombatDirector.OverrideCurrentMonsterCard += (hook_OverrideCurrentMonsterCard)obj; object obj2 = <>O.<1>__SolusFight_OverrideBossFight; if (obj2 == null) { hook_OverrideBossFight val2 = SolusFight_OverrideBossFight; <>O.<1>__SolusFight_OverrideBossFight = val2; obj2 = (object)val2; } SolusFight.OverrideBossFight += (hook_OverrideBossFight)obj2; } private static void CombatDirector_OverrideCurrentMonsterCard(orig_OverrideCurrentMonsterCard orig, CombatDirector self, DirectorCard overrideMonsterCard) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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_004c: 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_006c: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) if (overrideMonsterCard != null && !overrideMonsterCard.IsAvailable() && Object.op_Implicit((Object)(object)overrideMonsterCard.spawnCard) && self.finalMonsterCardsSelection != null) { WeightedSelection<DirectorCard> val = new WeightedSelection<DirectorCard>(8); for (int i = 0; i < self.finalMonsterCardsSelection.Count; i++) { ChoiceInfo<DirectorCard> choice = self.finalMonsterCardsSelection.GetChoice(i); if (choice.value != null && choice.value.IsAvailable() && choice.value.cost <= overrideMonsterCard.cost && choice.value.cost * 5 >= overrideMonsterCard.cost) { choice.weight *= choice.value.cost; val.AddChoice(choice); } } if (val.Count > 0) { overrideMonsterCard = val.Evaluate(self.rng.nextNormalizedFloat); } } orig.Invoke(self, overrideMonsterCard); } private static void SolusFight_OverrideBossFight(orig_OverrideBossFight orig, SolusFight self) { //IL_001b: 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: Expected O, but got Unknown orig.Invoke(self); object obj = <>c.<>9__2_0; if (obj == null) { orig_OverrideCurrentMonsterCard val = delegate(CombatDirector combatDirector, DirectorCard overrideMonsterCard) { combatDirector.OverrideNextBossCard(overrideMonsterCard, false); }; <>c.<>9__2_0 = val; obj = (object)val; } CombatDirector_OverrideCurrentMonsterCard((orig_OverrideCurrentMonsterCard)obj, TeleporterInteraction.instance.companionBoss, self.ForcedBossFight); } } public static class DeadDccsAdditions { [CompilerGenerated] private static class <>O { public static hook_MergeCategories <0>__DCCSBlender_MergeCategories; public static hook_Awake <1>__CombatDirector_Awake; public static orig_MergeCategories <2>__none; } private const string CHAMPIONS = "Champions"; private const string MINIBOSSES = "Minibosses"; private const string BASIC_MONSTERS = "Basic Monsters"; private const string SPECIAL = "Special"; public static readonly Dictionary<string, Action<DirectorCardCategorySelection>> monsterSelectionAdditions = new Dictionary<string, Action<DirectorCardCategorySelection>> { { "dccsAncientLoftMonstersDLC1", AncientLoftMonstersDLC1 }, { "dccsSulfurPoolsMonstersDLC1", SulfurPoolsMonstersDLC1 }, { "dccsIronalluviumMonsters", IronAlluviumMonsters }, { "dccsIronalluvium2MonstersDLC2", Ironalluvium2MonstersDLC2 }, { "dccsRepurposedcraterMonstersDLC1", RepurposedCraterMonstersDLC1 }, { "dccsConduitcanyonMonsters", ConduitCanyonMonsters }, { "dccsBallFamily_ItemThemed", BallFamily_ItemThemed } }; public static AsyncOperationHandle<SpawnCard> cscBell = Addressables.LoadAssetAsync<SpawnCard>((object)"RoR2/Base/Bell/cscBell.asset"); public static AsyncOperationHandle<SpawnCard> cscLesserWisp = Addressables.LoadAssetAsync<SpawnCard>((object)"RoR2/Base/Wisp/cscLesserWisp.asset"); public static AsyncOperationHandle<SpawnCard> cscMagmaWorm = Addressables.LoadAssetAsync<SpawnCard>((object)"RoR2/Base/MagmaWorm/cscMagmaWorm.asset"); public static AsyncOperationHandle<SpawnCard> cscHermitCrab = Addressables.LoadAssetAsync<SpawnCard>((object)"RoR2/Base/HermitCrab/cscHermitCrab.asset"); public static AsyncOperationHandle<SpawnCard> cscLemurian = Addressables.LoadAssetAsync<SpawnCard>((object)"RoR2/Base/Lemurian/cscLemurian.asset"); public static AsyncOperationHandle<SpawnCard> cscVulture = Addressables.LoadAssetAsync<SpawnCard>((object)"RoR2/Base/Vulture/cscVulture.asset"); public static AsyncOperationHandle<SpawnCard> cscRoboBallMini = Addressables.LoadAssetAsync<SpawnCard>((object)"RoR2/Base/RoboBallBoss/cscRoboBallMini.asset"); public static AsyncOperationHandle<SpawnCard> cscChild = Addressables.LoadAssetAsync<SpawnCard>((object)"RoR2/DLC2/Child/cscChild.asset"); public static AsyncOperationHandle<SpawnCard> cscMinorConstruct = Addressables.LoadAssetAsync<SpawnCard>((object)"RoR2/DLC1/MajorAndMinorConstruct/cscMinorConstruct.asset"); public static AsyncOperationHandle<SpawnCard> cscMiniMushroom = Addressables.LoadAssetAsync<SpawnCard>((object)"RoR2/Base/MiniMushroom/cscMiniMushroom.asset"); public static AsyncOperationHandle<SpawnCard> cscImp = Addressables.LoadAssetAsync<SpawnCard>((object)"RoR2/Base/Imp/cscImp.asset"); public static AsyncOperationHandle<SpawnCard> cscRoboBallBoss = Addressables.LoadAssetAsync<SpawnCard>((object)"RoR2/Base/RoboBallBoss/cscRoboBallBoss.asset"); public static void AncientLoftMonstersDLC1(DirectorCardCategorySelection dccs) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: 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) //IL_0027: Expected O, but got Unknown //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_0043: 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_0056: Expected O, but got Unknown dccs.AttemptAddCard("Minibosses", new DirectorCard { spawnCard = cscBell.WaitForCompletion(), selectionWeight = 1 }); dccs.AttemptAddCard("Basic Monsters", new DirectorCard { spawnCard = cscLesserWisp.WaitForCompletion(), selectionWeight = 1, preventOverhead = true }); } public static void SulfurPoolsMonstersDLC1(DirectorCardCategorySelection dccs) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: 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) //IL_0027: Expected O, but got Unknown //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_0043: 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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown dccs.AttemptAddCard("Champions", new DirectorCard { spawnCard = cscMagmaWorm.WaitForCompletion(), selectionWeight = 1 }); dccs.AttemptAddCard("Basic Monsters", new DirectorCard { spawnCard = cscHermitCrab.WaitForCompletion(), selectionWeight = 1, spawnDistance = (MonsterSpawnDistance)2 }); dccs.AttemptAddCard("Basic Monsters", new DirectorCard { spawnCard = cscLemurian.WaitForCompletion(), selectionWeight = 1 }); dccs.SetCategoryWeight("Basic Monsters", 2); } public static void IronAlluviumMonsters(DirectorCardCategorySelection dccs) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: 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) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: 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_0056: Expected O, but got Unknown dccs.AttemptAddCard("Basic Monsters", new DirectorCard { spawnCard = cscRoboBallMini.WaitForCompletion(), selectionWeight = 1, spawnDistance = (MonsterSpawnDistance)2 }); dccs.AttemptAddCard("Basic Monsters", new DirectorCard { spawnCard = cscVulture.WaitForCompletion(), selectionWeight = 1 }); dccs.SetCategoryWeight("Basic Monsters", 2); } public static void Ironalluvium2MonstersDLC2(DirectorCardCategorySelection dccs) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: 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) //IL_0027: Expected O, but got Unknown dccs.AttemptAddCard("Basic Monsters", new DirectorCard { spawnCard = cscChild.WaitForCompletion(), selectionWeight = 1 }); dccs.SetCategoryWeight("Basic Monsters", 2); } public static void RepurposedCraterMonstersDLC1(DirectorCardCategorySelection dccs) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: 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) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown dccs.AttemptAddCard("Basic Monsters", new DirectorCard { spawnCard = cscMinorConstruct.WaitForCompletion(), selectionWeight = 4, preventOverhead = true }); } public static void ConduitCanyonMonsters(DirectorCardCategorySelection dccs) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: 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) //IL_0028: Expected O, but got Unknown //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown dccs.AttemptAddCard("Basic Monsters", new DirectorCard { spawnCard = cscMiniMushroom.WaitForCompletion(), selectionWeight = 10 }); dccs.AttemptAddCard("Basic Monsters", new DirectorCard { spawnCard = cscImp.WaitForCompletion(), selectionWeight = 10 }); } public static void BallFamily_ItemThemed(DirectorCardCategorySelection dccs) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: 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) //IL_0027: Expected O, but got Unknown //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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown dccs.AttemptAddCard("Champions", new DirectorCard { spawnCard = cscRoboBallBoss.WaitForCompletion(), selectionWeight = 1 }); dccs.AttemptAddCard("Basic Monsters", new DirectorCard { spawnCard = cscRoboBallMini.WaitForCompletion(), selectionWeight = 1 }); } public static bool AttemptAddCard(this DirectorCardCategorySelection dccs, string categoryName, DirectorCard card) { int num = dccs.FindCategoryIndexByName(categoryName); if (ArrayUtils.IsInBounds<Category>(dccs.categories, num)) { dccs.AddCard(num, card); return true; } return false; } public static void SetCategoryWeight(this DirectorCardCategorySelection dccs, string categoryName, int categoryWeight) { int num = dccs.FindCategoryIndexByName(categoryName); if (ArrayUtils.IsInBounds<Category>(dccs.categories, num)) { dccs.categories[num].selectionWeight = categoryWeight; } } [SystemInitializer(new Type[] { })] private static void Init() { //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_001b: Expected O, but got Unknown //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown object obj = <>O.<0>__DCCSBlender_MergeCategories; if (obj == null) { hook_MergeCategories val = DCCSBlender_MergeCategories; <>O.<0>__DCCSBlender_MergeCategories = val; obj = (object)val; } DCCSBlender.MergeCategories += (hook_MergeCategories)obj; object obj2 = <>O.<1>__CombatDirector_Awake; if (obj2 == null) { hook_Awake val2 = CombatDirector_Awake; <>O.<1>__CombatDirector_Awake = val2; obj2 = (object)val2; } CombatDirector.Awake += (hook_Awake)obj2; } private static void DCCSBlender_MergeCategories(orig_MergeCategories orig, ref DirectorCardCategorySelection blendedDCCS, List<ChoiceInfo<DirectorCardCategorySelection>> selectedDCCSList) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(ref blendedDCCS, selectedDCCSList); foreach (ChoiceInfo<DirectorCardCategorySelection> selectedDCCS in selectedDCCSList) { string text = ((Object)selectedDCCS.value).name; if (text.EndsWith("(Clone)")) { text = text.Remove(text.Length - 7); } if (monsterSelectionAdditions.TryGetValue(text, out var value)) { SceneDef val = (Object.op_Implicit((Object)(object)SceneInfo.instance) ? SceneInfo.instance.sceneDef : null); ExpansionDef val2 = (Object.op_Implicit((Object)(object)val) ? val.requiredExpansion : null); if (Object.op_Implicit((Object)(object)val2) && Run.instance.AreExpansionMonstersDisabled(val2)) { ExpansionManagerPlugin.Logger.LogInfo((object)("DeadDccsAdditions: " + ((Object)val2).name + " has monsters disabled, Adding monster cards to " + text)); value(blendedDCCS); } } } } private static void CombatDirector_Awake(orig_Awake orig, CombatDirector self) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0036: 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_006c: 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) //IL_0077: Expected O, but got Unknown orig.Invoke(self); if (NetworkServer.active && Object.op_Implicit((Object)(object)self.monsterCards)) { DirectorCardCategorySelection blendedDCCS2 = new DirectorCardCategorySelection(); blendedDCCS2.CopyFrom(self.monsterCards); List<ChoiceInfo<DirectorCardCategorySelection>> selectedDCCSList2 = new List<ChoiceInfo<DirectorCardCategorySelection>>(1) { new ChoiceInfo<DirectorCardCategorySelection> { value = self.monsterCards, weight = 1f } }; object obj = <>O.<2>__none; if (obj == null) { orig_MergeCategories val = none; <>O.<2>__none = val; obj = (object)val; } DCCSBlender_MergeCategories((orig_MergeCategories)obj, ref blendedDCCS2, selectedDCCSList2); self.monsterCardsSelection = blendedDCCS2.GenerateDirectorCardWeightedSelection(); } static void none(ref DirectorCardCategorySelection blendedDCCS, List<ChoiceInfo<DirectorCardCategorySelection>> selectedDCCSList) { } } } public static class DropTableFallbacks { [CompilerGenerated] private static class <>O { public static hook_GeneratePickup <0>__PickupDropTable_GeneratePickup; public static hook_GenerateDistinctPickups <1>__PickupDropTable_GenerateDistinctPickups; public static hook_GenerateDrop <2>__PickupDropTable_GenerateDrop; public static hook_GenerateUniqueDrops <3>__PickupDropTable_GenerateUniqueDrops; } public static readonly Dictionary<string, string> fallbacksDictionary = new Dictionary<string, string> { { "dtVoidChest", "dtChest1" }, { "dtShrineHalcyoniteTier1", "dtShrineHalcyoniteTier3" }, { "dtShrineHalcyoniteTier2", "dtShrineHalcyoniteTier3" } }; public static bool DropTableFallback(PickupDropTable dropTable, out PickupDropTable fallbackDropTable) { if (dropTable.GetPickupCount() == 0 && fallbacksDictionary.TryGetValue(((Object)dropTable).name, out var fallbackName)) { return Object.op_Implicit((Object)(object)(fallbackDropTable = PickupDropTable.instancesList.Find((PickupDropTable x) => ((Object)x).name == fallbackName))); } fallbackDropTable = null; return false; } [SystemInitializer(new Type[] { })] private static void Init() { //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_001b: Expected O, but got Unknown //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_0050: 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_005b: Expected O, but got Unknown //IL_0070: 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_007b: Expected O, but got Unknown object obj = <>O.<0>__PickupDropTable_GeneratePickup; if (obj == null) { hook_GeneratePickup val = PickupDropTable_GeneratePickup; <>O.<0>__PickupDropTable_GeneratePickup = val; obj = (object)val; } PickupDropTable.GeneratePickup += (hook_GeneratePickup)obj; object obj2 = <>O.<1>__PickupDropTable_GenerateDistinctPickups; if (obj2 == null) { hook_GenerateDistinctPickups val2 = PickupDropTable_GenerateDistinctPickups; <>O.<1>__PickupDropTable_GenerateDistinctPickups = val2; obj2 = (object)val2; } PickupDropTable.GenerateDistinctPickups += (hook_GenerateDistinctPickups)obj2; object obj3 = <>O.<2>__PickupDropTable_GenerateDrop; if (obj3 == null) { hook_GenerateDrop val3 = PickupDropTable_GenerateDrop; <>O.<2>__PickupDropTable_GenerateDrop = val3; obj3 = (object)val3; } PickupDropTable.GenerateDrop += (hook_GenerateDrop)obj3; object obj4 = <>O.<3>__PickupDropTable_GenerateUniqueDrops; if (obj4 == null) { hook_GenerateUniqueDrops val4 = PickupDropTable_GenerateUniqueDrops; <>O.<3>__PickupDropTable_GenerateUniqueDrops = val4; obj4 = (object)val4; } PickupDropTable.GenerateUniqueDrops += (hook_GenerateUniqueDrops)obj4; } private static void PickupDropTable_GenerateDistinctPickups(orig_GenerateDistinctPickups orig, PickupDropTable self, List<UniquePickup> dest, int desiredCount, Xoroshiro128Plus rng, bool allowLoop = true) { if (DropTableFallback(self, out var fallbackDropTable)) { fallbackDropTable.GenerateDistinctPickups(dest, desiredCount, rng, allowLoop); } else { orig.Invoke(self, dest, desiredCount, rng, allowLoop); } } private static UniquePickup PickupDropTable_GeneratePickup(orig_GeneratePickup orig, PickupDropTable self, Xoroshiro128Plus rng) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) if (DropTableFallback(self, out var fallbackDropTable)) { return fallbackDropTable.GeneratePickup(rng); } return orig.Invoke(self, rng); } private static PickupIndex[] PickupDropTable_GenerateUniqueDrops(orig_GenerateUniqueDrops orig, PickupDropTable self, int maxDrops, Xoroshiro128Plus rng) { if (DropTableFallback(self, out var fallbackDropTable)) { return fallbackDropTable.GenerateUniqueDrops(maxDrops, rng); } return orig.Invoke(self, maxDrops, rng); } private static PickupIndex PickupDropTable_GenerateDrop(orig_GenerateDrop orig, PickupDropTable self, Xoroshiro128Plus rng) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) if (DropTableFallback(self, out var fallbackDropTable)) { return fallbackDropTable.GenerateDrop(rng); } return orig.Invoke(self, rng); } } public static class MissingExpansionRequirement { [CompilerGenerated] private sealed class <>c__DisplayClass0_0 { public AsyncOperationHandle<GameObject> prefab; public AsyncOperationHandle<ExpansionDef> expansion; internal void <Init>b__2(Stage instance) { SceneDef sceneDef = instance.sceneDef; if (Object.op_Implicit((Object)(object)sceneDef) && Run.instance.AreExpansionInteractablesDisabled(expansion.Result) && sceneDef.cachedName == "computationalexchange") { GameObject val = GameObject.Find("/HOLDER: Interactables/GROUP: Drone Zone/DroneCombinerStation"); if (Object.op_Implicit((Object)(object)val)) { val.SetActive(false); } } } } [CompilerGenerated] private sealed class <Init>d__0 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; private <>c__DisplayClass0_0 <>8__1; private IEnumerable<AsyncOperationHandle<GameObject>> <requests>5__2; private IEnumerator<AsyncOperationHandle<GameObject>> <>7__wrap2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <Init>d__0(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 4) { try { } finally { <>m__Finally1(); } } <>8__1 = null; <requests>5__2 = null; <>7__wrap2 = null; <>1__state = -2; } private bool MoveNext() { //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_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>8__1 = new <>c__DisplayClass0_0(); <>8__1.expansion = Addressables.LoadAssetAsync<ExpansionDef>((object)"RoR2/DLC2/Common/DLC2.asset"); <>8__1.prefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC2/ShrineColossusAccess.prefab"); goto IL_0082; case 1: <>1__state = -1; goto IL_0082; case 2: <>1__state = -1; <>8__1.expansion = Addressables.LoadAssetAsync<ExpansionDef>((object)"RoR2/DLC3/DLC3.asset"); <requests>5__2 = new string[4] { "RoR2/DLC3/DroneCombinerStation/DroneCombinerStation.prefab", "RoR2/DLC3/DroneScrapper/DroneScrapper.prefab", "RoR2/DLC3/TemporaryItemsDistributor/TemporaryItemsShopTerminal.prefab", "RoR2/DLC3/TripleDroneShop/TripleDroneShop.prefab" }.Select((string key) => Addressables.LoadAssetAsync<GameObject>((object)key)); goto IL_013d; case 3: <>1__state = -1; goto IL_013d; case 4: { <>1__state = -3; break; } IL_013d: if (!<>8__1.expansion.IsDone) { <>2__current = null; <>1__state = 3; return true; } <>7__wrap2 = <requests>5__2.GetEnumerator(); <>1__state = -3; break; IL_0082: if (!<>8__1.expansion.IsDone) { <>2__current = null; <>1__state = 1; return true; } <>2__current = add(); <>1__state = 2; return true; } if (<>7__wrap2.MoveNext()) { AsyncOperationHandle<GameObject> current = <>7__wrap2.Current; <>8__1.prefab = current; <>2__current = add(); <>1__state = 4; return true; } <>m__Finally1(); <>7__wrap2 = null; Stage.onServerStageBegin += delegate(Stage instance) { SceneDef sceneDef = instance.sceneDef; if (Object.op_Implicit((Object)(object)sceneDef) && Run.instance.AreExpansionInteractablesDisabled(<>8__1.expansion.Result) && sceneDef.cachedName == "computationalexchange") { GameObject val = GameObject.Find("/HOLDER: Interactables/GROUP: Drone Zone/DroneCombinerStation"); if (Object.op_Implicit((Object)(object)val)) { val.SetActive(false); } } }; return false; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } [IteratorStateMachine(typeof(<>c__DisplayClass0_0.<<Init>g__add|0>d))] IEnumerator add() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <>c__DisplayClass0_0.<<Init>g__add|0>d(0) { <>4__this = this }; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (<>7__wrap2 != null) { <>7__wrap2.Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [IteratorStateMachine(typeof(<Init>d__0))] [SystemInitializer(new Type[] { })] private static IEnumerator Init() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <Init>d__0(0); } } public static class SafeForcedStormItems { [CompilerGenerated] private static class <>O { public static Manipulator <0>__PickupPickerController_GenerateOptionsFromDropTablePlusForcedStorm; } [SystemInitializer(new Type[] { })] private static void Init() { //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_001b: Expected O, but got Unknown object obj = <>O.<0>__PickupPickerController_GenerateOptionsFromDropTablePlusForcedStorm; if (obj == null) { Manipulator val = PickupPickerController_GenerateOptionsFromDropTablePlusForcedStorm; <>O.<0>__PickupPickerController_GenerateOptionsFromDropTablePlusForcedStorm = val; obj = (object)val; } PickupPickerController.GenerateOptionsFromDropTablePlusForcedStorm += (Manipulator)obj; } private static void PickupPickerController_GenerateOptionsFromDropTablePlusForcedStorm(ILContext il) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); int locStormDropsListIndex = -1; int locElementIndex = -1; ILLabel breakLabel = null; MethodReference val2 = default(MethodReference); if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[6] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 2), (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref locStormDropsListIndex), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 3), (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 1), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<PickupDropTable>(x, "GenerateDistinctPickups") }) && val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[4] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, locStormDropsListIndex), (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref locElementIndex), (Instruction x) => ILPatternMatchingExt.MatchCallvirt(x, ref val2), (Instruction x) => ILPatternMatchingExt.MatchStfld<Option>(x, "pickup") }) && val.TryGotoPrev((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchBgt(x, ref breakLabel) })) { val.Emit(OpCodes.Ldloc, locStormDropsListIndex); val.Emit(OpCodes.Ldloc, locElementIndex); val.EmitDelegate<Func<List<UniquePickup>, int, bool>>((Func<List<UniquePickup>, int, bool>)((List<UniquePickup> stormDropsList, int i) => ListUtils.IsInBounds<UniquePickup>(stormDropsList, i))); val.Emit(OpCodes.Brfalse, (object)breakLabel); } else { ExpansionManagerPlugin.Logger.LogError((object)"SafeForcedStormItems: PickupPickerController_GenerateOptionsFromDropTablePlusForcedStorm IL match failed"); } } } } namespace ExpansionManager.ContentBlockers { public static class DirectorBlockers { [CompilerGenerated] private static class <>O { public static Manipulator <0>__DccsPool_AreConditionsMet; public static Manipulator <1>__DCCSBlender_AreConditionsMet; public static Manipulator <2>__DirectorCard_IsAvailable; } [SystemInitializer(new Type[] { })] private static void Init() { //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_001b: Expected O, but got Unknown //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_0050: 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_005b: Expected O, but got Unknown object obj = <>O.<0>__DccsPool_AreConditionsMet; if (obj == null) { Manipulator val = DccsPool_AreConditionsMet; <>O.<0>__DccsPool_AreConditionsMet = val; obj = (object)val; } DccsPool.AreConditionsMet += (Manipulator)obj; object obj2 = <>O.<1>__DCCSBlender_AreConditionsMet; if (obj2 == null) { Manipulator val2 = DCCSBlender_AreConditionsMet; <>O.<1>__DCCSBlender_AreConditionsMet = val2; obj2 = (object)val2; } DCCSBlender.AreConditionsMet += (Manipulator)obj2; object obj3 = <>O.<2>__DirectorCard_IsAvailable; if (obj3 == null) { Manipulator val3 = DirectorCard_IsAvailable; <>O.<2>__DirectorCard_IsAvailable = val3; obj3 = (object)val3; } DirectorCard.IsAvailable += (Manipulator)obj3; } private static void DccsPool_AreConditionsMet(ILContext il) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_0055: 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) ILCursor val = new ILCursor(il); int locExpansionIndex = -1; if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref locExpansionIndex), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Run>(x, "IsExpansionEnabled") })) { val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldloc, locExpansionIndex); val.EmitDelegate<Func<bool, DccsPool, ExpansionDef, bool>>((Func<bool, DccsPool, ExpansionDef, bool>)delegate(bool result, DccsPool dccsPool, ExpansionDef requiredExpansion) { if (result && Object.op_Implicit((Object)(object)ClassicStageInfo.instance)) { if ((Object)(object)dccsPool == (Object)(object)ClassicStageInfo.instance.monsterDccsPool) { return !Run.instance.AreExpansionMonstersDisabled(requiredExpansion); } if ((Object)(object)dccsPool == (Object)(object)ClassicStageInfo.instance.interactableDccsPool) { return !Run.instance.AreExpansionInteractablesDisabled(requiredExpansion); } } return result; }); } else { ExpansionManagerPlugin.Logger.LogError((object)"DirectorBlockers: DccsPool_AreConditionsMet IL match failed"); } } private static void DCCSBlender_AreConditionsMet(ILContext il) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_0055: 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) ILCursor val = new ILCursor(il); int locExpansionIndex = -1; if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref locExpansionIndex), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Run>(x, "IsExpansionEnabled") })) { val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldloc, locExpansionIndex); val.EmitDelegate<Func<bool, PoolEntry, ExpansionDef, bool>>((Func<bool, PoolEntry, ExpansionDef, bool>)delegate(bool result, PoolEntry poolEntry, ExpansionDef requiredExpansion) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (result) { Category[] categories = poolEntry.dccs.categories; for (int i = 0; i < categories.Length; i++) { DirectorCard[] cards = categories[i].cards; for (int j = 0; j < cards.Length; j++) { SpawnCard spawnCard = cards[j].spawnCard; if (spawnCard is CharacterSpawnCard) { return !Run.instance.AreExpansionMonstersDisabled(requiredExpansion); } if (spawnCard is InteractableSpawnCard) { return !Run.instance.AreExpansionInteractablesDisabled(requiredExpansion); } } } } return result; }); } else { ExpansionManagerPlugin.Logger.LogError((object)"DirectorBlockers: DCCSBlender_AreConditionsMet IL match failed"); } } private static void DirectorCard_IsAvailable(ILContext il) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_0077: 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) ILCursor val = new ILCursor(il); int locExpansionRequirementIndex = -1; if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref locExpansionRequirementIndex), (Instruction x) => ILPatternMatchingExt.MatchLdfld<ExpansionRequirementComponent>(x, "requiredExpansion"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Run>(x, "IsExpansionEnabled") })) { val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldloc, locExpansionRequirementIndex); val.EmitDelegate<Func<bool, DirectorCard, ExpansionRequirementComponent, bool>>((Func<bool, DirectorCard, ExpansionRequirementComponent, bool>)delegate(bool result, DirectorCard directorCard, ExpansionRequirementComponent expansionRequirement) { bool flag = result; if (flag) { SpawnCard spawnCard = directorCard.spawnCard; bool flag2 = ((spawnCard is CharacterSpawnCard) ? (!Run.instance.AreExpansionMonstersDisabled(expansionRequirement.requiredExpansion)) : (!(spawnCard is InteractableSpawnCard) || !Run.instance.AreExpansionInteractablesDisabled(expansionRequirement.requiredExpansion))); flag = flag2; } return flag; }); } else { ExpansionManagerPlugin.Logger.LogError((object)"DirectorBlockers: DirectorCard_IsAvailable IL match failed"); } } } public static class EliteBlockers { [CompilerGenerated] private static class <>O { public static hook_IsAvailable <0>__EliteDef_IsAvailable; } [SystemInitializer(new Type[] { })] private static void Init() { //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_001b: Expected O, but got Unknown object obj = <>O.<0>__EliteDef_IsAvailable; if (obj == null) { hook_IsAvailable val = EliteDef_IsAvailable; <>O.<0>__EliteDef_IsAvailable = val; obj = (object)val; } EliteDef.IsAvailable += (hook_IsAvailable)obj; } private static bool EliteDef_IsAvailable(orig_IsAvailable orig, EliteDef self) { if (orig.Invoke(self)) { if (Object.op_Implicit((Object)(object)self.eliteEquipmentDef) && Object.op_Implicit((Object)(object)self.eliteEquipmentDef.requiredExpansion) && Object.op_Implicit((Object)(object)Run.instance)) { return !Run.instance.AreExpansionElitesDisabled(self.eliteEquipmentDef.requiredExpansion); } return true; } return false; } } public static class ItemBlockers { [CompilerGenerated] private static class <>O { public static Action<CharacterBody> <0>__CharacterBody_onBodyAwakeGlobal; public static hook_GenerateWeightedSelection <1>__ExplicitPickupDropTable_GenerateWeightedSelection; public static Manipulator <2>__PreGameController_RecalculateModifierAvailability; public static hook_FilterByEntitlement <3>__CraftableCatalog_FilterByEntitlement; } [SystemInitializer(new Type[] { })] private static void Init() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_0050: 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_005b: Expected O, but got Unknown //IL_0070: 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_007b: Expected O, but got Unknown CharacterBody.onBodyAwakeGlobal += CharacterBody_onBodyAwakeGlobal; object obj = <>O.<1>__ExplicitPickupDropTable_GenerateWeightedSelection; if (obj == null) { hook_GenerateWeightedSelection val = ExplicitPickupDropTable_GenerateWeightedSelection; <>O.<1>__ExplicitPickupDropTable_GenerateWeightedSelection = val; obj = (object)val; } ExplicitPickupDropTable.GenerateWeightedSelection += (hook_GenerateWeightedSelection)obj; object obj2 = <>O.<2>__PreGameController_RecalculateModifierAvailability; if (obj2 == null) { Manipulator val2 = PreGameController_RecalculateModifierAvailability; <>O.<2>__PreGameController_RecalculateModifierAvailability = val2; obj2 = (object)val2; } PreGameController.RecalculateModifierAvailability += (Manipulator)obj2; object obj3 = <>O.<3>__CraftableCatalog_FilterByEntitlement; if (obj3 == null) { hook_FilterByEntitlement val3 = CraftableCatalog_FilterByEntitlement; <>O.<3>__CraftableCatalog_FilterByEntitlement = val3; obj3 = (object)val3; } CraftableCatalog.FilterByEntitlement += (hook_FilterByEntitlement)obj3; } private static void CharacterBody_onBodyAwakeGlobal(CharacterBody body) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Invalid comparison between Unknown and I4 //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Invalid comparison between Unknown and I4 //IL_0073: Unknown result type (might be due to invalid IL or missing references) DeathRewards val = default(DeathRewards); if (!((Component)body).TryGetComponent<DeathRewards>(ref val)) { return; } if (Object.op_Implicit((Object)(object)val.bossDropTable) && val.bossDropTable.GetPickupCount() == 0) { val.bossDropTable = null; } PickupDef pickupDef = PickupCatalog.GetPickupDef((PickupIndex)val.bossPickup); if (pickupDef != null && ((int)pickupDef.itemIndex != -1 || (int)pickupDef.equipmentIndex != -1)) { ExpansionDef requiredExpansion = pickupDef.GetRequiredExpansion(); if (Object.op_Implicit((Object)(object)requiredExpansion) && Run.instance.AreExpansionItemsDisabled(requiredExpansion)) { val.bossPickup = default(SerializablePickupIndex); } } } private static void ExplicitPickupDropTable_GenerateWeightedSelection(orig_GenerateWeightedSelection orig, ExplicitPickupDropTable self) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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_0048: Invalid comparison between Unknown and I4 //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Invalid comparison between Unknown and I4 orig.Invoke(self); if (!Object.op_Implicit((Object)(object)Run.instance)) { return; } for (int num = self.weightedSelection.Count; num >= 0; num--) { PickupDef pickupDef = PickupCatalog.GetPickupDef(self.weightedSelection.GetChoice(num).value.pickupIndex); if (pickupDef != null && ((int)pickupDef.itemIndex != -1 || (int)pickupDef.equipmentIndex != -1) && pickupDef.itemIndex != Items.PowerCube.itemIndex) { ExpansionDef requiredExpansion = pickupDef.GetRequiredExpansion(); if (Object.op_Implicit((Object)(object)requiredExpansion) && Run.instance.AreExpansionItemsDisabled(requiredExpansion)) { self.weightedSelection.RemoveChoice(num); } } } } private static void PreGameController_RecalculateModifierAvailability(ILContext il) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); int locChoiceDefIndex = -1; if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[4] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref locChoiceDefIndex), (Instruction x) => ILPatternMatchingExt.MatchLdfld<RuleChoiceDef>(x, "requiredExpansionDef"), (Instruction x) => ILPatternMatchingExt.MatchLdfld<ExpansionDef>(x, "enabledChoice"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<RuleBook>(x, "IsChoiceActive") })) { val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldloc, locChoiceDefIndex); val.EmitDelegate<Func<bool, PreGameController, RuleChoiceDef, bool>>((Func<bool, PreGameController, RuleChoiceDef, bool>)delegate(bool result, PreGameController preGameController, RuleChoiceDef choiceDef) { return (IsValidItem() || IsValidEquipment()) ? (result && !ExpansionRulesCatalog.IsExpansionContentDisabled(preGameController.readOnlyRuleBook, choiceDef.requiredExpansionDef, ExpansionRulesCatalog.disableExpansionItemsChoices)) : result; bool IsValidEquipment() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Invalid comparison between Unknown and I4 //IL_0016: Unknown result type (might be due to invalid IL or missing references) if ((int)choiceDef.equipmentIndex == -1) { return false; } EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef(choiceDef.equipmentIndex); if (Object.op_Implicit((Object)(object)equipmentDef)) { return !equipmentDef.IsElite(); } return false; } bool IsValidItem() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Invalid comparison between Unknown and I4 return (int)choiceDef.itemIndex != -1; } }); } else { ExpansionManagerPlugin.Logger.LogError((object)"ItemBlockers: PreGameController_RecalculateModifierAvailability IL match failed"); } } private static void CraftableCatalog_FilterByEntitlement(orig_FilterByEntitlement orig, ref RecipeEntry[] source) { //IL_0019: 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_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(ref source); List<RecipeEntry> list = new List<RecipeEntry>(); RecipeEntry[] array = source; foreach (RecipeEntry val in array) { PickupDef pickupDef = PickupCatalog.GetPickupDef(val.result); if (Run.instance.IsPickupAvailable(val.result) || pickupDef.itemIndex == Items.MasterCore.itemIndex || pickupDef.equipmentIndex == Equipment.EliteCollectiveEquipment.equipmentIndex) { list.Add(val); } } source = list.ToArray(); } } public static class StageBlockers { [CompilerGenerated] private static class <>O { public static hook_isValidStage <0>__PortalSpawner_isValidStage; public static Manipulator <1>__BazaarController_SetUpSeerStations; public static hook_CanPickStage <2>__Run_CanPickStage; } [SystemInitializer(new Type[] { })] private static void Init() { //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_001b: Expected O, but got Unknown //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_0050: 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_005b: Expected O, but got Unknown object obj = <>O.<0>__PortalSpawner_isValidStage; if (obj == null) { hook_isValidStage val = PortalSpawner_isValidStage; <>O.<0>__PortalSpawner_isValidStage = val; obj = (object)val; } PortalSpawner.isValidStage += (hook_isValidStage)obj; object obj2 = <>O.<1>__BazaarController_SetUpSeerStations; if (obj2 == null) { Manipulator val2 = BazaarController_SetUpSeerStations; <>O.<1>__BazaarController_SetUpSeerStations = val2; obj2 = (object)val2; } BazaarController.SetUpSeerStations += (Manipulator)obj2; object obj3 = <>O.<2>__Run_CanPickStage; if (obj3 == null) { hook_CanPickStage val3 = Run_CanPickStage; <>O.<2>__Run_CanPickStage = val3; obj3 = (object)val3; } Run.CanPickStage += (hook_CanPickStage)obj3; } private static bool PortalSpawner_isValidStage(orig_isValidStage orig, PortalSpawner self) { if (orig.Invoke(self)) { if (Object.op_Implicit((Object)(object)self.requiredExpansion)) { return !Run.instance.AreExpansionStagesDisabled(self.requiredExpansion); } return true; } return false; } private static void BazaarController_SetUpSeerStations(ILContext il) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_0077: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); int locSceneDefIndex = -1; if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref locSceneDefIndex), (Instruction x) => ILPatternMatchingExt.MatchLdfld<SceneDef>(x, "requiredExpansion"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Run>(x, "IsExpansionEnabled") })) { val.Emit(OpCodes.Ldloc, locSceneDefIndex); val.EmitDelegate<Func<bool, SceneDef, bool>>((Func<bool, SceneDef, bool>)((bool result, SceneDef sceneDef) => result && !Run.instance.AreExpansionStagesDisabled(sceneDef.requiredExpansion))); } else { ExpansionManagerPlugin.Logger.LogError((object)"StageBlockers: BazaarController_SetUpSeerStations IL match failed"); } } private static bool Run_CanPickStage(orig_CanPickStage orig, Run self, SceneDef sceneDef) { if (orig.Invoke(self, sceneDef)) { if (Object.op_Implicit((Object)(object)sceneDef.requiredExpansion)) { return !self.AreExpansionStagesDisabled(sceneDef.requiredExpansion); } return true; } return false; } } }