Decompiled source of Perk Pelts v1.0.0

PerkPelts.dll

Decompiled 10 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using DiskCardGame;
using InscryptionAPI.Card;
using InscryptionAPI.Helpers;
using InscryptionAPI.Pelts;
using Microsoft.CodeAnalysis;
using UnityEngine;

[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.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("PerkPelts")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("PerkPelts")]
[assembly: AssemblyTitle("PerkPelts")]
[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 PerkPelts
{
	[BepInPlugin("Keks.Inscryption.PerkPelts", "PerkPelts", "0.0.1")]
	public class Plugin : BaseUnityPlugin
	{
		internal const string PluginGUID = "Keks.Inscryption.PerkPelts";

		internal const string PluginNAME = "PerkPelts";

		internal const string PluginVERSION = "0.0.1";

		public static string ModPrefix = "PerkPelt";

		private void Awake()
		{
			addCard();
			addPelt();
		}

		private void addPelt()
		{
			Tools.AddPeltToManager(Tools.CreatePeltCard(ModPrefix, "PerkToken", "Perk Rat", "PerkRatBase", "Empty", 2, 2, 2, 0, 0, null, new List<Ability>(), new List<SpecialTriggeredAbility>(), new List<Appearance> { (Appearance)6 }), "PerkRat", 5, 0, 8);
		}

		private void addCard()
		{
			Tools.CreateCard(ModPrefix, "PerkRatOneBlood", "Stunted Rat", "PerkRatOneBlood", "PerkRatEmission", 2, 2, 1, 0, 0, null, new List<Ability>(), new List<SpecialTriggeredAbility>(), new List<Trait>(), new List<Tribe>(), new List<Appearance> { (Appearance)7 }, (SpecialStatIcon)0, "BloodDecalSacRat", appearChoiceNode: false, appearTrader: false, Rare: false, (CardTemple)0);
			Tools.CreateCard(ModPrefix, "PerkRatBall", "Shedding Rat", "PerkRatBall", "PerkRatEmission", 2, 2, 2, 0, 0, null, new List<Ability> { (Ability)46 }, new List<SpecialTriggeredAbility>(), new List<Trait>(), new List<Tribe> { (Tribe)1 }, new List<Appearance> { (Appearance)7 }, (SpecialStatIcon)0, "PerkRatDecal", appearChoiceNode: false, appearTrader: false, Rare: false, (CardTemple)0);
			Tools.CreateCard(ModPrefix, "PerkRatBloodPower", "Bloody Rat", "PerkRatBloodPower", "PerkRatEmission", 0, 4, 2, 0, 0, null, new List<Ability>(), new List<SpecialTriggeredAbility> { (SpecialTriggeredAbility)26 }, new List<Trait>(), new List<Tribe>(), new List<Appearance> { (Appearance)7 }, (SpecialStatIcon)7, "BloodDecalOneRat", appearChoiceNode: false, appearTrader: false, Rare: false, (CardTemple)0);
			Tools.CreateCard(ModPrefix, "PerkRatBones", "Marrow Rat", "PerkRatBones", "PerkRatEmission", 2, 2, 0, 3, 0, null, new List<Ability>(), new List<SpecialTriggeredAbility>(), new List<Trait>(), new List<Tribe>(), new List<Appearance> { (Appearance)7 }, (SpecialStatIcon)0, "PerkRatDecal", appearChoiceNode: false, appearTrader: false, Rare: false, (CardTemple)0);
			Tools.CreateCard(ModPrefix, "PerkRatDigger", "Digging Rat", "PerkRatDigger", "PerkRatEmission", 2, 4, 2, 0, 0, null, new List<Ability> { (Ability)28 }, new List<SpecialTriggeredAbility>(), new List<Trait>(), new List<Tribe>(), new List<Appearance> { (Appearance)7 }, (SpecialStatIcon)0, "SmokeDecal", appearChoiceNode: false, appearTrader: false, Rare: false, (CardTemple)0);
			Tools.CreateCard(ModPrefix, "PerkRatItem", "Packing Rat", "PerkRatItem", "PerkRatEmission", 2, 3, 2, 0, 0, null, new List<Ability> { (Ability)29 }, new List<SpecialTriggeredAbility>(), new List<Trait>(), new List<Tribe>(), new List<Appearance> { (Appearance)7 }, (SpecialStatIcon)0, "PerkRatDecal", appearChoiceNode: false, appearTrader: false, Rare: false, (CardTemple)0);
			Tools.CreateCard(ModPrefix, "PerkRatLooter", "Orlus Rat", "PerkRatLooter", "PerkRatEmission", 2, 2, 2, 0, 0, null, new List<Ability> { (Ability)79 }, new List<SpecialTriggeredAbility>(), new List<Trait>(), new List<Tribe>(), new List<Appearance> { (Appearance)7 }, (SpecialStatIcon)0, "PerkRatDecal", appearChoiceNode: false, appearTrader: false, Rare: false, (CardTemple)0);
			Tools.CreateCard(ModPrefix, "PerkRatStatic", "Corrupted Rat", "PerkRatStatic", "PerkRatEmission", 6, 6, 0, 6, 0, null, new List<Ability>(), new List<SpecialTriggeredAbility> { (SpecialTriggeredAbility)7 }, new List<Trait>(), new List<Tribe>(), new List<Appearance>
			{
				(Appearance)15,
				(Appearance)14,
				(Appearance)7
			}, (SpecialStatIcon)0, "PerkRatDecal", appearChoiceNode: false, appearTrader: false, Rare: false, (CardTemple)0);
		}
	}
	public class Tools
	{
		public static Assembly _assembly;

		public static Assembly CurrentAssembly => _assembly ?? (_assembly = Assembly.GetExecutingAssembly());

		public static Texture2D LoadTexture(string name)
		{
			if (name == null)
			{
				return null;
			}
			return TextureHelper.GetImageAsTexture(name + (name.EndsWith(".png") ? "" : ".png"), CurrentAssembly, (FilterMode)0);
		}

		public static void AddPeltToManager(CardInfo info, string Name, int baseBuyPrice = 5, int extraAbilities = 0, int choiceAmount = 4)
		{
			PeltManager.New("Keks.Inscryption.PerkPelts", info, baseBuyPrice, extraAbilities, choiceAmount, (Func<List<CardInfo>>)(() => CardManager.AllCardsCopy.FindAll((CardInfo a) => ((Object)a).name.Contains(Name))));
		}

		public static CardInfo CreatePeltCard(string modPrefix, string internalName, string displayName, string imageName, string imageEmissiveName, int attack = 0, int health = 1, int bloodCost = 0, int bonesCost = 0, int energyCost = 0, List<GemType> gemsCost = null, List<Ability> abilities = null, List<SpecialTriggeredAbility> specialAbilities = null, List<Appearance> appearances = null, string decalName = null, bool Rare = false)
		{
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			CardInfo val = CardExtensions.SetPortraitAndEmission(CardManager.New(modPrefix, internalName, displayName, attack, health, (string)null), LoadTexture(imageName), LoadTexture(imageEmissiveName), (FilterMode?)null);
			if (decalName != null)
			{
				CardExtensions.AddDecal(val, (Texture[])(object)new Texture[1] { (Texture)LoadTexture(decalName) });
			}
			val.cardComplexity = (CardComplexity)1;
			CardExtensions.SetCost(val, (int?)bloodCost, (int?)bonesCost, (int?)energyCost, gemsCost);
			CardExtensions.AddTraits(val, (Trait[])(object)new Trait[1] { (Trait)13 });
			val.temple = (CardTemple)0;
			val.abilities = abilities;
			val.specialAbilities = specialAbilities;
			CardExtensions.AddSpecialAbilities(val, (SpecialTriggeredAbility[])(object)new SpecialTriggeredAbility[1] { (SpecialTriggeredAbility)27 });
			val.appearanceBehaviour = appearances;
			CardExtensions.AddAppearances(val, (Appearance[])(object)new Appearance[1] { (Appearance)2 });
			if (Rare)
			{
				CardExtensions.AddAppearances(val, (Appearance[])(object)new Appearance[1] { (Appearance)6 });
			}
			CardManager.Add(modPrefix, val);
			return val;
		}

		public static CardInfo CreateCard(string modPrefix, string internalName, string displayName, string imageName, string imageEmissiveName, int attack = 0, int health = 1, int bloodCost = 0, int bonesCost = 0, int energyCost = 0, List<GemType> gemsCost = null, List<Ability> abilities = null, List<SpecialTriggeredAbility> specialAbilities = null, List<Trait> traits = null, List<Tribe> tribes = null, List<Appearance> appearances = null, SpecialStatIcon icon = 0, string decalName = null, bool appearChoiceNode = true, bool appearTrader = true, bool Rare = false, CardTemple temple = 0)
		{
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Invalid comparison between Unknown and I4
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			CardInfo val = CardExtensions.SetCost(CardExtensions.SetPortraitAndEmission(CardManager.New(modPrefix, internalName, displayName, attack, health, (string)null), LoadTexture(imageName), LoadTexture(imageEmissiveName), (FilterMode?)null), (int?)bloodCost, (int?)bonesCost, (int?)energyCost, gemsCost);
			if (decalName != null)
			{
				CardExtensions.AddDecal(val, (Texture[])(object)new Texture[1] { (Texture)LoadTexture(decalName) });
			}
			val.abilities = abilities;
			val.specialAbilities = specialAbilities;
			if ((int)icon > 0)
			{
				CardExtensions.SetStatIcon(val, icon);
			}
			val.traits = traits;
			val.tribes = tribes;
			val.appearanceBehaviour = appearances;
			if (appearChoiceNode)
			{
				CardExtensions.AddMetaCategories(val, (CardMetaCategory[])(object)new CardMetaCategory[1]);
			}
			if (appearTrader)
			{
				CardExtensions.AddMetaCategories(val, (CardMetaCategory[])(object)new CardMetaCategory[1] { (CardMetaCategory)1 });
			}
			if (Rare)
			{
				CardExtensions.AddMetaCategories(val, (CardMetaCategory[])(object)new CardMetaCategory[1] { (CardMetaCategory)3 });
				CardExtensions.AddAppearances(val, (Appearance[])(object)new Appearance[1] { (Appearance)7 });
			}
			val.temple = temple;
			CardManager.Add(modPrefix, val);
			return val;
		}
	}
}