Decompiled source of VanillaPlus v2.3.0

VanillaPlus.dll

Decompiled a month ago
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using DM;
using HarmonyLib;
using Landfall.TABS;
using Landfall.TABS.AI;
using Landfall.TABS.GameMode;
using Landfall.TABS.UnitEditor;
using Landfall.TABS.Workshop;
using TGCore;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
using VanillaPlus.Properties;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("VanillaPlus")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("VanillaPlus")]
[assembly: AssemblyCopyright("Copyright ©  2022")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("29C77666-B215-4BC7-8D4E-99A628E6FAD4")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
public class MasterBolt : ProjectileHitEffect
{
	public UnityEvent hitEvent;

	public UnityEvent disableEvent;

	public LayerMask mask;

	private MoveTransform move;

	private ProjectileHit projectileHit;

	private RaycastTrail trail;

	public ParticleSystem part;

	public bool spawnMore = true;

	public bool disableIfNoTarget;

	public bool onlyTargetAlive;

	private List<DataHandler> hitUnits = new List<DataHandler>();

	public float chanceOfSuccess = 1f;

	private void Start()
	{
		projectileHit = ((Component)this).GetComponent<ProjectileHit>();
		move = ((Component)this).GetComponent<MoveTransform>();
		trail = ((Component)this).GetComponent<RaycastTrail>();
	}

	public override bool DoEffect(HitData hit)
	{
		//IL_008e: 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_00c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_0103: Unknown result type (might be due to invalid IL or missing references)
		//IL_018d: Unknown result type (might be due to invalid IL or missing references)
		//IL_019b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0230: Unknown result type (might be due to invalid IL or missing references)
		//IL_023b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0240: Unknown result type (might be due to invalid IL or missing references)
		//IL_0245: Unknown result type (might be due to invalid IL or missing references)
		//IL_0249: Unknown result type (might be due to invalid IL or missing references)
		//IL_025e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0263: Unknown result type (might be due to invalid IL or missing references)
		//IL_0212: Unknown result type (might be due to invalid IL or missing references)
		//IL_021d: Unknown result type (might be due to invalid IL or missing references)
		if (!Object.op_Implicit((Object)(object)((Component)this).gameObject))
		{
			return false;
		}
		if (hitEvent != null)
		{
			hitEvent.Invoke();
		}
		if (!Object.op_Implicit((Object)(object)hit.rigidbody))
		{
			part.Play();
			((Behaviour)trail).enabled = false;
			((Behaviour)move).enabled = false;
			projectileHit.done = true;
			return true;
		}
		Collider[] array = Physics.OverlapSphere(((Component)this).transform.position, 20f, LayerMask.op_Implicit(mask));
		Transform val = null;
		float num = 999f;
		for (int i = 0; i < array.Length; i++)
		{
			if (!(((Component)this).transform.InverseTransformPoint(((Component)array[i]).transform.position).z > 0.6f) || !(Vector3.Angle(((Component)this).transform.forward, ((Component)array[i]).transform.position - ((Component)this).transform.position) < 90f))
			{
				continue;
			}
			DataHandler componentInParent = ((Component)((Component)array[i]).transform).GetComponentInParent<DataHandler>();
			if (Object.op_Implicit((Object)(object)componentInParent))
			{
				if (!componentInParent.Dead && !hitUnits.Contains(componentInParent))
				{
					hitUnits.Add(componentInParent);
				}
				if (componentInParent.Dead)
				{
					continue;
				}
			}
			float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)array[i]).transform.position);
			if (num2 < num)
			{
				val = ((Component)array[i]).transform;
				num = num2;
			}
		}
		if ((Object)(object)val != (Object)null)
		{
			if (Random.value < chanceOfSuccess && spawnMore)
			{
				Object.Instantiate<GameObject>(((Component)this).gameObject, ((Component)this).transform.position, ((Component)this).transform.rotation);
			}
			MoveTransform obj = move;
			Vector3 val2 = val.position - ((Component)this).transform.position;
			obj.velocity = ((Vector3)(ref val2)).normalized * ((Vector3)(ref move.selfImpulse)).magnitude;
		}
		else if (disableIfNoTarget)
		{
			projectileHit.DisableProjectile();
			disableEvent.Invoke();
		}
		CheckAchievements();
		return true;
	}

	private void CheckAchievements()
	{
		AchievementService service = ServiceLocator.GetService<AchievementService>();
		int num = hitUnits.Count((DataHandler hitUnit) => hitUnit.Dead);
		if (num >= 20)
		{
			service.UnlockAchievement("ZEUS_KILL_UNITS");
		}
	}
}
namespace VanillaPlus
{
	public class Abyssal : MonoBehaviour
	{
	}
	public class ParryRoot : MonoBehaviour
	{
		public bool canParry;

		public float globalCooldown = 2f;

		public float globalCounter = 1f;

		public void Update()
		{
			globalCounter += Time.deltaTime;
			if (globalCounter > globalCooldown)
			{
				canParry = true;
			}
		}

