Decompiled source of MoreSacrificeInteractables v1.0.2

MoreSacrificeInteractables.dll

Decompiled 3 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
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 = ".NET Standard 2.1")]
[assembly: AssemblyCompany("MoreSacrificeInteractables")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+277043c44019266f57d68ec0fcef3bef20f7cd6b")]
[assembly: AssemblyProduct("MoreSacrificeInteractables")]
[assembly: AssemblyTitle("MoreSacrificeInteractables")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace MoreSacrificeInteractables
{
	[BepInPlugin("com.Moffein.MoreSacrificeInteractables", "MoreSacrificeInteractables", "1.0.2")]
	public class MoreSacrificeInteractablesPlugin : BaseUnityPlugin
	{
		public static bool allowEquipBarrel;

		public static bool allowEquipShop;

		public static bool allowLunarPod;

		public static bool allowVoidCradle;

		public static bool allowVoidTriple;

		public static float equipBarrelWeight;

		public static float equipShopWeight;

		public static float lunarPodWeight;

		public static float voidCradleWeight;

		public static float voidTripleWeight;

		public void Awake()
		{
			allowEquipBarrel = ((BaseUnityPlugin)this).Config.Bind<bool>("Equipment", "Equipment Barrel", true, "Allow this interactable to spawn when Sacrifice is enabled.").Value;
			equipBarrelWeight = ((BaseUnityPlugin)this).Config.Bind<float>("Equipment", "Equipment Barrel Weight", 0.2f, "Affects how often this interactable will spawn when Sacrifice is enabled.").Value;
			allowEquipShop = ((BaseUnityPlugin)this).Config.Bind<bool>("Equipment", "Equipment Multishop", true, "Allow this interactable to spawn when Sacrifice is enabled.").Value;
			equipShopWeight = ((BaseUnityPlugin)this).Config.Bind<float>("Equipment", "Equipment Multishop Weight", 0.2f, "Affects how often this interactable will spawn when Sacrifice is enabled.").Value;
			allowLunarPod = ((BaseUnityPlugin)this).Config.Bind<bool>("Lunar", "Lunar Pod", true, "Allow this interactable to spawn when Sacrifice is enabled.").Value;
			lunarPodWeight = ((BaseUnityPlugin)this).Config.Bind<float>("Lunar", "Lunar Pod Weight", 0.5f, "Affects how often this interactable will spawn when Sacrifice is enabled.").Value;
			allowVoidCradle = ((BaseUnityPlugin)this).Config.Bind<bool>("Void", "Void Cradle", true, "Allow this interactable to spawn when Sacrifice is enabled.").Value;
			voidCradleWeight = ((BaseUnityPlugin)this).Config.Bind<float>("Void", "Void Cradle Weight", 1f, "Affects how often this interactable will spawn when Sacrifice is enabled.").Value;
			allowVoidTriple = ((BaseUnityPlugin)this).Config.Bind<bool>("Void", "Void Multishop", true, "Allow this interactable to spawn when Sacrifice is enabled.").Value;
			voidTripleWeight = ((BaseUnityPlugin)this).Config.Bind<float>("Void", "Void Multishop Weight", 1f, "Affects how often this interactable will spawn when Sacrifice is enabled.").Value;
			if (allowEquipBarrel)
			{
				SetSacrificeAllowed("RoR2/Base/EquipmentBarrel/iscEquipmentBarrel.asset", equipBarrelWeight);
			}
			if (allowEquipShop)
			{
				SetSacrificeAllowed("RoR2/Base/TripleShopEquipment/iscTripleShopEquipment.asset", equipShopWeight);
			}
			if (allowLunarPod)
			{
				SetSacrificeAllowed("RoR2/Base/LunarChest/iscLunarChest.asset", lunarPodWeight);
			}
			if (allowVoidCradle)
			{
				SetSacrificeAllowed("RoR2/DLC1/VoidChest/iscVoidChest.asset", voidCradleWeight);
			}
			if (allowVoidTriple)
			{
				SetSacrificeAllowed("RoR2/DLC1/VoidTriple/iscVoidTriple.asset", voidTripleWeight);
			}
		}

		private void SetSacrificeAllowed(string addressablePath, float mult = 1f)
		{
			//IL_0002: 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)
			InteractableSpawnCard val = Addressables.LoadAssetAsync<InteractableSpawnCard>((object)addressablePath).WaitForCompletion();
			if (Object.op_Implicit((Object)(object)val))
			{
				if (val.weightScalarWhenSacrificeArtifactEnabled == 0f)
				{
					val.weightScalarWhenSacrificeArtifactEnabled = 1f;
				}
				val.skipSpawnWhenSacrificeArtifactEnabled = false;
				val.weightScalarWhenSacrificeArtifactEnabled *= mult;
			}
		}
	}
}
namespace R2API.Utils
{
	[AttributeUsage(AttributeTargets.Assembly)]
	public class ManualNetworkRegistrationAttribute : Attribute
	{
	}
}