Decompiled source of Future of Heresy v0.3.1

GestationItem.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using BodyBlend;
using GestationItem.Hooks;
using IL.RoR2;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.RoR2;
using On.RoR2.UI;
using R2API;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
using RoR2.Orbs;
using RoR2.UI;
using TMPro;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("GestationItem")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("GestationItem")]
[assembly: AssemblyTitle("GestationItem")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace GestationItem
{
	public class ConfigOption<T>
	{
		public ConfigEntry<T> Bind;

		public ConfigOption(ConfigFile config, string categoryName, string configOptionName, T defaultValue, string fullDescription)
		{
			Bind = config.Bind<T>(categoryName, configOptionName, defaultValue, fullDescription);
		}

		public static implicit operator T(ConfigOption<T> x)
		{
			return x.Bind.Value;
		}

		public override string ToString()
		{
			return Bind.Value.ToString();
		}

		public T GetValue()
		{
			return Bind.Value;
		}

		public void SetValue(T value)
		{
			Bind.Value = value;
		}
	}
	public static class ConfigExtension
	{
		public static ConfigOption<T> ActiveBind<T>(this ConfigFile configWrapper, string categoryName, string configOptionName, T defaultValue, string fullDescription)
		{
			return new ConfigOption<T>(configWrapper, categoryName, configOptionName, defaultValue, fullDescription);
		}
	}
	public abstract class EquipmentBase<T> : EquipmentBase where T : EquipmentBase<T>
	{
		public static T instance { get; private set; }

		public EquipmentBase()
		{
			if (instance != null)
			{
				throw new InvalidOperationException("Singleton class \"" + typeof(T).Name + "\" inheriting EquipmentBoilerplate/Equipment was instantiated twice");
			}
			instance = this as T;
		}
	}
	public abstract class EquipmentBase
	{
		public enum TargetingType
		{
			Enemies,
			Friendlies,
			NonBossEnemies,
			Monsters,
			NonBossMonsters
		}

		public class TargetingControllerComponent : MonoBehaviour
		{
			public GameObject TargetObject;

			public GameObject VisualizerPrefab;

			public Indicator Indicator;

			public BullseyeSearch TargetFinder;

			public Action<BullseyeSearch> AdditionalBullseyeSettings = delegate
			{
			};

			public Action<BullseyeSearch> AdditionalBullseyeFunctionality = delegate
			{
			};

			public void Awake()
			{
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				//IL_0013: Expected O, but got Unknown
				Indicator = new Indicator(((Component)this).gameObject, (GameObject)null);
			}

			public void OnDestroy()
			{
				Invalidate();
			}

			public void Invalidate()
			{
				TargetObject = null;
				Indicator.targetTransform = null;
			}

			public void ConfigureTargetFinderBase(EquipmentSlot self)
			{
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0024: Unknown result type (might be due to invalid IL or missing references)
				//IL_003f: 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_0063: Unknown result type (might be due to invalid IL or missing references)
				//IL_0070: Unknown result type (might be due to invalid IL or missing references)
				//IL_0075: Unknown result type (might be due to invalid IL or missing references)
				//IL_007e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0083: 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_0095: 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: Expected O, but got Unknown
				if (TargetFinder == null)
				{
					TargetFinder = new BullseyeSearch();
				}
				TargetFinder.teamMaskFilter = TeamMask.allButNeutral;
				((TeamMask)(ref TargetFinder.teamMaskFilter)).RemoveTeam(self.characterBody.teamComponent.teamIndex);
				TargetFinder.sortMode = (SortMode)2;
				TargetFinder.filterByLoS = true;
				float num = default(float);
				Ray val = CameraRigController.ModifyAimRayIfApplicable(self.GetAimRay(), ((Component)self).gameObject, ref num);
				TargetFinder.searchOrigin = ((Ray)(ref val)).origin;
				TargetFinder.searchDirection = ((Ray)(ref val)).direction;
				TargetFinder.maxAngleFilter = 16f;
				TargetFinder.maxDistanceFilter = 16f;
				TargetFinder.viewer = self.characterBody;
				AdditionalBullseyeSettings(TargetFinder);
			}

			public void ConfigureTargetFinderForEnemies(EquipmentSlot self, bool nonChampion = false)
			{
				//IL_001a: Unknown result type (might be due to invalid IL or missing references)
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0024: Unknown result type (might be due to invalid IL or missing references)
				ConfigureTargetFinderBase(self);
				TargetFinder.teamMaskFilter = TeamMask.GetUnprotectedTeams(self.characterBody.teamComponent.teamIndex);
				TargetFinder.RefreshCandidates();
				TargetFinder.FilterOutGameObject(((Component)self).gameObject);
				AdditionalBullseyeFunctionality(TargetFinder);
				PlaceTargetingIndicator(TargetFinder.GetResults(), nonChampion);
			}

			public void ConfigureTargetFinderForMonsters(EquipmentSlot self, bool nonChampion = false)
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0020: Unknown result type (might be due to invalid IL or missing references)
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				ConfigureTargetFinderBase(self);
				TeamMask teamMaskFilter = default(TeamMask);
				((TeamMask)(ref teamMaskFilter)).AddTeam((TeamIndex)2);
				TargetFinder.teamMaskFilter = teamMaskFilter;
				TargetFinder.RefreshCandidates();
				TargetFinder.FilterOutGameObject(((Component)self).gameObject);
				AdditionalBullseyeFunctionality(TargetFinder);
				PlaceTargetingIndicator(TargetFinder.GetResults(), nonChampion);
			}

			public void ConfigureTargetFinderForFriendlies(EquipmentSlot self)
			{
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_002f: Unknown result type (might be due to invalid IL or missing references)
				ConfigureTargetFinderBase(self);
				TargetFinder.teamMaskFilter = TeamMask.none;
				((TeamMask)(ref TargetFinder.teamMaskFilter)).AddTeam(self.characterBody.teamComponent.teamIndex);
				TargetFinder.RefreshCandidates();
				TargetFinder.FilterOutGameObject(((Component)self).gameObject);
				AdditionalBullseyeFunctionality(TargetFinder);
				PlaceTargetingIndicator(TargetFinder.GetResults());
			}

			public void PlaceTargetingIndicator(IEnumerable<HurtBox> TargetFinderResults, bool nonChampion = false)
			{
				HurtBox val = ((!nonChampion) ? (TargetFinderResults.Any() ? TargetFinderResults.FirstOrDefault() : null) : (TargetFinderResults.Any() ? TargetFinderResults.FirstOrDefault((Func<HurtBox, bool>)((HurtBox p) => !(((Component)p.healthComponent).gameObject.GetComponent<CharacterBody>()?.isChampion ?? false))) : null));
				if (Object.op_Implicit((Object)(object)val))
				{
					TargetObject = ((Component)val.healthComponent).gameObject;
					Indicator.visualizerPrefab = VisualizerPrefab;
					Indicator.targetTransform = ((Component)val).transform;
				}
				else
				{
					Invalidate();
				}
				Indicator.active = Object.op_Implicit((Object)(object)val);
			}
		}

		public EquipmentDef EquipmentDef;

		public GameObject TargetingIndicatorPrefabBase = null;

		public Func<EquipmentSlot, bool> AdditionalTargetCondition = (EquipmentSlot slot) => true;

		public abstract string EquipmentName { get; }

		public abstract string EquipmentLangTokenName { get; }

		public abstract string EquipmentPickupDesc { get; }

		public abstract string EquipmentFullDescription { get; }

		public abstract string EquipmentLore { get; }

		public abstract GameObject EquipmentModel { get; }

		public abstract Sprite EquipmentIcon { get; }

		public virtual bool AppearsInSinglePlayer { get; } = true;


		public virtual bool AppearsInMultiPlayer { get; } = true;


		public virtual bool CanDrop { get; } = true;


		public virtual float Cooldown { get; } = 60f;


		public virtual bool EnigmaCompatible { get; } = true;


		public virtual bool IsBoss { get; } = false;


		public virtual bool IsLunar { get; } = false;


		public virtual bool UseTargeting { get; } = false;


		public virtual TargetingType TargetingTypeEnum { get; } = TargetingType.Enemies;


		public abstract void Init(ConfigFile config);

		public abstract ItemDisplayRuleDict CreateItemDisplayRules();

		protected void CreateLang()
		{
			LanguageAPI.Add("EQUIPMENT_" + EquipmentLangTokenName + "_NAME", EquipmentName);
			LanguageAPI.Add("EQUIPMENT_" + EquipmentLangTokenName + "_PICKUP", EquipmentPickupDesc);
			LanguageAPI.Add("EQUIPMENT_" + EquipmentLangTokenName + "_DESCRIPTION", EquipmentFullDescription);
			LanguageAPI.Add("EQUIPMENT_" + EquipmentLangTokenName + "_LORE", EquipmentLore);
		}

		protected void CreateEquipment()
		{
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Expected O, but got Unknown
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Expected O, but got Unknown
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Expected O, but got Unknown
			EquipmentDef = ScriptableObject.CreateInstance<EquipmentDef>();
			((Object)EquipmentDef).name = "EQUIPMENT_" + EquipmentLangTokenName;
			EquipmentDef.nameToken = "EQUIPMENT_" + EquipmentLangTokenName + "_NAME";
			EquipmentDef.pickupToken = "EQUIPMENT_" + EquipmentLangTokenName + "_PICKUP";
			EquipmentDef.descriptionToken = "EQUIPMENT_" + EquipmentLangTokenName + "_DESCRIPTION";
			EquipmentDef.loreToken = "EQUIPMENT_" + EquipmentLangTokenName + "_LORE";
			EquipmentDef.pickupModelPrefab = EquipmentModel;
			EquipmentDef.pickupIconSprite = EquipmentIcon;
			EquipmentDef.appearsInSinglePlayer = AppearsInSinglePlayer;
			EquipmentDef.appearsInMultiPlayer = AppearsInMultiPlayer;
			EquipmentDef.canDrop = CanDrop;
			EquipmentDef.cooldown = Cooldown;
			EquipmentDef.enigmaCompatible = EnigmaCompatible;
			EquipmentDef.isBoss = IsBoss;
			EquipmentDef.isLunar = IsLunar;
			if (EquipmentDef.isLunar)
			{
				EquipmentDef.colorIndex = (ColorIndex)4;
			}
			ItemAPI.Add(new CustomEquipment(EquipmentDef, CreateItemDisplayRules()));
			EquipmentSlot.PerformEquipmentAction += new hook_PerformEquipmentAction(PerformEquipmentAction);
			if (UseTargeting && Object.op_Implicit((Object)(object)TargetingIndicatorPrefabBase))
			{
				EquipmentSlot.Update += new hook_Update(UpdateTargeting);
			}
		}

		protected bool PerformEquipmentAction(orig_PerformEquipmentAction orig, EquipmentSlot self, EquipmentDef equipmentDef)
		{
			if ((Object)(object)equipmentDef == (Object)(object)EquipmentDef)
			{
				return ActivateEquipment(self);
			}
			return orig.Invoke(self, equipmentDef);
		}

		protected abstract bool ActivateEquipment(EquipmentSlot slot);

		public abstract void Hooks();

		protected virtual void UpdateTargeting(orig_Update orig, EquipmentSlot self)
		{
			//IL_000a: 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)
			orig.Invoke(self);
			if (self.equipmentIndex != EquipmentDef.equipmentIndex)
			{
				return;
			}
			TargetingControllerComponent targetingControllerComponent = ((Component)self).GetComponent<TargetingControllerComponent>();
			if (!Object.op_Implicit((Object)(object)targetingControllerComponent))
			{
				targetingControllerComponent = ((Component)self).gameObject.AddComponent<TargetingControllerComponent>();
				targetingControllerComponent.VisualizerPrefab = TargetingIndicatorPrefabBase;
			}
			if (self.stock > 0 && AdditionalTargetCondition(self))
			{
				switch (TargetingTypeEnum)
				{
				case TargetingType.Enemies:
					targetingControllerComponent.ConfigureTargetFinderForEnemies(self);
					break;
				case TargetingType.Friendlies:
					targetingControllerComponent.ConfigureTargetFinderForFriendlies(self);
					break;
				case TargetingType.NonBossEnemies:
					targetingControllerComponent.ConfigureTargetFinderForEnemies(self, nonChampion: true);
					break;
				case TargetingType.Monsters:
					targetingControllerComponent.ConfigureTargetFinderForMonsters(self);
					break;
				case TargetingType.NonBossMonsters:
					targetingControllerComponent.ConfigureTargetFinderForMonsters(self, nonChampion: true);
					break;
				}
			}
			else
			{
				targetingControllerComponent.Invalidate();
				targetingControllerComponent.Indicator.active = false;
			}
		}
	}
	internal class BodyBlendCompatibility
	{
		private static bool? _enabled;

		private static Dictionary<string, float> DefaultPartInfluences = new Dictionary<string, float>
		{
			{ "Belly", 50f },
			{ "Breasts", 50f }
		};

		protected static Dictionary<string, ConfigEntry<float>> PartInfluences = new Dictionary<string, ConfigEntry<float>>();

		public static bool enabled
		{
			get
			{
				if (!_enabled.HasValue)
				{
					_enabled = Chainloader.PluginInfos.ContainsKey("com.Maiesen.BodyBlend");
				}
				return _enabled.Value;
			}
		}

		public static ICollection<string> GetParts()
		{
			return PartInfluences.Keys;
		}

		public static float GetInfluence(string part)
		{
			return PartInfluences[part].Value / 100f;
		}

		public static void HookBodyBlend(ConfigFile config)
		{
			BodyBlendPlugin.AfterBodyBlendLoaded += delegate
			{
				CreateBodyBlendConfig(config);
			};
		}

		public static void CreateBodyBlendConfig(ConfigFile config)
		{
			foreach (KeyValuePair<string, float> defaultPartInfluence in DefaultPartInfluences)
			{
				CreatePartConfig(config, defaultPartInfluence.Key, defaultPartInfluence.Value);
			}
			foreach (string bodyBlendPart in BodyBlendPlugin.GetBodyBlendParts())
			{
				if (!PartInfluences.ContainsKey(bodyBlendPart))
				{
					CreatePartConfig(config, bodyBlendPart, 0f);
				}
			}
		}

		public static void CreatePartConfig(ConfigFile config, string part, float defaultInfluence)
		{
			//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_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Expected O, but got Unknown
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Expected O, but got Unknown
			string equipmentName = GestationItemPlugin.GestationItemInstance.EquipmentName;
			ConfigEntry<float> val = config.Bind<float>("(BodyBlend) " + equipmentName, part + " Influence", defaultInfluence, "Determine how much \"" + part + "\" will get influenced by " + equipmentName + " per child.\n" + $"Default: {defaultInfluence:0}");
			ModSettingsManager.AddOption((BaseOption)new SliderOption(val, new SliderConfig
			{
				min = 0f,
				max = 100f
			}));
			PartInfluences[part] = val;
		}
	}
	internal static class BodyBlendCompatibilityExt
	{
		public static void SetBlendValue(this CharacterBody body, string name, float value, string source)
		{
			BodyBlendController bodyBlendController = body.GetBodyBlendController();
			if (Object.op_Implicit((Object)(object)bodyBlendController))
			{
				bodyBlendController.SetBlendTargetWeight(name, value, source, false);
			}
		}

		public static void RemoveBlend(this CharacterBody body, string name, string source)
		{
			BodyBlendController bodyBlendController = body.GetBodyBlendController();
			if (Object.op_Implicit((Object)(object)bodyBlendController))
			{
				bodyBlendController.RemoveBlendTargetWeight(name, source);
			}
		}

		private static BodyBlendController GetBodyBlendController(this CharacterBody body)
		{
			return ((Component)body.modelLocator.modelTransform).gameObject.GetComponent<BodyBlendController>();
		}
	}
	internal class GestationItem : EquipmentBase<GestationItem>
	{
		private class StatHookArgs
		{
			public float speedMult = 1f;

			public float curseMult = 1f;

			public float progress = 0f;

			public int childCount = 0;
		}

		public class GestationStore : MonoBehaviour
		{
			public List<GameObject> EnemyPrefabs { get; }

			public int ChildCount { get; private set; }

			public GestationStore()
			{
				EnemyPrefabs = new List<GameObject>();
				ChildCount = 0;
			}

			public void AddEnemyPrefab(GameObject enemy, int count = 1)
			{
				ChildCount += count;
				EnemyPrefabs.Add(enemy);
			}

			public void ClearEnemyPrefabs()
			{
				ChildCount = 0;
				EnemyPrefabs.Clear();
			}
		}

		public class PeriodicStatsRecalculator : MonoBehaviour
		{
			public CharacterBody body;

			private IEnumerator statsUpdateCoroutine;

			public void StartStatsUpdate()
			{
				statsUpdateCoroutine = UpdateStats();
				((MonoBehaviour)this).StartCoroutine(statsUpdateCoroutine);
			}

			public void StopStatsUpdate()
			{
				((MonoBehaviour)this).StopCoroutine(statsUpdateCoroutine);
			}

			private IEnumerator UpdateStats()
			{
				while (true)
				{
					body.RecalculateStats();
					yield return (object)new WaitForSeconds(RecalculateStatsPeriod);
				}
			}
		}

		public static ConfigOption<int> CooldownCfg;

		public static ConfigOption<int> GestationTime;

		public static ConfigOption<int> ChildLifeTime;

		public static ConfigOption<float> MaxCurseCfg;

		public static ConfigOption<int> BossChildCount;

		public static ConfigOption<float> TargetMaxAngle;

		public static ConfigOption<float> TargetMaxDistance;

		public static ConfigOption<bool> AllowSuperFetation;

		public static ConfigOption<bool> AllowItemInheritance;

		public static ConfigOption<string> BlacklistCfg;

		public static ConfigOption<bool> UseTeamMinionLimit;

		public static ConfigOption<bool> LimitOneChildSize;

		private static float MaxCurseBase;

		private static float ChildScaling = 0.6f;

		private static float RecalculateStatsPeriod = 0.5f;

		public static BuffDef GestationBuff;

		public static BuffDef GestationCompleteBuff;

		internal static GameObject GestationOrbEffectPrefab;

		private static readonly float SurfaceHitOffset = 0.7f;

		private static readonly float MaxSpawnDistance = 9f;

		private static readonly float SpawnAngleSpread = 25f;

		private static readonly float SpawnRadiusSpread = Mathf.Tan(MathF.PI / 180f * SpawnAngleSpread / 2f);

		private static readonly float SpawnDistanceSpread = 4f;

		private static StatHookArgs StatArgs;

		public override string EquipmentName => "Future of Heresy";

		public override string EquipmentLangTokenName => "GESTATION_ITEM";

		public override string EquipmentPickupDesc => "Motherhood on command" + (((float)MaxCurseCfg == 0f) ? "." : "...\n<style=cDeath>BUT creation comes at a cost</style>.");

		public override string EquipmentFullDescription => "Become <style=cIsUtility>impregnated</style> with a clone of a targeted " + (((int)BossChildCount > 0) ? "monster" : "non-boss monster") + ". " + $"Gestate for <style=cIsUtility>{GestationTime}</style> seconds. " + (((float)MaxCurseCfg == 0f) ? "\n" : ("<style=cIsHealth>Maximum health and speed are reduced</style> up to " + $"<style=cIsHealth>{MaxCurseCfg.GetValue():0%}</style> per gestating monster.<line-height=50%>\n<line-height=100%>\n")) + "Can be activated again once the <style=cIsUtility>gestation is complete</style> to <style=cIsDamage>spawn the cloned monster</style>" + (AllowItemInheritance ? ", <style=cIsUtility>inherting all your items</style>." : ".") + " " + $"The monster lasts <style=cIsDamage>{ChildLifeTime}</style> seconds.";

		public override string EquipmentLore => "“Vision, Hooks, Strides, and Essence, these are the four distinct pieces from her Evisceration.\n...But from deep within Kur-skan's core is a piece cast aside, forgotten-- a machine of life, born from death.”\n\n“It is her femininity, her womb, her Future.”\n\n";

		public override bool IsLunar => (float)MaxCurseCfg != 0f;

		public override GameObject EquipmentModel => GestationItemPlugin.MainAssets.LoadAsset<GameObject>("Assets/Models/Prefabs/Equipment/GestationEquip/GestationPickup.prefab");

		public override Sprite EquipmentIcon => IsLunar ? GestationItemPlugin.MainAssets.LoadAsset<Sprite>("Assets/Textures/Icons/Equipment/GestationEquip/texGestationIconLunar.png") : GestationItemPlugin.MainAssets.LoadAsset<Sprite>("Assets/Textures/Icons/Equipment/GestationEquip/texGestationIconNormal.png");

		public override float Cooldown => (int)CooldownCfg;

		public override bool EnigmaCompatible => false;

		public override bool UseTargeting => true;

		public override TargetingType TargetingTypeEnum
		{
			get
			{
				if ((int)BossChildCount > 0)
				{
					return TargetingType.Monsters;
				}
				return TargetingType.NonBossMonsters;
			}
		}

		public override void Init(ConfigFile config)
		{
			CreateConfig(config);
			CreateLang();
			CreateEffect();
			CreateBuff();
			CreateTargetingIndicator();
			CreateEquipment();
			Hooks();
		}

		private void CreateConfig(ConfigFile config)
		{
			//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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Expected O, but got Unknown
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Expected O, but got Unknown
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Expected O, but got Unknown
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Expected O, but got Unknown
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Expected O, but got Unknown
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Expected O, but got Unknown
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Expected O, but got Unknown
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Expected O, but got Unknown
			//IL_0218: 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)
			//IL_0224: Unknown result type (might be due to invalid IL or missing references)
			//IL_0231: Expected O, but got Unknown
			//IL_022c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0236: Expected O, but got Unknown
			//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c2: Expected O, but got Unknown
			//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c7: Expected O, but got Unknown
			//IL_02fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0308: Expected O, but got Unknown
			//IL_0303: Unknown result type (might be due to invalid IL or missing references)
			//IL_030d: Expected O, but got Unknown
			//IL_0338: Unknown result type (might be due to invalid IL or missing references)
			//IL_033d: Unknown result type (might be due to invalid IL or missing references)
			//IL_033f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0344: Unknown result type (might be due to invalid IL or missing references)
			//IL_0350: Expected O, but got Unknown
			//IL_034b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0355: Expected O, but got Unknown
			//IL_038c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0396: Expected O, but got Unknown
			//IL_0391: Unknown result type (might be due to invalid IL or missing references)
			//IL_039b: Expected O, but got Unknown
			//IL_03d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e0: Expected O, but got Unknown
			//IL_03db: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e5: Expected O, but got Unknown
			CooldownCfg = config.ActiveBind(EquipmentName, "Equipment Cooldown", 45, "The time it takes until you can use " + EquipmentName + " again.");
			ModSettingsManager.AddOption((BaseOption)new IntSliderOption(CooldownCfg.Bind, new IntSliderConfig
			{
				min = 1,
				max = 240,
				restartRequired = true
			}));
			GestationTime = config.ActiveBind(EquipmentName, "Time to Gestate", 60, "How long it takes (in seconds) for the gestation to complete from initial activation.");
			ModSettingsManager.AddOption((BaseOption)new IntSliderOption(GestationTime.Bind, new IntSliderConfig
			{
				min = 1,
				max = 240
			}));
			ChildLifeTime = config.ActiveBind(EquipmentName, "Child Lifetime", 60, "The duration (in seconds) that the monster created from " + EquipmentName + " will stay alive for without any healing.");
			ModSettingsManager.AddOption((BaseOption)new IntSliderOption(ChildLifeTime.Bind, new IntSliderConfig
			{
				min = 1,
				max = 240
			}));
			MaxCurseCfg = config.ActiveBind(EquipmentName, "Maximum Penalty", 0.25f, "How much the character max health and speed will be reduced at maximum gestation for 1 monster. (0.0 is 0%, 1.0 is 100%)\nIf the value is set to 0, " + EquipmentName + " will become a regular orange equipment.");
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(MaxCurseCfg.Bind, new StepSliderConfig
			{
				min = 0f,
				max = 1f,
				increment = 0.01f,
				restartRequired = true
			}));
			MaxCurseCfg.Bind.SettingChanged += delegate
			{
				MaxCurseCfg.SetValue(Mathf.Clamp01((float)MaxCurseCfg));
				MaxCurseBase = Mathf.Clamp(1f - (float)MaxCurseCfg, 0.0001f, 1f);
			};
			MaxCurseCfg.SetValue(Mathf.Clamp01((float)MaxCurseCfg));
			MaxCurseBase = Mathf.Clamp(1f - (float)MaxCurseCfg, 0.0001f, 1f);
			BossChildCount = config.ActiveBind(EquipmentName, "Boss Penalty Mult", 2, "The penalty multiplier for gestating boss monsters. If set to 1, it will be equivalent to gestating a single non-boss monster. If set to 0, the " + EquipmentName + " will not be able to target boss monsters.");
			ModSettingsManager.AddOption((BaseOption)new IntSliderOption(BossChildCount.Bind, new IntSliderConfig
			{
				min = 0,
				max = 10
			}));
			BossChildCount.SetValue(Math.Max(0, BossChildCount));
			TargetMaxDistance = config.ActiveBind(EquipmentName, "Maximum equipment targeting distance", 30f, "How far you can target the monster to get impregnated with.");
			TargetMaxAngle = config.ActiveBind(EquipmentName, "Maximum equipment targeting angle", 16f, "How wide the equipment targeting angle is.");
			AllowSuperFetation = config.ActiveBind(EquipmentName, "Allow Superfetation", defaultValue: true, "If this is true, you can gestate multiple monsters at once by activating the equipment during gestation. However, doing this will change the gestation duration and increase the penalty per gestating monster.");
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(AllowSuperFetation.Bind, new CheckBoxConfig()));
			AllowItemInheritance = config.ActiveBind(EquipmentName, "Allow Item Inheritance", defaultValue: true, "If this is true, monster created from " + EquipmentName + " will inherit all your items.");
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(AllowItemInheritance.Bind, new CheckBoxConfig()));
			BlacklistCfg = config.ActiveBind(EquipmentName, "Item Blacklist", "", "Blacklist certain items from being inherited. To blacklist an item, enter the English item name (can be partial and capitalization is ignored). Set multiple items by separating them with |.\nExample: syringe|unstable tesla|chronobauble");
			ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(BlacklistCfg.Bind, new InputFieldConfig
			{
				submitOn = (SubmitEnum)6,
				restartRequired = true
			}));
			UseTeamMinionLimit = config.ActiveBind(EquipmentName, "Use Team Members Limit", defaultValue: true, "If this is true, " + EquipmentName + " will not spawn monster if it would exceed team members limit.");
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(UseTeamMinionLimit.Bind, new CheckBoxConfig()));
			if (BodyBlendCompatibility.enabled)
			{
				LimitOneChildSize = config.ActiveBind("(BodyBlend) " + EquipmentName, "Limit One Child Size", defaultValue: false, "If enabled, multiple children will only count as one when calculating size.\nDefault: false");
				ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(LimitOneChildSize.Bind, new CheckBoxConfig()));
			}
		}

		public override ItemDisplayRuleDict CreateItemDisplayRules()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			return new ItemDisplayRuleDict(Array.Empty<ItemDisplayRule>());
		}

		private void CreateBuff()
		{
			//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_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			BuffDef val = ScriptableObject.CreateInstance<BuffDef>();
			val.buffColor = new Color(0f, 1f, 1f);
			val.canStack = false;
			val.isDebuff = false;
			((Object)val).name = EquipmentName + ": Gestating";
			val.iconSprite = GestationItemPlugin.MainAssets.LoadAsset<Sprite>("Assets/Textures/Icons/Buffs/texGestatingIcon.png");
			GestationBuff = val;
			if (!ContentAddition.AddBuffDef(val))
			{
				Debug.Log((object)"GestationItem: unable to add Buff to buff catalouge");
			}
			val = ScriptableObject.CreateInstance<BuffDef>();
			val.buffColor = new Color(0f, 0.5f, 1f);
			val.canStack = false;
			val.isDebuff = false;
			((Object)val).name = EquipmentName + ": Gestated";
			val.iconSprite = GestationItemPlugin.MainAssets.LoadAsset<Sprite>("Assets/Textures/Icons/Buffs/texGestatedIcon.png");
			GestationCompleteBuff = val;
			if (!ContentAddition.AddBuffDef(val))
			{
				Debug.Log((object)"GestationItem: unable to add Buff to buff catalouge");
			}
		}

		private static void CreateEffect()
		{
			//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_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Expected O, but got Unknown
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Expected O, but got Unknown
			GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/OrbEffects/InfusionOrbEffect"), "GestationOrbEffect", false);
			ParticleSystem component = ((Component)val.transform.Find("VFX/Core")).gameObject.GetComponent<ParticleSystem>();
			ParticleSystem component2 = ((Component)val.transform.Find("VFX/PulseGlow")).gameObject.GetComponent<ParticleSystem>();
			TrailRenderer component3 = ((Component)val.transform.Find("TrailParent/Trail")).gameObject.GetComponent<TrailRenderer>();
			ColorOverLifetimeModule colorOverLifetime = component.colorOverLifetime;
			Gradient val2 = new Gradient();
			val2.SetKeys((GradientColorKey[])(object)new GradientColorKey[3]
			{
				new GradientColorKey(Color32.op_Implicit(new Color32((byte)219, (byte)146, byte.MaxValue, byte.MaxValue)), 0f),
				new GradientColorKey(Color32.op_Implicit(new Color32((byte)196, (byte)103, (byte)236, byte.MaxValue)), 0.674f),
				new GradientColorKey(Color32.op_Implicit(new Color32((byte)151, (byte)11, (byte)161, byte.MaxValue)), 1f)
			}, (GradientAlphaKey[])(object)new GradientAlphaKey[3]
			{
				new GradientAlphaKey(1f, 0f),
				new GradientAlphaKey(1f, 0.735f),
				new GradientAlphaKey(0f, 1f)
			});
			((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(val2);
			MainModule main = component2.main;
			((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(Color32.op_Implicit(new Color32((byte)24, (byte)0, (byte)12, byte.MaxValue)));
			Material val3 = new Material(((Renderer)component3).material);
			val3.SetTexture("_RemapTex", GestationItemPlugin.MainAssets.LoadAsset<Texture>("Assets/Textures/Materials/Items/GestationEquip/texRampGestation.png"));
			((Renderer)component3).material = val3;
			val.AddComponent<NetworkIdentity>();
			GestationOrbEffectPrefab = val;
			if (Object.op_Implicit((Object)(object)GestationOrbEffectPrefab))
			{
				PrefabAPI.RegisterNetworkPrefab(GestationOrbEffectPrefab);
				ContentAddition.AddEffect(GestationOrbEffectPrefab);
			}
		}

		private void CreateTargetingIndicator()
		{
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: 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_008e: Unknown result type (might be due to invalid IL or missing references)
			TargetingIndicatorPrefabBase = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/WoodSpriteIndicator"), "GestationTarget", false);
			SpriteRenderer componentInChildren = TargetingIndicatorPrefabBase.GetComponentInChildren<SpriteRenderer>();
			componentInChildren.sprite = GestationItemPlugin.MainAssets.LoadAsset<Sprite>("Assets/Textures/Icons/Equipment/GestationEquip/texGestationCrosshair.png");
			componentInChildren.color = Color32.op_Implicit(new Color32((byte)204, (byte)153, byte.MaxValue, byte.MaxValue));
			((Component)componentInChildren).transform.rotation = Quaternion.identity;
			((Graphic)TargetingIndicatorPrefabBase.GetComponentInChildren<TextMeshPro>()).color = new Color(0.423f, 1f, 0.749f);
		}

		public override void Hooks()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Expected O, but got Unknown
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Expected O, but got Unknown
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Expected O, but got Unknown
			EquipmentSlot.UpdateInventory += new hook_UpdateInventory(InstallGestationStore);
			CharacterBody.OnBuffFinalStackLost += new hook_OnBuffFinalStackLost(FinishGestation);
			if (BodyBlendCompatibility.enabled)
			{
				CharacterBody.Update += new hook_Update(UpdateBodyBlend);
			}
			if (UseTargeting && Object.op_Implicit((Object)(object)TargetingIndicatorPrefabBase))
			{
				EquipmentSlot.Update += new hook_Update(BeforeTargetingUpdate);
			}
			CharacterBody.RecalculateStats += new Manipulator(ILRecalculateStats);
		}

		protected override bool ActivateEquipment(EquipmentSlot slot)
		{
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)slot.characterBody) || !Object.op_Implicit((Object)(object)slot.characterBody.inputBank))
			{
				return false;
			}
			TargetingControllerComponent component = ((Component)slot).GetComponent<TargetingControllerComponent>();
			GestationStore component2 = ((Component)slot.characterBody).GetComponent<GestationStore>();
			if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.TargetObject))
			{
				CharacterBody characterBody = slot.characterBody;
				CharacterBody component3 = component.TargetObject.GetComponent<CharacterBody>();
				if (!Object.op_Implicit((Object)(object)component3))
				{
					return false;
				}
				int num = 1;
				if (component3.isChampion && (int)BossChildCount > 0)
				{
					num = BossChildCount;
				}
				if (!characterBody.HasBuff(GestationBuff.buffIndex) && !characterBody.HasBuff(GestationCompleteBuff.buffIndex))
				{
					characterBody.AddTimedBuff(GestationBuff, (float)(int)GestationTime);
					component2.AddEnemyPrefab(BodyCatalog.FindBodyPrefab(component3), num);
					CreateGestationOrb(component.TargetObject.transform.position, ((Component)characterBody.modelLocator.modelTransform).GetComponentInChildren<HurtBox>());
					StartStatsUpdate(characterBody);
					return true;
				}
				if ((bool)AllowSuperFetation && characterBody.HasBuff(GestationBuff.buffIndex) && !characterBody.HasBuff(GestationCompleteBuff.buffIndex))
				{
					int childCount = component2.ChildCount;
					float buffDuration = characterBody.GetBuffDuration(GestationBuff.buffIndex);
					if (MaxCurseCfg.GetValue() > 0f)
					{
						float num2 = CalculateRemainingDuration(childCount, childCount + num, buffDuration);
						characterBody.AddTimedBuff(GestationBuff, num2);
					}
					component2.AddEnemyPrefab(BodyCatalog.FindBodyPrefab(component3), num);
					CreateGestationOrb(component.TargetObject.transform.position, ((Component)characterBody.modelLocator.modelTransform).GetComponentInChildren<HurtBox>());
					return true;
				}
			}
			else if (slot.characterBody.HasBuff(GestationCompleteBuff))
			{
				SpawnChild(slot.inputBank, component2, slot.characterBody);
				slot.characterBody.RemoveBuff(GestationCompleteBuff);
				component2.ClearEnemyPrefabs();
				return true;
			}
			return false;
		}

		private static float CalculateRemainingDuration(int currChildCount, int nextChildCount, float currentDuration)
		{
			if (MaxCurseBase == 1f)
			{
				return (int)GestationTime;
			}
			float num = (Mathf.Pow(MaxCurseBase, (float)currChildCount) - 1f) / (Mathf.Pow(MaxCurseBase, (float)nextChildCount) - 1f);
			return (float)(int)GestationTime - num * ((float)(int)GestationTime - currentDuration);
		}

		private void CreateGestationOrb(Vector3 origin, HurtBox target)
		{
			//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)
			GestationOrb gestationOrb = new GestationOrb
			{
				origin = origin,
				target = target
			};
			((Orb)gestationOrb).Begin();
		}

		protected static bool SpawnChild(InputBankTest inputBank, GestationStore gestationStore, CharacterBody ownerBody)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			bool flag = false;
			bool flag2 = true;
			GameObject val = LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/TeleportOutCrystalBoom");
			EffectData val2 = new EffectData();
			Ray val3 = default(Ray);
			RaycastHit val6 = default(RaycastHit);
			foreach (GameObject enemyPrefab in gestationStore.EnemyPrefabs)
			{
				((Ray)(ref val3))..ctor(inputBank.aimOrigin, inputBank.aimDirection);
				float num = MaxSpawnDistance;
				if (!flag2)
				{
					Vector3 val4 = Random.insideUnitSphere * SpawnRadiusSpread;
					Vector3 direction = ((Ray)(ref val3)).direction;
					Vector3 val5 = val4 + ((Vector3)(ref direction)).normalized;
					((Ray)(ref val3)).direction = ((Vector3)(ref val5)).normalized;
					num += Random.Range(0f - SpawnDistanceSpread, SpawnDistanceSpread);
				}
				bool flag3 = Physics.Raycast(val3, ref val6, num, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1);
				Quaternion rotation = Quaternion.LookRotation(inputBank.aimDirection);
				Vector3 val7 = ((!flag3 || !Object.op_Implicit((Object)(object)((RaycastHit)(ref val6)).collider)) ? (((Ray)(ref val3)).origin + ((Ray)(ref val3)).direction * num) : (((RaycastHit)(ref val6)).point + ((RaycastHit)(ref val6)).normal * SurfaceHitOffset));
				if (flag2)
				{
					val2.origin = val7;
				}
				flag2 = false;
				bool flag4 = Utils.SpawnTempFrienemy(enemyPrefab, ownerBody, val7, rotation, ChildLifeTime, ChildScaling, AllowItemInheritance, !UseTeamMinionLimit);
				flag = flag || flag4;
			}
			if (flag && Object.op_Implicit((Object)(object)val) && val2 != null)
			{
				EffectManager.SpawnEffect(val, val2, true);
			}
			return flag;
		}

		private void BeforeTargetingUpdate(orig_Update orig, EquipmentSlot self)
		{
			//IL_000a: 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)
			orig.Invoke(self);
			if (self.equipmentIndex == EquipmentDef.equipmentIndex)
			{
				TargetingControllerComponent component = ((Component)self).GetComponent<TargetingControllerComponent>();
				if (Object.op_Implicit((Object)(object)component))
				{
					AdditionalTargetCondition = GetUseableCondition;
					component.AdditionalBullseyeSettings = ConfigureBullseyeFromConfig;
				}
			}
		}

		private static bool GetUseableCondition(EquipmentSlot slot)
		{
			return (!slot.characterBody.HasBuff(GestationBuff) || (bool)AllowSuperFetation) && !slot.characterBody.HasBuff(GestationCompleteBuff);
		}

		private static void ConfigureBullseyeFromConfig(BullseyeSearch bullseye)
		{
			bullseye.maxAngleFilter = TargetMaxAngle;
			bullseye.maxDistanceFilter = TargetMaxDistance;
		}

		protected void InstallGestationStore(orig_UpdateInventory orig, EquipmentSlot self)
		{
			//IL_000a: 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)
			orig.Invoke(self);
			if (self.equipmentIndex == EquipmentDef.equipmentIndex)
			{
				GestationStore component = ((Component)self.characterBody).GetComponent<GestationStore>();
				if (!Object.op_Implicit((Object)(object)component))
				{
					((Component)self.characterBody).gameObject.AddComponent<GestationStore>();
				}
			}
		}

		protected void FinishGestation(orig_OnBuffFinalStackLost orig, CharacterBody self, BuffDef buffDef)
		{
			if ((Object)(object)buffDef == (Object)(object)GestationBuff)
			{
				self.AddBuff(GestationCompleteBuff);
				StopStatsUpdate(self);
			}
			else if ((Object)(object)buffDef == (Object)(object)GestationCompleteBuff && BodyBlendCompatibility.enabled)
			{
				foreach (string part in BodyBlendCompatibility.GetParts())
				{
					self.RemoveBlend(part, EquipmentLangTokenName);
				}
			}
			orig.Invoke(self, buffDef);
		}

		protected void UpdateBodyBlend(orig_Update orig, CharacterBody self)
		{
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			if (!BodyBlendCompatibility.enabled)
			{
				return;
			}
			object obj;
			if (self == null)
			{
				obj = null;
			}
			else
			{
				ModelLocator modelLocator = self.modelLocator;
				if (modelLocator == null)
				{
					obj = null;
				}
				else
				{
					Transform modelTransform = modelLocator.modelTransform;
					obj = ((modelTransform != null) ? ((Component)modelTransform).gameObject : null);
				}
			}
			if ((Object)obj == (Object)null)
			{
				return;
			}
			GestationStore component = ((Component)self).GetComponent<GestationStore>();
			float mult = 0f;
			if (Object.op_Implicit((Object)(object)component))
			{
				int num = component.ChildCount;
				if (num > 0 && (bool)LimitOneChildSize)
				{
					num = 1;
				}
				mult = num;
			}
			if (self.HasBuff(GestationBuff))
			{
				float value = 1f - self.GetBuffDuration(GestationBuff.buffIndex) / (float)(int)GestationTime;
				SetBlendValues(self, value, mult, EquipmentLangTokenName);
			}
			else if (self.HasBuff(GestationCompleteBuff))
			{
				SetBlendValues(self, 1f, mult, EquipmentLangTokenName);
			}
			else
			{
				SetBlendValues(self, 0f, 0f, EquipmentLangTokenName);
			}
		}

		private static void SetBlendValues(CharacterBody body, float value, float mult, string token)
		{
			foreach (string part in BodyBlendCompatibility.GetParts())
			{
				float influence = BodyBlendCompatibility.GetInfluence(part);
				if (influence > 0.0001f)
				{
					body.SetBlendValue(part, value * influence * mult, token);
				}
				else
				{
					body.RemoveBlend(part, token);
				}
			}
		}

		private static void StartStatsUpdate(CharacterBody body)
		{
			PeriodicStatsRecalculator periodicStatsRecalculator = ((Component)body).gameObject.AddComponent<PeriodicStatsRecalculator>();
			periodicStatsRecalculator.body = body;
			periodicStatsRecalculator.StartStatsUpdate();
		}

		private static void StopStatsUpdate(CharacterBody body)
		{
			PeriodicStatsRecalculator component = ((Component)body).gameObject.GetComponent<PeriodicStatsRecalculator>();
			if (Object.op_Implicit((Object)(object)component))
			{
				Object.Destroy((Object)(object)component);
			}
		}

		internal static void ILRecalculateStats(ILContext il)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Expected O, but got Unknown
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			val.Emit(OpCodes.Ldarg_0);
			val.EmitDelegate<Action<CharacterBody>>((Action<CharacterBody>)delegate(CharacterBody body)
			{
				GetStatArgs(body, out StatArgs);
			});
			int locBaseSpeedIndex = -1;
			int locSpeedMultIndex = -1;
			int locSpeedDivIndex = -1;
			if (val.TryGotoNext(new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "baseMoveSpeed"),
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "levelMoveSpeed")
			}) && val.TryGotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref locBaseSpeedIndex)
			}) && val.TryGotoNext(new Func<Instruction, bool>[6]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, locBaseSpeedIndex),
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref locSpeedMultIndex),
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref locSpeedDivIndex),
				(Instruction x) => ILPatternMatchingExt.MatchDiv(x),
				(Instruction x) => ILPatternMatchingExt.MatchMul(x),
				(Instruction x) => ILPatternMatchingExt.MatchStloc(x, locBaseSpeedIndex)
			}))
			{
				val.GotoNext(new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchStloc(x, locBaseSpeedIndex)
				});
				val.EmitDelegate<Func<float, float>>((Func<float, float>)((float locBaseSpeed) => locBaseSpeed * StatArgs.speedMult));
			}
			int num = default(int);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[4]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "PermanentCurse"),
				(Instruction x) => ILPatternMatchingExt.MatchCall<CharacterBody>(x, "GetBuffCount"),
				(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref num)
			}))
			{
				val.Emit(OpCodes.Ldarg_0);
				val.EmitDelegate<Action<CharacterBody>>((Action<CharacterBody>)delegate(CharacterBody body)
				{
					body.cursePenalty *= StatArgs.curseMult;
				});
			}
		}

		private static void GetStatArgs(CharacterBody body, out StatHookArgs args)
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			args = new StatHookArgs();
			GestationStore component = ((Component)body).GetComponent<GestationStore>();
			if ((Object)(object)component != (Object)null)
			{
				args.childCount = component.ChildCount;
				if (body.HasBuff(GestationBuff))
				{
					args.progress = 1f - body.GetBuffDuration(GestationBuff.buffIndex) / (float)(int)GestationTime;
				}
				else if (body.HasBuff(GestationCompleteBuff))
				{
					args.progress = 1f;
				}
				args.progress = Mathf.Clamp01(args.progress);
				args.speedMult = GetSpeedMult(args);
				args.curseMult = GetCurseMult(args);
			}
		}

		private static float GetSpeedMult(StatHookArgs args)
		{
			return Mathf.Lerp(1f, Mathf.Pow(MaxCurseBase, (float)args.childCount), args.progress);
		}

		private static float GetCurseMult(StatHookArgs args)
		{
			float num = Mathf.Lerp(1f, Mathf.Pow(MaxCurseBase, (float)args.childCount), args.progress);
			return 1f / num;
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.Maiesen.FutureOfHeresy", "Future of Heresy", "0.3.1")]
	public class GestationItemPlugin : BaseUnityPlugin
	{
		public const string MODNAME = "Future of Heresy";

		public const string AUTHOR = "Maiesen";

		public const string GUID = "com.Maiesen.FutureOfHeresy";

		public const string VERSION = "0.3.1";

		internal static ManualLogSource Logger;

		public static AssetBundle MainAssets;

		internal static GestationItem GestationItemInstance;

		public void Start()
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Expected O, but got Unknown
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			Logger = ((BaseUnityPlugin)this).Logger;
			using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("GestationItem.gestation_item_assets"))
			{
				MainAssets = AssetBundle.LoadFromStream(stream);
			}
			ApplyShaders();
			Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false);
			using (MemoryStream memoryStream = new MemoryStream())
			{
				Assembly.GetExecutingAssembly().GetManifestResourceStream("GestationItem.icon.png").CopyTo(memoryStream);
				ImageConversion.LoadImage(val, memoryStream.ToArray());
			}
			Sprite modIcon = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).height, (float)((Texture)val).width), new Vector2(0.5f, 0.5f), 100f);
			ModSettingsManager.SetModIcon(modIcon);
			GestationItemInstance = new GestationItem();
			GestationItemInstance.Init(((BaseUnityPlugin)this).Config);
			GestationBuffIconHook.Hook();
			if (BodyBlendCompatibility.enabled)
			{
				BodyBlendCompatibility.HookBodyBlend(((BaseUnityPlugin)this).Config);
			}
		}

		public void Update()
		{
			ItemBlacklist.Init(((BaseUnityPlugin)this).Config);
			((Behaviour)this).enabled = false;
		}

		public static void ApplyShaders()
		{
			Material[] array = MainAssets.LoadAllAssets<Material>();
			Material[] array2 = array;
			foreach (Material val in array2)
			{
				if (((Object)val.shader).name.StartsWith("StubbedShader"))
				{
					val.shader = Resources.Load<Shader>("shaders" + ((Object)val.shader).name.Substring(13));
				}
			}
		}
	}
	internal class GestationOrb : Orb
	{
		public override void Begin()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Expected O, but got Unknown
			((Orb)this).duration = 1f;
			EffectData val = new EffectData
			{
				origin = base.origin,
				genericFloat = ((Orb)this).duration,
				scale = 1.5f
			};
			val.SetHurtBoxReference(base.target);
			EffectManager.SpawnEffect(GestationItem.GestationOrbEffectPrefab, val, true);
		}
	}
	internal class ItemBlacklist
	{
		public static List<ItemIndex> ItemIndices = new List<ItemIndex>();

		public static void Init(ConfigFile config)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			ItemCatalog.Init += new hook_Init(AfterItemCatalogInit);
		}

		private static void AfterItemCatalogInit(orig_Init orig)
		{
			orig.Invoke();
			UpdateItemBlacklist();
		}

		public static void UpdateItemBlacklist()
		{
			//IL_002d: 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_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Invalid comparison between Unknown and I4
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			string value = GestationItem.BlacklistCfg.GetValue();
			string[] array = value.Split(new char[1] { '|' });
			string[] array2 = array;
			foreach (string name in array2)
			{
				ItemIndex val = TryGetItemIndex(name);
				if ((int)val != -1)
				{
					ItemIndices.Add(val);
				}
			}
		}

		public static ItemIndex TryGetItemIndex(string name)
		{
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: 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_0073: Unknown result type (might be due to invalid IL or missing references)
			ItemDef[] itemDefs = ItemCatalog.itemDefs;
			foreach (ItemDef val in itemDefs)
			{
				string langInvar = GetLangInvar(val.nameToken.ToUpper());
				if (((Object)val).name.ToUpper().Contains(name.ToUpper()) || langInvar.ToUpper().Contains(name.ToUpper()) || langInvar.ToUpper().Contains(RemoveSpacesAndAlike(name.ToUpper())))
				{
					return val.itemIndex;
				}
			}
			return (ItemIndex)(-1);
		}

		public static string GetLangInvar(string baseToken)
		{
			return RemoveSpacesAndAlike(Language.GetString(baseToken, "en"));
		}

		public static string RemoveSpacesAndAlike(string input)
		{
			return Regex.Replace(input, "[ '-]", string.Empty);
		}
	}
	internal static class Utils
	{
		internal static float GetBuffDuration(this CharacterBody body, BuffIndex buffIndex)
		{
			//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)
			List<TimedBuff> timedBuffs = body.timedBuffs;
			if (timedBuffs == null)
			{
				return 0f;
			}
			if (timedBuffs.Count > 0)
			{
				return timedBuffs.Single((TimedBuff p) => p.buffIndex == buffIndex).timer;
			}
			return 0f;
		}

		internal static bool SpawnTempFrienemy(GameObject targetPrefab, CharacterBody ownerBody, Vector3 position, Quaternion rotation, int duration = 0, float scaling = 1f, bool copyOwnerInventory = false, bool ignoreTeamLimit = false)
		{
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Expected O, but got Unknown
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: 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)
			if (!NetworkServer.active)
			{
				return false;
			}
			if (!Object.op_Implicit((Object)(object)targetPrefab) || !Object.op_Implicit((Object)(object)ownerBody))
			{
				return false;
			}
			CharacterMaster val = MasterCatalog.allAiMasters.FirstOrDefault((Func<CharacterMaster, bool>)((CharacterMaster master) => (Object)(object)master.bodyPrefab == (Object)(object)targetPrefab));
			if (!Object.op_Implicit((Object)(object)val))
			{
				return false;
			}
			MasterSummon val2 = new MasterSummon();
			val2.masterPrefab = ((Component)val).gameObject;
			val2.ignoreTeamMemberLimit = ignoreTeamLimit;
			val2.position = position;
			val2.rotation = rotation;
			val2.summonerBodyObject = ((Component)ownerBody).gameObject;
			if (copyOwnerInventory)
			{
				val2.inventoryToCopy = ownerBody.inventory;
				val2.preSpawnSetupCallback = delegate(CharacterMaster master)
				{
					master.inventory.SetEquipmentIndex((EquipmentIndex)(-1));
					master.inventory.GiveItem(Items.HealthDecay, duration);
					master.inventory.ResetItems(ItemBlacklist.ItemIndices);
				};
			}
			val2.useAmbientLevel = true;
			CharacterMaster val3 = val2.Perform();
			if (!Object.op_Implicit((Object)(object)val3))
			{
				return false;
			}
			CharacterBody body = val3.GetBody();
			GameObject bodyObject = val3.GetBodyObject();
			if (Object.op_Implicit((Object)(object)body))
			{
				EntityStateMachine[] components = ((Component)body).GetComponents<EntityStateMachine>();
				foreach (EntityStateMachine val4 in components)
				{
					val4.initialStateType = val4.mainStateType;
				}
				Transform modelTransform = body.modelLocator.modelTransform;
				modelTransform.localScale *= scaling;
				Vector3 localPosition = body.modelLocator.modelTransform.localPosition;
			}
			return true;
		}

		public static void FilterGestateableMonsters(this BullseyeSearch search)
		{
			if (search.candidatesEnumerable.Any())
			{
				search.candidatesEnumerable = search.candidatesEnumerable.Where((CandidateInfo candidate) => true);
			}
		}

		internal static void ResetItems(this Inventory inv, List<ItemIndex> itemList)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: 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)
			foreach (ItemIndex item in itemList)
			{
				inv.ResetItem(item);
			}
		}
	}
}
namespace GestationItem.Hooks
{
	internal class GestationBuffIconHook
	{
		internal static HUD HUD;

