Decompiled source of BetaGemification v1.2.0

BetaGemification.dll

Decompiled a week 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 HarmonyLib;
using InscryptionAPI.Card;
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("BetaGemification")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Alters Act 3's Gemification upgrade to make it work like it did in the Inscryption beta")]
[assembly: AssemblyFileVersion("1.2.0.0")]
[assembly: AssemblyInformationalVersion("1.2.0")]
[assembly: AssemblyProduct("BetaGemification")]
[assembly: AssemblyTitle("BetaGemification")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.2.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 BetaGemification
{
	[BepInPlugin("tvflabs.inscryption.BetaGemification", "BetaGemification", "1.2.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(AttachGemSequencer), "UpdateModChoices")]
		private class AttachGemSequencer_UpdateModChoices_Patch
		{
			private static void Prefix(AttachGemSequencer __instance, CardInfo selectedCard)
			{
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0015: Expected O, but got Unknown
				//IL_0029: Unknown result type (might be due to invalid IL or missing references)
				//IL_002f: Expected O, but got Unknown
				//IL_0043: Unknown result type (might be due to invalid IL or missing references)
				//IL_0049: Expected O, but got Unknown
				if (__instance.modList == null)
				{
					CardModificationInfo val = new CardModificationInfo();
					val.addGemCost.Add((GemType)0);
					val.healthAdjustment = 2;
					CardModificationInfo val2 = new CardModificationInfo();
					val2.addGemCost.Add((GemType)1);
					val2.attackAdjustment = 1;
					CardModificationInfo val3 = new CardModificationInfo();
					val3.addGemCost.Add((GemType)2);
					val3.energyCostAdjustment = -2;
					__instance.modList = new List<CardModificationInfo> { val, val2, val3 };
				}
			}
		}

		[HarmonyPatch(typeof(AttachGemSequencer), "GetValidCardsFromDeck")]
		private class AttachGemSequencer_GetValidCardsFromDeck_Patch
		{
			private static void Postfix(AttachGemSequencer __instance, ref List<CardInfo> __result)
			{
				__result.RemoveAll((CardInfo c) => c.GemsCost.Count > 0);
			}
		}

		[HarmonyPatch(typeof(AttachGemSequencer), "DisplayMod")]
		private class AttachGemSequencer_DisplayMod_Patch
		{
			private static bool Prefix(AttachGemSequencer __instance)
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_006b: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
				Face currentFace = P03AnimationController.Instance.CurrentFace;
				P03AnimationController.Instance.SwitchToFace((Face)19, false, false).GetComponent<P03AddModFace>().DisplayCardWithMod(((Card)((DiskDriveModSequencer)__instance).selectedCard).Info, ((DiskDriveModSequencer)__instance).currentValidModChoices[((DiskDriveModSequencer)__instance).currentModIndex]);
				P03AnimationController.Instance.SwitchToFace((Face)19, false, false).GetComponent<P03GemFace>().SetGem(((DiskDriveModSequencer)__instance).currentValidModChoices[((DiskDriveModSequencer)__instance).currentModIndex].addGemCost[0]);
				P03AnimationController.Instance.SwitchToFace((Face)18, false, false).GetComponent<P03GemFace>().SetGem(((DiskDriveModSequencer)__instance).currentValidModChoices[((DiskDriveModSequencer)__instance).currentModIndex].addGemCost[0]);
				P03AnimationController.Instance.SwitchToFace(currentFace, false, false);
				return false;
			}
		}

		[HarmonyPatch(typeof(AttachGemSequencer), "ShowDetailsOnScreen")]
		private class AttachGemSequencer_ShowDetailsOnScreen_Patch
		{
			private static bool Prefix(AttachGemSequencer __instance)
			{
				P03AnimationController.Instance.SwitchToFace((Face)19, false, true).GetComponent<P03AddModFace>().DisplayCardWithMod(((Card)((DiskDriveModSequencer)__instance).selectedCard).Info, ((DiskDriveModSequencer)__instance).currentValidModChoices[((DiskDriveModSequencer)__instance).currentModIndex]);
				return false;
			}
		}

		[HarmonyPatch(typeof(AttachGemSequencer), "ShowOverviewOnScreen")]
		private class AttachGemSequencer_ShowOverviewOnScreen_Patch
		{
			private static bool Prefix(AttachGemSequencer __instance)
			{
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				P03AnimationController.Instance.SwitchToFace((Face)18, false, true).GetComponent<P03GemFace>().SetGem(((DiskDriveModSequencer)__instance).currentValidModChoices[((DiskDriveModSequencer)__instance).currentModIndex].addGemCost[0]);
				return false;
			}
		}

		[HarmonyPatch(typeof(AttachGemSequencer), "OnStartModSelection")]
		private class AttachGemSequencer_OnStartModSelection_Patch
		{
			private static bool Prefix(AttachGemSequencer __instance)
			{
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				P03AnimationController.Instance.SwitchToFace((Face)18, true, true).GetComponent<P03GemFace>().SetGem(((DiskDriveModSequencer)__instance).currentValidModChoices[((DiskDriveModSequencer)__instance).currentModIndex].addGemCost[0]);
				return false;
			}
		}

		[HarmonyPatch(typeof(DialogueDataUtil), "LoadData")]
		private class DialogueDataUtil_LoadData_Patch
		{
			private static void Postfix()
			{
				//IL_0046: Unknown result type (might be due to invalid IL or missing references)
				//IL_004c: Expected O, but got Unknown
				//IL_0059: Unknown result type (might be due to invalid IL or missing references)
				//IL_0069: Unknown result type (might be due to invalid IL or missing references)
				//IL_0070: Expected O, but got Unknown
				//IL_007f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0165: Unknown result type (might be due to invalid IL or missing references)
				//IL_016c: Expected O, but got Unknown
				//IL_017b: Unknown result type (might be due to invalid IL or missing references)
				//IL_018c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0193: Expected O, but got Unknown
				//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ba: Expected O, but got Unknown
				//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
				//IL_01da: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e1: Expected O, but got Unknown
				//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
				//IL_0201: Unknown result type (might be due to invalid IL or missing references)
				//IL_0208: Expected O, but got Unknown
				//IL_0217: Unknown result type (might be due to invalid IL or missing references)
				//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
				//IL_02ab: Expected O, but got Unknown
				//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
				//IL_02cb: Unknown result type (might be due to invalid IL or missing references)
				//IL_02d2: Expected O, but got Unknown
				//IL_02e1: Unknown result type (might be due to invalid IL or missing references)
				//IL_0324: Unknown result type (might be due to invalid IL or missing references)
				//IL_032b: Expected O, but got Unknown
				//IL_033a: Unknown result type (might be due to invalid IL or missing references)
				if (editedDialogue)
				{
					return;
				}
				editedDialogue = true;
				for (int i = 0; i < DialogueDataUtil.data.events.Count; i++)
				{
					if (DialogueDataUtil.data.events[i].id == "FactoryGemsModuleFetched2")
					{
						Line val = new Line();
						val.text = "New resource type: [c:g1]G[c:][c:g2]e[c:][c:g3]m[c:][c:g1]s[c:].";
						val.p03Face = (Face)0;
						val.specialInstruction = "";
						Line val2 = new Line();
						val2.text = "Then you can play cards that cost [c:g1]G[c:][c:g2]e[c:][c:g3]m[c:][c:g1]s[c:].";
						val2.p03Face = (Face)0;
						val2.specialInstruction = "";
						DialogueDataUtil.data.events[i].mainLines.lines = new List<Line>(5)
						{
							val,
							DialogueDataUtil.data.events[i].mainLines.lines[0],
							val2,
							DialogueDataUtil.data.events[i].mainLines.lines[1],
							DialogueDataUtil.data.events[i].mainLines.lines[2]
						};
					}
					else if (DialogueDataUtil.data.events[i].id == "TutorialAttachGem")
					{
						Line val3 = new Line();
						val3.text = "I hope you can understand this.";
						val3.p03Face = (Face)0;
						val3.specialInstruction = "";
						Line val4 = new Line();
						val4.text = "You're going to pick a card, okay?";
						val4.p03Face = (Face)0;
						val4.specialInstruction = "";
						Line val5 = new Line();
						val5.text = "In addition to its [c:bR]Energy[c:] cost, it will also have a [c:g1]G[c:][c:g2]e[c:][c:g3]m[c:] cost.";
						val5.p03Face = (Face)0;
						val5.specialInstruction = "";
						Line val6 = new Line();
						val6.text = "Don't panic just yet. I'm not finished.";
						val6.p03Face = (Face)3;
						val6.specialInstruction = "";
						Line val7 = new Line();
						val7.text = "The card's stats will be enhanced depending on the [c:g1]G[c:][c:g2]e[c:][c:g3]m[c:] you choose.";
						val7.p03Face = (Face)0;
						val7.specialInstruction = "";
						DialogueDataUtil.data.events[i].mainLines.lines = new List<Line>(5) { val3, val4, val5, val6, val7 };
					}
					else if (DialogueDataUtil.data.events[i].id == "AttachGemCompleted")
					{
						Line val8 = new Line();
						val8.text = "See that thing next to the energy cost?";
						val8.p03Face = (Face)0;
						val8.specialInstruction = "";
						Line val9 = new Line();
						val9.text = "You have to have that kind of [c:g1]G[c:][c:g2]e[c:][c:g3]m[c:] to play that card now.";
						val9.p03Face = (Face)0;
						val9.specialInstruction = "";
						DialogueDataUtil.data.events[i].mainLines.lines = new List<Line>(2) { val8, val9 };
						Line val10 = new Line();
						val10.text = "Play [c:g1]G[c:][c:g2]e[c:][c:g3]m[c:][c:g1]s[c:] to use it.";
						val10.p03Face = (Face)0;
						val10.specialInstruction = "";
						DialogueDataUtil.data.events[i].repeatLines[1].lines = new List<Line>(1) { val10 };
					}
				}
			}
		}

		[HarmonyPatch(typeof(Part3CardChoiceGenerator), "GenerateChoices")]
		private class Part3CardChoiceGenerator_GenerateChoices_Patch
		{
			private static void Prefix(Part3CardChoiceGenerator __instance, ref CardChoicesNodeData data, int randomSeed)
			{
				data.gemifyChoices = false;
			}
		}

		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		private class CardInfo_Gemified_getter_Patch
		{
			private static void Postfix(CardInfo __instance, ref bool __result)
			{
				__result = false;
			}
		}

		private Harmony harmony = new Harmony("tvflabs.inscryption.BetaGemification");

		private const string PluginGuid = "tvflabs.inscryption.BetaGemification";

		private const string PluginName = "BetaGemification";

		private const string PluginVersion = "1.2.0";

		private const string PluginPrefix = "BetaGemification";

		private static bool editedDialogue;

		private static bool editedCardList;

		private void Awake()
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded BetaGemification!");
			harmony.PatchAll();
			CardManager.ModifyCardList += delegate(List<CardInfo> cardList)
			{
				for (int i = 0; i < cardList.Count; i++)
				{
					if (((Object)cardList[i]).name == "GemExploder")
					{
						cardList[i].energyCost = 2;
						cardList[i].gemsCost = new List<GemType>(1) { (GemType)2 };
					}
					else if (((Object)cardList[i]).name == "GemShielder")
					{
						cardList[i].energyCost = 2;
						cardList[i].gemsCost = new List<GemType>(1) { (GemType)1 };
					}
					else if (((Object)cardList[i]).name == "GemRipper")
					{
						cardList[i].energyCost = 4;
						cardList[i].displayedName = "Emerald Ripper";
						cardList[i].gemsCost = new List<GemType>(1) { (GemType)0 };
					}
					else if (((Object)cardList[i]).name == "SentinelOrange")
					{
						cardList[i].displayedName = "Orange Sentinel";
						cardList[i].energyCost = 3;
						cardList[i].gemsCost = new List<GemType>(1) { (GemType)1 };
						cardList[i].baseAttack = 2;
					}
					else if (((Object)cardList[i]).name == "SentinelBlue")
					{
						cardList[i].displayedName = "Blue Sentinel";
						cardList[i].energyCost = 1;
						cardList[i].gemsCost = new List<GemType>(1) { (GemType)2 };
						cardList[i].baseAttack = 1;
					}
					else if (((Object)cardList[i]).name == "SentinelGreen")
					{
						cardList[i].displayedName = "Green Sentinel";
						cardList[i].energyCost = 3;
						cardList[i].gemsCost = new List<GemType>(1) { (GemType)0 };
						cardList[i].baseAttack = 1;
						cardList[i].baseHealth = 3;
					}
					else if (((Object)cardList[i]).name == "CellGift")
					{
						cardList[i].gemsCost = new List<GemType>(1) { (GemType)2 };
					}
					else if (((Object)cardList[i]).name == "CellTri")
					{
						cardList[i].gemsCost = new List<GemType>(1) { (GemType)0 };
					}
					else if (((Object)cardList[i]).name == "CellBuff")
					{
						cardList[i].gemsCost = new List<GemType>(1) { (GemType)1 };
					}
				}
				return cardList;
			};
			CardInfo val = Resources.Load<CardInfo>("data/cards/technology/GemExploder");
			val.energyCost = 2;
			val.gemsCost = new List<GemType>(1) { (GemType)2 };
			CardInfo val2 = Resources.Load<CardInfo>("data/cards/technology/GemShielder");
			val2.energyCost = 2;
			val2.gemsCost = new List<GemType>(1) { (GemType)1 };
			CardInfo val3 = Resources.Load<CardInfo>("data/cards/technology/GemRipper");
			val3.displayedName = "Emerald Ripper";
			val3.energyCost = 4;
			val3.gemsCost = new List<GemType>(1) { (GemType)0 };
			CardInfo val4 = Resources.Load<CardInfo>("data/cards/technology/SentinelGreen");
			val4.displayedName = "Green Sentinel";
			val4.energyCost = 3;
			val4.gemsCost = new List<GemType>(1) { (GemType)0 };
			val4.baseAttack = 1;
			val4.baseHealth = 3;
			CardInfo val5 = Resources.Load<CardInfo>("data/cards/technology/SentinelBlue");
			val5.displayedName = "Blue Sentinel";
			val5.energyCost = 1;
			val5.gemsCost = new List<GemType>(1) { (GemType)2 };
			val5.baseAttack = 1;
			CardInfo val6 = Resources.Load<CardInfo>("data/cards/technology/SentinelOrange");
			val6.displayedName = "Orange Sentinel";
			val6.energyCost = 3;
			val6.gemsCost = new List<GemType>(1) { (GemType)1 };
			val6.baseAttack = 2;
			CardInfo val7 = Resources.Load<CardInfo>("data/cards/technology/CellGift");
			val7.gemsCost = new List<GemType>(1) { (GemType)2 };
			CardInfo val8 = Resources.Load<CardInfo>("data/cards/technology/CellTri");
			val8.gemsCost = new List<GemType>(1) { (GemType)0 };
			CardInfo val9 = Resources.Load<CardInfo>("data/cards/technology/CellBuff");
			val9.gemsCost = new List<GemType>(1) { (GemType)1 };
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "BetaGemification";

		public const string PLUGIN_NAME = "BetaGemification";

		public const string PLUGIN_VERSION = "1.2.0";
	}
}