Decompiled source of ModularEnhancement v0.0.1

plugins/ModularEnhancement.dll

Decompiled 5 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using CardChoiceSpawnUniqueCardPatch.CustomCategories;
using HarmonyLib;
using Jotunn.Utils;
using ME.Cards;
using ME.Extensions;
using ME.Monos;
using ModdingUtils.Extensions;
using ModdingUtils.MonoBehaviours;
using ModdingUtils.Utils;
using ModsPlus;
using Photon.Pun;
using RarityLib.Utils;
using TMPro;
using UnboundLib;
using UnboundLib.Cards;
using UnboundLib.GameModes;
using UnboundLib.Networking;
using UnboundLib.Utils;
using UnityEngine;
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("ModularEnhancement")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ModularEnhancement")]
[assembly: AssemblyTitle("ModularEnhancement")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace ME
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[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("koala.modular.enhancement", "Modular Enhancement", "0.0.1")]
	[BepInProcess("Rounds.exe")]
	public class ME : BaseUnityPlugin
	{
		private const string ModId = "koala.modular.enhancement";

		private const string ModName = "Modular Enhancement";

		public const string Version = "0.0.1";

		public const string ModInitials = "MODLR";

		public static ME instance;

		internal static AssetBundle ArtAssets;

		internal static ObjectsToSpawn wallbounce;

		public static CardInfo[] Modules;

		internal static CardCategory Module;

		private void Start()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			Harmony val = new Harmony("koala.modular.enhancement");
			val.PatchAll();
			instance = this;
			FieldInfo field = typeof(CardManager).GetField("defaultCards", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
			CardInfo[] source = (CardInfo[])field.GetValue(null);
			CardInfo val2 = source.Where((CardInfo c) => c.cardName.ToLower() == "mayhem").ToArray()[0];
			wallbounce = ((Component)val2).gameObject.GetComponent<Gun>().objectsToSpawn[0];
			ArtAssets = AssetUtils.LoadAssetBundleFromResources("modularassets", typeof(ME).Assembly);
			if ((Object)(object)ArtAssets == (Object)null)
			{
				Debug.Log((object)"Modular Enhancment art asset bundle either doesn't exist or failed to load.");
			}
			Module = CustomCardCategories.instance.CardCategory("Module");
			GameModeManager.AddHook("GameStart", (Func<IGameModeHandler, IEnumerator>)GameStart);
			ExtensionMethods.ExecuteAfterFrames((MonoBehaviour)(object)instance, 10, (Action)delegate
			{
				List<CardInfo> list = new List<CardInfo>
				{
					ModularMK1.card,
					ModularMK2.card,
					ModularMK3.card
				};
				Modules = (CardInfo[])(object)new CardInfo[6]
				{
					BlankCard.card,
					BuffModule.card,
					DamageModule.card,
					HealthModule.card,
					MobilityModule.card,
					BlockModule.card
				};
				foreach (CardInfo item in list)
				{
					foreach (CardInfo item2 in list)
					{
						if ((Object)(object)item != (Object)(object)item2)
						{
							CustomCardCategories.instance.MakeCardsExclusive(item, item2);
						}
					}
				}
			});
		}

		private void Awake()
		{
			CustomCard.BuildCard<ModularMK1>((Action<CardInfo>)delegate(CardInfo card)
			{
				ModularMK1.card = card;
				ExtensionMethods.SetAbbreviation(card, "M1");
			});
			CustomCard.BuildCard<ModularMK2>((Action<CardInfo>)delegate(CardInfo card)
			{
				ModularMK2.card = card;
				ExtensionMethods.SetAbbreviation(card, "M2");
			});
			CustomCard.BuildCard<ModularMK3>((Action<CardInfo>)delegate(CardInfo card)
			{
				ModularMK3.card = card;
				ExtensionMethods.SetAbbreviation(card, "M3");
			});
			CustomCard.BuildCard<DamageModule>((Action<CardInfo>)delegate(CardInfo card)
			{
				DamageModule.card = card;
				ExtensionMethods.SetAbbreviation(card, "DM");
			});
			CustomCard.BuildCard<HealthModule>((Action<CardInfo>)delegate(CardInfo card)
			{
				HealthModule.card = card;
				ExtensionMethods.SetAbbreviation(card, "HM");
			});
			CustomCard.BuildCard<MobilityModule>((Action<CardInfo>)delegate(CardInfo card)
			{
				MobilityModule.card = card;
				ExtensionMethods.SetAbbreviation(card, "MM");
			});
			CustomCard.BuildCard<BuffModule>((Action<CardInfo>)delegate(CardInfo card)
			{
				BuffModule.card = card;
				ExtensionMethods.SetAbbreviation(card, "BM");
			});
			CustomCard.BuildCard<BlockModule>((Action<CardInfo>)delegate(CardInfo card)
			{
				BlockModule.card = card;
				ExtensionMethods.SetAbbreviation(card, "BM");
			});
			CustomCard.BuildCard<ModModule>((Action<CardInfo>)delegate(CardInfo card)
			{
				ModModule.card = card;
				ExtensionMethods.SetAbbreviation(card, "MC");
			});
			CustomCard.BuildCard<ModStats>((Action<CardInfo>)delegate(CardInfo card)
			{
				ModStats.card = card;
				Cards.instance.AddHiddenCard(card);
			});
		}

		private IEnumerator GameStart(IGameModeHandler gm)
		{
			foreach (Player player in PlayerManager.instance.players)
			{
				if (!CharacterStatModifiersExtension.GetAdditionalData(player.data.stats).blacklistedCategories.Contains(Module))
				{
					CharacterStatModifiersExtension.GetAdditionalData(player.data.stats).blacklistedCategories.Add(Module);
				}
			}
			yield return null;
		}

		public static GameObject GetBase(string chosen)
		{
			GameObject val = ArtAssets.LoadAsset<GameObject>(chosen);
			((Component)val.transform.GetChild(0)).GetComponent<Canvas>().sortingLayerID = -1160774667;
			return val;
		}
	}
}
namespace ME.Patches
{
	[HarmonyPatch(typeof(Block))]
	internal class Block_Patch
	{
		[HarmonyPostfix]
		[HarmonyPatch("IsBlocking")]
		private static void IncreasedBlockTime(Block __instance, ref bool __result, CharacterData ___data)
		{
			if ((double)__instance.sinceBlock < 0.3 + (double)___data.stats.GetAdditionalData().extraBlockTime)
			{
				__instance.ShowStatusEffectBlock();
			}
			__result = __result || (double)__instance.sinceBlock < 0.3 + (double)___data.stats.GetAdditionalData().extraBlockTime;
		}
	}
}
namespace ME.Extensions
{
	public static class BlockExtension
	{
		public static void UpdateParticleDuration(this Block block)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			float simulationSpeed = 1f / ((0.3f + ((Component)block).GetComponent<CharacterStatModifiers>().GetAdditionalData().extraBlockTime) / 0.3f);
			MainModule main = block.particle.main;
			((MainModule)(ref main)).simulationSpeed = simulationSpeed;
		}
	}
	[Serializable]
	public class CharacterStatModifiersAdditionalData
	{
		public float extraBlockTime;

		public CharacterStatModifiersAdditionalData()
		{
			extraBlockTime = 0f;
		}
	}
	public static class CharacterStatModifiersExtension
	{
		public static readonly ConditionalWeakTable<CharacterStatModifiers, CharacterStatModifiersAdditionalData> data = new ConditionalWeakTable<CharacterStatModifiers, CharacterStatModifiersAdditionalData>();

		public static CharacterStatModifiersAdditionalData GetAdditionalData(this CharacterStatModifiers statModifiers)
		{
			return data.GetOrCreateValue(statModifiers);
		}

		public static void AddData(this CharacterStatModifiers statModifiers, CharacterStatModifiersAdditionalData value)
		{
			try
			{
				data.Add(statModifiers, value);
			}
			catch (Exception)
			{
			}
		}
	}
	[HarmonyPatch(typeof(CharacterStatModifiers), "ResetStats")]
	internal class CharacterStatModifiersPatchResetStats
	{
		private static void Prefix(CharacterStatModifiers __instance)
		{
			__instance.GetAdditionalData().extraBlockTime = 0f;
		}
	}
}
namespace ME.Monos
{
	public class ModStats : CustomEffectCard<ModularStats>
	{
		internal static CardInfo card;

