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 FogboundLagoon v1.1.7
plugins/FblAssembly.dll
Decompiled 5 months 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 BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using FBLStage.Content; using HG.Reflection; using On.RoR2; using R2API; using RoR2; using RoR2.ContentManagement; using ShaderSwapper; 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: OptIn] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] public class AkAmbientRefAttatcher : MonoBehaviour { public AkAmbient component; public string key; private void Awake() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) ((AkEvent)component).data.WwiseObjectReference = Addressables.LoadAssetAsync<WwiseEventReference>((object)key).WaitForCompletion(); } } public class WaterAntiGravController : MonoBehaviour { public float elevation; public float antiGravCoeff; private void FixedUpdate() { //IL_0015: 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) foreach (CharacterBody readOnlyInstances in CharacterBody.readOnlyInstancesList) { if (!(readOnlyInstances.corePosition.y >= elevation) && Object.op_Implicit((Object)(object)readOnlyInstances.characterMotor)) { CharacterMotor characterMotor = readOnlyInstances.characterMotor; if (Object.op_Implicit((Object)(object)characterMotor) && !characterMotor.isGrounded && characterMotor.useGravity && characterMotor.hasEffectiveAuthority) { characterMotor.velocity.y += (0f - Physics.gravity.y) * antiGravCoeff * Time.fixedDeltaTime; } } } } } namespace FBLStage { [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("JaceDaDorito.FBLStage", "FBLStage", "1.1.7")] public class FBLStage : BaseUnityPlugin { public const string Author = "JaceDaDorito"; public const string Name = "FBLStage"; public const string Version = "1.1.7"; public const string GUID = "JaceDaDorito.FBLStage"; public static FBLStage instance; public static ConfigEntry<bool> dlcPool; public static ConfigEntry<bool> waterMuffle; private void Awake() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown instance = this; Log.Init(((BaseUnityPlugin)this).Logger); ConfigSetup(); ContentManager.collectContentPackProviders += new CollectContentPackProvidersDelegate(GiveToRoR2OurContentPackProviders); Language.collectLanguageRootFolders += CollectLanguageRootFolders; } 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")); } private void ConfigSetup() { dlcPool = ((BaseUnityPlugin)this).Config.Bind<bool>("Monster Pool Settings", "DLC Monster pools", true, "If you want to play with the non-DLC monster pool without turning off the DLC, set this to false. This doesn't effect void seeds or the void enemies that spawn out of them."); waterMuffle = ((BaseUnityPlugin)this).Config.Bind<bool>("Audio Settings", "Water Muffle", true, "Being underwater muffles your game."); } } 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); } } } namespace FBLStage.Content { public class BadToTheBone : NetworkBehaviour { private static int kRpcRpcPlayBadToTheBone; [ClientRpc] public void RpcPlayBadToTheBone() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)FBLContent.BadToTheBone)) { EffectManager.SimpleSoundEffect(FBLContent.BadToTheBone.index, ((Component)this).gameObject.transform.position, true); } } private void UNetVersion() { } protected static void InvokeRpcRpcPlayBadToTheBone(NetworkBehaviour obj, NetworkReader reader) { if (!NetworkClient.active) { Debug.LogError((object)"RPC RpcPlayBadToTheBone called on server."); } else { ((BadToTheBone)(object)obj).RpcPlayBadToTheBone(); } } public void CallRpcPlayBadToTheBone() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { Debug.LogError((object)"RPC Function RpcPlayBadToTheBone called on client."); return; } NetworkWriter val = new NetworkWriter(); val.Write((short)0); val.Write((short)2); val.WritePackedUInt32((uint)kRpcRpcPlayBadToTheBone); val.Write(((Component)this).GetComponent<NetworkIdentity>().netId); ((NetworkBehaviour)this).SendRPCInternal(val, 0, "RpcPlayBadToTheBone"); } static BadToTheBone() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown kRpcRpcPlayBadToTheBone = -356175276; NetworkBehaviour.RegisterRpcDelegate(typeof(BadToTheBone), kRpcRpcPlayBadToTheBone, new CmdDelegate(InvokeRpcRpcPlayBadToTheBone)); NetworkCRC.RegisterBehaviour("BadToTheBone", 0); } public override bool OnSerialize(NetworkWriter writer, bool forceAll) { bool result = default(bool); return result; } public override void OnDeserialize(NetworkReader reader, bool initialState) { } public override void PreStartClient() { } } public class ContentProvider : IContentPackProvider { private readonly ContentPack _contentPack = new ContentPack(); public static string assetDirectory; public string identifier => "JaceDaDorito.FBLStage.ContentProvider"; public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args) { _contentPack.identifier = identifier; string assetsFolderFullPath = (assetDirectory = Path.GetDirectoryName(typeof(ContentProvider).Assembly.Location)); FBLContent.LoadSoundBank(assetsFolderFullPath); AssetBundle scenesAssetBundle = null; yield return LoadAssetBundle(Path.Combine(assetsFolderFullPath, "fblstage"), args.progressReceiver, delegate(AssetBundle assetBundle) { scenesAssetBundle = assetBundle; }); AssetBundle assetsAssetBundle = null; yield return LoadAssetBundle(Path.Combine(assetsFolderFullPath, "fblassets"), args.progressReceiver, delegate(AssetBundle assetBundle) { assetsAssetBundle = assetBundle; }); yield return FBLContent.LoadAssetBundlesAsync(scenesAssetBundle, assetsAssetBundle, args.progressReceiver, _contentPack); } 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 FBLContent { internal const string SoundBankFileName = "fblsoundbank.bnk"; internal const string ScenesAssetBundleFileName = "fblstage"; internal const string AssetsAssetBundleFileName = "fblassets"; private static uint _soundbankId; internal static NetworkSoundEventDef BadToTheBone; private static AssetBundle _scenesAssetBundle; private static AssetBundle _assetsAssetBundle; internal static UnlockableDef[] UnlockableDefs; internal static SceneDef[] SceneDefs; internal static SceneDef FBLSceneDef; internal static Sprite FBLSceneDefPreviewSprite; internal static Material FBLBazaarSeer; public static List<Material> SwappedMaterials = new List<Material>(); internal static void LoadSoundBank(string assetsFolderFullPath) { //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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Invalid comparison between Unknown and I4 //IL_006b: Unknown result type (might be due to invalid IL or missing references) AKRESULT val = AkSoundEngine.AddBasePath(assetsFolderFullPath); if ((int)val == 1) { Log.Info("Added bank base path : " + assetsFolderFullPath); } else { Log.Error("Error adding base path : " + assetsFolderFullPath + " " + $"Error code : {val}"); } val = AkSoundEngine.LoadBank("fblsoundbank.bnk", ref _soundbankId); if ((int)val == 1) { Log.Info("Added bank : fblsoundbank.bnk"); } else { Log.Error("Error loading bank : fblsoundbank.bnk " + $"Error code : {val}"); } } 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<NetworkSoundEventDef>(_assetsAssetBundle, progress, (Action<NetworkSoundEventDef[]>)delegate(NetworkSoundEventDef[] assets) { BadToTheBone = assets.First((NetworkSoundEventDef a) => ((Object)a).name == "FBL_BadtotheBone"); contentPack.networkSoundEventDefs.Add(assets); }); yield return LoadAllAssetsAsync<UnlockableDef>(_assetsAssetBundle, progress, (Action<UnlockableDef[]>)delegate(UnlockableDef[] assets) { UnlockableDefs = assets; contentPack.unlockableDefs.Add(assets); }); if (!FBLStage.dlcPool.Value) { yield return LoadAllAssetsAsync<AddressableDCCSPool>(_assetsAssetBundle, progress, (Action<AddressableDCCSPool[]>)delegate(AddressableDCCSPool[] assets) { assets.First((AddressableDCCSPool a) => ((Object)a).name == "dpFBLMonsters").poolCategories[0].includedIfConditionsMet = Array.Empty<ConditionalPoolEntry>(); }); } yield return LoadAllAssetsAsync<Sprite>(_assetsAssetBundle, progress, (Action<Sprite[]>)delegate(Sprite[] assets) { FBLSceneDefPreviewSprite = assets.First((Sprite a) => ((Object)a).name == "texFBLScenePreview"); }); yield return LoadAllAssetsAsync<SceneDef>(_assetsAssetBundle, progress, (Action<SceneDef[]>)delegate(SceneDef[] assets) { SceneDefs = assets; FBLSceneDef = SceneDefs.First((SceneDef sd) => sd.baseSceneNameOverride == "FBLScene"); Log.Debug(FBLSceneDef.nameToken); contentPack.sceneDefs.Add(assets); }); FBLSceneDef.portalMaterial = StageRegistration.MakeBazaarSeerMaterial((Texture2D)FBLSceneDef.previewTexture); AsyncOperationHandle<MusicTrackDef> mainTrackDefRequest = Addressables.LoadAssetAsync<MusicTrackDef>((object)"RoR2/Base/Common/MusicTrackDefs/muFULLSong06.asset"); while (!mainTrackDefRequest.IsDone) { yield return null; } AsyncOperationHandle<MusicTrackDef> bossTrackDefRequest = Addressables.LoadAssetAsync<MusicTrackDef>((object)"RoR2/DLC2/Common/muSong_Lakes&HabitatBoss.asset"); while (!bossTrackDefRequest.IsDone) { yield return null; } FBLSceneDef.mainTrack = mainTrackDefRequest.Result; FBLSceneDef.bossTrack = bossTrackDefRequest.Result; StageRegistration.RegisterSceneDefToNormalProgression(FBLSceneDef, 1f, true, true); } internal static void Unload() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Invalid comparison between Unknown and I4 //IL_003f: Unknown result type (might be due to invalid IL or missing references) _assetsAssetBundle.Unload(true); _scenesAssetBundle.Unload(true); AKRESULT val = AkSoundEngine.UnloadBank(_soundbankId, IntPtr.Zero); if ((int)val == 1) { Log.Info("Unloaded bank : fblsoundbank.bnk."); } else { Log.Error("Error unloading bank : fblsoundbank.bnk. " + $"Error code : {val}"); } } 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 class WaterDeafenController : MonoBehaviour { public float elevation; 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 (FBLStage.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 (FBLStage.waterMuffle.Value) { MusicController.RecalculateHealth -= new hook_RecalculateHealth(MusicController_RecalculateHealth); } } private void MusicController_RecalculateHealth(orig_RecalculateHealth orig, MusicController self, GameObject playerObject) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, playerObject); if (Object.op_Implicit((Object)(object)self.targetCamera) && ((Component)self.targetCamera).transform.position.y < elevation) { self.rtpcPlayerHealthValue.value -= 100f; self.rtpcPlayerHealthValue.value = Mathf.Max(self.rtpcEnemyValue.value, -100f); } } } }