Some mods may be broken due to the recent Alloyed Collective update.
Decompiled source of Judgement v1.6.1
plugins/Judgement/Judgement.dll
Decompiled a week agousing System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.Linq.Expressions; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using EntityStates.InfiniteTowerSafeWard; using EntityStates.Missions.BrotherEncounter; using HG.Reflection; using HarmonyLib; using IL.RoR2; using Microsoft.CodeAnalysis; using Mono.Cecil; using Mono.Cecil.Cil; using MonoMod.Cil; using MonoMod.Utils; using On.EntityStates.InfiniteTowerSafeWard; using On.EntityStates.Missions.BrotherEncounter; using On.RoR2; using R2API; using R2API.Utils; using RoR2; using RoR2.Artifacts; using RoR2.ContentManagement; using RoR2.ExpansionManagement; using RoR2BepInExPack.GameAssetPathsBetter; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Networking; using UnityEngine.ResourceManagement.AsyncOperations; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: OptIn] [assembly: NetworkCompatibility(/*Could not decode attribute arguments.*/)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Judgement")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+7829641c24e69351d5db8a959da21132f367aff2")] [assembly: AssemblyProduct("Judgement")] [assembly: AssemblyTitle("Judgement")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } public class CheckWavePickups : MonoBehaviour { private List<GameObject> potentialList = new List<GameObject>(); public void AddPickup(GameObject pickup) { potentialList.Add(pickup); } public bool CanStartWave() { bool flag = false; Debug.LogWarning((object)$"PotentialList Count Before {potentialList.Count}"); potentialList.RemoveAll(delegate(GameObject potential) { Debug.LogWarning((object)$"Potential object {potential}"); return ((Object)(object)potential == (Object)null) ? true : false; }); Debug.LogWarning((object)$"PotentialList Count After {potentialList.Count}"); if (potentialList.Count <= 0) { flag = true; } Debug.LogWarning((object)$"Can Start Wave? {flag}"); return flag; } } namespace Judgement { public class CreateGameMode { public static GameObject judgementRunPrefab; public static GameObject extraGameModeMenu; private GameObject simClone = AssetAsyncReferenceManager<GameObject>.LoadAsset(new AssetReferenceT<GameObject>(RoR2_DLC1_GameModes_InfiniteTowerRun.InfiniteTowerRun_prefab), (AsyncReferenceHandleUnloadType)2).WaitForCompletion(); public CreateGameMode() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) CreateJudgementRun(); } private void CreateJudgementRun() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected O, but got Unknown //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) judgementRunPrefab = PrefabAPI.InstantiateClone(new GameObject("JudgementRun"), "JudgementRun"); judgementRunPrefab.AddComponent<NetworkIdentity>(); PrefabAPI.RegisterNetworkPrefab(judgementRunPrefab); InfiniteTowerRun component = simClone.GetComponent<InfiniteTowerRun>(); JudgementRun judgementRun = judgementRunPrefab.AddComponent<JudgementRun>(); ((Run)judgementRun).nameToken = "Judgement"; ((Run)judgementRun).userPickable = true; ((Run)judgementRun).startingSceneGroup = ((Run)component).startingSceneGroup; ((Run)judgementRun).gameOverPrefab = ((Run)component).gameOverPrefab; ((Run)judgementRun).lobbyBackgroundPrefab = ((Run)component).lobbyBackgroundPrefab; ((Run)judgementRun).uiPrefab = ((Run)component).uiPrefab; ((InfiniteTowerRun)judgementRun).defaultWavePrefab = component.defaultWavePrefab; List<WeightedWave> list = new List<WeightedWave>(); List<WeightedWave> list2 = new List<WeightedWave>(); InfiniteTowerWaveCategory[] waveCategories = component.waveCategories; foreach (InfiniteTowerWaveCategory val in waveCategories) { WeightedWave[] wavePrefabs; if (((Object)val).name == "BossWaveCategory") { wavePrefabs = val.wavePrefabs; foreach (WeightedWave val2 in wavePrefabs) { if (!((Object)val2.wavePrefab).name.Contains("Brother") && !((Object)val2.wavePrefab).name.Contains("Lunar") && !((Object)val2.wavePrefab).name.Contains("Void")) { list2.Add(val2); } } continue; } wavePrefabs = val.wavePrefabs; foreach (WeightedWave val3 in wavePrefabs) { if (!((Object)val3.wavePrefab).name.Contains("Command")) { list.Add(val3); } } } InfiniteTowerWaveCategory val4 = ScriptableObject.CreateInstance<InfiniteTowerWaveCategory>(); ((Object)val4).name = "CommonWaveCategoryNux"; val4.wavePrefabs = list.ToArray(); val4.availabilityPeriod = 1; val4.minWaveIndex = 0; InfiniteTowerWaveCategory val5 = ScriptableObject.CreateInstance<InfiniteTowerWaveCategory>(); ((Object)val5).name = "BossWaveCategoryNux"; val5.wavePrefabs = list2.ToArray(); val5.availabilityPeriod = 2; val5.minWaveIndex = 0; InfiniteTowerWaveCategory[] waveCategories2 = (InfiniteTowerWaveCategory[])(object)new InfiniteTowerWaveCategory[2] { val5, val4 }; ((InfiniteTowerRun)judgementRun).waveCategories = waveCategories2; ((InfiniteTowerRun)judgementRun).defaultWaveEnemyIndicatorPrefab = component.defaultWaveEnemyIndicatorPrefab; ((InfiniteTowerRun)judgementRun).enemyItemPattern = component.enemyItemPattern; ((InfiniteTowerRun)judgementRun).enemyItemPeriod = 100; ((InfiniteTowerRun)judgementRun).enemyInventory = judgementRunPrefab.AddComponent<Inventory>(); ((InfiniteTowerRun)judgementRun).stageTransitionPeriod = 2; ((InfiniteTowerRun)judgementRun).stageTransitionPortalCard = component.stageTransitionPortalCard; ((InfiniteTowerRun)judgementRun).stageTransitionPortalMaxDistance = component.stageTransitionPortalMaxDistance; ((InfiniteTowerRun)judgementRun).stageTransitionChatToken = component.stageTransitionChatToken; ((InfiniteTowerRun)judgementRun).fogDamagePrefab = component.fogDamagePrefab; ((InfiniteTowerRun)judgementRun).spawnMaxRadius = component.spawnMaxRadius; ((InfiniteTowerRun)judgementRun).initialSafeWardCard = component.initialSafeWardCard; ((InfiniteTowerRun)judgementRun).safeWardCard = component.safeWardCard; ((InfiniteTowerRun)judgementRun).playerRespawnEffectPrefab = component.playerRespawnEffectPrefab; ((InfiniteTowerRun)judgementRun).interactableCredits = 0; ((InfiniteTowerRun)judgementRun).blacklistedTags = component.blacklistedTags; ((InfiniteTowerRun)judgementRun).blacklistedItems = component.blacklistedItems; judgementRunPrefab.AddComponent<TeamManager>(); judgementRunPrefab.AddComponent<NetworkRuleBook>(); judgementRunPrefab.AddComponent<TeamFilter>(); judgementRunPrefab.AddComponent<EnemyInfoPanelInventoryProvider>(); judgementRunPrefab.AddComponent<DirectorCore>(); judgementRunPrefab.AddComponent<ExpansionRequirementComponent>(); judgementRunPrefab.AddComponent<RunCameraManager>(); ContentAddition.AddGameMode(judgementRunPrefab, "Defeat all that stand before you to reach the final throne."); } } public class EntityStateHooks { public EntityStateHooks() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown AwaitingActivation.OnEnter += new hook_OnEnter(ChangeBaseWardRadius); Active.OnEnter += new hook_OnEnter(ChangeActiveWardRadius); } private void ChangeBaseWardRadius(orig_OnEnter orig, AwaitingActivation self) { if (Object.op_Implicit((Object)(object)Run.instance) && ((Object)Run.instance).name.Contains("Judgement") && self.radius != 30f) { self.radius = 30f; } orig.Invoke(self); } private void ChangeActiveWardRadius(orig_OnEnter orig, Active self) { if (Object.op_Implicit((Object)(object)Run.instance) && ((Object)Run.instance).name.Contains("Judgement")) { self.radius = 75f; } orig.Invoke(self); } } public class RunHooks { private BasicPickupDropTable dtEquip; private BasicPickupDropTable dtWhite; private BasicPickupDropTable dtGreen; private BasicPickupDropTable dtRed; private BasicPickupDropTable dtYellow; private GameObject potentialPickup; private GameObject shrineUseEffect; private SceneDef voidPlains; private SceneDef voidAqueduct; private SceneDef voidAphelian; private SceneDef voidRPD; private SceneDef voidAbyssal; private SceneDef voidMeadow; private GameEndingDef judgementRunEnding; private GameObject tpOutController; public RunHooks() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown //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_003f: Expected O, but got Unknown //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Expected O, but got Unknown LoadAssets(); SceneDirector.PopulateScene += new Manipulator(RemoveExtraLoot); PurchaseInteraction.OnInteractionBegin += new hook_OnInteractionBegin(PreventPrinterCheese); Run.PickNextStageScene += new hook_PickNextStageScene(SetFirstStage); CharacterMaster.OnBodyStart += new hook_OnBodyStart(CreateDropletsOnStart); MusicController.PickCurrentTrack += new hook_PickCurrentTrack(SetJudgementMusic); BossDeath.OnEnter += new hook_OnEnter(EndRun); CharacterBody.Start += new hook_Start(ManageSurvivorStats); SceneExitController.Begin += new hook_Begin(ManageStageSelection); } private void TrackPotentials(orig_CreatePickupDroplet_CreatePickupInfo_Vector3_Vector3 orig, CreatePickupInfo pickupInfo, Vector3 position, Vector3 velocity) { //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_0089: 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_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: 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) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)Run.instance) && ((Object)Run.instance).name.Contains("Judgement")) { JudgementRun component = ((Component)Run.instance).gameObject.GetComponent<JudgementRun>(); if (Object.op_Implicit((Object)(object)((InfiniteTowerRun)component).safeWardController)) { CheckWavePickups component2 = ((Component)((InfiniteTowerRun)component).safeWardController).gameObject.GetComponent<CheckWavePickups>(); Debug.LogWarning((object)$"Pickup Checker? {component2}"); if (Object.op_Implicit((Object)(object)component2)) { if (CommandArtifactManager.IsCommandArtifactEnabled) { ref PickupArtifactFlag artifactFlag = ref pickupInfo.artifactFlag; artifactFlag = (PickupArtifactFlag)((uint)artifactFlag | 1u); } GameObject val = Object.Instantiate<GameObject>(PickupDropletController.pickupDropletPrefab, position, Quaternion.identity); PickupDropletController component3 = val.GetComponent<PickupDropletController>(); if (Object.op_Implicit((Object)(object)component3)) { component3.createPickupInfo = pickupInfo; } Rigidbody component4 = val.GetComponent<Rigidbody>(); component4.velocity = velocity; component4.AddTorque(Random.Range(150f, 120f) * Random.onUnitSphere); component2.AddPickup(val); Debug.LogWarning((object)"Added Pickup"); NetworkServer.Spawn(val); } else { orig.Invoke(pickupInfo, position, velocity); } } else { orig.Invoke(pickupInfo, position, velocity); } } else { orig.Invoke(pickupInfo, position, velocity); } } private void PreventPrinterCheese(orig_OnInteractionBegin orig, PurchaseInteraction self, Interactor activator) { //IL_003f: 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_005a: Expected O, but got Unknown //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0082: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Expected O, but got Unknown JudgementRun component = ((Component)Run.instance).gameObject.GetComponent<JudgementRun>(); if (Object.op_Implicit((Object)(object)component)) { if (((Object)self).name == "JudgementHealShrine") { if (!component.healShrineUsed) { string text = "0 heals left."; Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage { baseToken = "You have " + text }); HealthComponent healthComponent = ((Component)activator).GetComponent<CharacterBody>().healthComponent; healthComponent.health = healthComponent.fullHealth; EffectManager.SpawnEffect(shrineUseEffect, new EffectData { origin = ((Component)self).transform.position, rotation = Quaternion.identity, scale = 1f, color = Color32.op_Implicit(Color.green) }, true); component.healShrineUsed = true; self.available = false; } } else if (((Object)self).name == "DuplicatorLarge(Clone)") { if (((Component)activator).GetComponent<CharacterBody>().inventory.GetItemCountPermanent(Items.RegeneratingScrap) != 0) { orig.Invoke(self, activator); } } else { orig.Invoke(self, activator); } } else { orig.Invoke(self, activator); } } private void SetFirstStage(orig_PickNextStageScene orig, Run self, WeightedSelection<SceneDef> choices) { if (Run.instance.stageClearCount == 0 && ((Object)self).name.Contains("Judgement")) { if (((InfiniteTowerRun)((Component)Run.instance).gameObject.GetComponent<JudgementRun>()).waveIndex == 0) { SceneDef nextStageScene = SceneCatalog.FindSceneDef("itgolemplains"); self.nextStageScene = nextStageScene; } } else { orig.Invoke(self, choices); } } public void SavePersistentHP() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0077: 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) JudgementRun component = ((Component)Run.instance).gameObject.GetComponent<JudgementRun>(); foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances) { if (component.persistentHP.TryGetValue(((NetworkBehaviour)instance.master).netId, out var _)) { component.persistentHP[((NetworkBehaviour)instance.master).netId] = instance.master.GetBody().healthComponent.health; } else { component.persistentHP.Add(((NetworkBehaviour)instance.master).netId, instance.master.GetBody().healthComponent.health); } } } public void LoadPersistentHP(CharacterBody body) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) JudgementRun component = ((Component)Run.instance).gameObject.GetComponent<JudgementRun>(); if (Object.op_Implicit((Object)(object)body.master) && Object.op_Implicit((Object)(object)body.healthComponent) && component.persistentHP.TryGetValue(((NetworkBehaviour)body.master).netId, out var value)) { body.healthComponent.health = value; } } private void RemoveExtraLoot(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)0, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "TreasureCache") })) { val.Index += 2; val.EmitDelegate<Func<int, int>>((Func<int, int>)((int count) => ItemFunction(count))); } else { Log.Error("Judgement: TreasureCache IL hook failed", "C:\\Users\\romym\\OneDrive\\Desktop\\RoR2Mods\\Judgement2\\Judgement\\Hooks\\RunHooks.cs", "RemoveExtraLoot", 188); } val.Index = 0; if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "TreasureCacheVoid") })) { val.Index += 2; val.EmitDelegate<Func<int, int>>((Func<int, int>)((int count) => ItemFunction(count))); } else { Log.Error("Judgement: TreasureCacheVoid IL hook failed", "C:\\Users\\romym\\OneDrive\\Desktop\\RoR2Mods\\Judgement2\\Judgement\\Hooks\\RunHooks.cs", "RemoveExtraLoot", 198); } val.Index = 0; if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "FreeChest") })) { val.Index += 2; val.EmitDelegate<Func<int, int>>((Func<int, int>)((int count) => ItemFunction(count))); } else { Log.Error("Judgement: FreeChest IL hook failed", "C:\\Users\\romym\\OneDrive\\Desktop\\RoR2Mods\\Judgement2\\Judgement\\Hooks\\RunHooks.cs", "RemoveExtraLoot", 208); } static int ItemFunction(int itemCount) { if (Object.op_Implicit((Object)(object)Run.instance) && ((Object)Run.instance).name.Contains("Judgement")) { return 0; } return itemCount; } } private void CreateDropletsOnStart(orig_OnBodyStart orig, CharacterMaster self, CharacterBody body) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Invalid comparison between Unknown and I4 //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Invalid comparison between Unknown and I4 //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0183: 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) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: 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) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_03ad: Unknown result type (might be due to invalid IL or missing references) //IL_03cd: Unknown result type (might be due to invalid IL or missing references) //IL_032b: Unknown result type (might be due to invalid IL or missing references) //IL_034b: Unknown result type (might be due to invalid IL or missing references) //IL_036c: Unknown result type (might be due to invalid IL or missing references) //IL_038c: Unknown result type (might be due to invalid IL or missing references) CharacterBody body2 = body; orig.Invoke(self, body2); PlayerCharacterMasterController component = ((Component)self).GetComponent<PlayerCharacterMasterController>(); if (!Object.op_Implicit((Object)(object)Run.instance) || !((Object)Run.instance).name.Contains("Judgement")) { return; } Scene activeScene = SceneManager.GetActiveScene(); string name = ((Scene)(ref activeScene)).name; JudgementRun component2 = ((Component)Run.instance).gameObject.GetComponent<JudgementRun>(); if ((int)Run.instance.selectedDifficulty > 3 && Object.op_Implicit((Object)(object)body2.teamComponent) && (int)body2.teamComponent.teamIndex == 1 && (!body2.HasBuff(Buffs.Immune) || ((InfiniteTowerRun)component2).waveIndex == 0)) { HealthComponent healthComponent = body2.healthComponent; if (Object.op_Implicit((Object)(object)healthComponent)) { healthComponent.Networkhealth = healthComponent.fullHealth; } } if (!Object.op_Implicit((Object)(object)component)) { return; } if (name == "moon2" && !body2.HasBuff(Buffs.Immune)) { Vector3 val = new Vector3(127f, 500f, 101f); float num = Random.Range(0f, 360f); float num2 = 5f * Mathf.Sqrt(Random.Range(0f, 1f)); Vector3 val2 = val + new Vector3(num2 * Mathf.Cos(num * (MathF.PI / 180f)), 0f, num2 * Mathf.Sin(num * (MathF.PI / 180f))); TeleportHelper.TeleportBody(body2, val2, false); } Vector3 velocity; Quaternion quaternion; if (NetworkServer.active && name != "moon2" && !body2.HasBuff(Buffs.Immune)) { double num3 = 72.0; velocity = Vector3.up * 10f + Vector3.forward * 2f; Vector3 up = Vector3.up; quaternion = Quaternion.AngleAxis((float)num3, up); CreateDrop(PickupCatalog.FindPickupIndex((ItemTier)0), dtWhite, Run.instance.runRNG); CreateDrop(PickupCatalog.FindPickupIndex((ItemTier)0), dtWhite, Run.instance.runRNG); CreateDrop(PickupCatalog.FindPickupIndex((ItemTier)0), dtWhite, Run.instance.runRNG); switch (((InfiniteTowerRun)component2).waveIndex) { case 0: CreateDrop(PickupCatalog.FindPickupIndex((ItemTier)1), dtGreen, Run.instance.runRNG); CreateDrop(PickupCatalog.FindPickupIndex(EquipmentCatalog.FindEquipmentIndex("LifestealOnHit")), dtEquip, Run.instance.runRNG); break; case 4: CreateDrop(PickupCatalog.FindPickupIndex((ItemTier)2), dtRed, Run.instance.runRNG); CreateDrop(PickupCatalog.FindPickupIndex(EquipmentCatalog.FindEquipmentIndex("LifestealOnHit")), dtEquip, Run.instance.runRNG); break; case 6: CreateDrop(PickupCatalog.FindPickupIndex((ItemTier)1), dtGreen, Run.instance.runRNG); CreateDrop(PickupCatalog.FindPickupIndex((ItemTier)4), dtYellow, Run.instance.runRNG); break; case 8: CreateDrop(PickupCatalog.FindPickupIndex((ItemTier)2), dtRed, Run.instance.runRNG); CreateDrop(PickupCatalog.FindPickupIndex((ItemTier)1), dtGreen, Run.instance.runRNG); break; default: CreateDrop(PickupCatalog.FindPickupIndex((ItemTier)1), dtGreen, Run.instance.runRNG); CreateDrop(PickupCatalog.FindPickupIndex((ItemTier)1), dtGreen, Run.instance.runRNG); break; } } void CreateDrop(PickupIndex pickupIndex, BasicPickupDropTable dropTable, Xoroshiro128Plus rng) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0054: 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_005c: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) CreatePickupInfo val3 = default(CreatePickupInfo); ((CreatePickupInfo)(ref val3)).pickupIndex = pickupIndex; val3.position = body2.corePosition + Vector3.up * 1.5f; val3.pickerOptions = PickupPickerController.GenerateOptionsFromDropTable(3, (PickupDropTable)(object)dropTable, rng); val3.prefabOverride = potentialPickup; CreatePickupInfo val4 = val3; PickupDropletController.CreatePickupDroplet(val4, val4.position, velocity); velocity = quaternion * velocity; } } private static void SetJudgementMusic(orig_PickCurrentTrack orig, MusicController self, ref MusicTrackDef newTrack) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, ref newTrack); if (Object.op_Implicit((Object)(object)Run.instance) && ((Object)Run.instance).name.Contains("Judgement")) { Scene activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name != "moon2") { newTrack = MusicTrackCatalog.FindMusicTrackDef("muSong23"); } } } private void ManageStageSelection(orig_Begin orig, SceneExitController self) { //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: 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_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)Run.instance) && ((Object)Run.instance).name.Contains("Judgement")) { JudgementRun component = ((Component)Run.instance).gameObject.GetComponent<JudgementRun>(); Debug.LogWarning((object)$"Managing Stage Selection for wave {((InfiniteTowerRun)component).waveIndex}"); if (NetworkServer.active) { SavePersistentHP(); } if (((InfiniteTowerRun)component).waveIndex == 0) { self.destinationScene = voidPlains; } if (((InfiniteTowerRun)component).waveIndex == 2) { int[] array = Array.Empty<int>(); WeightedSelection<SceneDef> obj = new WeightedSelection<SceneDef>(8); obj.AddChoice(voidAqueduct, 1f); obj.AddChoice(voidAphelian, 1f); int num = obj.EvaluateToChoiceIndex(Run.instance.runRNG.nextNormalizedFloat, array); self.destinationScene = obj.GetChoice(num).value; } if (((InfiniteTowerRun)component).waveIndex == 4) { self.destinationScene = voidRPD; } if (((InfiniteTowerRun)component).waveIndex == 6) { self.destinationScene = voidAbyssal; } if (((InfiniteTowerRun)component).waveIndex == 8) { self.destinationScene = voidMeadow; } if (((InfiniteTowerRun)component).waveIndex == 10) { SceneDef destinationScene = SceneCatalog.FindSceneDef("moon2"); self.destinationScene = destinationScene; } Debug.LogWarning((object)("Next Stage set to " + self.destinationScene.nameToken)); ReadOnlyCollection<CharacterMaster> readOnlyInstancesList = CharacterMaster.readOnlyInstancesList; for (int i = 0; i < readOnlyInstancesList.Count; i++) { CharacterMaster component2 = ((Component)readOnlyInstancesList[i]).GetComponent<CharacterMaster>(); if (Object.op_Implicit((Object)(object)((Component)component2).GetComponent<SetDontDestroyOnLoad>())) { GameObject bodyObject = component2.GetBodyObject(); if (Object.op_Implicit((Object)(object)bodyObject)) { GameObject obj2 = Object.Instantiate<GameObject>(tpOutController, bodyObject.transform.position, Quaternion.identity); obj2.GetComponent<TeleportOutController>().Networktarget = bodyObject; NetworkServer.Spawn(obj2); } } } if (!SceneExitController.isRunning) { self.BeginStagePreload(); } self.SetState((ExitState)3); } else { orig.Invoke(self); } } private void ManageSurvivorStats(orig_Start orig, CharacterBody self) { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Invalid comparison between Unknown and I4 orig.Invoke(self); if (Object.op_Implicit((Object)(object)Run.instance) && ((Object)Run.instance).name.Contains("Judgement") && self.isPlayerControlled && !self.HasBuff(Buffs.Immune)) { JudgementRun component = ((Component)Run.instance).gameObject.GetComponent<JudgementRun>(); if (NetworkServer.active) { LoadPersistentHP(self); } if ((int)Run.instance.selectedDifficulty >= 3 && ((InfiniteTowerRun)component).waveIndex == 0) { self.healthComponent.health = self.healthComponent.fullHealth; } } } private void EndRun(orig_OnEnter orig, BossDeath self) { orig.Invoke(self); if (Object.op_Implicit((Object)(object)Run.instance) && ((Object)Run.instance).name.Contains("Judgement")) { Run.instance.BeginGameOver(judgementRunEnding); } } private void LoadAssets() { //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_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) AssetReferenceT<BasicPickupDropTable> obj = new AssetReferenceT<BasicPickupDropTable>(RoR2_Base_Common.dtEquipment_asset); AssetReferenceT<BasicPickupDropTable> val = new AssetReferenceT<BasicPickupDropTable>(RoR2_Base_Common.dtTier1Item_asset); AssetReferenceT<BasicPickupDropTable> val2 = new AssetReferenceT<BasicPickupDropTable>(RoR2_Base_Common.dtTier2Item_asset); AssetReferenceT<BasicPickupDropTable> val3 = new AssetReferenceT<BasicPickupDropTable>(RoR2_Base_Common.dtTier3Item_asset); AssetReferenceT<BasicPickupDropTable> val4 = new AssetReferenceT<BasicPickupDropTable>(RoR2_Base_DuplicatorWild.dtDuplicatorWild_asset); AssetReferenceT<GameObject> val5 = new AssetReferenceT<GameObject>(RoR2_DLC1_OptionPickup.OptionPickup_prefab); AssetReferenceT<GameObject> val6 = new AssetReferenceT<GameObject>(RoR2_Base_Common.TeleportOutController_prefab); AssetReferenceT<GameObject> val7 = new AssetReferenceT<GameObject>(RoR2_Base_Common_VFX.ShrineUseEffect_prefab); AssetReferenceT<SceneDef> val8 = new AssetReferenceT<SceneDef>(RoR2_DLC1_itgolemplains.itgolemplains_asset); AssetReferenceT<SceneDef> val9 = new AssetReferenceT<SceneDef>(RoR2_DLC1_itgoolake.itgoolake_asset); AssetReferenceT<SceneDef> val10 = new AssetReferenceT<SceneDef>(RoR2_DLC1_itancientloft.itancientloft_asset); AssetReferenceT<SceneDef> val11 = new AssetReferenceT<SceneDef>(RoR2_DLC1_itfrozenwall.itfrozenwall_asset); AssetReferenceT<SceneDef> val12 = new AssetReferenceT<SceneDef>(RoR2_DLC1_itdampcave.itdampcave_asset); AssetReferenceT<SceneDef> val13 = new AssetReferenceT<SceneDef>(RoR2_DLC1_itskymeadow.itskymeadow_asset); AssetReferenceT<GameEndingDef> val14 = new AssetReferenceT<GameEndingDef>(RoR2_Base_WeeklyRun.PrismaticTrialEnding_asset); AsyncOperationHandle<BasicPickupDropTable> val15 = AssetAsyncReferenceManager<BasicPickupDropTable>.LoadAsset(obj, (AsyncReferenceHandleUnloadType)2); val15.Completed += delegate(AsyncOperationHandle<BasicPickupDropTable> x) { dtEquip = x.Result; }; val15 = AssetAsyncReferenceManager<BasicPickupDropTable>.LoadAsset(val, (AsyncReferenceHandleUnloadType)2); val15.Completed += delegate(AsyncOperationHandle<BasicPickupDropTable> x) { dtWhite = x.Result; }; val15 = AssetAsyncReferenceManager<BasicPickupDropTable>.LoadAsset(val2, (AsyncReferenceHandleUnloadType)2); val15.Completed += delegate(AsyncOperationHandle<BasicPickupDropTable> x) { dtGreen = x.Result; }; val15 = AssetAsyncReferenceManager<BasicPickupDropTable>.LoadAsset(val3, (AsyncReferenceHandleUnloadType)2); val15.Completed += delegate(AsyncOperationHandle<BasicPickupDropTable> x) { dtRed = x.Result; }; val15 = AssetAsyncReferenceManager<BasicPickupDropTable>.LoadAsset(val4, (AsyncReferenceHandleUnloadType)2); val15.Completed += delegate(AsyncOperationHandle<BasicPickupDropTable> x) { dtYellow = x.Result; }; AsyncOperationHandle<GameObject> val16 = AssetAsyncReferenceManager<GameObject>.LoadAsset(val5, (AsyncReferenceHandleUnloadType)2); val16.Completed += delegate(AsyncOperationHandle<GameObject> x) { potentialPickup = x.Result; }; val16 = AssetAsyncReferenceManager<GameObject>.LoadAsset(val6, (AsyncReferenceHandleUnloadType)2); val16.Completed += delegate(AsyncOperationHandle<GameObject> x) { tpOutController = x.Result; }; val16 = AssetAsyncReferenceManager<GameObject>.LoadAsset(val7, (AsyncReferenceHandleUnloadType)2); val16.Completed += delegate(AsyncOperationHandle<GameObject> x) { shrineUseEffect = x.Result; }; AsyncOperationHandle<SceneDef> val17 = AssetAsyncReferenceManager<SceneDef>.LoadAsset(val8, (AsyncReferenceHandleUnloadType)2); val17.Completed += delegate(AsyncOperationHandle<SceneDef> x) { voidPlains = x.Result; }; val17 = AssetAsyncReferenceManager<SceneDef>.LoadAsset(val9, (AsyncReferenceHandleUnloadType)2); val17.Completed += delegate(AsyncOperationHandle<SceneDef> x) { voidAqueduct = x.Result; }; val17 = AssetAsyncReferenceManager<SceneDef>.LoadAsset(val10, (AsyncReferenceHandleUnloadType)2); val17.Completed += delegate(AsyncOperationHandle<SceneDef> x) { voidAphelian = x.Result; }; val17 = AssetAsyncReferenceManager<SceneDef>.LoadAsset(val11, (AsyncReferenceHandleUnloadType)2); val17.Completed += delegate(AsyncOperationHandle<SceneDef> x) { voidRPD = x.Result; }; val17 = AssetAsyncReferenceManager<SceneDef>.LoadAsset(val12, (AsyncReferenceHandleUnloadType)2); val17.Completed += delegate(AsyncOperationHandle<SceneDef> x) { voidAbyssal = x.Result; }; val17 = AssetAsyncReferenceManager<SceneDef>.LoadAsset(val13, (AsyncReferenceHandleUnloadType)2); val17.Completed += delegate(AsyncOperationHandle<SceneDef> x) { voidMeadow = x.Result; }; AsyncOperationHandle<GameEndingDef> val18 = AssetAsyncReferenceManager<GameEndingDef>.LoadAsset(val14, (AsyncReferenceHandleUnloadType)2); val18.Completed += delegate(AsyncOperationHandle<GameEndingDef> x) { judgementRunEnding = x.Result; }; } } public class SimulacrumHooks { private SpawnCard lockBox; private SpawnCard lockBoxVoid; private SpawnCard freeChest; private SpawnCard greenPrinter; private SpawnCard voidChest; private GameObject healShrine; public SimulacrumHooks() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown //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_003f: Expected O, but got Unknown //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown LoadAssets(); InfiniteTowerRun.OverrideRuleChoices += new hook_OverrideRuleChoices(BlacklistItems); InfiniteTowerRun.SpawnSafeWard += new hook_SpawnSafeWard(SetupInteractables); InfiniteTowerRun.MoveSafeWard += new hook_MoveSafeWard(PreventCrabMovement); InfiniteTowerRun.RecalculateDifficultyCoefficentInternal += new hook_RecalculateDifficultyCoefficentInternal(IncreaseScaling); InfiniteTowerWaveController.DropRewards += new hook_DropRewards(PreventCrabDrops); InfiniteTowerWaveController.OnEnable += new hook_OnEnable(ManageWaveCredits); InfiniteTowerBossWaveController.PreStartClient += new hook_PreStartClient(GuaranteeBoss); } private void BlacklistItems(orig_OverrideRuleChoices orig, InfiniteTowerRun self, RuleChoiceMask mustInclude, RuleChoiceMask mustExclude, ulong runSeed) { //IL_0014: 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) if (Object.op_Implicit((Object)(object)PreGameController.instance) && PreGameController.instance.gameModeIndex == GameModeCatalog.FindGameModeIndex("JudgementRun")) { string[] array = new string[8] { "ExtraLife", "ExtraLifeVoid", "Dagger", "ShockNearby", "IgniteOnKill", "ExplodeOnDeathVoid", "ExtraShrineItem", "LowerPricedChests" }; string[] array2 = new string[2] { "HealAndRevive", "Scanner" }; string[] array3 = array; foreach (string text in array3) { RuleDef obj = RuleCatalog.FindRuleDef("Items." + text); RuleChoiceDef val = ((obj != null) ? obj.FindChoice("Off") : null); if (val != null) { ((Run)self).ForceChoice(mustInclude, mustExclude, val); } } array3 = array2; foreach (string text2 in array3) { RuleDef obj2 = RuleCatalog.FindRuleDef("Equipment." + text2); RuleChoiceDef val2 = ((obj2 != null) ? obj2.FindChoice("Off") : null); if (val2 != null) { ((Run)self).ForceChoice(mustInclude, mustExclude, val2); } } } else { orig.Invoke(self, mustInclude, mustExclude, runSeed); } } private void ManageWaveCredits(orig_OnEnable orig, InfiniteTowerWaveController self) { if (Object.op_Implicit((Object)(object)Run.instance) && ((Object)Run.instance).name.Contains("Judgement")) { if (self is InfiniteTowerBossWaveController) { self.baseCredits = 350f; } else { self.baseCredits = 225f; } } orig.Invoke(self); } private void PreventCrabMovement(orig_MoveSafeWard orig, InfiniteTowerRun self) { if (!Object.op_Implicit((Object)(object)Run.instance) || !((Object)Run.instance).name.Contains("Judgement")) { orig.Invoke(self); } } private void PreventCrabDrops(orig_DropRewards orig, InfiniteTowerWaveController self) { if (!Object.op_Implicit((Object)(object)Run.instance) || !((Object)Run.instance).name.Contains("Judgement")) { orig.Invoke(self); } } private void GuaranteeBoss(orig_PreStartClient orig, InfiniteTowerBossWaveController self) { if (Object.op_Implicit((Object)(object)Run.instance) && ((Object)Run.instance).name.Contains("Judgement")) { self.guaranteeInitialChampion = true; } orig.Invoke(self); } private void IncreaseScaling(orig_RecalculateDifficultyCoefficentInternal orig, InfiniteTowerRun self) { if (Object.op_Implicit((Object)(object)Run.instance) && ((Object)Run.instance).name.Contains("Judgement")) { DifficultyDef difficultyDef = DifficultyCatalog.GetDifficultyDef((DifficultyIndex)2); float num = 1.5f * (float)self.waveIndex; float num2 = 0.0506f * (difficultyDef.scalingValue * 2f); float num3 = Mathf.Pow(1.02f, (float)self.waveIndex); ((Run)self).difficultyCoefficient = (float)(1.0 + (double)num2 * (double)num) * num3; ((Run)self).compensatedDifficultyCoefficient = ((Run)self).difficultyCoefficient; ((Run)self).ambientLevel = Mathf.Min((float)(((double)((Run)self).difficultyCoefficient - 1.0) / 0.33000001311302185 + 1.0), 9999f); int ambientLevelFloor = ((Run)self).ambientLevelFloor; ((Run)self).ambientLevelFloor = Mathf.FloorToInt(((Run)self).ambientLevel); if (ambientLevelFloor != ((Run)self).ambientLevelFloor && ambientLevelFloor != 0 && ((Run)self).ambientLevelFloor > ambientLevelFloor) { ((Run)self).OnAmbientLevelUp(); } } else { orig.Invoke(self); } } private void SetupInteractables(orig_SpawnSafeWard orig, InfiniteTowerRun self, InteractableSpawnCard spawnCard, DirectorPlacementRule placementRule) { //IL_003f: 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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Expected O, but got Unknown //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Expected O, but got Unknown //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_0324: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)Run.instance) && ((Object)Run.instance).name.Contains("Judgement")) { JudgementRun component = ((Component)Run.instance).gameObject.GetComponent<JudgementRun>(); component.healShrineUsed = false; Scene activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name == "moon2") { GameObject val = GameObject.Find("Director"); if (Object.op_Implicit((Object)(object)val) && NetworkServer.active) { Object.Destroy((Object)(object)((Component)self.fogDamageController).gameObject); CombatDirector[] components = val.GetComponents<CombatDirector>(); for (int i = 0; i < components.Length; i++) { Object.Destroy((Object)(object)components[i]); } } return; } GameObject val2 = DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest((SpawnCard)(object)spawnCard, placementRule, self.safeWardRng)); if (!Object.op_Implicit((Object)(object)val2)) { return; } NetworkServer.Spawn(val2); self.safeWardController = val2.GetComponent<InfiniteTowerSafeWardController>(); if (Object.op_Implicit((Object)(object)self.safeWardController)) { self.safeWardController.onActivated += self.OnSafeWardActivated; } HoldoutZoneController component2 = val2.GetComponent<HoldoutZoneController>(); if (Object.op_Implicit((Object)(object)component2)) { component2.calcAccumulatedCharge += new CalcAccumulatedChargeDelegate(self.CalcHoldoutZoneCharge); } if (!Object.op_Implicit((Object)(object)self.fogDamageController)) { return; } self.fogDamageController.AddSafeZone(self.safeWardController.safeZone); if (!NetworkServer.active) { return; } Vector3 position = ((Component)self.safeWardController).transform.position; GameObject obj = Object.Instantiate<GameObject>(healShrine, new Vector3(2f, 0f, 0f) + position, Quaternion.identity); ((Object)obj).name = "JudgementHealShrine"; obj.GetComponent<PurchaseInteraction>().costType = (CostTypeIndex)0; obj.GetComponent<PurchaseInteraction>().Networkcost = 0; obj.GetComponent<PurchaseInteraction>().Networkavailable = true; obj.GetComponent<PurchaseInteraction>().contextToken = "Single-Use Full Heal Shrine"; obj.GetComponent<PurchaseInteraction>().displayNameToken = "Single-Use Full Heal Shrine"; NetworkServer.Spawn(obj); if (((InfiniteTowerRun)component).waveIndex == 4 || ((InfiniteTowerRun)component).waveIndex == 8) { for (int j = 0; j < Run.instance.participatingPlayerCount; j++) { SpawnInteractable(voidChest, position, isFree: false); } } foreach (CharacterMaster readOnlyInstances in CharacterMaster.readOnlyInstancesList) { if (readOnlyInstances.inventory.GetItemCountPermanent(Items.RegeneratingScrap) > 0) { SpawnInteractable(greenPrinter, position, isFree: false); break; } } for (int k = 0; k < CharacterMaster.readOnlyInstancesList.Count; k++) { if (CharacterMaster.readOnlyInstancesList[k].inventory.GetItemCountPermanent(Items.TreasureCache) > 0) { SpawnInteractable(lockBox, position, isFree: false); } } for (int l = 0; l < CharacterMaster.readOnlyInstancesList.Count; l++) { if (CharacterMaster.readOnlyInstancesList[l].inventory.GetItemCountPermanent(Items.TreasureCacheVoid) > 0) { SpawnInteractable(lockBoxVoid, position, isFree: false); } } for (int m = 0; m < CharacterMaster.readOnlyInstancesList.Count; m++) { if (CharacterMaster.readOnlyInstancesList[m].inventory.GetItemCountPermanent(Items.FreeChest) > 0) { SpawnInteractable(freeChest, position, isFree: false); } } } else { orig.Invoke(self, spawnCard, placementRule); } } private void SpawnInteractable(SpawnCard spawnCard, Vector3 position, bool isFree = true) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown DirectorCore instance = DirectorCore.instance; DirectorPlacementRule val = new DirectorPlacementRule(); val.placementMode = (PlacementMode)1; val.position = position; val.minDistance = 2f; val.maxDistance = 30f; DirectorSpawnRequest val2 = new DirectorSpawnRequest(spawnCard, val, Run.instance.runRNG); GameObject val3 = instance.TrySpawnObject(val2); if (!Object.op_Implicit((Object)(object)val3)) { Log.Error("Judgement: Failed to spawn pre-wave interactable " + ((Object)spawnCard).name + ".", "C:\\Users\\romym\\OneDrive\\Desktop\\RoR2Mods\\Judgement2\\Judgement\\Hooks\\SimulacrumHooks.cs", "SpawnInteractable", 241); } if (isFree) { SetPurchaseCostFree(val3); } } private void SetPurchaseCostFree(GameObject chest) { PurchaseInteraction component = chest.GetComponent<PurchaseInteraction>(); if (Object.op_Implicit((Object)(object)component)) { component.cost = 0; component.Networkcost = 0; } else { Log.Error("Judgement: Failed to set " + ((Object)chest).name + " cost to free.", "C:\\Users\\romym\\OneDrive\\Desktop\\RoR2Mods\\Judgement2\\Judgement\\Hooks\\SimulacrumHooks.cs", "SetPurchaseCostFree", 257); } } private void LoadAssets() { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: 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) AssetReferenceT<SpawnCard> obj = new AssetReferenceT<SpawnCard>(RoR2_Junk_TreasureCache.iscLockbox_asset); AssetReferenceT<SpawnCard> val = new AssetReferenceT<SpawnCard>(RoR2_DLC1_TreasureCacheVoid.iscLockboxVoid_asset); AssetReferenceT<SpawnCard> val2 = new AssetReferenceT<SpawnCard>(RoR2_DLC1_FreeChest.iscFreeChest_asset); AssetReferenceT<SpawnCard> val3 = new AssetReferenceT<SpawnCard>(RoR2_Base_DuplicatorLarge.iscDuplicatorLarge_asset); AssetReferenceT<SpawnCard> val4 = new AssetReferenceT<SpawnCard>(RoR2_DLC1_VoidChest.iscVoidChest_asset); AssetReferenceT<GameObject> val5 = new AssetReferenceT<GameObject>(RoR2_Base_ShrineHealing.ShrineHealing_prefab); AsyncOperationHandle<SpawnCard> val6 = AssetAsyncReferenceManager<SpawnCard>.LoadAsset(obj, (AsyncReferenceHandleUnloadType)2); val6.Completed += delegate(AsyncOperationHandle<SpawnCard> x) { lockBox = x.Result; }; val6 = AssetAsyncReferenceManager<SpawnCard>.LoadAsset(val, (AsyncReferenceHandleUnloadType)2); val6.Completed += delegate(AsyncOperationHandle<SpawnCard> x) { lockBoxVoid = x.Result; }; val6 = AssetAsyncReferenceManager<SpawnCard>.LoadAsset(val2, (AsyncReferenceHandleUnloadType)2); val6.Completed += delegate(AsyncOperationHandle<SpawnCard> x) { freeChest = x.Result; }; val6 = AssetAsyncReferenceManager<SpawnCard>.LoadAsset(val3, (AsyncReferenceHandleUnloadType)2); val6.Completed += delegate(AsyncOperationHandle<SpawnCard> x) { greenPrinter = x.Result; }; val6 = AssetAsyncReferenceManager<SpawnCard>.LoadAsset(val4, (AsyncReferenceHandleUnloadType)2); val6.Completed += delegate(AsyncOperationHandle<SpawnCard> x) { voidChest = x.Result; }; AsyncOperationHandle<GameObject> val7 = AssetAsyncReferenceManager<GameObject>.LoadAsset(val5, (AsyncReferenceHandleUnloadType)2); val7.Completed += delegate(AsyncOperationHandle<GameObject> x) { healShrine = x.Result; }; } } public class JudgementRun : InfiniteTowerRun { public Vector3 safeWardPos = Vector3.zero; public bool healShrineUsed; [SyncVar] public Dictionary<NetworkInstanceId, float> persistentHP = new Dictionary<NetworkInstanceId, float>(); } internal static class Log { internal static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } private static string getLogPrefix(string callerPath, string callerMemberName, int callerLineNumber) { int num = callerPath.LastIndexOf("Judgement"); if (num >= 0) { callerPath = callerPath.Substring(num + "Judgement".Length + 1); } return $"{callerPath}:{callerLineNumber} ({callerMemberName}) "; } internal static void Error(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1) { _logSource.LogError((object)(getLogPrefix(callerPath, callerMemberName, callerLineNumber) + data)); } internal static void Error_NoCallerPrefix(object data) { _logSource.LogError(data); } internal static void Fatal(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1) { _logSource.LogFatal((object)(getLogPrefix(callerPath, callerMemberName, callerLineNumber) + data)); } internal static void Fatal_NoCallerPrefix(object data) { _logSource.LogFatal(data); } internal static void Info(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1) { _logSource.LogInfo((object)(getLogPrefix(callerPath, callerMemberName, callerLineNumber) + data)); } internal static void Info_NoCallerPrefix(object data) { _logSource.LogInfo(data); } internal static void Message(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1) { _logSource.LogMessage((object)(getLogPrefix(callerPath, callerMemberName, callerLineNumber) + data)); } internal static void Message_NoCallerPrefix(object data) { _logSource.LogMessage(data); } internal static void Warning(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1) { _logSource.LogWarning((object)(getLogPrefix(callerPath, callerMemberName, callerLineNumber) + data)); } internal static void Warning_NoCallerPrefix(object data) { _logSource.LogWarning(data); } } [BepInPlugin("Nuxlar.Judgement", "Judgement", "1.6.1")] public class Main : BaseUnityPlugin { public const string PluginGUID = "Nuxlar.Judgement"; public const string PluginAuthor = "Nuxlar"; public const string PluginName = "Judgement"; public const string PluginVersion = "1.6.1"; internal static Main Instance { get; private set; } public static string PluginDirectory { get; private set; } public void Awake() { Instance = this; Stopwatch stopwatch = Stopwatch.StartNew(); Log.Init(((BaseUnityPlugin)this).Logger); new CreateGameMode(); new RunHooks(); new SimulacrumHooks(); new EntityStateHooks(); stopwatch.Stop(); Log.Info_NoCallerPrefix($"Judgement: Initialized in {stopwatch.Elapsed.TotalSeconds:F2} seconds"); } } internal static class OptionPickupFix { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown PickupDisplay.RebuildModel += new Manipulator(PickupDisplay_RebuildModel); } private static void PickupDisplay_RebuildModel(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)SymbolExtensions.GetMethodInfo<PickupDisplay>((Expression<Action<PickupDisplay>>)((PickupDisplay _) => _.DestroyModel()))) })) { Log.Error("Failed to find patch location", "C:\\Users\\romym\\OneDrive\\Desktop\\RoR2Mods\\Judgement2\\Judgement\\Patches\\OptionPickupFix.cs", "PickupDisplay_RebuildModel", 27); return; } val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldfld, AccessTools.DeclaredField(typeof(PickupDisplay), "dontInstantiatePickupModel")); val.EmitSkipMethodCall(OpCodes.Brtrue); } public static void EmitSkipMethodCall(this ILCursor c, OpCode branchOpCode, MethodDefinition method = null) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) c.EmitSkipMethodCall(branchOpCode, null, method); } public static void EmitSkipMethodCall(this ILCursor c, OpCode branchOpCode, Action<ILCursor> emitSkippedReturnValue, MethodDefinition method = null) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Invalid comparison between Unknown and I4 //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) if (c == null) { throw new ArgumentNullException("c"); } if ((int)((OpCode)(ref branchOpCode)).FlowControl != 0 && (int)((OpCode)(ref branchOpCode)).FlowControl != 3) { throw new ArgumentException($"Invalid branch OpCode: {branchOpCode}"); } if (method == null) { MethodReference val = default(MethodReference); if (!ILPatternMatchingExt.MatchCallOrCallvirt(c.Next, ref val)) { Log.Error($"Failed to find method call to skip: {((MemberReference)c.Context.Method).FullName} at instruction {c.Next} ({c.Index})", "C:\\Users\\romym\\OneDrive\\Desktop\\RoR2Mods\\Judgement2\\Judgement\\Patches\\OptionPickupFix.cs", "EmitSkipMethodCall", 53); return; } method = Extensions.SafeResolve(val); if (method == null) { Log.Error($"Failed to resolve method '{((MemberReference)val).FullName}': {((MemberReference)c.Context.Method).FullName} at instruction {c.Next} ({c.Index})", "C:\\Users\\romym\\OneDrive\\Desktop\\RoR2Mods\\Judgement2\\Judgement\\Patches\\OptionPickupFix.cs", "EmitSkipMethodCall", 61); return; } } int num = ((MethodReference)method).Parameters.Count + ((!method.IsStatic) ? 1 : 0); bool flag = Extensions.Is((MemberReference)(object)((MethodReference)method).ReturnType, (MemberInfo)typeof(void)); ILLabel val2 = c.DefineLabel(); c.Emit(branchOpCode, (object)val2); int index = c.Index; c.Index = index + 1; if (num > 0 || !flag) { ILLabel val3 = c.DefineLabel(); c.Emit(OpCodes.Br, (object)val3); c.MarkLabel(val2); for (int i = 0; i < num; i++) { c.Emit(OpCodes.Pop); } if (emitSkippedReturnValue != null) { emitSkippedReturnValue(c); } else if (!flag) { Log.Warning($"Skipped method ({((MemberReference)method).FullName}) is not void, emitting default value: {((MemberReference)c.Context.Method).FullName} at instruction {c.Next} ({c.Index})", "C:\\Users\\romym\\OneDrive\\Desktop\\RoR2Mods\\Judgement2\\Judgement\\Patches\\OptionPickupFix.cs", "EmitSkipMethodCall", 93); if (((MethodReference)method).ReturnType.IsValueType) { VariableDefinition val4 = c.Context.AddVariable(((MethodReference)method).ReturnType); c.Emit(OpCodes.Ldloca, val4); c.Emit(OpCodes.Initobj, ((MethodReference)method).ReturnType); c.Emit(OpCodes.Ldloc, val4); } else { c.Emit(OpCodes.Ldnull); } } c.MarkLabel(val3); } else { c.MarkLabel(val2); } } public static VariableDefinition AddVariable(this ILContext context, TypeReference variableType) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown VariableDefinition val = new VariableDefinition(variableType); context.Method.Body.Variables.Add(val); return val; } } }