		public void OnCollisionEnter(Collision col)
		{
			//IL_0054: 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_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0273: Unknown result type (might be due to invalid IL or missing references)
			//IL_0278: Unknown result type (might be due to invalid IL or missing references)
			//IL_0245: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)col.rigidbody) && Object.op_Implicit((Object)(object)((Component)col.transform).GetComponent<MeleeWeapon>()) && Object.op_Implicit((Object)(object)((Component)col.transform.root).GetComponent<Unit>()) && ((Component)col.transform.root).GetComponent<Unit>().Team != ((Component)((Component)this).transform.root).GetComponent<Unit>().Team && !((Component)col.transform.root).GetComponent<Unit>().data.Dead && ((Component)this).GetComponent<MeleeWeapon>().isSwinging && canParry && ((Component)this).GetComponent<MeleeWeapon>().requiredPowerToParry * 1.5f >= ((Component)col.transform).GetComponent<MeleeWeapon>().requiredPowerToParry)
			{
				globalCounter = 0f;
				canParry = false;
				float num = 30f;
				((Component)col.transform).GetComponent<MeleeWeapon>().StopSwing();
				((Weapon)((Component)this).GetComponent<MeleeWeapon>()).internalCounter = Mathf.Lerp(((Weapon)((Component)this).GetComponent<MeleeWeapon>()).internalCounter, ((Weapon)((Component)this).GetComponent<MeleeWeapon>()).internalCooldown, 0.8f);
				if (Object.op_Implicit((Object)(object)((Component)col.transform).GetComponent<ParryRoot>()))
				{
					((Component)col.transform).GetComponent<ParryRoot>().canParry = false;
					((Component)col.transform).GetComponent<ParryRoot>().globalCounter /= 2f;
				}
				Rigidbody rigidbody = col.rigidbody;
				Vector3 val = col.transform.position - ((ContactPoint)(ref col.contacts[0])).point;
				rigidbody.AddForce(((Vector3)(ref val)).normalized * num, (ForceMode)2);
				Rigidbody component = ((Component)this).GetComponent<Rigidbody>();
				val = ((Component)this).transform.position - ((ContactPoint)(ref col.contacts[0])).point;
				component.AddForce(((Vector3)(ref val)).normalized * num * -0.5f, (ForceMode)2);
				CollisionSound componentInChildren = ((Component)this).GetComponentInChildren<CollisionSound>();
				if (Object.op_Implicit((Object)(object)componentInChildren) && componentInChildren.SoundEffectRef != string.Empty)
				{
					ServiceLocator.GetService<SoundPlayer>().PlaySoundEffect(componentInChildren.SoundEffectRef, 1f, ((ContactPoint)(ref col.contacts[0])).point, (MaterialType)3, (Transform)null, 1f);
				}
				GameObject val2 = Object.Instantiate<GameObject>(VPMain.combatUpgrade.LoadAsset<GameObject>("E_Parry"), ((ContactPoint)(ref col.contacts[0])).point, Quaternion.identity);
				val2.GetComponent<ParticleSystem>().Play();
			}
		}
	}
	public class SpawnFloatyPhysics : MonoBehaviour
	{
		public void Start()
		{
			StandingHandler componentInChildren = ((Component)((Component)this).transform.root).GetComponentInChildren<StandingHandler>();
			Wings componentInChildren2 = ((Component)((Component)this).transform.root).GetComponentInChildren<Wings>();
			if (Object.op_Implicit((Object)(object)componentInChildren2) && componentInChildren2.useWingsInPlacement)
			{
				if (Object.op_Implicit((Object)(object)componentInChildren))
				{
					((Behaviour)componentInChildren).enabled = true;
				}
				return;
			}
			Unit component = ((Component)((Component)this).transform.root).GetComponent<Unit>();
			if (Object.op_Implicit((Object)(object)component))
			{
				if (!Object.op_Implicit((Object)(object)component.data.footLeft) || !Object.op_Implicit((Object)(object)component.data.footRight))
				{
					if (Object.op_Implicit((Object)(object)componentInChildren))
					{
						((Behaviour)componentInChildren).enabled = true;
					}
					return;
				}
				((Component)component.data.footLeft).GetComponent<CurveAnimation>().multiplier = 2.5f;
				((Component)component.data.footRight).GetComponent<CurveAnimation>().multiplier = 2.5f;
			}
			Object.Instantiate<GameObject>(VPMain.combatUpgrade.LoadAsset<GameObject>("2.0Hover"), ((Component)this).transform.parent);
			Object.Destroy((Object)(object)this);
		}
	}
	public class Superimage : MonoBehaviour
	{
		public Material imgMaterial;

		public GameObject poofEffect;

		public GameObject despawnEffect;

		public float fadeTime = 0.5f;

		public float destroyDelay = 0.05f;

		public void Start()
		{
			((Component)this).GetComponent<UnitSpawner>().unitBlueprint = ((Component)((Component)this).transform.root).GetComponent<Unit>().unitBlueprint;
		}

		public void SpawnAfterimage()
		{
			((MonoBehaviour)this).StartCoroutine(Spawn());
		}

		public IEnumerator Spawn()
		{
			((Component)this).transform.position = ((Component)((Component)this).transform.root).GetComponent<Unit>().data.mainRig.position;
			Unit u = ((Component)this).GetComponent<UnitSpawner>().Spawn();
			((Object)u).name = "SUPERIMAGE";
			((Component)u).transform.position = new Vector3(((Component)((Component)this).transform.root).GetComponent<Unit>().data.mainRig.position.x, ((Component)((Component)this).transform.root).GetComponent<Unit>().data.mainRig.position.y - 1.353508f, ((Component)((Component)this).transform.root).GetComponent<Unit>().data.mainRig.position.z);
			((Component)u.data).GetComponent<UnitColorHandler>().SetMaterial(imgMaterial);
			((Component)u).GetComponent<UnitAPI>().forceSupressFromWinCondition = true;
			u.targetingPriorityMultiplier = 0.1f;
			ConditionalEvent[] componentsInChildren = ((Component)u).GetComponentsInChildren<ConditionalEvent>();
			foreach (ConditionalEvent move in componentsInChildren)
			{
				Object.Destroy((Object)(object)((Component)move).gameObject);
			}
			Object.Instantiate<GameObject>(poofEffect, u.data.mainRig.position, poofEffect.transform.rotation);
			yield return (object)new WaitForSeconds(fadeTime);
			Object.Instantiate<GameObject>(despawnEffect, u.data.mainRig.position, poofEffect.transform.rotation);
			yield return (object)new WaitForSeconds(destroyDelay);
			TrailRenderer[] componentsInChildren2 = ((Component)u).GetComponentsInChildren<TrailRenderer>();
			foreach (TrailRenderer trail in componentsInChildren2)
			{
				((Component)trail).transform.SetParent((Transform)null);
				trail.emitting = false;
				((Component)trail).gameObject.AddComponent<RemoveAfterSeconds>().seconds = trail.time * 1.5f;
			}
			u.DestroyUnit();
		}
	}
	public class UnitBaseSkeleton
	{
		public bool standingHandlerEnabled;

		public float stepMultiplier;

		public float allowedLegAngle;

		public float allowedTorsoAngle;

		public CurveAnimationData legLeftData;

