Decompiled source of HalcyonSeedBuff v1.1.2

plugins/HalcyonSeedBuff.dll

Decompiled a month ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using EntityStates;
using EntityStates.BrotherMonster;
using EntityStates.MeridianEvent;
using EntityStates.Missions.BrotherEncounter;
using HalcyonSeedBuff.Changes;
using IL.RoR2;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.EntityStates.BrotherMonster;
using On.EntityStates.MeridianEvent;
using On.EntityStates.Missions.BrotherEncounter;
using On.RoR2;
using RoR2;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("HalcyonSeedBuff")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("HalcyonSeedBuff")]
[assembly: AssemblyTitle("HalcyonSeedBuff")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
namespace HalcyonSeedBuff
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.kking117.HalcyonSeedBuff", "HalcyonSeedBuff", "1.1.2")]
	public class MainPlugin : BaseUnityPlugin
	{
		public const string MODUID = "com.kking117.HalcyonSeedBuff";

		public const string MODNAME = "HalcyonSeedBuff";

		public const string MODTOKEN = "KKING117_HALCYONSEEDBUFF_";

		public const string MODVERSION = "1.1.2";

		internal static ManualLogSource ModLogger;

		public static int Halcyon_ItemMult = 2;

		public static bool Halcyon_CanBeStolen = true;

		public static bool Halcyon_ChannelTeamFix = false;

		public static int ChannelOn_MoonPhase = 2;

		public static int ChannelOn_MeridianPhase = 3;

		public static bool ChannelOn_Focus = true;

		public static bool ChannelOn_VoidRaid = true;

		public static bool FalseSon_PlayerLoyal = true;

		public static bool FalseSon_BossLoyal = true;

		public static string FalseSon_BodyList = "FalseSonBody, FalseSonBossBody, FalseSonBossBodyLunarShard, FalseSonBossBodyBrokenLunarShard";

		public void Awake()
		{
			ModLogger = ((BaseUnityPlugin)this).Logger;
			ReadConfig();
			HalcyonSeed.EnableChanges();
		}

		public void ReadConfig()
		{
			Halcyon_ItemMult = ((BaseUnityPlugin)this).Config.Bind<int>("Halcyon Seed", "Effect Multiplier", 2, "Multiplies the Halcyon Seed count by this much when calculating Aurelionite's health and damage.").Value;
			Halcyon_CanBeStolen = ((BaseUnityPlugin)this).Config.Bind<bool>("Halcyon Seed", "Can Be Stolen", true, "Allows Mithrix to steal and channel Halcyon Seeds. (Set Spawn Against Mithrix to 0-3 for this to work.)").Value;
			ChannelOn_Focus = ((BaseUnityPlugin)this).Config.Bind<bool>("Channel", "Spawn On Focus", true, "Attempt to channel Aurelionite when activating the Focus.").Value;
			ChannelOn_VoidRaid = ((BaseUnityPlugin)this).Config.Bind<bool>("Channel", "Spawn On Void Raid", true, "Attempt to channel Aurelionite at the start of each Voidling phase.").Value;
			ChannelOn_MoonPhase = ((BaseUnityPlugin)this).Config.Bind<int>("Channel", "Spawn Against Mithrix", 2, "Attempt to channel Aurelionite on this phase during the Mithrix fight. (0-4) (0 = Don't spawn, 4 = Vanilla)").Value;
			ChannelOn_MeridianPhase = ((BaseUnityPlugin)this).Config.Bind<int>("Channel", "Spawn Against False Son", 3, "Attempt to channel Aurelionite on this phase during the False Son fight. (0-3) (0 = Don't spawn, 3 = Vanilla)").Value;
			FalseSon_PlayerLoyal = ((BaseUnityPlugin)this).Config.Bind<bool>("False Son", "Loyal to Playable False Son", true, "If Aurelionite is channeled and a False Son Player exists then Aurelionite will be forced onto their team instead. (Has priority over 'Loyal to NPC False Son'.)").Value;
			FalseSon_BossLoyal = ((BaseUnityPlugin)this).Config.Bind<bool>("False Son", "Loyal to NPC False Son", true, "If Aurelionite is channeled and a False Son NPC exists then Aurelionite will be forced onto their team instead.").Value;
			FalseSon_BodyList = ((BaseUnityPlugin)this).Config.Bind<string>("False Son", "Body List", "FalseSonBody, FalseSonBossBody, FalseSonBossBodyLunarShard, FalseSonBossBodyBrokenLunarShard", "List of bodies that count as False Son.").Value;
		}
	}
}
namespace HalcyonSeedBuff.Changes
{
	public class HalcyonSeed
	{
		private static float SummonTimer = -1f;

