JARL.dll

Decompiled 3 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 BepInEx.Bootstrap;
using BepInEx.Configuration;
using ClassesManagerReborn;
using ClassesManagerReborn.Util;
using HarmonyLib;
using JARL;
using JARL.Abstract;
using JARL.ArmorFramework;
using JARL.ArmorFramework.Abstract;
using JARL.ArmorFramework.Abstract.Builtin;
using JARL.ArmorFramework.Builtin;
using JARL.ArmorFramework.Classes;
using JARL.ArmorFramework.Utlis;
using JARL.Extensions;
using Jotunn.Utils;
using Microsoft.CodeAnalysis;
using ModdingUtils.Utils;
using ModsPlus;
using Photon.Pun;
using TMPro;
using TabInfo.Utils;
using UnboundLib;
using UnboundLib.Cards;
using UnboundLib.GameModes;
using UnboundLib.Utils.UI;
using UnityEngine;
using UnityEngine.Events;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(/*Could not decode attribute arguments.*/)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.1", FrameworkDisplayName = ".NET Framework 4.7.1")]
[assembly: AssemblyVersion("0.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(/*Could not decode attribute arguments.*/)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
[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("com.aalund13.rounds.jarl", "Just Another Rounds Library", "1.3.0")]
[BepInProcess("Rounds.exe")]
public class JustAnotherRoundsLibrary : BaseUnityPlugin
{
	internal const string modInitials = "JARL";

	internal const string ModId = "com.aalund13.rounds.jarl";

	internal const string ModName = "Just Another Rounds Library";

	internal const string Version = "1.3.0";

	public static List<BaseUnityPlugin> plugins;

	internal static AssetBundle assets = AssetUtils.LoadAssetBundleFromResources("jarl_asset", typeof(JustAnotherRoundsLibrary).Assembly);

	public static CardCategory SoulstreakClassCards;

	private void Awake()
	{
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		assets.LoadAsset<GameObject>("ModCards").GetComponent<JARLCardResgester>().RegisterCards();
		new Harmony("com.aalund13.rounds.jarl").PatchAll();
		ClassesRegistry.Register(JARLCardResgester.ModCards["Armor Piercing"].GetComponent<CardInfo>(), (CardType)32, 4);
	}

	private void Start()
	{
		ConfigHandler.RegesterMenu(((BaseUnityPlugin)this).Config);
		plugins = (List<BaseUnityPlugin>)typeof(Chainloader).GetField("_plugins", (BindingFlags)40).GetValue((object)null);
		GameModeManager.AddHook("GameStart", (Func<IGameModeHandler, IEnumerator>)([CompilerGenerated] (IGameModeHandler _) => GameStart()));
		if (plugins.Exists((Predicate<BaseUnityPlugin>)((BaseUnityPlugin plugin) => plugin.Info.Metadata.GUID == "com.willuwontu.rounds.tabinfo")))
		{
			TabinfoInterface.SetUpTabinfoInterface();
		}
		ArmorFramework.RegisterArmorType(new DefaultArmor());
		ArmorHandler.DamageProcessingMethodsAfter.Add("ApplyArmorPiercePercent", (Func<ArmorBase, Player, Player, float, float, DamageAndArmorResult>)ArmorPiercePercent.ApplyArmorPiercePercent);
	}

	private void Update()
	{
		ArmorFramework.ResetEveryPlayerArmorStats(skipArmorHandlerChecking: false);
	}

	[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
	private IEnumerator GameStart()
	{
		ArmorFramework.ResetEveryPlayerArmorStats();
		yield break;
	}
}
namespace JARL
{
	public class ArmorPierceCard : CustomCardUnity
	{
		[Header("Stats: Armor Pierce Percent")]
		public float ArmorPiercePercent;

		public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
			player.data.GetAdditionalData().ArmorPiercePercent = Mathf.Clamp(player.data.GetAdditionalData().ArmorPiercePercent + ArmorPiercePercent, 0f, 1f);
		}

		public override string GetModName()
		{
			return "JARL";
		}
	}
	public class DefaultArmorCard : CustomCardUnity
	{
		[Header("Armor: Max Armor Amd Regen")]
		public float maxArmorValue;

		public float regenerationRate;

		public float regenCooldownSeconds;

		[Header("Armor: Armor Reactivate")]
		public ArmorReactivateType armorReactivateType;

		public float reactivateArmorValue;

		public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
			player.data.GetAdditionalData().armorHandler.AddArmor("Default", maxArmorValue, regenerationRate, regenCooldownSeconds, armorReactivateType, reactivateArmorValue);
		}

		public override string GetModName()
		{
			return "JARL";
		}
	}
	internal class ConfigHandler : Object
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c : Object
		{
			public static readonly <>c <>9 = new <>c();

			public static UnityAction <>9__2_0;

			internal void <RegesterMenu>b__2_0()
			{
			}
		}

		public static ConfigEntry<bool> DetailsMode;

		public static ConfigEntry<bool> DebugMode;

		public static void RegesterMenu(ConfigFile config)
		{
			//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_0024: Expected O, but got Unknown
			object obj = <>c.<>9__2_0;
			if (obj == null)
			{
				UnityAction val = delegate
				{
				};
				<>c.<>9__2_0 = val;
				obj = (object)val;
			}
			Unbound.RegisterMenu("Just Another Rounds Library", (UnityAction)obj, (Action<GameObject>)NewGui, (GameObject)null, false);
			DetailsMode = config.Bind<bool>("Just Another Rounds Library", "DetailsMode", false, "Enabled or disabled DetailsMode.");
			DebugMode = config.Bind<bool>("Just Another Rounds Library", "DebugMode", false, "Enabled or disabled Debug Mode");
		}

		public static void addBlank(GameObject menu)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//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_001e: Unknown result type (might be due to invalid IL or missing references)
			TextMeshProUGUI val = default(TextMeshProUGUI);
			MenuHandler.CreateText(" ", menu, ref val, 30, true, default(Nullable<Color>), (TMP_FontAsset)null, (Material)null, default(Nullable<TextAlignmentOptions>));
		}

		public static void NewGui(GameObject menu)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//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_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			TextMeshProUGUI val2 = default(TextMeshProUGUI);
			MenuHandler.CreateText("Details Mode | Show extracts details about every armor.", menu, ref val2, 30, true, default(Nullable<Color>), (TMP_FontAsset)null, (Material)null, default(Nullable<TextAlignmentOptions>));
			MenuHandler.CreateToggle(DetailsMode.Value, "Details Mode", menu, (UnityAction<bool>)DetailsModeChanged, 30, true, default(Nullable<Color>), (TMP_FontAsset)null, (Material)null, default(Nullable<TextAlignmentOptions>));
			addBlank(menu);
			MenuHandler.CreateToggle(DebugMode.Value, "<#c41010> Debug Mode", menu, (UnityAction<bool>)DebugModeChanged, 30, true, default(Nullable<Color>), (TMP_FontAsset)null, (Material)null, default(Nullable<TextAlignmentOptions>));
			[CompilerGenerated]
			static void DebugModeChanged(bool val)
			{
				DebugMode.Value = val;
			}
			[CompilerGenerated]
			static void DetailsModeChanged(bool val)
			{
				DetailsMode.Value = val;
			}
		}
	}
	public class JARLCardResgester : MonoBehaviour
	{
		public List<GameObject> Cards;

		public List<GameObject> HiddenCards;

		internal static Dictionary<string, GameObject> ModCards = new Dictionary<string, GameObject>();

		internal void RegisterCards()
		{
			//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_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			Enumerator<GameObject> enumerator = Cards.GetEnumerator();
			try
			{
				while (enumerator.MoveNext())
				{
					GameObject current = enumerator.Current;
					CustomCard.RegisterUnityCard(current, "JARL", current.GetComponent<CardInfo>().cardName, true, (Action<CardInfo>)null);
					ModCards.Add(current.GetComponent<CardInfo>().cardName, current);
				}
			}
			finally
			{
				((IDisposable)enumerator).Dispose();
			}
			enumerator = HiddenCards.GetEnumerator();
			try
			{
				while (enumerator.MoveNext())
				{
					GameObject current2 = enumerator.Current;
					CustomCard.RegisterUnityCard(current2, "JARL", current2.GetComponent<CardInfo>().cardName, false, (Action<CardInfo>)null);
					Cards.instance.AddHiddenCard(current2.GetComponent<CardInfo>());
					ModCards.Add(current2.GetComponent<CardInfo>().cardName, current2);
				}
			}
			finally
			{
				((IDisposable)enumerator).Dispose();
			}
		}

		internal static List<GameObject> GetCardsFormString(List<string> cardsOfString)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			List<GameObject> val = new List<GameObject>();
			Enumerator<string> enumerator = cardsOfString.GetEnumerator();
			try
			{
				while (enumerator.MoveNext())
				{
					string current = enumerator.Current;
					val.Add(ModCards[current]);
				}
				return val;
			}
			finally
			{
				((IDisposable)enumerator).Dispose();
			}
		}
	}
	internal class TabinfoInterface : Object
	{
		[CompilerGenerated]
		private sealed class <>c__DisplayClass2_0 : Object
		{
			public string armorType;

			internal bool <RegisterArmorTabinfoInterface>b__1(Player p)
			{
				return p.data.GetAdditionalData().armorHandler.GetArmorByType(armorType).maxArmorValue > 0f;
			}

			internal string <RegisterArmorTabinfoInterface>b__2(Player p)
			{
				ArmorBase armorByType = p.data.GetAdditionalData().armorHandler.GetArmorByType(armorType);
				if (armorByType.currentArmorValue <= 0f && !Utility.IsNullOrWhiteSpace(armorByType.deactivateText))
				{
					return armorByType.deactivateText;
				}
				return String.Format("{0:0.0}/{1:0.0}", (object)armorByType.currentArmorValue, (object)armorByType.maxArmorValue);
			}

			internal bool <RegisterArmorTabinfoInterface>b__3(Player p)
			{
				if (p.data.GetAdditionalData().armorHandler.GetArmorByType(armorType).maxArmorValue > 0f)
				{
					return Utils.DetailsMode;
				}
				return false;
			}

			internal string <RegisterArmorTabinfoInterface>b__4(Player p)
			{
				return String.Format("{0:0.0}/{1:0.0}", (object)p.data.GetAdditionalData().armorHandler.GetArmorByType(armorType).currentArmorValue, (object)p.data.GetAdditionalData().armorHandler.GetArmorByType(armorType).maxArmorValue);
			}

			internal bool <RegisterArmorTabinfoInterface>b__5(Player p)
			{
				if (p.data.GetAdditionalData().armorHandler.GetArmorByType(armorType).maxArmorValue > 0f)
				{
					return Utils.DetailsMode;
				}
				return false;
			}

			internal string <RegisterArmorTabinfoInterface>b__6(Player p)
			{
				return String.Format("{0:0.00}", (object)p.data.GetAdditionalData().armorHandler.GetArmorByType(armorType).armorRegenerationRate);
			}

			internal bool <RegisterArmorTabinfoInterface>b__7(Player p)
			{
				if (p.data.GetAdditionalData().armorHandler.GetArmorByType(armorType).maxArmorValue > 0f)
				{
					return Utils.DetailsMode;
				}
				return false;
			}

			internal string <RegisterArmorTabinfoInterface>b__8(Player p)
			{
				return String.Format("{0:0.00}s", (object)p.data.GetAdditionalData().armorHandler.GetArmorByType(armorType).armorRegenCooldownSeconds);
			}

			internal bool <RegisterArmorTabinfoInterface>b__9(Player p)
			{
				if (p.data.GetAdditionalData().armorHandler.GetArmorByType(armorType).maxArmorValue > 0f)
				{
					return Utils.DetailsMode;
				}
				return false;
			}

			internal string <RegisterArmorTabinfoInterface>b__10(Player p)
			{
				return String.Format("{0}", (object)p.data.GetAdditionalData().armorHandler.GetArmorByType(armorType).reactivateArmorType);
			}

			internal bool <RegisterArmorTabinfoInterface>b__11(Player p)
			{
				if (p.data.GetAdditionalData().armorHandler.GetArmorByType(armorType).maxArmorValue > 0f)
				{
					return Utils.DetailsMode;
				}
				return false;
			}

			internal string <RegisterArmorTabinfoInterface>b__12(Player p)
			{
				return String.Format("{0}", (object)p.data.GetAdditionalData().armorHandler.GetArmorByType(armorType).reactivateArmorValue);
			}
		}

		public static object armorsStatsCategory;

		public static void SetUpTabinfoInterface()
		{
			StatCategory obj = TabInfoManager.RegisterCategory("JARL Stats", 0);
			ExtensionMethods.SetFieldValue((object)obj, "priority", (object)(-45));
			armorsStatsCategory = TabInfoManager.RegisterCategory("Armor Stats", 0);
			ExtensionMethods.SetFieldValue(armorsStatsCategory, "priority", (object)(-44));
			TabInfoManager.RegisterStat(obj, "Total Armor", (Func<Player, bool>)((Player p) => p.data.GetAdditionalData().totalMaxArmor > 0f), (Func<Player, string>)((Player p) => String.Format("{0:0.0}/{1:0.0}", (object)p.data.GetAdditionalData().totalArmor, (object)p.data.GetAdditionalData().totalMaxArmor)));
			TabInfoManager.RegisterStat(obj, "Armor Pierce", (Func<Player, bool>)((Player p) => p.data.GetAdditionalData().ArmorPiercePercent > 0f), (Func<Player, string>)((Player p) => String.Format("{0:0}%", (object)(p.data.GetAdditionalData().ArmorPiercePercent * 100f))));
		}

		public static void RegisterArmorTabinfoInterface(ArmorBase registerArmor)
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Expected O, but got Unknown
			if (JustAnotherRoundsLibrary.plugins.Exists((Predicate<BaseUnityPlugin>)((BaseUnityPlugin plugin) => plugin.Info.Metadata.GUID == "com.willuwontu.rounds.tabinfo")))
			{
				<>c__DisplayClass2_0 CS$<>8__locals0 = new <>c__DisplayClass2_0();
				CS$<>8__locals0.armorType = registerArmor.GetArmorType();
				TabInfoManager.RegisterStat((StatCategory)armorsStatsCategory, String.Concat(CS$<>8__locals0.armorType, " Armor"), (Func<Player, bool>)((Player p) => p.data.GetAdditionalData().armorHandler.GetArmorByType(CS$<>8__locals0.armorType).maxArmorValue > 0f), (Func<Player, string>)delegate(Player p)
				{
					ArmorBase armorByType = p.data.GetAdditionalData().armorHandler.GetArmorByType(CS$<>8__locals0.armorType);
					return (armorByType.currentArmorValue <= 0f && !Utility.IsNullOrWhiteSpace(armorByType.deactivateText)) ? armorByType.deactivateText : String.Format("{0:0.0}/{1:0.0}", (object)armorByType.currentArmorValue, (object)armorByType.maxArmorValue);
				});
				StatCategory obj = TabInfoManager.RegisterCategory(String.Concat(CS$<>8__locals0.armorType, " Armor Stats"), 127);
				TabInfoManager.RegisterStat(obj, String.Concat(CS$<>8__locals0.armorType, " Armor Health"), (Func<Player, bool>)((Player p) => p.data.GetAdditionalData().armorHandler.GetArmorByType(CS$<>8__locals0.armorType).maxArmorValue > 0f && Utils.DetailsMode), (Func<Player, string>)((Player p) => String.Format("{0:0.0}/{1:0.0}", (object)p.data.GetAdditionalData().armorHandler.GetArmorByType(CS$<>8__locals0.armorType).currentArmorValue, (object)p.data.GetAdditionalData().armorHandler.GetArmorByType(CS$<>8__locals0.armorType).maxArmorValue)));
				TabInfoManager.RegisterStat(obj, String.Concat(CS$<>8__locals0.armorType, " Armor Regeneration Rate"), (Func<Player, bool>)((Player p) => p.data.GetAdditionalData().armorHandler.GetArmorByType(CS$<>8__locals0.armorType).maxArmorValue > 0f && Utils.DetailsMode), (Func<Player, string>)((Player p) => String.Format("{0:0.00}", (object)p.data.GetAdditionalData().armorHandler.GetArmorByType(CS$<>8__locals0.armorType).armorRegenerationRate)));
				TabInfoManager.RegisterStat(obj, String.Concat(CS$<>8__locals0.armorType, " Armor Regen Cooldown "), (Func<Player, bool>)((Player p) => p.data.GetAdditionalData().armorHandler.GetArmorByType(CS$<>8__locals0.armorType).maxArmorValue > 0f && Utils.DetailsMode), (Func<Player, string>)((Player p) => String.Format("{0:0.00}s", (object)p.data.GetAdditionalData().armorHandler.GetArmorByType(CS$<>8__locals0.armorType).armorRegenCooldownSeconds)));
				TabInfoManager.RegisterStat(obj, String.Concat(CS$<>8__locals0.armorType, " Armor Reactivate Armor Type"), (Func<Player, bool>)((Player p) => p.data.GetAdditionalData().armorHandler.GetArmorByType(CS$<>8__locals0.armorType).maxArmorValue > 0f && Utils.DetailsMode), (Func<Player, string>)((Player p) => String.Format("{0}", (object)p.data.GetAdditionalData().armorHandler.GetArmorByType(CS$<>8__locals0.armorType).reactivateArmorType)));
				TabInfoManager.RegisterStat(obj, String.Concat(CS$<>8__locals0.armorType, " Armor Reactivate Armor Value"), (Func<Player, bool>)((Player p) => p.data.GetAdditionalData().armorHandler.GetArmorByType(CS$<>8__locals0.armorType).maxArmorValue > 0f && Utils.DetailsMode), (Func<Player, string>)((Player p) => String.Format("{0}", (object)p.data.GetAdditionalData().armorHandler.GetArmorByType(CS$<>8__locals0.armorType).reactivateArmorValue)));
			}
		}
	}
	public static class Utils : Object
	{
		public static bool logging = ConfigHandler.DebugMode.Value;

		public static bool DetailsMode = ConfigHandler.DetailsMode.Value;

		public static void LogInfo(string message)
		{
			if (logging)
			{
				Debug.Log((object)message);
			}
		}

		public static void LogWarn(string message)
		{
			if (logging)
			{
				Debug.LogWarning((object)message);
			}
		}

		public static void LogError(string message)
		{
			if (logging)
			{
				Debug.LogError((object)message);
			}
		}
	}
}
namespace JARL.Patchs
{
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	public class CharacterStatModifiersPatch : Object
	{
		[HarmonyPatch("ResetStats")]
		[HarmonyPrefix]
		public static void ResetStats(CharacterStatModifiers __instance)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			CharacterDataExtensions.GetAdditionalData((CharacterData)Traverse.Create((object)__instance).Field("data").GetValue()).ArmorPiercePercent = 0f;
			JARL.ArmorFramework.ArmorFramework.ResetEveryPlayerArmorStats();
		}
	}
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	public class HealthHandlerPatch : Object
	{
		[HarmonyPatch("DoDamage")]
		[HarmonyPrefix]
		public static void DoDamage(HealthHandler __instance, ref Vector2 damage, Vector2 position, Color blinkColor, GameObject damagingWeapon, Player damagingPlayer, bool healthRemoval, bool lethal, bool ignoreBlock)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			CharacterData val = (CharacterData)Traverse.Create((object)__instance).Field("data").GetValue();
			if (val.GetAdditionalData().totalArmor > 0f)
			{
				((Component)val.player).GetComponent<ArmorHandler>().ProcessDamage(ref damage, damagingPlayer, val.player);
			}
		}

		[HarmonyPatch("Revive")]
		[HarmonyPostfix]
		public static void Revive(CharacterData ___data)
		{
			if (Object.op_Implicit((Object)(object)((Component)___data).GetComponent<ArmorHandler>()))
			{
				((Component)___data).GetComponent<ArmorHandler>().OnRespawn();
			}
		}
	}
}
namespace JARL.ArmorFramework
{
	public class ArmorFramework : Object
	{
		[CompilerGenerated]
		private sealed class <>c__DisplayClass1_0 : Object
		{
			public ArmorBase armorType;