		public float legLeftMultiplier;

		public CurveAnimationData legRightData;

		public float legRightMultiplier;

		public float footLeftMultiplier;

		public float footRightMultiplier;

		public void CopyThisOntoUnitBase(GameObject ub1, bool isAddingPhysics = false, bool isRemovingPhysics = false)
		{
			StandingHandler componentInChildren = ub1.GetComponentInChildren<StandingHandler>();
			if (Object.op_Implicit((Object)(object)componentInChildren))
			{
				((Behaviour)componentInChildren).enabled = standingHandlerEnabled;
			}
			Balance componentInChildren2 = ub1.GetComponentInChildren<Balance>();
			if (Object.op_Implicit((Object)(object)componentInChildren2))
			{
				componentInChildren2.allowedLegAngle = allowedLegAngle;
				componentInChildren2.allowedTorsoAngle = allowedTorsoAngle;
			}
			StepHandler componentInChildren3 = ub1.GetComponentInChildren<StepHandler>();
			if (Object.op_Implicit((Object)(object)componentInChildren3))
			{
				componentInChildren3.multiplier = stepMultiplier;
			}
			Unit component = ub1.GetComponent<Unit>();
			Transform legLeft = component.data.legLeft;
			CurveAnimation val = ((legLeft != null) ? ((Component)legLeft).GetComponent<CurveAnimation>() : null);
			if (Object.op_Implicit((Object)(object)val))
			{
				val.animationData = legLeftData;
				val.multiplier = legLeftMultiplier;
			}
			Transform legRight = component.data.legRight;
			CurveAnimation val2 = ((legRight != null) ? ((Component)legRight).GetComponent<CurveAnimation>() : null);
			if (Object.op_Implicit((Object)(object)val2))
			{
				val2.animationData = legRightData;
				val2.multiplier = legRightMultiplier;
			}
			if (isAddingPhysics && !Object.op_Implicit((Object)(object)((Component)component.data.hip).GetComponent<SpawnFloatyPhysics>()))
			{
				((Component)component.data.hip).gameObject.AddComponent<SpawnFloatyPhysics>();
			}
			if (isRemovingPhysics && Object.op_Implicit((Object)(object)((Component)component.data.hip).GetComponent<SpawnFloatyPhysics>()))
			{
				Object.Destroy((Object)(object)((Component)component.data.hip).GetComponent<SpawnFloatyPhysics>());
			}
		}

		public void CopyUnitBaseOntoThis(GameObject ub1)
		{
			StandingHandler componentInChildren = ub1.GetComponentInChildren<StandingHandler>();
			if (Object.op_Implicit((Object)(object)componentInChildren))
			{
				standingHandlerEnabled = ((Behaviour)componentInChildren).enabled;
			}
			Balance componentInChildren2 = ub1.GetComponentInChildren<Balance>();
			if (Object.op_Implicit((Object)(object)componentInChildren2))
			{
				allowedLegAngle = componentInChildren2.allowedLegAngle;
				allowedTorsoAngle = componentInChildren2.allowedTorsoAngle;
			}
			StepHandler componentInChildren3 = ub1.GetComponentInChildren<StepHandler>();
			if (Object.op_Implicit((Object)(object)componentInChildren3))
			{
				stepMultiplier = componentInChildren3.multiplier;
			}
			Unit component = ub1.GetComponent<Unit>();
			Transform legLeft = component.data.legLeft;
			CurveAnimation val = ((legLeft != null) ? ((Component)legLeft).GetComponent<CurveAnimation>() : null);
			if (Object.op_Implicit((Object)(object)val))
			{
				legLeftData = val.animationData;
				legLeftMultiplier = val.multiplier;
			}
			Transform legRight = component.data.legRight;
			CurveAnimation val2 = ((legRight != null) ? ((Component)legRight).GetComponent<CurveAnimation>() : null);
			if (Object.op_Implicit((Object)(object)val2))
			{
				legRightData = val2.animationData;
				legRightMultiplier = val2.multiplier;
			}
		}
	}
	public class UnitSkeleton
	{
		public float health;

		public GameObject[] m_props;

		public float animationMultiplier;

		public float balanceMultiplier;

		public float costTweak;

		public float damageMultiplier;

		public uint forceCost;

		public PropItemData[] m_propData;

		public float massMultiplier;

		public float sizeMultiplier;

		public float stepMultiplier;

		public TurningData turningData;

		public float turnSpeed;

		public float balanceForceMultiplier;

		public float movementSpeedMuiltiplier;

		public GameObject LeftWeapon;

		public GameObject RightWeapon;

		public GameObject[] objectsToSpawnAsChildren;

		public float minSizeRandom;

		public float maxSizeRandom;

		public GameObject UnitBase;

		public string Name;

		public void CopyThisOntoUnit(UnitBlueprint unit1)
		{
			unit1.health = health;
			unit1.m_props = m_props;
			unit1.animationMultiplier = animationMultiplier;
			unit1.balanceMultiplier = balanceMultiplier;
			unit1.costTweak = costTweak;
			unit1.damageMultiplier = damageMultiplier;
			unit1.forceCost = forceCost;
			unit1.m_propData = m_propData;
			unit1.massMultiplier = massMultiplier;
			unit1.sizeMultiplier = sizeMultiplier;
			unit1.stepMultiplier = stepMultiplier;
			unit1.turningData = turningData;
			unit1.turnSpeed = turnSpeed;
			unit1.balanceForceMultiplier = balanceForceMultiplier;
			unit1.movementSpeedMuiltiplier = movementSpeedMuiltiplier;
			unit1.LeftWeapon = LeftWeapon;
			unit1.RightWeapon = RightWeapon;
			unit1.objectsToSpawnAsChildren = objectsToSpawnAsChildren;
			unit1.minSizeRandom = minSizeRandom;
			unit1.maxSizeRandom = maxSizeRandom;
			unit1.UnitBase = UnitBase;
			if (Name != string.Empty)
			{
				unit1.Entity.Name = Name;
			}
		}

