Decompiled source of Bundle Of Totems v1.3.0

Bundle_Of_Totems.dll

Decompiled 10 months ago
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
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 DiskCardGame;
using HarmonyLib;
using InscryptionAPI.Card;
using InscryptionAPI.Guid;
using InscryptionAPI.Helpers;
using InscryptionAPI.Helpers.Extensions;
using InscryptionAPI.Totems;
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.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("Bundle_Of_Totems")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("A collection of vanilla-like custom totems.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Bundle_Of_Totems")]
[assembly: AssemblyTitle("Bundle_Of_Totems")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
public class CatTotem : CompositeTotemPiece
{
	public override void SetData(ItemData data)
	{
		((CompositeTotemPiece)this).SetData(data);
		GameObject val = GameObjectExtensions.FindChild(((Component)this).gameObject, "EYES");
		if ((Object)(object)val != (Object)null)
		{
			base.emissiveRenderer = val.GetComponent<Renderer>();
		}
	}
}
public class FishTotem : CompositeTotemPiece
{
	public override void SetData(ItemData data)
	{
		((CompositeTotemPiece)this).SetData(data);
		GameObject val = GameObjectExtensions.FindChild(((Component)this).gameObject, "FishEyes");
		if ((Object)(object)val != (Object)null)
		{
			base.emissiveRenderer = val.GetComponent<Renderer>();
		}
	}
}
public class MouseTotem : CompositeTotemPiece
{
	public override void SetData(ItemData data)
	{
		((CompositeTotemPiece)this).SetData(data);
		GameObject val = GameObjectExtensions.FindChild(((Component)this).gameObject, "eyes");
		if ((Object)(object)val != (Object)null)
		{
			base.emissiveRenderer = val.GetComponent<Renderer>();
		}
	}
}
public class ZombieTotem : CompositeTotemPiece
{
	public override void SetData(ItemData data)
	{
		((CompositeTotemPiece)this).SetData(data);
		GameObject val = GameObjectExtensions.FindChild(((Component)this).gameObject, "FishEyes");
		if ((Object)(object)val != (Object)null)
		{
			base.emissiveRenderer = val.GetComponent<Renderer>();
		}
	}
}
namespace Bundle_Of_Totems
{
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "Bundle_Of_Totems";

		public const string PLUGIN_NAME = "Bundle_Of_Totems";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace BundleOfTotems
{
	[HarmonyPatch]
	[BepInPlugin("Lily.BOT", "Bundle Of Totems", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public const string PluginGuid = "Lily.BOT";

		private const string PluginName = "Bundle Of Totems";

		private const string PluginVersion = "1.0.0";

		public static string Directory;

		internal static ManualLogSource Log;

		public static Tribe FelineTribe;

		public static Tribe AquaticTribe;

		public static Tribe UndeadTribe;

		public static Tribe RodentTribe;

		public static ConfigEntry<bool> configAddTribesToVanillaCards;

		public static ConfigEntry<bool> configAddRodentTribeToSquirrels;

		public void Awake()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded Bundle Of Totems!");
			Log = ((BaseUnityPlugin)this).Logger;
			Harmony val = new Harmony("Lily.BOT");
			val.PatchAll();
			Directory = ((BaseUnityPlugin)this).Info.Location;
			GameObject val2 = default(GameObject);
			if (AssetBundleHelper.TryGet<GameObject>(Path.Combine(Path.GetDirectoryName(Directory), "custom_totems"), "cat", ref val2))
			{
				FelineTribe = TribeManager.Add("Lily.BOT", "feline", GetTexture("feline_tribe"), true, (Texture2D)null);
				TotemManager.NewTopPiece<CatTotem>("feline_totem", "Lily.BOT", FelineTribe, val2);
			}
			GameObject val3 = default(GameObject);
			if (AssetBundleHelper.TryGet<GameObject>(Path.Combine(Path.GetDirectoryName(Directory), "custom_totems"), "fish", ref val3))
			{
				AquaticTribe = TribeManager.Add("Lily.BOT", "aquatic", GetTexture("aquatic_tribe"), true, (Texture2D)null);
				TotemManager.NewTopPiece<FishTotem>("aquatic_totem", "Lily.BOT", AquaticTribe, val3);
			}
			GameObject val4 = default(GameObject);
			if (AssetBundleHelper.TryGet<GameObject>(Path.Combine(Path.GetDirectoryName(Directory), "custom_totems"), "zombie", ref val4))
			{
				UndeadTribe = TribeManager.Add("Lily.BOT", "undead", GetTexture("undead_tribe"), true, (Texture2D)null);
				TotemManager.NewTopPiece<ZombieTotem>("undead_totem", "Lily.BOT", UndeadTribe, val4);
			}
			GameObject val5 = default(GameObject);
			if (AssetBundleHelper.TryGet<GameObject>(Path.Combine(Path.GetDirectoryName(Directory), "custom_totems"), "mouse", ref val5))
			{
				RodentTribe = TribeManager.Add("Lily.BOT", "rodent", GetTexture("rodent_tribe"), true, (Texture2D)null);
				TotemManager.NewTopPiece<MouseTotem>("rodent_totem", "Lily.BOT", RodentTribe, val5);
			}
			configAddTribesToVanillaCards = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Add Tribes To Vanilla Cards", true, "Makes it so vanilla cards gain custom tribes from this mod if said tribe fits that card.");
			configAddRodentTribeToSquirrels = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Add Rodent Tribe To Squirrels", false, "Makes it so squirrels and aquasquirrels gain the rodent tribe.");
			if (configAddTribesToVanillaCards.Value)
			{
				AddTribesToVanillaCards();
			}
			if (configAddRodentTribeToSquirrels.Value)
			{
				AddRodentTribeToSquirrels();
			}
		}

		public static void AddTribesToVanillaCards()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected I4, but got Unknown
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Expected I4, but got Unknown
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Expected I4, but got Unknown
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected I4, but got Unknown
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Expected I4, but got Unknown
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Expected I4, but got Unknown
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Expected I4, but got Unknown
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Expected I4, but got Unknown
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Expected I4, but got Unknown
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Expected I4, but got Unknown
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Expected I4, but got Unknown
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Expected I4, but got Unknown
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Expected I4, but got Unknown
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Expected I4, but got Unknown
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Expected I4, but got Unknown
			//IL_0225: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: Expected I4, but got Unknown
			//IL_0248: Unknown result type (might be due to invalid IL or missing references)
			//IL_024e: Expected I4, but got Unknown
			//IL_026b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0271: Expected I4, but got Unknown
			//IL_028e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0294: Expected I4, but got Unknown
			//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b7: Expected I4, but got Unknown
			//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02da: Expected I4, but got Unknown
			//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fd: Expected I4, but got Unknown
			CardExtensions.AddTribes(CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, "Cat"), (Tribe[])(object)new Tribe[1] { (Tribe)(int)FelineTribe });
			CardExtensions.AddTribes(CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, "Bullfrog"), (Tribe[])(object)new Tribe[1] { (Tribe)(int)AquaticTribe });
			CardExtensions.AddTribes(CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, "Tadpole"), (Tribe[])(object)new Tribe[1] { (Tribe)(int)AquaticTribe });
			CardExtensions.AddTribes(CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, "Kraken"), (Tribe[])(object)new Tribe[1] { (Tribe)(int)AquaticTribe });
			CardExtensions.AddTribes(CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, "Shark"), (Tribe[])(object)new Tribe[1] { (Tribe)(int)AquaticTribe });
			CardExtensions.AddTribes(CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, "Snelk"), (Tribe[])(object)new Tribe[1] { (Tribe)(int)UndeadTribe });
			CardExtensions.AddTribes(CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, "Snelk_Neck"), (Tribe[])(object)new Tribe[1] { (Tribe)(int)UndeadTribe });
			CardExtensions.AddTribes(CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, "SkeletonPirate"), (Tribe[])(object)new Tribe[1] { (Tribe)(int)UndeadTribe });
			CardExtensions.AddTribes(CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, "SkeletonParrot"), (Tribe[])(object)new Tribe[1] { (Tribe)(int)UndeadTribe });
			CardExtensions.AddTribes(CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, "Beaver"), (Tribe[])(object)new Tribe[1] { (Tribe)(int)RodentTribe });
			CardExtensions.AddTribes(CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, "FieldMouse"), (Tribe[])(object)new Tribe[1] { (Tribe)(int)RodentTribe });
			CardExtensions.AddTribes(CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, "Mole"), (Tribe[])(object)new Tribe[1] { (Tribe)(int)RodentTribe });
			CardExtensions.AddTribes(CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, "MoleMan"), (Tribe[])(object)new Tribe[1] { (Tribe)(int)RodentTribe });
			CardExtensions.AddTribes(CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, "MoleSeaman"), (Tribe[])(object)new Tribe[1] { (Tribe)(int)RodentTribe });
			CardExtensions.AddTribes(CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, "PackRat"), (Tribe[])(object)new Tribe[1] { (Tribe)(int)RodentTribe });
			CardExtensions.AddTribes(CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, "Porcupine"), (Tribe[])(object)new Tribe[1] { (Tribe)(int)RodentTribe });
			CardExtensions.AddTribes(CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, "Rabbit"), (Tribe[])(object)new Tribe[1] { (Tribe)(int)RodentTribe });
			CardExtensions.AddTribes(CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, "Warren"), (Tribe[])(object)new Tribe[1] { (Tribe)(int)RodentTribe });
			CardExtensions.AddTribes(CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, "SquirrelBall"), (Tribe[])(object)new Tribe[1] { (Tribe)(int)RodentTribe });
			CardExtensions.AddTribes(CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, "Amalgam"), (Tribe[])(object)new Tribe[1] { (Tribe)(int)FelineTribe });
			CardExtensions.AddTribes(CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, "Amalgam"), (Tribe[])(object)new Tribe[1] { (Tribe)(int)AquaticTribe });
			CardExtensions.AddTribes(CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, "Amalgam"), (Tribe[])(object)new Tribe[1] { (Tribe)(int)UndeadTribe });
		}

		public static void AddRodentTribeToSquirrels()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected I4, but got Unknown
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Expected I4, but got Unknown
			CardExtensions.AddTribes(CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, "Squirrel"), (Tribe[])(object)new Tribe[1] { (Tribe)(int)RodentTribe });
			CardExtensions.AddTribes(CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, "AquaSquirrel"), (Tribe[])(object)new Tribe[1] { (Tribe)(int)RodentTribe });
		}

		public void AddDevStuff()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected I4, but got Unknown
			CardInfo val = CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, "Squirrel");
			Tribe[] array = (Tribe[])(object)new Tribe[1] { (Tribe)(int)GuidManager.GetEnumValue<Tribe>("Lily.BOT", "undead") };
			CardExtensions.AddTribes(val, array);
			val.baseHealth = 99;
			val.baseAttack = 1;
			CardInfo val2 = CardExtensions.CardByName((IEnumerable<CardInfo>)CardManager.BaseGameCards, "Geck");
			CardExtensions.AddAbilities(val2, (Ability[])(object)new Ability[1] { (Ability)4 });
			val2.baseHealth = 99;
			val2.baseAttack = 1;
		}

		public static Texture2D GetTexture(string path)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			byte[] array = File.ReadAllBytes(Path.Combine(Path.GetDirectoryName(Directory), "Artwork/", path + ".png"));
			Texture2D val = new Texture2D(2, 2);
			ImageConversion.LoadImage(val, array);
			((Texture)val).filterMode = (FilterMode)0;
			return val;
		}
	}
}