		private static float DisbandTimer = -1f;

		private static float BodyRadiusMult = 8f;

		private static Vector3 BodyOffset = new Vector3(1f, 0f, 0f);

		private static Vector3 MoonPosition = new Vector3(-87.4f, 491.95f, -2.54f);

		private static Vector3 MeridianPosition = new Vector3(92.7f, 152.4f, -143.5f);

		private static Vector3 SpawnLocation;

		private static List<MasterIndex> VoidlingIndices = new List<MasterIndex>();

		private static MasterIndex MithrixIndex = MasterIndex.none;

		private static List<BodyIndex> FalseSonBodies = new List<BodyIndex>();

		private static List<MasterIndex> FalseSonIndices = new List<MasterIndex>();

		public static void EnableChanges()
		{
			ClampConfig();
			Hooks();
		}

		private static void ClampConfig()
		{
			MainPlugin.Halcyon_ItemMult = Math.Max(1, MainPlugin.Halcyon_ItemMult);
			MainPlugin.ChannelOn_MeridianPhase = Math.Clamp(MainPlugin.ChannelOn_MeridianPhase, 0, 3);
		}

		private static void EditTags()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Invalid comparison between Unknown and I4
			ItemDef val = Addressables.LoadAssetAsync<ItemDef>((object)"RoR2/Base/TitanGoldDuringTP/TitanGoldDuringTP.asset").WaitForCompletion();
			if (!Object.op_Implicit((Object)(object)val))
			{
				return;
			}
			List<ItemTag> list = val.tags.ToList();
			for (int i = 0; i < list.Count; i++)
			{
				if ((int)list[i] == 12)
				{
					list.RemoveAt(i);
					i--;
				}
			}
			val.tags = list.ToArray();
		}

