Decompiled source of CotLMiniMods v1.2.3

plugins/CotlMiniMods/CotlMiniMods.dll

Decompiled 3 months 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 BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using COTL_API.CustomFollowerCommand;
using COTL_API.CustomInventory;
using COTL_API.CustomSettings;
using COTL_API.CustomStructures;
using COTL_API.CustomTarotCard;
using COTL_API.CustomTasks;
using COTL_API.Guid;
using COTL_API.Helpers;
using CotLMiniMods;
using CotLMiniMods.API;
using CotLMiniMods.CCommands.Tasks;
using CotLMiniMods.CustomFollowerCommands;
using CotLMiniMods.Helpers;
using CotLMiniMods.Interactions;
using CotLMiniMods.Items;
using CotLMiniMods.Meals;
using CotLMiniMods.Patches.Rituals;
using CotLMiniMods.Rituals;
using CotLMiniMods.Structures;
using CotLMiniMods.Structures.Mines;
using CotLMiniMods.Structures.Productivity;
using CotLMiniMods.Structures.Proxies;
using CotLMiniMods.Tarots;
using CotLTemplateMod.CustomFollowerCommands;
using DG.Tweening;
using DG.Tweening.Core;
using DG.Tweening.Plugins.Options;
using FMOD.Studio;
using HarmonyLib;
using I2.Loc;
using Lamb.UI;
using Lamb.UI.Assets;
using Lamb.UI.BuildMenu;
using Lamb.UI.FollowerInteractionWheel;
using Lamb.UI.FollowerSelect;
using Lamb.UI.Rituals;
using MMTools;
using Microsoft.CodeAnalysis;
using Spine;
using Spine.Unity;
using TMPro;
using UnityEngine;
using src.Extensions;
using src.UI;
using src.UI.InfoCards;
using src.UI.Menus;

[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("CotlMiniMods")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+81ce4f8cb3108cc204a68d53b11cc52cd7fdddcd")]
[assembly: AssemblyProduct("CotlMiniMods")]
[assembly: AssemblyTitle("CotlMiniMods")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace CotLTemplateMod.Patches
{
	[HarmonyPatch]
	internal class RelicResetPatch
	{
		public static RelicType temp;

		[HarmonyPatch(typeof(DataManager), "SetNewRun")]
		[HarmonyPrefix]
		public static void DataManager_SetNewRun(out RelicType __state)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Expected I4, but got Unknown
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			if (Plugin.relicNoReset.Value)
			{
				Plugin.Log.LogInfo((object)"GOT current relic (SINGLEPLAYER ONLY)");
				Plugin.Log.LogInfo((object)PlayerFarming.Instance.currentRelicType);
				__state = (RelicType)(int)PlayerFarming.Instance.currentRelicType;
				temp = PlayerFarming.Instance.currentRelicType;
			}
			else
			{
				__state = (RelicType)0;
			}
		}

		[HarmonyPatch(typeof(DataManager), "SetNewRun")]
		[HarmonyPostfix]
		public static void DataManager_SetNewRun_Post(RelicType __state)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Invalid comparison between Unknown and I4
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//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)
			if ((int)__state > 0)
			{
				Plugin.Log.LogInfo((object)"GOT old relic");
				Plugin.Log.LogInfo((object)__state);
				PlayerFarming.Instance.currentRelicType = __state;
				PlayerFarming.Instance.playerRelic.EquipRelic(EquipmentManager.GetRelicData(PlayerFarming.Instance.currentRelicType), false, false);
			}
		}

		[HarmonyPatch(typeof(PlayerFarming), "Awake")]
		[HarmonyPostfix]
		public static void DataManager_ResetRunData_Post()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Invalid comparison between Unknown and I4
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			Plugin.Log.LogInfo((object)"Forced Relic");
			Plugin.Log.LogInfo((object)temp);
			if ((int)temp > 0)
			{
				PlayerFarming.Instance.playerRelic.EquipRelic(EquipmentManager.GetRelicData(temp), false, false);
			}
		}
	}
}
namespace CotLTemplateMod.CustomFollowerCommands
{
	internal class EatWaiterTask : FollowerTask_EatMeal
	{
		public EatWaiterTask(int mealID)
			: base(mealID)
		{
		}

		public override Vector3 UpdateDestination(Follower follower)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			return follower.Brain.LastPosition;
		}

		public override void OnStart()
		{
			((FollowerTask)this).SetState((FollowerTaskState)4);
		}
	}
}
namespace CotLMiniMods
{
	internal class ConfigListener
	{
		public static void AddConfigEntries()
		{
			CustomSettingsManager.AddBepInExConfig("CotLMiniMods", "Enable Chef Job", Plugin.chefJob, (Action<bool>)null);
			CustomSettingsManager.AddBepInExConfig("CotLMiniMods", "Enable Waiter Job", Plugin.waiterJob, (Action<bool>)null);
			CustomSettingsManager.AddBepInExConfig("CotLMiniMods", "Enable Fisher Job", Plugin.fisherJob, (Action<bool>)null);
			CustomSettingsManager.AddBepInExConfig("CotLMiniMods", "Enable Reaper Job", Plugin.reaperJob, (Action<bool>)null);
			CustomSettingsManager.AddBepInExConfig("CotLMiniMods", "Enable Custom Food", Plugin.customFood, (Action<bool>)null);
			CustomSettingsManager.AddBepInExConfig("CotLMiniMods", "Enable Custom Rituals", Plugin.customRituals, (Action<bool>)null);
			CustomSettingsManager.AddBepInExConfig("CotLMiniMods", "Enable Custom Structures", Plugin.customStructures, (Action<bool>)null);
			CustomSettingsManager.AddBepInExConfig("CotLMiniMods", "Death Cat Repeat", Plugin.deathCatRepeat, (Action<bool>)null);
			CustomSettingsManager.AddBepInExConfig("CotLMiniMods", "Shrimp Chef Repeat", Plugin.shrimpChefRepeat, (Action<bool>)null);
			CustomSettingsManager.AddBepInExConfig("CotLMiniMods", "Player Eat unlimited", Plugin.playerEatMore, (Action<bool>)null);
			CustomSettingsManager.AddBepInExConfig("CotLMiniMods", "Kitchen Discount", Plugin.kitchenDiscount, (Action<bool>)null);
			CustomSettingsManager.AddBepInExConfig("CotLMiniMods", "Skip Splash", Plugin.skipSplash, (Action<bool>)null);
			CustomSettingsManager.AddBepInExConfig("CotLMiniMods", "One Click Shrine Collection", Plugin.oneClickShrineCollection, (Action<bool>)null);
		}
	}
	[BepInPlugin("InfernoDragon0.cotl.CotLChef", "CotLMiniMods", "1.2.3")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[HarmonyPatch]
	public class Plugin : BaseUnityPlugin
	{
		public const string PluginGuid = "InfernoDragon0.cotl.CotLChef";

		public const string PluginName = "CotLMiniMods";

		public const string PluginVer = "1.2.3";

		internal static ManualLogSource Log;

		internal static readonly Harmony Harmony = new Harmony("InfernoDragon0.cotl.CotLChef");

		internal static string PluginPath;

		internal static WaiterCommand waiterTask;

		internal static FisherCommand fisherTask;

		internal static DivorceCommand DivorceCommand;

		internal static FlipCoinCommand FlipCoinCommand;

		internal static KnucklebonesCommand KnucklebonesCommand;

		internal static BoneMineCommand BoneMineCommand;

		internal static SilkMineCommand SilkMineCommand;

		internal static CrystalMineCommand CrystalMineCommand;

		internal static HRManagementStructure HRManagementStructure;

		internal static CrystalMineStructure CrystalMineStructure;

		internal static BoneMineStructure BoneMineStructure;

		internal static SilkMineStructure SilkMineStructure;

		internal static WishingWellStructure WishingWellStructure;

		internal static WaiterDeskStructure WaiterDeskStructure;

		internal static ChefDeskStructure ChefDeskStructure;

		internal static Structures_LuckyNarinder Structures_LuckyNarinder;

		internal static Structures_StudyTable Structures_StudyTable;

		internal static Structures_Telescope Structures_Telescope;

		internal static Structures_AlchemyCauldron Structures_AlchemyCauldron;

		internal static Structures_EndlessPit Structures_EndlessPit;

		internal static Structures_RelicGenerator Structures_RelicGenerator;

		internal static ITEM_TYPE StrangeMaterialItem;

		internal static ITEM_TYPE StrangeEnergyItem;

		internal static ConfigEntry<bool> biggerShrine;

		internal static ConfigEntry<int> shrineSize;

		internal static ConfigEntry<bool> oneClickShrineCollection;

		internal static ConfigEntry<bool> skipSplash;

		internal static ConfigEntry<bool> kitchenDiscount;

		internal static ConfigEntry<bool> playerEatMore;

		internal static ConfigEntry<bool> deathCatRepeat;

		internal static ConfigEntry<bool> shrimpChefRepeat;

		internal static ConfigEntry<bool> chefJob;

		internal static ConfigEntry<bool> fisherJob;

		internal static ConfigEntry<bool> waiterJob;

		internal static ConfigEntry<bool> reaperJob;

		internal static ConfigEntry<bool> customFood;

		internal static ConfigEntry<bool> customStructures;

		internal static ConfigEntry<bool> customRituals;

		internal static ConfigEntry<bool> customTarots;

		internal static ConfigEntry<bool> telescopeGivesQuest;

		internal static ConfigEntry<bool> relicNoReset;

		internal static ConfigEntry<bool> NoExhaustMating;

		internal static bool SinnedToday = false;

		private void Awake()
		{
			//IL_02da: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_050e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0523: Unknown result type (might be due to invalid IL or missing references)
			//IL_052e: 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_0352: Unknown result type (might be due to invalid IL or missing references)
			//IL_0367: Unknown result type (might be due to invalid IL or missing references)
			//IL_037c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0391: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_040f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0424: Unknown result type (might be due to invalid IL or missing references)
			//IL_0439: Unknown result type (might be due to invalid IL or missing references)
			//IL_0444: Unknown result type (might be due to invalid IL or missing references)
			//IL_044f: Unknown result type (might be due to invalid IL or missing references)
			//IL_045a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0465: Unknown result type (might be due to invalid IL or missing references)
			//IL_0470: Unknown result type (might be due to invalid IL or missing references)
			//IL_047b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0486: Unknown result type (might be due to invalid IL or missing references)
			//IL_049b: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04df: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_054a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0555: Unknown result type (might be due to invalid IL or missing references)
			//IL_0560: Unknown result type (might be due to invalid IL or missing references)
			//IL_056b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0576: Unknown result type (might be due to invalid IL or missing references)
			//IL_0581: Unknown result type (might be due to invalid IL or missing references)
			//IL_058c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0597: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_05cf: Unknown result type (might be due to invalid IL or missing references)
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded CotLMiniMods!");
			Log = ((BaseUnityPlugin)this).Logger;
			PluginPath = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
			biggerShrine = ((BaseUnityPlugin)this).Config.Bind<bool>("", "biggerShrine", true, "Increases max capacity of shrine");
			shrineSize = ((BaseUnityPlugin)this).Config.Bind<int>("", "shrineSize", 2000, "Max capacity of shrine");
			oneClickShrineCollection = ((BaseUnityPlugin)this).Config.Bind<bool>("", "oneClickShrineCollection", true, "Instantly collect all souls in one click from shrine");
			skipSplash = ((BaseUnityPlugin)this).Config.Bind<bool>("", "skipSplash", true, "Skips the splash screen");
			kitchenDiscount = ((BaseUnityPlugin)this).Config.Bind<bool>("", "kitchenDiscount", true, "Enables a 50% food discount on Kitchen 1");
			playerEatMore = ((BaseUnityPlugin)this).Config.Bind<bool>("", "playerEatMore", true, "Allows you to eat as many times as you want per day.");
			deathCatRepeat = ((BaseUnityPlugin)this).Config.Bind<bool>("", "deathCatRepeat", false, "Allows you to re-challenge The one who waits as many times as you want.");
			shrimpChefRepeat = ((BaseUnityPlugin)this).Config.Bind<bool>("", "shrimpChefRepeat", false, "Allows you to re-challenge Chef Rakshasa as many times as you want.");
			chefJob = ((BaseUnityPlugin)this).Config.Bind<bool>("", "chefJob", true, "Allows followers to take on the chef role.");
			fisherJob = ((BaseUnityPlugin)this).Config.Bind<bool>("", "fisherJob", true, "Allows you to command followers to fish (different loot table).");
			waiterJob = ((BaseUnityPlugin)this).Config.Bind<bool>("", "waiterJob", true, "Allows followers to take on the waiter role. If you enable this, followers will not walk towards food, but wait for someone to serve.");
			reaperJob = ((BaseUnityPlugin)this).Config.Bind<bool>("", "reaperJob", true, "Allows followers to bury other followers in an Endless Pit.");
			customFood = ((BaseUnityPlugin)this).Config.Bind<bool>("", "customFood", false, "Adds custom food (partial implementation, not ready yet).");
			customStructures = ((BaseUnityPlugin)this).Config.Bind<bool>("", "customStructures", true, "Adds Custom Structures.");
			customRituals = ((BaseUnityPlugin)this).Config.Bind<bool>("", "customRituals", true, "Adds Custom Rituals.");
			customTarots = ((BaseUnityPlugin)this).Config.Bind<bool>("", "customTarots", true, "Adds Custom Tarots.");
			telescopeGivesQuest = ((BaseUnityPlugin)this).Config.Bind<bool>("", "telescopeGivesQuest", true, "Set to true if the telescope should give quests in the morning. False will provide Strange Material at a lower rate in the day.");
			relicNoReset = ((BaseUnityPlugin)this).Config.Bind<bool>("", "relicNoReset", true, "Set to true for the Relic Infuser to work, and getting to keep relics after runs.");
			NoExhaustMating = ((BaseUnityPlugin)this).Config.Bind<bool>("", "NoExhaustMating", true, "Set to true to allow mating without exhausting the follower.");
			ConfigListener.AddConfigEntries();
			TimeManager.OnNewDayStarted = (Action)Delegate.Combine(TimeManager.OnNewDayStarted, new Action(OnNewDayStarted));
			if (waiterJob.Value)
			{
				waiterTask = new WaiterCommand();
				CustomFollowerCommandManager.Add((CustomFollowerCommand)(object)waiterTask);
			}
			if (fisherJob.Value)
			{
				fisherTask = new FisherCommand();
				CustomFollowerCommandManager.Add((CustomFollowerCommand)(object)fisherTask);
			}
			if (customFood.Value)
			{
				CustomMealManager.AddAll();
			}
			if (customStructures.Value)
			{
				HRManagementStructure = new HRManagementStructure();
				CustomStructureManager.Add((CustomStructure)(object)HRManagementStructure);
				CrystalMineStructure = new CrystalMineStructure();
				CustomStructureManager.Add((CustomStructure)(object)CrystalMineStructure);
				WishingWellStructure = new WishingWellStructure();
				CustomStructureManager.Add((CustomStructure)(object)WishingWellStructure);
				BoneMineStructure = new BoneMineStructure();
				CustomStructureManager.Add((CustomStructure)(object)BoneMineStructure);
				SilkMineStructure = new SilkMineStructure();
				CustomStructureManager.Add((CustomStructure)(object)SilkMineStructure);
				WaiterDeskStructure = new WaiterDeskStructure();
				CustomStructureManager.Add((CustomStructure)(object)WaiterDeskStructure);
				ChefDeskStructure = new ChefDeskStructure();
				CustomStructureManager.Add((CustomStructure)(object)ChefDeskStructure);
				Structures_LuckyNarinder = new Structures_LuckyNarinder();
				CustomStructureManager.Add((CustomStructure)(object)Structures_LuckyNarinder);
				Structures_StudyTable = new Structures_StudyTable();
				CustomStructureManager.Add((CustomStructure)(object)Structures_StudyTable);
				Structures_Telescope = new Structures_Telescope();
				CustomStructureManager.Add((CustomStructure)(object)Structures_Telescope);
				Structures_AlchemyCauldron = new Structures_AlchemyCauldron();
				CustomStructureManager.Add((CustomStructure)(object)Structures_AlchemyCauldron);
				Structures_EndlessPit = new Structures_EndlessPit();
				CustomStructureManager.Add((CustomStructure)(object)Structures_EndlessPit);
				Structures_RelicGenerator = new Structures_RelicGenerator();
				CustomStructureManager.Add((CustomStructure)(object)Structures_RelicGenerator);
				CustomStructureManager.Add((CustomStructure)(object)new Structures_StrangeGenerator());
				CustomStructureManager.Add((CustomStructure)(object)new Structures_EnergyController());
				CustomStructureManager.Add((CustomStructure)(object)new Structures_StasisChamber());
				CustomStructureManager.Add((CustomStructure)(object)new Structures_AIOQuarry());
				CustomStructureManager.Add((CustomStructure)(object)new Structures_AIOFarmer());
				CustomStructureManager.Add((CustomStructure)(object)new Structures_GiftTree());
				CustomStructureManager.Add((CustomStructure)(object)new Structures_Boutique());
				BoneMineCommand = new BoneMineCommand();
				CustomFollowerCommandManager.Add((CustomFollowerCommand)(object)BoneMineCommand);
				SilkMineCommand = new SilkMineCommand();
				CustomFollowerCommandManager.Add((CustomFollowerCommand)(object)SilkMineCommand);
				CrystalMineCommand = new CrystalMineCommand();
				CustomFollowerCommandManager.Add((CustomFollowerCommand)(object)CrystalMineCommand);
				StrangeMaterialItem = CustomItemManager.Add((CustomInventoryItem)(object)new StrangeMaterialItem());
				StrangeEnergyItem = CustomItemManager.Add((CustomInventoryItem)(object)new StrangeEnergyItem());
			}
			DivorceCommand = new DivorceCommand();
			CustomFollowerCommandManager.Add((CustomFollowerCommand)(object)DivorceCommand);
			FlipCoinCommand = new FlipCoinCommand();
			CustomFollowerCommandManager.Add((CustomFollowerCommand)(object)FlipCoinCommand);
			KnucklebonesCommand = new KnucklebonesCommand();
			CustomFollowerCommandManager.Add((CustomFollowerCommand)(object)KnucklebonesCommand);
			CustomFollowerCommandManager.Add((CustomFollowerCommand)(object)new Command_ForIHaveSinned());
			if (customRituals.Value)
			{
				CustomRitualManager.Add(new DistributionRitual());
				CustomRitualManager.Add(new RitualFrenzyRitual());
				CustomRitualManager.Add(new FusionRitual());
				CustomRitualManager.Add(new YouthRitual());
				CustomRitualManager.Add(new ReversalRitual());
				CustomRitualManager.Add(new MistletoeRitual());
				CustomRitualManager.Add(new MassResurrectionRitual());
				CustomRitualManager.Add(new ExiledRitual());
				CustomRitualManager.Add(new MassacreRitual());
			}
			if (customTarots.Value)
			{
				Log.LogInfo((object)"Added tarots");
				CustomTarotCardManager.Add((CustomTarotCard)(object)new Tarot_StrangeExtraction());
			}
		}

		private void OnNewDayStarted()
		{
			SinnedToday = false;
			Log.LogInfo((object)"You can now sin again.");
		}

		private void OnEnable()
		{
			Harmony.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded CotLMiniMods!");
		}

		private void OnDisable()
		{
			Harmony.UnpatchSelf();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Unloaded CotLMiniMods!");
		}
	}
}
namespace CotLMiniMods.Tarots
{
	public class Tarot_StrangeExtraction : CustomTarotCard
	{
		public override string InternalName => "STRANGE_EXTRACTION";