			internal bool <RegisterArmorType>b__0(ArmorBase armor)
			{
				return armor.priority == armorType.priority;
			}
		}

		public static List<ArmorBase> registeredArmorTypes = new List<ArmorBase>();

		public static void RegisterArmorType(ArmorBase armorType)
		{
			<>c__DisplayClass1_0 CS$<>8__locals0 = new <>c__DisplayClass1_0();
			CS$<>8__locals0.armorType = armorType;
			Utils.LogInfo(String.Concat("Registering ArmorType: '", CS$<>8__locals0.armorType.GetArmorType(), "'"));
			if (registeredArmorTypes.Contains(CS$<>8__locals0.armorType))
			{
				Utils.LogWarn(String.Concat("ArmorType '", CS$<>8__locals0.armorType.GetArmorType(), "' already exists"));
				return;
			}
			while (Enumerable.Any<ArmorBase>((IEnumerable<ArmorBase>)(object)registeredArmorTypes, (Func<ArmorBase, bool>)((ArmorBase armor) => armor.priority == CS$<>8__locals0.armorType.priority)))
			{
				CS$<>8__locals0.armorType.priority++;
			}
			registeredArmorTypes.Add(CS$<>8__locals0.armorType);
			RegisterArmorTabinfoInterface(CS$<>8__locals0.armorType);
			Utils.LogInfo(String.Concat("Successfully registered ArmorType: '", CS$<>8__locals0.armorType.GetArmorType(), "'"));
		}