		public override CardDetails<ModularStats> Details => new CardDetails<ModularStats>
		{
			Title = "Modular Stats",
			Description = "Displays Modular Stats\nM to open Modular Settings",
			ModName = "MODLR",
			Art = null,
			Rarity = (Rarity)2,
			Theme = (CardThemeColorType)3
		};

		protected override GameObject GetCardBase()
		{
			return ME.GetBase("StatsBase");
		}

		public override bool GetEnabled()
		{
			return false;
		}

		protected override void Added(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
			ExtensionMethods.ExecuteAfterFrames((MonoBehaviour)(object)ME.instance, 25, (Action)delegate
			{
				CharacterStatModifiersExtension.GetAdditionalData(player.data.stats).blacklistedCategories.Remove(ME.Module);
			});
		}

		protected override void Removed(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
			ExtensionMethods.ExecuteAfterFrames((MonoBehaviour)(object)ME.instance, 25, (Action)delegate
			{
				CharacterStatModifiersExtension.GetAdditionalData(player.data.stats).blacklistedCategories.Add(ME.Module);
			});
		}
	}
	public class DisplayIdentifier : MonoBehaviour
	{
		public ModularArmor owner;

		public CardInfo card;

		public Vector2 bounds = new Vector2(2.3f, 6.25f);

		public bool isOn = false;
	}
	public class ModularArmor : CardEffect
	{
		public List<int> mods = new List<int>();

		public List<int> savedMods = new List<int>();

		public List<GameObject> modObjs = new List<GameObject>();