		public override string Skin => "Trinkets/Sun";

		public override string LocalisedName(int upgradeIndex)
		{
			return "<color=\"red\">Strange Extraction</color>";
		}

		public override string LocalisedLore()
		{
			return "Our enemies.. <color=\"yellow\">they possess it..</color>";
		}

		public override string LocalisedDescription(int upgradeIndex)
		{
			return "When an enemy dies, they are converted into <color=\"red\">Strange Material</color>.";
		}

		public override InventoryItem GetItemToDrop(TarotCard card)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			return new InventoryItem(Plugin.StrangeMaterialItem);
		}
	}
}
namespace CotLMiniMods.Structures
{
	internal class CustomEnergyStructure : CustomStructure, IEnergyProvider
	{
		public int currentEnergy = 0;

		public int maxEnergy = 1000;

		public int regenRate = 0;

		public override string InternalName => "Custom_Energy_Structure";

		public override Sprite Sprite => TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/endlesspit.png"));

		public override int BuildDurationMinutes => 30;

		public int EnergyCurrent
		{
			get
			{
				return currentEnergy;
			}
			set
			{
				currentEnergy = value;
			}
		}

		public virtual int EnergyMax
		{
			get
			{
				return maxEnergy;
			}
			set
			{
				maxEnergy = value;
			}
		}

		public virtual int EnergyRegenRate
		{
			get
			{
				return 1;
			}
			set
			{
				regenRate = value;
			}
		}

		public virtual bool CanAdd => false;

		public virtual bool CanRemove => true;

		public virtual bool WorksAtNight => true;

		public virtual bool WorksAtDay => true;

		public override string GetLocalizedName()
		{
			return "Custom Energy Structure";
		}

		public override string GetLocalizedDescription()
		{
			return "Structure that uses or generates Strange Energy";
		}

		public int AddEnergy(int amount)
		{
			int result = 0;
			if (amount < 0)
			{
				return result;
			}
			if (EnergyCurrent + amount >= EnergyMax)
			{
				result = EnergyMax - EnergyCurrent;
				EnergyCurrent = EnergyMax;
			}
			else
			{
				EnergyCurrent += amount;
				result = amount;
			}
			return result;
		}

		public int RemoveEnergy(int amount)
		{
			int result = 0;
			if (amount < 0)
			{
				return result;
			}
			if (EnergyCurrent - amount <= 0)
			{
				result = EnergyCurrent;
				EnergyCurrent = 0;
			}
			else
			{
				result = amount;
				EnergyCurrent -= amount;
			}
			return result;
		}
	}
	internal class Structures_EndlessPit : CustomEnergyStructure, ITaskProvider
	{
		public int energyPerFollower = 1;

		public override string InternalName => "Structures_EndlessPit";

		public override Sprite Sprite => TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/endlesspit.png"));

		public override int BuildDurationMinutes => 30;

		public override List<ItemCost> Cost => new List<ItemCost>
		{
			new ItemCost((ITEM_TYPE)20, 20),
			new ItemCost(Plugin.StrangeMaterialItem, 10)
		};

		public override Category Category => (Category)0;

		public override Categories StructureCategories => (Categories)13;

		public override int EnergyRegenRate
		{
			get
			{
				return ((StructureBrain)this).Data.Inventory.Count * energyPerFollower;
			}
			set
			{
				energyPerFollower = value;
			}
		}

		public override bool CanAdd => false;

		public override bool CanRemove => true;

		public override bool WorksAtNight => true;

		public override bool WorksAtDay => true;

		public override string GetLocalizedName()
		{
			return "Endless Pit of Gluttony";
		}

		public override string GetLocalizedDescription()
		{
			return "A pit that emits Strange Energy from dead followers. Max 10000 Energy Stored";
		}

		public override void OnAdded()
		{
			TimeManager.OnNewPhaseStarted = (Action)Delegate.Combine(TimeManager.OnNewPhaseStarted, new Action(((StructureBrain)this).OnNewPhaseStarted));
			EnergyMax = 10000;
		}

		public override void OnRemoved()
		{
			TimeManager.OnNewPhaseStarted = (Action)Delegate.Remove(TimeManager.OnNewPhaseStarted, new Action(((StructureBrain)this).OnNewPhaseStarted));
		}

		public override void OnNewPhaseStarted()
		{
			Plugin.Log.LogInfo((object)"Add more energy");
			AddEnergy(EnergyRegenRate);
		}

		public void GetAvailableTasks(ScheduledActivity activity, SortedList<float, FollowerTask> sortedTasks)
		{
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			int num = 0;
			foreach (Structures_DeadWorshipper item in StructureManager.GetAllStructuresOfType<Structures_DeadWorshipper>((FollowerLocation)1))
			{
				if (!((StructureBrain)item).Data.Rotten && !((StructureBrain)item).ReservedForTask)
				{
					num++;
				}
			}
			if ((int)activity == 0 && !((StructureBrain)this).ReservedForTask && num != 0 && Plugin.reaperJob.Value)
			{
				FollowerTask_Reaper followerTask_Reaper = new FollowerTask_Reaper(((StructureBrain)this).Data.ID);
				sortedTasks.Add(((FollowerTask)followerTask_Reaper).Priorty, (FollowerTask)(object)followerTask_Reaper);
			}
		}

		public FollowerTask GetOverrideTask(FollowerBrain brain)
		{
			throw new NotImplementedException();
		}

		public bool CheckOverrideComplete()
		{
			return true;
		}
	}
	internal class Structures_StrangeGenerator : CustomEnergyStructure
	{
		public int energyPerFollower = 1;

		public override string InternalName => "Structures_StrangeGenerator";

		public override Sprite Sprite => TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/generator.png"));

		public override int BuildDurationMinutes => 30;

		public override List<ItemCost> Cost => new List<ItemCost>
		{
			new ItemCost((ITEM_TYPE)20, 200),
			new ItemCost(Plugin.StrangeMaterialItem, 3)
		};

		public override Category Category => (Category)0;

		public override Categories StructureCategories => (Categories)13;

		public override int EnergyRegenRate
		{
			get
			{
				return 1000;
			}
			set
			{
				energyPerFollower = value;
			}
		}

		public override bool CanAdd => false;

		public override bool CanRemove => true;

		public override bool WorksAtNight => true;

		public override bool WorksAtDay => true;

		public override string GetLocalizedName()
		{
			return "Strange Generator";
		}

		public override string GetLocalizedDescription()
		{
			return "A machine that converts Strange Material to Strange Energy on demand. Max 10000 Energy Stored.";
		}