		internal static void Hook()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			HUD.Awake += new hook_Awake(HUD_Awake);
			BuffIcon.Awake += new hook_Awake(BuffIcon_Awake);
			BuffIcon.UpdateIcon += new hook_UpdateIcon(BuffIcon_UpdateIcon);
		}

		internal static void HUD_Awake(orig_Awake orig, HUD self)
		{
			orig.Invoke(self);
			HUD = self;
		}

		internal static void BuffIcon_Awake(orig_Awake orig, BuffIcon self)
		{
			orig.Invoke(self);
			if (((Object)((Component)self).transform.parent).name == "BuffDisplayRoot")
			{
				CreateIconTextObject("GestationTimerText", self, (TextAlignmentOptions)1028);
				CreateIconTextObject("GestationCountText", self, (TextAlignmentOptions)1025);
			}
		}

		private static GameObject CreateIconTextObject(string name, BuffIcon icon, TextAlignmentOptions alignment = 1028)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//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)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name);
			RectTransform val2 = val.AddComponent<RectTransform>();
			HGTextMeshProUGUI val3 = val.AddComponent<HGTextMeshProUGUI>();
			val.transform.SetParent(((Component)icon).transform);
			((TMP_Text)val3).enableWordWrapping = false;
			((TMP_Text)val3).alignment = alignment;
			((TMP_Text)val3).fontSize = 23f;
			((TMP_Text)val3).faceColor = Color32.op_Implicit(Color.white);
			((TMP_Text)val3).text = "";
			((Transform)val2).localPosition = Vector3.zero;
			val2.anchorMin = new Vector2(1f, 0f);
			val2.anchorMax = new Vector2(1f, 0f);
			((Transform)val2).localScale = Vector3.one;
			val2.sizeDelta = new Vector2(48f, 48f);
			val2.anchoredPosition = new Vector2(-24f, 24f);
			return val;
		}

		internal static void BuffIcon_UpdateIcon(orig_UpdateIcon orig, BuffIcon self)
		{
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			if (!Object.op_Implicit((Object)(object)self.buffDef) || !(((Object)((Component)self).transform.parent).name == "BuffDisplayRoot"))
			{
				return;
			}
			HGTextMeshProUGUI component = ((Component)((Component)self).transform.Find("GestationTimerText")).GetComponent<HGTextMeshProUGUI>();
			HGTextMeshProUGUI component2 = ((Component)((Component)self).transform.Find("GestationCountText")).GetComponent<HGTextMeshProUGUI>();
			((TMP_Text)component).text = "";
			((TMP_Text)component2).text = "";
			if (((Object)(object)self.buffDef != (Object)(object)GestationItem.GestationBuff && (Object)(object)self.buffDef != (Object)(object)GestationItem.GestationCompleteBuff) || (Object)(object)component == (Object)null || (Object)(object)component2 == (Object)null || (Object)(object)HUD == (Object)null)
			{
				return;
			}
			CharacterBody val = (Object.op_Implicit((Object)(object)HUD.targetBodyObject) ? HUD.targetBodyObject.GetComponent<CharacterBody>() : null);
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			GestationItem.GestationStore component3 = ((Component)val).GetComponent<GestationItem.GestationStore>();
			if (!((Object)(object)component3 == (Object)null))
			{
				int count = component3.EnemyPrefabs.Count;
				if (val.HasBuff(GestationItem.GestationBuff))
				{
					float buffDuration = val.GetBuffDuration(GestationItem.GestationBuff.buffIndex);
					((TMP_Text)component).text = Mathf.Ceil(buffDuration).ToString("N0");
				}
				if (val.HasBuff(GestationItem.GestationBuff) || val.HasBuff(GestationItem.GestationCompleteBuff))
				{
					((TMP_Text)component2).text = $"{count}x";
				}
			}
		}
	}
}