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 ChestToVoidCradle v1.0.0
plugins/ChestToVoidCradle/ChestToVoidCradle.dll
Decompiled 5 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using Microsoft.CodeAnalysis; using On.RoR2; using RoR2; using UnityEngine; using UnityEngine.AddressableAssets; [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("ChestToVoidCradle")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("ChestToVoidCradle")] [assembly: AssemblyTitle("ChestToVoidCradle")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace ExamplePlugin { 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 ChestToVoidCradle { [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("fr.viiper.chesttovoidcradle", "ChestToVoidCradle", "1.0.0")] public class ChestReplacementPlugin : BaseUnityPlugin { public const string PluginGUID = "fr.viiper.chesttovoidcradle"; public const string PluginName = "ChestToVoidCradle"; public const string PluginVersion = "1.0.0"; private InteractableSpawnCard voidCradleCard; private int originalVoidCradleCost; private HashSet<string> chestsToReplace; public void Awake() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Expected O, but got Unknown voidCradleCard = Addressables.LoadAssetAsync<InteractableSpawnCard>((object)"RoR2/DLC1/VoidChest/iscVoidChest.asset").WaitForCompletion(); if ((Object)(object)voidCradleCard == (Object)null) { ((BaseUnityPlugin)this).Logger.LogError((object)"Impossible de charger la void cradle spawn card!"); return; } originalVoidCradleCost = ((SpawnCard)voidCradleCard).directorCreditCost; ((BaseUnityPlugin)this).Logger.LogInfo((object)("Void cradle spawn card chargée: " + ((Object)voidCradleCard).name)); ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Coût original du void cradle: {originalVoidCradleCost}"); chestsToReplace = new HashSet<string> { "iscChest1", "iscChest2", "iscChest1Stealthed", "iscCategoryChestDamage", "iscCategoryChestHealing", "iscCategoryChestUtility", "iscLockbox", "iscEquipmentBarrel", "iscTripleShop", "iscTripleShopLarge", "iscTripleShopEquipment" }; DirectorCore.TrySpawnObject += new hook_TrySpawnObject(DirectorCore_TrySpawnObject); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Mod ChestToVoidCradle chargé !"); } private GameObject DirectorCore_TrySpawnObject(orig_TrySpawnObject orig, DirectorCore self, DirectorSpawnRequest directorSpawnRequest) { if ((Object)(object)directorSpawnRequest?.spawnCard != (Object)null) { string name = ((Object)directorSpawnRequest.spawnCard).name; if (chestsToReplace.Contains(name)) { int directorCreditCost = directorSpawnRequest.spawnCard.directorCreditCost; ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Interception de {name} (coût: {directorCreditCost}), remplacement par void cradle"); ((SpawnCard)voidCradleCard).directorCreditCost = directorCreditCost; directorSpawnRequest.spawnCard = (SpawnCard)(object)voidCradleCard; } } GameObject result = orig.Invoke(self, directorSpawnRequest); ((SpawnCard)voidCradleCard).directorCreditCost = originalVoidCradleCost; return result; } public void OnDestroy() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown DirectorCore.TrySpawnObject -= new hook_TrySpawnObject(DirectorCore_TrySpawnObject); if ((Object)(object)voidCradleCard != (Object)null) { ((SpawnCard)voidCradleCard).directorCreditCost = originalVoidCradleCost; } } } }