Decompiled source of TechnicallyAScannerBuff v1.0.0

TechnicallyAScannerBuff/TechnicallyAScannerBuff.dll

Decompiled a month ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
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.0")]
public class Main : BaseUnityPlugin
{
	public GameObject newCloakedChestPrefab;

	public InteractableSpawnCard iscChest2Stealthed;

	public static int chestCount = 1;

	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 void Awake()
	{
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: 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.").Value;
		SetupNewCloakedChest();
		SceneDirector.PopulateScene += new hook_PopulateScene(SpawnCloakedChest);
	}

	private void SetupNewCloakedChest()
	{
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Expected O, but got Unknown
		newCloakedChestPrefab = PrefabAPI.InstantiateClone(cloakedChestPrefab, "Chest2StealthedVariant");
		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 SpawnCloakedChest(orig_PopulateScene orig, SceneDirector self)
	{
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Expected O, but got Unknown
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Expected O, but got Unknown
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Expected O, but got Unknown
		orig.Invoke(self);
		if (SceneInfo.instance.countsAsStage || SceneInfo.instance.sceneDef.allowItemsToSpawnObjects)
		{
			for (int i = 0; i < chestCount; i++)
			{
				Xoroshiro128Plus val = new Xoroshiro128Plus(self.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);
	}
}