		public static void ResetEveryPlayerArmorStats(bool skipArmorHandlerChecking = true)
		{
			for (int i = 0; i < PlayerManager.instance.players.Count; i++)
			{
				Player val = PlayerManager.instance.players[i];
				if (skipArmorHandlerChecking || (Object)(object)((Component)val).GetComponent<ArmorHandler>() == (Object)null)
				{
					Utils.LogInfo("Reseting Stats");
					ArmorHandler orAddComponent = ExtensionMethods.GetOrAddComponent<ArmorHandler>(((Component)val).gameObject, false);
					val.data.GetAdditionalData().armorHandler = orAddComponent;
					orAddComponent.ResetArmorStats();
				}
			}
		}

		internal static void RegisterArmorTabinfoInterface(ArmorBase armor)
		{
			if (JustAnotherRoundsLibrary.plugins.Exists((Predicate<BaseUnityPlugin>)((BaseUnityPlugin plugin) => plugin.Info.Metadata.GUID == "com.willuwontu.rounds.tabinfo")))
			{
				TabinfoInterface.RegisterArmorTabinfoInterface(armor);
			}
		}
	}
	public class ArmorHandler : MonoBehaviour
	{
		private List<HealthBarObjectWithArmor> armorHeathBars = new List<HealthBarObjectWithArmor>();