		public bool editingMods = false;

		public int slots;

		public int boosts;

		public string[] statsS = new string[5] { "Damage", "Health", "Movement Speed", "Jump-Height", "Block Duration" };

		public string[] statsE = new string[5] { "%", "%", "%", "%", "s" };

		public float[] statsN = new float[5] { 1f, 1f, 1f, 1f, 1f };

		public GameObject modularDisplay;

		protected override void OnDestroy()
		{
			GameModeManager.RemoveHook("BattleStart", (Func<IGameModeHandler, IEnumerator>)PointStart);
			GameModeManager.RemoveHook("PointEnd", (Func<IGameModeHandler, IEnumerator>)PointEnd);
		}

		protected override void Start()
		{
			GameModeManager.AddHook("BattleStart", (Func<IGameModeHandler, IEnumerator>)PointStart);
			GameModeManager.AddHook("PointEnd", (Func<IGameModeHandler, IEnumerator>)PointEnd);
			foreach (CardInfo currentCard in ((CardEffect)this).player.data.currentCards)
			{
				if ((Object)(object)currentCard == (Object)(object)ModularMK1.card || (Object)(object)currentCard == (Object)(object)ModularMK2.card || (Object)(object)currentCard == (Object)(object)ModularMK3.card)
				{
					slots = int.Parse(currentCard.cardStats[0].amount);
					boosts = int.Parse(currentCard.cardStats[1].amount);
				}
			}
			BuildModular();
		}

		public void BuildModular()
		{
			int num = slots + boosts;
			for (int i = 0; i < num; i++)
			{
				mods.Add(0);
			}
		}

		private void HoverOverCard(CardInfo card)
		{
			MonoBehaviour.print((object)card.cardName);
		}

		private void ShowModularDisplay()
		{
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			editingMods = true;
			if ((Object)(object)modularDisplay != (Object)null)
			{
				Object.Destroy((Object)(object)modularDisplay);
			}
			modularDisplay = Object.Instantiate<GameObject>(ME.ArtAssets.LoadAsset<GameObject>("CardDisplaySystem"));
			GameObject val = Object.Instantiate<GameObject>(ME.ArtAssets.LoadAsset<GameObject>("ModularGreyedout"), modularDisplay.transform);
			((Renderer)val.GetComponent<SpriteRenderer>()).sortingLayerID = -1160774667;
			modularDisplay.transform.position = Vector3.zero;
			float num = mods.Count / 4;
			num = 0f;
			for (int i = 0; (float)i < num; i++)
			{
				GameObject val2 = Object.Instantiate<GameObject>(ME.ArtAssets.LoadAsset<GameObject>("USBHub"), modularDisplay.transform.GetChild(0).GetChild(0).GetChild(0)
					.GetChild(0));
				((Component)val2.transform.GetChild(0)).GetComponent<Canvas>().sortingLayerID = -1160774667;
				modularDisplay = ((Component)val2.transform.parent).gameObject;
				val2.SetActive(false);
			}
			List<CardInfo> list = new List<CardInfo>();
			foreach (CardInfo currentCard in ((CardEffect)this).player.data.currentCards)
			{
				if (currentCard.categories.Contains(ME.Module))
				{
					list.Add(currentCard);
				}
			}
			modObjs.Clear();
			int[] array = new int[ME.Modules.Length];
			foreach (int mod in mods)
			{
				if (mod != 0)
				{
					array[mod]++;
				}
			}
			Vector3 val4 = default(Vector3);
			for (int j = 0; j < list.Count; j++)
			{
				CardInfo val3 = list[j];
				((Vector3)(ref val4))..ctor(-10f * (float)(list.Count - 1) / 2f + 10f * (float)j, -10f, 0f);
				GameObject card = GenerateCard(val3, modularDisplay.transform.GetChild(0).GetChild(0).GetChild(0)
					.GetChild(0));
				modObjs.Add(card);
				card.gameObject.AddComponent<DisplayIdentifier>().owner = this;
				card.gameObject.GetComponent<DisplayIdentifier>().card = val3;
				int num2 = ME.Modules.ToList().IndexOf(val3);
				if (array[num2] > 0)
				{
					card.GetComponent<DisplayIdentifier>().isOn = true;
					array[num2]--;
					ExtensionMethods.ExecuteAfterFrames((MonoBehaviour)(object)ME.instance, 5, (Action)delegate
					{
						//IL_0038: Unknown result type (might be due to invalid IL or missing references)
						((Graphic)((Component)card.transform.GetChild(0).GetChild(0).GetChild(0)
							.GetChild(2)).GetComponent<TextMeshProUGUI>()).color = new Color(1f, 1f, 0f);
					});
				}
			}
		}

		public override void OnTakeDamage(Vector2 damage, bool selfDamage)
		{
			if (((Vector2)(ref damage)).magnitude > ((CardEffect)this).player.data.health)
			{
				HideModularDisplay();
			}
		}