		public override void OnAdded()
		{
			((StructureBrain)this).OnAdded();
			EnergyMax = 10000;
		}
	}
	internal class FridgeStructure : CustomStructure
	{
		public override string InternalName => "Fridge_Structure";

		public override Sprite Sprite => TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/cotlpc.png"));
	}
	internal class HRManagementStructure : CustomStructure
	{
		public override string InternalName => "HR_Management";

		public override Sprite Sprite => TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/cotlpc.png"));

		public override int BuildDurationMinutes => 30;

		public override List<ItemCost> Cost => new List<ItemCost>
		{
			new ItemCost((ITEM_TYPE)20, 30)
		};

		public override Category Category => (Category)0;

		public override Categories StructureCategories => (Categories)13;

		public override string GetLocalizedName()
		{
			return "Follower Manager";
		}

		public override string GetLocalizedDescription()
		{
			return "A modern device to manage your followers remotely.";
		}

		public override void OnAdded()
		{
			((StructureBrain)this).OnAdded();
		}
	}
	internal class Structures_AlchemyCauldron : CustomStructure
	{
		public ITEM_TYPE SelectedCookItem = (ITEM_TYPE)45;

		public override string InternalName => "Structures_AlchemyCauldron";

		public override Sprite Sprite => TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/cauldron.png"));

		public override int BuildDurationMinutes => 30;

		public override List<ItemCost> Cost => new List<ItemCost>
		{
			new ItemCost((ITEM_TYPE)20, 750),
			new ItemCost(Plugin.StrangeMaterialItem, 25)
		};

		public List<ITEM_TYPE> CookItems => new List<ITEM_TYPE>
		{
			(ITEM_TYPE)45,
			(ITEM_TYPE)46,
			(ITEM_TYPE)47,
			(ITEM_TYPE)48,
			(ITEM_TYPE)49,
			(ITEM_TYPE)124,
			(ITEM_TYPE)123,
			(ITEM_TYPE)127,
			(ITEM_TYPE)125,
			(ITEM_TYPE)122,
			(ITEM_TYPE)126
		};

		public override Category Category => (Category)0;

		public override Categories StructureCategories => (Categories)13;

		public override string GetLocalizedName()
		{
			return "Alchemy Cauldron";
		}

		public override string GetLocalizedDescription()
		{
			return "A Cauldron that allows you to fabricate necklaces using the power of Strange Materials.";
		}

		public override void OnAdded()
		{
			((StructureBrain)this).OnAdded();
		}
	}
	internal class Structures_AugmentTable : CustomStructure
	{
		public override string InternalName => "Structures_AugmentTable";

		public override Sprite Sprite => TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/cauldron.png"));

		public override int BuildDurationMinutes => 30;

		public override List<ItemCost> Cost => new List<ItemCost>
		{
			new ItemCost((ITEM_TYPE)20, 500),
			new ItemCost(Plugin.StrangeMaterialItem, 8)
		};

		public override Category Category => (Category)0;

		public override Categories StructureCategories => (Categories)13;

		public override string GetLocalizedName()
		{
			return "Augment Table";
		}

		public override string GetLocalizedDescription()
		{
			return "A machine that helps infuse The Lamb with Strange Material.";
		}

		public override void OnAdded()
		{
			((StructureBrain)this).OnAdded();
		}
	}
	internal class Structures_EnergyController : CustomEnergyStructure
	{
		public int energyPerPhase = 0;

		public bool timeFrozen = false;

		public override string InternalName => "Structures_EnergyController";

		public override Sprite Sprite => TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/wireless.png"));

		public override int BuildDurationMinutes => 30;

		public override List<ItemCost> Cost => new List<ItemCost>
		{
			new ItemCost((ITEM_TYPE)20, 1000),
			new ItemCost(Plugin.StrangeMaterialItem, 25)
		};

		public override Category Category => (Category)0;

		public override Categories StructureCategories => (Categories)13;

		public override int EnergyRegenRate => 0;

		public override bool CanAdd => true;

		public override bool CanRemove => true;

		public override bool WorksAtNight => true;

		public override bool WorksAtDay => true;

		public override string GetLocalizedName()
		{
			return "Energy Controller";
		}

		public override string GetLocalizedDescription()
		{
			return "A device that collects and transfers Strange Energy. Stores up to 10000 Strange Energy";
		}

		public override void OnAdded()
		{
			((StructureBrain)this).OnAdded();
			EnergyMax = 10000;
			TimeManager.OnNewPhaseStarted = (Action)Delegate.Combine(TimeManager.OnNewPhaseStarted, new Action(((StructureBrain)this).OnNewPhaseStarted));
		}

		public override void OnRemoved()
		{
			TimeManager.OnNewPhaseStarted = (Action)Delegate.Remove(TimeManager.OnNewPhaseStarted, new Action(((StructureBrain)this).OnNewPhaseStarted));
		}

		public override void OnNewPhaseStarted()
		{
			Plugin.Log.LogInfo((object)"Collecting energy..");
			foreach (StructureBrain item in StructureManager.StructuresAtLocation((FollowerLocation)1))
			{
				if (!(item is Structures_EnergyController) && item is CustomEnergyStructure customEnergyStructure && customEnergyStructure.CanRemove)
				{
					Plugin.Log.LogInfo((object)("Found energy structure: " + ((CustomStructure)customEnergyStructure).InternalName + " with " + customEnergyStructure.EnergyCurrent + " energy"));
					int amount = ((customEnergyStructure.EnergyCurrent + base.EnergyCurrent < customEnergyStructure.EnergyMax) ? customEnergyStructure.EnergyCurrent : (EnergyMax - base.EnergyCurrent));
					Plugin.Log.LogInfo((object)("Before adding, this structure has " + base.EnergyCurrent + " energy"));
					AddEnergy(amount);
					customEnergyStructure.RemoveEnergy(amount);
					Plugin.Log.LogInfo((object)("Now this structure has " + base.EnergyCurrent + " energy"));
				}
			}
			Plugin.Log.LogInfo((object)"Distributing Energy..");
			foreach (StructureBrain item2 in StructureManager.StructuresAtLocation((FollowerLocation)1))
			{
				if (!(item2 is Structures_EnergyController) && item2 is CustomEnergyStructure customEnergyStructure2 && customEnergyStructure2.CanAdd)
				{
					Plugin.Log.LogInfo((object)("Found to add structure: " + ((CustomStructure)customEnergyStructure2).InternalName + " with " + customEnergyStructure2.EnergyCurrent + " energy"));
					int amount2 = ((customEnergyStructure2.EnergyCurrent + base.EnergyCurrent < EnergyMax) ? base.EnergyCurrent : (EnergyMax - base.EnergyCurrent));
					Plugin.Log.LogInfo((object)("Before removing, that structure has " + customEnergyStructure2.EnergyCurrent + " energy"));
					RemoveEnergy(amount2);
					customEnergyStructure2.AddEnergy(amount2);
					Plugin.Log.LogInfo((object)("Now that structure has " + customEnergyStructure2.EnergyCurrent + " energy"));
					Plugin.Log.LogInfo((object)("Now this structure has " + base.EnergyCurrent + " energy"));
				}
			}
		}
	}
	internal class Structures_StasisChamber : CustomEnergyStructure
	{
		public int energyPerPhase = 50;

		public bool timeFrozen = false;

		public override string InternalName => "Structures_StasisChamber";

		public override Sprite Sprite => TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/stasis.png"));

		public override int BuildDurationMinutes => 30;

		public override List<ItemCost> Cost => new List<ItemCost>
		{
			new ItemCost((ITEM_TYPE)20, 150),
			new ItemCost(Plugin.StrangeMaterialItem, 10)
		};

		public override Category Category => (Category)0;

		public override Categories StructureCategories => (Categories)13;

		public override int EnergyRegenRate => 0;

		public override bool CanAdd => true;

		public override bool CanRemove => false;

		public override bool WorksAtNight => true;

		public override bool WorksAtDay => true;

		public override string GetLocalizedName()
		{
			return "Stasis Chamber";
		}

		public override string GetLocalizedDescription()
		{
			return "An exotic machine that uses Strange Material to freeze time.";
		}

		public override void OnAdded()
		{
			((StructureBrain)this).OnAdded();
			EnergyMax = 1000;
		}
	}
	internal class SprinklerStructure : CustomStructure
	{
		public override string InternalName => "Sprinkler_Structure";

		public override Sprite Sprite => TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/cotlpc.png"));
	}
	internal class Structures_RelicGenerator : CustomStructure
	{
		public override string InternalName => "Structures_RelicGenerator";

		public override Sprite Sprite => TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/Icon_Pond.png"));

		public override int BuildDurationMinutes => 30;

		public override List<ItemCost> Cost => new List<ItemCost>
		{
			new ItemCost((ITEM_TYPE)20, 250),
			new ItemCost(Plugin.StrangeMaterialItem, 5)
		};

		public override Category Category => (Category)0;

		public override Categories StructureCategories => (Categories)13;

		public override string GetLocalizedName()
		{
			return "Relic Infuser";
		}

		public override string GetLocalizedDescription()
		{
			return "Infuse Strange Material into the Lamb to bond with a Relic. If the relic is dropped, it will transform back after your next encounter.";
		}
	}
	internal class WishingWellStructure : CustomStructure
	{
		public override string InternalName => "Wishing_Well";

		public override Sprite Sprite => TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/Icon_Pond.png"));

		public override int BuildDurationMinutes => 30;

		public override List<ItemCost> Cost => new List<ItemCost>
		{
			new ItemCost((ITEM_TYPE)20, 50),
			new ItemCost((ITEM_TYPE)86, 5)
		};

		public override Category Category => (Category)0;

		public override Categories StructureCategories => (Categories)13;

		public override string GetLocalizedName()
		{
			return "Wishing Well";
		}

		public override string GetLocalizedDescription()
		{
			return "Give Coins. Get blessed.";
		}
	}
}
namespace CotLMiniMods.Structures.Proxies
{
	internal class ChefDeskStructure : CustomStructure, ITaskProvider
	{
		public ITEM_TYPE SelectedCookItem = (ITEM_TYPE)57;

		public override string InternalName => "Chef_Desk_Structure";

		public override Sprite Sprite => TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/chefdesk.png"));

		public override int BuildDurationMinutes => 30;

		public override List<ItemCost> Cost => new List<ItemCost>
		{
			new ItemCost((ITEM_TYPE)20, 10),
			new ItemCost((ITEM_TYPE)35, 5),
			new ItemCost((ITEM_TYPE)1, 10)
		};

		public List<ITEM_TYPE> CookItems => new List<ITEM_TYPE>
		{
			(ITEM_TYPE)57,
			(ITEM_TYPE)69,
			(ITEM_TYPE)100,
			(ITEM_TYPE)112,
			(ITEM_TYPE)108,
			(ITEM_TYPE)106,
			(ITEM_TYPE)58,
			(ITEM_TYPE)80,
			(ITEM_TYPE)109,
			(ITEM_TYPE)107
		};

		public override string GetLocalizedName()
		{
			return "Sous Chef Desk";
		}

		public override string GetLocalizedDescription()
		{
			return "A Desk for the Sous Chef to create Signature Dishes.";
		}

		public bool CheckOverrideComplete()
		{
			return true;
		}

		public void GetAvailableTasks(ScheduledActivity activity, SortedList<float, FollowerTask> sortedTasks)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			if ((int)activity == 0 && !((StructureBrain)this).ReservedForTask)
			{
				if (Interaction_FollowerKitchen.FollowerKitchens.Count > 0 && ((Interaction_Kitchen)Interaction_FollowerKitchen.FollowerKitchens[0]).StructureInfo.QueuedMeals.Count > 0)
				{
					FollowerTask_CookCustom followerTask_CookCustom = new FollowerTask_CookCustom(((StructureBrain)this).Data.ID);
					sortedTasks.Add(((FollowerTask)followerTask_CookCustom).Priorty, (FollowerTask)(object)followerTask_CookCustom);
				}
				if (FollowerManager.GetHungriestFollowerBrain().GetHungerScore() > 0f)
				{
					Debug.Log((object)("Someone is hungry at " + FollowerManager.GetHungriestFollowerBrain().GetHungerScore()));
					FollowerTask_CookCustom followerTask_CookCustom2 = new FollowerTask_CookCustom(((StructureBrain)this).Data.ID);
					sortedTasks.Add(((FollowerTask)followerTask_CookCustom2).Priorty, (FollowerTask)(object)followerTask_CookCustom2);
				}
			}
		}