		private float healthBarOffset = 0.25f;

		public bool allArmorDisabled;

		public int disableTimeRemainingSeconds;

		public List<ArmorBase> armors = new List<ArmorBase>();

		public List<ArmorBase> activeArmors = new List<ArmorBase>();

		public int activeArmorsCount;

		public Player player;

		public static Dictionary<string, Func<ArmorBase, Player, Player, float, float, DamageAndArmorResult>> DamageProcessingMethodsAfter = new Dictionary<string, Func<ArmorBase, Player, Player, float, float, DamageAndArmorResult>>();

		public static Dictionary<string, Func<ArmorBase, Player, Player, float, float, ArmorProcessingResult>> DamageProcessingMethodsBefore = new Dictionary<string, Func<ArmorBase, Player, Player, float, float, ArmorProcessingResult>>();

		public void TryReactivateArmor(ArmorBase armor)
		{
			if ((!armor.isActive && armor.reactivateArmorType == ArmorReactivateType.Second && Time.time >= armor.timeSinceLastDamage + armor.reactivateArmorValue) || (!armor.isActive && armor.reactivateArmorType == ArmorReactivateType.Percent && armor.currentArmorValue / armor.maxArmorValue > armor.reactivateArmorValue))
			{
				Utils.LogInfo(String.Concat("Armor '", armor.GetArmorType(), "' passed all reactivation checks. Reactivating..."));
				armor.isActive = true;
				armor.OnReactivate();
			}
		}