		private GameObject GenerateCard(CardInfo cardToMake, Transform daddy)
		{
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: 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_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			GameObject cardObj = Object.Instantiate<GameObject>(((Component)cardToMake).gameObject, daddy);
			cardObj.SetActive(true);
			cardObj.transform.Rotate(0f, 0f, 0f);
			cardObj.GetComponentInChildren<CardVisuals>().firstValueToSet = true;
			Object.Destroy((Object)(object)((Component)((Component)cardObj.transform).GetComponentInChildren<Collider2D>()).gameObject);
			RectTransform orAddComponent = ExtensionMethods.GetOrAddComponent<RectTransform>(cardObj, false);
			((Transform)orAddComponent).localScale = Vector3.one * 20f;
			Transform transform = ((Component)orAddComponent).transform;
			transform.localPosition /= 20f;
			orAddComponent.anchorMin = Vector2.zero;
			orAddComponent.anchorMax = Vector2.one;
			orAddComponent.offsetMin = Vector2.zero;
			orAddComponent.offsetMax = Vector2.zero;
			orAddComponent.pivot = new Vector2(0.5f, 0.5f);
			GameObject val = FindObjectInChildren(cardObj, "Back");
			try
			{
				Object.Destroy((Object)(object)val);
			}
			catch
			{
			}
			GameObject obj2 = FindObjectInChildren(cardObj, "BlockFront");
			if (obj2 != null)
			{
				obj2.SetActive(false);
			}
			CanvasGroup[] componentsInChildren = cardObj.GetComponentsInChildren<CanvasGroup>();
			CanvasGroup[] array = componentsInChildren;
			foreach (CanvasGroup val2 in array)
			{
				val2.alpha = 1f;
			}
			ExtensionMethods.ExecuteAfterSeconds((MonoBehaviour)(object)this, 0.2f, (Action)delegate
			{
				CardRarityColor[] componentsInChildren2 = cardObj.GetComponentsInChildren<CardRarityColor>();
				CardRarityColor[] array2 = componentsInChildren2;
				foreach (CardRarityColor val3 in array2)
				{
					try
					{
						val3.Toggle(true);
					}
					catch
					{
					}
				}
			});
			return cardObj;
		}

		private static GameObject FindObjectInChildren(GameObject gameObject, string gameObjectName)
		{
			Transform[] componentsInChildren = gameObject.GetComponentsInChildren<Transform>(true);
			return (from item in componentsInChildren
				where ((Object)item).name == gameObjectName
				select ((Component)item).gameObject).FirstOrDefault();
		}

		private void HideModularDisplay()
		{
			editingMods = false;
			modObjs.Clear();
			Object.Destroy((Object)(object)modularDisplay);
		}

