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 TechnicallyAScannerBuff v1.0.1
TechnicallyAScannerBuff/TechnicallyAScannerBuff.dll
Decompiled 4 months agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using On.RoR2; using R2API; using RoR2; using UnityEngine; using UnityEngine.AddressableAssets; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")] [assembly: AssemblyCompany("TechnicallyAScannerBuff")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("TechnicallyAScannerBuff")] [assembly: AssemblyTitle("TechnicallyAScannerBuff")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace TimedSeeSChest; 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); } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("Samuel17.TechnicallyAScannerBuff", "TechnicallyAScannerBuff", "1.0.1")] public class Main : BaseUnityPlugin { public static GameObject newCloakedChestPrefab; public static InteractableSpawnCard iscChest2Stealthed; public static bool scannerUsedThisStage = false; public static SceneDirector currentSceneDirector; public static GameObject cloakedChestPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Chest1StealthedVariant/Chest1StealthedVariant.prefab").WaitForCompletion(); public static BasicPickupDropTable largeChestDropTable = Addressables.LoadAssetAsync<BasicPickupDropTable>((object)"RoR2/Base/Chest2/dtChest2.asset").WaitForCompletion(); public static InteractableSpawnCard iscChest1Stealthed = Addressables.LoadAssetAsync<InteractableSpawnCard>((object)"RoR2/Base/Chest1StealthedVariant/iscChest1Stealthed.asset").WaitForCompletion(); public static ConfigEntry<int> chestCount { get; private set; } public static ConfigEntry<bool> largeRarity { get; private set; } public static ConfigEntry<bool> scannerRequired { get; private set; } public void Awake() { //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Expected O, but got Unknown Log.Init(((BaseUnityPlugin)this).Logger); chestCount = ((BaseUnityPlugin)this).Config.Bind<int>("Cloaked Chests", "Chest Count", 1, "The amount of guaranteed Cloaked Chests per stage."); largeRarity = ((BaseUnityPlugin)this).Config.Bind<bool>("Cloaked Chests", "Improved Item Rarity", true, "Item rarity is equal to a Large Chest. False makes it equal to a regular Chest."); scannerRequired = ((BaseUnityPlugin)this).Config.Bind<bool>("Cloaked Chests", "Scanner is Required", false, "If set to true, the guaranteed Cloaked Chests can only be found by activating the Radar Scanner at least once."); SetupNewCloakedChest(); SceneDirector.onPostPopulateSceneServer += StageStart; if (scannerRequired.Value) { EquipmentSlot.FireScanner += new hook_FireScanner(SpawnCloakedChestWithRadar); } } private void SetupNewCloakedChest() { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown newCloakedChestPrefab = PrefabAPI.InstantiateClone(cloakedChestPrefab, "Chest2StealthedVariant"); if (largeRarity.Value) { newCloakedChestPrefab.GetComponent<ChestBehavior>().dropTable = (PickupDropTable)(object)largeChestDropTable; } newCloakedChestPrefab.GetComponent<PurchaseInteraction>().setUnavailableOnTeleporterActivated = false; PurchaseInteraction.IsLockable += new hook_IsLockable(UnlockNewCloakedChest); iscChest2Stealthed = Object.Instantiate<InteractableSpawnCard>(iscChest1Stealthed); ((Object)iscChest2Stealthed).name = "iscChest2Stealthed"; ((SpawnCard)iscChest2Stealthed).prefab = newCloakedChestPrefab; } private void StageStart(SceneDirector sceneDirector) { currentSceneDirector = sceneDirector; scannerUsedThisStage = false; if (!scannerRequired.Value) { SpawnCloakedChest(sceneDirector); } } private bool SpawnCloakedChestWithRadar(orig_FireScanner orig, EquipmentSlot self) { if (Object.op_Implicit((Object)(object)currentSceneDirector) && !scannerUsedThisStage) { scannerUsedThisStage = true; SpawnCloakedChest(currentSceneDirector); } return orig.Invoke(self); } private void SpawnCloakedChest(SceneDirector sceneDirector) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown //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_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown if (SceneInfo.instance.countsAsStage || SceneInfo.instance.sceneDef.allowItemsToSpawnObjects) { for (int i = 0; i < chestCount.Value; i++) { Xoroshiro128Plus val = new Xoroshiro128Plus(sceneDirector.rng.nextUlong); DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest((SpawnCard)(object)iscChest2Stealthed, new DirectorPlacementRule { placementMode = (PlacementMode)4 }, val)); } } } private bool UnlockNewCloakedChest(orig_IsLockable orig, PurchaseInteraction self) { if (((Object)((Component)self).gameObject).name == "Chest2StealthedVariant(Clone)") { return false; } return orig.Invoke(self); } }