		public void ProcessDamage(ref Vector2 damageVector, Player damagingPlayer, Player hurtPlayer)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Expected O, but got Unknown
			//IL_01bc: Expected O, but got Unknown
			//IL_028f: Expected O, but got Unknown
			//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f5: 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)
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_0219: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			Utils.LogInfo("Proocessing Damage");
			float num = ((Vector2)(ref damageVector)).magnitude;
			Enumerator<ArmorBase> enumerator = armors.GetEnumerator();
			try
			{
				while (enumerator.MoveNext())
				{
					ArmorBase current = enumerator.Current;
					Utils.LogInfo(String.Concat("Proocessing damage for '", current.GetArmorType(), "'"));
					if (num <= 0f)
					{
						break;
					}
					if (!current.isActive || current.maxArmorValue == 0f)
					{
						continue;
					}
					Utils.LogInfo(String.Concat("Runing all 'DamageProcessingMethodsBefore' method for '", current.GetArmorType(), "'"));
					Enumerator<string, Func<ArmorBase, Player, Player, float, float, ArmorProcessingResult>> enumerator2 = DamageProcessingMethodsBefore.GetEnumerator();
					try
					{
						while (enumerator2.MoveNext())
						{
							KeyValuePair<string, Func<ArmorBase, Player, Player, float, float, ArmorProcessingResult>> current2 = enumerator2.Current;
							string key = current2.Key;
							Func<ArmorBase, Player, Player, float, float, ArmorProcessingResult> value = current2.Value;
							Utils.LogInfo(String.Concat((string[])(object)new String[5]
							{
								"Runing '",
								key,
								"' method for '",
								current.GetArmorType(),
								"'"
							}));
							try
							{
								ArmorProcessingResult armorProcessingResult = value.Invoke(current, damagingPlayer, hurtPlayer, num, ((Vector2)(ref damageVector)).magnitude);
								num = armorProcessingResult.damage;
								current.currentArmorValue = armorProcessingResult.armor;
								_ = armorProcessingResult.skipArmorDamageProcess;
							}
							catch (Exception val)
							{
								Exception val2 = val;
								Debug.LogError((object)String.Concat("An error occurred while executing method '", key, "': ", val2.Message));
							}
						}
					}
					finally
					{
						((IDisposable)enumerator2).Dispose();
					}
					Utils.LogInfo(String.Concat("Runing 'OnArmorDamage' method for '", current.GetArmorType(), "'"));
					try
					{
						current.OnArmorDamage(num, damagingPlayer);
						DamageAndArmorResult damageAndArmorResult = current.OnDamage(num, damagingPlayer);
						num = damageAndArmorResult.damage;
						current.currentArmorValue = damageAndArmorResult.armor;
						if (damageAndArmorResult.armor <= 0f)
						{
							current.isActive = false;
						}
						current.timeSinceLastDamage = Time.time;
					}
					catch (Exception val3)
					{
						Exception val4 = val3;
						Debug.LogError((object)String.Concat("An error occurred while executing the 'OnArmorDamage' method of '", ((MemberInfo)((Object)current).GetType()).Name, "': ", val4.Message));
						break;
					}
					Utils.LogInfo(String.Concat("Runing all 'DamageProcessingMethodsAfter' method for '", current.GetArmorType(), "'"));
					Enumerator<string, Func<ArmorBase, Player, Player, float, float, DamageAndArmorResult>> enumerator3 = DamageProcessingMethodsAfter.GetEnumerator();
					try
					{
						while (enumerator3.MoveNext())
						{
							KeyValuePair<string, Func<ArmorBase, Player, Player, float, float, DamageAndArmorResult>> current3 = enumerator3.Current;
							string key2 = current3.Key;
							Func<ArmorBase, Player, Player, float, float, DamageAndArmorResult> value2 = current3.Value;
							Utils.LogInfo(String.Concat((string[])(object)new String[5]
							{
								"Runing '",
								key2,
								"' method for '",
								current.GetArmorType(),
								"'"
							}));
							try
							{
								DamageAndArmorResult damageAndArmorResult2 = value2.Invoke(current, damagingPlayer, hurtPlayer, num, ((Vector2)(ref damageVector)).magnitude);
								num = damageAndArmorResult2.damage;
								current.currentArmorValue = damageAndArmorResult2.armor;
							}
							catch (Exception val5)
							{
								Exception val6 = val5;
								Debug.LogError((object)String.Concat("An error occurred while executing method '", key2, "': ", val6.Message));
							}
						}
					}
					finally
					{
						((IDisposable)enumerator3).Dispose();
					}
				}
			}
			finally
			{
				((IDisposable)enumerator).Dispose();
			}
			Vector2 val7 = ((Vector2)(ref damageVector)).normalized * num;
			damageVector = val7;
		}