		private void Update()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: 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_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: 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_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: 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_02fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_026c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0610: Unknown result type (might be due to invalid IL or missing references)
			if (editingMods)
			{
				float x = MainCam.instance.cam.ScreenToWorldPoint(Input.mousePosition).x;
				float y = MainCam.instance.cam.ScreenToWorldPoint(Input.mousePosition).y;
				Vector3 val = default(Vector3);
				((Vector3)(ref val))..ctor(x, y, ((Component)((CardEffect)this).player).transform.position.z);
				Vector3 val2 = default(Vector3);
				((Vector3)(ref val2))..ctor(6.25f, 45f, 0f);
				int num = 0;
				foreach (int mod in mods)
				{
					if (mod == 0)
					{
						num++;
					}
				}
				((TMP_Text)((Component)modularDisplay.transform.GetChild(1)).GetComponent<TextMeshProUGUI>()).text = "Modules Left: " + num;
				foreach (GameObject modObj in modObjs)
				{
					Vector3 mousePosition = Input.mousePosition;
					Vector3 val3 = modObj.transform.position + new Vector3(148f, 45f, 0f);
					Vector3 val4 = modObj.transform.position - new Vector3(77f, 45f, 0f);
					if (!(mousePosition.x > val4.x) || !(mousePosition.x < val3.x) || !(mousePosition.y > val4.y) || !(mousePosition.y < val3.y) || !Input.GetMouseButtonDown(0))
					{
						continue;
					}
					if (!modObj.GetComponent<DisplayIdentifier>().isOn)
					{
						if (mods.IndexOf(0) != -1)
						{
							modObj.GetComponent<DisplayIdentifier>().isOn = true;
							int index = mods.IndexOf(0);
							int value = ME.Modules.ToList().IndexOf(modObj.GetComponent<DisplayIdentifier>().card);
							mods[index] = value;
							((Graphic)((Component)modObj.transform.GetChild(0).GetChild(0).GetChild(0)
								.GetChild(2)).GetComponent<TextMeshProUGUI>()).color = new Color(1f, 1f, 0f);
						}
					}
					else
					{
						modObj.GetComponent<DisplayIdentifier>().isOn = false;
						int item = ME.Modules.ToList().IndexOf(modObj.GetComponent<DisplayIdentifier>().card);
						int index2 = mods.IndexOf(item);
						mods[index2] = 0;
						((Graphic)((Component)modObj.transform.GetChild(0).GetChild(0).GetChild(0)
							.GetChild(2)).GetComponent<TextMeshProUGUI>()).color = new Color(0.6792f, 0.6792f, 0.6792f);
					}
				}
			}
			if (Input.GetKeyDown((KeyCode)109) && ((CardEffect)this).player.data.view.IsMine)
			{
				if (!editingMods)
				{
					ShowModularDisplay();
				}
				else
				{
					HideModularDisplay();
				}
			}
			if ((Object)(object)GameObject.Find("__MODLR__Modular Stats(Clone)") != (Object)null)
			{
				int index3 = 0;
				for (int i = 0; i < PlayerManager.instance.players.Count(); i++)
				{
					string text = "Bar" + (i + 1);
					GameObject val5 = GameObject.Find(text);
					for (int j = 1; j < val5.transform.childCount; j++)
					{
						GameObject gameObject = ((Component)val5.transform.GetChild(j)).gameObject;
						if (gameObject.GetComponent<HoverEvent>().isHovered)
						{
							index3 = i;
						}
					}
				}
				ModularArmor componentInChildren = ((Component)((Component)PlayerManager.instance.players[index3]).transform).GetComponentInChildren<ModularArmor>();
				float[] array = componentInChildren.statsN;
				GameObject val6 = GameObject.Find("__MODLR__Modular Stats(Clone)");
				GameObject gameObject2 = ((Component)val6.transform.GetChild(0).GetChild(0).GetChild(0)
					.GetChild(4)).gameObject;
				GameObject gameObject3 = ((Component)val6.transform.GetChild(0).GetChild(0).GetChild(0)
					.GetChild(5)).gameObject;
				for (int num2 = gameObject3.transform.childCount - 1; num2 > 0; num2--)
				{
					Object.Destroy((Object)(object)((Component)gameObject3.transform.GetChild(num2)).gameObject);
				}
				for (int k = 0; k < array.Length; k++)
				{
					float num3 = (int)((array[k] - 1f) * 100f);
					float num4 = (int)(array[k] * 100f);
					string text2 = statsE[k];
					string text3 = text2;
					if (text3 == "s")
					{
						num3 = array[k] - 1f;
					}
					if (array[k] > 1f)
					{
						GameObject val7 = Object.Instantiate<GameObject>(gameObject2, gameObject3.transform);
						val7.SetActive(true);
						((TMP_Text)((Component)val7.transform.GetChild(1)).GetComponent<TextMeshProUGUI>()).text = "+" + num3 + statsE[k];
						((TMP_Text)((Component)val7.transform.GetChild(0)).GetComponent<TextMeshProUGUI>()).text = statsS[k];
					}
					if (array[k] < 1f)
					{
						GameObject val8 = Object.Instantiate<GameObject>(gameObject2, gameObject3.transform);
						val8.SetActive(true);
						((Graphic)((Component)val8.transform.GetChild(1)).GetComponent<TextMeshProUGUI>()).color = new Color(0.6981f, 0.326f, 0.326f);
						((TMP_Text)((Component)val8.transform.GetChild(1)).GetComponent<TextMeshProUGUI>()).text = "-" + num4 + statsE[k];
						((TMP_Text)((Component)val8.transform.GetChild(0)).GetComponent<TextMeshProUGUI>()).text = statsS[k];
					}
				}
			}
			if (savedMods != mods && (Object)(object)((Component)((CardEffect)this).player).GetComponentInChildren<ModularStats>() != (Object)null)
			{
				((Component)((CardEffect)this).player).GetComponentInChildren<ModularStats>().DoStatUpdate(((CardEffect)this).player.playerID, mods.ToArray());
				savedMods = mods;
			}
		}

		public void ListReadInt(List<int> list)
		{
			string text = "";
			foreach (int item in list)
			{
				text = text + item + ", ";
			}
			MonoBehaviour.print((object)text);
		}

		private IEnumerator PointStart(IGameModeHandler gm)
		{
			statsN = new float[5] { 1f, 1f, 1f, 1f, 1f };
			float mult = 1f;
			foreach (int i in mods)
			{
				if (i == 1)
				{
					mult *= 1.2f;
				}
			}
			using (List<int>.Enumerator enumerator2 = mods.GetEnumerator())
			{
				while (enumerator2.MoveNext())
				{
					switch (enumerator2.Current)
					{
					case 2:
						statsN[0] *= 1.3f * mult;
						break;
					case 3:
						statsN[1] *= 1.3f * mult;
						break;
					case 4:
						statsN[2] *= 1.2f * mult;
						statsN[3] *= 1.2f * mult;
						break;
					case 5:
						statsN[4] += 0.25f * mult;
						break;
					}
				}
			}
			ReversibleEffect reversibleEffect = ((Component)((CardEffect)this).player).gameObject.AddComponent<ReversibleEffect>();
			reversibleEffect.gunStatModifier.damage_mult = statsN[0];
			reversibleEffect.characterDataModifier.maxHealth_mult = statsN[1];
			reversibleEffect.stats.movementSpeed = statsN[2];
			reversibleEffect.stats.jump = statsN[3];
			((CardEffect)this).player.data.stats.GetAdditionalData().extraBlockTime += statsN[4] - 1f;
			float ratio = 1f / ((0.3f + ((Component)((CardEffect)this).player.data.stats).GetComponent<CharacterStatModifiers>().GetAdditionalData().extraBlockTime) / 0.3f);
			MainModule main = ((CardEffect)this).block.particle.main;
			((MainModule)(ref main)).simulationSpeed = ratio;
			reversibleEffect.SetLivesToEffect(((CardEffect)this).player.data.stats.respawns + 1);
			yield break;
		}

