Decompiled source of RemoteVillage v1.2.0

plugins/viliger-RemoteVillage/AgateVillage.dll

Decompiled a month 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 HG;
using On.RoR2;
using R2API;
using RoR2;
using RoR2.ContentManagement;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using UnityEngine.ResourceManagement.AsyncOperations;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("AgateVillage")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("AgateVillage")]
[assembly: AssemblyTitle("AgateVillage")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace AgateVillage
{
	public class FishingInteractable : MonoBehaviour
	{
		private CharacterSpawnCard cscMagmaWorm;

		private CharacterSpawnCard cscElectricWorm;

		private BasicPickupDropTable dtChest1;

		private Transform spawnPoint;

		private Vector3 velocityVector = new Vector3(-1f, 65f, -35f);

		private void Awake()
		{
			//IL_0013: 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_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			AsyncOperationHandle<CharacterSpawnCard> magmaHandle = Addressables.LoadAssetAsync<CharacterSpawnCard>((object)"RoR2/Base/MagmaWorm/cscMagmaWorm.asset");
			if (magmaHandle.IsValid())
			{
				magmaHandle.Completed += delegate(AsyncOperationHandle<CharacterSpawnCard> result)
				{
					//IL_002a: Unknown result type (might be due to invalid IL or missing references)
					if (result.IsDone && Object.op_Implicit((Object)(object)result.Result))
					{
						cscMagmaWorm = result.Result;
					}
					Addressables.Release<CharacterSpawnCard>(magmaHandle);
				};
			}
			AsyncOperationHandle<CharacterSpawnCard> electricHandle = Addressables.LoadAssetAsync<CharacterSpawnCard>((object)"RoR2/Base/ElectricWorm/cscElectricWorm.asset");
			if (electricHandle.IsValid())
			{
				electricHandle.Completed += delegate(AsyncOperationHandle<CharacterSpawnCard> result)
				{
					//IL_002a: Unknown result type (might be due to invalid IL or missing references)
					if (result.IsDone && Object.op_Implicit((Object)(object)result.Result))
					{
						cscElectricWorm = result.Result;
					}
					Addressables.Release<CharacterSpawnCard>(electricHandle);
				};
			}
			AsyncOperationHandle<BasicPickupDropTable> chestHandle = Addressables.LoadAssetAsync<BasicPickupDropTable>((object)"RoR2/Base/Chest1/dtChest1.asset");
			if (chestHandle.IsValid())
			{
				chestHandle.Completed += delegate(AsyncOperationHandle<BasicPickupDropTable> result)
				{
					//IL_002a: Unknown result type (might be due to invalid IL or missing references)
					if (result.IsDone && Object.op_Implicit((Object)(object)result.Result))
					{
						dtChest1 = result.Result;
					}
					Addressables.Release<BasicPickupDropTable>(chestHandle);
				};
			}
			spawnPoint = ((Component)this).transform;
			ChildLocator component = ((Component)this).GetComponent<ChildLocator>();
			if (Object.op_Implicit((Object)(object)component))
			{
				Transform val = component.FindChild("BobberHead");
				if (Object.op_Implicit((Object)(object)val))
				{
					spawnPoint = val;
				}
			}
		}

		public void GoneFishing(Interactor interactor)
		{
			//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_0036: 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_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Expected O, but got Unknown
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Expected O, but got Unknown
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Expected O, but got Unknown
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//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_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Expected O, but got Unknown
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Expected O, but got Unknown
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Expected O, but got Unknown
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Expected O, but got Unknown
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Expected O, but got Unknown
			if (!NetworkServer.active)
			{
				return;
			}
			int num = Random.Range(0, 10000);
			if (num < 10)
			{
				if (Object.op_Implicit((Object)(object)cscElectricWorm))
				{
					DirectorSpawnRequest val = new DirectorSpawnRequest((SpawnCard)(object)cscElectricWorm, new DirectorPlacementRule
					{
						placementMode = (PlacementMode)3,
						position = spawnPoint.position,
						spawnOnTarget = spawnPoint
					}, RoR2Application.rng);
					val.ignoreTeamMemberLimit = true;
					val.teamIndexOverride = (TeamIndex)2;
					DirectorCore.instance.TrySpawnObject(val);
					Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
					{
						baseToken = "AGATE_VILLAGE_FISH_REALLY_BIG"
					});
				}
			}
			else if (num < 500)
			{
				if (Object.op_Implicit((Object)(object)cscMagmaWorm))
				{
					DirectorSpawnRequest val2 = new DirectorSpawnRequest((SpawnCard)(object)cscMagmaWorm, new DirectorPlacementRule
					{
						placementMode = (PlacementMode)0,
						position = spawnPoint.position,
						spawnOnTarget = spawnPoint
					}, RoR2Application.rng);
					val2.ignoreTeamMemberLimit = true;
					val2.teamIndexOverride = (TeamIndex)2;
					DirectorCore.instance.TrySpawnObject(val2);
					Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
					{
						baseToken = "AGATE_VILLAGE_FISH_BIG"
					});
				}
			}
			else if (num < 3500)
			{
				if (Object.op_Implicit((Object)(object)dtChest1))
				{
					Xoroshiro128Plus val3 = new Xoroshiro128Plus(Run.instance.treasureRng.nextUlong);
					PickupDropletController.CreatePickupDroplet(((PickupDropTable)dtChest1).GenerateDrop(val3), spawnPoint.position, velocityVector);
					Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
					{
						baseToken = "AGATE_VILLAGE_FISH_ITEM"
					});
				}
			}
			else
			{
				Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
				{
					baseToken = "AGATE_VILLAGE_FISH_NOTHING"
				});
			}
		}
	}
}
namespace RoR2_AgateVillage
{
	[BepInPlugin("Viliger.AgateVillagePlugin", "AgateVillagePlugin", "1.2.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class AgateVillagePlugin : BaseUnityPlugin
	{
		public const string Author = "Viliger";

		public const string Name = "AgateVillagePlugin";

		public const string Version = "1.2.0";

		public const string GUID = "Viliger.AgateVillagePlugin";

		public static ConfigEntry<bool> UseCustomMusic;

		private void Awake()
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Expected O, but got Unknown
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Expected O, but got Unknown
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: 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_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Expected O, but got Unknown
			Log.Init(((BaseUnityPlugin)this).Logger);
			UseCustomMusic = ((BaseUnityPlugin)this).Config.Bind<bool>("Custom Music", "Custom Music", true, "Does the stage use custom music.");
			ContentManager.collectContentPackProviders += new CollectContentPackProvidersDelegate(ContentManager_collectContentPackProviders);
			MusicController.StartIntroMusic += new hook_StartIntroMusic(MusicController_StartIntroMusic);
			Language.collectLanguageRootFolders += CollectLanguageRootFolders;
			DirectorCardCategorySelection mixEnemy = Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)"RoR2/Base/MixEnemy/dccsMixEnemy.asset").WaitForCompletion();
			if (RegigigasCompat.enabled)
			{
				DirectorCard regigigasSpawnCard = RegigigasCompat.GetRegigigasSpawnCard(mixEnemy);
				if (!((object)regigigasSpawnCard).Equals((object?)null))
				{
					Helpers.AddNewMonsterToStage(new DirectorCardHolder
					{
						Card = regigigasSpawnCard,
						MonsterCategory = (MonsterCategory)4
					}, false, (Stage)1, "agatevillage");
					Log.Info("Regigigas added to agatevillage spawn pool.");
				}
			}
			if (TyranitarCompat.enabled)
			{
				DirectorCard tyranitarSpawnCard = TyranitarCompat.GetTyranitarSpawnCard(mixEnemy);
				if (!((object)tyranitarSpawnCard).Equals((object?)null))
				{
					Helpers.AddNewMonsterToStage(new DirectorCardHolder
					{
						Card = tyranitarSpawnCard,
						MonsterCategory = (MonsterCategory)4
					}, false, (Stage)1, "agatevillage");
					Log.Info("Tyranitar added to agatevillage spawn pool.");
				}
			}
		}

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