		private static void Hooks()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Expected O, but got Unknown
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Expected O, but got Unknown
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Expected O, but got Unknown
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Expected O, but got Unknown
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Expected O, but got Unknown
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Expected O, but got Unknown
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Expected O, but got Unknown
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Expected O, but got Unknown
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Expected O, but got Unknown
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Expected O, but got Unknown
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Expected O, but got Unknown
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Expected O, but got Unknown
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Expected O, but got Unknown
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Expected O, but got Unknown
			//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Expected O, but got Unknown
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Expected O, but got Unknown
			//IL_020d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Expected O, but got Unknown
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Expected O, but got Unknown
			MainPlugin.ModLogger.LogInfo((object)"Applying IL modifications");
			GoldTitanManager.TryStartChannelingTitansServer += new Manipulator(IL_TrySpawnTitan);
			GoldTitanManager.OnBossGroupStartServer += new hook_OnBossGroupStartServer(GoldTitanManager_OnBossGroupStartServer);
			if (MainPlugin.ChannelOn_Focus)
			{
				InfiniteTowerRun.OnSafeWardActivated += new hook_OnSafeWardActivated(InfiniteTowerRun_OnSafeWardActivated);
				InfiniteTowerRun.MoveSafeWard += new hook_MoveSafeWard(InfiniteTowerRun_MoveSafeWard);
				InfiniteTowerRun.OnWaveAllEnemiesDefeatedServer += new hook_OnWaveAllEnemiesDefeatedServer(InfiniteTowerRun_OnWaveFinish);
			}
			if (MainPlugin.ChannelOn_MoonPhase != 4)
			{
				switch (MainPlugin.ChannelOn_MoonPhase)
				{
				case 1:
					Phase1.OnEnter += new hook_OnEnter(Moon_Phase1);
					break;
				case 2:
					Phase2.OnEnter += new hook_OnEnter(Moon_Phase2);
					break;
				case 3:
					Phase3.OnEnter += new hook_OnEnter(Moon_Phase3);
					break;
				}
			}
			if (MainPlugin.ChannelOn_MeridianPhase != 0)
			{
				switch (MainPlugin.ChannelOn_MeridianPhase)
				{
				case 1:
					Phase1.OnEnter += new hook_OnEnter(Meridian_Phase1);
					break;
				case 2:
					Phase2.OnEnter += new hook_OnEnter(Meridian_Phase2);
					break;
				case 3:
					Phase3.OnEnter += new hook_OnEnter(Meridian_Phase3);
					break;
				}
				Phase3.OnExit += new hook_OnExit(Meridian_Finish);
			}
			if (MainPlugin.Halcyon_CanBeStolen)
			{
				EditTags();
				SpellChannelEnterState.OnEnter += new hook_OnEnter(OnItemSteal_Enter);
				SpellChannelExitState.OnExit += new hook_OnExit(OnItemSteal_End);
			}
			else if (MainPlugin.ChannelOn_MoonPhase == 4)
			{
				Phase4.OnEnter += new hook_OnEnter(Moon_Phase4);
			}
			EncounterFinished.OnEnter += new hook_OnEnter(OnEncounterFinish);
			Run.FixedUpdate += new hook_FixedUpdate(Run_FixedUpdate);
			Run.BeginStage += new hook_BeginStage(Run_BeginStage);
			MasterCatalog.Init += new hook_Init(MasterCatalog_Init);
			GoldTitanManager.CalcTitanPowerAndBestTeam += new hook_CalcTitanPowerAndBestTeam(CalcTitanPowerAndTeam);
		}

		private static void MasterCatalog_Init(orig_Init orig)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Invalid comparison between Unknown and I4
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke();
			MithrixIndex = MasterCatalog.FindMasterIndex("BrotherHurtMaster");
			VoidlingIndices.Add(MasterCatalog.FindMasterIndex("MiniVoidRaidCrabMasterPhase1"));
			VoidlingIndices.Add(MasterCatalog.FindMasterIndex("MiniVoidRaidCrabMasterPhase2"));
			VoidlingIndices.Add(MasterCatalog.FindMasterIndex("MiniVoidRaidCrabMasterPhase3"));
			FalseSonIndices.Add(MasterCatalog.FindMasterIndex("FalseSonBossMaster"));
			FalseSonIndices.Add(MasterCatalog.FindMasterIndex("FalseSonBossLunarShardMaster"));
			FalseSonIndices.Add(MasterCatalog.FindMasterIndex("FalseSonBossLunarShardBrokenMaster"));
			string[] array = MainPlugin.FalseSon_BodyList.Split(',');
			for (int i = 0; i < array.Length; i++)
			{
				BodyIndex val = BodyCatalog.FindBodyIndex(array[i].Trim());
				if ((int)val > -1)
				{
					FalseSonBodies.Add(val);
				}
				else
				{
					Debug.LogWarning((object)("HalcyonSeedBuff: Could not find body '" + array[i] + "'"));
				}
			}
		}

		private static void Run_BeginStage(orig_BeginStage orig, Run self)
		{
			orig.Invoke(self);
			SummonTimer = -1f;
			DisbandTimer = -1f;
		}

		private static void Run_FixedUpdate(orig_FixedUpdate orig, Run self)
		{
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			if (!NetworkServer.active)
			{
				return;
			}
			if (DisbandTimer > 0f)
			{
				DisbandTimer -= Time.fixedDeltaTime;
				if (DisbandTimer <= 0f)
				{
					GoldTitanManager.KillTitansInList(GoldTitanManager.currentTitans);
				}
			}
			if (SummonTimer > 0f)
			{
				SummonTimer -= Time.fixedDeltaTime;
				if (SummonTimer <= 0f && GoldTitanManager.currentTitans.Count > -1)
				{
					GoldTitanManager.TryStartChannelingTitansServer((object)self, SpawnLocation, (Vector3?)null, (Action)null);
				}
			}
		}

		private static void CalcTitanPowerAndTeam(orig_CalcTitanPowerAndBestTeam orig, out int returnItemCount, out TeamIndex returnTeamIndex)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Invalid comparison between Unknown and I4
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Invalid comparison between Unknown and I4
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: 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_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_022d: Unknown result type (might be due to invalid IL or missing references)
			//IL_022f: Expected I4, but got Unknown
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_020d: Invalid comparison between Unknown and I4
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Invalid comparison between Unknown and I4
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			GoldTitanManager.isFalseSonBossLunarShardBrokenMaster = false;
			bool flag = false;
			if (MainPlugin.FalseSon_PlayerLoyal || MainPlugin.FalseSon_BossLoyal)
			{
				flag = true;
			}
			int num = 0;
			TeamIndex val = (TeamIndex)1;
			TeamIndex val2 = (TeamIndex)0;
			TeamIndex val3 = (TeamIndex)0;
			int num2 = 0;
			int num3 = 0;
			TeamIndex val4 = (TeamIndex)0;
			while ((int)val4 < 5)
			{
				int itemCountForTeam = Util.GetItemCountForTeam(val4, GoldTitanManager.goldTitanItemIndex, true, true);
				if ((int)val == 1)
				{
					if (itemCountForTeam >= num)
					{
						num = itemCountForTeam;
						val = val4;
					}
				}
				else if (itemCountForTeam > num)
				{
					num = itemCountForTeam;
					val = val4;
				}
				if (flag)
				{
					int num4 = 0;
					int num5 = 0;
					foreach (TeamComponent teamMember in TeamComponent.GetTeamMembers(val4))
					{
						CharacterBody body = teamMember.body;
						if (!Object.op_Implicit((Object)(object)body))
						{
							continue;
						}
						CharacterMaster master = body.master;
						if (Object.op_Implicit((Object)(object)master) && FalseSonBodies.Count > 0 && FalseSonBodies.Contains(body.bodyIndex))
						{
							if (body.isPlayerControlled)
							{
								num4++;
							}
							else
							{
								num5++;
							}
						}
					}
					if ((int)val4 == 1)
					{
						if (num4 > 0)
						{
							num4++;
						}
						if (num5 > 0)
						{
							num5++;
						}
					}
					if (num4 > num2)
					{
						num2 = num4;
						val2 = val4;
					}
					if (num5 > num3)
					{
						num3 = num5;
						val3 = val4;
					}
				}
				val4 = (TeamIndex)(sbyte)(val4 + 1);
			}
			if (MainPlugin.FalseSon_BossLoyal && num3 > 0)
			{
				val = val3;
			}
			if (MainPlugin.FalseSon_PlayerLoyal && num2 > 0 && num2 >= num3)
			{
				val = val2;
			}
			if (num > 0)
			{
				num = (((int)val != 1) ? 1 : (num * MainPlugin.Halcyon_ItemMult));
			}
			returnItemCount = num;
			returnTeamIndex = (TeamIndex)(int)val;
		}

		private static void GoldTitanManager_OnBossGroupStartServer(orig_OnBossGroupStartServer orig, BossGroup self)
		{
			//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)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			bool flag = false;
			bool flag2 = false;
			CombatSquad combatSquad = self.combatSquad;
			foreach (CharacterMaster readOnlyMembers in combatSquad.readOnlyMembersList)
			{
				if (readOnlyMembers.masterIndex == MithrixIndex)
				{
					flag = true;
					break;
				}
				if (FalseSonIndices.Count > 0 && FalseSonIndices.Contains(readOnlyMembers.masterIndex))
				{
					flag2 = true;
					break;
				}
				if (MainPlugin.ChannelOn_VoidRaid)
				{
					VoidRaidGauntletController instance = VoidRaidGauntletController.instance;
					if (Object.op_Implicit((Object)(object)instance) && VoidlingIndices.Count > 0 && VoidlingIndices.Contains(readOnlyMembers.masterIndex))
					{
						DisbandTimer = 1f;
						SummonTimer = 10f;
						SpawnLocation = instance.currentDonut.crabPosition.position;
					}
				}
			}
			if (!flag && !flag2)
			{
				orig.Invoke(self);
			}
		}

		private static void Moon_Phase1(orig_OnEnter orig, Phase1 self)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			if (NetworkServer.active)
			{
				SummonTimer = 5.5f;
				SpawnLocation = MoonPosition;
			}
		}

		private static void Moon_Phase2(orig_OnEnter orig, Phase2 self)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			if (NetworkServer.active)
			{
				SummonTimer = 3f;
				SpawnLocation = MoonPosition;
			}
		}

		private static void Moon_Phase3(orig_OnEnter orig, Phase3 self)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			if (NetworkServer.active)
			{
				SummonTimer = 6f;
				SpawnLocation = MoonPosition;
			}
		}

		private static void Moon_Phase4(orig_OnEnter orig, Phase4 self)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			if (NetworkServer.active)
			{
				SummonTimer = 10f;
				SpawnLocation = MoonPosition;
			}
		}

		private static void OnItemSteal_Enter(orig_OnEnter orig, SpellChannelEnterState self)
		{
			orig.Invoke(self);
			if (NetworkServer.active)
			{
				GoldTitanManager.KillTitansInList(GoldTitanManager.currentTitans);
				DisbandTimer = -1f;
				SummonTimer = -1f;
			}
		}

		private static void OnItemSteal_End(orig_OnExit orig, SpellChannelExitState self)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			if (NetworkServer.active)
			{
				SummonTimer = 1f;
				SpawnLocation = ((EntityState)self).characterBody.footPosition + (((EntityState)self).characterBody.radius + BodyRadiusMult) * BodyOffset;
			}
		}

		private static void OnEncounterFinish(orig_OnEnter orig, EncounterFinished self)
		{
			orig.Invoke(self);
			if (NetworkServer.active)
			{
				DisbandTimer = 3f;
				SummonTimer = -1f;
			}
		}

		private static void Meridian_Phase1(orig_OnEnter orig, Phase1 self)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			if (NetworkServer.active)
			{
				SummonTimer = 9f;
				SpawnLocation = MeridianPosition;
			}
		}

		private static void Meridian_Phase2(orig_OnEnter orig, Phase2 self)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			if (NetworkServer.active)
			{
				SummonTimer = 3f;
				SpawnLocation = MeridianPosition;
			}
		}

		private static void Meridian_Phase3(orig_OnEnter orig, Phase3 self)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			if (NetworkServer.active)
			{
				SummonTimer = 6f;
				SpawnLocation = MeridianPosition;
			}
		}

		private static void Meridian_Finish(orig_OnExit orig, Phase3 self)
		{
			orig.Invoke(self);
			if (NetworkServer.active)
			{
				DisbandTimer = 0.1f;
				SummonTimer = -1f;
			}
		}

		private static void InfiniteTowerRun_OnSafeWardActivated(orig_OnSafeWardActivated orig, InfiniteTowerRun self, InfiniteTowerSafeWardController safeWard)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self, safeWard);
			if (NetworkServer.active && Object.op_Implicit((Object)(object)safeWard))
			{
				SummonTimer = 3f;
				SpawnLocation = ((Component)safeWard).transform.position;
			}
		}

		private static void InfiniteTowerRun_OnWaveFinish(orig_OnWaveAllEnemiesDefeatedServer orig, InfiniteTowerRun self, InfiniteTowerWaveController wc)
		{
			orig.Invoke(self, wc);
			if (NetworkServer.active && self.IsStageTransitionWave())
			{
				DisbandTimer = 3f;
			}
		}

		private static void InfiniteTowerRun_MoveSafeWard(orig_MoveSafeWard orig, InfiniteTowerRun self)
		{
			orig.Invoke(self);
			if (NetworkServer.active)
			{
				DisbandTimer = 3f;
				SummonTimer = -1f;
			}
		}

		private static void IL_TrySpawnTitan(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext(new Func<Instruction, bool>[4]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 1),
				(Instruction x) => ILPatternMatchingExt.MatchStfld(x, typeof(DirectorSpawnRequest), "ignoreTeamMemberLimit"),
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 4),
				(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 1)
			}))
			{
				val.Index += 3;
				val.Remove();
				val.Emit(OpCodes.Ldloc, 2);
			}
			else
			{
				Debug.LogError((object)"HalcyonSeedBuff: Enforce Team - IL Hook failed");
			}
		}
	}
}