		public void ResetArmorStats()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			armors.Clear();
			Enumerator<ArmorBase> enumerator = ArmorFramework.registeredArmorTypes.GetEnumerator();
			try
			{
				while (enumerator.MoveNext())
				{
					ArmorBase current = enumerator.Current;
					Utils.LogInfo(String.Concat("Resetting stats for ArmorType: ", current.GetArmorType(), "."));
					ArmorBase armorBase = (ArmorBase)current.Clone();
					armorBase.armorHandler = this;
					armors.Add(armorBase);
				}
			}
			finally
			{
				((IDisposable)enumerator).Dispose();
			}
			armors = Enumerable.ToList<ArmorBase>((IEnumerable<ArmorBase>)(object)Enumerable.OrderByDescending<ArmorBase, int>((IEnumerable<ArmorBase>)(object)armors, (Func<ArmorBase, int>)((ArmorBase armor) => armor.priority)));
		}

		public void Update()
		{
			//IL_005d: 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)
			float num = 0f;
			float num2 = 0f;
			if (!player.data.isPlaying)
			{
				return;
			}
			activeArmors = this.GetActiveArmors();
			if (activeArmors.Count != activeArmorsCount)
			{
				ResetArmorHealthBar();
				activeArmorsCount = activeArmors.Count;
			}
			Enumerator<ArmorBase> enumerator = armors.GetEnumerator();
			try
			{
				while (enumerator.MoveNext())
				{
					ArmorBase current = enumerator.Current;
					if (current.isActive)
					{
						num += current.currentArmorValue;
					}
					num2 += current.maxArmorValue;
					player.data.GetAdditionalData().totalArmor = num;
					player.data.GetAdditionalData().totalMaxArmor = num2;
					current.OnUpdate();
					current.RegenerationArmor();
					TryReactivateArmor(current);
				}
			}
			finally
			{
				((IDisposable)enumerator).Dispose();
			}
			UpdateArmorHealthBar();
		}

		public void OnRespawn()
		{
			//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)
			Enumerator<ArmorBase> enumerator = armors.GetEnumerator();
			try
			{
				while (enumerator.MoveNext())
				{
					ArmorBase current = enumerator.Current;
					if (current.regenerateFullyAfterRevive)
					{
						Utils.LogInfo(String.Concat("Regenerating ArmorType '", current.GetArmorType(), "' fully"));
						current.currentArmorValue = current.maxArmorValue;
					}
					current.OnRespawn();
				}
			}
			finally
			{
				((IDisposable)enumerator).Dispose();
			}
		}

		private void Start()
		{
			player = ((Component)this).GetComponent<Player>();
		}

		private void UpdateArmorHealthBar()
		{
			//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_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: 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_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_006c: Unknown result type (might be due to invalid IL or missing references)
			Enumerator<HealthBarObjectWithArmor> enumerator = armorHeathBars.GetEnumerator();
			try
			{
				while (enumerator.MoveNext())
				{
					HealthBarObjectWithArmor current = enumerator.Current;
					CustomHealthBar component = current.healthBarObject.GetComponent<CustomHealthBar>();
					component.SetValues(current.armor.currentArmorValue, current.armor.maxArmorValue);
					if (current.armor.isActive)
					{
						Color activedBarColor = current.armor.GetBarColor().activedBarColor;
						activedBarColor.a = 1f;
						component.SetColor(activedBarColor);
					}
					else
					{
						Color deactivatedBarColor = current.armor.GetBarColor().deactivatedBarColor;
						deactivatedBarColor.a = 1f;
						component.SetColor(deactivatedBarColor);
					}
				}
			}
			finally
			{
				((IDisposable)enumerator).Dispose();
			}
		}

		private void ResetArmorHealthBar()
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			Utils.LogInfo("Reseting all armor health bars");
			DestroyAllArmorHealthBar();
			float num = 1f;
			Enumerator<ArmorBase> enumerator = Enumerable.ToList<ArmorBase>((IEnumerable<ArmorBase>)(object)Enumerable.OrderBy<ArmorBase, int>((IEnumerable<ArmorBase>)(object)this.GetActiveArmors(), (Func<ArmorBase, int>)((ArmorBase armors) => armors.priority))).GetEnumerator();
			try
			{
				while (enumerator.MoveNext())
				{
					ArmorBase current = enumerator.Current;
					AddArmorHealthBar(current, num);
					num += 1f;
				}
			}
			finally
			{
				((IDisposable)enumerator).Dispose();
			}
		}

		private void AddArmorHealthBar(ArmorBase armor, float offsetMultiplier)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(String.Concat(armor.GetArmorType(), " Armor Health Bar"));
			val.transform.SetParent(((Component)((Component)player).GetComponentInChildren<PlayerWobblePosition>()).transform);
			CustomHealthBar obj = val.AddComponent<CustomHealthBar>();
			((Component)obj).transform.localPosition = Vector3.up * (healthBarOffset * offsetMultiplier);
			((Component)obj).transform.localScale = Vector3.one;
			armorHeathBars.Add(new HealthBarObjectWithArmor(val, armor));
			Utils.LogInfo(String.Concat("Added ", ((Object)val).name));
		}

		private void DestroyAllArmorHealthBar()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			Utils.LogInfo("Destroying all armor health bars");
			Enumerator<HealthBarObjectWithArmor> enumerator = armorHeathBars.GetEnumerator();
			try
			{
				while (enumerator.MoveNext())
				{
					HealthBarObjectWithArmor current = enumerator.Current;
					Utils.LogInfo(String.Concat("Destroy ", ((Object)current.healthBarObject).name));
					Object.Destroy((Object)(object)current.healthBarObject);
				}
			}
			finally
			{
				((IDisposable)enumerator).Dispose();
			}
			armorHeathBars.Clear();
		}

		[PunRPC]
		public void RPCA_AddArmor(string armorType, float maxArmorValue, float regenerationRate, float regenCooldownSeconds, ArmorReactivateType reactivateArmorType, float reactivateArmorValue)
		{
			ArmorBase armorByType = this.GetArmorByType(armorType);
			if (armorByType == null)
			{
				Utils.LogError(String.Concat("Failed to add armor. Armor type '", armorType, "' not found."));
				return;
			}
			Utils.LogInfo(String.Format("Adding armor '{0}' with max value {1}, regeneration rate {2}, and reactivation value {3}", (object[])(object)new Object[4]
			{
				(Object)armorType,
				(object)maxArmorValue,
				(object)regenerationRate,
				(object)reactivateArmorValue
			}));
			armorByType.maxArmorValue += Mathf.Max(maxArmorValue, 0f);
			armorByType.armorRegenerationRate += Mathf.Max(regenerationRate, 0f);
			if (armorByType.armorRegenCooldownSeconds < regenCooldownSeconds)
			{
				armorByType.armorRegenCooldownSeconds = regenCooldownSeconds;
			}
			if (reactivateArmorType != ArmorReactivateType.Null)
			{
				armorByType.reactivateArmorType = reactivateArmorType;
			}
			armorByType.reactivateArmorValue = reactivateArmorValue;
		}

		public void AddArmor(string armorType, float maxArmorValue, float regenerationRate, float regenCooldownSeconds, ArmorReactivateType reactivateArmorType, float reactivateArmorValue)
		{
			if (PhotonNetwork.OfflineMode || PhotonNetwork.IsMasterClient)
			{
				Utils.LogInfo("Calling method 'RPCA_AddArmor' on all clients");
				player.data.view.RPC("RPCA_AddArmor", (RpcTarget)0, (object[])(object)new Object[6]
				{
					(Object)armorType,
					(object)maxArmorValue,
					(object)regenerationRate,
					(object)regenCooldownSeconds,
					(object)reactivateArmorType,
					(object)reactivateArmorValue
				});
			}
		}
	}
}
namespace JARL.ArmorFramework.Utlis
{
	public static class ArmorUtils : Object
	{
		[CompilerGenerated]
		private sealed class <>c__DisplayClass1_0 : Object
		{
			public string type;