		private void ContentManager_collectContentPackProviders(AddContentPackProviderDelegate addContentPackProvider)
		{
			addContentPackProvider.Invoke((IContentPackProvider)(object)new ContentProvider());
		}

		private void CollectLanguageRootFolders(List<string> folders)
		{
			folders.Add(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "Language"));
		}
	}
	public class CalculateNetworkCost : MonoBehaviour
	{
		private void Start()
		{
			if (NetworkServer.active)
			{
				PurchaseInteraction componentInChildren = ((Component)this).GetComponentInChildren<PurchaseInteraction>();
				if (Object.op_Implicit((Object)(object)componentInChildren))
				{
					componentInChildren.Networkcost = Run.instance.GetDifficultyScaledCost(componentInChildren.cost);
					componentInChildren.solitudeCost = componentInChildren.Networkcost;
				}
			}
		}
	}
	public class ContentProvider : IContentPackProvider
	{
		private readonly ContentPack _contentPack = new ContentPack();

		internal const string ScenesAssetBundleFileName = "agatevillagescene";

		internal const string AssetsAssetBundleFileName = "agatevillageassets";

		internal const string MusicSoundBankFileName = "AgateVillageMusic.bnk";

		internal const string InitSoundBankFileName = "AgateVillageInit.bnk";

		internal const string SoundsSoundBankFileName = "AgateVillageSounds.bnk";

		public static SceneDef AgateVillageSceneDef;

		public static readonly 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/hgopaquecloudremap", "RoR2/Base/Shaders/HGOpaqueCloudRemap.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" },
			{ "stubbeddecalicious/decaliciousdeferreddecal", "Decalicious/DecaliciousDeferredDecal.shader" },
			{ "stubbedror2/base/shaders/hggrass", "RoR2/Base/Shaders/HGGrass.shader" }
		};

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

		private static Sprite AgateVillagePreviewSprite;

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

		public IEnumerator FinalizeAsync(FinalizeAsyncArgs args)
		{
			args.ReportProgress(1f);
			yield break;
		}

		public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args)
		{
			ContentPack.Copy(_contentPack, args.output);
			args.ReportProgress(1f);
			yield break;
		}

		public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args)
		{
			_contentPack.identifier = identifier;
			LoadSoundBanks(Path.Combine(Path.GetDirectoryName(typeof(ContentProvider).Assembly.Location), "soundbanks"));
			string assetsFolderFullPath = Path.Combine(Path.GetDirectoryName(typeof(ContentProvider).Assembly.Location), "assetbundles");
			AssetBundle scenesAssetBundle = null;
			yield return LoadAssetBundle(Path.Combine(assetsFolderFullPath, "agatevillagescene"), args.progressReceiver, delegate(AssetBundle assetBundle)
			{
				scenesAssetBundle = assetBundle;
			});
			AssetBundle assetsAssetBundle = null;
			yield return LoadAssetBundle(Path.Combine(assetsFolderFullPath, "agatevillageassets"), args.progressReceiver, delegate(AssetBundle assetBundle)
			{
				assetsAssetBundle = assetBundle;
			});
			yield return LoadAllAssetsAsync<Material>(assetsAssetBundle, args.progressReceiver, (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;
								FixMaterials(val4);
								SwappedMaterials.Add(val4);
							}
						}
					}
				}
			});
			yield return LoadAllAssetsAsync<UnlockableDef>(assetsAssetBundle, args.progressReceiver, (Action<UnlockableDef[]>)delegate(UnlockableDef[] assets)
			{
				_contentPack.unlockableDefs.Add(assets);
			});
			yield return LoadAllAssetsAsync<Sprite>(assetsAssetBundle, args.progressReceiver, (Action<Sprite[]>)delegate(Sprite[] assets)
			{
				AgateVillagePreviewSprite = assets.First((Sprite a) => ((Object)a).name == "texAgateVillage");
			});
			yield return LoadAllAssetsAsync<SceneDef>(assetsAssetBundle, args.progressReceiver, (Action<SceneDef[]>)delegate(SceneDef[] assets)
			{
				AgateVillageSceneDef = assets.First((SceneDef sd) => sd.cachedName == "agatevillage");
				_contentPack.sceneDefs.Add(assets);
			});
			yield return LoadAllAssetsAsync<GameObject>(assetsAssetBundle, args.progressReceiver, (Action<GameObject[]>)delegate(GameObject[] assets)
			{
				GameObject val3 = assets.First((GameObject sd) => ((Object)sd).name == "FishingRodInteractable");
				_contentPack.networkedObjectPrefabs.Add((GameObject[])(object)new GameObject[1] { val3 });
			});
			Material val = Object.Instantiate<Material>(Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/bazaar/matBazaarSeerWispgraveyard.mat").WaitForCompletion());
			val.mainTexture = (Texture)(object)AgateVillagePreviewSprite.texture;
			AgateVillageSceneDef.previewTexture = (Texture)(object)AgateVillagePreviewSprite.texture;
			AgateVillageSceneDef.portalMaterial = val;
			if (AgateVillagePlugin.UseCustomMusic.Value)
			{
				SetupMusic();
			}
			else
			{
				AgateVillageSceneDef.mainTrack = Addressables.LoadAssetAsync<MusicTrackDef>((object)"RoR2/Base/Common/MusicTrackDefs/muGameplayBase_09.asset").WaitForCompletion();
				AgateVillageSceneDef.bossTrack = Addressables.LoadAssetAsync<MusicTrackDef>((object)"RoR2/Base/Common/MusicTrackDefs/muSong16.asset").WaitForCompletion();
			}
			ref SceneEntry[] sceneEntries = ref Addressables.LoadAssetAsync<SceneCollection>((object)"RoR2/Base/SceneGroups/sgStage3.asset").WaitForCompletion()._sceneEntries;
			SceneEntry val2 = new SceneEntry
			{
				sceneDef = AgateVillageSceneDef
			};
			((SceneEntry)(ref val2)).weight = 1f;
			ArrayUtils.ArrayAppend<SceneEntry>(ref sceneEntries, ref val2);
			AgateVillageSceneDef.destinationsGroup = Addressables.LoadAssetAsync<SceneCollection>((object)"RoR2/Base/SceneGroups/sgStage4.asset").WaitForCompletion();
			ref SceneEntry[] sceneEntries2 = ref Addressables.LoadAssetAsync<SceneCollection>((object)"RoR2/Base/SceneGroups/loopSgStage3.asset").WaitForCompletion()._sceneEntries;
			val2 = new SceneEntry
			{
				sceneDef = AgateVillageSceneDef
			};
			((SceneEntry)(ref val2)).weight = 1f;
			ArrayUtils.ArrayAppend<SceneEntry>(ref sceneEntries2, ref val2);
			AgateVillageSceneDef.loopedDestinationsGroup = Addressables.LoadAssetAsync<SceneCollection>((object)"RoR2/Base/SceneGroups/loopSgStage4.asset").WaitForCompletion();
		}

		private static void FixMaterials(Material material)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: 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_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: 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_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			if (((Object)material).name == "matFire")
			{
				material.SetTexture("_RemapTex", (Texture)(object)Addressables.LoadAssetAsync<Texture2D>((object)"RoR2/Base/Common/ColorRamps/texRampCaptainAirstrike.png").WaitForCompletion());
			}
			else if (((Object)material).name == "matHeatGas")
			{
				material.SetTexture("_RemapTex", (Texture)(object)Addressables.LoadAssetAsync<Texture2D>((object)"RoR2/Base/Common/ColorRamps/texRampLunarSmoke.png").WaitForCompletion());
			}
			else if (((Object)material).name == "matClouds")
			{
				material.SetTexture("_RemapTex", (Texture)(object)Addressables.LoadAssetAsync<Texture2D>((object)"RoR2/Base/Common/ColorRamps/texRampDefault.png").WaitForCompletion());
			}
			else if (((Object)material).name == "matRain")
			{
				material.SetTexture("_MainTex", (Texture)(object)Addressables.LoadAssetAsync<Texture2D>((object)"RoR2/Base/Common/VFX/ParticleMasks/texParticleDust1Mask.png").WaitForCompletion());
				material.SetTexture("_RemapTex", (Texture)(object)Addressables.LoadAssetAsync<Texture2D>((object)"RoR2/Base/Common/ColorRamps/texRampTwotoneEnvironment.jpg").WaitForCompletion());
				material.SetTexture("_Cloud1Tex", (Texture)(object)Addressables.LoadAssetAsync<Texture2D>((object)"RoR2/Base/Common/texCloudDifferenceBW1.png").WaitForCompletion());
			}
		}

		private 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_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			CustomMusicTrackDef val = ScriptableObject.CreateInstance<CustomMusicTrackDef>();
			((Object)val).name = "AgateVillageMainMusic";
			((MusicTrackDef)val).cachedName = "AgateVillageMainMusic";
			((MusicTrackDef)val).comment = "sunnydaze - Barrow's Ceiling\r\nagatevillage";
			val.CustomStates = new List<CustomState>();
			CustomState item = default(CustomState);
			item.GroupId = 3508158228u;
			item.StateId = 2025383728u;
			val.CustomStates.Add(item);
			CustomState item2 = default(CustomState);
			item2.GroupId = 792781730u;
			item2.StateId = 89505537u;
			val.CustomStates.Add(item2);
			AgateVillageSceneDef.mainTrack = (MusicTrackDef)(object)val;
			CustomMusicTrackDef val2 = ScriptableObject.CreateInstance<CustomMusicTrackDef>();
			((Object)val2).name = "AgateVillageBossMusic";
			((MusicTrackDef)val2).cachedName = "AgateVillageBossMusic";
			((MusicTrackDef)val2).comment = "sunnydaze - Fight!\r\nagatevillage";
			val2.CustomStates = new List<CustomState>();
			CustomState item3 = default(CustomState);
			item3.GroupId = 3508158228u;
			item3.StateId = 514064485u;
			val2.CustomStates.Add(item3);
			CustomState item4 = default(CustomState);
			item4.GroupId = 792781730u;
			item4.StateId = 580146960u;
			val2.CustomStates.Add(item4);
			AgateVillageSceneDef.bossTrack = (MusicTrackDef)(object)val2;
		}

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

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

		internal 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_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("AgateVillageInit.bnk", ref num);
			if ((int)val == 1)
			{
				Log.Info("Added bank : AgateVillageInit.bnk");
			}
			else
			{
				Log.Error("Error loading bank : AgateVillageInit.bnk " + $"Error code : {val}");
			}
			val = AkSoundEngine.LoadBank("AgateVillageMusic.bnk", ref num);
			if ((int)val == 1)
			{
				Log.Info("Added bank : AgateVillageMusic.bnk");
			}
			else
			{
				Log.Error("Error loading bank : AgateVillageMusic.bnk " + $"Error code : {val}");
			}
			val = AkSoundEngine.LoadBank("AgateVillageSounds.bnk", ref num);
			if ((int)val == 1)
			{
				Log.Info("Added bank : AgateVillageSounds.bnk");
			}
			else
			{
				Log.Error("Error loading bank : AgateVillageSounds.bnk " + $"Error code : {val}");
			}
		}
	}
	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);
		}
	}
	public class RegigigasCompat
	{
		private static bool? _enabled;

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

		public static DirectorCard GetRegigigasSpawnCard(DirectorCardCategorySelection mixEnemy)
		{
			return ((IEnumerable<DirectorCard>)mixEnemy.categories[0].cards).FirstOrDefault((Func<DirectorCard, bool>)((DirectorCard card) => ((Object)card.spawnCard).name == "cscRegigigas"));
		}
	}
	public class TyranitarCompat
	{
		private static bool? _enabled;

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

		public static DirectorCard GetTyranitarSpawnCard(DirectorCardCategorySelection mixEnemy)
		{
			return ((IEnumerable<DirectorCard>)mixEnemy.categories[0].cards).FirstOrDefault((Func<DirectorCard, bool>)((DirectorCard card) => ((Object)card.spawnCard).name == "cscTyranitar"));
		}
	}
}