Decompiled source of ArtifactOfChests v1.0.2

plugins/MyFirstMod/ExamplePlugin.dll

Decompiled 13 hours 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 Microsoft.CodeAnalysis;
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 = ".NET Standard 2.1")]
[assembly: AssemblyCompany("ExamplePlugin")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ExamplePlugin")]
[assembly: AssemblyTitle("ExamplePlugin")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[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 MoreChestsArtifact2
{
	[BepInPlugin("com.yourname.morechestsartifact2", "More Chests Artifact 2", "1.0.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class MoreChestsArtifact2Plugin : BaseUnityPlugin
	{
		public static ArtifactDef MoreChestsArtifact2;

		public void Awake()
		{
			CreateArtifact();
			SceneDirector.onGenerateInteractableCardSelection += IncreaseChestWeights;
			SceneDirector.onPrePopulateSceneServer += IncreaseInteractableCredits;
		}

		private void CreateArtifact()
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			MoreChestsArtifact2 = ScriptableObject.CreateInstance<ArtifactDef>();
			MoreChestsArtifact2.cachedName = "MoreChests2";
			MoreChestsArtifact2.nameToken = "ARTIFACT_MORE_CHESTS_2_NAME";
			MoreChestsArtifact2.descriptionToken = "ARTIFACT_MORE_CHESTS_2_DESC";
			MoreChestsArtifact2.smallIconSelectedSprite = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/Common/MiscIcons/texBarrelIcon.png").WaitForCompletion();
			MoreChestsArtifact2.smallIconDeselectedSprite = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/Common/MiscIcons/texBarrelIcon.png").WaitForCompletion();
			ContentAddition.AddArtifactDef(MoreChestsArtifact2);
			LanguageAPI.Add("ARTIFACT_MORE_CHESTS_2_NAME", "Artifact of Chests (4x)");
			LanguageAPI.Add("ARTIFACT_MORE_CHESTS_2_DESC", "Chests appear 4x more frequently each stage.");
		}

		private void IncreaseChestWeights(SceneDirector sceneDirector, DirectorCardCategorySelection selection)
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)RunArtifactManager.instance) || !RunArtifactManager.instance.IsArtifactEnabled(MoreChestsArtifact2))
			{
				return;
			}
			Category[] categories = selection.categories;
			foreach (Category val in categories)
			{
				DirectorCard[] cards = val.cards;
				foreach (DirectorCard val2 in cards)
				{
					if (!((Object)(object)val2.spawnCard == (Object)null) && ((Object)val2.spawnCard).name.Contains("Chest"))
					{
						val2.selectionWeight *= 4;
					}
				}
			}
		}

		private void IncreaseInteractableCredits(SceneDirector sceneDirector)
		{
			if (Object.op_Implicit((Object)(object)RunArtifactManager.instance) && RunArtifactManager.instance.IsArtifactEnabled(MoreChestsArtifact2))
			{
				sceneDirector.interactableCredit += 400;
			}
		}
	}
}
namespace MoreChestsArtifact3
{
	[BepInPlugin("com.yourname.morechestsartifact3", "More Chests Artifact 3", "1.0.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class MoreChestsArtifact2Plugin : BaseUnityPlugin
	{
		public static ArtifactDef MoreChestsArtifact2;

		public void Awake()
		{
			CreateArtifact();
			SceneDirector.onGenerateInteractableCardSelection += IncreaseChestWeights;
			SceneDirector.onPrePopulateSceneServer += IncreaseInteractableCredits;
		}

		private void CreateArtifact()
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			MoreChestsArtifact2 = ScriptableObject.CreateInstance<ArtifactDef>();
			MoreChestsArtifact2.cachedName = "MoreChests3";
			MoreChestsArtifact2.nameToken = "ARTIFACT_MORE_CHESTS_3_NAME";
			MoreChestsArtifact2.descriptionToken = "ARTIFACT_MORE_CHESTS_3_DESC";
			MoreChestsArtifact2.smallIconSelectedSprite = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/Common/MiscIcons/texBarrelIcon.png").WaitForCompletion();
			MoreChestsArtifact2.smallIconDeselectedSprite = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/Common/MiscIcons/texBarrelIcon.png").WaitForCompletion();
			ContentAddition.AddArtifactDef(MoreChestsArtifact2);
			LanguageAPI.Add("ARTIFACT_MORE_CHESTS_2_NAME", "Artifact of Chests (6x)");
			LanguageAPI.Add("ARTIFACT_MORE_CHESTS_2_DESC", "Chests appear 6x more frequently each stage.");
		}

		private void IncreaseChestWeights(SceneDirector sceneDirector, DirectorCardCategorySelection selection)
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)RunArtifactManager.instance) || !RunArtifactManager.instance.IsArtifactEnabled(MoreChestsArtifact2))
			{
				return;
			}
			Category[] categories = selection.categories;
			foreach (Category val in categories)
			{
				DirectorCard[] cards = val.cards;
				foreach (DirectorCard val2 in cards)
				{
					if (!((Object)(object)val2.spawnCard == (Object)null) && ((Object)val2.spawnCard).name.Contains("Chest"))
					{
						val2.selectionWeight *= 6;
					}
				}
			}
		}

		private void IncreaseInteractableCredits(SceneDirector sceneDirector)
		{
			if (Object.op_Implicit((Object)(object)RunArtifactManager.instance) && RunArtifactManager.instance.IsArtifactEnabled(MoreChestsArtifact2))
			{
				sceneDirector.interactableCredit += 600;
			}
		}
	}
}
namespace MoreChestsArtifact
{
	[BepInPlugin("com.yourname.morechestsartifact", "More Chests Artifact", "1.0.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class MoreChestsArtifactPlugin : BaseUnityPlugin
	{
		public static ArtifactDef MoreChestsArtifact;

		public void Awake()
		{
			CreateArtifact();
			SceneDirector.onGenerateInteractableCardSelection += IncreaseChestWeights;
			SceneDirector.onPrePopulateSceneServer += IncreaseInteractableCredits;
		}

		private void CreateArtifact()
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			MoreChestsArtifact = ScriptableObject.CreateInstance<ArtifactDef>();
			MoreChestsArtifact.cachedName = "MoreChests";
			MoreChestsArtifact.nameToken = "ARTIFACT_MORE_CHESTS_NAME";
			MoreChestsArtifact.descriptionToken = "ARTIFACT_MORE_CHESTS_DESC";
			MoreChestsArtifact.smallIconSelectedSprite = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/Common/MiscIcons/texBarrelIcon.png").WaitForCompletion();
			MoreChestsArtifact.smallIconDeselectedSprite = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/Common/MiscIcons/texBarrelIcon.png").WaitForCompletion();
			ContentAddition.AddArtifactDef(MoreChestsArtifact);
			LanguageAPI.Add("ARTIFACT_MORE_CHESTS_NAME", "Artifact of Chests (2x)");
			LanguageAPI.Add("ARTIFACT_MORE_CHESTS_DESC", "Chests appear 2x more frequently each stage.");
		}

		private void IncreaseChestWeights(SceneDirector sceneDirector, DirectorCardCategorySelection selection)
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)RunArtifactManager.instance) || !RunArtifactManager.instance.IsArtifactEnabled(MoreChestsArtifact))
			{
				return;
			}
			Category[] categories = selection.categories;
			foreach (Category val in categories)
			{
				DirectorCard[] cards = val.cards;
				foreach (DirectorCard val2 in cards)
				{
					if (!((Object)(object)val2.spawnCard == (Object)null) && ((Object)val2.spawnCard).name.Contains("Chest"))
					{
						val2.selectionWeight *= 2;
					}
				}
			}
		}

		private void IncreaseInteractableCredits(SceneDirector sceneDirector)
		{
			if (Object.op_Implicit((Object)(object)RunArtifactManager.instance) && RunArtifactManager.instance.IsArtifactEnabled(MoreChestsArtifact))
			{
				sceneDirector.interactableCredit += 200;
			}
		}
	}
}