			internal bool <GetArmorByType>b__0(ArmorBase armor)
			{
				return armor.GetArmorType() == type;
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass2_0 : Object
		{
			public string type;

			internal bool <GetRegisteredArmorByType>b__0(ArmorBase armor)
			{
				return armor.GetArmorType() == type;
			}
		}

		public static DamageAndArmorResult ApplyDamage(float armor, float damage)
		{
			float armor2 = Mathf.Max(0f, armor - damage);
			return new DamageAndArmorResult(Mathf.Max(0f, damage - armor), armor2);
		}

		public static ArmorBase GetArmorByType(this ArmorHandler armorHandler, string type)
		{
			<>c__DisplayClass1_0 CS$<>8__locals0 = new <>c__DisplayClass1_0();
			CS$<>8__locals0.type = type;
			return armorHandler.armors.Find((Predicate<ArmorBase>)((ArmorBase armor) => armor.GetArmorType() == CS$<>8__locals0.type));
		}

		public static ArmorBase GetRegisteredArmorByType(string type)
		{
			<>c__DisplayClass2_0 CS$<>8__locals0 = new <>c__DisplayClass2_0();
			CS$<>8__locals0.type = type;
			return ArmorFramework.registeredArmorTypes.Find((Predicate<ArmorBase>)((ArmorBase armor) => armor.GetArmorType() == CS$<>8__locals0.type));
		}

		public static List<ArmorBase> GetActiveArmors(this ArmorHandler armorHandler)
		{
			return armorHandler.armors.FindAll((Predicate<ArmorBase>)((ArmorBase armor) => armor.maxArmorValue > 0f));
		}
	}
}
namespace JARL.ArmorFramework.Builtin
{
	public class DefaultArmor : ArmorBase
	{
		public override string GetArmorType()
		{
			return "Default";
		}

		public override BarColor GetBarColor()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			return new BarColor(Color.cyan * 0.6f, Color.cyan * 0.45f);
		}

		public override void SetupArmor()
		{
			armorTags.Add("CanArmorPierce");
			reactivateArmorType = ArmorReactivateType.Second;
		}
	}
}
namespace JARL.ArmorFramework.Classes
{
	public enum ArmorReactivateType : Enum
	{
		Percent,
		Second,
		Null
	}
	public class DamageAndArmorResult : Object
	{
		public float damage;

		public float armor;

		public DamageAndArmorResult(float damage, float armor)
		{
			this.damage = damage;
			this.armor = armor;
		}
	}
	public class ArmorProcessingResult : Object
	{
		public float damage;

		public float armor;

		public bool skipArmorDamageProcess;

		public ArmorProcessingResult(float damage, float armor, bool skipArmorDamageProcess)
		{
			this.damage = damage;
			this.armor = armor;
			this.skipArmorDamageProcess = skipArmorDamageProcess;
		}
	}
	public class HealthBarObjectWithArmor : Object
	{
		public GameObject healthBarObject;

		public ArmorBase armor;

		public HealthBarObjectWithArmor(GameObject healthBarObject, ArmorBase armor)
		{
			this.healthBarObject = healthBarObject;
			this.armor = armor;
		}
	}
	public class BarColor : Object
	{
		public Color activedBarColor;

		public Color deactivatedBarColor;

		public BarColor(Color activedBarColor, Color deactivatedBarColor)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			this.activedBarColor = activedBarColor;
			this.deactivatedBarColor = deactivatedBarColor;
		}
	}
}
namespace JARL.ArmorFramework.Abstract
{
	public abstract class ArmorBase : Object, ICloneable
	{
		public List<string> armorTags = new List<string>();

		public float maxArmorValue;

		public float currentArmorValue;

		public float armorRegenerationRate;

		public float armorRegenCooldownSeconds;

		public ArmorReactivateType reactivateArmorType;

		public float reactivateArmorValue;

		public string deactivateText = "";

		public bool isActive;

		public float timeSinceLastDamage;

		public bool regenerateFullyAfterRevive = true;

		public int priority;

		public ArmorHandler armorHandler;

		public object Clone()
		{
			return ((Object)this).MemberwiseClone();
		}

		public abstract string GetArmorType();

		public abstract BarColor GetBarColor();

		public virtual DamageAndArmorResult OnDamage(float damage, Player DamagingPlayer)
		{
			return ArmorUtils.ApplyDamage(currentArmorValue, damage);
		}

		public virtual void OnArmorDamage(float damage, Player DamagingPlayer)
		{
		}

		public virtual void SetupArmor()
		{
		}

		public bool HasArmorTag(string armorTag)
		{
			return armorTags.Contains(armorTag);
		}

		public float HealArmor(float healValue)
		{
			currentArmorValue = Mathf.Clamp(currentArmorValue + healValue, 0f, maxArmorValue);
			return currentArmorValue;
		}

		public float DamageArmor(float damageValue)
		{
			currentArmorValue = Mathf.Max(currentArmorValue - damageValue, 0f);
			OnArmorDamage(damageValue, null);
			return currentArmorValue;
		}

		public void RegenerationArmor()
		{
			if (Time.time > timeSinceLastDamage + armorRegenCooldownSeconds)
			{
				float healValue = armorRegenerationRate * Time.deltaTime;
				HealArmor(healValue);
			}
		}

		public virtual void OnUpdate()
		{
		}

		public virtual void OnRespawn()
		{
		}

		public virtual void OnReactivate()
		{
		}