		public FollowerTask GetOverrideTask(FollowerBrain brain)
		{
			throw new NotImplementedException();
		}
	}
	internal class WaiterDeskStructure : CustomStructure, ITaskProvider
	{
		public override string InternalName => "Waiter_Desk_Structure";

		public override Sprite Sprite => TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/waiterdesk.png"));

		public override int BuildDurationMinutes => 30;

		public override List<ItemCost> Cost => new List<ItemCost>
		{
			new ItemCost((ITEM_TYPE)20, 10),
			new ItemCost((ITEM_TYPE)35, 5),
			new ItemCost((ITEM_TYPE)1, 10)
		};

		public override string GetLocalizedName()
		{
			return "Waiter Desk";
		}

		public override string GetLocalizedDescription()
		{
			return "A Desk to allow followers to serve food to other followers.";
		}

		public bool CheckOverrideComplete()
		{
			return true;
		}

		public void GetAvailableTasks(ScheduledActivity activity, SortedList<float, FollowerTask> sortedTasks)
		{
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			int num = 0;
			foreach (Structures_Meal item in StructureManager.GetAllStructuresOfType<Structures_Meal>((FollowerLocation)1))
			{
				if (!((StructureBrain)item).Data.Rotten && !((StructureBrain)item).Data.Burned && !((StructureBrain)item).ReservedForTask)
				{
					num++;
				}
			}
			foreach (Interaction_FollowerKitchen followerKitchen in Interaction_FollowerKitchen.FollowerKitchens)
			{
				foreach (InventoryItem item2 in followerKitchen.foodStorage.StructureInfo.Inventory)
				{
					if (item2.UnreservedQuantity > 0)
					{
						num++;
					}
				}
			}
			if ((int)activity == 0 && !((StructureBrain)this).ReservedForTask && num != 0)
			{
				WaiterTask waiterTask = new WaiterTask(((StructureBrain)this).Data.ID);
				sortedTasks.Add(((FollowerTask)waiterTask).Priorty, (FollowerTask)(object)waiterTask);
			}
		}

		public FollowerTask GetOverrideTask(FollowerBrain brain)
		{
			throw new NotImplementedException();
		}
	}
}
namespace CotLMiniMods.Structures.Productivity
{
	internal class Structures_LuckyNarinder : CustomStructure, ITaskProvider
	{
		public override string InternalName => "Structures_LuckyNarinder";

		public override Sprite Sprite => TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/luckynarinder.png"));

		public override int BuildDurationMinutes => 30;

		public override List<ItemCost> Cost => new List<ItemCost>
		{
			new ItemCost((ITEM_TYPE)20, 15),
			new ItemCost((ITEM_TYPE)81, 5),
			new ItemCost((ITEM_TYPE)82, 5)
		};

		public override string GetLocalizedName()
		{
			return "Lucky Narinder Statue";
		}

		public override string GetLocalizedDescription()
		{
			return "Follower can admire this statue and pray to it. Provides Faith.";
		}

		public bool CheckOverrideComplete()
		{
			return true;
		}

		public void GetAvailableTasks(ScheduledActivity activity, SortedList<float, FollowerTask> sortedTasks)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			if ((int)activity == 0 && !((StructureBrain)this).ReservedForTask)
			{
				FollowerTask_DevoteNarinder followerTask_DevoteNarinder = new FollowerTask_DevoteNarinder(((StructureBrain)this).Data.ID);
				sortedTasks.Add(((FollowerTask)followerTask_DevoteNarinder).Priorty, (FollowerTask)(object)followerTask_DevoteNarinder);
			}
		}

		public FollowerTask GetOverrideTask(FollowerBrain brain)
		{
			throw new NotImplementedException();
		}
	}
	internal class Structures_StudyTable : CustomStructure, ITaskProvider
	{
		public override string InternalName => "Structures_StudyTable";

		public override Sprite Sprite => TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/study.png"));

		public override int BuildDurationMinutes => 30;

		public override List<ItemCost> Cost => new List<ItemCost>
		{
			new ItemCost((ITEM_TYPE)20, 15),
			new ItemCost((ITEM_TYPE)81, 7),
			new ItemCost((ITEM_TYPE)35, 10)
		};

		public override string GetLocalizedName()
		{
			return "Study Table";
		}

		public override string GetLocalizedDescription()
		{
			return "Allows your followers to research in Strange Materials. Invest Gold to increase generation. The follower will gain loyalty as well.";
		}

		public bool CheckOverrideComplete()
		{
			return true;
		}

		public void GetAvailableTasks(ScheduledActivity activity, SortedList<float, FollowerTask> sortedTasks)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			if ((int)activity == 0 && !((StructureBrain)this).ReservedForTask)
			{
				FollowerTask_StudyResearch followerTask_StudyResearch = new FollowerTask_StudyResearch(((StructureBrain)this).Data.ID);
				sortedTasks.Add(((FollowerTask)followerTask_StudyResearch).Priorty, (FollowerTask)(object)followerTask_StudyResearch);
			}
		}

		public FollowerTask GetOverrideTask(FollowerBrain brain)
		{
			throw new NotImplementedException();
		}
	}
	internal class Structures_Telescope : CustomStructure, ITaskProvider
	{
		public bool UsedForTheDay = false;

		public override string InternalName => "Structures_Telescope";

		public override Sprite Sprite => TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/telescope.png"));

		public override int BuildDurationMinutes => 30;

		public override List<ItemCost> Cost => new List<ItemCost>
		{
			new ItemCost((ITEM_TYPE)20, 15),
			new ItemCost((ITEM_TYPE)81, 5),
			new ItemCost((ITEM_TYPE)82, 5)
		};

		public override string GetLocalizedName()
		{
			return "Telescope";
		}

		public override string GetLocalizedDescription()
		{
			return "Allows your followers to see the stars, and gain inspiration.";
		}

		public bool CheckOverrideComplete()
		{
			return true;
		}

		public void GetAvailableTasks(ScheduledActivity activity, SortedList<float, FollowerTask> sortedTasks)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			if ((int)activity == 0 && !((StructureBrain)this).ReservedForTask && !UsedForTheDay)
			{
				FollowerTask_Stargazing followerTask_Stargazing = new FollowerTask_Stargazing(((StructureBrain)this).Data.ID);
				sortedTasks.Add(((FollowerTask)followerTask_Stargazing).Priorty, (FollowerTask)(object)followerTask_Stargazing);
			}
		}

		public FollowerTask GetOverrideTask(FollowerBrain brain)
		{
			throw new NotImplementedException();
		}

		public override void OnAdded()
		{
			TimeManager.OnNewDayStarted = (Action)Delegate.Combine(TimeManager.OnNewDayStarted, new Action(((StructureBrain)this).OnNewPhaseStarted));
			TimeManager.OnNewPhaseStarted = (Action)Delegate.Combine(TimeManager.OnNewPhaseStarted, new Action(CheckNight));
		}

		public override void OnRemoved()
		{
			TimeManager.OnNewDayStarted = (Action)Delegate.Remove(TimeManager.OnNewDayStarted, new Action(((StructureBrain)this).OnNewPhaseStarted));
			TimeManager.OnNewPhaseStarted = (Action)Delegate.Remove(TimeManager.OnNewPhaseStarted, new Action(CheckNight));
		}

		public override void OnNewPhaseStarted()
		{
			Plugin.Log.LogInfo((object)"Reset use for the day for telescope");
			UsedForTheDay = false;
		}

		public void CheckNight()
		{
			if (TimeManager.IsNight)
			{
				Plugin.Log.LogInfo((object)"Reset for the night");
				UsedForTheDay = false;
			}
		}
	}
}
namespace CotLMiniMods.Structures.Mines
{
	internal class BoneMineStructure : CustomStructure, ITaskProvider
	{
		public int ResourceMax = 150;

		public override string InternalName => "Bone_Mine_Structure";

		public override Sprite Sprite => TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/bonemines.png"));

		public override int BuildDurationMinutes => 30;

		public override List<ItemCost> Cost => new List<ItemCost>
		{
			new ItemCost((ITEM_TYPE)20, 6),
			new ItemCost((ITEM_TYPE)9, 5),
			new ItemCost((ITEM_TYPE)2, 5)
		};

		public override string GetLocalizedName()
		{
			return "Bone Mines";
		}

		public override string GetLocalizedDescription()
		{
			return "A place to mine bones.";
		}

		public bool CheckOverrideComplete()
		{
			return true;
		}

		public void GetAvailableTasks(ScheduledActivity activity, SortedList<float, FollowerTask> sortedTasks)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			if ((int)activity == 0 && !((StructureBrain)this).ReservedForTask && ((StructureBrain)this).Data.Inventory.Count < ResourceMax)
			{
				FollowerTask_BoneMiner followerTask_BoneMiner = new FollowerTask_BoneMiner(((StructureBrain)this).Data.ID);
				sortedTasks.Add(((FollowerTask)followerTask_BoneMiner).Priorty, (FollowerTask)(object)followerTask_BoneMiner);
			}
		}

