Decompiled source of Catacombs v1.0.4

plugins/viliger-Catacombs/Catacombs.dll

Decompiled 2 months ago
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.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using DS1Catacombs.Content;
using DireseekerMod.Modules;
using EntityStates;
using HG;
using HG.Reflection;
using On.RoR2;
using R2API;
using RoR2;
using RoR2.ContentManagement;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Catacombs")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Catacombs")]
[assembly: AssemblyTitle("Catacombs")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace DS1Catacombs
{
	public static class DireseekerCompat
	{
		private static bool? _enabled;

		public static bool enabled
		{
			get
			{
				if (!_enabled.HasValue)
				{
					_enabled = Chainloader.PluginInfos.ContainsKey("com.rob.Direseeker");
				}
				return _enabled.Value;
			}
		}

		public static CharacterSpawnCard GetDireseekerSpawnCard()
		{
			return SpawnCards.bossSpawnCard;
		}
	}
	[BepInPlugin("com.Viliger.DS1Catacombs", "DS1Catacombs", "1.0.4")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class DS1CatacombsPlugin : BaseUnityPlugin
	{
		public const string Author = "Viliger";

		public const string Name = "DS1CatacombsPlugin";

		public const string Version = "1.0.4";

		public const string GUID = "Viliger.DS1CatacombsPlugin";

		public static ConfigEntry<bool> EnableShitpostMusic;

		public static ConfigEntry<bool> AnyoneCanDestroyWalls;

		public static DS1CatacombsPlugin instance;

		public static PluginInfo PluginInfo;

		private void Awake()
		{
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Expected O, but got Unknown
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Expected O, but got Unknown
			//IL_0096: 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_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: 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_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Expected O, but got Unknown
			//IL_00cd: 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_00e0: Expected O, but got Unknown
			EnableShitpostMusic = ((BaseUnityPlugin)this).Config.Bind<bool>("Catacombs", "Enable shitpost music", false, "Enables shitpost music.");
			AnyoneCanDestroyWalls = ((BaseUnityPlugin)this).Config.Bind<bool>("Catacombs", "Anyone can destroy walls", false, "Wall destruction is no longer minor exclusive.");
			instance = this;
			PluginInfo = ((BaseUnityPlugin)this).Info;
			Log.Init(((BaseUnityPlugin)this).Logger);
			MusicController.StartIntroMusic += new hook_StartIntroMusic(MusicController_StartIntroMusic);
			ContentManager.collectContentPackProviders += new CollectContentPackProvidersDelegate(GiveToRoR2OurContentPackProviders);
			Language.collectLanguageRootFolders += CollectLanguageRootFolders;
			if (DireseekerCompat.enabled)
			{
				Helpers.AddNewMonsterToStage(new DirectorCardHolder
				{
					Card = new DirectorCard
					{
						spawnCard = (SpawnCard)(object)DireseekerCompat.GetDireseekerSpawnCard(),
						selectionWeight = 3,
						spawnDistance = (MonsterSpawnDistance)0,
						preventOverhead = false,
						minimumStageCompletions = 5
					},
					MonsterCategory = (MonsterCategory)4
				}, false, (Stage)1, "catacombs_DS1_Catacombs");
			}
		}

		private void MusicController_StartIntroMusic(orig_StartIntroMusic orig, MusicController self)
		{
			orig.Invoke(self);
			AkSoundEngine.PostEvent("DS1_Play_Music_System", ((Component)self).gameObject);
		}

		private void Destroy()
		{
			Language.collectLanguageRootFolders -= CollectLanguageRootFolders;
		}

		private 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"));
		}
	}
	public class DestructibleWallDeath : BaseState
	{
		public override void OnEnter()
		{
			//IL_0030: 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_005a: 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_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: 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_0083: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			if (Object.op_Implicit((Object)(object)((EntityState)this).gameObject.transform.Find("Model/WorldCollider")))
			{
				GameObject val = Object.Instantiate<GameObject>(DS1CatacombsContent.FracturedWall, ((EntityState)this).transform.position, ((EntityState)this).transform.rotation);
				Rigidbody[] componentsInChildren = val.GetComponentsInChildren<Rigidbody>();
				foreach (Rigidbody obj in componentsInChildren)
				{
					Vector3 val2 = ((Component)obj).transform.position - ((EntityState)this).transform.position;
					Vector3 val3 = ((Vector3)(ref val2)).normalized * 10f;
					obj.AddForce(val3);
				}
				AkSoundEngine.PostEvent("DS1_Wall_Destroy", val);
				EntityState.Destroy((Object)(object)((EntityState)this).gameObject);
			}
			else
			{
				Log.Debug("couldn't find WorldCollider");
			}
		}
	}
	public class DestructibleWallMainState : Idle
	{
		public override void OnEnter()
		{
			((EntityState)this).OnEnter();
			if (NetworkServer.active)
			{
				((EntityState)this).characterBody.AddBuff(Buffs.HiddenInvincibility);
			}
		}
	}
	public class EasterEggOnEnterManager : MonoBehaviour
	{
		public Transform chestSpawnLocation;

		public GameObject Vamos;

		private bool triggered;

		private void OnTriggerEnter(Collider other)
		{
			HurtBox val = default(HurtBox);
			if (!triggered && ((Component)other).gameObject.TryGetComponent<HurtBox>(ref val))
			{
				triggered = true;
				VamosBegoneWithYou();
			}
		}

		private void VamosBegoneWithYou()
		{
			AkSoundEngine.PostEvent("DS1_Vamos_Begone", Vamos);
			((MonoBehaviour)this).Invoke("MakeVamosMove", 2f);
		}

		private void VamosFocus()
		{
			AkSoundEngine.PostEvent("DS1_Vamos_Focus", Vamos);
		}

		private void MakeVamosMove()
		{
			PathFollower pathFollower = default(PathFollower);
			if (Object.op_Implicit((Object)(object)Vamos) && Vamos.TryGetComponent<PathFollower>(ref pathFollower))
			{
				((Behaviour)pathFollower).enabled = true;
			}
			((MonoBehaviour)this).Invoke("VamosFocus", 2f);
			((MonoBehaviour)this).Invoke("SpawnChest", 3f);
		}

		private void SpawnChest()
		{
			//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)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkServer.active)
			{
				GameObject obj = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/GoldChest/GoldChest.prefab").WaitForCompletion();
				obj.transform.localPosition = new Vector3(0.6709f, -1.0345f, 0f);
				obj.GetComponent<PurchaseInteraction>().automaticallyScaleCostWithDifficulty = true;
				NetworkServer.Spawn(Object.Instantiate<GameObject>(obj, chestSpawnLocation));
			}
		}
	}
	public class PathFollower : MonoBehaviour
	{
		public Transform[] path;

		public float speed = 5f;

		public float reachDist = 1f;

		private int currentPoint;

		private void FixedUpdate()
		{
			//IL_000d: 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_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			float num = Vector3.Distance(path[currentPoint].position, ((Component)this).transform.position);
			((Component)this).transform.position = Vector3.MoveTowards(((Component)this).transform.position, path[currentPoint].position, Time.deltaTime * speed);
			if (num <= reachDist)
			{
				currentPoint++;
			}
			if (currentPoint >= path.Length)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}
	}
	public class WallIncomingDamageReciever : MonoBehaviour, IOnIncomingDamageServerReceiver
	{
		public void OnIncomingDamageServer(DamageInfo damageInfo)
		{
			//IL_0032: 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)
			if (((Object)damageInfo.attacker).name.Contains("MinerBody") || DS1CatacombsPlugin.AnyoneCanDestroyWalls.Value)
			{
				((Component)this).gameObject.GetComponent<HealthComponent>().Suicide((GameObject)null, (GameObject)null, default(DamageTypeCombo));
			}
		}
	}
	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 PlaySound : MonoBehaviour
	{
		public string EnableSound;

		public string DisableSound;

		private void Start()
		{
			Util.PlaySound(EnableSound, ((Component)this).gameObject);
		}

		private void OnDisable()
		{
			Util.PlaySound(DisableSound, ((Component)this).gameObject);
		}
	}
}
namespace DS1Catacombs.Content
{
	public class ContentProvider : IContentPackProvider
	{
		private readonly ContentPack _contentPack = new ContentPack();

		public static string assetDirectory;

		public string identifier => "Viliger.DS1CatacombsPlugin.ContentProvider";

		public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args)
		{
			_contentPack.identifier = identifier;
			string assetsFolderFullPath = (assetDirectory = Path.Combine(Path.GetDirectoryName(typeof(ContentProvider).Assembly.Location), "assetbundles"));
			string musicFolderFullPath = Path.Combine(Path.GetDirectoryName(typeof(ContentProvider).Assembly.Location), "Soundbanks");
			DS1CatacombsContent.LoadSoundBank(musicFolderFullPath);
			AssetBundle scenesAssetBundle = null;
			yield return LoadAssetBundle(Path.Combine(assetsFolderFullPath, "catacombsstage"), args.progressReceiver, delegate(AssetBundle assetBundle)
			{
				scenesAssetBundle = assetBundle;
			});
			AssetBundle assetsAssetBundle = null;
			yield return LoadAssetBundle(Path.Combine(assetsFolderFullPath, "catacombsassets"), args.progressReceiver, delegate(AssetBundle assetBundle)
			{
				assetsAssetBundle = assetBundle;
			});
			yield return DS1CatacombsContent.LoadAssetBundlesAsync(scenesAssetBundle, assetsAssetBundle, args.progressReceiver, _contentPack, musicFolderFullPath);
		}

		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 DS1CatacombsContent
	{
		internal const string ScenesAssetBundleFileName = "catacombsstage";

		internal const string AssetsAssetBundleFileName = "catacombsassets";

		internal const string SoundBankFileName = "DS1CatacombsMusic.bnk";

		internal const string InitSoundBankFileName = "DS1CatacombsInit.bnk";

		internal const string SoundEffectsSoundBankFileName = "DS1CatacombsSounds.bnk";

		private static AssetBundle _scenesAssetBundle;

		private static AssetBundle _assetsAssetBundle;

		internal static UnlockableDef[] UnlockableDefs;

		internal static SceneDef[] SceneDefs;

		public static SceneDef DS1SceneDef;

		internal static Sprite DS1ScenePreviewSprite;

		internal static Material DS1BazaarSeer;

		public static GameObject FracturedWall;

		public static List<Material> SwappedMaterials = new List<Material>();

		public static Dictionary<string, string> ShaderLookup = new Dictionary<string, string>
		{
			{ "stubbedror2/base/shaders/hgstandard", "RoR2/Base/Shaders/HGStandard.shader" },
			{ "stubbedror2/base/shaders/hgsnowtopped", "RoR2/Base/Shaders/HGSnowTopped.shader" },
			{ "stubbedror2/base/shaders/hgtriplanarterrainblend", "RoR2/Base/Shaders/HGTriplanarTerrainBlend.shader" },
			{ "stubbedror2/base/shaders/hgintersectioncloudremap", "RoR2/Base/Shaders/HGIntersectionCloudRemap.shader" },
			{ "stubbedror2/base/shaders/hgcloudremap", "RoR2/Base/Shaders/HGCloudRemap.shader" },
			{ "stubbedror2/base/shaders/hgdistortion", "RoR2/Base/Shaders/HGDistortion.shader" },
			{ "stubbedcalm water/calmwater - dx11 - doublesided", "Calm Water/CalmWater - DX11 - DoubleSided.shader" },
			{ "stubbedcalm water/calmwater - dx11", "Calm Water/CalmWater - DX11.shader" },
			{ "stubbednature/speedtree", "RoR2/Base/Shaders/SpeedTreeCustom.shader" }
		};

		internal static void LoadSoundBank(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_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: 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_00c9: Invalid comparison between Unknown and I4
			//IL_00e0: 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("DS1CatacombsInit.bnk", ref num);
			if ((int)val == 1)
			{
				Log.Info("Added bank : DS1CatacombsInit.bnk");
			}
			else
			{
				Log.Error("Error loading bank : DS1CatacombsInit.bnk " + $"Error code : {val}");
			}
			val = AkSoundEngine.LoadBank("DS1CatacombsMusic.bnk", ref num);
			if ((int)val == 1)
			{
				Log.Info("Added bank : DS1CatacombsMusic.bnk");
			}
			else
			{
				Log.Error("Error loading bank : DS1CatacombsMusic.bnk " + $"Error code : {val}");
			}
			val = AkSoundEngine.LoadBank("DS1CatacombsSounds.bnk", ref num);
			if ((int)val == 1)
			{
				Log.Info("Added bank : DS1CatacombsSounds.bnk");
			}
			else
			{
				Log.Error("Error loading bank : DS1CatacombsSounds.bnk " + $"Error code : {val}");
			}
		}

		internal static IEnumerator LoadAssetBundlesAsync(AssetBundle scenesAssetBundle, AssetBundle assetsAssetBundle, IProgress<float> progress, ContentPack contentPack, string musicFolderFullPath)
		{
			_scenesAssetBundle = scenesAssetBundle;
			_assetsAssetBundle = assetsAssetBundle;
			Log.Debug("Asset bundles found. Loading asset bundles...");
			yield return LoadAllAssetsAsync<Material>(_assetsAssetBundle, progress, (Action<Material[]>)delegate(Material[] assets)
			{
				//IL_0040: Unknown result type (might be due to invalid IL or missing references)
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				if (assets != null)
				{
					Material[] array = assets;
					foreach (Material val4 in array)
					{
						if (((Object)val4.shader).name.StartsWith("Stubbed"))
						{
							Shader val5 = Addressables.LoadAssetAsync<Shader>((object)ShaderLookup[((Object)val4.shader).name.ToLower()]).WaitForCompletion();
							if (Object.op_Implicit((Object)(object)val5))
							{
								val4.shader = val5;
								SwappedMaterials.Add(val4);
							}
						}
					}
				}
			});
			yield return LoadAllAssetsAsync<UnlockableDef>(_assetsAssetBundle, progress, (Action<UnlockableDef[]>)delegate(UnlockableDef[] assets)
			{
				UnlockableDefs = assets;
				contentPack.unlockableDefs.Add(assets);
			});
			yield return LoadAllAssetsAsync<Sprite>(_assetsAssetBundle, progress, (Action<Sprite[]>)delegate(Sprite[] assets)
			{
				DS1ScenePreviewSprite = assets.First((Sprite a) => ((Object)a).name == "texCatacombsPreview");
			});
			yield return LoadAllAssetsAsync<SceneDef>(_assetsAssetBundle, progress, (Action<SceneDef[]>)delegate(SceneDef[] assets)
			{
				SceneDefs = assets;
				DS1SceneDef = SceneDefs.First((SceneDef sd) => sd.cachedName == "catacombs_DS1_Catacombs");
				Log.Debug(DS1SceneDef.nameToken);
				contentPack.sceneDefs.Add(assets);
			});
			yield return LoadAllAssetsAsync<GameObject>(_assetsAssetBundle, progress, (Action<GameObject[]>)delegate(GameObject[] assets)
			{
				FracturedWall = assets.First((GameObject go) => ((Object)go).name == "fracturedwall_prefab");
				GameObject val3 = assets.First((GameObject go) => ((Object)go).name == "LowerCryptWall");
				contentPack.networkedObjectPrefabs.Add((GameObject[])(object)new GameObject[1] { val3 });
			});
			contentPack.entityStateTypes.Add(new Type[1] { typeof(DestructibleWallDeath) });
			contentPack.networkSoundEventDefs.Add((NetworkSoundEventDef[])(object)new NetworkSoundEventDef[3]
			{
				CreateNetworkSoundEventDef("DS1_Vamos_Focus"),
				CreateNetworkSoundEventDef("DS1_Vamos_Begone"),
				CreateNetworkSoundEventDef("DS1_Wall_Destroy")
			});
			Material val = Object.Instantiate<Material>(Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/bazaar/matBazaarSeerWispgraveyard.mat").WaitForCompletion());
			val.mainTexture = (Texture)(object)DS1ScenePreviewSprite.texture;
			DS1SceneDef.previewTexture = (Texture)(object)DS1ScenePreviewSprite.texture;
			DS1SceneDef.portalMaterial = val;
			SetupMusic();
			ref SceneEntry[] sceneEntries = ref Addressables.LoadAssetAsync<SceneCollection>((object)"RoR2/Base/SceneGroups/sgStage2.asset").WaitForCompletion()._sceneEntries;
			SceneEntry val2 = new SceneEntry
			{
				sceneDef = DS1SceneDef
			};
			((SceneEntry)(ref val2)).weight = 1f;
			ArrayUtils.ArrayAppend<SceneEntry>(ref sceneEntries, ref val2);
			DS1SceneDef.destinationsGroup = Addressables.LoadAssetAsync<SceneCollection>((object)"RoR2/Base/SceneGroups/sgStage3.asset").WaitForCompletion();
			ref SceneEntry[] sceneEntries2 = ref Addressables.LoadAssetAsync<SceneCollection>((object)"RoR2/Base/SceneGroups/loopSgStage2.asset").WaitForCompletion()._sceneEntries;
			val2 = new SceneEntry
			{
				sceneDef = DS1SceneDef
			};
			((SceneEntry)(ref val2)).weight = 1f;
			ArrayUtils.ArrayAppend<SceneEntry>(ref sceneEntries2, ref val2);
			DS1SceneDef.loopedDestinationsGroup = Addressables.LoadAssetAsync<SceneCollection>((object)"RoR2/Base/SceneGroups/loopSgStage3.asset").WaitForCompletion();
		}

		private static void SetupMusic()
		{
			//IL_0029: 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_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: 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_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			CustomMusicTrackDef val = ScriptableObject.CreateInstance<CustomMusicTrackDef>();
			((MusicTrackDef)val).cachedName = "DS1CustomMainMusic";
			((MusicTrackDef)val).comment = "Aurora Borealis\r\nDS1Catacombs";
			val.CustomStates = new List<CustomState>();
			CustomState item = default(CustomState);
			item.GroupId = 487602916u;
			if (DS1CatacombsPlugin.EnableShitpostMusic.Value)
			{
				item.StateId = 1661578544u;
			}
			else
			{
				item.StateId = 2254536284u;
			}
			val.CustomStates.Add(item);
			CustomState item2 = default(CustomState);
			item2.GroupId = 792781730u;
			item2.StateId = 89505537u;
			val.CustomStates.Add(item2);
			DS1SceneDef.mainTrack = (MusicTrackDef)(object)val;
			CustomMusicTrackDef val2 = ScriptableObject.CreateInstance<CustomMusicTrackDef>();
			((MusicTrackDef)val2).cachedName = "DS1CustomBossMusic";
			((MusicTrackDef)val2).comment = "Dies Irae\r\nDS1Catacombs bosstrack";
			val2.CustomStates = new List<CustomState>();
			CustomState item3 = default(CustomState);
			item3.GroupId = 487602916u;
			if (DS1CatacombsPlugin.EnableShitpostMusic.Value)
			{
				item3.StateId = 2399718655u;
			}
			else
			{
				item3.StateId = 3699353111u;
			}
			val2.CustomStates.Add(item3);
			CustomState item4 = default(CustomState);
			item4.GroupId = 792781730u;
			item4.StateId = 580146960u;
			val2.CustomStates.Add(item4);
			DS1SceneDef.bossTrack = (MusicTrackDef)(object)val2;
		}

		private static NetworkSoundEventDef CreateNetworkSoundEventDef(string eventName)
		{
			NetworkSoundEventDef obj = ScriptableObject.CreateInstance<NetworkSoundEventDef>();
			obj.eventName = eventName;
			return obj;
		}

		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());
		}
	}
}