		public void CopyUnitOntoThis(UnitBlueprint unit2)
		{
			health = unit2.health;
			m_props = unit2.m_props;
			animationMultiplier = unit2.animationMultiplier;
			balanceMultiplier = unit2.balanceMultiplier;
			costTweak = unit2.costTweak;
			damageMultiplier = unit2.damageMultiplier;
			forceCost = unit2.forceCost;
			m_propData = unit2.m_propData;
			massMultiplier = unit2.massMultiplier;
			sizeMultiplier = unit2.sizeMultiplier;
			stepMultiplier = unit2.stepMultiplier;
			turningData = unit2.turningData;
			turnSpeed = unit2.turnSpeed;
			balanceForceMultiplier = unit2.balanceForceMultiplier;
			movementSpeedMuiltiplier = unit2.movementSpeedMuiltiplier;
			LeftWeapon = unit2.LeftWeapon;
			RightWeapon = unit2.RightWeapon;
			objectsToSpawnAsChildren = unit2.objectsToSpawnAsChildren;
			minSizeRandom = unit2.minSizeRandom;
			maxSizeRandom = unit2.maxSizeRandom;
			UnitBase = unit2.UnitBase;
			if (unit2.Entity.Name != string.Empty)
			{
				Name = unit2.Entity.Name;
			}
		}
	}
	[BepInPlugin("teamgrad.vanillaplus", "VanillaPlus", "2.3.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class VPLauncher : TGMod
	{
		public static ConfigEntry<bool> ConfigUnitUpgradesEnabled;

		public static ConfigEntry<bool> ConfigFloatinessEnabled;

		public static ConfigEntry<bool> ConfigShieldsBlockEnabled;

		public static ConfigEntry<bool> ConfigAllWeaponsBlockEnabled;

		public static ConfigEntry<bool> ConfigNerfsEnabled;

		public override void EarlyLaunch()
		{
			new VPMain();
		}

		public override void LateLaunch()
		{
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			VPMain.unitBaseList = new List<GameObject>(TGMain.landfallDb.GetUnitBases().ToList().FindAll((GameObject b) => (Object)(object)b != (Object)null && !((Object)b).name.Contains("_2.") && (((Object)b).name.Contains("Humanoid") || ((Object)b).name.Contains("Stiffy") || ((Object)b).name.Contains("Halfling") || ((Object)b).name.Contains("Blackbeard"))));
			foreach (GameObject unitBase in VPMain.unitBaseList)
			{
				UnitBaseSkeleton unitBaseSkeleton = new UnitBaseSkeleton();
				unitBaseSkeleton.CopyUnitBaseOntoThis(unitBase);
				VPMain.originalUnitBaseSkeletons.Add(unitBase.GetComponent<Unit>().Entity.GUID, unitBaseSkeleton);
			}
			VPMain.unitsToUpgrade = new List<UnitBlueprint>(TGMain.landfallDb.GetUnitBlueprints().ToList().FindAll((UnitBlueprint x) => (Object)(object)x != (Object)null && Object.op_Implicit((Object)(object)x.UnitBase) && (((Object)x.UnitBase).name.Contains("Humanoid") || ((Object)x.UnitBase).name.Contains("Stiffy") || ((Object)x.UnitBase).name.Contains("Halfling") || ((Object)x.UnitBase).name.Contains("Blackbeard"))));
			foreach (UnitBlueprint item in VPMain.unitsToUpgrade)
			{
				if (item.sizeMultiplier < 3f)
				{
					item.animationMultiplier = Mathf.Lerp(item.animationMultiplier, 1f, 0.5f);
					item.movementSpeedMuiltiplier = Mathf.Lerp(item.movementSpeedMuiltiplier, 0.75f, 0.5f);
					item.stepMultiplier = Mathf.Lerp(item.stepMultiplier, 0.75f, 0.5f);
				}
			}
			VPMain.ToggleUpgrades_OnValueChanged(0);
			VPMain.TogglePhysics_OnValueChanged(0);
			VPMain.ToggleShieldBlocking_OnValueChanged(0);
			VPMain.ToggleAllBlocking_OnValueChanged(0);
		}

		public override void AddSettings()
		{
			ConfigUnitUpgradesEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Gameplay", "UnitUpgradesEnabled", true, "Enables/disables unit modifications.");
			ConfigFloatinessEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Gameplay", "FloatinessEnabled", true, "Enables/disables unit modifications.");
			ConfigShieldsBlockEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Gameplay", "ShieldsBlockEnabled", true, "Enables/disables shied blocking.");
			ConfigAllWeaponsBlockEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Bug", "AllWeaponsBlockEnabled", false, "Enables/disables all weapons block on contact.");
			ConfigNerfsEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Bug", "NerfsEnabled", true, "Enables/disables a reduction to all unit health by 30% and a reduction to invulnerability time by 50%.");
			SettingsInstance val = TGAddons.CreateSetting((SettingsType)0, "Toggle unit upgrades", "Enables/disables unit modifications.", "GAMEPLAY", 0f, (float)((!ConfigUnitUpgradesEnabled.Value) ? 1 : 0), new string[2] { "Enable unit modifications", "Disable unit modifications" }, 0f, 1f);
			val.OnValueChanged += VPMain.ToggleUpgrades_OnValueChanged;
			SettingsInstance val2 = TGAddons.CreateSetting((SettingsType)0, "Toggle floaty physics", "Enables/disables floatier unit movement.", "GAMEPLAY", 0f, (float)((!ConfigFloatinessEnabled.Value) ? 1 : 0), new string[2] { "Enable floaty physics", "Disable floaty physics" }, 0f, 1f);
			val2.OnValueChanged += VPMain.TogglePhysics_OnValueChanged;
			SettingsInstance val3 = TGAddons.CreateSetting((SettingsType)0, "Toggle shield blocking", "Enables/disables shied blocking.", "GAMEPLAY", 0f, (float)((!ConfigShieldsBlockEnabled.Value) ? 1 : 0), new string[2] { "Enable shield blocking", "Disable shield blocking" }, 0f, 1f);
			val3.OnValueChanged += VPMain.ToggleShieldBlocking_OnValueChanged;
			SettingsInstance val4 = TGAddons.CreateSetting((SettingsType)0, "Toggle all weapon blocking", "Enables/disables all weapons block on contact.", "BUG", 0f, (float)((!ConfigAllWeaponsBlockEnabled.Value) ? 1 : 0), new string[2] { "Disable weapon blocking", "Enable weapon blocking" }, 0f, 1f);
			val4.OnValueChanged += VPMain.ToggleAllBlocking_OnValueChanged;
			SettingsInstance val5 = TGAddons.CreateSetting((SettingsType)0, "Toggle nerfs", "Enables/disables a reduction to all unit health by 30% and a reduction to invulnerability time by 50%.", "BUG", 0f, (float)((!ConfigNerfsEnabled.Value) ? 1 : 0), new string[2] { "Enable nerfs", "Disables nerfs" }, 0f, 1f);
			val5.OnValueChanged += delegate(int value)
			{
				ConfigNerfsEnabled.Value = value == 0;
			};
		}

		public override void SceneManager(Scene scene, LoadSceneMode loadSceneMode)
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Expected O, but got Unknown
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Expected O, but got Unknown
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Expected O, but got Unknown
			switch (((Scene)(ref scene)).name)
			{
			case "02_Lvl1_Farmer_VC":
			{
				GameObject val3 = new GameObject
				{
					name = "Secrets"
				};
				Object.Instantiate<GameObject>(VPMain.combatUpgrade.LoadAsset<GameObject>("SkewerThrower_Unlock"), val3.transform, true);
				break;
			}
			case "05_Lvl2_Medieval_VC":
			{
				GameObject val2 = new GameObject
				{
					name = "Secrets"
				};
				Object.Instantiate<GameObject>(VPMain.combatUpgrade.LoadAsset<GameObject>("Marauder_Unlock"), val2.transform, true);
				break;
			}
			case "05_AsiaTemple_VC":
			{
				GameObject val = new GameObject
				{
					name = "Secrets"
				};
				Object.Instantiate<GameObject>(VPMain.combatUpgrade.LoadAsset<GameObject>("Nunchaku_Unlock"), val.transform, true);
				break;
			}
			}
		}
	}
	public class VPMain
	{
		public static AssetBundle combatUpgrade = AssetBundle.LoadFromMemory(Resources.combatupgrade);

		public static List<UnitBlueprint> unitsToUpgrade = new List<UnitBlueprint>();

		public static List<UnitBlueprint> unitList = new List<UnitBlueprint>();

		public static List<GameObject> unitBaseList = new List<GameObject>();

		public static Dictionary<string, float> shieldWhitelist = new Dictionary<string, float>();

		public static Dictionary<DatabaseID, UnitSkeleton> unitSkeletons = new Dictionary<DatabaseID, UnitSkeleton>();

		public static Dictionary<DatabaseID, UnitSkeleton> originalUnitSkeletons = new Dictionary<DatabaseID, UnitSkeleton>();

		public static UnitBaseSkeleton unitBaseSkeleton = new UnitBaseSkeleton();

		public static Dictionary<DatabaseID, UnitBaseSkeleton> originalUnitBaseSkeletons = new Dictionary<DatabaseID, UnitBaseSkeleton>();

		public static bool NerfsEnabled => VPLauncher.ConfigNerfsEnabled.Value;

		public VPMain()
		{
			//IL_077f: Unknown result type (might be due to invalid IL or missing references)
			//IL_07b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_07e4: Unknown result type (might be due to invalid IL or missing references)
			Material[] array = combatUpgrade.LoadAllAssets<Material>();
			foreach (Material val in array)
			{
				if (Object.op_Implicit((Object)(object)Shader.Find(((Object)val.shader).name)))
				{
					val.shader = Shader.Find(((Object)val.shader).name);
				}
			}
			unitList = TGMain.landfallDb.GetUnitBlueprints().ToList();
			unitsToUpgrade = new List<UnitBlueprint>(unitList.FindAll((UnitBlueprint x) => (Object)(object)x != (Object)null && (Object)(object)x.UnitBase != (Object)null && (((Object)x.UnitBase).name.Contains("Humanoid") || ((Object)x.UnitBase).name.Contains("Stiffy") || ((Object)x.UnitBase).name.Contains("Halfling") || ((Object)x.UnitBase).name.Contains("Blackbeard"))));
			unitBaseSkeleton.CopyUnitBaseOntoThis(combatUpgrade.LoadAsset<GameObject>("Humanoid_2.0"));
			shieldWhitelist.Add("Shield_Tower_1 Weapons_VB", 2f);
			shieldWhitelist.Add("Ra_Shield", 0.5f);
			shieldWhitelist.Add("CavalryKnightShield 1_1 Weapons_VB", 0.5f);
			shieldWhitelist.Add("KnightlyShield", 2f);
			shieldWhitelist.Add("KnightShield", 2f);
			shieldWhitelist.Add("KnightShield_1 Weapons_VB", 2f);
			shieldWhitelist.Add("KnightShieldNew_1 Weapons_VB", 2f);
			shieldWhitelist.Add("EvilTankShield_Test_L_1 Weapons_VB", 0.5f);
			shieldWhitelist.Add("EvilTankShield_Test_R_1 Weapons_VB", 0.5f);
			shieldWhitelist.Add("Evil_ClericShield_1 Weapons_VB", 2f);
			shieldWhitelist.Add("Good_Cleric_Shield_1 Weapons_VB", 2f);
			shieldWhitelist.Add("Skeletonshield_Giant_1 Weapons_VB", 2f);
			shieldWhitelist.Add("Ballistic Shield_1 Weapons_VB", 0.5f);
			shieldWhitelist.Add("BallisticShield_Taser", 1f);
			shieldWhitelist.Add("BallisticShields", 0.5f);
			shieldWhitelist.Add("CrusaderShield", 1f);
			shieldWhitelist.Add("Napoleonic_Shield", 0.5f);
			shieldWhitelist.Add("Spartan_Shield", 2f);
			shieldWhitelist.Add("SmallShield_1 Weapons_VB", 2f);
			shieldWhitelist.Add("Shield_Wall_1 Weapons_VB", 0.5f);
			shieldWhitelist.Add("Legionary_Shield", 2f);
			shieldWhitelist.Add("CenturionShield_1 Weapons_VB", 1f);
			GameObject val2 = TGMain.landfallDb.GetWeapons().ToList().Find((GameObject x) => ((Object)x).name.Contains("Spear_Greek_1"));
			if (Object.op_Implicit((Object)(object)val2))
			{
				val2.GetComponent<Holdable>().holdableData.setRotation = false;
			}
			GameObject val3 = TGMain.landfallDb.GetWeapons().ToList().Find((GameObject x) => ((Object)x).name.Contains("ClericMace_1"));
			if (Object.op_Implicit((Object)(object)val3))
			{
				val3.GetComponent<MeleeWeapon>().requiredPowerToParry = 5f;
			}
			GameObject val4 = TGMain.landfallDb.GetWeapons().ToList().Find((GameObject x) => ((Object)x).name.Contains("ClericMaceEvil_1"));
			if (Object.op_Implicit((Object)(object)val4))
			{
				val4.GetComponent<MeleeWeapon>().requiredPowerToParry = 5f;
			}
			GameObject val5 = TGMain.landfallDb.GetWeapons().ToList().Find((GameObject x) => ((Object)x).name.Contains("Assassin_Dagger_1"));
			if (Object.op_Implicit((Object)(object)val5))
			{
				val5.GetComponent<MeleeWeapon>().requiredPowerToParry = 5f;
			}
			GameObject val6 = TGMain.landfallDb.GetWeapons().ToList().Find((GameObject x) => ((Object)x).name.Contains("WarGlaivecurved_1"));
			if (Object.op_Implicit((Object)(object)val6))
			{
				val6.GetComponent<MeleeWeapon>().requiredPowerToParry = 5f;
			}
			GameObject val7 = TGMain.landfallDb.GetWeapons().ToList().Find((GameObject x) => ((Object)x).name.Contains("Club_1") && !((Object)x).name.Contains("Aztec"));
			if (Object.op_Implicit((Object)(object)val7))
			{
				val7.GetComponent<MeleeWeapon>().requiredPowerToParry = 5f;
			}
			GameObject val8 = TGMain.landfallDb.GetWeapons().ToList().Find((GameObject x) => ((Object)x).name.Contains("Leg_SuperBoxer_W_1"));
			if (Object.op_Implicit((Object)(object)val8))
			{
				val8.GetComponent<MeleeWeapon>().requiredPowerToParry = 50f;
			}
			GameObject val9 = TGMain.landfallDb.GetWeapons().ToList().Find((GameObject x) => ((Object)x).name.Contains("Leg_SuperBoxer_W_R_1"));
			if (Object.op_Implicit((Object)(object)val9))
			{
				val9.GetComponent<MeleeWeapon>().requiredPowerToParry = 50f;
			}
			GameObject val10 = TGMain.landfallDb.GetWeapons().ToList().Find((GameObject x) => ((Object)x).name.Contains("ValkyrieSword_1"));
			if (Object.op_Implicit((Object)(object)val10))
			{
				val10.GetComponent<MeleeWeapon>().requiredPowerToParry = 5f;
			}
			UnitBlueprint[] array2 = combatUpgrade.LoadAllAssets<UnitBlueprint>();
			foreach (UnitBlueprint unit in array2)
			{
				GameObject val11 = TGMain.landfallDb.GetUnitBases().ToList().Find((GameObject x) => ((Object)x).name == ((Object)unit.UnitBase).name);
				GameObject val12 = TGMain.landfallDb.GetUnitBases().ToList().Find((GameObject x) => ((Object)x).name.Contains("Humanoid_1 Prefabs_VB"));
				if (Object.op_Implicit((Object)(object)unit.UnitBase) && Object.op_Implicit((Object)(object)val11))
				{
					unit.UnitBase = val11;
				}
				else if (Object.op_Implicit((Object)(object)unit.UnitBase) && ((Object)unit.UnitBase).name.Contains("2.0") && !((Object)unit.UnitBase).name.Contains("Minotaur") && Object.op_Implicit((Object)(object)val12))
				{
					unit.UnitBase = val12;
				}
				if (((Object)unit).name.Contains("Vampire"))
				{
					List<GameObject> list = new List<GameObject>(unit.objectsToSpawnAsChildren) { TGMain.tgcore.LoadAsset<GameObject>("Move_Vampire_Vampire") };
					unit.objectsToSpawnAsChildren = list.ToArray();
				}
			}
			List<UnitBlueprint> list2 = combatUpgrade.LoadAllAssets<UnitBlueprint>().ToList();
			foreach (UnitBlueprint unit2 in unitList)
			{
				UnitBlueprint val13 = list2.Find((UnitBlueprint x) => ((Object)x).name == ((Object)unit2).name + "_2.0");
				if (Object.op_Implicit((Object)(object)val13))
				{
					UnitSkeleton unitSkeleton = new UnitSkeleton();
					unitSkeleton.CopyUnitOntoThis(val13);
					unitSkeletons.Add(unit2.Entity.GUID, unitSkeleton);
					UnitSkeleton unitSkeleton2 = new UnitSkeleton();
					unitSkeleton2.CopyUnitOntoThis(unit2);
					originalUnitSkeletons.Add(unit2.Entity.GUID, unitSkeleton2);
				}
			}
			new Harmony("VanillaPlus").PatchAll();
			Faction[] array3 = combatUpgrade.LoadAllAssets<Faction>();
			foreach (Faction val14 in array3)
			{
				UnitBlueprint[] source = (from x in val14.Units
					where Object.op_Implicit((Object)(object)x)
					orderby x.GetUnitCost(true)
					select x).ToArray();
				val14.Units = source.ToArray();
				foreach (Faction item3 in TGMain.landfallDb.GetFactions().ToList())
				{
					if (val14.Entity.Name == item3.Entity.Name + "_NEW")
					{
						List<UnitBlueprint> list3 = new List<UnitBlueprint>(item3.Units);
						list3.AddRange(val14.Units);
						item3.Units = (from x in list3
							where Object.op_Implicit((Object)(object)x)
							orderby x.GetUnitCost(true)
							select x).ToArray();
						Object.DestroyImmediate((Object)(object)val14);
					}
				}
			}
			PropItem[] array4 = combatUpgrade.LoadAllAssets<PropItem>();
			foreach (PropItem val15 in array4)
			{
				int num4 = (from rend in ((Component)val15).GetComponentsInChildren<MeshFilter>()
					where ((Component)rend).gameObject.activeSelf && ((Component)rend).gameObject.activeInHierarchy && rend.mesh.subMeshCount > 0 && Object.op_Implicit((Object)(object)((Component)rend).GetComponent<MeshRenderer>()) && ((Renderer)((Component)rend).GetComponent<MeshRenderer>()).enabled
					select rend).Sum((MeshFilter rend) => rend.mesh.subMeshCount) + (from rend in ((Component)val15).GetComponentsInChildren<SkinnedMeshRenderer>()
					where ((Component)rend).gameObject.activeSelf && rend.sharedMesh.subMeshCount > 0 && ((Renderer)rend).enabled
					select rend).Sum((SkinnedMeshRenderer rend) => rend.sharedMesh.subMeshCount);
				if (num4 > 0)
				{
					float item = 1f / (float)num4;
					List<float> list4 = new List<float>();
					for (int num5 = 0; num5 < num4 - 1; num5++)
					{
						list4.Add(item);
					}
					((CharacterItem)val15).SubmeshArea = list4.ToArray();
				}
			}
			WeaponItem[] array5 = combatUpgrade.LoadAllAssets<WeaponItem>();
			foreach (WeaponItem val16 in array5)
			{
				int num7 = (from rend in ((Component)val16).GetComponentsInChildren<MeshFilter>()
					where ((Component)rend).gameObject.activeSelf && ((Component)rend).gameObject.activeInHierarchy && rend.mesh.subMeshCount > 0 && Object.op_Implicit((Object)(object)((Component)rend).GetComponent<MeshRenderer>()) && ((Renderer)((Component)rend).GetComponent<MeshRenderer>()).enabled
					select rend).Sum((MeshFilter rend) => rend.mesh.subMeshCount) + (from rend in ((Component)val16).GetComponentsInChildren<SkinnedMeshRenderer>()
					where ((Component)rend).gameObject.activeSelf && rend.sharedMesh.subMeshCount > 0 && ((Renderer)rend).enabled
					select rend).Sum((SkinnedMeshRenderer rend) => rend.sharedMesh.subMeshCount);
				if (num7 > 0)
				{
					float item2 = 1f / (float)num7;
					List<float> list5 = new List<float>();
					for (int num8 = 0; num8 < num7 - 1; num8++)
					{
						list5.Add(item2);
					}
					((CharacterItem)val16).SubmeshArea = list5.ToArray();
				}
			}
			AudioSource[] array6 = combatUpgrade.LoadAllAssets<AudioSource>();
			foreach (AudioSource val17 in array6)
			{
				val17.outputAudioMixerGroup = ServiceLocator.GetService<GameModeService>().AudioSettings.AudioMixer.outputAudioMixerGroup;
			}
			TGMain.newSounds.AddRange(combatUpgrade.LoadAllAssets<SoundBank>());
			GameObject[] source2 = combatUpgrade.LoadAllAssets<GameObject>();
			TGAddons.AddItems((IEnumerable<UnitBlueprint>)combatUpgrade.LoadAllAssets<UnitBlueprint>(), (IEnumerable<Faction>)combatUpgrade.LoadAllAssets<Faction>(), (IEnumerable<TABSCampaignAsset>)combatUpgrade.LoadAllAssets<TABSCampaignAsset>(), (IEnumerable<TABSCampaignLevelAsset>)combatUpgrade.LoadAllAssets<TABSCampaignLevelAsset>(), (IEnumerable<VoiceBundle>)combatUpgrade.LoadAllAssets<VoiceBundle>(), (IEnumerable<FactionIcon>)combatUpgrade.LoadAllAssets<FactionIcon>(), source2.Select((GameObject x) => x.GetComponent<Unit>()), source2.Select((GameObject x) => x.GetComponent<PropItem>()), source2.Select((GameObject x) => x.GetComponent<SpecialAbility>()), source2.Select((GameObject x) => x.GetComponent<WeaponItem>()), source2.Select((GameObject x) => x.GetComponent<ProjectileEntity>()));
		}

		public static void ToggleUpgrades_OnValueChanged(int value)
		{
			//IL_015d: 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_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			VPLauncher.ConfigUnitUpgradesEnabled.Value = value == 0;
			if (value == 0)
			{
				foreach (UnitBlueprint unit in unitList)
				{
					if ((Object)(object)unit != (Object)null && unitSkeletons.ContainsKey(unit.Entity.GUID))
					{
						unitSkeletons[unit.Entity.GUID].CopyThisOntoUnit(unit);
						Faction val = ContentDatabase.Instance().LandfallContentDatabase.GetFactions().ToList().Find((Faction x) => ((Object)x).name == "Secret");
						if (Object.op_Implicit((Object)(object)val))
						{
							val.Units = (from UnitBlueprint uj in val.Units
								orderby uj.GetUnitCost(true)
								select uj).ToArray();
						}
					}
				}
				return;
			}
			foreach (UnitBlueprint unit2 in unitList)
			{
				UnitBlueprint val2 = unit2;
				if (!((Object)(object)val2 != (Object)null) || !originalUnitSkeletons.ContainsKey(val2.Entity.GUID))
				{
					continue;
				}
				originalUnitSkeletons[val2.Entity.GUID].CopyThisOntoUnit(val2);
				Faction val3 = ContentDatabase.Instance().LandfallContentDatabase.GetFactions().ToList().Find((Faction x) => ((Object)x).name == "Secret");
				if (Object.op_Implicit((Object)(object)val3))
				{
					val3.Units = (from UnitBlueprint uj in val3.Units
						orderby uj.GetUnitCost(true)
						select uj).ToArray();
				}
			}
		}

		public static void TogglePhysics_OnValueChanged(int value)
		{
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			VPLauncher.ConfigFloatinessEnabled.Value = value == 0;
			if (value == 0)
			{
				foreach (GameObject unitBase in unitBaseList)
				{
					unitBaseSkeleton.CopyThisOntoUnitBase(unitBase, isAddingPhysics: true);
				}
				return;
			}
			foreach (GameObject unitBase2 in unitBaseList)
			{
				DatabaseID gUID = unitBase2.GetComponent<Unit>().Entity.GUID;
				if ((Object)(object)unitBase2 != (Object)null && originalUnitBaseSkeletons.ContainsKey(gUID))
				{
					originalUnitBaseSkeletons[gUID].CopyThisOntoUnitBase(unitBase2, isAddingPhysics: false, isRemovingPhysics: true);
				}
			}
		}

		public static void ToggleShieldBlocking_OnValueChanged(int value)
		{
			VPLauncher.ConfigShieldsBlockEnabled.Value = value == 0;
			if (value == 0)
			{
				foreach (GameObject item in ContentDatabase.Instance().LandfallContentDatabase.GetWeapons().ToList())
				{
					if (shieldWhitelist.ContainsKey(((Object)item).name) && Object.op_Implicit((Object)(object)item.GetComponent<MeleeWeapon>()) && Object.op_Implicit((Object)(object)item.GetComponent<Rigidbody>()) && !Object.op_Implicit((Object)(object)item.GetComponent<ParryRoot>()))
					{
						item.AddComponent<ParryRoot>().globalCooldown = shieldWhitelist[((Object)item).name];
					}
				}
				return;
			}
			foreach (GameObject item2 in ContentDatabase.Instance().LandfallContentDatabase.GetWeapons().ToList())
			{
				if (shieldWhitelist.ContainsKey(((Object)item2).name) && Object.op_Implicit((Object)(object)item2.GetComponent<ParryRoot>()))
				{
					Object.DestroyImmediate((Object)(object)item2.GetComponent<ParryRoot>());
				}
			}
		}

		public static void ToggleAllBlocking_OnValueChanged(int value)
		{
			VPLauncher.ConfigAllWeaponsBlockEnabled.Value = value == 1;
			if (value == 1)
			{
				foreach (GameObject item in ContentDatabase.Instance().LandfallContentDatabase.GetWeapons().ToList())
				{
					if (!shieldWhitelist.ContainsKey(((Object)item).name) && Object.op_Implicit((Object)(object)item.GetComponent<MeleeWeapon>()) && Object.op_Implicit((Object)(object)item.GetComponent<Rigidbody>()) && !Object.op_Implicit((Object)(object)item.GetComponent<ParryRoot>()))
					{
						item.AddComponent<ParryRoot>();
					}
				}
				return;
			}
			foreach (GameObject item2 in ContentDatabase.Instance().LandfallContentDatabase.GetWeapons().ToList())
			{
				if (!shieldWhitelist.ContainsKey(((Object)item2).name) && Object.op_Implicit((Object)(object)item2.GetComponent<ParryRoot>()))
				{
					Object.DestroyImmediate((Object)(object)item2.GetComponent<ParryRoot>());
				}
			}
		}
	}
	public static class VPExtensions
	{
		public static T DeepCopyOf<T>(this T self, T from) where T : class
		{
			FieldInfo[] fields = typeof(T).GetFields((BindingFlags)(-1));
			FieldInfo[] array = fields;
			FieldInfo[] array2 = array;
			foreach (FieldInfo fieldInfo in array2)
			{
				try
				{
					fieldInfo.SetValue(self, fieldInfo.GetValue(from));
				}
				catch
				{
					Debug.Log((object)"you suck and you field");
				}
			}
			PropertyInfo[] properties = typeof(T).GetProperties((BindingFlags)(-1));
			PropertyInfo[] array3 = properties;
			PropertyInfo[] array4 = array3;
			foreach (PropertyInfo propertyInfo in array4)
			{
				if (propertyInfo.CanWrite && propertyInfo.CanRead)
				{
					try
					{
						propertyInfo.SetValue(self, propertyInfo.GetValue(from));
					}
					catch
					{
						Debug.Log((object)"you suck and you property");
					}
				}
			}
			return self;
		}
	}
}
namespace VanillaPlus.Properties
{
	[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
	[DebuggerNonUserCode]
	[CompilerGenerated]
	internal class Resources
	{
		private static ResourceManager resourceMan;

		private static CultureInfo resourceCulture;

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		internal static ResourceManager ResourceManager
		{
			get
			{
				if (resourceMan == null)
				{
					ResourceManager resourceManager = new ResourceManager("VanillaPlus.Properties.Resources", typeof(Resources).Assembly);
					resourceMan = resourceManager;
				}
				return resourceMan;
			}
		}

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		internal static CultureInfo Culture
		{
			get
			{
				return resourceCulture;
			}
			set
			{
				resourceCulture = value;
			}
		}

		internal static byte[] combatupgrade
		{
			get
			{
				object obj = ResourceManager.GetObject("combatupgrade", resourceCulture);
				return (byte[])obj;
			}
		}

		internal Resources()
		{
		}
	}
}
namespace VanillaPlus.HarmonyPatches
{
	[HarmonyPatch(typeof(HealthHandler), "Update")]
	internal class AbyssalPatch
	{
		[HarmonyPrefix]
		public static bool Prefix(HealthHandler __instance)
		{
			if (Object.op_Implicit((Object)(object)((Component)((Component)__instance).transform.root).GetComponentInChildren<Abyssal>()))
			{
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(DataHandler), "Start")]
	internal class HealthNerfPatch
	{
		[HarmonyPrefix]
		public static void Postfix(DataHandler __instance)
		{
			if (VPMain.NerfsEnabled)
			{
				__instance.health *= 0.7f;
			}
			__instance.maxHealth = __instance.health;
		}
	}
	[HarmonyPatch(typeof(UnitDontTakeDamageForSeconds), "Start")]
	internal class InvulnerabilityNerfPatch
	{
		[HarmonyPrefix]
		public static bool Prefix(UnitDontTakeDamageForSeconds __instance)
		{
			if (VPMain.NerfsEnabled)
			{
				__instance.seconds *= 0.7f;
			}
			return true;
		}
	}
}