		public FollowerTask GetOverrideTask(FollowerBrain brain)
		{
			throw new NotImplementedException();
		}
	}
	internal class CrystalMineStructure : CustomStructure, ITaskProvider
	{
		public int ResourceMax = 150;

		public override string InternalName => "Crystal_Mine_Structure";

		public override Sprite Sprite => TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/crystalmines.png"));

		public override int BuildDurationMinutes => 30;

		public override List<ItemCost> Cost => new List<ItemCost>
		{
			new ItemCost((ITEM_TYPE)20, 15),
			new ItemCost((ITEM_TYPE)89, 3),
			new ItemCost((ITEM_TYPE)2, 5)
		};

		public override string GetLocalizedName()
		{
			return "Crystal Mines";
		}

		public override string GetLocalizedDescription()
		{
			return "A place to mine crystals.";
		}

		public bool CheckOverrideComplete()
		{
			return true;
		}

		public void GetAvailableTasks(ScheduledActivity activity, SortedList<float, FollowerTask> sortedTasks)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			if ((int)activity == 0 && !((StructureBrain)this).ReservedForTask && ((StructureBrain)this).Data.Inventory.Count < ResourceMax)
			{
				FollowerTask_CrystalMiner followerTask_CrystalMiner = new FollowerTask_CrystalMiner(((StructureBrain)this).Data.ID);
				sortedTasks.Add(((FollowerTask)followerTask_CrystalMiner).Priorty, (FollowerTask)(object)followerTask_CrystalMiner);
			}
		}

		public FollowerTask GetOverrideTask(FollowerBrain brain)
		{
			throw new NotImplementedException();
		}
	}
	internal class SilkMineStructure : CustomStructure, ITaskProvider
	{
		public int ResourceMax = 150;

		public override string InternalName => "Silk_Mine_Structure";

		public override Sprite Sprite => TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/silkmines.png"));

		public override int BuildDurationMinutes => 30;

		public override List<ItemCost> Cost => new List<ItemCost>
		{
			new ItemCost((ITEM_TYPE)20, 55),
			new ItemCost((ITEM_TYPE)86, 3),
			new ItemCost((ITEM_TYPE)2, 15)
		};

		public override string GetLocalizedName()
		{
			return "Silk Mines";
		}

		public override string GetLocalizedDescription()
		{
			return "A place to harvest webs.";
		}

		public bool CheckOverrideComplete()
		{
			return true;
		}

		public void GetAvailableTasks(ScheduledActivity activity, SortedList<float, FollowerTask> sortedTasks)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			if ((int)activity == 0 && !((StructureBrain)this).ReservedForTask && ((StructureBrain)this).Data.Inventory.Count < ResourceMax)
			{
				FollowerTask_SilkMiner followerTask_SilkMiner = new FollowerTask_SilkMiner(((StructureBrain)this).Data.ID);
				sortedTasks.Add(((FollowerTask)followerTask_SilkMiner).Priorty, (FollowerTask)(object)followerTask_SilkMiner);
			}
		}

		public FollowerTask GetOverrideTask(FollowerBrain brain)
		{
			throw new NotImplementedException();
		}
	}
	internal class Structures_AIOFarmer : CustomStructure, ITaskProvider
	{
		public int ResourceMax = 1000;

		public ITEM_TYPE SelectedQuarryItem = (ITEM_TYPE)35;

		public override string InternalName => "Structures_AIOFarmer";

		public override Sprite Sprite => TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/aiofarm.png"));

		public override int BuildDurationMinutes => 30;

		public override List<ItemCost> Cost => new List<ItemCost>
		{
			new ItemCost((ITEM_TYPE)20, 1000),
			new ItemCost(Plugin.StrangeMaterialItem, 15)
		};

		public List<ITEM_TYPE> QuarryItems => new List<ITEM_TYPE>
		{
			(ITEM_TYPE)50,
			(ITEM_TYPE)97,
			(ITEM_TYPE)102,
			(ITEM_TYPE)29,
			(ITEM_TYPE)21,
			(ITEM_TYPE)55,
			(ITEM_TYPE)56,
			(ITEM_TYPE)77,
			(ITEM_TYPE)35
		};

		public override string GetLocalizedName()
		{
			return "Incubation Chamber";
		}

		public override string GetLocalizedDescription()
		{
			return "A machine powered by Strange Energy to incubate seeds.";
		}

		public bool CheckOverrideComplete()
		{
			return true;
		}

		public void GetAvailableTasks(ScheduledActivity activity, SortedList<float, FollowerTask> sortedTasks)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			if ((int)activity == 0 && !((StructureBrain)this).ReservedForTask && ((StructureBrain)this).Data.Inventory.Count < ResourceMax)
			{
				FollowerTask_AIOFarmer followerTask_AIOFarmer = new FollowerTask_AIOFarmer(((StructureBrain)this).Data.ID);
				sortedTasks.Add(((FollowerTask)followerTask_AIOFarmer).Priorty, (FollowerTask)(object)followerTask_AIOFarmer);
			}
		}

		public FollowerTask GetOverrideTask(FollowerBrain brain)
		{
			throw new NotImplementedException();
		}
	}
	internal class Structures_AIOQuarry : CustomStructure, ITaskProvider
	{
		public int ResourceMax = 1000;

		public ITEM_TYPE SelectedQuarryItem = (ITEM_TYPE)2;

		public override string InternalName => "Structures_AIOQuarry";

		public override Sprite Sprite => TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/aio.png"));

		public override int BuildDurationMinutes => 30;

		public override List<ItemCost> Cost => new List<ItemCost>
		{
			new ItemCost((ITEM_TYPE)20, 1500),
			new ItemCost(Plugin.StrangeMaterialItem, 20)
		};

		public List<ITEM_TYPE> QuarryItems => new List<ITEM_TYPE>
		{
			(ITEM_TYPE)20,
			(ITEM_TYPE)2,
			(ITEM_TYPE)82,
			(ITEM_TYPE)1,
			(ITEM_TYPE)81,
			(ITEM_TYPE)117,
			(ITEM_TYPE)39,
			(ITEM_TYPE)83,
			(ITEM_TYPE)6,
			(ITEM_TYPE)7
		};

		public override string GetLocalizedName()
		{
			return "AIO Quarry";
		}

		public override string GetLocalizedDescription()
		{
			return "A machine powered by Strange Energy to generate your preferred output.";
		}

		public bool CheckOverrideComplete()
		{
			return true;
		}

		public void GetAvailableTasks(ScheduledActivity activity, SortedList<float, FollowerTask> sortedTasks)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			if ((int)activity == 0 && !((StructureBrain)this).ReservedForTask && ((StructureBrain)this).Data.Inventory.Count < ResourceMax)
			{
				FollowerTask_AIOMiner followerTask_AIOMiner = new FollowerTask_AIOMiner(((StructureBrain)this).Data.ID);
				sortedTasks.Add(((FollowerTask)followerTask_AIOMiner).Priorty, (FollowerTask)(object)followerTask_AIOMiner);
			}
		}

		public FollowerTask GetOverrideTask(FollowerBrain brain)
		{
			throw new NotImplementedException();
		}
	}
	internal class Structures_Boutique : CustomStructure, ITaskProvider
	{
		public override string InternalName => "Structures_Boutique";

		public override Sprite Sprite => TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/GiftTree.png"));

		public override int BuildDurationMinutes => 30;

		public override List<ItemCost> Cost => new List<ItemCost>
		{
			new ItemCost(Plugin.StrangeMaterialItem, 5),
			new ItemCost((ITEM_TYPE)1, 10)
		};

		public override string GetLocalizedName()
		{
			return "The Boutique";
		}

		public override string GetLocalizedDescription()
		{
			return "Followers can create Gifts to pass to other followers to improve their relationship.";
		}

		public bool CheckOverrideComplete()
		{
			return true;
		}

		public void GetAvailableTasks(ScheduledActivity activity, SortedList<float, FollowerTask> sortedTasks)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			if ((int)activity == 0 && !((StructureBrain)this).ReservedForTask)
			{
				FollowerTask_Boutique followerTask_Boutique = new FollowerTask_Boutique(((StructureBrain)this).Data.ID);
				sortedTasks.Add(((FollowerTask)followerTask_Boutique).Priorty, (FollowerTask)(object)followerTask_Boutique);
			}
		}

		public FollowerTask GetOverrideTask(FollowerBrain brain)
		{
			throw new NotImplementedException();
		}
	}
	internal class Structures_GiftTree : CustomStructure, ITaskProvider
	{
		public int ResourceMax = 150;

		public override string InternalName => "Structures_GiftTree";

		public override Sprite Sprite => TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/GiftTree.png"));

		public override int BuildDurationMinutes => 30;

		public override List<ItemCost> Cost => new List<ItemCost>
		{
			new ItemCost(Plugin.StrangeMaterialItem, 5),
			new ItemCost((ITEM_TYPE)1, 10)
		};

		public override string GetLocalizedName()
		{
			return "Tree of Giving";
		}

		public override string GetLocalizedDescription()
		{
			return "Followers can work here to pack collectable gifts.";
		}

		public bool CheckOverrideComplete()
		{
			return true;
		}

		public void GetAvailableTasks(ScheduledActivity activity, SortedList<float, FollowerTask> sortedTasks)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			if ((int)activity == 0 && !((StructureBrain)this).ReservedForTask && ((StructureBrain)this).Data.Inventory.Count < ResourceMax)
			{
				FollowerTask_GiftPacking followerTask_GiftPacking = new FollowerTask_GiftPacking(((StructureBrain)this).Data.ID);
				sortedTasks.Add(((FollowerTask)followerTask_GiftPacking).Priorty, (FollowerTask)(object)followerTask_GiftPacking);
			}
		}

		public FollowerTask GetOverrideTask(FollowerBrain brain)
		{
			throw new NotImplementedException();
		}
	}
}
namespace CotLMiniMods.Rituals
{
	public abstract class CustomRitual : Ritual
	{
		internal string ModPrefix;

		public Type upgradeType;

		public abstract string InternalName { get; }

		public virtual Sprite Sprite { get; } = TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/placeholder.png"));


		public virtual List<ItemCost> ItemCosts { get; } = new List<ItemCost>
		{
			new ItemCost((ITEM_TYPE)1, 1)
		};


		public override Type RitualType => upgradeType;

		public virtual string GetLocalizedName => "Custom_Ritual_" + InternalName;

		public virtual string GetLocalizedDescription => "Custom_Ritual_" + InternalName + "_Description";

		public virtual float FaithChange { get; } = 5f;


		public virtual TraitType RitualTrait { get; } = (TraitType)0;


		public virtual float Cooldown => 120f;
	}
	public class DistributionRitual : CustomRitual
	{
		private EventInstance loopedSound;

		public override string InternalName { get; } = "Distribution_Ritual";


		public override Sprite Sprite { get; } = TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/ritual_leveling.png"));


		public override List<ItemCost> ItemCosts { get; } = new List<ItemCost>
		{
			new ItemCost((ITEM_TYPE)20, 300)
		};


		public override string GetLocalizedName => "Distribution Ritual";

		public override string GetLocalizedDescription => "Distribute your wealth among the followers! They will instantly level up.";

		public override float FaithChange { get; } = 10f;


		public override TraitType RitualTrait { get; } = (TraitType)0;


		public override float Cooldown => 60f;

		public override void Play()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			((Ritual)this).Play();
			ManualLogSource log = Plugin.Log;
			string? text = ((object)(Type)(ref upgradeType)).ToString();
			Type ritualType = ((Ritual)this).RitualType;
			log.LogInfo((object)("Starting ritual for " + text + " and " + ((object)(Type)(ref ritualType)).ToString()));
			((MonoBehaviour)GameManager.GetInstance()).StartCoroutine(RitualRoutine());
		}

		private IEnumerator RitualRoutine()
		{
			AudioManager.Instance.PlayOneShot("event:/rituals/generic_start_ritual");
			Interaction_TempleAltar.Instance.SimpleSetCamera.Play();
			yield return ((MonoBehaviour)this).StartCoroutine(((Ritual)this).WaitFollowersFormCircle(false, true, 12f));
			((Interaction)Interaction_TempleAltar.Instance).state.CURRENT_STATE = (State)49;
			PlayerFarming.Instance.simpleSpineAnimator.Animate("build", 0, true);
			TweenSettingsExtensions.SetUpdate<TweenerCore<Vector3, Vector3, VectorOptions>>(TweenSettingsExtensions.SetEase<TweenerCore<Vector3, Vector3, VectorOptions>>(ShortcutExtensions.DOMove(((Component)PlayerFarming.Instance.state).transform, ChurchFollowerManager.Instance.RitualCenterPosition.position, 0.1f, false), (Ease)4), true);
			Bone obj = ((SkeletonRenderer)PlayerFarming.Instance.Spine).skeleton.FindBone("ritualring");
			obj.Rotation += 60f;
			((SkeletonRenderer)PlayerFarming.Instance.Spine).skeleton.UpdateWorldTransform();
			((SkeletonRenderer)PlayerFarming.Instance.Spine).skeleton.Update(Time.deltaTime);
			PlayerFarming.Instance.simpleSpineAnimator.Animate("rituals/ritual-start", 0, false);
			PlayerFarming.Instance.simpleSpineAnimator.AddAnimate("rituals/ritual-loop", 0, true, 0f);
			((Component)Interaction_TempleAltar.Instance.RitualLighting).gameObject.SetActive(true);
			ChurchFollowerManager.Instance.StartRitualOverlay();
			BiomeConstants.Instance.ChromaticAbberationTween(2f, BiomeConstants.Instance.ChromaticAberrationDefaultValue, 1f);
			BiomeConstants.Instance.VignetteTween(2f, BiomeConstants.Instance.VignetteDefaultValue, 0.7f);
			TweenSettingsExtensions.SetEase<TweenerCore<float, float, FloatOptions>>(DOTween.To((DOGetter<float>)(() => GameManager.GetInstance().CamFollowTarget.targetDistance), (DOSetter<float>)delegate(float x)
			{
				GameManager.GetInstance().CamFollowTarget.targetDistance = x;
			}, 6.5f, 1f), (Ease)3);
			yield return (object)new WaitForSeconds(1.2f);
			loopedSound = AudioManager.Instance.CreateLoop("event:/rituals/coin_loop", ((Component)PlayerFarming.Instance).gameObject, true, true);
			float delay = 0f;
			foreach (FollowerBrain followerBrain3 in Ritual.GetFollowersAvailableToAttendSermon(false))
			{
				((MonoBehaviour)this).StartCoroutine(GiveCoins(FollowerManager.FindFollowerByID(followerBrain3.Info.ID), 5f, delay));
				delay += 0.1f;
			}
			yield return (object)new WaitForSeconds(5f);
			AudioManager.Instance.StopLoop(loopedSound);
			yield return (object)new WaitForSeconds(1.2f);
			Interaction_TempleAltar.Instance.PulseDisplacementObject(PlayerFarming.Instance.CameraBone.transform.position);
			PlayerFarming.Instance.simpleSpineAnimator.Animate("rituals/ritual-stop", 0, false);
			PlayerFarming.Instance.simpleSpineAnimator.AddAnimate("idle", 0, true, 0f);
			foreach (FollowerBrain followerBrain2 in Ritual.FollowerToAttendSermon)
			{
				if (followerBrain2.CurrentTask is FollowerTask_AttendRitual)
				{
					FollowerTask currentTask = followerBrain2.CurrentTask;
					((FollowerTask_AttendRitual)((currentTask is FollowerTask_AttendRitual) ? currentTask : null)).Cheer();
				}
			}
			yield return (object)new WaitForSeconds(0.5f);
			BiomeConstants.Instance.ChromaticAbberationTween(1f, 1f, BiomeConstants.Instance.ChromaticAberrationDefaultValue);
			BiomeConstants.Instance.VignetteTween(1f, 0.7f, BiomeConstants.Instance.VignetteDefaultValue);
			ChurchFollowerManager.Instance.EndRitualOverlay();
			GameManager.GetInstance().CamFollowTarget.targetDistance = 11f;
			((Component)Interaction_TempleAltar.Instance.RitualLighting).gameObject.SetActive(false);
			float EndingDelay = 0f;
			foreach (FollowerBrain followerBrain in Ritual.FollowerToAttendSermon)
			{
				FollowerBrain brain = followerBrain;
				brain.AddThought((Thought)177, false, false);
				brain.Stats.Adoration = brain.Stats.MAX_ADORATION;
				Follower f = FollowerManager.FindFollowerByID(brain.Info.ID);
				f.AdorationUI.BarController.SetBarSize(brain.Stats.Adoration / brain.Stats.MAX_ADORATION, false, true, (NotificationData)null);
				((MonoBehaviour)f).StartCoroutine(brain.AddAdorationIE(f, (AdorationActions)0, (Action)null));
			}
			yield return (object)new WaitForSeconds(3f + EndingDelay);
			Interaction_TempleAltar.Instance.SimpleSetCamera.Reset(1f);
			((Ritual)this).CompleteRitual(false, -1, -1, true);
			yield return (object)new WaitForSeconds(1f);
			CultFaithManager.AddThought((Thought)244, -1, 1f, Array.Empty<string>());
		}

		private IEnumerator GiveCoins(Follower follower, float totalTime, float delay)
		{
			yield return (object)new WaitForSeconds(delay);
			int randomCoins = 50;
			float increment = (totalTime - delay) / (float)randomCoins;
			int i = 0;
			while (i < randomCoins)
			{
				AudioManager.Instance.PlayOneShot("event:/followers/pop_in", ((Component)PlayerFarming.Instance).transform.position);
				ResourceCustomTarget.Create(((Component)follower).gameObject, ((Component)PlayerFarming.Instance).transform.position, (ITEM_TYPE)20, (Action)PlayCoinSound, true);
				yield return (object)new WaitForSeconds(increment);
				int num = i + 1;
				i = num;
			}
		}

