Decompiled source of MoreHouse v1.0.2

MoreHouse.dll

Decompiled 3 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using HouseMod.SkillStates.House.TheGame;
using Microsoft.CodeAnalysis;
using On.RoR2.UI;
using R2API;
using RiskOfOptions;
using RiskOfOptions.Options;
using RoR2;
using RoR2.Skills;
using RoR2.UI;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.UI;

[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("MoreHouse")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MoreHouse")]
[assembly: AssemblyTitle("MoreHouse")]
[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 MoreHouse
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("MoreHouse", "MoreHouse", "1.0.2")]
	internal class MoreHouse : BaseUnityPlugin
	{
		internal class SkillDefInfo
		{
			public string skillName;

			public string skillNameToken;

			public string skillDescriptionToken;

			public Sprite skillIcon;

			public SerializableEntityStateType activationState;

			public string activationStateMachineName;

			public int baseMaxStock;

			public float baseRechargeInterval;

			public bool beginSkillCooldownOnSkillEnd;

			public bool canceledFromSprinting;

			public bool forceSprintDuringState;

			public bool fullRestockOnAssign;

			public InterruptPriority interruptPriority;

			public bool resetCooldownTimerOnUse;

			public bool isCombatSkill;

			public bool mustKeyPress;

			public bool cancelSprintingOnActivation;

			public int rechargeStock;

			public int requiredStock;

			public int stockToConsume;

			public string[] keywordTokens;
		}

		internal class HouseCard
		{
			public enum CardType
			{
				Positive,
				Negative,
				Neutral,
				Random,
				None
			}

			public Sprite cardArt = null;

			public Sprite cardIcon = null;

			public string name = "DefaultCardName";

			public string description = "DefualtCardDescription";

			public Color color = Color.clear;

			public CardType type = CardType.None;

			public bool exhaust = false;

			public bool etherial = false;

			public bool indestructible = false;

			public int id;

			public HouseCard(string name, string description, Sprite cardIcon, Sprite cardArt, int id)
			{
				//IL_0025: Unknown result type (might be due to invalid IL or missing references)
				//IL_002a: Unknown result type (might be due to invalid IL or missing references)
				this.name = name;
				this.description = description;
				this.cardIcon = cardIcon;
				this.cardArt = cardArt;
			}
		}

		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static UnityAction <>9__53_0;

			public static Func<Assembly, bool> <>9__61_0;

			public static Func<Assembly, bool> <>9__64_0;

			internal void <openCardMenu>b__53_0()
			{
				customMenu.SetActive(false);
			}

			internal bool <changeHouse>b__61_0(Assembly asm)
			{
				return asm.GetName().Name == "HouseMod";
			}

			internal bool <CreateSkillDef>b__64_0(Assembly asm)
			{
				return asm.GetName().Name == "HouseMod";
			}
		}

		private const string modName = "MoreHouse";

		private const string Author = "idolfan";

		private const string modGuid = "MoreHouse";

		private const string Version = "1.0.2";

		public static GameObject customMenu;

		public static GameObject currentDeckView;

		public static GameObject keyBindHUD;

		public static GameObject keyBindPanel;

		public static Text KeyBindHUDText;

		public static HouseDeckDef deck1;

		public static HouseCard[] cards;

		public static Assembly houseAssembly;

		public static AssetBundle assetBundle;

		public static ConfigEntry<bool> debug { get; set; }

		public static int[] firstDeckCards { get; set; }

		public static ConfigEntry<string> firstDeck { get; set; }

		public static ConfigEntry<string> firstDeckName { get; set; }

		public static ConfigEntry<string> firstDeckDescription { get; set; }

		public static ConfigEntry<string> cardNumbers { get; set; }

		public static ConfigEntry<KeyboardShortcut> openCurrentDeckMenu { get; set; }

		public static ConfigEntry<bool> showShortcutHUD { get; set; }

		private void Awake()
		{
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Expected O, but got Unknown
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Expected O, but got Unknown
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Expected O, but got Unknown
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Expected O, but got Unknown
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Expected O, but got Unknown
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Expected O, but got Unknown
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_0237: Expected O, but got Unknown
			//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fb: Expected O, but got Unknown
			//IL_0303: Unknown result type (might be due to invalid IL or missing references)
			//IL_030d: Expected O, but got Unknown
			assetBundle = AssetBundle.LoadFromFile(Assembly.GetExecutingAssembly().Location.Replace("MoreHouse.dll", "morehouseassets"));
			debug = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "Debug mode", true, "Toggles debug messages");
			firstDeck = ((BaseUnityPlugin)this).Config.Bind<string>("Decks", "Custom Deck Cards", "16,16,16,6,6,19,19,20,20,2,2,2,2,1,1,1,1,4,4,4,4,14,14,14,14,34,34,34,34,34,31,31,31,31,31,32,32,9,9,13,13,8,8,26", "Cards used by the first Deck. You can manually add Cards separated by commas, or just use the visual Card Selection.");
			firstDeckName = ((BaseUnityPlugin)this).Config.Bind<string>("Decks", "Custom Deck Name", "Custom Deck", "The displayed name for the custom Deck");
			firstDeckDescription = ((BaseUnityPlugin)this).Config.Bind<string>("Decks", "Custom Deck Description", "Your custom deck.", "The displayed description for your custom deck");
			string[] array = firstDeck.Value.Split(',');
			firstDeckCards = new int[array.Length];
			openCurrentDeckMenu = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Decks", "View deck", new KeyboardShortcut((KeyCode)282, Array.Empty<KeyCode>()), "Open a view for your current deck durung a run.");
			showShortcutHUD = ((BaseUnityPlugin)this).Config.Bind<bool>("Decks", "Show Keybind HUD", true, "Show your keybind for the current deck view in the HUD.");
			ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(firstDeckName), "MoreHouse", "MoreHouse");
			firstDeckName.SettingChanged += changeDeckName;
			ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(firstDeckDescription), "MoreHouse", "MoreHouse");
			firstDeckDescription.SettingChanged += changeDeckDescription;
			ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(firstDeck), "MoreHouse", "MoreHouse");
			firstDeck.SettingChanged += changeDeckCards;
			ModSettingsManager.AddOption((BaseOption)new GenericButtonOption("Select Cards", "Decks", "Select cards for your deck by adding one Card via leftclick, and removing via rightclick. \n Changes will be applied immediately.\n The 'First Deck Cards' will only show your changes after reopening the Mod Options.", "Open Card Selection", new UnityAction(openCardMenu)), "MoreHouse", "MoreHouse");
			ModSettingsManager.AddOption((BaseOption)new KeyBindOption(openCurrentDeckMenu), "MoreHouse", "MoreHouse");
			openCurrentDeckMenu.SettingChanged += changeKeyBindHUDText;
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(showShortcutHUD), "MoreHouse", "MoreHouse");
			showShortcutHUD.SettingChanged += changeKeyBindHUD;
			ModSettingsManager.SetModIcon(assetBundle.LoadAsset<Sprite>("customDeck.png"), "MoreHouse", "MoreHouse");
			ModSettingsManager.SetModDescription("Adds a configurable deck to The House", "MoreHouse", "MoreHouse");
			for (int i = 0; i < array.Length; i++)
			{
				if (array[i] != "")
				{
					firstDeckCards[i] = int.Parse(array[i]);
				}
			}
			cardNumbers = ((BaseUnityPlugin)this).Config.Bind<string>("Indexes", "Indexes of cards", "", "7HEARTS:1\r\n7DIAMONDS:2\r\n7CLUBS:3\r\n7SPADES:4\r\nJACKPOT:5\r\n52:6\r\nBUST:7\r\nSNAKE:8\r\nCOINS:9\r\nSWORDS:10\r\nTOWER:11\r\nJOKER:12\r\n7JACK:13\r\n7ACE:14\r\n7KING:15\r\n7QUEEN:16\r\nRROULETTE:17\r\nWILDCARD:18\r\nFORTUNE:19\r\nTHREEOFAKIND:20\r\nGHEARTS:21\r\nGCLUBS:22\r\nGSPADES:23\r\nCRAZYCARD:24\r\nTHESUN:25\r\nTHEMOON:26\r\nTHESTAR:27\r\nTHEWORLD:28\r\nJUDGEMENT:29\r\nKINGOFWANDS:30\r\nKNIGHTOFSWORDS:31\r\nQUEENOFCUPS:32\r\nPAGEOFPENTACLES:33\r\nANTEUP:34");
			changeHouse();
			LanguageTokens();
			HUD.Awake += new hook_Awake(addKeyBindHUD);
			HUD.shouldHudDisplay += new ShouldHudDisplayDelegate(displayHUD);
			if (debug.Value)
			{
				Console.WriteLine("MoreHouse awake completed.");
			}
		}

		private void displayHUD(HUD hud, ref bool shouldDisplay)
		{
			object obj;
			if (hud == null)
			{
				obj = null;
			}
			else
			{
				LocalUser localUserViewer = hud.localUserViewer;
				if (localUserViewer == null)
				{
					obj = null;
				}
				else
				{
					CharacterBody cachedBody = localUserViewer.cachedBody;
					obj = ((cachedBody != null) ? ((Component)cachedBody).GetComponent("HousePassiveManager") : null);
				}
			}
			if ((Object)obj != (Object)null)
			{
				shouldDisplay = true;
				keyBindHUD.SetActive(true);
			}
		}

		private void changeKeyBindHUDText(object sender, EventArgs e)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)KeyBindHUDText != (Object)null)
			{
				Text keyBindHUDText = KeyBindHUDText;
				KeyboardShortcut value = openCurrentDeckMenu.Value;
				KeyCode mainKey = ((KeyboardShortcut)(ref value)).MainKey;
				keyBindHUDText.text = ((object)(KeyCode)(ref mainKey)).ToString();
			}
		}

		private void changeKeyBindHUD(object sender, EventArgs e)
		{
			if ((Object)(object)keyBindPanel != (Object)null)
			{
				keyBindPanel.gameObject.SetActive(showShortcutHUD.Value);
			}
		}

		private void addKeyBindHUD(orig_Awake orig, HUD self)
		{
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			GameObject val = assetBundle.LoadAsset<GameObject>("KeyBindHUDCanvas.prefab");
			keyBindHUD = Object.Instantiate<GameObject>(val);
			keyBindHUD.SetActive(false);
			keyBindPanel = ((Component)keyBindHUD.transform.Find("Panel")).gameObject;
			keyBindPanel.gameObject.SetActive(showShortcutHUD.Value);
			KeyBindHUDText = ((Component)keyBindPanel.transform.Find("Text")).GetComponent<Text>();
			Text keyBindHUDText = KeyBindHUDText;
			KeyboardShortcut value = openCurrentDeckMenu.Value;
			KeyCode mainKey = ((KeyboardShortcut)(ref value)).MainKey;
			keyBindHUDText.text = ((object)(KeyCode)(ref mainKey)).ToString();
		}

		public void Update()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)Run.instance != (Object)null)
			{
				KeyboardShortcut value = openCurrentDeckMenu.Value;
				if (Input.GetKeyDown(((KeyboardShortcut)(ref value)).MainKey))
				{
					openCurrentDeckView();
				}
			}
		}

		private void showKeyBind()
		{
		}

		private void openCurrentDeckView()
		{
			//IL_020d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Expected O, but got Unknown
			//IL_0228: Unknown result type (might be due to invalid IL or missing references)
			//IL_022d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_023e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0288: Unknown result type (might be due to invalid IL or missing references)
			//IL_0297: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0326: Unknown result type (might be due to invalid IL or missing references)
			//IL_032d: Expected O, but got Unknown
			//IL_03c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d7: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)currentDeckView != (Object)null)
			{
				currentDeckView.SetActive(false);
				Object.Destroy((Object)(object)currentDeckView);
				currentDeckView = null;
				return;
			}
			LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser();
			if (firstLocalUser == null)
			{
				return;
			}
			CharacterBody component = firstLocalUser.cachedMasterController.master.GetBodyObject().GetComponent<CharacterBody>();
			if ((Object)(object)component == (Object)null)
			{
				return;
			}
			Component component2 = ((Component)component).GetComponent("HousePassiveManager");
			if ((Object)(object)component2 == (Object)null)
			{
				return;
			}
			GameObject val = assetBundle.LoadAsset<GameObject>("CurrentDeckCanvas.prefab");
			currentDeckView = Object.Instantiate<GameObject>(val);
			currentDeckView.SetActive(true);
			Canvas component3 = currentDeckView.GetComponent<Canvas>();
			component3.renderMode = (RenderMode)0;
			component3.sortingOrder = 1000;
			GameObject gameObject = ((Component)currentDeckView.transform.Find("Panel")).gameObject;
			FieldInfo field = ((object)component2).GetType().GetField("gameDeck", BindingFlags.Instance | BindingFlags.Public);
			FieldInfo field2 = ((object)component2).GetType().GetField("gameDeckDiscardPile", BindingFlags.Instance | BindingFlags.Public);
			FieldInfo field3 = ((object)component2).GetType().GetField("handCards", BindingFlags.Instance | BindingFlags.Public);
			List<int> list = (List<int>)field.GetValue(component2);
			List<int> list2 = (List<int>)field2.GetValue(component2);
			int[] deck = (int[])field3.GetValue(component2);
			List<int[]> list3 = new List<int[]>();
			for (int i = 0; i < cards.Length; i++)
			{
				int num = countCardInDeck(list.ToArray(), i) + countCardInDeck(list2.ToArray(), i) + countCardInDeck(deck, i);
				if (num != 0)
				{
					list3.Add(new int[2] { i, num });
				}
			}
			float num2 = ((list3.Count > 16) ? 0.3f : 0.45f);
			for (int j = 0; j < list3.Count; j++)
			{
				HouseCard houseCard = cards[list3[j][0]];
				GameObject val2 = new GameObject(houseCard.name);
				RectTransform val3 = val2.AddComponent<RectTransform>();
				RectTransform component4 = gameObject.GetComponent<RectTransform>();
				Rect rect = component4.rect;
				float num3 = ((Rect)(ref rect)).width;
				rect = component4.rect;
				float num4 = num3 / ((Rect)(ref rect)).height;
				val3.anchorMin = new Vector2(0.05f + num2 * (float)j % 0.9f, 1f - 0.05f * num4 - num2 * num4 * (float)(int)(1f + num2 * (float)j / 0.9f));
				val3.anchorMax = new Vector2(val3.anchorMin.x + num2 * 0.9f, val3.anchorMin.y + num2 * 0.9f * num4);
				val3.sizeDelta = new Vector2(1f, 1f);
				Image val4 = val2.AddComponent<Image>();
				((Object)val4).name = houseCard.name + "IMAGE";
				val4.sprite = houseCard.cardIcon;
				GameObject val5 = new GameObject("NumberText" + j);
				val5.transform.SetParent(val2.transform, false);
				Text val6 = val5.AddComponent<Text>();
				int num5 = list3[j][1];
				val6.text = ((num5 != 0) ? (num5 + "x") : "");
				val6.font = Resources.GetBuiltinResource<Font>("Arial.ttf");
				val6.fontSize = 25;
				val6.alignment = (TextAnchor)2;
				Shadow val7 = val5.AddComponent<Shadow>();
				val7.effectColor = new Color(0f, 0f, 0f, 0.5f);
				val7.effectDistance = new Vector2(2f, -2f);
				val2.transform.SetParent(gameObject.transform, false);
			}
		}

		private void openCardMenu()
		{
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Expected O, but got Unknown
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Expected O, but got Unknown
			//IL_03af: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ba: Expected O, but got Unknown
			//IL_026a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0281: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02aa: Expected O, but got Unknown
			//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_02db: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e2: Expected O, but got Unknown
			//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0313: Unknown result type (might be due to invalid IL or missing references)
			//IL_031a: Expected O, but got Unknown
			//IL_031d: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = assetBundle.LoadAsset<GameObject>("Canvas.prefab");
			GameObject val2 = assetBundle.LoadAsset<GameObject>("Canvas");
			customMenu = Object.Instantiate<GameObject>(val);
			customMenu.SetActive(true);
			Canvas component = customMenu.GetComponent<Canvas>();
			component.renderMode = (RenderMode)0;
			component.sortingOrder = 1000;
			GameObject gameObject = ((Component)customMenu.transform.Find("Panel")).gameObject;
			for (int i = 0; i < cards.Length; i++)
			{
				HouseCard houseCard = cards[i];
				GameObject val3 = new GameObject(houseCard.name);
				RectTransform val4 = val3.AddComponent<RectTransform>();
				RectTransform component2 = gameObject.GetComponent<RectTransform>();
				Rect rect = component2.rect;
				float num = ((Rect)(ref rect)).width;
				rect = component2.rect;
				float num2 = num / ((Rect)(ref rect)).height;
				val4.anchorMin = new Vector2(0.1f + 0.1f * (float)i % 0.8f, 0.9f - 0.1f * num2 * (float)(int)(1f + 0.1f * (float)i / 0.8f));
				val4.anchorMax = new Vector2(val4.anchorMin.x + 0.09f, val4.anchorMin.y + 0.09f * num2);
				val4.sizeDelta = new Vector2(1f, 1f);
				Image val5 = val3.AddComponent<Image>();
				((Object)val5).name = houseCard.name + "IMAGE";
				val5.sprite = houseCard.cardIcon;
				Button val6 = val3.AddComponent<Button>();
				GameObject val7 = new GameObject("NumberText" + i);
				val7.transform.SetParent(val3.transform, false);
				Text numberText = val7.AddComponent<Text>();
				int num3 = countCardInDeck(firstDeckCards, i);
				numberText.text = ((num3 != 0) ? (num3 + "x") : "");
				numberText.font = Resources.GetBuiltinResource<Font>("Arial.ttf");
				numberText.fontSize = 25;
				numberText.alignment = (TextAnchor)2;
				Shadow val8 = val7.AddComponent<Shadow>();
				val8.effectColor = new Color(0f, 0f, 0f, 0.5f);
				val8.effectDistance = new Vector2(2f, -2f);
				int ownIndex = i;
				EventTrigger val9 = ((Component)val6).gameObject.AddComponent<EventTrigger>();
				Entry val10 = new Entry();
				val10.eventID = (EventTriggerType)4;
				((UnityEvent<BaseEventData>)(object)val10.callback).AddListener((UnityAction<BaseEventData>)delegate(BaseEventData eventData)
				{
					//IL_0007: Unknown result type (might be due to invalid IL or missing references)
					//IL_001d: Expected O, but got Unknown
					OnPointerClick((PointerEventData)eventData, ownIndex, numberText);
				});
				val9.triggers.Add(val10);
				Entry val11 = new Entry();
				val11.eventID = (EventTriggerType)0;
				((UnityEvent<BaseEventData>)(object)val11.callback).AddListener((UnityAction<BaseEventData>)delegate
				{
					OnPointerEnter(ownIndex);
				});
				val9.triggers.Add(val11);
				Entry val12 = new Entry();
				val12.eventID = (EventTriggerType)1;
				((UnityEvent<BaseEventData>)(object)val12.callback).AddListener((UnityAction<BaseEventData>)delegate
				{
					OnPointerExit();
				});
				val9.triggers.Add(val12);
				val3.transform.SetParent(gameObject.transform, false);
			}
			Button component3 = ((Component)customMenu.transform.Find("Panel/CloseButton")).GetComponent<Button>();
			ButtonClickedEvent onClick = component3.onClick;
			object obj = <>c.<>9__53_0;
			if (obj == null)
			{
				UnityAction val13 = delegate
				{
					customMenu.SetActive(false);
				};
				<>c.<>9__53_0 = val13;
				obj = (object)val13;
			}
			((UnityEvent)onClick).AddListener((UnityAction)obj);
		}

		private void OnPointerExit()
		{
		}

		private void OnPointerEnter(int cardIndex)
		{
			HouseCard houseCard = cards[cardIndex];
			Text component = ((Component)customMenu.transform.Find("CardPanel/CardNameText")).GetComponent<Text>();
			Text component2 = ((Component)customMenu.transform.Find("CardPanel/CardDescriptionText")).gameObject.GetComponent<Text>();
			string text = Language.GetString(houseCard.name) ?? houseCard.name;
			string input = Language.GetString(houseCard.description) ?? houseCard.description;
			component.text = text;
			component2.text = new Regex("<[^>]*style[^>]*>").Replace(input, "");
		}

		private void OnPointerClick(PointerEventData eventData, int index, Text numberText)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Invalid comparison between Unknown and I4
			if ((int)eventData.button == 1)
			{
				int indexOfCard = Array.IndexOf(firstDeckCards, index);
				if (indexOfCard == -1)
				{
					return;
				}
				int[] array = firstDeckCards.Where((int ValidationUtils, int idx) => idx != indexOfCard).ToArray();
				string text = "";
				for (int i = 0; i < array.Length; i++)
				{
					text += array[i];
					if (i != array.Length - 1)
					{
						text += ",";
					}
				}
				firstDeck.Value = text;
				firstDeckCards = array;
				int num = countCardInDeck(firstDeckCards, index);
				numberText.text = ((num != 0) ? (num + "x") : "");
			}
			else
			{
				if ((int)eventData.button != 0)
				{
					return;
				}
				int[] array2 = new int[firstDeckCards.Length + 1];
				firstDeckCards.CopyTo(array2, 0);
				array2[^1] = index;
				firstDeckCards = array2;
				string text2 = "";
				for (int j = 0; j < array2.Length; j++)
				{
					text2 += array2[j];
					if (j != array2.Length - 1)
					{
						text2 += ",";
					}
				}
				firstDeck.Value = text2;
				int num2 = countCardInDeck(firstDeckCards, index);
				numberText.text = ((num2 != 0) ? (num2 + "x") : "");
			}
		}

		private int countCardInDeck(int[] deck, int cardIndex)
		{
			return deck.Count((int x) => x == cardIndex);
		}

		private void changeDeckName(object sender, EventArgs e)
		{
			deck1.deckSkillDef.skillNameToken = firstDeckName.Value;
		}

		private void changeDeckDescription(object sender, EventArgs e)
		{
			deck1.deckSkillDef.skillDescriptionToken = firstDeckDescription.Value;
		}

		private void changeDeckCards(object sender, EventArgs e)
		{
			string[] array = firstDeck.Value.Split(',');
			firstDeckCards = new int[array.Length];
			for (int i = 0; i < array.Length; i++)
			{
				firstDeckCards[i] = int.Parse(array[i]);
			}
			deck1.deckCards = firstDeckCards;
		}

		private void changeHouse()
		{
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Expected O, but got Unknown
			//IL_018b: Expected O, but got Unknown
			//IL_01de: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Expected O, but got Unknown
			Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
			houseAssembly = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault((Assembly asm) => asm.GetName().Name == "HouseMod");
			Type type = houseAssembly.GetType("HouseMod.SkillStates.House.TheGame.HouseCardDefs");
			FieldInfo field = type.GetField("houseDecks", BindingFlags.Static | BindingFlags.Public);
			object value = field.GetValue(null);
			FieldInfo field2 = type.GetField("cards", BindingFlags.Static | BindingFlags.Public);
			object value2 = field2.GetValue(null);
			MethodInfo method = value2.GetType().GetMethod("GetLength");
			MethodInfo method2 = value2.GetType().GetMethod("GetValue", new Type[1] { typeof(int) });
			int num = (int)method.Invoke(value2, new object[1] { 0 });
			cards = new HouseCard[num];
			for (int i = 0; i < num; i++)
			{
				object obj = method2.Invoke(value2, new object[1] { i });
				Type type2 = obj.GetType();
				object value3 = type2.GetField("name").GetValue(obj);
				HouseCard houseCard = new HouseCard((string)type2.GetField("name").GetValue(obj), (string)type2.GetField("description").GetValue(obj), (Sprite)type2.GetField("cardIcon").GetValue(obj), (Sprite)type2.GetField("cardArt").GetValue(obj), i);
				cards[i] = houseCard;
			}
			Type type3 = houseAssembly.GetType("HouseMod.SkillStates.House.TheGame.HouseDeckDef");
			FieldInfo field3 = type3.GetField("deckSkillDef", BindingFlags.Instance | BindingFlags.Public);
			FieldInfo field4 = type3.GetField("deckCards", BindingFlags.Instance | BindingFlags.Public);
			deck1 = new HouseDeckDef();
			SkillDef val = CreateSkillDef(new SkillDefInfo
			{
				skillName = "SUPERTEST",
				skillNameToken = "FIRST_DECK_NAME",
				skillDescriptionToken = "FIRST_DECK_DESCRIPTION",
				skillIcon = assetBundle.LoadAsset<Sprite>("customDeck.png")
			});
			deck1.deckSkillDef = val;
			deck1.deckCards = firstDeckCards;
			MethodInfo method3 = value.GetType().GetMethod("Add");
			method3.Invoke(value, new object[1] { deck1 });
			Type type4 = houseAssembly.GetType("HouseMod.Modules.Survivors.House");
			FieldInfo field5 = type4.GetField("characterPrefab", BindingFlags.Static | BindingFlags.NonPublic);
			object? value4 = field5.GetValue(value);
			GameObject val2 = (GameObject)((value4 is GameObject) ? value4 : null);
			GenericSkill[] components = val2.GetComponents<GenericSkill>();
			SkillFamily skillFamily = components[0]._skillFamily;
			AddExtraSkill(val2, val, skillFamily);
		}

		internal static SkillDef CreateSkillDef(SkillDefInfo skillDefInfo)
		{
			//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_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			SkillDef val = ScriptableObject.CreateInstance<SkillDef>();
			val.skillName = skillDefInfo.skillName;
			val.skillNameToken = skillDefInfo.skillNameToken;
			val.skillDescriptionToken = skillDefInfo.skillDescriptionToken;
			val.icon = skillDefInfo.skillIcon;
			val.activationState = skillDefInfo.activationState;
			val.activationStateMachineName = skillDefInfo.activationStateMachineName;
			val.baseMaxStock = skillDefInfo.baseMaxStock;
			val.baseRechargeInterval = skillDefInfo.baseRechargeInterval;
			val.beginSkillCooldownOnSkillEnd = skillDefInfo.beginSkillCooldownOnSkillEnd;
			val.canceledFromSprinting = skillDefInfo.canceledFromSprinting;
			val.forceSprintDuringState = skillDefInfo.forceSprintDuringState;
			val.fullRestockOnAssign = skillDefInfo.fullRestockOnAssign;
			val.interruptPriority = skillDefInfo.interruptPriority;
			val.resetCooldownTimerOnUse = skillDefInfo.resetCooldownTimerOnUse;
			val.isCombatSkill = skillDefInfo.isCombatSkill;
			val.mustKeyPress = skillDefInfo.mustKeyPress;
			val.cancelSprintingOnActivation = skillDefInfo.cancelSprintingOnActivation;
			val.rechargeStock = skillDefInfo.rechargeStock;
			val.requiredStock = skillDefInfo.requiredStock;
			val.stockToConsume = skillDefInfo.stockToConsume;
			val.keywordTokens = skillDefInfo.keywordTokens;
			Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
			Assembly assembly = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault((Assembly asm) => asm.GetName().Name == "HouseMod");
			Type type = assembly.GetType("HouseMod.Modules.Skills");
			FieldInfo field = type.GetField("skillDefs", BindingFlags.Static | BindingFlags.NonPublic);
			object value = field.GetValue(null);
			MethodInfo method = value.GetType().GetMethod("Add");
			method.Invoke(value, new object[1] { val });
			return val;
		}

		internal static void AddExtraSkill(GameObject targetPrefab, SkillDef skillDef, SkillFamily skillFamily)
		{
			//IL_0029: 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)
			//IL_004b: Expected O, but got Unknown
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1);
			Variant[] variants = skillFamily.variants;
			int num = skillFamily.variants.Length - 1;
			Variant val = new Variant
			{
				skillDef = skillDef
			};
			((Variant)(ref val)).viewableNode = new Node(skillDef.skillNameToken, false, (Node)null);
			variants[num] = val;
		}

		private void LanguageTokens()
		{
			LanguageAPI.Add("FIRST_DECK_NAME", firstDeckName.Value);
			string text = "Hier könnte ihre Werbung stehen. <style=cStack>\n\n";
			LanguageAPI.Add("FIRST_DECK_DESCRIPTION", firstDeckDescription.Value);
		}
	}
}
namespace ExamplePlugin
{
	internal static class Log
	{
		private static ManualLogSource _logSource;

		internal static void Init(ManualLogSource logSource)
		{
			_logSource = logSource;
		}

		internal static void Debug(object data)
		{
			_logSource.LogDebug(data);
		}

		internal static void Error(object data)
		{
			_logSource.LogError(data);
		}

		internal static void Fatal(object data)
		{
			_logSource.LogFatal(data);
		}

		internal static void Info(object data)
		{
			_logSource.LogInfo(data);
		}

		internal static void Message(object data)
		{
			_logSource.LogMessage(data);
		}

		internal static void Warning(object data)
		{
			_logSource.LogWarning(data);
		}
	}
}