		private IEnumerator PointEnd(IGameModeHandler gm)
		{
			((CardEffect)this).player.data.stats.GetAdditionalData().extraBlockTime -= statsN[4] - 1f;
			float ratio = 1f / ((0.3f + ((Component)((CardEffect)this).player.data.stats).GetComponent<CharacterStatModifiers>().GetAdditionalData().extraBlockTime) / 0.3f);
			MainModule main = ((CardEffect)this).block.particle.main;
			((MainModule)(ref main)).simulationSpeed = ratio;
			yield break;
		}
	}
	public class ModularStats : CardEffect
	{
		public void DoStatUpdate(int playerId, int[] newMods)
		{
			if (!PhotonNetwork.IsMasterClient && !PhotonNetwork.OfflineMode)
			{
				NetworkingManager.RPC(typeof(ModularStats), "RPC_ModularArmorStat", new object[2] { playerId, newMods });
			}
		}

		[UnboundRPC]
		public static void RPC_ModularArmorStat(int playerId, int[] newMods)
		{
			Player playerWithID = ExtensionMethods.GetPlayerWithID(PlayerManager.instance, playerId);
			((Component)playerWithID).GetComponentInChildren<ModularArmor>().mods = newMods.ToList();
		}
	}
}
namespace ME.Cards
{
	public class BlankCard : SimpleCard
	{
		internal static CardInfo card;

		public override CardDetails Details
		{
			get
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0006: Expected O, but got Unknown
				//IL_0046: Unknown result type (might be due to invalid IL or missing references)
				//IL_0062: Unknown result type (might be due to invalid IL or missing references)
				//IL_0067: Unknown result type (might be due to invalid IL or missing references)
				//IL_0072: Unknown result type (might be due to invalid IL or missing references)
				//IL_0079: Unknown result type (might be due to invalid IL or missing references)
				//IL_007b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0080: Unknown result type (might be due to invalid IL or missing references)
				//IL_008c: Expected O, but got Unknown
				CardDetails val = new CardDetails();
				val.Title = "Blank";
				val.Description = "Does Nothing";
				val.ModName = "MODLR";
				val.Art = ME.ArtAssets.LoadAsset<GameObject>("C_Blank");
				val.Rarity = RarityUtils.GetRarity("Legendary");
				val.Theme = (CardThemeColorType)3;
				val.Stats = (CardInfoStat[])(object)new CardInfoStat[1]
				{
					new CardInfoStat
					{
						amount = "+100%",
						positive = true,
						simepleAmount = (SimpleAmount)0,
						stat = "Nothing"
					}
				};
				return val;
			}
		}