		public ArmorBase()
		{
			SetupArmor();
		}
	}
}
namespace JARL.ArmorFramework.Abstract.Builtin
{
	public class ArmorPiercePercent : Object
	{
		public static DamageAndArmorResult ApplyArmorPiercePercent(ArmorBase armor, Player damageingPlayer, Player hurtPlayer, float remaindingDamage, float Damage)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			if (armor.armorTags.Contains("CanArmorPierce"))
			{
				? val;
				if (damageingPlayer == null)
				{
					val = default(Nullable<float>);
				}
				else
				{
					CharacterData data = damageingPlayer.data;
					if (data == null)
					{
						val = default(Nullable<float>);
					}
					else
					{
						JARLCharacterDataAdditionalData additionalData = data.GetAdditionalData();
						val = ((additionalData != null) ? new Nullable<float>(additionalData.ArmorPiercePercent) : default(Nullable<float>));
					}
				}
				Nullable<float> val2 = (Nullable<float>)val;
				float num = val2.GetValueOrDefault();
				return new DamageAndArmorResult(Math.Min(remaindingDamage + Damage * num, Damage), armor.currentArmorValue);
			}
			return new DamageAndArmorResult(remaindingDamage, armor.currentArmorValue);
		}
	}
}
namespace JARL.Extensions
{
	public class JARLCharacterDataAdditionalData : Object
	{
		public float totalArmor;

		public float totalMaxArmor;

		public float ArmorPiercePercent;

		public ArmorHandler armorHandler;

		public JARLCharacterDataAdditionalData()
		{
			totalArmor = 0f;
			totalMaxArmor = 0f;
			ArmorPiercePercent = 0f;
			armorHandler = null;
		}
	}
	public static class CharacterDataExtensions : Object
	{
		public static readonly ConditionalWeakTable<CharacterData, JARLCharacterDataAdditionalData> data = new ConditionalWeakTable<CharacterData, JARLCharacterDataAdditionalData>();

		public static JARLCharacterDataAdditionalData GetAdditionalData(this CharacterData block)
		{
			return data.GetOrCreateValue(block);
		}

		public static void AddData(this CharacterData block, JARLCharacterDataAdditionalData value)
		{
			try
			{
				data.Add(block, value);
			}
			catch (Exception)
			{
			}
		}
	}
}
namespace JARL.Abstract
{
	public abstract class CustomCardUnity : CustomCard
	{
		private class SetLocalPos : MonoBehaviour
		{
			private readonly Vector3 localpos = new Vector3(-50f, -50f, 0f);

			private void Update()
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: 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)
				if (!(((Component)this).gameObject.transform.localPosition == localpos))
				{
					((Component)this).gameObject.transform.localPosition = localpos;
					Object.Destroy((Object)(object)this, 1f);
				}
			}
		}

		[Header("Class Value")]
		public bool automatedlyCreateClass = true;

		private bool CreatedClassText;

		public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers)
		{
		}

		private void Update()
		{
			if (!CreatedClassText)
			{
				CreateClassText();
			}
		}

		protected override GameObject GetCardArt()
		{
			return base.cardInfo.cardArt;
		}

		protected override string GetDescription()
		{
			return base.cardInfo.cardDestription;
		}

		protected override Rarity GetRarity()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			return base.cardInfo.rarity;
		}

		protected override CardInfoStat[] GetStats()
		{
			return base.cardInfo.cardStats;
		}

		protected override CardThemeColorType GetTheme()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			return base.cardInfo.colorTheme;
		}

		protected override string GetTitle()
		{
			return base.cardInfo.cardName;
		}

		private void CreateClassText()
		{
			if (!automatedlyCreateClass)
			{
				return;
			}
			List<CardInfo> obj = Enumerable.ToList<CardInfo>((IEnumerable<CardInfo>)(object)ClassesRegistry.GetClassInfos((CardType)1, false));
			List<CardInfo> val = Enumerable.ToList<CardInfo>((IEnumerable<CardInfo>)(object)ClassesRegistry.GetClassInfos((CardType)2, false));
			List<CardInfo> val2 = Enumerable.ToList<CardInfo>((IEnumerable<CardInfo>)(object)ClassesRegistry.GetClassInfos((CardType)(-2), false));
			ClassObject val3 = ClassesRegistry.Get(Cards.instance.GetCardWithName(base.cardInfo.cardName));
			if (Enumerable.Any<CardInfo>((IEnumerable<CardInfo>)(object)obj, (Func<CardInfo, bool>)([CompilerGenerated] (CardInfo classCardInfo) => classCardInfo.cardName == base.cardInfo.cardName)))
			{
				goto IL_0090;
			}
			if (Enumerable.Any<CardInfo>((IEnumerable<CardInfo>)(object)val2, (Func<CardInfo, bool>)([CompilerGenerated] (CardInfo classCardInfo) => classCardInfo.cardName == base.cardInfo.cardName)))
			{
				CardInfo[] array = Enumerable.FirstOrDefault<CardInfo[]>((IEnumerable<CardInfo[]>)(object)val3.RequiredClassesTree);
				if (array != null && Enumerable.Count<CardInfo>((IEnumerable<CardInfo>)(object)array) > 0)
				{
					goto IL_0090;
				}
			}
			goto IL_00ee;
			IL_0090:
			CardInfo[] array2 = Enumerable.FirstOrDefault<CardInfo[]>((IEnumerable<CardInfo[]>)(object)val3.RequiredClassesTree);
			string className = ((array2 == null) ? null : Enumerable.FirstOrDefault<CardInfo>((IEnumerable<CardInfo>)(object)array2)?.cardName) ?? "Class";
			if (Enumerable.Any<CardInfo>((IEnumerable<CardInfo>)(object)val, (Func<CardInfo, bool>)([CompilerGenerated] (CardInfo subClassCardInfo) => subClassCardInfo.cardName == base.cardInfo.cardName)))
			{
				className = base.cardInfo.cardName;
			}
			((Component)this).gameObject.AddComponent<ClassNameMono>().className = className;
			goto IL_00ee;
			IL_00ee:
			CreatedClassText = true;
		}

		public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
		}
	}
}