Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Ancient Observatory v2.0.0
Plugins/Ancient_Observatory.dll
Decompiled 2 weeks agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Security.Permissions; using AncientWisp; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using EnemiesReturns.Configuration; using EnemiesReturns.Enemies.Colossus; using EnemiesReturns.Enemies.Swift; using FRCSharp; using FSCStage; using HG; using HG.Reflection; using On.RoR2; using Promenade.Content; using R2API; using RoR2; using RoR2.ContentManagement; using RoR2.Navigation; using Sandswept; using ShaderSwapper; 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 ReplaceShaders : MonoBehaviour { } namespace FSCStage { 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 IsForgottenRelics { private static bool? _enabled; public static bool enabled { get { if (!_enabled.HasValue) { _enabled = Chainloader.PluginInfos.ContainsKey("PlasmaCore.ForgottenRelics"); } return _enabled.Value; } } } public class IsAncientWisp { private static bool? _enabled; public static bool enabled { get { if (!_enabled.HasValue) { _enabled = Chainloader.PluginInfos.ContainsKey("com.Moffein.AncientWisp"); } return _enabled.Value; } } } } namespace Promenade { 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 AncientWispCompat { 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 //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown StageSpawnInfo item = new StageSpawnInfo("observatory_wormsworms", 0); StageSpawnInfo item2 = new StageSpawnInfo("observatory_wormsworms", 5); StageSpawnInfo item3 = new StageSpawnInfo("itobservatory_wormsworms", 0); StageSpawnInfo item4 = new StageSpawnInfo("itobservatory_wormsworms", 5); if (Promenade.toggleAncientWisp.Value && !AncientWispPlugin.StageList.Contains(item) && !AncientWispPlugin.StageList.Contains(item2)) { Helpers.AddNewMonsterToStage(AWContent.AncientWispCard, false, (Stage)1, "observatory_wormsworms"); } if (Promenade.toggleAncientWisp.Value && !AncientWispPlugin.StageList.Contains(item3) && !AncientWispPlugin.StageList.Contains(item4)) { Helpers.AddNewMonsterToStage(AWContent.AncientWispCard, false, (Stage)1, "itobservatory_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 (Promenade.toggleColossus.Value && General.EnableColossus.Value) { DirectorCard card = new DirectorCard { spawnCard = (SpawnCard)SpawnCards.cscColossusGrassy, 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("observatory_wormsworms")) { Helpers.AddNewMonsterToStage(val, false, (Stage)1, "observatory_wormsworms"); Log.Info("Colossus added to ancient observatory's spawn pool."); } if (!Colossus.DefaultStageList.Value.Contains("itobservatory_wormsworms")) { Helpers.AddNewMonsterToStage(val, false, (Stage)1, "itobservatory_wormsworms"); Log.Info("Colossus added to ancient observatory's simulacrum spawn pool."); } } if (Promenade.toggleSwift.Value && General.EnableSwift.Value) { DirectorCard card2 = new DirectorCard { spawnCard = (SpawnCard)SpawnCards.cscSwiftDefault, spawnDistance = (MonsterSpawnDistance)2, selectionWeight = Swift.SelectionWeight.Value, minimumStageCompletions = Swift.MinimumStageCompletion.Value }; DirectorCardHolder val2 = new DirectorCardHolder { Card = card2, MonsterCategory = (MonsterCategory)2 }; if (!Swift.DefaultStageList.Value.Contains("observatory_wormsworms")) { Helpers.AddNewMonsterToStage(val2, false, (Stage)1, "observatory_wormsworms"); Log.Info("Swift added to ancient observatory's spawn pool."); } Swift.DefaultStageList.Value.Contains("itobservatory_wormsworms"); } } } public class ForgottenRelicsCompat { public static CharacterSpawnCard CannonballJellyfishCard; public static void AddEnemies() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: 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_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_003f: Expected O, but got Unknown //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0061: Expected O, but got Unknown if (Promenade.toggleBrassMonolith.Value && !VF2ConfigManager.disableBrassMonolith.Value) { DirectorCardHolder val = new DirectorCardHolder { Card = new DirectorCard { spawnCard = (SpawnCard)VF2ContentPackProvider.cscBrassMonolith, selectionWeight = 1 }, MonsterCategory = (MonsterCategory)4 }; Helpers.AddNewMonsterToStage(val, false, (Stage)1, "observatory_wormsworms"); Helpers.AddNewMonsterToStage(val, false, (Stage)1, "itobservatory_wormsworms"); Log.Debug("Brass Monolith added to ancient observatory spawn pool."); } } } public class SandsweptCompat { public static CharacterSpawnCard CannonballJellyfishCard; public static bool FindEnabledConfig(string configName) { ConfigEntryBase[] configEntries = Main.config.GetConfigEntries(); foreach (ConfigEntryBase val in configEntries) { if (((object)val.Definition).ToString() == configName) { return (bool)val.BoxedValue; } } return false; } public static int FindCreditConfig(string configName) { ConfigEntryBase[] configEntries = Main.config.GetConfigEntries(); foreach (ConfigEntryBase val in configEntries) { if (((object)val.Definition).ToString() == configName) { return (int)val.DefaultValue; } } return 115; } public static void AddEnemies() { //IL_005f: 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_0075: 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_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Expected O, but got Unknown //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: 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_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Expected O, but got Unknown //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Expected O, but got Unknown //IL_00f0: 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_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Expected O, but got Unknown //IL_0112: Expected O, but got Unknown bool flag = FindEnabledConfig("Enemies :: Cannonball Jellyfish.Enabled"); if (Promenade.toggleCannonballJellyfish.Value && flag) { CannonballJellyfishCard = ScriptableObject.CreateInstance<CharacterSpawnCard>(); ((Object)CannonballJellyfishCard).name = "cscAOCannonballJellyfish"; ((SpawnCard)CannonballJellyfishCard).prefab = Main.assets.LoadAsset<GameObject>("CannonJellyMaster.prefab"); ((SpawnCard)CannonballJellyfishCard).sendOverNetwork = true; ((SpawnCard)CannonballJellyfishCard).hullSize = (HullClassification)0; ((SpawnCard)CannonballJellyfishCard).nodeGraphType = (GraphType)1; ((SpawnCard)CannonballJellyfishCard).requiredFlags = (NodeFlags)0; ((SpawnCard)CannonballJellyfishCard).forbiddenFlags = (NodeFlags)2; ((SpawnCard)CannonballJellyfishCard).directorCreditCost = FindCreditConfig("Enemies :: Cannonball Jellyfish.Director Credit Cost"); ((SpawnCard)CannonballJellyfishCard).occupyPosition = false; CannonballJellyfishCard.loadout = new SerializableLoadout(); CannonballJellyfishCard.noElites = false; CannonballJellyfishCard.forbiddenAsBoss = false; DirectorCardHolder val = new DirectorCardHolder { Card = new DirectorCard { spawnCard = (SpawnCard)CannonballJellyfishCard, selectionWeight = 1 }, MonsterCategory = (MonsterCategory)2 }; Helpers.AddNewMonsterToStage(val, false, (Stage)1, "observatory_wormsworms"); Helpers.AddNewMonsterToStage(val, false, (Stage)1, "itobservatory_wormsworms"); Log.Debug("Cannonball Jellyfish added to ancient observatory spawn pool."); } } } [BepInPlugin("wormsworms.Ancient_Observatory", "Ancient_Observatory", "2.0.0")] public class Promenade : BaseUnityPlugin { public enum aoLightingMode { Night, Day, NightAfterLooping, DayAfterLooping, Random } public const string Author = "wormsworms"; public const string Name = "Ancient_Observatory"; public const string Version = "2.0.0"; public const string GUID = "wormsworms.Ancient_Observatory"; public static Promenade instance; public static ConfigEntry<bool> enableRegular; public static ConfigEntry<bool> enableSimulacrum; public static ConfigEntry<bool> stage1Simulacrum; public static ConfigEntry<aoLightingMode> observatoryLighting; public static ConfigEntry<bool> toggleSwift; public static ConfigEntry<bool> toggleColossus; public static ConfigEntry<bool> toggleCannonballJellyfish; public static ConfigEntry<bool> toggleBrassMonolith; public static ConfigEntry<bool> toggleAncientWisp; 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); SceneManager.sceneLoaded += SceneSetup; RoR2Application.onLoadFinished = (Action)Delegate.Combine(RoR2Application.onLoadFinished, new Action(AddModdedEnemies)); } public static void AddModdedEnemies() { if (IsEnemiesReturns.enabled) { EnemiesReturnsCompat.AddEnemies(); } if (IsSandswept.enabled) { SandsweptCompat.AddEnemies(); } if (IsForgottenRelics.enabled) { ForgottenRelicsCompat.AddEnemies(); } if (IsAncientWisp.enabled) { AncientWispCompat.AddEnemies(); } } private void MusicController_StartIntroMusic(orig_StartIntroMusic orig, MusicController self) { orig.Invoke(self); AkSoundEngine.PostEvent("WORM_AO_Play_Music_System", ((Component)self).gameObject); } public void SceneSetup(Scene newScene, LoadSceneMode loadSceneMode) { if (((Scene)(ref newScene)).name == "itobservatory_wormsworms") { BroadcastMusicString(); GameObject.Find("Directional Light").GetComponent<Light>().shadowStrength = 0.3f; GameObject val = GameObject.Find("HOLDER: Gameplay Space/Misc./Workshop"); Material iTStoneMaterial = PromenadeContent.ITStoneMaterial; MeshRenderer val2 = default(MeshRenderer); for (int i = 0; i < val.transform.childCount; i++) { ((Component)((Component)val.transform.GetChild(i)).gameObject.transform.GetChild(0)).TryGetComponent<MeshRenderer>(ref val2); ((Renderer)val2).material = iTStoneMaterial; } } if (!(((Scene)(ref newScene)).name == "observatory_wormsworms")) { return; } ChangeLighting(); BroadcastMusicString(); GameObject.Find("ShatteredMoonMesh").layer = 9; GameObject val3 = GameObject.Find("MoonHolder"); GameObject val4 = GameObject.Find("SM_SkyboxPrefab(Clone)"); for (int j = 0; j < val3.transform.childCount; j++) { if (((Object)((Component)val3.transform.GetChild(j)).gameObject).name.Contains("Cloud")) { Object.Destroy((Object)(object)((Component)val3.transform.GetChild(j)).gameObject); } } for (int k = 0; k < val4.transform.childCount; k++) { if (((Object)((Component)val4.transform.GetChild(k)).gameObject).name.Contains("Cloud")) { Object.Destroy((Object)(object)((Component)val4.transform.GetChild(k)).gameObject); } } GameObject val5 = GameObject.Find("HOLDER: Gameplay Space/Misc./Workshop"); Material stoneMaterial = PromenadeContent.StoneMaterial; MeshRenderer val6 = default(MeshRenderer); for (int l = 0; l < val5.transform.childCount; l++) { ((Component)((Component)val5.transform.GetChild(l)).gameObject.transform.GetChild(0)).TryGetComponent<MeshRenderer>(ref val6); ((Renderer)val6).material = stoneMaterial; } string[] array = new string[26] { "MS_FloatingIsland1", "Final Zone/Grass", "ChainlinkSet", "ChainlinkSet (1)", "ChainlinkSet (2)", "ChainlinkSet (3)", "TP Area Holder/MiscProps", "LShapeScaffolding", "StaircaseScaffolding", "Formula/spmSMGrassSmallCluster", "Formula/spmSMGrassSmallCluster (1)", "Formula/spmSMGrassSmallCluster (2)", "Formula/spmSMFruitPlant", "PortalDialer/spmSMGrassSmallCluster (3)", "PortalDialer/spmSMGrassSmallCluster (4)", "PortalDialerButton 1", "PortalDialerButton 2", "PortalDialerButton 3", "PortalDialerButton 4", "PortalDialerButton 5", "PortalDialerButton 6", "PortalDialerButton 7", "PortalDialerButton 8", "PortalDialerButton 9", "PortalDialer", "Final Zone/MiscProps" }; foreach (string text in array) { if ((Object)(object)GameObject.Find(text) != (Object)null) { Object.Destroy((Object)(object)GameObject.Find(text)); } } Material metalMaterial = PromenadeContent.MetalMaterial; GameObject val7 = GameObject.Find("Final Zone/PowerLines"); GameObject val8 = GameObject.Find("ButtonContainer/Barriers"); string[] array2 = new string[6] { "LOP_ArtifactLaptop(Clone)/FW_Crate", "mega teleporter/PowerLine, Huge", "Powerline/SM_PowerLine(Clone)", "FW_CellTowerSnowy(Clone)/HumanLargeCellTowerMesh", "LOP_ArtifactLaptop(Clone)/FW_Crate", "PowerCoil, 1/PowerLine1 (1)" }; MeshRenderer val9 = default(MeshRenderer); for (int n = 0; n < val7.transform.childCount; n++) { if (((Object)val7.transform.GetChild(n)).name.Contains("PowerLine")) { ((Component)val7.transform.GetChild(n)).TryGetComponent<MeshRenderer>(ref val9); ((Renderer)val9).material = metalMaterial; } } MeshRenderer val10 = default(MeshRenderer); for (int num = 0; num < val8.transform.childCount; num++) { if (((Object)val8.transform.GetChild(num)).name.Contains("PowerLine")) { ((Component)val8.transform.GetChild(num)).TryGetComponent<MeshRenderer>(ref val10); ((Renderer)val10).material = metalMaterial; } } array = array2; MeshRenderer val11 = default(MeshRenderer); foreach (string text2 in array) { if ((Object)(object)GameObject.Find(text2) != (Object)null) { GameObject.Find(text2).TryGetComponent<MeshRenderer>(ref val11); ((Renderer)val11).material = metalMaterial; } } } private void BroadcastMusicString() { //IL_000e: 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_001f: Expected O, but got Unknown if (NetworkServer.active) { string baseToken = "WORM_CHAT_AO_SONGPLAYING"; Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage { baseToken = baseToken }); } } private void ChangeLighting() { GameObject val = GameObject.Find("HOLDER: Time/Day"); GameObject val2 = GameObject.Find("HOLDER: Time/Night"); if (observatoryLighting.Value == aoLightingMode.Night) { val.SetActive(false); val2.SetActive(true); } else if (observatoryLighting.Value == aoLightingMode.Day) { val.SetActive(true); val2.SetActive(false); } else if (observatoryLighting.Value == aoLightingMode.NightAfterLooping) { if (Run.instance.stageClearCount >= 5) { val.SetActive(false); val2.SetActive(true); } else { val.SetActive(true); val2.SetActive(false); } } else if (observatoryLighting.Value == aoLightingMode.DayAfterLooping) { if (Run.instance.stageClearCount >= 5) { val.SetActive(true); val2.SetActive(false); } else { val.SetActive(false); val2.SetActive(true); } } else if (observatoryLighting.Value == aoLightingMode.Random) { if ((float)new Random().Next(0, 2) > 0.5f) { val.SetActive(false); val2.SetActive(true); } else { val.SetActive(true); val2.SetActive(false); } } else { Log.Error("Couldn't find a valid value for the Map Lighting config setting. Defaulting to night. Current value: " + observatoryLighting.Value); val.SetActive(false); val2.SetActive(true); } } private void Destroy() { Language.collectLanguageRootFolders -= CollectLanguageRootFolders; } private static void GiveToRoR2OurContentPackProviders(AddContentPackProviderDelegate addContentPackProvider) { addContentPackProvider.Invoke((IContentPackProvider)(object)new ContentProvider()); } public void CollectLanguageRootFolders(List<string> 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 ConfigSetup() { enableRegular = ((BaseUnityPlugin)this).Config.Bind<bool>("00 - Stages", "Enable Ancient Observatory", true, "If set to false, Ancient Observatory will never appear in regular runs."); enableSimulacrum = ((BaseUnityPlugin)this).Config.Bind<bool>("00 - Stages", "Enable Simulacrum Variant", true, "If set to false, Ancient Observatory will never appear in the Simulacrum."); stage1Simulacrum = ((BaseUnityPlugin)this).Config.Bind<bool>("00 - Stages", "Enable Simulacrum Variant on Stage 1", true, "If set to false, Ancient Observatory will only appear after clearing at least one stage in the Simulacrum."); observatoryLighting = ((BaseUnityPlugin)this).Config.Bind<aoLightingMode>("00 - Stages", "Ancient Observatory - Stage Lighting", aoLightingMode.DayAfterLooping, "Set the stage's lighting. Day is the map's original lighting, prior to version 2.0.0."); toggleSwift = ((BaseUnityPlugin)this).Config.Bind<bool>("01 - Monsters: EnemiesReturns", "Enable Swift", true, "If set to false, Swifts will not appear in Ancient Observatory."); toggleColossus = ((BaseUnityPlugin)this).Config.Bind<bool>("01 - Monsters: EnemiesReturns", "Enable Colossus", true, "If set to false, Colossi will not appear in Ancient Observatory."); toggleCannonballJellyfish = ((BaseUnityPlugin)this).Config.Bind<bool>("03 - Monsters: Sandswept", "Enable Cannonball Jellyfish", true, "If set to false, Cannonball Jellyfish will not appear in Ancient Observatory."); toggleBrassMonolith = ((BaseUnityPlugin)this).Config.Bind<bool>("02 - Monsters: Forgotten Relics", "Enable Brass Monolith", true, "If set to false, Brass Monoliths will not appear in Ancient Observatory."); toggleAncientWisp = ((BaseUnityPlugin)this).Config.Bind<bool>("04 - Monsters: Other", "Enable Ancient Wisp", true, "If set to false, Ancient Wisps will not appear in Ancient Observatory."); } } } namespace Promenade.Content { public class ContentProvider : IContentPackProvider { private readonly ContentPack _contentPack = new ContentPack(); public static string assetDirectory; internal const string MusicSoundBankFileName = "WormAOMusic.bnk"; internal const string InitSoundBankFileName = "WormAOMusicInit.bnk"; public string identifier => "wormsworms.Ancient_Observatory.ContentProvider"; public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args) { _contentPack.identifier = identifier; string assetsFolderFullPath = (assetDirectory = Path.GetDirectoryName(typeof(ContentProvider).Assembly.Location)); LoadSoundBanks(Path.Combine(Path.GetDirectoryName(typeof(ContentProvider).Assembly.Location), "Soundbanks")); AssetBundle scenesAssetBundle = null; yield return LoadAssetBundle(Path.Combine(assetsFolderFullPath, "observatoryscenes"), args.progressReceiver, delegate(AssetBundle assetBundle) { scenesAssetBundle = assetBundle; }); AssetBundle assetsAssetBundle = null; yield return LoadAssetBundle(Path.Combine(assetsFolderFullPath, "observatoryassets"), args.progressReceiver, delegate(AssetBundle assetBundle) { assetsAssetBundle = assetBundle; }); yield return PromenadeContent.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) CustomMusicTrackDef val = ScriptableObject.CreateInstance<CustomMusicTrackDef>(); ((Object)val).name = "AncientObservatoryMainMusic"; ((MusicTrackDef)val).cachedName = "AncientObservatoryMainMusic"; ((MusicTrackDef)val).comment = "\r\nJared Damron - Ancient Observatory stage theme\r\nancientobservatory_wormsworms"; val.CustomStates = new List<CustomState>(); CustomState item = new CustomState { GroupId = 351601992u, StateId = 4279525798u }; val.CustomStates.Add(item); CustomState item2 = new CustomState { GroupId = 792781730u, StateId = 89505537u }; val.CustomStates.Add(item2); PromenadeContent.PromenadeSceneDef.mainTrack = (MusicTrackDef)(object)val; PromenadeContent.SimuSceneDef.mainTrack = (MusicTrackDef)(object)val; } 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("WormAOMusicInit.bnk", ref num); if ((int)val == 1) { Log.Info("Added bank : WormAOMusicInit.bnk"); } else { Log.Error("Error loading bank : WormAOMusicInit.bnk " + $"Error code : {val}"); } val = AkSoundEngine.LoadBank("WormAOMusic.bnk", ref num); if ((int)val == 1) { Log.Info("Added bank : WormAOMusic.bnk"); } else { Log.Error("Error loading bank : WormAOMusic.bnk " + $"Error code : {val}"); } } private IEnumerator LoadAssetBundle(string assetBundleFullPath, IProgress<float> progress, Action<AssetBundle> 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 PromenadeContent { internal const string ScenesAssetBundleFileName = "observatoryscenes"; internal const string AssetsAssetBundleFileName = "observatoryassets"; private static AssetBundle _scenesAssetBundle; private static AssetBundle _assetsAssetBundle; internal static UnlockableDef[] UnlockableDefs; internal static SceneDef[] SceneDefs; internal static SceneDef PromenadeSceneDef; internal static Sprite PromenadeSceneDefPreviewSprite; internal static Material PromenadeBazaarSeer; internal static SceneDef SimuSceneDef; internal static Sprite SimuSceneDefPreviewSprite; internal static Material SimuBazaarSeer; internal static Material MetalMaterial; internal static Material StoneMaterial; internal static Material ITStoneMaterial; public static List<Material> SwappedMaterials = new List<Material>(); internal static IEnumerator LoadAssetBundlesAsync(AssetBundle scenesAssetBundle, AssetBundle assetsAssetBundle, IProgress<float> progress, ContentPack contentPack) { _scenesAssetBundle = scenesAssetBundle; _assetsAssetBundle = assetsAssetBundle; IEnumerator upgradeStubbedShaders = ShaderSwapper.UpgradeStubbedShadersAsync(_assetsAssetBundle); while (upgradeStubbedShaders.MoveNext()) { yield return upgradeStubbedShaders.Current; } yield return LoadAllAssetsAsync<UnlockableDef>(assetsAssetBundle, progress, (Action<UnlockableDef[]>)delegate(UnlockableDef[] assets) { contentPack.unlockableDefs.Add(assets); }); yield return LoadAllAssetsAsync<Material>(_assetsAssetBundle, progress, (Action<Material[]>)delegate(Material[] assets) { MetalMaterial = assets.First((Material a) => ((Object)a).name == "matAOMetal"); StoneMaterial = assets.First((Material a) => ((Object)a).name == "matAOStone"); ITStoneMaterial = assets.First((Material a) => ((Object)a).name == "matITAOStone"); }); yield return LoadAllAssetsAsync<SceneDef>(_assetsAssetBundle, progress, (Action<SceneDef[]>)delegate(SceneDef[] assets) { SceneDefs = assets; PromenadeSceneDef = SceneDefs.First((SceneDef sd) => sd.baseSceneNameOverride == "observatory_wormsworms"); SimuSceneDef = SceneDefs.First((SceneDef sd) => sd.baseSceneNameOverride == "itobservatory_wormsworms"); Log.Debug(PromenadeSceneDef.nameToken); Log.Debug(SimuSceneDef.nameToken); contentPack.sceneDefs.Add(assets); }); PromenadeSceneDef.portalMaterial = StageRegistration.MakeBazaarSeerMaterial((Texture2D)PromenadeSceneDef.previewTexture); AsyncOperationHandle<MusicTrackDef> bossTrackDefRequest = Addressables.LoadAssetAsync<MusicTrackDef>((object)"RoR2/Base/Common/MusicTrackDefs/muSong23.asset"); while (!bossTrackDefRequest.IsDone) { yield return null; } ContentProvider.SetupMusic(); PromenadeSceneDef.bossTrack = bossTrackDefRequest.Result; SimuSceneDef.bossTrack = bossTrackDefRequest.Result; if (Promenade.enableRegular.Value) { StageRegistration.RegisterSceneDefToNormalProgression(PromenadeSceneDef, 1f, true, true); } if (Promenade.enableSimulacrum.Value && Promenade.stage1Simulacrum.Value) { Simulacrum.RegisterSceneToSimulacrum(SimuSceneDef); } else if (Promenade.enableSimulacrum.Value && !Promenade.stage1Simulacrum.Value) { Simulacrum.RegisterSceneToSimulacrum(SimuSceneDef, canBeStage1: false); } } internal static void Unload() { _assetsAssetBundle.Unload(true); _scenesAssetBundle.Unload(true); } private static IEnumerator LoadAllAssetsAsync<T>(AssetBundle assetBundle, IProgress<float> progress, Action<T[]> onAssetsLoaded) where T : Object { AssetBundleRequest sceneDefsRequest = assetBundle.LoadAllAssetsAsync<T>(); while (!((AsyncOperation)sceneDefsRequest).isDone) { progress.Report(((AsyncOperation)sceneDefsRequest).progress); yield return null; } onAssetsLoaded(sceneDefsRequest.allAssets.Cast<T>().ToArray()); } } 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<SceneCollection>((object)"RoR2/DLC1/GameModes/InfiniteTowerRun/SceneGroups/sgInfiniteTowerStageX.asset").WaitForCompletion(); SceneCollection val2 = Addressables.LoadAssetAsync<SceneCollection>((object)"RoR2/DLC1/GameModes/InfiniteTowerRun/SceneGroups/sgInfiniteTowerStage1.asset").WaitForCompletion(); List<SceneCollection> list = new List<SceneCollection>(); Enumerator<SceneEntry> 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/*cast due to .constrained prefix*/).Dispose(); } SceneCollection val3 = ScriptableObject.CreateInstance<SceneCollection>(); ((Object)val3).name = "sgInfiniteTowerStageX" + sceneDef.cachedName; val3._sceneEntries = val._sceneEntries; sceneDef.destinationsGroup = val3; SceneEntry val4 = new SceneEntry { sceneDef = sceneDef, weightMinusOne = weight - 1f }; ArrayUtils.ArrayAppend<SceneEntry>(ref val._sceneEntries, ref val4); if (canBeStage1) { ArrayUtils.ArrayAppend<SceneEntry>(ref val2._sceneEntries, ref val4); } foreach (SceneCollection item in list) { ArrayUtils.ArrayAppend<SceneEntry>(ref item._sceneEntries, ref val4); } } } }