		protected override GameObject GetCardBase()
		{
			GameObject val = ME.ArtAssets.LoadAsset<GameObject>("ModularBase");
			((Component)val.transform.GetChild(0)).GetComponent<Canvas>().sortingLayerID = -1160774667;
			return val;
		}
	}
	public class ModularMK1 : CustomEffectCard<ModularArmor>
	{
		internal static CardInfo card;

		public override CardDetails<ModularArmor> Details
		{
			get
			{
				//IL_0059: Unknown result type (might be due to invalid IL or missing references)
				//IL_005e: 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: Unknown result type (might be due to invalid IL or missing references)
				//IL_0072: Unknown result type (might be due to invalid IL or missing references)
				//IL_0077: Unknown result type (might be due to invalid IL or missing references)
				//IL_0083: Expected O, but got Unknown
				//IL_0085: Unknown result type (might be due to invalid IL or missing references)
				//IL_008a: 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_009c: 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)
				//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00af: Expected O, but got Unknown
				CardDetails<ModularArmor> val = new CardDetails<ModularArmor>();
				val.Title = "Modular Armor MK1";
				val.Description = "Body armor that has many different attachments and attachment slots";
				val.ModName = "MODLR";
				val.Art = ME.ArtAssets.LoadAsset<GameObject>("C_ModularM1");
				val.Rarity = (Rarity)2;
				val.Theme = (CardThemeColorType)3;
				val.Stats = (CardInfoStat[])(object)new CardInfoStat[2]
				{
					new CardInfoStat
					{
						amount = "8",
						positive = true,
						simepleAmount = (SimpleAmount)0,
						stat = "Module Slots"
					},
					new CardInfoStat
					{
						amount = "0",
						positive = true,
						simepleAmount = (SimpleAmount)0,
						stat = "Boost Slots"
					}
				};
				return val;
			}
		}

		public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers)
		{
			cardInfo.allowMultiple = false;
		}

		protected override void Added(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
			bool flag = false;
			foreach (CardInfo currentCard in player.data.currentCards)
			{
				if ((Object)(object)currentCard == (Object)(object)ModStats.card)
				{
					flag = true;
				}
			}
			if (!flag)
			{
				ExtensionMethods.ExecuteAfterFrames((MonoBehaviour)(object)ME.instance, 25, (Action)delegate
				{
					Cards.instance.AddCardsToPlayer(player, (CardInfo[])(object)new CardInfo[1] { ModStats.card }, false, new string[1] { "MS" }, (float[])null, (float[])null);
				});
			}
		}

		protected override GameObject GetCardBase()
		{
			return ME.GetBase("ModularBase");
		}
	}
	public class ModularMK2 : CustomEffectCard<ModularArmor>
	{
		internal static CardInfo card;

		public override CardDetails<ModularArmor> Details
		{
			get
			{
				//IL_0046: Unknown result type (might be due to invalid IL or missing references)
				//IL_0062: Unknown result type (might be due to invalid IL or missing references)
				//IL_0067: Unknown result type (might be due to invalid IL or missing references)
				//IL_0072: Unknown result type (might be due to invalid IL or missing references)
				//IL_0079: Unknown result type (might be due to invalid IL or missing references)
				//IL_007b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0080: Unknown result type (might be due to invalid IL or missing references)
				//IL_008c: Expected O, but got Unknown
				//IL_008e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0093: 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)
				//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b8: Expected O, but got Unknown
				CardDetails<ModularArmor> val = new CardDetails<ModularArmor>();
				val.Title = "Modular Armor MK2";
				val.Description = "Body armor that has many different attachments and attachment slots";
				val.ModName = "MODLR";
				val.Art = ME.ArtAssets.LoadAsset<GameObject>("C_ModularM2");
				val.Rarity = RarityUtils.GetRarity("Legendary");
				val.Theme = (CardThemeColorType)3;
				val.Stats = (CardInfoStat[])(object)new CardInfoStat[2]
				{
					new CardInfoStat
					{
						amount = "10",
						positive = true,
						simepleAmount = (SimpleAmount)0,
						stat = "Module Slots"
					},
					new CardInfoStat
					{
						amount = "2",
						positive = true,
						simepleAmount = (SimpleAmount)0,
						stat = "Boost Slots"
					}
				};
				val.OwnerOnly = true;
				return val;
			}
		}

		public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers)
		{
			cardInfo.allowMultiple = false;
		}

		protected override void Added(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
			bool flag = false;
			foreach (CardInfo currentCard in player.data.currentCards)
			{
				if ((Object)(object)currentCard == (Object)(object)ModStats.card)
				{
					flag = true;
				}
			}
			if (!flag)
			{
				ExtensionMethods.ExecuteAfterFrames((MonoBehaviour)(object)ME.instance, 25, (Action)delegate
				{
					Cards.instance.AddCardsToPlayer(player, (CardInfo[])(object)new CardInfo[1] { ModStats.card }, false, new string[1] { "MS" }, (float[])null, (float[])null);
				});
			}
		}

		protected override GameObject GetCardBase()
		{
			return ME.GetBase("ModularBase");
		}
	}
	public class ModularMK3 : CustomEffectCard<ModularArmor>
	{
		internal static CardInfo card;

		public override CardDetails<ModularArmor> Details
		{
			get
			{
				//IL_0046: Unknown result type (might be due to invalid IL or missing references)
				//IL_0062: Unknown result type (might be due to invalid IL or missing references)
				//IL_0067: Unknown result type (might be due to invalid IL or missing references)
				//IL_0072: Unknown result type (might be due to invalid IL or missing references)
				//IL_0079: Unknown result type (might be due to invalid IL or missing references)
				//IL_007b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0080: Unknown result type (might be due to invalid IL or missing references)
				//IL_008c: Expected O, but got Unknown
				//IL_008e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0093: 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)
				//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b8: Expected O, but got Unknown
				CardDetails<ModularArmor> val = new CardDetails<ModularArmor>();
				val.Title = "Modular Armor MK3";
				val.Description = "Body armor that has many different attachments and attachment slots";
				val.ModName = "MODLR";
				val.Art = ME.ArtAssets.LoadAsset<GameObject>("C_ModularM3");
				val.Rarity = RarityUtils.GetRarity("Mythical");
				val.Theme = (CardThemeColorType)3;
				val.Stats = (CardInfoStat[])(object)new CardInfoStat[2]
				{
					new CardInfoStat
					{
						amount = "12",
						positive = true,
						simepleAmount = (SimpleAmount)0,
						stat = "Module Slots"
					},
					new CardInfoStat
					{
						amount = "4",
						positive = true,
						simepleAmount = (SimpleAmount)0,
						stat = "Boost Slots"
					}
				};
				val.OwnerOnly = true;
				return val;
			}
		}

		public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers)
		{
			cardInfo.allowMultiple = false;
		}

		protected override void Added(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
			bool flag = false;
			foreach (CardInfo currentCard in player.data.currentCards)
			{
				if ((Object)(object)currentCard == (Object)(object)ModStats.card)
				{
					flag = true;
				}
			}
			if (!flag)
			{
				ExtensionMethods.ExecuteAfterFrames((MonoBehaviour)(object)ME.instance, 25, (Action)delegate
				{
					Cards.instance.AddCardsToPlayer(player, (CardInfo[])(object)new CardInfo[1] { ModStats.card }, false, new string[1] { "MS" }, (float[])null, (float[])null);
				});
			}
		}

		protected override GameObject GetCardBase()
		{
			return ME.GetBase("ModularBase");
		}
	}
	public class BlockModule : SimpleCard
	{
		internal static CardInfo card;

		public override CardDetails Details => new CardDetails
		{
			Title = "Block Module",
			Description = "<#769964>+0.25s</color> Block Duration",
			ModName = "MODLR",
			Art = null,
			Rarity = (Rarity)2,
			Theme = (CardThemeColorType)3
		};

		protected override GameObject GetCardBase()
		{
			return ME.GetBase("ModularToken");
		}

		public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers)
		{
			cardInfo.categories = (CardCategory[])(object)new CardCategory[1] { ME.Module };
		}
	}
	public class BuffModule : SimpleCard
	{
		internal static CardInfo card;

		public override CardDetails Details => new CardDetails
		{
			Title = "Buffing Module",
			Description = "<#769964>+20%</color> Module Power",
			ModName = "MODLR",
			Art = null,
			Rarity = RarityUtils.GetRarity("Legendary"),
			Theme = (CardThemeColorType)3
		};

		protected override GameObject GetCardBase()
		{
			return ME.GetBase("ModularToken");
		}

		public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers)
		{
			cardInfo.categories = (CardCategory[])(object)new CardCategory[1] { ME.Module };
		}
	}
	public class DamageModule : SimpleCard
	{
		internal static CardInfo card;

		public override CardDetails Details => new CardDetails
		{
			Title = "Damage Module",
			Description = "<#769964>+30%</color> Damage",
			ModName = "MODLR",
			Art = null,
			Rarity = (Rarity)1,
			Theme = (CardThemeColorType)3
		};

		protected override GameObject GetCardBase()
		{
			return ME.GetBase("ModularToken");
		}

		public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers)
		{
			cardInfo.categories = (CardCategory[])(object)new CardCategory[1] { ME.Module };
		}
	}
	public class HealthModule : SimpleCard
	{
		internal static CardInfo card;

		public override CardDetails Details => new CardDetails
		{
			Title = "Health Module",
			Description = "<#769964>+30%</color> Health",
			ModName = "MODLR",
			Art = null,
			Rarity = (Rarity)1,
			Theme = (CardThemeColorType)3
		};

		protected override GameObject GetCardBase()
		{
			return ME.GetBase("ModularToken");
		}

		public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers)
		{
			cardInfo.categories = (CardCategory[])(object)new CardCategory[1] { ME.Module };
		}
	}
	public class MobilityModule : SimpleCard
	{
		internal static CardInfo card;

		public override CardDetails Details => new CardDetails
		{
			Title = "Mobility Module",
			Description = "<#769964>+20%</color> Speed\n<#769964>+20%</color> Jump Height",
			ModName = "MODLR",
			Art = null,
			Rarity = (Rarity)1,
			Theme = (CardThemeColorType)3
		};

		protected override GameObject GetCardBase()
		{
			return ME.GetBase("ModularToken");
		}

		public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers)
		{
			cardInfo.categories = (CardCategory[])(object)new CardCategory[1] { ME.Module };
		}
	}
	public class ModModule : SimpleCard
	{
		internal static CardInfo card;

		public override CardDetails Details => new CardDetails
		{
			Title = "Module Expansion Component",
			Description = "<#769964>+4</color> Modular Slots",
			ModName = "MODLR",
			Art = null,
			Rarity = RarityUtils.GetRarity("Mythical"),
			Theme = (CardThemeColorType)3
		};

		protected override void Added(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
			((Component)player).GetComponentInChildren<ModularArmor>().mods.Add(0);
			((Component)player).GetComponentInChildren<ModularArmor>().mods.Add(0);
			((Component)player).GetComponentInChildren<ModularArmor>().mods.Add(0);
			((Component)player).GetComponentInChildren<ModularArmor>().mods.Add(0);
		}

		protected override GameObject GetCardBase()
		{
			return ME.GetBase("ModularToken");
		}

		public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers)
		{
			cardInfo.categories = (CardCategory[])(object)new CardCategory[1] { ME.Module };
		}
	}
}