		private void PlayCoinSound()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			AudioManager.Instance.PlayOneShot("event:/rituals/coins", ((Component)PlayerFarming.Instance).transform.position);
		}
	}
	public class ExiledRitual : CustomRitual
	{
		public Follower followerToLeave;

		public override string InternalName { get; } = "Exiled_Ritual";


		public override Sprite Sprite { get; } = TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/ritual_exile.png"));


		public override List<ItemCost> ItemCosts { get; } = new List<ItemCost>
		{
			new ItemCost(Plugin.StrangeMaterialItem, 3)
		};


		public override string GetLocalizedName => "Ritual of Exile";

		public override string GetLocalizedDescription => "Removes a follower from existence, permanently leaving the cult. Warning: this action is irreversible!";

		public override float FaithChange { get; } = 10f;


		public override TraitType RitualTrait { get; } = (TraitType)0;


		public override float Cooldown => 60f;

		public override void Play()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			((Ritual)this).Play();
			ManualLogSource log = Plugin.Log;
			string? text = ((object)(Type)(ref upgradeType)).ToString();
			Type ritualType = ((Ritual)this).RitualType;
			log.LogInfo((object)("Starting ritual for " + text + " and " + ((object)(Type)(ref ritualType)).ToString()));
			((MonoBehaviour)GameManager.GetInstance()).StartCoroutine(RitualRoutine());
		}

		private IEnumerator RitualRoutine()
		{
			bool Cancelled = false;
			AudioManager.Instance.PlayOneShot("event:/rituals/generic_start_ritual");
			yield return ((MonoBehaviour)this).StartCoroutine(((Ritual)this).CentreAndAnimatePlayer());
			Interaction_TempleAltar.Instance.SimpleSetCamera.Play();
			yield return ((MonoBehaviour)this).StartCoroutine(((Ritual)this).WaitFollowersFormCircle(false, true, 12f));
			Bone obj = ((SkeletonRenderer)PlayerFarming.Instance.Spine).skeleton.FindBone("ritualring");
			obj.Rotation += 60f;
			((SkeletonRenderer)PlayerFarming.Instance.Spine).skeleton.UpdateWorldTransform();
			((SkeletonRenderer)PlayerFarming.Instance.Spine).skeleton.Update(Time.deltaTime);
			PlayerFarming.Instance.simpleSpineAnimator.Animate("rituals/ritual-start", 0, false);
			PlayerFarming.Instance.simpleSpineAnimator.AddAnimate("rituals/ritual-loop", 0, true, 0f);
			((Component)Interaction_TempleAltar.Instance.RitualLighting).gameObject.SetActive(true);
			ChurchFollowerManager.Instance.StartRitualOverlay();
			UIFollowerSelectMenuController followerSelectInstance = GameObjectExtensions.Instantiate<UIFollowerSelectMenuController>(MonoSingleton<UIManager>.Instance.FollowerSelectMenuTemplate);
			new List<FollowerInfo>();
			Helper.MakeSimpleFSEFromList(DataManager.Instance.Followers, (Status)0);
			followerSelectInstance.Show(Ritual.GetFollowerSelectEntriesForSermon(0, false), false, (Type)60, true, true, true, false);
			UIFollowerSelectMenuController obj2 = followerSelectInstance;
			((UIFollowerSelectBase<FollowerInformationBox>)(object)obj2).OnFollowerSelected = (Action<FollowerInfo>)Delegate.Combine(((UIFollowerSelectBase<FollowerInformationBox>)(object)obj2).OnFollowerSelected, (Action<FollowerInfo>)delegate(FollowerInfo followerInfo)
			{
				followerToLeave = FollowerManager.FindFollowerByID(followerInfo.ID);
				UIManager.PlayAudio("event:/ritual_sacrifice/ritual_begin");
			});
			((UIMenuBase)followerSelectInstance).OnCancel = (Action)Delegate.Combine(((UIMenuBase)followerSelectInstance).OnCancel, (Action)delegate
			{
				((MonoBehaviour)GameManager.GetInstance()).StartCoroutine(EndRitual());
				Cancelled = true;
				((Ritual)this).CompleteRitual(true, -1, -1, true);
				((Ritual)this).CancelFollowers();
			});
			UIFollowerSelectMenuController obj3 = followerSelectInstance;
			((UIMenuBase)obj3).OnHidden = (Action)Delegate.Combine(((UIMenuBase)obj3).OnHidden, (Action)delegate
			{
				followerSelectInstance = null;
			});
			UIFollowerSelectMenuController obj4 = followerSelectInstance;
			((UIMenuBase)obj4).OnShow = (Action)Delegate.Combine(((UIMenuBase)obj4).OnShow, (Action)delegate
			{
				foreach (FollowerInformationBox followerInfoBox in ((UIFollowerSelectBase<FollowerInformationBox>)(object)followerSelectInstance).FollowerInfoBoxes)
				{
					((TMP_Text)followerInfoBox.FollowerRole).text = "Warning: permanently erases follower!!";
				}
			});
			while ((Object)(object)followerSelectInstance != (Object)null && !Cancelled)
			{
				yield return null;
			}
			if (!Cancelled)
			{
				yield return (object)new WaitForSeconds(1.2f);
				ChurchFollowerManager.Instance.PlayOverlay((OverlayType)0, "resurrect", "", false);
				yield return (object)new WaitForSeconds(0.5f);
				((Ritual)this).PlaySacrificePortalEffect();
				followerToLeave.Brain.CompleteCurrentTask();
				FollowerTask_ManualControl nextTask = new FollowerTask_ManualControl();
				followerToLeave.Brain.HardSwapToTask((FollowerTask)(object)nextTask);
				followerToLeave.Brain.InRitual = true;
				followerToLeave.SetOutfit(followerToLeave.Brain.Info.Outfit, true, (Thought)0);
				foreach (FollowerBrain allBrain in FollowerBrain.AllBrains)
				{
					if ((int)allBrain.CurrentTaskType == 21)
					{
						FollowerTask currentTask = allBrain.CurrentTask;
						((FollowerTask_AttendRitual)((currentTask is FollowerTask_AttendRitual) ? currentTask : null)).WorshipTentacle();
					}
				}
				yield return (object)new WaitForSeconds(0.5f);
				AudioManager.Instance.PlayOneShot("event:/rituals/resurrect");
				yield return (object)new WaitForSeconds(1.2f);
				TweenCallback val = default(TweenCallback);
				followerToLeave.HoodOff("idle", false, (Action)delegate
				{
					//IL_0047: 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_0070: Expected O, but got Unknown
					//IL_0075: Expected O, but got Unknown
					followerToLeave.Spine.AnimationState.SetAnimation(1, "walk", true);
					TweenerCore<Vector3, Vector3, VectorOptions> obj5 = ShortcutExtensions.DOMove(((Component)followerToLeave).gameObject.transform, ((Component)Interaction_TempleAltar.Instance.PortalEffect).transform.position, 2.5f, false);
					TweenCallback obj6 = val;
					if (obj6 == null)
					{
						TweenCallback val2 = delegate
						{
							Interaction_TempleAltar.Instance.SimpleSetCamera.Reset(1f);
							((MonoBehaviour)GameManager.GetInstance()).StartCoroutine(ExileRoutine());
						};
						TweenCallback val3 = val2;
						val = val2;
						obj6 = val3;
					}
					TweenSettingsExtensions.OnComplete<TweenerCore<Vector3, Vector3, VectorOptions>>(obj5, obj6);
				});
				yield return (object)new WaitForSeconds(10f);
				((Ritual)this).StopSacrificePortalEffect();
				ChurchFollowerManager.Instance.StopSacrificePortalEffect();
				Interaction_TempleAltar.Instance.PulseDisplacementObject(PlayerFarming.Instance.CameraBone.transform.position);
				PlayerFarming.Instance.simpleSpineAnimator.Animate("rituals/ritual-stop", 0, false);
				PlayerFarming.Instance.simpleSpineAnimator.AddAnimate("idle", 0, true, 0f);
				foreach (FollowerBrain followerBrain in Ritual.FollowerToAttendSermon)
				{
					if (followerBrain.CurrentTask is FollowerTask_AttendRitual)
					{
						FollowerTask currentTask2 = followerBrain.CurrentTask;
						((FollowerTask_AttendRitual)((currentTask2 is FollowerTask_AttendRitual) ? currentTask2 : null)).Cheer();
					}
				}
				yield return (object)new WaitForSeconds(3f);
			}
			ChurchFollowerManager.Instance.EndRitualOverlay();
			GameManager.GetInstance().CamFollowTarget.targetDistance = 11f;
			((Component)Interaction_TempleAltar.Instance.RitualLighting).gameObject.SetActive(false);
			Interaction_TempleAltar.Instance.SimpleSetCamera.Reset(1f);
			((Ritual)this).CompleteRitual(false, -1, -1, true);
		}

		private IEnumerator EndRitual()
		{
			Interaction_TempleAltar.Instance.SimpleSetCamera.Reset(1f);
			PlayerFarming.Instance.simpleSpineAnimator.Animate("rituals/ritual-stop", 0, false);
			PlayerFarming.Instance.simpleSpineAnimator.AddAnimate("idle", 0, true, 0f);
			yield return (object)new WaitForSeconds(2f / 3f);
		}

		private IEnumerator ExileRoutine()
		{
			ChurchFollowerManager.Instance.RemoveBrainFromAudience(followerToLeave.Brain);
			followerToLeave.Spine.AnimationState.SetAnimation(1, "Reactions/react-scared", false);
			yield return (object)new WaitForSeconds(1.9f);
			followerToLeave.Spine.AnimationState.SetAnimation(1, "Spawn-Out-Portal", false);
			yield return (object)new WaitForSeconds(2.8f);
			followerToLeave.Brain.LeftCult = true;
			followerToLeave.LeaveCult();
		}
	}
	public class FusionRitual : CustomRitual
	{
		private Follower sacrificeFollower;

		private Follower absorbtionFollower;

		public override string InternalName { get; } = "Fusion_Ritual";


		public override Sprite Sprite { get; } = TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/ritual_fusion.png"));


		public override List<ItemCost> ItemCosts { get; } = new List<ItemCost>
		{
			new ItemCost((ITEM_TYPE)20, 1000)
		};


		public override string GetLocalizedName => "Fusion Ritual";

		public override string GetLocalizedDescription => "Sacrifice a selected Follower. The next selected Follower gets the sacrificed follower's traits.";

		public override float FaithChange { get; } = 20f;


		public override float Cooldown => 60f;

		public override TraitType RitualTrait { get; } = (TraitType)0;


		public override void Play()
		{
			((Ritual)this).Play();
			((MonoBehaviour)GameManager.GetInstance()).StartCoroutine(RitualRoutine());
		}

		private IEnumerator RitualRoutine()
		{
			yield return ((MonoBehaviour)this).StartCoroutine(((Ritual)this).CentreAndAnimatePlayer());
			Interaction_TempleAltar.Instance.SimpleSetCamera.Play();
			yield return ((MonoBehaviour)this).StartCoroutine(((Ritual)this).WaitFollowersFormCircle(false, true, 12f));
			PlayerFarming.Instance.simpleSpineAnimator.Animate("rituals/ritual-start", 0, false);
			PlayerFarming.Instance.simpleSpineAnimator.AddAnimate("rituals/ritual-loop", 0, true, 0f);
			yield return (object)new WaitForSeconds(1f);
			bool Cancelled = false;
			UIFollowerSelectMenuController followerSelectInstance = GameObjectExtensions.Instantiate<UIFollowerSelectMenuController>(MonoSingleton<UIManager>.Instance.FollowerSelectMenuTemplate);
			followerSelectInstance.Show(Ritual.GetFollowerSelectEntriesForSermon(0, false), false, (Type)60, true, true, true, false);
			UIFollowerSelectMenuController obj = followerSelectInstance;
			((UIFollowerSelectBase<FollowerInformationBox>)(object)obj).OnFollowerSelected = (Action<FollowerInfo>)Delegate.Combine(((UIFollowerSelectBase<FollowerInformationBox>)(object)obj).OnFollowerSelected, (Action<FollowerInfo>)delegate(FollowerInfo followerInfo)
			{
				sacrificeFollower = FollowerManager.FindFollowerByID(followerInfo.ID);
				UIManager.PlayAudio("event:/ritual_sacrifice/ritual_begin");
			});
			UIFollowerSelectMenuController obj2 = followerSelectInstance;
			((UIMenuBase)obj2).OnShow = (Action)Delegate.Combine(((UIMenuBase)obj2).OnShow, (Action)delegate
			{
				//IL_003f: 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)
				foreach (FollowerInformationBox followerInfoBox in ((UIFollowerSelectBase<FollowerInformationBox>)(object)followerSelectInstance).FollowerInfoBoxes)
				{
					string text = "";
					foreach (TraitType trait in followerInfoBox.followBrain.Info.Traits)
					{
						TraitType current3 = trait;
						text = text + ((object)(TraitType)(ref current3)).ToString() + " | ";
					}
					((TMP_Text)followerInfoBox.FollowerRole).text = "Traits: " + text;
				}
			});
			((UIMenuBase)followerSelectInstance).OnCancel = (Action)Delegate.Combine(((UIMenuBase)followerSelectInstance).OnCancel, (Action)delegate
			{
				((MonoBehaviour)GameManager.GetInstance()).StartCoroutine(EndRitual());
				Cancelled = true;
				((Ritual)this).CompleteRitual(true, -1, -1, true);
				((Ritual)this).CancelFollowers();
			});
			Plugin.Log.LogInfo((object)"on hidden");
			UIFollowerSelectMenuController obj3 = followerSelectInstance;
			((UIMenuBase)obj3).OnHidden = (Action)Delegate.Combine(((UIMenuBase)obj3).OnHidden, (Action)delegate
			{
				followerSelectInstance = null;
			});
			while ((Object)(object)followerSelectInstance != (Object)null && !Cancelled)
			{
				yield return null;
			}
			if (Cancelled)
			{
				yield break;
			}
			AudioManager.Instance.PlayOneShot("event:/ritual_sacrifice/select_follower", ((Component)PlayerFarming.Instance).gameObject);
			sacrificeFollower.Brain.CompleteCurrentTask();
			FollowerTask_ManualControl nextTask = new FollowerTask_ManualControl();
			sacrificeFollower.Brain.HardSwapToTask((FollowerTask)(object)nextTask);
			sacrificeFollower.Brain.InRitual = true;
			yield return null;
			sacrificeFollower.SetOutfit(sacrificeFollower.Brain.Info.Outfit, true, (Thought)0);
			TweenCallback val = default(TweenCallback);
			sacrificeFollower.HoodOff("idle", false, (Action)delegate
			{
				//IL_0034: Unknown result type (might be due to invalid IL or missing references)
				//IL_003b: Invalid comparison between Unknown and I4
				//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ee: 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_00f5: Expected O, but got Unknown
				//IL_00fa: Expected O, but got Unknown
				ChurchFollowerManager.Instance.RemoveBrainFromAudience(sacrificeFollower.Brain);
				foreach (FollowerBrain allBrain in FollowerBrain.AllBrains)
				{
					if ((int)allBrain.CurrentTaskType == 21)
					{
						allBrain.CurrentTask.RecalculateDestination();
						allBrain.CurrentTask.Setup(FollowerManager.FindFollowerByID(allBrain.Info.ID));
					}
				}
				sacrificeFollower.Spine.AnimationState.SetAnimation(1, "walk", true);
				TweenerCore<Vector3, Vector3, VectorOptions> obj4 = ShortcutExtensions.DOMove(((Component)sacrificeFollower).gameObject.transform, ((Component)Interaction_TempleAltar.Instance.PortalEffect).transform.position, 2.5f, false);
				TweenCallback obj5 = val;
				if (obj5 == null)
				{
					TweenCallback val2 = delegate
					{
						Interaction_TempleAltar.Instance.SimpleSetCamera.Reset(1f);
						((MonoBehaviour)GameManager.GetInstance()).StartCoroutine(PreSacrificeRoutine());
					};
					TweenCallback val3 = val2;
					val = val2;
					obj5 = val3;
				}
				TweenSettingsExtensions.OnComplete<TweenerCore<Vector3, Vector3, VectorOptions>>(obj4, obj5);
			});
			GameManager.GetInstance().OnConversationNext(((Component)sacrificeFollower).gameObject, 9f);
		}

		private IEnumerator PreSacrificeRoutine()
		{
			Plugin.Log.LogInfo((object)"Pre sacrifice routine");
			sacrificeFollower.Spine.AnimationState.SetAnimation(1, "devotion/devotion-collect-loopstart-whiteyes", false);
			yield return (object)new WaitForSeconds(1.3f);
			sacrificeFollower.Spine.AnimationState.SetAnimation(1, "devotion/devotion-collect-loop-whiteyes", true);
			foreach (TraitType trait in sacrificeFollower.Brain.Info.Traits)
			{
				yield return (object)new WaitForSeconds(1f);
				ResourceCustomTarget.Create(((Component)PlayerFarming.Instance).gameObject, ((Component)sacrificeFollower).transform.position, FollowerTrait.GetIcon(trait), (Action)null);
				AudioManager.Instance.PlayOneShot("event:/building/building_bell_ring", ((Component)PlayerFarming.Instance).gameObject);
			}
			((MonoBehaviour)GameManager.GetInstance()).StartCoroutine(DoSacrificeRoutine());
			yield return null;
		}

		private IEnumerator DoSacrificeRoutine()
		{
			GameManager.GetInstance().OnConversationNext(((Component)sacrificeFollower).gameObject, 4f);
			ChurchFollowerManager.Instance.PlayOverlay((OverlayType)2, "1", "", false);
			sacrificeFollower.Spine.AnimationState.Event += new TrackEntryEventDelegate(HandleSacrificeAnimationStateEvent);
			sacrificeFollower.State.CURRENT_STATE = (State)49;
			Ritual.FollowerToAttendSermon.Remove(sacrificeFollower.Brain);
			_ = (double)sacrificeFollower.SetBodyAnimation("sacrifice-tentacles", false);
			_ = sacrificeFollower.Brain.Info.ID;
			yield return (object)new WaitForSeconds(0.5f);
			((Ritual)this).PlaySacrificePortalEffect();
			Interaction_TempleAltar.Instance.PulseDisplacementObject(((Component)Interaction_TempleAltar.Instance.PortalEffect).transform.position);
			BiomeConstants.Instance.ChromaticAbberationTween(1f, BiomeConstants.Instance.ChromaticAberrationDefaultValue, 7f);
			foreach (FollowerBrain allBrain2 in FollowerBrain.AllBrains)
			{
				if ((int)allBrain2.CurrentTaskType == 21)
				{
					FollowerTask currentTask = allBrain2.CurrentTask;
					((FollowerTask_AttendRitual)((currentTask is FollowerTask_AttendRitual) ? currentTask : null)).WorshipTentacle();
				}
			}
			yield return (object)new WaitForSeconds(1.5f);
			foreach (FollowerBrain allBrain in FollowerBrain.AllBrains)
			{
				if ((int)allBrain.CurrentTaskType == 21)
				{
					FollowerTask currentTask2 = allBrain.CurrentTask;
					((FollowerTask_AttendRitual)((currentTask2 is FollowerTask_AttendRitual) ? currentTask2 : null)).Cheer();
				}
			}
			ChurchFollowerManager.Instance.StartRitualOverlay();
			AudioManager.Instance.PlayOneShot("event:/ritual_sacrifice/ritual_end", ((Component)PlayerFarming.Instance).gameObject);
			yield return (object)new WaitForSeconds(0.7f);
			Interaction_TempleAltar.Instance.PulseDisplacementObject(sacrificeFollower.CameraBone.transform.position);
			yield return (object)new WaitForSeconds(3.1666665f);
			Interaction_TempleAltar.Instance.PulseDisplacementObject(((Component)Interaction_TempleAltar.Instance.PortalEffect).transform.position);
			yield return (object)new WaitForSeconds(0.3f);
			GameManager.GetInstance().OnConversationNext(Interaction_TempleAltar.Instance.RitualCameraPosition, 8f);
			yield return (object)new WaitForSeconds(0.5f);
			yield return (object)new WaitForSeconds(1f);
			GameManager.GetInstance().OnConversationNext(Interaction_TempleAltar.Instance.RitualCameraPosition, 6f);
			((Ritual)this).StopSacrificePortalEffect();
			sacrificeFollower.Spine.AnimationState.Event -= new TrackEntryEventDelegate(HandleSacrificeAnimationStateEvent);
			foreach (FollowerBrain followerBrain in Ritual.FollowerToAttendSermon)
			{
				if ((int)sacrificeFollower.Brain.Info.CursedState == 146)
				{
					followerBrain.AddThought((Thought)178, false, false);
				}
			}
			FollowerManager.FollowerDie(sacrificeFollower.Brain.Info.ID, (NotificationType)33);
			Object.Destroy((Object)(object)((Component)sacrificeFollower).gameObject);
			JudgementMeter.ShowModify(DataManager.Instance.CultTraits.Contains((TraitType)9) ? 1 : (-1));
			ChurchFollowerManager.Instance.EndRitualOverlay();
			Interaction_TempleAltar.Instance.SimpleSetCamera.Reset(1f);
			DataManager instance = DataManager.Instance;
			instance.STATS_Sacrifices++;
			((MonoBehaviour)this).StartCoroutine(((Ritual)this).WaitFollowersFormCircle(false, true, 12f));
			yield return GetAbsorptionFollower();
		}

		private IEnumerator EndRitual()
		{
			Interaction_TempleAltar.Instance.SimpleSetCamera.Reset(1f);
			PlayerFarming.Instance.simpleSpineAnimator.Animate("rituals/ritual-stop", 0, false);
			PlayerFarming.Instance.simpleSpineAnimator.AddAnimate("idle", 0, true, 0f);
			yield return (object)new WaitForSeconds(2f / 3f);
		}

		private IEnumerator GetAbsorptionFollower()
		{
			UIFollowerSelectMenuController followerSelectInstance = GameObjectExtensions.Instantiate<UIFollowerSelectMenuController>(MonoSingleton<UIManager>.Instance.FollowerSelectMenuTemplate);
			followerSelectInstance.Show(Ritual.GetFollowerSelectEntriesForSermon(0, false), false, (Type)287, true, false, true, false);
			UIFollowerSelectMenuController obj = followerSelectInstance;
			((UIFollowerSelectBase<FollowerInformationBox>)(object)obj).OnFollowerSelected = (Action<FollowerInfo>)Delegate.Combine(((UIFollowerSelectBase<FollowerInformationBox>)(object)obj).OnFollowerSelected, (Action<FollowerInfo>)delegate(FollowerInfo followerInfo)
			{
				absorbtionFollower = FollowerManager.FindFollowerByID(followerInfo.ID);
				UIManager.PlayAudio("event:/ritual_sacrifice/ritual_begin");
			});
			UIFollowerSelectMenuController obj2 = followerSelectInstance;
			((UIMenuBase)obj2).OnHidden = (Action)Delegate.Combine(((UIMenuBase)obj2).OnHidden, (Action)delegate
			{
				followerSelectInstance = null;
			});
			while ((Object)(object)followerSelectInstance != (Object)null)
			{
				yield return null;
			}
			absorbtionFollower.Brain.CompleteCurrentTask();
			FollowerTask_ManualControl nextTask = new FollowerTask_ManualControl();
			absorbtionFollower.Brain.HardSwapToTask((FollowerTask)(object)nextTask);
			ChurchFollowerManager.Instance.RemoveBrainFromAudience(absorbtionFollower.Brain);
			foreach (FollowerBrain allBrain in FollowerBrain.AllBrains)
			{
				if ((int)allBrain.CurrentTaskType == 21)
				{
					allBrain.CurrentTask.RecalculateDestination();
					allBrain.CurrentTask.Setup(FollowerManager.FindFollowerByID(allBrain.Info.ID));
				}
			}
			absorbtionFollower.Spine.AnimationState.SetAnimation(1, "walk", true);
			TweenSettingsExtensions.OnComplete<TweenerCore<Vector3, Vector3, VectorOptions>>(ShortcutExtensions.DOMove(((Component)absorbtionFollower).gameObject.transform, ((Component)Interaction_TempleAltar.Instance.PortalEffect).transform.position, 2.5f, false), (TweenCallback)delegate
			{
				Interaction_TempleAltar.Instance.SimpleSetCamera.Reset(1f);
				((MonoBehaviour)GameManager.GetInstance()).StartCoroutine(FusionAddTraits());
			});
			yield return null;
		}

		private IEnumerator FusionAddTraits()
		{
			Plugin.Log.LogInfo((object)"Start fusion");
			absorbtionFollower.Brain.CompleteCurrentTask();
			FollowerTask_ManualControl nextTask = new FollowerTask_ManualControl();
			absorbtionFollower.Brain.HardSwapToTask((FollowerTask)(object)nextTask);
			absorbtionFollower.TimedAnimation("devotion/devotion-collect-loopstart", 1.3f, (Action)delegate
			{
				absorbtionFollower.SimpleAnimator.Animate("devotion/devotion-collect-loop", 1, true);
			}, true, true);
			yield return (object)new WaitForSeconds(1f);
			foreach (TraitType trait in sacrificeFollower.Brain.Info.Traits)
			{
				Plugin.Log.LogInfo((object)"Looping fusion");
				if (!absorbtionFollower.Brain.Info.Traits.Contains(trait))
				{
					ResourceCustomTarget.Create(((Component)absorbtionFollower).gameObject, ((Component)PlayerFarming.Instance).transform.position, FollowerTrait.GetIcon(trait), (Action)null);
					AudioManager.Instance.PlayOneShot("event:/building/building_bell_ring", ((Component)PlayerFarming.Instance).gameObject);
					absorbtionFollower.AddTrait(trait, false);
					yield return (object)new WaitForSeconds(0.5f);
				}
			}
			PlayerFarming.Instance.simpleSpineAnimator.Animate("rituals/ritual-stop", 0, false);
			PlayerFarming.Instance.simpleSpineAnimator.AddAnimate("idle", 0, true, 0f);
			float num3 = 0.5f;
			yield return (object)new WaitForSeconds(0.5f);
			foreach (FollowerBrain brain in Ritual.FollowerToAttendSermon)
			{
				float Delay = Random.Range(0.1f, 0.5f);
				num3 += Delay;
				((MonoBehaviour)this).StartCoroutine(((Ritual)this).DelayFollowerReaction(brain, Delay, true));
			}
			yield return (object)new WaitForSeconds(0.5f);
			((Ritual)this).CompleteRitual(false, -1, -1, true);
			yield return null;
		}

		private void HandleSacrificeAnimationStateEvent(TrackEntry trackEntry, Event e)
		{
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			switch (e.Data.Name)
			{
			case "CamOffset-Remove":
				GameManager.GetInstance().CamFollowTarget.SetOffset(Vector3.zero);
				BiomeConstants.Instance.DepthOfFieldTween(0.15f, 8.7f, 26f, 1f, 200f);
				BiomeConstants.Instance.ChromaticAbberationTween(1f, 1f, BiomeConstants.Instance.ChromaticAberrationDefaultValue);
				break;
			case "CamOffset-Add":
				GameManager.GetInstance().CamFollowTarget.SetOffset(new Vector3(0f, 0f, 1f));
				BiomeConstants.Instance.DepthOfFieldTween(0.5f, 7f, 8f, 1f, 150f);
				break;
			case "Shake-big":
				CameraManager.instance.ShakeCameraForDuration(0.6f, 0.7f, 0.6f, true);
				GameManager.GetInstance().OnConversationNext(sacrificeFollower.CameraBone, 8f);
				Interaction_TempleAltar.Instance.PulseDisplacementObject(sacrificeFollower.CameraBone.transform.position);
				BiomeConstants.Instance.ImpactFrameForDuration(0.2f, 0f);
				break;
			case "Shake-small":
				CameraManager.instance.ShakeCameraForDuration(0.4f, 0.5f, 0.3f, true);
				GameManager.GetInstance().OnConversationNext(sacrificeFollower.CameraBone, 6f);
				Interaction_TempleAltar.Instance.PulseDisplacementObject(sacrificeFollower.CameraBone.transform.position);
				break;
			}
		}
	}
	public class MassacreRitual : CustomRitual
	{
		public override string InternalName { get; } = "Massacre_Ritual";


		public override Sprite Sprite { get; } = TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/ritual_massres.png"));


		public override List<ItemCost> ItemCosts { get; } = new List<ItemCost>
		{
			new ItemCost(Plugin.StrangeMaterialItem, 12)
		};


		public override string GetLocalizedName => "Ritual of Massacre";

		public override string GetLocalizedDescription => "Kills every follower except 1 random follower.";

		public override float FaithChange { get; } = 10f;


		public override TraitType RitualTrait { get; } = (TraitType)0;


		public override float Cooldown => 60f;

		public override void Play()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			((Ritual)this).Play();
			ManualLogSource log = Plugin.Log;
			string? text = ((object)(Type)(ref upgradeType)).ToString();
			Type ritualType = ((Ritual)this).RitualType;
			log.LogInfo((object)("Starting ritual for " + text + " and " + ((object)(Type)(ref ritualType)).ToString()));
			((MonoBehaviour)GameManager.GetInstance()).StartCoroutine(RitualRoutine());
		}

		private IEnumerator RitualRoutine()
		{
			bool Cancelled = false;
			AudioManager.Instance.PlayOneShot("event:/rituals/generic_start_ritual");
			yield return ((MonoBehaviour)this).StartCoroutine(((Ritual)this).CentreAndAnimatePlayer());
			Interaction_TempleAltar.Instance.SimpleSetCamera.Play();
			yield return ((MonoBehaviour)this).StartCoroutine(((Ritual)this).WaitFollowersFormCircle(false, true, 12f));
			Bone obj = ((SkeletonRenderer)PlayerFarming.Instance.Spine).skeleton.FindBone("ritualring");
			obj.Rotation += 60f;
			((SkeletonRenderer)PlayerFarming.Instance.Spine).skeleton.UpdateWorldTransform();
			((SkeletonRenderer)PlayerFarming.Instance.Spine).skeleton.Update(Time.deltaTime);
			PlayerFarming.Instance.simpleSpineAnimator.Animate("rituals/ritual-start", 0, false);
			PlayerFarming.Instance.simpleSpineAnimator.AddAnimate("rituals/ritual-loop", 0, true, 0f);
			((Component)Interaction_TempleAltar.Instance.RitualLighting).gameObject.SetActive(true);
			ChurchFollowerManager.Instance.StartRitualOverlay();
			UIFollowerSelectMenuController followerSelectInstance = GameObjectExtensions.Instantiate<UIFollowerSelectMenuController>(MonoSingleton<UIManager>.Instance.FollowerSelectMenuTemplate);
			List<FollowerInfo> tempList = new List<FollowerInfo>();
			FollowerInfo selectedSurvivor = null;
			if (DataManager.Instance.Followers_Dead.Count > 0)
			{
				tempList.Add(DataManager.Instance.Followers_Dead[0]);
			}
			List<FollowerSelectEntry> FSE = Ritual.GetFollowerSelectEntriesForSermon(0, false);
			followerSelectInstance.Show(FSE, false, (Type)154, true, true, true, false);
			UIFollowerSelectMenuController obj2 = followerSelectInstance;
			((UIFollowerSelectBase<FollowerInformationBox>)(object)obj2).OnFollowerSelected = (Action<FollowerInfo>)Delegate.Combine(((UIFollowerSelectBase<FollowerInformationBox>)(object)obj2).OnFollowerSelected, (Action<FollowerInfo>)delegate(FollowerInfo followerInfo)
			{
				selectedSurvivor = followerInfo;
				UIManager.PlayAudio("event:/ritual_sacrifice/ritual_begin");
			});
			((UIMenuBase)followerSelectInstance).OnCancel = (Action)Delegate.Combine(((UIMenuBase)followerSelectInstance).OnCancel, (Action)delegate
			{
				((MonoBehaviour)GameManager.GetInstance()).StartCoroutine(EndRitual());
				Cancelled = true;
				((Ritual)this).CompleteRitual(true, -1, -1, true);
				((Ritual)this).CancelFollowers();
			});
			UIFollowerSelectMenuController obj3 = followerSelectInstance;
			((UIMenuBase)obj3).OnHidden = (Action)Delegate.Combine(((UIMenuBase)obj3).OnHidden, (Action)delegate
			{
				followerSelectInstance = null;
			});
			UIFollowerSelectMenuController obj4 = followerSelectInstance;
			((UIMenuBase)obj4).OnShow = (Action)Delegate.Combine(((UIMenuBase)obj4).OnShow, (Action)delegate
			{
				foreach (FollowerInformationBox followerInfoBox in ((UIFollowerSelectBase<FollowerInformationBox>)(object)followerSelectInstance).FollowerInfoBoxes)
				{
					int count = DataManager.Instance.Followers_Dead.Count;
					((TMP_Text)followerInfoBox.FollowerRole).text = "Select one follower to be left alive.";
				}
			});
			while ((Object)(object)followerSelectInstance != (Object)null && !Cancelled)
			{
				yield return null;
			}
			if (!Cancelled)
			{
				yield return (object)new WaitForSeconds(1.2f);
				ChurchFollowerManager.Instance.PlayOverlay((OverlayType)0, "resurrect", "", false);
				yield return (object)new WaitForSeconds(0.5f);
				((Ritual)this).PlaySacrificePortalEffect();
				foreach (FollowerBrain allBrain in FollowerBrain.AllBrains)
				{
					if ((int)allBrain.CurrentTaskType == 21)
					{
						FollowerTask currentTask = allBrain.CurrentTask;
						((FollowerTask_AttendRitual)((currentTask is FollowerTask_AttendRitual) ? currentTask : null)).WorshipTentacle();
					}
				}
				yield return (object)new WaitForSeconds(0.5f);
				AudioManager.Instance.PlayOneShot("event:/rituals/resurrect");
				yield return (object)new WaitForSeconds(1.2f);
				int groupResurrect = 0;
				ChurchFollowerManager.Instance.GodRays.gameObject.SetActive(true);
				ChurchFollowerManager.Instance.GodRays.GetComponent<ParticleSystem>().Play();
				((Component)ChurchFollowerManager.Instance.Goop).gameObject.SetActive(true);
				ChurchFollowerManager.Instance.Goop.Play("Show");
				((Renderer)((Component)ChurchFollowerManager.Instance.Goop).GetComponentInChildren<MeshRenderer>()).material.SetColor("_TintCOlor", Color.red);
				yield return (object)new WaitForSeconds(0.5f);
				bool survivor = false;
				new List<Follower>();
				foreach (FollowerSelectEntry fs in FSE)
				{
					if (!survivor && selectedSurvivor == null)
					{
						survivor = true;
						continue;
					}
					if (!survivor && fs.FollowerInfo == selectedSurvivor)
					{
						survivor = true;
						continue;
					}
					Follower killing = FollowerManager.FindFollowerByID(fs.FollowerInfo.ID);
					ChurchFollowerManager.Instance.RemoveBrainFromAudience(killing.Brain);
					killing.TimedAnimation("ascend", 1.3f, (Action)delegate
					{
						killing.Die((NotificationType)52, false, 1, "die", "dead", (Action<GameObject>)null, true);
					}, true, true);
					Ritual.FollowerToAttendSermon.Remove(killing.Brain);
					groupResurrect++;
					yield return (object)new WaitForSeconds(0.1f);
					if (groupResurrect >= 7)
					{
						yield return (object)new WaitForSeconds(0.33f);
						groupResurrect = 0;
					}
				}
				((Ritual)this).StopSacrificePortalEffect();
				ChurchFollowerManager.Instance.StopSacrificePortalEffect();
				((Component)ChurchFollowerManager.Instance.Goop).gameObject.SetActive(false);
				ChurchFollowerManager.Instance.GodRays.SetActive(false);
				ChurchFollowerManager.Instance.Sparkles.Stop();
				PlayerFarming.Instance.simpleSpineAnimator.Animate("rituals/ritual-stop", 0, false);
				PlayerFarming.Instance.simpleSpineAnimator.AddAnimate("idle", 0, true, 0f);
				foreach (FollowerBrain followerBrain in Ritual.FollowerToAttendSermon)
				{
					if (followerBrain.CurrentTask is FollowerTask_AttendRitual)
					{
						FollowerTask currentTask2 = followerBrain.CurrentTask;
						((FollowerTask_AttendRitual)((currentTask2 is FollowerTask_AttendRitual) ? currentTask2 : null)).Cheer();
					}
				}
				yield return (object)new WaitForSeconds(7f);
			}
			ChurchFollowerManager.Instance.EndRitualOverlay();
			GameManager.GetInstance().CamFollowTarget.targetDistance = 11f;
			((Component)Interaction_TempleAltar.Instance.RitualLighting).gameObject.SetActive(false);
			Interaction_TempleAltar.Instance.SimpleSetCamera.Reset(1f);
			((Ritual)this).CompleteRitual(false, -1, -1, true);
		}

		private IEnumerator EndRitual()
		{
			Interaction_TempleAltar.Instance.SimpleSetCamera.Reset(1f);
			PlayerFarming.Instance.simpleSpineAnimator.Animate("rituals/ritual-stop", 0, false);
			PlayerFarming.Instance.simpleSpineAnimator.AddAnimate("idle", 0, true, 0f);
			yield return (object)new WaitForSeconds(2f / 3f);
		}
	}
	public class MassResurrectionRitual : CustomRitual
	{
		public override string InternalName { get; } = "MassResurrection_Ritual";


		public override Sprite Sprite { get; } = TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/ritual_massres.png"));


		public override List<ItemCost> ItemCosts { get; } = new List<ItemCost>
		{
			new ItemCost(Plugin.StrangeMaterialItem, 12)
		};


		public override string GetLocalizedName => "Mass Resurrection Ritual";

		public override string GetLocalizedDescription => "Resurrects all dead followers. Beware, your cult may be flooded with followers!";

		public override float FaithChange { get; } = 10f;


		public override TraitType RitualTrait { get; } = (TraitType)0;


		public override float Cooldown => 60f;

		public override void Play()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			((Ritual)this).Play();
			ManualLogSource log = Plugin.Log;
			string? text = ((object)(Type)(ref upgradeType)).ToString();
			Type ritualType = ((Ritual)this).RitualType;
			log.LogInfo((object)("Starting ritual for " + text + " and " + ((object)(Type)(ref ritualType)).ToString()));
			((MonoBehaviour)GameManager.GetInstance()).StartCoroutine(RitualRoutine());
		}

		private IEnumerator RitualRoutine()
		{
			bool Cancelled = false;
			AudioManager.Instance.PlayOneShot("event:/rituals/generic_start_ritual");
			yield return ((MonoBehaviour)this).StartCoroutine(((Ritual)this).CentreAndAnimatePlayer());
			Interaction_TempleAltar.Instance.SimpleSetCamera.Play();
			yield