using 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.InteropServices; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using ClayMen; using EnemiesReturns.Configuration; using EnemiesReturns.Enemies.Colossus; using EnemiesReturns.Enemies.SandCrab; using EntityStates; using HG; using HG.Reflection; using On.RoR2; using R2API; using RoR2; using RoR2.ContentManagement; using RoR2.Networking; using ShaderSwapper; using SunkenTombWorm.Content; using SunkenTombWorm.EntityStates.AcridCage; 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: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] public class AcridCage : NetworkBehaviour { [SyncVar] private bool opened; public SerializableEntityStateType openState = new SerializableEntityStateType(typeof(Open)); public SerializableEntityStateType closedState = new SerializableEntityStateType(typeof(Closed)); public bool Networkopened { get { return opened; } [param: In] set { ((NetworkBehaviour)this).SetSyncVar(value, ref opened, 1u); } } public bool Networkopened { get { return opened; } [param: In] set { ((NetworkBehaviour)this).SetSyncVar(value, ref opened, 1u); } } public override int GetNetworkChannel() { return QosChannelIndex.defaultReliable.intVal; } public Interactability GetInteractability(Interactor activator) { if (!opened) { return (Interactability)2; } return (Interactability)0; } [Server] public void Open() { if (!NetworkServer.active) { Debug.LogWarning((object)"[Server] function 'System.Void AcridCage::Open()' called on client"); } else if (NetworkServer.active) { EntityStateMachine component = ((Component)this).gameObject.GetComponent(); if (Object.op_Implicit((Object)(object)component)) { component.SetNextState(EntityStateCatalog.InstantiateState(ref openState)); } } } public void OnEnable() { InstanceTracker.Add(this); } public void OnDisable() { InstanceTracker.Remove(this); } private void UNetVersion() { } public override bool OnSerialize(NetworkWriter writer, bool forceAll) { if (forceAll) { writer.Write(opened); return true; } bool flag = false; if ((((NetworkBehaviour)this).syncVarDirtyBits & (true ? 1u : 0u)) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.Write(opened); } if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); } return flag; } public override void OnDeserialize(NetworkReader reader, bool initialState) { if (initialState) { opened = reader.ReadBoolean(); return; } int num = (int)reader.ReadPackedUInt32(); if (((uint)num & (true ? 1u : 0u)) != 0) { opened = reader.ReadBoolean(); } } public override void PreStartClient() { } } public class ReplaceShaders : MonoBehaviour { } public class GravityZone : MonoBehaviour { private List characterBodies = new List(); public float gravityCoefficient; public void OnTriggerEnter(Collider other) { CharacterBody component = ((Component)other).GetComponent(); if (Object.op_Implicit((Object)(object)component) && !characterBodies.Contains(component) && (Object)(object)component.characterMotor != (Object)null && component.characterMotor.useGravity) { characterBodies.Add(component); } } public void OnTriggerStay(Collider other) { CharacterBody component = ((Component)other).GetComponent(); if (Object.op_Implicit((Object)(object)component) && !characterBodies.Contains(component) && (Object)(object)component.characterMotor != (Object)null && component.characterMotor.useGravity) { characterBodies.Add(component); } } public void OnTriggerExit(Collider other) { CharacterBody component = ((Component)other).GetComponent(); if (characterBodies.Contains(component)) { characterBodies.Remove(component); } } private void FixedUpdate() { //IL_0061: Unknown result type (might be due to invalid IL or missing references) foreach (CharacterBody characterBody in characterBodies) { bool flag = characterBody.HasBuff(Buffs.KnockBackActiveWindow) || characterBody.HasBuff(Buffs.KnockUpHitEnemies) || characterBody.HasBuff(Buffs.KnockUpHitEnemiesJuggleCount); if (!characterBody.characterMotor.isGrounded && !flag) { characterBody.characterMotor.velocity.y += (0f - Physics.gravity.y) * gravityCoefficient * Time.fixedDeltaTime; } } } } namespace SunkenTombWorm { internal static class Log { private static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void Debug(object data) { _logSource.LogDebug(data); } internal static void Error(object data) { _logSource.LogError(data); } internal static void Fatal(object data) { _logSource.LogFatal(data); } internal static void Info(object data) { _logSource.LogInfo(data); } internal static void Message(object data) { _logSource.LogMessage(data); } internal static void Warning(object data) { _logSource.LogWarning(data); } } public class IsStarstorm2 { private static bool? _enabled; public static bool enabled { get { if (!_enabled.HasValue) { _enabled = Chainloader.PluginInfos.ContainsKey("com.TeamMoonstorm.MSU") && Chainloader.PluginInfos.ContainsKey("com.TeamMoonstorm"); } return _enabled.Value; } } } public class IsEnemiesReturns { private static bool? _enabled; public static bool enabled { get { if (!_enabled.HasValue) { _enabled = Chainloader.PluginInfos.ContainsKey("com.Viliger.EnemiesReturns"); } return _enabled.Value; } } } public class IsSandswept { private static bool? _enabled; public static bool enabled { get { if (!_enabled.HasValue) { _enabled = Chainloader.PluginInfos.ContainsKey("com.TeamSandswept.Sandswept"); } return _enabled.Value; } } } public class IsClayMen { private static bool? _enabled; public static bool enabled { get { if (!_enabled.HasValue) { _enabled = Chainloader.PluginInfos.ContainsKey("com.Moffein.ClayMen"); } return _enabled.Value; } } } public class IsForgottenRelics { private static bool? _enabled; public static bool enabled { get { if (!_enabled.HasValue) { _enabled = Chainloader.PluginInfos.ContainsKey("PlasmaCore.ForgottenRelics"); } return _enabled.Value; } } } public class ClayMenCompat { public static void AddEnemies() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown StageSpawnInfo item = new StageSpawnInfo("sunkentombs_wormsworms", 0); StageSpawnInfo item2 = new StageSpawnInfo("sunkentombs_wormsworms", 5); if (SunkenTomb.toggleClayMen.Value && !ClayMenPlugin.StageList.Contains(item) && !ClayMenPlugin.StageList.Contains(item2)) { Helpers.AddNewMonsterToStage(ClayMenContent.ClayManCard, false, (Stage)1, "sunkentombs_wormsworms"); } } } public class EnemiesReturnsCompat { public static void AddEnemies() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_0033: 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_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_005b: 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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected O, but got Unknown //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Expected O, but got Unknown //IL_00fe: 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_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Expected O, but got Unknown //IL_0126: 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) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Expected O, but got Unknown if (SunkenTomb.toggleColossus.Value && General.EnableColossus.Value) { DirectorCard card = new DirectorCard { spawnCard = (SpawnCard)SpawnCards.cscColossusDefault, spawnDistance = (MonsterSpawnDistance)0, selectionWeight = Colossus.SelectionWeight.Value, minimumStageCompletions = Colossus.MinimumStageCompletion.Value }; DirectorCardHolder val = new DirectorCardHolder { Card = card, MonsterCategory = (MonsterCategory)4 }; if (!Colossus.DefaultStageList.Value.Contains("sunkentombs_wormsworms")) { Helpers.AddNewMonsterToStage(val, false, (Stage)1, "sunkentombs_wormsworms"); Log.Info("Colossus Spider added to Sunken Tombs (wormsworms)'s spawn pool."); } if (!Colossus.DefaultStageList.Value.Contains("itsunkentombs_wormsworms")) { Helpers.AddNewMonsterToStage(val, false, (Stage)1, "itsunkentombs_wormsworms"); Log.Info("Colossus added to Sunken Tombs (wormsworms)'s simulacrum spawn pool."); } } if (SunkenTomb.toggleSandCrab.Value && General.EnableSandCrab.Value) { DirectorCard card2 = new DirectorCard { spawnCard = (SpawnCard)SpawnCards.cscSandCrabDefault, spawnDistance = (MonsterSpawnDistance)0, selectionWeight = SandCrab.SelectionWeight.Value, minimumStageCompletions = SandCrab.MinimumStageCompletion.Value }; DirectorCardHolder val2 = new DirectorCardHolder { Card = card2, MonsterCategory = (MonsterCategory)3 }; if (!SandCrab.DefaultStageList.Value.Contains("sunkentombs_wormsworms")) { Helpers.AddNewMonsterToStage(val2, false, (Stage)1, "sunkentombs_wormsworms"); Log.Info("Sand Crab added to Sunken Tombs (wormsworms)'s spawn pool."); } if (!SandCrab.DefaultStageList.Value.Contains("itsunkentombs_wormsworms")) { Helpers.AddNewMonsterToStage(val2, false, (Stage)1, "itsunkentombs_wormsworms"); Log.Info("Sand Crab added to Sunken Tombs (wormsworms)'s simulacrum spawn pool."); } } } } [BepInPlugin("wormsworms.Sunken_Tombs_Returns", "Sunken_Tombs_Returns", "1.0.2")] public class SunkenTomb : BaseUnityPlugin { public const string Author = "wormsworms"; public const string Name = "Sunken_Tombs_Returns"; public const string Version = "1.0.2"; public const string GUID = "wormsworms.Sunken_Tombs_Returns"; public static SunkenTomb instance; public static ConfigEntry enableRegular; public static ConfigEntry enableSimulacrum; public static ConfigEntry stage1Simulacrum; public static ConfigEntry waterMuffle; public static ConfigEntry toggleSandCrab; public static ConfigEntry toggleColossus; public static ConfigEntry toggleClayMen; public const string mapName = "sunkentombs_wormsworms"; public const string simuName = "itsunkentombs_wormsworms"; private void Awake() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown instance = this; Log.Init(((BaseUnityPlugin)this).Logger); ConfigSetup(); ContentManager.collectContentPackProviders += new CollectContentPackProvidersDelegate(GiveToRoR2OurContentPackProviders); Language.collectLanguageRootFolders += CollectLanguageRootFolders; MusicController.StartIntroMusic += new hook_StartIntroMusic(MusicController_StartIntroMusic); AddEntityStates(); SceneManager.sceneLoaded += SceneSetup; RoR2Application.onLoadFinished = (Action)Delegate.Combine(RoR2Application.onLoadFinished, new Action(AddModdedEnemies)); } public static void AddModdedEnemies() { if (IsEnemiesReturns.enabled) { EnemiesReturnsCompat.AddEnemies(); } if (IsClayMen.enabled) { ClayMenCompat.AddEnemies(); } } private void MusicController_StartIntroMusic(orig_StartIntroMusic orig, MusicController self) { orig.Invoke(self); AkSoundEngine.PostEvent("STWorms_Play_Music_System", ((Component)self).gameObject); } public void AddEntityStates() { //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) bool flag = default(bool); ContentAddition.AddEntityState(ref flag); ContentAddition.AddEntityState(ref flag); } private void Destroy() { Language.collectLanguageRootFolders -= CollectLanguageRootFolders; } private static void GiveToRoR2OurContentPackProviders(AddContentPackProviderDelegate addContentPackProvider) { addContentPackProvider.Invoke((IContentPackProvider)(object)new ContentProvider()); } public void CollectLanguageRootFolders(List folders) { folders.Add(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "Language")); folders.Add(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "Plugins/Language")); } private void SceneSetup(Scene newScene, LoadSceneMode loadSceneMode) { if (((Scene)(ref newScene)).name == "sunkentombs_wormsworms") { Transform transform = GameObject.Find("HOLDER: Jump Pads/Geysers").transform; for (int i = 0; i < transform.childCount; i++) { GameObject gameObject = ((Component)transform.GetChild(i).GetChild(0).GetChild(0)).gameObject; GameObject gameObject2 = ((Component)transform.GetChild(i).GetChild(0).GetChild(1)).gameObject; ((Renderer)gameObject.GetComponent()).material = SunkenTombContent.terrainMaterial; ((Renderer)gameObject2.GetComponent()).material = SunkenTombContent.terrainMaterial; } } else if (((Scene)(ref newScene)).name == "itsunkentombs_wormsworms") { Transform transform2 = GameObject.Find("HOLDER: Jump Pads/Geysers").transform; for (int j = 0; j < transform2.childCount; j++) { GameObject gameObject3 = ((Component)transform2.GetChild(j).GetChild(0).GetChild(0)).gameObject; GameObject gameObject4 = ((Component)transform2.GetChild(j).GetChild(0).GetChild(1)).gameObject; ((Renderer)gameObject3.GetComponent()).material = SunkenTombContent.itTerrainMaterial; ((Renderer)gameObject4.GetComponent()).material = SunkenTombContent.itTerrainMaterial; } } } private void ConfigSetup() { enableRegular = ((BaseUnityPlugin)this).Config.Bind("00 - Stages", "Enable Sunken Tombs", true, "If true, Sunken Tombs can appear in regular runs."); enableSimulacrum = ((BaseUnityPlugin)this).Config.Bind("00 - Stages", "Enable Simulacrum Variant", true, "If true, Sunken Tombs can appear in the Simulacrum."); stage1Simulacrum = ((BaseUnityPlugin)this).Config.Bind("00 - Stages", "Enable Simulacrum Variant on Stage 1", true, "If false, Sunken Tombs will only appear after clearing at least one stage in the Simulacrum, like Commencement."); waterMuffle = ((BaseUnityPlugin)this).Config.Bind("00 - Stages", "Underwater Music Muffling", false, "If true, music will be muffled while underwater in Sunken Tombs."); toggleSandCrab = ((BaseUnityPlugin)this).Config.Bind("01 - Monsters: EnemiesReturns", "Enable Sand Crab", true, "If true, Sand Crabs will appear in Sunken Tombs."); toggleColossus = ((BaseUnityPlugin)this).Config.Bind("01 - Monsters: EnemiesReturns", "Enable Colossus", true, "If true, Collossi will appear in Sunken Tombs."); toggleClayMen = ((BaseUnityPlugin)this).Config.Bind("03 - Monsters: Misc.", "Enable Clay Man", true, "If true, Clay Men will appear in Sunken Tombs."); } } } namespace SunkenTombWorm.Content { public class ContentProvider : IContentPackProvider { private readonly ContentPack _contentPack = new ContentPack(); public static string assetDirectory; internal const string MusicSoundBankFileName = "STWormsMusic.bnk"; internal const string InitSoundBankFileName = "STWormsMusicInit.bnk"; public string identifier => "wormsworms.Sunken_Tombs_Returns.ContentProvider"; public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args) { _contentPack.identifier = identifier; string assetsFolderFullPath = (assetDirectory = Path.GetDirectoryName(typeof(ContentProvider).Assembly.Location)); string text = Path.Combine(Path.GetDirectoryName(typeof(ContentProvider).Assembly.Location), "Soundbanks"); Log.Debug(text); LoadSoundBanks(text); AssetBundle scenesAssetBundle = null; yield return LoadAssetBundle(Path.Combine(assetsFolderFullPath, "SunkenTombsWormsScenes"), args.progressReceiver, delegate(AssetBundle assetBundle) { scenesAssetBundle = assetBundle; }); AssetBundle assetsAssetBundle = null; yield return LoadAssetBundle(Path.Combine(assetsFolderFullPath, "SunkenTombsWormsAssets"), args.progressReceiver, delegate(AssetBundle assetBundle) { assetsAssetBundle = assetBundle; }); yield return SunkenTombContent.LoadAssetBundlesAsync(scenesAssetBundle, assetsAssetBundle, args.progressReceiver, _contentPack); } public static void SetupMusic() { //IL_0034: 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) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) CustomMusicTrackDef val = ScriptableObject.CreateInstance(); ((Object)val).name = "STWormsMainMusic"; ((MusicTrackDef)val).cachedName = "STWormsMainMusic"; ((MusicTrackDef)val).comment = "Chris Christodoulou - 25 3 N 91 7 E\r\nsunkentomb_wormsworms"; val.CustomStates = new List(); CustomState item = default(CustomState); item.GroupId = 1810963621u; item.StateId = 3457533948u; val.CustomStates.Add(item); CustomState item2 = default(CustomState); item2.GroupId = 792781730u; item2.StateId = 89505537u; val.CustomStates.Add(item2); SunkenTombContent.mainSceneDef.mainTrack = (MusicTrackDef)(object)val; SunkenTombContent.simuSceneDef.mainTrack = (MusicTrackDef)(object)val; CustomMusicTrackDef val2 = ScriptableObject.CreateInstance(); ((Object)val2).name = "STWormsBossMusic"; ((MusicTrackDef)val2).cachedName = "STWormsBossMusic"; ((MusicTrackDef)val2).comment = "Chris Christodoulou - Hailstorm\r\nnsunkentomb_wormsworms"; val2.CustomStates = new List(); CustomState item3 = default(CustomState); item3.GroupId = 1810963621u; item3.StateId = 514064485u; val2.CustomStates.Add(item3); CustomState item4 = default(CustomState); item4.GroupId = 792781730u; item4.StateId = 580146960u; val2.CustomStates.Add(item4); SunkenTombContent.mainSceneDef.bossTrack = (MusicTrackDef)(object)val2; SunkenTombContent.simuSceneDef.bossTrack = (MusicTrackDef)(object)val2; } public static void LoadSoundBanks(string soundbanksFolderPath) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Invalid comparison between Unknown and I4 //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: 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_0051: Invalid comparison between Unknown and I4 //IL_0069: 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_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) //IL_008d: Invalid comparison between Unknown and I4 //IL_00a4: Unknown result type (might be due to invalid IL or missing references) AKRESULT val = AkSoundEngine.AddBasePath(soundbanksFolderPath); if ((int)val == 1) { Log.Info("Added bank base path : " + soundbanksFolderPath); } else { Log.Error("Error adding base path : " + soundbanksFolderPath + " " + $"Error code : {val}"); } uint num = default(uint); val = AkSoundEngine.LoadBank("STWormsMusicInit.bnk", ref num); if ((int)val == 1) { Log.Info("Added bank : STWormsMusicInit.bnk"); } else { Log.Error("Error loading bank : STWormsMusicInit.bnk " + $"Error code : {val}"); } val = AkSoundEngine.LoadBank("STWormsMusic.bnk", ref num); if ((int)val == 1) { Log.Info("Added bank : STWormsMusic.bnk"); } else { Log.Error("Error loading bank : STWormsMusic.bnk " + $"Error code : {val}"); } } private IEnumerator LoadAssetBundle(string assetBundleFullPath, IProgress progress, Action onAssetBundleLoaded) { AssetBundleCreateRequest assetBundleCreateRequest = AssetBundle.LoadFromFileAsync(assetBundleFullPath); while (!((AsyncOperation)assetBundleCreateRequest).isDone) { progress.Report(((AsyncOperation)assetBundleCreateRequest).progress); yield return null; } onAssetBundleLoaded(assetBundleCreateRequest.assetBundle); } public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args) { ContentPack.Copy(_contentPack, args.output); args.ReportProgress(1f); yield break; } public IEnumerator FinalizeAsync(FinalizeAsyncArgs args) { args.ReportProgress(1f); yield break; } } public static class Simulacrum { public static void RegisterSceneToSimulacrum(SceneDef sceneDef, bool canBeStage1 = true, float weight = 1f) { //IL_0005: 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_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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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_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_0078: 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_00fe: 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_0087: Unknown result type (might be due to invalid IL or missing references) SceneCollection val = Addressables.LoadAssetAsync((object)"RoR2/DLC1/GameModes/InfiniteTowerRun/SceneGroups/sgInfiniteTowerStageX.asset").WaitForCompletion(); SceneCollection val2 = Addressables.LoadAssetAsync((object)"RoR2/DLC1/GameModes/InfiniteTowerRun/SceneGroups/sgInfiniteTowerStage1.asset").WaitForCompletion(); List list = new List(); Enumerator enumerator = val.sceneEntries.GetEnumerator(); try { while (enumerator.MoveNext()) { SceneEntry current = enumerator.Current; if ((Object)(object)current.sceneDef == (Object)(object)sceneDef) { Log.Error("SceneDef " + sceneDef.cachedName + " is already registered into the Simulacrum"); return; } if (current.sceneDef.hasAnyDestinations) { list.Add(current.sceneDef.destinationsGroup); } } } finally { ((IDisposable)enumerator).Dispose(); } SceneCollection val3 = ScriptableObject.CreateInstance(); ((Object)val3).name = "sgInfiniteTowerStageX" + sceneDef.cachedName; val3._sceneEntries = val._sceneEntries; sceneDef.destinationsGroup = val3; SceneEntry val4 = default(SceneEntry); val4.sceneDef = sceneDef; val4.weightMinusOne = weight - 1f; SceneEntry val5 = val4; ArrayUtils.ArrayAppend(ref val._sceneEntries, ref val5); if (canBeStage1) { ArrayUtils.ArrayAppend(ref val2._sceneEntries, ref val5); } foreach (SceneCollection item in list) { ArrayUtils.ArrayAppend(ref item._sceneEntries, ref val5); } } } public static class SunkenTombContent { internal const string ScenesAssetBundleFileName = "SunkenTombsWormsScenes"; internal const string AssetsAssetBundleFileName = "SunkenTombsWormsAssets"; private static AssetBundle _scenesAssetBundle; private static AssetBundle _assetsAssetBundle; internal static UnlockableDef[] UnlockableDefs; internal static SceneDef[] SceneDefs; internal static SceneDef mainSceneDef; internal static Sprite mainSceneDefPreviewSprite; internal static Material mainBazaarSeer; internal static Material terrainMaterial; internal static CharacterSpawnCard stAcridCard; internal static SceneDef simuSceneDef; internal static Sprite simuSceneDefPreviewSprite; internal static Material simuBazaarSeer; internal static Material itTerrainMaterial; public static List SwappedMaterials = new List(); internal static IEnumerator LoadAssetBundlesAsync(AssetBundle scenesAssetBundle, AssetBundle assetsAssetBundle, IProgress progress, ContentPack contentPack) { _scenesAssetBundle = scenesAssetBundle; _assetsAssetBundle = assetsAssetBundle; IEnumerator upgradeStubbedShaders = ShaderSwapper.UpgradeStubbedShadersAsync(_assetsAssetBundle); while (upgradeStubbedShaders.MoveNext()) { yield return upgradeStubbedShaders.Current; } yield return LoadAllAssetsAsync(assetsAssetBundle, progress, (Action)delegate(UnlockableDef[] assets) { contentPack.unlockableDefs.Add(assets); }); yield return LoadAllAssetsAsync(assetsAssetBundle, progress, (Action)delegate(CharacterSpawnCard[] assets) { stAcridCard = assets.First((CharacterSpawnCard a) => ((Object)a).name == "cscSTAcrid"); }); yield return LoadAllAssetsAsync(_assetsAssetBundle, progress, (Action)delegate(Sprite[] assets) { mainSceneDefPreviewSprite = assets.First((Sprite a) => ((Object)a).name == "texSTScenePreview"); simuSceneDefPreviewSprite = assets.First((Sprite a) => ((Object)a).name == "texSTScenePreview"); }); yield return LoadAllAssetsAsync(_assetsAssetBundle, progress, (Action)delegate(Material[] assets) { terrainMaterial = assets.First((Material a) => ((Object)a).name == "matSTTerrain"); itTerrainMaterial = assets.First((Material a) => ((Object)a).name == "matITSTTerrain"); }); yield return LoadAllAssetsAsync(_assetsAssetBundle, progress, (Action)delegate(SceneDef[] assets) { SceneDefs = assets; mainSceneDef = SceneDefs.First((SceneDef sd) => sd.baseSceneNameOverride == "sunkentombs_wormsworms"); simuSceneDef = SceneDefs.First((SceneDef sd) => sd.baseSceneNameOverride == "itsunkentombs_wormsworms"); Log.Debug(mainSceneDef.nameToken); contentPack.sceneDefs.Add(assets); }); mainSceneDef.portalMaterial = StageRegistration.MakeBazaarSeerMaterial((Texture2D)mainSceneDef.previewTexture); AsyncOperationHandle mainTrackDefRequest = Addressables.LoadAssetAsync((object)"RoR2/Base/Common/MusicTrackDefs/muSong13.asset"); while (!mainTrackDefRequest.IsDone) { yield return null; } AsyncOperationHandle bossTrackDefRequest = Addressables.LoadAssetAsync((object)"RoR2/Base/Common/MusicTrackDefs/muSong05.asset"); while (!bossTrackDefRequest.IsDone) { yield return null; } ContentProvider.SetupMusic(); GameObject prefab = Addressables.LoadAssetAsync((object)"RoR2/Base/Croco/CrocoMonsterMaster.prefab").WaitForCompletion(); ItemDef itemDef = Addressables.LoadAssetAsync((object)"RoR2/Base/InvadingDoppelganger/InvadingDoppelganger.asset").WaitForCompletion(); ItemDef itemDef2 = Addressables.LoadAssetAsync((object)"RoR2/Base/CritGlasses/CritGlasses.asset").WaitForCompletion(); ItemDef itemDef3 = Addressables.LoadAssetAsync((object)"RoR2/Base/AttackSpeedOnCrit/AttackSpeedOnCrit.asset").WaitForCompletion(); ItemDef itemDef4 = Addressables.LoadAssetAsync((object)"RoR2/Base/UtilitySkillMagazine/UtilitySkillMagazine.asset").WaitForCompletion(); ItemCountPair val = default(ItemCountPair); val.itemDef = itemDef; val.count = 1; ItemCountPair val2 = val; val = default(ItemCountPair); val.itemDef = itemDef2; val.count = 10; val = default(ItemCountPair); val.itemDef = itemDef3; val.count = 1; val = default(ItemCountPair); val.itemDef = itemDef4; val.count = 1; ((SpawnCard)stAcridCard).prefab = prefab; stAcridCard.itemsToGrant[0] = val2; if (SunkenTomb.enableRegular.Value) { StageRegistration.RegisterSceneDefToNormalProgression(mainSceneDef, 1f, true, true); } if (SunkenTomb.enableSimulacrum.Value && SunkenTomb.stage1Simulacrum.Value) { Simulacrum.RegisterSceneToSimulacrum(simuSceneDef); } else if (SunkenTomb.enableSimulacrum.Value && !SunkenTomb.stage1Simulacrum.Value) { Simulacrum.RegisterSceneToSimulacrum(simuSceneDef, canBeStage1: false); } } internal static void Unload() { _assetsAssetBundle.Unload(true); _scenesAssetBundle.Unload(true); } private static IEnumerator LoadAllAssetsAsync(AssetBundle assetBundle, IProgress progress, Action onAssetsLoaded) where T : Object { AssetBundleRequest sceneDefsRequest = assetBundle.LoadAllAssetsAsync(); while (!((AsyncOperation)sceneDefsRequest).isDone) { progress.Report(((AsyncOperation)sceneDefsRequest).progress); yield return null; } onAssetsLoaded(sceneDefsRequest.allAssets.Cast().ToArray()); } } public class AudioMuffleZone : MonoBehaviour { private void OnEnable() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown if (SunkenTomb.waterMuffle.Value) { MusicController.RecalculateHealth += new hook_RecalculateHealth(MusicController_RecalculateHealth); } } private void OnDisable() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown if (SunkenTomb.waterMuffle.Value) { MusicController.RecalculateHealth -= new hook_RecalculateHealth(MusicController_RecalculateHealth); } } public static bool IsInsideCollider(Collider collider, Vector3 position) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) Bounds bounds = collider.bounds; return ((Bounds)(ref bounds)).Contains(position); } private void MusicController_RecalculateHealth(orig_RecalculateHealth orig, MusicController self, GameObject playerObject) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, playerObject); if (Object.op_Implicit((Object)(object)self.targetCamera) && IsInsideCollider((Collider)(object)((Component)this).gameObject.GetComponent(), ((Component)self.targetCamera).transform.localPosition)) { self.rtpcPlayerHealthValue.value -= 100f; self.rtpcPlayerHealthValue.value = Mathf.Max(self.rtpcEnemyValue.value, -100f); } } } } namespace SunkenTombWorm.EntityStates.AcridCage { public class Closed : EntityState { public override void OnEnter() { ((EntityState)this).OnEnter(); ((EntityState)this).PlayAnimation("Base", "Closed"); } } public class Open : EntityState { public static float duration = 1f; private static int OpeningStateHash = Animator.StringToHash("Open"); private static int OpeningParamHash = Animator.StringToHash("Open.playbackRate"); public override void OnEnter() { ((EntityState)this).OnEnter(); ChildLocator component = ((EntityState)this).gameObject.GetComponent(); if (!Object.op_Implicit((Object)(object)component)) { return; } Transform val = component.FindChild("Cage"); Transform val2 = component.FindChild("Door"); if (Object.op_Implicit((Object)(object)val)) { Animator component2 = ((Component)val).gameObject.GetComponent(); if (Object.op_Implicit((Object)(object)component2)) { EntityState.PlayAnimationOnAnimator(component2, "Base", "Open"); } } if (Object.op_Implicit((Object)(object)val2)) { ((Component)val2).gameObject.SetActive(false); } } public override void FixedUpdate() { ((EntityState)this).FixedUpdate(); if (((EntityState)this).fixedAge >= duration) { base.outer.SetNextState((EntityState)(object)new Closed()); } } } }