using System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security.Permissions; using BepInEx; using HG; using LOP; using Microsoft.CodeAnalysis; using On.RoR2; using R2API; using RoR2; using RoR2BepInExPack.GameAssetPaths.Version_1_39_0; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Events; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("ForlornWreckageStage5")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("ForlornWreckageStage5")] [assembly: AssemblyTitle("ForlornWreckageStage5")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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] [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; } } } namespace ForlornWreckageStage5 { [BepInPlugin("com.viliger.ForlornWreckageStage5", "ForlornWreckageStage5", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class ForlornWreckageStage5Plugin : BaseUnityPlugin { public const string Author = "viliger"; public const string ModName = "ForlornWreckageStage5"; public const string Version = "1.0.0"; public const string GUID = "com.viliger.ForlornWreckageStage5"; private const string FORLORN_WRECKAGE_SCENE_NAME = "forgottenwreckage_ws"; private static GameObject artifactPortalPrefab; private void Awake() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Expected O, but got Unknown RoR2Application.onLoadFinished = (Action)Delegate.Combine(RoR2Application.onLoadFinished, new Action(ModifyForlornWreckage)); SceneDirector.Start += new hook_Start(SceneDirector_Start); CreateArtifactThing(); AddMonsterToStage(RoR2_Base_Parent.cscParent_asset, (MonsterCategory)3); AddMonsterToStage(RoR2_Base_LemurianBruiser.cscLemurianBruiser_asset, (MonsterCategory)3); AddMonsterToStage(RoR2_Base_Grandparent.cscGrandparent_asset, (MonsterCategory)4); DirectorCard card = new DirectorCard { spawnCardReference = new AssetReferenceT(RoR2_Base_TripleShopLarge.iscTripleShopLarge_asset), selectionWeight = 40, spawnDistance = (MonsterSpawnDistance)0 }; Helpers.AddNewInteractableToStage(new DirectorCardHolder { Card = card, InteractableCategory = (InteractableCategory)2 }, (Stage)1, "forgottenwreckage_ws"); Helpers.RemoveExistingInteractableFromStage(InteractableNames.TripleShop, (Stage)1, "forgottenwreckage_ws"); } private void CreateJumpPad(Vector3 position, Vector3 rotation, Vector3 targetPosition, Vector3 jumpVelocity, float time) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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_007e: 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_008b: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(); ((Object)val).name = "FW_ArtifactPortalJumpPad"; GameObject val2 = new GameObject(); val2.transform.parent = val.transform; val2.transform.localPosition = targetPosition; InstantiateGeyserPrefab obj = val.AddComponent(); obj.geyserType = (GeyserType)0; JumpVolume component = val.GetComponent(); component.jumpVelocity = jumpVelocity; component.time = time; component.jumpSoundString = "Play_env_geyser_launch"; component.targetElevationTransform = val2.transform; component.onJump = new UnityEvent(); val.transform.position = position; val.transform.rotation = Quaternion.Euler(rotation); obj.Refresh(); } private void CreateArtifactThing() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Expected O, but got Unknown //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: 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_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_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014d: 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_019a: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: 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) artifactPortalPrefab = new GameObject(); Object.DontDestroyOnLoad((Object)(object)artifactPortalPrefab); ((Object)artifactPortalPrefab).name = "FW_ArtifactPortalPrefab"; artifactPortalPrefab.AddComponent(); InstantiateArtifactPortal obj = artifactPortalPrefab.AddComponent(); List list = new List { AddButton(artifactPortalPrefab, new Vector3(5.09f, -19.57f, 20.97f), Vector3.zero), AddButton(artifactPortalPrefab, new Vector3(2f, -19.57f, 16.75f), Vector3.zero), AddButton(artifactPortalPrefab, new Vector3(-1.23f, -19.57f, 12.46f), Vector3.zero), AddButton(artifactPortalPrefab, new Vector3(0.9499768f, -19.57f, 23.940008f), Vector3.zero), AddButton(artifactPortalPrefab, new Vector3(-2.1f, -19.57f, 19.79f), Vector3.zero), AddButton(artifactPortalPrefab, new Vector3(-5.410023f, -19.57f, 15.610008f), Vector3.zero), AddButton(artifactPortalPrefab, new Vector3(-3.1f, -19.57f, 26.73f), Vector3.zero), AddButton(artifactPortalPrefab, new Vector3(-5.9000063f, -19.57f, 22.88001f), Vector3.zero), AddButton(artifactPortalPrefab, new Vector3(-9.360006f, -19.57f, 18.680012f), Vector3.zero) }; obj.artifactButtons = list.ToArray(); obj.portalLocation = AddButton(artifactPortalPrefab, new Vector3(36.94f, -8.72f, -18.5f), new Vector3(0f, 126.94791f, 0f)); obj.laptopLocation = AddButton(artifactPortalPrefab, new Vector3(-10.28f, -19.96f, 10.07f), Vector3.zero); PrefabAPI.RegisterNetworkPrefab(artifactPortalPrefab); ContentAddition.AddNetworkedObject(artifactPortalPrefab); static Transform AddButton(GameObject parent, Vector3 position, Vector3 rotation) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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_0022: 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_0029: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(); val.transform.parent = parent.transform; val.transform.localPosition = position; val.transform.rotation = Quaternion.Euler(rotation); return val.transform; } } private void SceneDirector_Start(orig_Start orig, SceneDirector self) { //IL_0047: 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_0087: 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_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: 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_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)SceneInfo.instance) && Object.op_Implicit((Object)(object)SceneInfo.instance.sceneDef) && SceneInfo.instance.sceneDef.baseSceneName == "forgottenwreckage_ws") { self.teleporterSpawnCard = (SpawnCard)(object)Addressables.LoadAssetAsync((object)RoR2_Base_Teleporters.iscLunarTeleporter_asset).WaitForCompletion(); ClassicStageInfo component = ((Component)SceneInfo.instance).GetComponent(); if (Object.op_Implicit((Object)(object)component)) { component.sceneDirectorInteractibleCredits = 520; } CreateJumpPad(new Vector3(153.32f, 270.01f, -405.06f), new Vector3(270f, 0f, 0f), new Vector3(-11.58f, 40.43f, 53.53f), new Vector3(-5.0347834f, 57.77391f, -17.578259f), 2.3f); CreateJumpPad(new Vector3(148.82f, 323.46f, -457.4f), new Vector3(270f, 0f, 0f), new Vector3(-13.61f, 21.73f, 48.41f), new Vector3(-5.917392f, 55.54783f, -9.447831f), 2.3f); CreateJumpPad(new Vector3(146.9f, 371.97f, -475.18f), new Vector3(270f, 0f, 0f), new Vector3(114.6f, -44.8f, 61.277f), new Vector3(38.2f, 65.42567f, 14.93333f), 3f); if (NetworkServer.active && Object.op_Implicit((Object)(object)artifactPortalPrefab)) { NetworkServer.Spawn(Object.Instantiate(artifactPortalPrefab, new Vector3(312.4234f, 430.78784f, -385.85416f), Quaternion.identity)); } } orig.Invoke(self); } private void AddMonsterToStage(string cardGuid, MonsterCategory category) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: 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) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_0034: 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_0047: Expected O, but got Unknown DirectorCard card = new DirectorCard { spawnCardReference = new AssetReferenceT(cardGuid), selectionWeight = 1, spawnDistance = (MonsterSpawnDistance)0, preventOverhead = true }; Helpers.AddNewMonsterToStage(new DirectorCardHolder { Card = card, MonsterCategory = category }, false, (Stage)1, "forgottenwreckage_ws"); } private void ModifyForlornWreckage() { //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_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_0051: 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) //IL_0065: 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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) SceneDef val = SceneCatalog.FindSceneDef("forgottenwreckage_ws"); if (Object.op_Implicit((Object)(object)val)) { SceneCollection sceneCollection = Addressables.LoadAssetAsync((object)RoR2_Base_SceneGroups.loopSgStage3_asset).WaitForCompletion(); SceneCollection sceneCollection2 = Addressables.LoadAssetAsync((object)RoR2_Base_SceneGroups.sgStage3_asset).WaitForCompletion(); RemoveStageFromSceneCollection(ref sceneCollection, val); RemoveStageFromSceneCollection(ref sceneCollection2, val); SceneCollection sceneCollection3 = Addressables.LoadAssetAsync((object)RoR2_Base_SceneGroups.loopSgStage5_asset).WaitForCompletion(); SceneCollection sceneCollection4 = Addressables.LoadAssetAsync((object)RoR2_Base_SceneGroups.sgStage5_asset).WaitForCompletion(); AppendStageToSceneCollection(ref sceneCollection3, val); AppendStageToSceneCollection(ref sceneCollection4, val); SceneCollection loopedDestinationsGroup = Addressables.LoadAssetAsync((object)RoR2_Base_SceneGroups.loopSgStage1_asset).WaitForCompletion(); SceneCollection destinationsGroup = Addressables.LoadAssetAsync((object)RoR2_Base_SceneGroups.sgStage1_asset).WaitForCompletion(); val.destinationsGroup = destinationsGroup; val.loopedDestinationsGroup = loopedDestinationsGroup; } static void AppendStageToSceneCollection(ref SceneCollection reference, SceneDef sceneDef) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) ref SceneEntry[] sceneEntries = ref reference._sceneEntries; SceneEntry val2 = new SceneEntry { sceneDef = sceneDef, weightMinusOne = 0f }; ArrayUtils.ArrayAppend(ref sceneEntries, ref val2); } static void RemoveStageFromSceneCollection(ref SceneCollection reference, SceneDef sceneDef) { for (int i = 0; i < reference._sceneEntries.Length; i++) { if ((Object)(object)reference._sceneEntries[i].sceneDef == (Object)(object)sceneDef) { ArrayUtils.ArrayRemoveAtAndResize(ref reference._sceneEntries, i, 1); break; } } } } } }