Decompiled source of SwanSongExtended v0.1.0

SwanSongExtended.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using BetterSoulCost;
using BossDropRework;
using EntityStates;
using EntityStates.AI.Walker;
using EntityStates.Bandit2;
using EntityStates.BrotherMonster.Weapon;
using EntityStates.Captain.Weapon;
using EntityStates.CaptainSupplyDrop;
using EntityStates.Engi.EngiMissilePainter;
using EntityStates.GrandParent;
using EntityStates.LaserTurbine;
using EntityStates.Mage.Weapon;
using EntityStates.Missions.BrotherEncounter;
using EntityStates.MoonElevator;
using EntityStates.NullifierMonster;
using EntityStates.TeleporterHealNovaController;
using HG;
using HG.BlendableTypes;
using HarmonyLib;
using IL.RoR2;
using IL.RoR2.Items;
using IL.RoR2.Orbs;
using KinematicCharacterController;
using MissileRework;
using Mono.Cecil;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using MonoMod.RuntimeDetour;
using MoreStats;
using On.EntityStates;
using On.EntityStates.Captain.Weapon;
using On.EntityStates.Engi.EngiMissilePainter;
using On.EntityStates.LaserTurbine;
using On.EntityStates.Mage.Weapon;
using On.EntityStates.Missions.BrotherEncounter;
using On.EntityStates.TeleporterHealNovaController;
using On.RoR2;
using On.RoR2.Items;
using On.RoR2.Orbs;
using R2API;
using R2API.Utils;
using RainrotSharedUtils;
using RainrotSharedUtils.Components;
using RainrotSharedUtils.Frost;
using RainrotSharedUtils.Shelters;
using RoR2;
using RoR2.Achievements;
using RoR2.Artifacts;
using RoR2.Audio;
using RoR2.CharacterAI;
using RoR2.ContentManagement;
using RoR2.EntitlementManagement;
using RoR2.ExpansionManagement;
using RoR2.Hologram;
using RoR2.Navigation;
using RoR2.Orbs;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2.UI;
using RoR2BepInExPack.GameAssetPaths;
using SwanSongExtended.Artifacts;
using SwanSongExtended.Characters;
using SwanSongExtended.Components;
using SwanSongExtended.Elites;
using SwanSongExtended.Equipment;
using SwanSongExtended.Equipment.Zapinator;
using SwanSongExtended.Interactables;
using SwanSongExtended.Items;
using SwanSongExtended.Modules;
using SwanSongExtended.Scavengers;
using SwanSongExtended.Skills;
using SwanSongExtended.States;
using SwanSongExtended.Storms;
using ThreeEyedGames;
using Unity;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.Rendering;
using UnityEngine.ResourceManagement.AsyncOperations;
using UnityEngine.SceneManagement;

[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("SwanSongExtended")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SwanSongExtended")]
[assembly: AssemblyTitle("SwanSongExtended")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: UnverifiableCode]
namespace RiskierRainContent.Interactables
{
	internal static class CombatEncounterHelper
	{
		public enum CustomDirectorType
		{
			GalleryDirector = 1,
			ConstructDirector
		}

		public static GameObject MethodOne(PurchaseInteraction purchaseInteraction, Interactor activator, int credits, CustomDirectorType directorType)
		{
			//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_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_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Expected O, but got Unknown
			Vector3 val = Vector3.zero;
			Quaternion rotation = Quaternion.identity;
			Transform transform = ((Component)purchaseInteraction).gameObject.transform;
			if (Object.op_Implicit((Object)(object)transform))
			{
				val = transform.position;
				rotation = transform.rotation;
			}
			GameObject val2 = LegacyResourcesAPI.Load<GameObject>("Prefabs/NetworkedObjects/Encounters/MonstersOnShrineUseEncounter");
			if ((Object)(object)val2 == (Object)null)
			{
				return null;
			}
			GameObject val3 = Object.Instantiate<GameObject>(val2, val, Quaternion.identity);
			NetworkServer.Spawn(val3);
			CombatDirector component = val3.GetComponent<CombatDirector>();
			ParseDirectorType(((Component)component).gameObject, directorType);
			if (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)Stage.instance))
			{
				return null;
			}
			float num = (float)credits * Stage.instance.entryDifficultyCoefficient;
			DirectorCard val4 = component.SelectMonsterCardForCombatShrine(num);
			if (val4 != null)
			{
				component.CombatShrineActivation(activator, num, val4);
				EffectData val5 = new EffectData
				{
					origin = val,
					rotation = rotation
				};
				if (directorType == CustomDirectorType.ConstructDirector)
				{
					GameObject val6 = LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/MonstersOnShrineUse");
					EffectManager.SpawnEffect(val6, val5, true);
				}
			}
			return val3;
		}

		public static void ParseDirectorType(GameObject obj, CustomDirectorType value)
		{
			switch (value)
			{
			case CustomDirectorType.GalleryDirector:
				obj.AddComponent<GalleryDirector>();
				break;
			case CustomDirectorType.ConstructDirector:
				obj.AddComponent<ConstructDirector>();
				break;
			default:
				obj.AddComponent<GalleryDirector>();
				break;
			}
		}
	}
	internal class GalleryDirector : MonoBehaviour
	{
	}
	internal class ConstructDirector : MonoBehaviour
	{
	}
}
namespace SwanSongExtended
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	[R2APISubmoduleDependency(new string[] { "LanguageAPI", "PrefabAPI", "RecalculateStatsAPI", "DotAPI" })]
	[BepInPlugin("com.RiskOfBrainrot.SwanSongExtended", "SwanSongExtended", "0.1.0")]
	public class SwanSongPlugin : BaseUnityPlugin
	{
		public delegate void orig_idc(LaserTurbineController self);

		private class ResDiscContext
		{
			public LaserTurbineController laserTurbineController;

			public ResDiscContext(LaserTurbineController passive)
			{
				laserTurbineController = passive;
			}
		}

		public static int ignitionTankBurnChance = 15;

		public float ignitionBurnDamage = 2f;

		public float ignitionBurnDuration = 2f;

		private bool shouldIgnitionDamageAndDurationCompound = false;

		public static int stacheBurnChance = 25;

		public static int brandBurnChance = 30;

		public static float pillarDropOffset = 2.5f;

		public static float pillarDropForce = 20f;

		public static int baseRewardCount = 1;

		public static bool scaleRewardsByPlayerCount = true;

		public static int brittleCrownStealCountBase = 2;

		public static int brittleCrownStealCountStack = 1;

		public static float crownCommonStealSoulCost = 0.25f;

		public static float crownUncommonStealSoulCost = 0.5f;

		public static float crownRareStealSoulCost = 0.8f;

		private string common = Tools.ConvertDecimal(crownCommonStealSoulCost);

		private string uncommon = Tools.ConvertDecimal(crownUncommonStealSoulCost);

		private string rare = Tools.ConvertDecimal(crownRareStealSoulCost);

		public static float cooldown = 90f;

		public static float secondsPerCost = 0.5f;

		public static float foconMinRadius = 8f;

		public static float foconRadiusMultiplier = 0.5f;

		public static float foconChargeBonus = 1f;

		public static int foconMaxStack = 5;

		public static float gestureEquipBreakChance = 40f;

		public static int gestureStockBase = 4;

		public static int gestureStockStack = 2;

		public static float gestureCdiBase = 1f;

		public static float gestureCdiStack = 0.5f;

		public static float hauntExecutionThreshold = 0.25f;

		private float ghostSpawnChanceOnExecute = 100f;

		private float ghostDurationPerStack = 6.66f;

		public static float harpoonBarrierBase = 6f;

		public static float harpoonBarrierStack = 6f;

		public static float harpoonTargetTime = 15f;

		public static float harpoonDecayReduction = 0.2f;

		public static Material harpoonTargetMaterial;

		public int scopeBaseCrit = 5;

		public int scopeStackCrit = 0;

		public int scopeBaseStationaryCrit = 40;

		public int scopeStackStationaryCrit = 0;

		public static ItemDef seedItemDef;

		public static float seedRegenDurationBase = 0.25f;

		public static float seedRegenDurationStack = 0.25f;

		public static float sunDurationBase = 10f;

		public static float sunDurationStack = 5f;

		private static float razorwireArmorBase = 8f;

		private static float razorwireArmorStack = 8f;

		private static float razorwireRangeBase = 40f;

		private static float razorwireRangeStack = 0f;

		private static float razorwireTargetsBase = 5f;

		private static float razorwireTargetsStack = 2f;

		private static float razorwireBleedDuration = 5f;

		private static float razorwireDamage = 3.6f;

		private static float razorwireProcCoeff = 0.2f;

		private static float razorwireCooldown = 1f;

		public static GameObject laserTurbineControllerPrefab;

		private readonly Dictionary<EntityState, ResDiscContext> resDiscStateContext = new Dictionary<EntityState, ResDiscContext>();

		public static SpawnCard exploderCard = Resources.Load<SpawnCard>("spawncards/characterspawncards/cscLunarExploder");

		private List<DirectorCard> exploderCards = new List<DirectorCard>();

		public static ExploderDirector exploderDirector;

		internal static float phaseTwoRate = 0f;

		internal static float phaseThreeRate = 1f;

		public const string guid = "com.RiskOfBrainrot.SwanSongExtended";

		public const string teamName = "RiskOfBrainrot";

		public const string modName = "SwanSongExtended";

		public const string version = "0.1.0";

		public const string expansionName = "Swan Song";

		public const string expansionName2 = "Secrets of the Scug";

		public const string expansionToken = "EXPANSION2R4R";

		public const string expansionToken2 = "EXPANSIONSOTS";

		public const string DEVELOPER_PREFIX = "FRUIT";

		public static SwanSongPlugin instance;

		public static ExpansionDef expansionDefSS2;

		public static ExpansionDef expansionDefSOTS;

		public const string iconsPath = "";

		private BuffDef brittleCrownBuff => CommonAssets.brittleCrownCursePurchase;

		private static float minSpin => LaserTurbineController.minSpin;

		private static float maxSpin => LaserTurbineController.maxSpin;

		private static float spinPerKill => LaserTurbineController.spinGeneratedOnKill;

		private static float spinDecayRate => LaserTurbineController.spinDecayPerSecondAfterRefresh;

		private GameObject meatballNapalmPool => CommonAssets.meatballNapalmPool;

		public static AssetBundle mainAssetBundle => CommonAssets.mainAssetBundle;

		public static AssetBundle orangeAssetBundle => CommonAssets.orangeAssetBundle;

		public static AssetBundle retierAssetBundle => CommonAssets.retierAssetBundle;

		public static bool iabMissilesLoaded => ModLoaded("com.HouseOfFruits.IAmBecomeMissiles");

		public static bool isAELoaded => ModLoaded("com.Borbo.ArtificerExtended");

		public static bool is2R4RLoaded => ModLoaded("com.HouseOfFruits.RiskierRain");

		public static bool isHBULoaded => ModLoaded("com.Borbo.HuntressBuffULTIMATE");

		public static bool isScepterLoaded => ModLoaded("com.DestroyedClone.AncientScepter");

		public static bool autosprintLoaded => ModLoaded("com.johnedwa.RTAutoSprintEx");

		public static bool acridLungeLoaded => ModLoaded("Withor.AcridBiteLunge");

		public static bool ucrLoaded => ModLoaded("HIFU.UltimateCustomRun");

		private void BurnReworks()
		{
			IgnitionTankRework();
		}

		private void IgnitionTankRework()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			StatHooks.GetMoreStatCoefficients += new MoreStatHookEventHandler(IgniTankBurnChance);
			StrengthenBurnUtils.CheckDotForUpgrade += new hook_CheckDotForUpgrade(OverrideIgnitionBurn);
			LanguageAPI.Add("ITEM_STRENGTHENBURN_PICKUP", "Your ignite effects deal triple damage.");
			LanguageAPI.Add("ITEM_STRENGTHENBURN_DESC", $"Gain <style=cIsDamage>{ignitionTankBurnChance}% ignite chance</style>. " + "All ignition effects deal <style=cIsDamage>+" + Tools.ConvertDecimal(ignitionBurnDamage) + "</style> <style=cStack>(+" + Tools.ConvertDecimal(ignitionBurnDamage) + " per stack)</style> more damage and last <style=cIsUtility>+" + Tools.ConvertDecimal(ignitionBurnDuration) + "</style> <style=cStack>(+" + Tools.ConvertDecimal(ignitionBurnDuration) + " per stack)</style> longer.");
		}

		private void IgniTankBurnChance(CharacterBody sender, MoreStatHookEventArgs args)
		{
			Inventory inventory = sender.inventory;
			if (Object.op_Implicit((Object)(object)inventory) && inventory.GetItemCount(Items.StrengthenBurn) > 0)
			{
				args.burnChanceOnHit += (float)ignitionTankBurnChance;
			}
		}

		private void OverrideIgnitionBurn(orig_CheckDotForUpgrade orig, Inventory inventory, ref InflictDotInfo dotInfo)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Invalid comparison between Unknown and I4
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			if ((int)dotInfo.dotIndex != 1 && (int)dotInfo.dotIndex != 2)
			{
				return;
			}
			int itemCount = inventory.GetItemCount(Items.StrengthenBurn);
			if (itemCount > 0)
			{
				dotInfo.preUpgradeDotIndex = dotInfo.dotIndex;
				dotInfo.dotIndex = (DotIndex)7;
				float num = 1f + ignitionBurnDamage * (float)itemCount;
				float num2 = 1f + ignitionBurnDuration * (float)itemCount;
				if (shouldIgnitionDamageAndDurationCompound)
				{
					dotInfo.totalDamage *= num * num2;
					dotInfo.damageMultiplier *= num;
				}
				else
				{
					dotInfo.totalDamage *= num;
					dotInfo.damageMultiplier *= num / num2;
				}
			}
		}

		public static int GetBurnCount(CharacterBody victimBody)
		{
			return victimBody.GetBuffCount(Buffs.OnFire) + victimBody.GetBuffCount(Buffs.StrongerBurn);
		}

		private void MakePillarsFun()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			MoonBatteryMissionController.Awake += new hook_Awake(ReduceRequiredPillars);
			AsyncOperationHandle<GameObject> val = Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_moon2.MoonBatteryBlood_prefab);
			val.Completed += delegate(AsyncOperationHandle<GameObject> ctx)
			{
				AddPillarItemDrop(ctx.Result, PillarItemDropper.PillarType.Blood);
			};
			val = Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_moon2.MoonBatteryDesign_prefab);
			val.Completed += delegate(AsyncOperationHandle<GameObject> ctx)
			{
				AddPillarItemDrop(ctx.Result, PillarItemDropper.PillarType.Design);
			};
			val = Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_moon2.MoonBatteryMass_prefab);
			val.Completed += delegate(AsyncOperationHandle<GameObject> ctx)
			{
				AddPillarItemDrop(ctx.Result, PillarItemDropper.PillarType.Mass);
			};
			val = Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_moon2.MoonBatterySoul_prefab);
			val.Completed += delegate(AsyncOperationHandle<GameObject> ctx)
			{
				AddPillarItemDrop(ctx.Result, PillarItemDropper.PillarType.Soul);
			};
			static void AddPillarItemDrop(GameObject pillarPrefab, PillarItemDropper.PillarType pillarType)
			{
				PillarItemDropper pillarItemDropper = pillarPrefab.AddComponent<PillarItemDropper>();
				pillarItemDropper.pillarType = pillarType;
			}
		}

		private void ReduceRequiredPillars(orig_Awake orig, MoonBatteryMissionController self)
		{
			orig.Invoke(self);
			self._numRequiredBatteries = 2;
			GameObject[] moonBatteries = self.moonBatteries;
			foreach (GameObject val in moonBatteries)
			{
				PillarItemDropper pillarItemDropper = val.GetComponent<PillarItemDropper>();
				if (!Object.op_Implicit((Object)(object)pillarItemDropper))
				{
					pillarItemDropper = val.AddComponent<PillarItemDropper>();
					PillarItemDropper.PillarType pillarType = PillarItemDropper.PillarType.None;
					string name = ((Object)val).name;
					switch (name.Substring(11, 4))
					{
					case "Mass":
						pillarType = PillarItemDropper.PillarType.Mass;
						break;
					case "Desi":
						pillarType = PillarItemDropper.PillarType.Design;
						break;
					case "Bloo":
						pillarType = PillarItemDropper.PillarType.Blood;
						break;
					case "Soul":
						pillarType = PillarItemDropper.PillarType.Soul;
						break;
					}
					pillarItemDropper.pillarType = pillarType;
				}
				pillarItemDropper.shouldDropItem = true;
			}
		}

		private void PillarsDropItems(orig_OnBatteryCharged orig, MoonBatteryMissionController self, HoldoutZoneController holdoutZone)
		{
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Expected O, but got Unknown
			int participatingPlayerCount = Run.instance.participatingPlayerCount;
			if (participatingPlayerCount != 0)
			{
				DropPillarItemFromHoldout(holdoutZone, participatingPlayerCount);
			}
			self.Network_numChargedBatteries = self._numChargedBatteries + 1;
			if (self._numChargedBatteries < self._numRequiredBatteries || !NetworkServer.active)
			{
				return;
			}
			for (int i = 0; i < self.batteryHoldoutZones.Length; i++)
			{
				if (((Behaviour)self.batteryHoldoutZones[i]).enabled)
				{
					self.batteryHoldoutZones[i].FullyChargeHoldoutZone();
					((UnityEvent<HoldoutZoneController>)(object)self.batteryHoldoutZones[i].onCharged).RemoveListener((UnityAction<HoldoutZoneController>)self.OnBatteryCharged);
				}
			}
			for (int j = 0; j < self.elevatorStateMachines.Length; j++)
			{
				self.elevatorStateMachines[j].SetNextState((EntityState)new InactiveToReady());
			}
		}

		public static void DropPillarItemFromHoldout(HoldoutZoneController holdoutZone)
		{
			Log.Warning(((Object)((Component)holdoutZone).gameObject).name + "3");
			DropPillarItemFromHoldout(holdoutZone, Object.op_Implicit((Object)(object)Run.instance) ? Run.instance.participatingPlayerCount : 0);
		}

		public static void DropPillarItemFromHoldout(HoldoutZoneController holdoutZone, int participatingPlayerCount)
		{
			//IL_0034: 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_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)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			Log.Warning(((Object)((Component)holdoutZone).gameObject).name + "4");
			if (participatingPlayerCount == 0)
			{
				return;
			}
			Vector3 val = ((Component)holdoutZone).gameObject.transform.position + Vector3.up * pillarDropOffset;
			PickupIndex pickupIndexFromPillarType = GetPickupIndexFromPillarType(((Component)holdoutZone).gameObject);
			if (pickupIndexFromPillarType != PickupIndex.none)
			{
				Log.Warning(((Object)((Component)holdoutZone).gameObject).name + "5");
				int num = baseRewardCount;
				if (scaleRewardsByPlayerCount)
				{
					num *= participatingPlayerCount;
				}
				float num2 = 360f / (float)num;
				Vector3 val2 = Quaternion.AngleAxis((float)Random.Range(0, 360), Vector3.up) * (Vector3.up * pillarDropForce + Vector3.forward * 5f);
				Quaternion val3 = Quaternion.AngleAxis(num2, Vector3.up);
				int num3 = 0;
				while (num3 < num)
				{
					Log.Warning(((Object)((Component)holdoutZone).gameObject).name + "6");
					PickupDropletController.CreatePickupDroplet(pickupIndexFromPillarType, val, val2);
					num3++;
					val2 = val3 * val2;
				}
			}
		}

		public static PickupIndex GetPickupIndexFromPillarType(GameObject pillar)
		{
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: 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_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			ItemBase itemBase = null;
			string name = ((Object)pillar).name;
			switch (name.Substring(11, 4))
			{
			case "Mass":
				itemBase = ItemBase<MassAnomaly>.instance;
				break;
			case "Desi":
				itemBase = ItemBase<DesignAnomaly>.instance;
				break;
			case "Bloo":
				itemBase = ItemBase<BloodAnomaly>.instance;
				break;
			case "Soul":
				itemBase = ItemBase<SoulAnomaly>.instance;
				break;
			}
			if (itemBase != null)
			{
				ItemIndex itemIndex = itemBase.ItemsDef.itemIndex;
				return PickupCatalog.FindPickupIndex(itemIndex);
			}
			Debug.Log((object)"No pickup index found!");
			return PickupIndex.none;
		}

		public void BrittleCrownChanges()
		{
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Expected O, but got Unknown
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Expected O, but got Unknown
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Expected O, but got Unknown
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Expected O, but got Unknown
			LanguageAPI.Add("ITEM_GOLDONHIT_NAME", "Sunken Crown");
			LanguageAPI.Add("ITEM_GOLDONHIT_PICKUP", "Steal from chests... " + Language.Styling.HealthColor("at the cost of health."));
			LanguageAPI.Add("ITEM_GOLDONHIT_DESC", "Allows interacting with chests without the ability to afford them, opening the chest " + Language.Styling.UtilityColor("without spending ANY money") + ". Stealing from chests costs " + Language.Styling.HealthColor("[ " + common + " / " + uncommon + " / " + rare + " ]") + " of your " + Language.Styling.HealthColor("maximum health") + ", depending on the size of the chest. " + $"Can steal up to {brittleCrownStealCountBase} {Language.Styling.StackText($"+{brittleCrownStealCountStack}")} times per stage.");
			HealthComponent.TakeDamageProcess += new Manipulator(RemoveCrownPenalty);
			GlobalEventManager.ProcessHitEnemy += new Manipulator(RemoveCrownReward);
			PurchaseInteraction.CanBeAffordedByInteractor += new hook_CanBeAffordedByInteractor(PurchaseInteraction_CanBeAffordedByInteractor);
			CharacterBody.OnInventoryChanged += new hook_OnInventoryChanged(AddBrittleCrownBehavior);
		}

		private void AddBrittleCrownBehavior(orig_OnInventoryChanged orig, CharacterBody self)
		{
			orig.Invoke(self);
			if (NetworkServer.active)
			{
				self.AddItemBehavior<BrittleCrownBehavior>(self.inventory.GetItemCount(Items.GoldOnHit));
			}
		}

		private void RemoveCrownReward(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_005b: 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)
			ILCursor val = new ILCursor(il);
			val.GotoNext((MoveType)2, new Func<Instruction, bool>[2]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, "RoR2.RoR2Content/Items", "GoldOnHit"),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Inventory>(x, "GetItemCount")
			});
			val.Emit(OpCodes.Pop);
			val.Emit(OpCodes.Ldc_I4, 0);
		}

		private void RemoveCrownPenalty(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0039: 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)
			ILCursor val = new ILCursor(il);
			val.GotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<ItemCounts>(x, "goldOnHit")
			});
			val.Emit(OpCodes.Pop);
			val.Emit(OpCodes.Ldc_I4, 0);
		}

		private void CTCInit(orig_Init orig)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Expected O, but got Unknown
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			orig.Invoke();
			CostTypeDef costTypeDef = CostTypeCatalog.GetCostTypeDef((CostTypeIndex)1);
			MethodInfo method = ((Delegate)(object)costTypeDef.payCost).Method;
			ILHook val = new ILHook((MethodBase)method, new Manipulator(PatchMoneyCostForBrittleCrown));
		}

		private void PatchMoneyCostForBrittleCrown(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			val.Emit(OpCodes.Ldarg_1);
			val.EmitDelegate<Action<PayCostContext>>((Action<PayCostContext>)delegate(PayCostContext ctx)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				//IL_001d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0029: Unknown result type (might be due to invalid IL or missing references)
				CharacterBody activatorBody = ctx.activatorBody;
				if (Object.op_Implicit((Object)(object)activatorBody) && Object.op_Implicit((Object)(object)ctx.activatorMaster) && ctx.activatorMaster.money < ctx.cost)
				{
					ctx.cost = 0;
				}
			});
		}

		private bool PurchaseInteraction_CanBeAffordedByInteractor(orig_CanBeAffordedByInteractor orig, PurchaseInteraction self, Interactor activator)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Invalid comparison between Unknown and I4
			bool flag = orig.Invoke(self, activator);
			if (flag)
			{
				return flag;
			}
			CharacterBody val = null;
			if ((int)self.costType == 1 && self.saleStarCompatible && ((Component)activator).gameObject.TryGetComponent<CharacterBody>(ref val) && val.HasBuff(brittleCrownBuff) && val.master.money < self.cost)
			{
				int num = 1;
				int difficultyScaledCost = Run.instance.GetDifficultyScaledCost(45, Stage.instance.entryDifficultyCoefficient);
				int difficultyScaledCost2 = Run.instance.GetDifficultyScaledCost(245, Stage.instance.entryDifficultyCoefficient);
				if (self.cost >= num && self.cost < difficultyScaledCost)
				{
					CounterfeitCalculations(val, crownCommonStealSoulCost);
				}
				else if (self.cost >= difficultyScaledCost && self.cost < difficultyScaledCost2)
				{
					CounterfeitCalculations(val, crownUncommonStealSoulCost);
				}
				else
				{
					CounterfeitCalculations(val, crownRareStealSoulCost);
				}
				flag = true;
			}
			return flag;
		}

		public void CounterfeitCalculations(CharacterBody activator, float soulCost)
		{
			SoulCostPlugin.AddSoulCostToBody(activator, soulCost);
			activator.AddBuff(Buffs.FreeUnlocks);
			Util.PlaySound("sfx_lunarmoney_start", ((Component)activator).gameObject);
			if (NetworkServer.active)
			{
				activator.RemoveBuff(brittleCrownBuff);
			}
		}

		public void ExecutiveCardChanges()
		{
			//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_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
			EquipmentDef val = Addressables.LoadAssetAsync<EquipmentDef>((object)"RoR2/DLC1/MultiShopCard/MultiShopCard.asset").WaitForCompletion();
			val.cooldown = cooldown;
			LanguageAPI.Add("EQUIPMENT_MULTISHOPCARD_PICKUP", "Hack a targeted interactable. Hacked Multishops remain open.");
			LanguageAPI.Add("EQUIPMENT_MULTISHOPCARD_DESC", "Target an interactable to <style=cIsUtility>hack</style> it, unlocking its contents for <style=cIsUtility>free</style>. If the target is a <style=cIsUtility>multishop</style> terminal, the other terminals will <style=cIsUtility>remain open</style>.");
			MultiShopCardUtils.OnPurchase += new Manipulator(FreezeCard);
			EquipmentSlot.UpdateTargets += new hook_UpdateTargets(CardTargetInteractables);
			EquipmentSlot.PerformEquipmentAction += new hook_PerformEquipmentAction(PerformEquipmentAction);
		}

		private void FreezeCard(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			ILCursor val = new ILCursor(il);
			val.GotoNext((MoveType)0, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Inventory>(x, "get_currentEquipmentIndex")
			});
			val.Remove();
			val.EmitDelegate<Func<Inventory, int>>((Func<Inventory, int>)((Inventory inv) => -1));
		}

		private bool PerformEquipmentAction(orig_PerformEquipmentAction orig, EquipmentSlot self, EquipmentDef equipmentDef)
		{
			if ((Object)(object)equipmentDef == (Object)(object)Equipment.MultiShopCard)
			{
				return ActivateEquipment(self);
			}
			return orig.Invoke(self, equipmentDef);
			static bool ActivateEquipment(EquipmentSlot slot)
			{
				bool result = false;
				GameObject rootObject = slot.currentTarget.rootObject;
				if ((Object)(object)rootObject != (Object)null)
				{
					PurchaseInteraction component = rootObject.GetComponent<PurchaseInteraction>();
					if ((Object)(object)component != (Object)null && HackingMainState.PurchaseInteractionIsValidTarget(component))
					{
						component.Networkcost = 0;
						ShopTerminalBehavior component2 = rootObject.GetComponent<ShopTerminalBehavior>();
						if (Object.op_Implicit((Object)(object)component2))
						{
							component2.serverMultiShopController.SetCloseOnTerminalPurchase(((Component)component).GetComponent<PurchaseInteraction>(), false);
						}
						CharacterBody characterBody = slot.characterBody;
						Interactor val = ((characterBody != null) ? ((Component)characterBody).GetComponent<Interactor>() : null);
						if (Object.op_Implicit((Object)(object)val))
						{
							val.AttemptInteraction(rootObject);
						}
						slot.InvalidateCurrentTarget();
						result = true;
					}
				}
				return result;
			}
		}

		private void CardTargetInteractables(orig_UpdateTargets orig, EquipmentSlot self, EquipmentIndex targetingEquipmentIndex, bool userShouldAnticipateTarget)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: 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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02da: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			if (targetingEquipmentIndex != Equipment.MultiShopCard.equipmentIndex || !userShouldAnticipateTarget)
			{
				orig.Invoke(self, targetingEquipmentIndex, userShouldAnticipateTarget);
				return;
			}
			float num = 150f;
			float num2 = 10f;
			float num3 = Mathf.Cos(Mathf.Clamp(num2, 0f, 180f) * MathF.PI / 180f);
			float num4 = default(float);
			Ray val = CameraRigController.ModifyAimRayIfApplicable(self.GetAimRay(), ((Component)self.characterBody).gameObject, ref num4);
			Collider[] array = Physics.OverlapSphere(((Ray)(ref val)).origin, num + num4, -1, (QueryTriggerInteraction)2);
			bool flag = false;
			GameObject rootObject = self.currentTarget.rootObject;
			Vector3 val3;
			if ((Object)(object)rootObject != (Object)null)
			{
				PurchaseInteraction val2 = ((rootObject != null) ? rootObject.GetComponent<PurchaseInteraction>() : null);
				if ((Object)(object)val2 != (Object)null)
				{
					flag = HackingMainState.PurchaseInteractionIsValidTarget(val2) && val2.available;
				}
				Vector3 origin = ((Ray)(ref val)).origin;
				Vector3 position = rootObject.transform.position;
				if (flag)
				{
					val3 = position - origin;
					if (!(((Vector3)(ref val3)).sqrMagnitude > num * num))
					{
						Vector3 direction = ((Ray)(ref val)).direction;
						val3 = position - origin;
						if (!(Vector3.Dot(direction, ((Vector3)(ref val3)).normalized) < num3))
						{
							goto IL_0146;
						}
					}
				}
				self.InvalidateCurrentTarget();
			}
			goto IL_0146;
			IL_0146:
			bool flag2 = false;
			PurchaseInteraction val4 = null;
			Collider[] array2 = array;
			foreach (Collider val5 in array2)
			{
				Vector3 direction2 = ((Ray)(ref val)).direction;
				val3 = ((Component)val5).transform.position - ((Ray)(ref val)).origin;
				float num5 = Vector3.Dot(direction2, ((Vector3)(ref val3)).normalized);
				if (num5 < num3)
				{
					continue;
				}
				Vector3 origin2 = ((Ray)(ref val)).origin;
				Vector3 position2 = ((Component)val5).transform.position;
				if (!HasLos(origin2, position2))
				{
					continue;
				}
				EntityLocator component = ((Component)val5).GetComponent<EntityLocator>();
				if (!Object.op_Implicit((Object)(object)component))
				{
					continue;
				}
				PurchaseInteraction component2 = component.entity.GetComponent<PurchaseInteraction>();
				if (Object.op_Implicit((Object)(object)component2))
				{
					flag2 = HackingMainState.PurchaseInteractionIsValidTarget(component2);
					if (flag2)
					{
						flag2 = true;
						val4 = component2;
						break;
					}
					if ((Object)(object)val4 == (Object)null && component2.available)
					{
						val4 = component2;
					}
				}
			}
			if ((Object)(object)val4 != (Object)null)
			{
				if (flag2 && userShouldAnticipateTarget)
				{
					self.targetIndicator.visualizerPrefab = LegacyResourcesAPI.Load<GameObject>("Prefabs/RecyclerIndicator");
				}
				else
				{
					self.targetIndicator.visualizerPrefab = LegacyResourcesAPI.Load<GameObject>("Prefabs/RecyclerBadIndicator");
				}
				self.currentTarget = new UserTargetInfo
				{
					transformToIndicateAt = ((Component)val4).gameObject.transform,
					pickupController = null,
					hurtBox = null,
					rootObject = ((Component)val4).gameObject
				};
				self.targetIndicator.active = true;
				self.targetIndicator.targetTransform = self.currentTarget.transformToIndicateAt;
			}
			else
			{
				self.InvalidateCurrentTarget();
				self.targetIndicator.active = false;
			}
		}

		public bool HasLos(Vector3 origin, Vector3 targetPosition)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = targetPosition - origin;
			RaycastHit val2 = default(RaycastHit);
			return !Physics.Raycast(origin, val, ref val2, ((Vector3)(ref val)).magnitude - 1f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1);
		}

		private void FreezeCardf(orig_OnPurchase orig, PayCostContext context, int moneyCost)
		{
		}

		public void FocusedConvergenceChanges()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			FocusConvergenceController.ApplyRadius += new hook_ApplyRadius(FoconNewRadius);
			FocusConvergenceController.ApplyRate += new Manipulator(FoconApplyRate);
			FocusConvergenceController.DoUpdate += new Manipulator(FoconUpdate);
			LanguageAPI.Add("ITEM_FOCUSEDCONVERGENCE_PICKUP", $"Increase the speed Holdout Zones charge... <color=#FF7F7F>BUT reduce the size of the zone</color>. Max of {foconMaxStack}.");
			LanguageAPI.Add("ITEM_FOCUSEDCONVERGENCE_DESC", "Holdout Zones charge <style=cIsUtility>" + Tools.ConvertDecimal(foconChargeBonus) + " <style=cStack>(+" + Tools.ConvertDecimal(foconChargeBonus) + " per stack)</style> faster</style>, but are <style=cIsHealth>" + Tools.ConvertDecimal(1f - foconRadiusMultiplier) + " smaller</style> <style=cStack>(-" + Tools.ConvertDecimal(1f - foconRadiusMultiplier) + " per stack)</style>. " + $"Max of {foconMaxStack}.");
		}

		private void FoconUpdate(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			ILCursor val = new ILCursor(il);
			val.GotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld<FocusConvergenceController>(x, "cap")
			});
			val.EmitDelegate<Func<int, int>>((Func<int, int>)((int cap) => foconMaxStack));
		}

		private void FoconNewRadius(orig_ApplyRadius orig, MonoBehaviour self, ref float radius)
		{
			FocusConvergenceController val = (FocusConvergenceController)(object)((self is FocusConvergenceController) ? self : null);
			if (val.currentFocusConvergenceCount > 0)
			{
				radius -= foconMinRadius;
				radius *= Mathf.Pow(foconRadiusMultiplier, (float)val.currentFocusConvergenceCount);
				radius += foconMinRadius;
			}
		}

		private void FoconApplyRadius(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0039: 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_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			val.GotoNext((MoveType)0, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld<FocusConvergenceController>(x, "convergenceRadiusDivisor")
			});
			val.Emit(OpCodes.Ldc_R4, foconMinRadius);
			val.Emit(OpCodes.Sub);
			val.GotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld<FocusConvergenceController>(x, "convergenceRadiusDivisor")
			});
			val.Remove();
			val.Emit(OpCodes.Ldc_R4, 2);
			val.GotoNext((MoveType)0, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchStindR4(x)
			});
			val.Emit(OpCodes.Ldc_R4, foconMinRadius);
			val.Emit(OpCodes.Add);
		}

		private void FoconApplyRate(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			ILCursor val = new ILCursor(il);
			val.GotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld<FocusConvergenceController>(x, "convergenceChargeRateBonus")
			});
			val.EmitDelegate<Func<float, float>>((Func<float, float>)((float chargeBonus) => foconChargeBonus));
		}

		public void GestureChanges()
		{
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Expected O, but got Unknown
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Expected O, but got Unknown
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Expected O, but got Unknown
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Expected O, but got Unknown
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Expected O, but got Unknown
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Expected O, but got Unknown
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Expected O, but got Unknown
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Expected O, but got Unknown
			LanguageAPI.Add("ITEM_AUTOCASTEQUIPMENT_PICKUP", "Greatly increase equipment stock... " + Language.Styling.HealthColor("BUT greatly increase equipment cooldown.") + " Equipments can be activated during their cooldown, " + Language.Styling.HealthColor("with a chance to break."));
			LanguageAPI.Add("ITEM_AUTOCASTEQUIPMENT_DESC", "Hold " + Language.Styling.UtilityColor($"{gestureStockBase} additional equipment charges") + " " + Language.Styling.StackText($"+{gestureStockStack}") + "... " + Language.Styling.HealthColor("BUT increase equipment cooldown by +" + Tools.ConvertDecimal(gestureCdiBase)) + " " + Language.Styling.StackText("+" + Tools.ConvertDecimal(gestureCdiStack)) + ". Using your equipment without charges " + Language.Styling.UtilityColor("under-casts") + " it, allowing it to be used " + Language.Styling.HealthColor($"with a {gestureEquipBreakChance}% chance to break") + ". " + Language.Styling.UtilityColor("Unaffected by luck."));
			EquipmentSlot.MyFixedUpdate += new Manipulator(RemoveGestureAutocast);
			Inventory.CalculateEquipmentCooldownScale += new Manipulator(RemoveGestureCdr);
			EquipmentSlot.ExecuteIfReady += new Manipulator(AllowGestureUndercast);
			EquipmentSlot.OnEquipmentExecuted += new hook_OnEquipmentExecuted(AddGestureUndercast);
			Inventory.CalculateEquipmentCooldownScale += new hook_CalculateEquipmentCooldownScale(AddGestureCdi);
			Inventory.GetEquipmentSlotMaxCharges += new hook_GetEquipmentSlotMaxCharges(AddGestureStock);
			EquipmentSlot.MyFixedUpdate += new hook_MyFixedUpdate(AddGestureBreak);
			Inventory.UpdateEquipment += new Manipulator(FixMaxStock);
		}

		private void AllowGestureUndercast(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			val.GotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<EquipmentSlot>(x, "get_stock")
			});
			val.Emit(OpCodes.Ldarg_0);
			val.EmitDelegate<Func<int, EquipmentSlot, int>>((Func<int, EquipmentSlot, int>)delegate(int stock, EquipmentSlot slot)
			{
				if (stock > 0)
				{
					return stock;
				}
				return (slot.inventory.GetItemCount(Items.AutoCastEquipment) > 0) ? 1 : 0;
			});
		}

		private void FixMaxStock(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			val.GotoNext((MoveType)2, new Func<Instruction, bool>[2]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, "RoR2.RoR2Content/Items", "EquipmentMagazine"),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Inventory>(x, "GetItemCount")
			});
			int num = default(int);
			val.GotoNext((MoveType)0, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref num)
			});
			val.Emit(OpCodes.Ldarg_0);
			val.EmitDelegate<Func<int, Inventory, int>>((Func<int, Inventory, int>)delegate(int stock, Inventory inv)
			{
				stock += GetGestureStockFromInventory(inv);
				return stock;
			});
		}

		private int AddGestureStock(orig_GetEquipmentSlotMaxCharges orig, Inventory self, byte slot)
		{
			int num = orig.Invoke(self, slot);
			return num + GetGestureStockFromInventory(self);
		}

		public static int GetGestureStockFromInventory(Inventory inv)
		{
			int itemCount = inv.GetItemCount(Items.AutoCastEquipment);
			if (itemCount > 0)
			{
				return 4 + 2 * (itemCount - 1);
			}
			return 0;
		}

		private float AddGestureCdi(orig_CalculateEquipmentCooldownScale orig, Inventory self)
		{
			float num = orig.Invoke(self);
			int itemCount = self.GetItemCount(Items.AutoCastEquipment);
			if (itemCount > 0)
			{
				num *= 1f + gestureCdiBase + gestureCdiStack * (float)(itemCount - 1);
			}
			return num;
		}

		private void RemoveGestureCdr(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_005b: 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)
			ILCursor val = new ILCursor(il);
			val.GotoNext((MoveType)2, new Func<Instruction, bool>[2]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, "RoR2.RoR2Content/Items", "AutoCastEquipment"),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Inventory>(x, "GetItemCount")
			});
			val.Emit(OpCodes.Pop);
			val.Emit(OpCodes.Ldc_I4, 0);
		}

		private void AddGestureUndercast(orig_OnEquipmentExecuted orig, EquipmentSlot self)
		{
			bool flag = false;
			if (NetworkServer.active && self.stock <= 0 && self.inventory.GetItemCount(Items.AutoCastEquipment) > 0)
			{
				self.inventory.RestockEquipmentCharges(self.activeEquipmentSlot, 1);
				flag = true;
			}
			orig.Invoke(self);
			if (flag)
			{
				self.characterBody.AddBuff(CommonAssets.gestureQueueEquipBreak);
				if (self.subcooldownTimer <= 0f)
				{
					TryGestureEquipmentBreak(self);
				}
			}
		}

		private void AddGestureBreak(orig_MyFixedUpdate orig, EquipmentSlot self, float deltaTime)
		{
			orig.Invoke(self, deltaTime);
			if (NetworkServer.active && self.subcooldownTimer <= 0f)
			{
				TryGestureEquipmentBreak(self);
			}
		}

		private void AddPreonAccumulatorBreak(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			val.GotoNext((MoveType)2, new Func<Instruction, bool>[2]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 0f),
				(Instruction x) => ILPatternMatchingExt.MatchStfld<EquipmentSlot>(x, "bfgChargeTimer")
			});
			val.Emit(OpCodes.Ldarg_0);
			val.EmitDelegate<Action<EquipmentSlot>>((Action<EquipmentSlot>)delegate(EquipmentSlot self)
			{
				TryGestureEquipmentBreak(self);
			});
		}

		public static void TryGestureEquipmentBreak(EquipmentSlot self)
		{
			if (self.characterBody.HasBuff(CommonAssets.gestureQueueEquipBreak))
			{
				if (Util.CheckRoll(gestureEquipBreakChance, 0f, (CharacterMaster)null))
				{
					self.inventory.SetEquipmentIndex((EquipmentIndex)(-1));
				}
				self.characterBody.RemoveBuff(CommonAssets.gestureQueueEquipBreak);
			}
		}

		private void RemoveGestureAutocast(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_005b: 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)
			ILCursor val = new ILCursor(il);
			val.GotoNext((MoveType)2, new Func<Instruction, bool>[2]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, "RoR2.RoR2Content/Items", "AutoCastEquipment"),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Inventory>(x, "GetItemCount")
			});
			val.Emit(OpCodes.Pop);
			val.Emit(OpCodes.Ldc_I4, 0);
		}

		public void HappiestMaskRework()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected O, but got Unknown
			StatHooks.GetMoreStatCoefficients += new MoreStatHookEventHandler(MaskExecution);
			GlobalEventManager.onServerCharacterExecuted += HappiestMaskGhostSpawn;
			GlobalEventManager.OnCharacterDeath += new Manipulator(RevokeHappiestMaskRights);
			CharacterBody.OnInventoryChanged += new hook_OnInventoryChanged(AddMaskBehavior);
			LanguageAPI.Add("ITEM_GHOSTONKILL_PICKUP", "Haunt nearby enemies, marking them for execution. Executing enemies summons a ghost.");
			LanguageAPI.Add("ITEM_GHOSTONKILL_DESC", $"Once every <style=cIsDamage>{HappiestMaskBehavior.baseHauntInterval}</style> seconds, " + "<style=cIsDamage>Haunt</style> a nearby non-boss enemy, marking them for Execution below <style=cIsHealth>" + Tools.ConvertDecimal(hauntExecutionThreshold) + "</style> health. Execution <style=cIsDamage>spawns a ghost</style> of the killed enemy with <style=cIsDamage>1500%</style> damage, " + $"lasting for <style=cIsDamage>{ghostDurationPerStack}s</style> <style=cStack>(+{ghostDurationPerStack}s per stack)</style> " + Language.Styling.UtilityColor("(double for Haunted enemies)") + ".");
			LanguageAPI.Add("ITEM_GHOSTONKILL_LORE", "<style=cMono>\r\n//--AUTO-TRANSCRIPTION FROM RALLYPOINT DELTA --//</style>\r\n\r\n“Sir, the ghosts are back.”\r\n\r\nThe man sighed. After a routine expedition, one of the crew members – a simple soldier - had recovered an artifact thought to have been aboard the Contact Light – a simple mask, adorned with a painfully happy grin. \r\n\r\n“I’ll take care of it.” The man trudged down the hall towards the barracks. The Lemurians he had killed earlier that day walked down the hall by him, barely earning a second glance from the man. This had become so commonplace that most of the crew members in this block had grown accustomed to having a ghostly room-mate.\r\n\r\nBut enough was enough. Stepping through the ghost of an Imp, the man slammed the door open. The lights were off, and in the corner sat the soldier.\r\n\r\n“Alright, we’ve had enough fun playing with the dead. Fork it over.”\r\n\r\nNo response. The man grunted and hoisted the soldier to his feet, giving him a few rough shakes. “Hey, can you hear me!? I said hand over the mask! I’m tired of waking up next to Beetles, so give it a rest already--”\r\n\r\nThe soldier’s limp body moved. Slowly, the soldier raised his finger – pointing directly at the man.\r\n\r\n“What are you...?” With a sense of dread, the man turned and saw the Lemurians he had killed earlier step into the room. Their mouths began to glow with an otherworldly light.\r\n\r\nThe man cursed under his breath as he loaded his shotgun. “This planet, I tell you...”");
		}

		private void MaskExecution(CharacterBody sender, MoreStatHookEventArgs args)
		{
			bool flag = sender.HasBuff(CommonAssets.hauntDebuff);
			args.ModifyBaseExecutionThreshold(hauntExecutionThreshold, flag);
		}

		private void AddMaskBehavior(orig_OnInventoryChanged orig, CharacterBody self)
		{
			orig.Invoke(self);
			int itemCount = self.inventory.GetItemCount(Items.GhostOnKill);
			self.AddItemBehavior<HappiestMaskBehavior>(itemCount);
		}

		private void HappiestMaskGhostSpawn(DamageReport damageReport, float executionHealthLost)
		{
			CharacterBody victimBody = damageReport.victimBody;
			CharacterBody attackerBody = damageReport.attackerBody;
			if (!Object.op_Implicit((Object)(object)victimBody) || !Object.op_Implicit((Object)(object)attackerBody))
			{
				return;
			}
			Inventory inventory = attackerBody.inventory;
			if (!Object.op_Implicit((Object)(object)inventory))
			{
				return;
			}
			int num = inventory.GetItemCount(Items.GhostOnKill);
			if (num > 0 && Object.op_Implicit((Object)(object)victimBody) && Util.CheckRoll(ghostSpawnChanceOnExecute, attackerBody.master))
			{
				if (victimBody.HasBuff(CommonAssets.hauntDebuff))
				{
					num *= 2;
				}
				Util.TryToCreateGhost(victimBody, attackerBody, Mathf.CeilToInt((float)num * ghostDurationPerStack));
			}
		}

		private void RevokeHappiestMaskRights(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			val.GotoNext((MoveType)2, new Func<Instruction, bool>[2]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, "RoR2.RoR2Content/Items", "GhostOnKill"),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Inventory>(x, "GetItemCount")
			});
			val.Emit(OpCodes.Ldc_I4, 0);
			val.Emit(OpCodes.Mul);
		}

		public void HuntersHarpoonRework()
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Expected O, but got Unknown
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Expected O, but got Unknown
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Expected O, but got Unknown
			harpoonTargetMaterial = CreateMatRecolor(new Color32((byte)210, (byte)140, (byte)32, (byte)100));
			GlobalEventManager.OnCharacterDeath += new Manipulator(RevokeHarpoonRights);
			CharacterBody.OnInventoryChanged += new hook_OnInventoryChanged(AddHarpoonBehavior);
			OnHit.GetHitBehavior += new HitHookEventHandler(HarpoonOnHit);
			StatHooks.GetMoreStatCoefficients += new MoreStatHookEventHandler(HarpoonDecay);
			LanguageAPI.Add("ITEM_MOVESPEEDONKILL_PICKUP", "Target a nearby enemy, gaining barrier on hit.");
			LanguageAPI.Add("ITEM_MOVESPEEDONKILL_DESC", "Reduce barrier decay by <style=cIsHealing>-" + Language.Styling.ConvertDecimal(harpoonDecayReduction) + "</style>." + $"Once every <style=cIsDamage>{harpoonTargetTime}</style> seconds, <style=cIsDamage>target</style> a random enemy. " + "Attacking the targeted enemy grants a <style=cIsHealing>temporary barrier</style> " + $"for <style=cIsHealing>{harpoonBarrierBase} health</style> <style=cStack>(+{harpoonBarrierStack} per stack)</style>.");
		}

		private void HarpoonDecay(CharacterBody sender, MoreStatHookEventArgs args)
		{
			if (Object.op_Implicit((Object)(object)sender.inventory) && Object.op_Implicit((Object)(object)sender.inventory))
			{
				int itemCount = sender.inventory.GetItemCount(Items.MoveSpeedOnKill);
				if (itemCount > 0)
				{
					args.barrierDecayRatePercentIncreaseMult *= 1f - harpoonDecayReduction;
				}
			}
		}

		public static Material CreateMatRecolor(Color32 blueEquivalent)
		{
			//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_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			Material val = Object.Instantiate<Material>(Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Huntress/matHuntressFlashExpanded.mat").WaitForCompletion());
			val.SetColor("_TintColor", Color32.op_Implicit(blueEquivalent));
			val.SetInt("_Cull", 1);
			return val;
		}

		private void HarpoonOnHit(CharacterBody attackerBody, DamageInfo damageInfo, CharacterBody victimBody)
		{
			Inventory inventory = attackerBody.inventory;
			HealthComponent healthComponent = attackerBody.healthComponent;
			if ((Object)(object)inventory != (Object)null && (Object)(object)healthComponent != (Object)null && (Object)(object)victimBody != (Object)null && victimBody.HasBuff(CommonAssets.harpoonDebuff))
			{
				int itemCount = inventory.GetItemCount(Items.MoveSpeedOnKill);
				if (itemCount > 0)
				{
					float num = harpoonBarrierBase + harpoonBarrierStack * (float)(itemCount - 1);
					healthComponent.AddBarrierAuthority(num * damageInfo.procCoefficient);
				}
			}
		}

		private void AddHarpoonBehavior(orig_OnInventoryChanged orig, CharacterBody self)
		{
			orig.Invoke(self);
			int itemCount = self.inventory.GetItemCount(Items.MoveSpeedOnKill);
			self.AddItemBehavior<HuntersHarpoonBehavior>(itemCount);
		}

		private void RevokeHarpoonRights(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_005b: 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)
			ILCursor val = new ILCursor(il);
			val.GotoNext((MoveType)2, new Func<Instruction, bool>[2]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, "RoR2.DLC1Content/Items", "MoveSpeedOnKill"),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Inventory>(x, "GetItemCount")
			});
			val.Emit(OpCodes.Pop);
			val.Emit(OpCodes.Ldc_I4, 0);
		}

		public void ReworkLaserScope()
		{
			//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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Expected O, but got Unknown
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Expected O, but got Unknown
			ItemDef val = Addressables.LoadAssetAsync<ItemDef>((object)"RoR2/DLC1/CritDamage/CritDamage.asset").WaitForCompletion();
			RetierItem(val, (ItemTier)1);
			Sprite val2 = retierAssetBundle.LoadAsset<Sprite>("Assets/Icons/Laser_Scope.png");
			if (Object.op_Implicit((Object)(object)val2))
			{
				val.pickupIconSprite = val2;
			}
			RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(ScopeCritChance);
			CharacterBody.OnInventoryChanged += new hook_OnInventoryChanged(AddScopeItemBehavior);
			LanguageAPI.Add("ITEM_CRITDAMAGE_NAME", "Combat Telescope");
			LanguageAPI.Add("ITEM_CRITDAMAGE_PICKUP", "Increases 'Critical Strike' chance and damage while stationary.");
			LanguageAPI.Add("ITEM_CRITDAMAGE_DESC", "<style=cIsDamage>Critical Strikes</style> deal an additional <style=cIsDamage>100% damage</style> <style=cStack>(+100% per stack)</style>. " + $"Gain <style=cIsDamage>{scopeBaseCrit}% critical chance</style>, " + $"or <style=cIsDamage>{scopeBaseStationaryCrit}%</style> after standing still " + $"for <style=cIsUtility>{CombatTelescopeBehavior.combatTelescopeWaitTime}</style> seconds.");
		}

		private void AddScopeItemBehavior(orig_OnInventoryChanged orig, CharacterBody self)
		{
			orig.Invoke(self);
			self.AddItemBehavior<CombatTelescopeBehavior>(self.inventory.GetItemCount(Items.CritDamage));
		}

		private void ScopeCritChance(CharacterBody sender, StatHookEventArgs args)
		{
			if (!Object.op_Implicit((Object)(object)sender.inventory))
			{
				return;
			}
			int itemCount = sender.inventory.GetItemCount(Items.CritDamage);
			if (itemCount > 0)
			{
				int num = scopeBaseCrit;
				int buffCount = sender.GetBuffCount(CommonAssets.combatTelescopeCritChance);
				if (buffCount > 0)
				{
					num = scopeBaseStationaryCrit;
				}
				args.critAdd += (float)num;
			}
		}

		private void RevokeScopeRights(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			val.GotoNext((MoveType)2, new Func<Instruction, bool>[2]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, "RoR2.DLC1Content/Items", "CritDamage"),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Inventory>(x, "GetItemCount")
			});
			val.Emit(OpCodes.Ldc_I4, 0);
			val.Emit(OpCodes.Mul);
		}

		public void ReworkLeechingSeed()
		{
			//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_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			seedItemDef = Addressables.LoadAssetAsync<ItemDef>((object)"RoR2/Base/Seed/Seed.asset").WaitForCompletion();
			RetierItem(seedItemDef, (ItemTier)0);
			Sprite val = retierAssetBundle.LoadAsset<Sprite>("Assets/Icons/Leeching_Seed.png");
			if (Object.op_Implicit((Object)(object)val))
			{
				seedItemDef.pickupIconSprite = val;
			}
			GlobalEventManager.ProcessHitEnemy += new Manipulator(FuckLeechingSeed);
			OnHit.GetHitBehavior += new HitHookEventHandler(NewSeedBehavior);
			LanguageAPI.Add("ITEM_SEED_PICKUP", "Dealing damage heals you.");
			LanguageAPI.Add("ITEM_SEED_DESC", "Dealing damage increases <style=cIsHealing>base health regeneration</style> by <style=cIsHealing>+2 hp/s</style> " + $"for <style=cIsUtility>{seedRegenDurationBase}s</style> <style=cStack>(+{seedRegenDurationStack}s per stack)</style>.");
		}

		private void NewSeedBehavior(CharacterBody body, DamageInfo damageInfo, CharacterBody victimBody)
		{
			//IL_0040: 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 (((ProcChainMask)(ref damageInfo.procChainMask)).HasProc((ProcType)6))
			{
				return;
			}
			Inventory inventory = body.inventory;
			if ((Object)(object)inventory != (Object)null)
			{
				int itemCount = inventory.GetItemCount(seedItemDef);
				if (itemCount > 0)
				{
					ProcChainMask procChainMask = damageInfo.procChainMask;
					((ProcChainMask)(ref procChainMask)).AddProc((ProcType)6);
					body.AddTimedBuff(Buffs.MeatRegenBoost, (seedRegenDurationBase + seedRegenDurationStack * (float)(itemCount - 1)) * damageInfo.procCoefficient);
				}
			}
		}

		private void FuckLeechingSeed(ILContext il)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Expected O, but got Unknown
			//IL_0089: 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)
			ILCursor val = new ILCursor(il);
			int seedLoc = 14;
			val.GotoNext((MoveType)2, new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, "RoR2.RoR2Content/Items", "Seed"),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Inventory>(x, "GetItemCount"),
				(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref seedLoc)
			});
			int index = val.Index;
			val.Index = index - 1;
			val.Emit(OpCodes.Pop);
			val.Emit(OpCodes.Ldc_I4, 0);
		}

		public void ReworkFreshMeat()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			ChangeBuffStacking("MeatRegenBoost", canStack: true);
			RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(LetMeatActuallyStack);
			GlobalEventManager.OnCharacterDeath += new hook_OnCharacterDeath(MeatRegen);
			LanguageAPI.Add("ITEM_FLATHEALTH_PICKUP", "Regenerate health after killing an enemy.");
			LanguageAPI.Add("ITEM_FLATHEALTH_DESC", "Increases <style=cIsHealing>base health regeneration</style> by <style=cIsHealing>+2 hp/s</style> for <style=cIsUtility>3s</style> <style=cStack>(+3s per stack)</style> after killing an enemy.");
		}

		private void MeatRegen(orig_OnCharacterDeath orig, GlobalEventManager self, DamageReport damageReport)
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			CharacterBody attackerBody = damageReport.attackerBody;
			if ((Object)(object)attackerBody != (Object)null && (Object)(object)attackerBody.inventory != (Object)null)
			{
				Inventory inventory = attackerBody.inventory;
				int itemCount = inventory.GetItemCount(Items.FlatHealth);
				if (itemCount > 0)
				{
					attackerBody.AddTimedBuffAuthority(Buffs.MeatRegenBoost.buffIndex, (float)(3 * itemCount));
				}
			}
			orig.Invoke(self, damageReport);
		}

		private void LetMeatActuallyStack(CharacterBody sender, StatHookEventArgs args)
		{
			int buffCount = sender.GetBuffCount(Buffs.MeatRegenBoost);
			if (buffCount > 1)
			{
				args.baseRegenAdd += 2f * (1f + 0.2f * (sender.level - 1f)) * (float)(buffCount - 1);
			}
			Inventory inventory = sender.inventory;
			if ((Object)(object)inventory != (Object)null)
			{
				args.baseHealthAdd -= (float)(inventory.GetItemCount(Items.FlatHealth) * 25);
			}
		}

		private void PlanulaChanges()
		{
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Expected O, but got Unknown
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Expected O, but got Unknown
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Expected O, but got Unknown
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Expected O, but got Unknown
			LanguageAPI.Add("ITEM_PARENTEGG_DESC", "After beginning the teleporter event, " + Language.Styling.DamageColor("summon a sun overhead") + " that lasts for " + Language.Styling.DamageColor(sunDurationBase.ToString()) + " seconds " + Language.Styling.StackText($"+{sunDurationStack}") + ". " + Language.Styling.HealthColor("All enemies and allies burn near the sun") + ".");
			HealthComponent.TakeDamageProcess += new Manipulator(FuckPlanula);
			IdleToChargingState.OnEnter += new hook_OnEnter(OnTeleporterEventPreStart);
			ChargingState.OnEnter += new hook_OnEnter(OnTeleporterEventStart);
			ChargingState.FixedUpdate += new hook_FixedUpdate(OnTeleporterEventUpdate);
		}

		private void FuckPlanula(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0039: 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)
			ILCursor val = new ILCursor(il);
			val.GotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "RoR2.HealthComponent/ItemCounts", "parentEgg")
			});
			val.Emit(OpCodes.Pop);
			val.Emit(OpCodes.Ldc_I4_0);
		}

		private void OnTeleporterEventPreStart(orig_OnEnter orig, IdleToChargingState self)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			int itemCountForTeam = Util.GetItemCountForTeam((TeamIndex)1, Items.ParentEgg.itemIndex, false, false);
			if (itemCountForTeam <= 0)
			{
				return;
			}
			TeleporterInteraction teleporterInteraction = ((BaseTeleporterState)self).teleporterInteraction;
			GameObject chargeActivatorServer = teleporterInteraction.chargeActivatorServer;
			PlanulaSunController planulaSunController = ((Component)teleporterInteraction).gameObject.AddComponent<PlanulaSunController>();
			Debug.Log((object)((Object)(object)planulaSunController != (Object)null));
			if ((Object)(object)planulaSunController != (Object)null)
			{
				planulaSunController.holdoutZoneController = teleporterInteraction.holdoutZoneController;
				Transform val = ((EntityState)self).transform.Find("FireworkOrigin");
				if ((Object)(object)val == (Object)null)
				{
					val = ((Component)teleporterInteraction).transform;
				}
				planulaSunController.activator = chargeActivatorServer;
				planulaSunController.CreateBeamEffect(val);
				planulaSunController.SetSunDuration(itemCountForTeam);
			}
		}

		private void OnTeleporterEventStart(orig_OnEnter orig, ChargingState self)
		{
			orig.Invoke(self);
			PlanulaSunController component = ((EntityState)self).gameObject.GetComponent<PlanulaSunController>();
			if ((Object)(object)component != (Object)null)
			{
				component.EndBeamEffect();
				component.CreateSun();
			}
		}

		private void OnTeleporterEventUpdate(orig_FixedUpdate orig, ChargingState self)
		{
			orig.Invoke(self);
		}

		public void RazorwireRework()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected O, but got Unknown
			RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RazorwireArmor);
			CharacterBody.OnInventoryChanged += new hook_OnInventoryChanged(AddRazorBehavior);
			HealthComponent.TakeDamageProcess += new Manipulator(RazorwireBegin);
			LightningOrb.OnArrival += new Manipulator(RazorwireArrival);
			LanguageAPI.Add("ITEM_THORNS_PICKUP", "Retaliate in a burst of bleeding razors on taking damage. Recharges over time.");
			LanguageAPI.Add("ITEM_THORNS_DESC", $"Increase <style=cIsHealing>armor</style> by <style=cIsHealing>{razorwireArmorBase}</style> <style=cStack>(+{razorwireArmorStack} per stack)</stack>" + "Getting hit causes you to explode in a burst of razors, " + $"<style=cIsDamage>bleeding</style> up to <style=cIsDamage>{razorwireTargetsBase}</style> " + $"<style=cStack>(+{razorwireTargetsStack} per stack)</style> nearby enemies " + "for <style=cIsDamage>" + Tools.ConvertDecimal(razorwireBleedDuration * 0.8f) + "</style> base damage per <style=cIsDamage>razor charge</style> expelled. " + $"You can hold up to {RazorwireBehavior.baseRazors} <style=cStack>(+{RazorwireBehavior.stackRazors} per stack)</style> " + $"razor charges, all reloading over <style=cIsUtility>{RazorwireBehavior.rechargeTime}</style> seconds.");
		}

		private void RazorwireArmor(CharacterBody sender, StatHookEventArgs args)
		{
			if (Object.op_Implicit((Object)(object)sender.inventory))
			{
				int itemCount = sender.inventory.GetItemCount(Items.Thorns);
				if (itemCount > 0)
				{
					args.armorAdd += razorwireArmorBase + razorwireArmorStack * (float)(itemCount - 1);
				}
			}
		}

		private void AddRazorBehavior(orig_OnInventoryChanged orig, CharacterBody self)
		{
			orig.Invoke(self);
			int itemCount = self.inventory.GetItemCount(Items.Thorns);
			self.AddItemBehavior<RazorwireBehavior>(itemCount);
		}

		private void RazorwireArrival(ILContext il)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Expected O, but got Unknown
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			int healthComponentLoc = 0;
			val.GotoNext((MoveType)2, new Func<Instruction, bool>[2]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<HurtBox>(x, "healthComponent"),
				(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref healthComponentLoc)
			});
			val.GotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, healthComponentLoc)
			});
			val.Emit(OpCodes.Ldarg_0);
			val.EmitDelegate<Func<HealthComponent, LightningOrb, HealthComponent>>((Func<HealthComponent, LightningOrb, HealthComponent>)delegate(HealthComponent hc, LightningOrb orb)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Invalid comparison between Unknown and I4
				if ((int)orb.lightningType == 6 && (Object)(object)hc != (Object)null)
				{
					for (int i = 0; (float)i < orb.procCoefficient; i++)
					{
						DotController.InflictDot(((Component)hc).gameObject, orb.attacker, (DotIndex)0, razorwireBleedDuration, orb.damageValue, (uint?)null);
					}
					return null;
				}
				return hc;
			});
		}

		private void RazorwireBegin(ILContext il)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Expected O, but got Unknown
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			int buffCount = 0;
			val.GotoNext((MoveType)2, new Func<Instruction, bool>[2]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdflda<HealthComponent>(x, "itemCounts"),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<ItemCounts>(x, "thorns")
			});
			int num4 = default(int);
			int num3 = default(int);
			val.GotoPrev((MoveType)0, new Func<Instruction, bool>[2]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, ref num4),
				(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, ref num3)
			});
			val.Next.Operand = razorwireTargetsBase;
			int index = val.Index;
			val.Index = index + 1;
			val.Next.Operand = razorwireTargetsStack;
			val.GotoNext((MoveType)2, new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdflda<HealthComponent>(x, "itemCounts"),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<ItemCounts>(x, "thorns"),
				(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 0)
			});
			index = val.Index;
			val.Index = index - 1;
			val.Emit(OpCodes.Ldarg_0);
			val.EmitDelegate<Func<int, HealthComponent, int>>((Func<int, HealthComponent, int>)delegate(int itemCount, HealthComponent hc)
			{
				if (!NetworkServer.active)
				{
					return 0;
				}
				CharacterBody body2 = hc.body;
				buffCount = 0;
				while (body2.HasBuff(CommonAssets.razorChargeBuff))
				{
					body2.RemoveBuff(CommonAssets.razorChargeBuff);
					buffCount++;
				}
				return (buffCount > 0) ? itemCount : 0;
			});
			val.GotoNext((MoveType)2, new Func<Instruction, bool>[2]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdflda<HealthComponent>(x, "itemCounts"),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<ItemCounts>(x, "thorns")
			});
			int num2 = default(int);
			int num = default(int);
			val.GotoPrev((MoveType)0, new Func<Instruction, bool>[2]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, ref num2),
				(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, ref num)
			});
			val.Next.Operand = razorwireRangeBase;
			index = val.Index;
			val.Index = index + 1;
			val.Next.Operand = razorwireRangeStack;
			val.GotoNext((MoveType)0, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<OrbManager>(x, "AddOrb")
			});
			val.Emit(OpCodes.Ldarg_0);
			val.EmitDelegate<Func<LightningOrb, HealthComponent, LightningOrb>>((Func<LightningOrb, HealthComponent, LightningOrb>)delegate(LightningOrb razorwireOrb, HealthComponent hc)
			{
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Invalid comparison between Unknown and I4
				CharacterBody body = hc.body;
				razorwireOrb.procCoefficient = buffCount;
				razorwireOrb.damageValue = (((int)body.teamComponent.teamIndex == 1) ? 1f : 0.2f);
				return razorwireOrb;
			});
		}

		private void NerfRazorwireOrb(orig_Begin orig, LightningOrb self)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			if ((int)self.lightningType == 6)
			{
				self.procCoefficient = razorwireProcCoeff;
				self.damageType.damageType = (DamageType)1024;
			}
			orig.Invoke(self);
		}

		public void DeworkResonanceDisc()
		{
			//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_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Expected O, but got Unknown
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_020d: Expected O, but got Unknown
			//IL_0237: Unknown result type (might be due to invalid IL or missing references)
			//IL_023e: Expected O, but got Unknown
			//IL_0268: Unknown result type (might be due to invalid IL or missing references)
			//IL_026f: Expected O, but got Unknown
			//IL_0299: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a0: Expected O, but got Unknown
			//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d1: Expected O, but got Unknown
			//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0302: Expected O, but got Unknown
			AsyncOperationHandle<GameObject> val = Addressables.LoadAssetAsync<GameObject>((object)"bfba6e51566cdb5419002a0035f60af7");
			val.Completed += delegate(AsyncOperationHandle<GameObject> ctx)
			{
				ReplaceLaserTurbineController(ctx.Result);
			};
			LaserTurbineBaseState.OnEnter += new hook_OnEnter(TurbineState_OnEnter);
			EntityState.FixedUpdate += new hook_FixedUpdate(TurbineState_FixedUpdate);
			EntityState.OnExit += new hook_OnExit(RechargeTurbine_OnExit);
			string text = "launches itself toward a target for <style=cIsDamage>300%</style> base damage <style=cStack>(+300% per stack)</style>, piercing all enemies it doesn't kill, and then explodes for <style=cIsDamage>1000%</style> base damage <style=cStack>(+1000% per stack)</style>. Then returns to the user, striking all enemies along the way for <style=cIsDamage>300%</style> base damage <style=cStack>(+300% per stack)</style>.";
			bool flag = true;
			string text2 = "Obtain a Resonance Disc charged by killing enemies. Fires automatically when fully charged.";
			string text3 = "Killing enemies charges the Resonance Disc. The disc " + text;
			string text4 = "Gain a Resonance Disc that spins " + Language.Styling.DamageColor(Language.Styling.ConvertDecimal(spinPerKill / minSpin) + " faster") + " after killing enemies, up to " + Language.Styling.DamageColor((maxSpin / minSpin - 1f).ToString()) + " times. While spinning, the Resonance Disc continuously slows down to a minimum of " + Language.Styling.DamageColor(Language.Styling.ConvertDecimal(minSpin * 10f) + " Spin") + " at a rate of " + Language.Styling.DamageColor("-" + Language.Styling.ConvertDecimal(spinDecayRate) + " current Spin per second per second") + ", converting " + Language.Styling.DamageColor(Language.Styling.ConvertDecimal(spinDecayRate / minSpin) + " of lost Spin") + " into " + Language.Styling.UtilityColor("Charge") + ". " + Environment.NewLine + "When the Resonance Disc reaches " + Language.Styling.UtilityColor("100% Charge") + ", it consumes all " + Language.Styling.UtilityColor("Charge") + ". The disc then " + text;
			LanguageAPI.Add("ITEM_LASERTURBINE_PICKUP", flag ? text4 : text2);
			LanguageAPI.Add("ITEM_LASERTURBINE_DESC", flag ? text4 : text3);
			Hook val2 = new Hook((MethodBase)typeof(LaserTurbineController).GetMethod("Awake", (BindingFlags)(-1)), typeof(SwanSongPlugin).GetMethod("ReflectOnThatThang", (BindingFlags)(-1)));
			Hook val3 = new Hook((MethodBase)typeof(LaserTurbineController).GetMethod("Update", (BindingFlags)(-1)), typeof(SwanSongPlugin).GetMethod("ReflectOnThatThang", (BindingFlags)(-1)));
			Hook val4 = new Hook((MethodBase)typeof(LaserTurbineController).GetMethod("FixedUpdate", (BindingFlags)(-1)), typeof(SwanSongPlugin).GetMethod("ReflectOnThatThang", (BindingFlags)(-1)));
			Hook val5 = new Hook((MethodBase)typeof(LaserTurbineController).GetMethod("OnEnable", (BindingFlags)(-1)), typeof(SwanSongPlugin).GetMethod("ReflectOnThatThang", (BindingFlags)(-1)));
			Hook val6 = new Hook((MethodBase)typeof(LaserTurbineController).GetMethod("OnDisable", (BindingFlags)(-1)), typeof(SwanSongPlugin).GetMethod("ReflectOnThatThang", (BindingFlags)(-1)));
			Hook val7 = new Hook((MethodBase)typeof(LaserTurbineController).GetMethod("ExpendCharge", (BindingFlags)(-1)), typeof(SwanSongPlugin).GetMethod("ReflectOnThatThang", (BindingFlags)(-1)));
		}

		private static void ReflectOnThatThang(orig_idc orig, LaserTurbineController self)
		{
		}

		private void TurbineState_OnEnter(orig_OnEnter orig, LaserTurbineBaseState self)
		{
			if (self is FireMainBeamState || self is RechargeState)
			{
				GameObject gameObject = ((Component)((EntityState)self).outer).gameObject;
				LaserTurbineController component = gameObject.GetComponent<LaserTurbineController>();
				ResDiscContext resDiscContext = new ResDiscContext(component);
				resDiscStateContext[(EntityState)(object)self] = resDiscContext;
				if (self is FireMainBeamState)
				{
					if (NetworkServer.active)
					{
						resDiscContext.laserTurbineController.ExpendCharge();
					}
					resDiscContext.laserTurbineController.showTurbineDisplay = false;
				}
			}
			orig.Invoke(self);
		}

		private void TurbineState_FixedUpdate(orig_FixedUpdate orig, EntityState self)
		{
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Expected O, but got Unknown
			if (resDiscStateContext.ContainsKey(self))
			{
				ResDiscContext resDiscContext = resDiscStateContext[self];
				if (self is RechargeState)
				{
					if (self.isAuthority && resDiscContext.laserTurbineController.charge >= 1f)
					{
						self.outer.SetNextState((EntityState)new ReadyState());
					}
					return;
				}
			}
			orig.Invoke(self);
		}

		private void RechargeTurbine_OnExit(orig_OnExit orig, EntityState self)
		{
			if (resDiscStateContext.ContainsKey(self))
			{
				ResDiscContext resDiscContext = resDiscStateContext[self];
				if (self is FireMainBeamState)
				{
					resDiscContext.laserTurbineController.showTurbineDisplay = true;
				}
				resDiscStateContext.Remove(self);
			}
			orig.Invoke(self);
		}

		private void ReplaceLaserTurbineController(GameObject result)
		{
			laserTurbineControllerPrefab = result;
			LaserTurbineController component = result.GetComponent<LaserTurbineController>();
			if (Object.op_Implicit((Object)(object)component))
			{
				LaserTurbineController laserTurbineController = result.AddComponent<LaserTurbineController>();
				laserTurbineController.chargeIndicator = component.chargeIndicator;
				laserTurbineController.spinIndicator = component.spinIndicator;
				laserTurbineController.turbineDisplayRoot = component.turbineDisplayRoot;
				laserTurbineController.chargeIndicator = component.chargeIndicator;
			}
		}

		public void SquolypRework()
		{
			SquolypChangeAttack();
			SquolypChangeStats();
		}

		private void SquolypChangeAttack()
		{
			//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_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			SkillDef val = Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/Base/Squid/SquidTurretBodyTurret.asset").WaitForCompletion();
			Content.AddEntityState(typeof(SquidBlaster));
			SerializableEntityStateType activationState = default(SerializableEntityStateType);
			((SerializableEntityStateType)(ref activationState))..ctor(typeof(SquidBlaster));
			val.activationState = activationState;
		}

		private void SquolypChangeStats()
		{
			//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)
			GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Squid/SquidTurretBody.prefab").WaitForCompletion();
			CharacterBody component = val.GetComponent<CharacterBody>();
			if (Object.op_Implicit((Object)(object)component))
			{
				component.baseDamage = 12f;
				component.levelDamage = 2.4f;
			}
		}

		public void LunarExplodersDuringBrother()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected O, but got Unknown
			Phase1.OnEnter += new hook_OnEnter(InitializeExploderDirector);
			Phase2.OnEnter += new hook_OnEnter(DisableExploderDirector);
			Phase3.OnEnter += new hook_OnEnter(RestoreExploderDirector);
			Phase4.OnEnter += new hook_OnEnter(KillExploderDirector);
		}

		private void GetExploderCard(List<DirectorCardHolder> cardList, StageInfo currentStage)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Invalid comparison between Unknown and I4
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Invalid comparison between Unknown and I4
			Debug.Log((object)"jsd fjsn");
			if ((int)currentStage.stage != 65536)
			{
				return;
			}
			List<DirectorCardHolder> list = new List<DirectorCardHolder>();
			foreach (DirectorCardHolder card2 in cardList)
			{
				if ((int)card2.MonsterCategory == 2)
				{
					DirectorCard card = card2.Card;
					SpawnCard spawnCard = card.spawnCard;
					GameObject prefab = spawnCard.prefab;
					if (((Object)spawnCard).name == "cscLunarExploder")
					{
						exploderCards.Add(card);
					}
				}
			}
			foreach (DirectorCardHolder item in list)
			{
				cardList.Remove(item);
			}
		}

		private void InitializeExploderDirector(orig_OnEnter orig, Phase1 self)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			if ((Object)(object)exploderDirector == (Object)null)
			{
				GameObject val = new GameObject("CommencementPerfected_ChimeraExploderDirector_OrTheCPCEDForShort");
				val.transform.position = new Vector3(-88f, 491.1f, 0f);
				exploderDirector = val.AddComponent<ExploderDirector>();
				exploderDirector.baseState = (BrotherEncounterBaseState)(object)self;
			}
		}

		private void DisableExploderDirector(orig_OnEnter orig, Phase2 self)
		{
			orig.Invoke(self);
			exploderDirector.SetDirectorRate(phaseTwoRate);
		}

		private void RestoreExploderDirector(orig_OnEnter orig, Phase3 self)
		{
			orig.Invoke(self);
			exploderDirector.SetDirectorRate(phaseThreeRate);
		}

		private void KillExploderDirector(orig_OnEnter orig, Phase4 self)
		{
			orig.Invoke(self);
			Object.Destroy((Object)(object)((Component)exploderDirector).gameObject);
		}

		public static bool ModLoaded(string modGuid)
		{
			return modGuid != "" && Chainloader.PluginInfos.ContainsKey(modGuid);
		}

		public static bool IsMissileArtifactEnabled()
		{
			if (ModLoaded("com.RiskOfBrainrot.IAmBecomeMissiles"))
			{
				return GetMissileArtifactEnabled();
			}
			return false;
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		private static bool GetMissileArtifactEnabled()
		{
			return RunArtifactManager.instance.IsArtifactEnabled(MissileReworkPlugin.MissileArtifact);
		}

		private void Awake()
		{
			instance = this;
			Config.Init();
			Log.Init(((BaseUnityPlugin)this).Logger);
			CreateExpansionDef();
			Language.Init();
			Hooks.Init();
			CommonAssets.Init();
			EliteModule.Init();
			AllyCaps.Init();
			Spawnlists.Init();
			StormsCore.Init();
			ConfigManager.HandleConfigAttributes(((object)this).GetType(), "SwanSong", Config.MyConfig);
			InitializeChangesPreContent();
			InitializeContent();
			InitializeChanges();
			Materials.SwapShadersFromMaterialsInBundle(mainAssetBundle);
			Materials.SwapShadersFromMaterialsInBundle(orangeAssetBundle);
			new ContentPacks().Initialize();
		}

		private void CreateExpansionDef()
		{
			expansionDefSS2 = ScriptableObject.CreateInstance<ExpansionDef>();
			expansionDefSS2.nameToken = "EXPANSION2R4R_NAME";
			expansionDefSS2.descriptionToken = "EXPANSION2R4R_DESCRIPTION";
			expansionDefSS2.iconSprite = null;
			expansionDefSS2.disabledIconSprite = null;
			LanguageAPI.Add("EXPANSION2R4R_NAME", "Swan Song");
			LanguageAPI.Add("EXPANSION2R4R_DESCRIPTION", "Adds content from the 'Swan Song' expansion to the game.");
			Content.AddExpansionDef(expansionDefSS2);
			expansionDefSOTS = ScriptableObject.CreateInstance<ExpansionDef>();
			expansionDefSOTS.nameToken = "EXPANSIONSOTS_NAME";
			expansionDefSOTS.descriptionToken = "EXPANSIONSOTS_DESCRIPTION";
			expansionDefSOTS.iconSprite = null;
			expansionDefSOTS.disabledIconSprite = null;
			LanguageAPI.Add("EXPANSIONSOTS_NAME", "Secrets of the Scug");
			LanguageAPI.Add("EXPANSIONSOTS_DESCRIPTION", "Adds content from the 'Secrets of the Scug' expansion to the game.");
			Content.AddExpansionDef(expansionDefSOTS);
		}

		private void InitializeContent()
		{
			Type[] types = Assembly.GetExecutingAssembly().GetTypes();
			BeginInitializing<ItemBase>(types, "SwanSongItems.txt");
			BeginInitializing<EquipmentBase>(types, "SwanSongEquipment.txt");
			BeginInitializing<EliteEquipmentBase>(types, "SwanSongElites.txt");
			BeginInitializing<InteractableBase>(types, "SwanSongInteractables.txt");
			BeginInitializing<ArtifactBase>(types, "SwanSongArtifacts.txt");
			BeginInitializing<SkillBase>(types, "SwanSongSkills.txt");
			BeginInitializing<TwistedScavengerBase>(types, "SwanSongScavengers.txt");
		}

		private void InitializeChangesPreContent()
		{
			if (GetConfigBool(defaultValue: true, "Reworks : Commencement"))
			{
				MakePillarsFun();
				LunarExplodersDuringBrother();
			}
		}

		private void InitializeChanges()
		{
			BurnReworks();
			if (GetConfigBool(defaultValue: true, "Reworks : Razorwire"))
			{
				RazorwireRework();
			}
			if (GetConfigBool(defaultValue: true, "Reworks : Laser Scope"))
			{
				ReworkLaserScope();
			}
			if (GetConfigBool(defaultValue: true, "Reworks : Happiest Mask"))
			{
				HappiestMaskRework();
			}
			if (GetConfigBool(defaultValue: true, "Reworks : Hunters Harpoon"))
			{
				HuntersHarpoonRework();
			}
			if (GetConfigBool(defaultValue: true, "Reworks : Focused Convergence"))
			{
				FocusedConvergenceChanges();
			}
			if (GetConfigBool(defaultValue: true, "Reworks : Squid Polyp"))
			{
				SquolypRework();
			}
			if (GetConfigBool(defaultValue: true, "Reworks : Executive Card"))
			{
				ExecutiveCardChanges();
			}
			if (GetConfigBool(defaultValue: true, "Reworks : Leeching Seed"))
			{
				ReworkLeechingSeed();
			}
			if (GetConfigBool(defaultValue: true, "Reworks : Bison Steak"))
			{
				ReworkFreshMeat();
			}
			if (GetConfigBool(defaultValue: true, "Reworks : Gesture of the Drowned"))
			{
				GestureChanges();
			}
			if (GetConfigBool(defaultValue: true, "Reworks : Brittle Crown"))
			{
				BrittleCrownChanges();
			}
			if (GetConfigBool(defaultValue: true, "Reworks : Planula"))
			{
				PlanulaChanges();
			}
			if (GetConfigBool(defaultValue: true, "Reworks : Resonance Disc"))
			{
				DeworkResonanceDisc();
			}
			Secrets.AddSecrets();
		}

		private void BeginInitializing<T>(Type[] allTypes, string fileName = "") where T : SharedBase
		{
			Type baseType = typeof(T);
			if (!baseType.IsAbstract)
			{
				Log.Error(Log.Combine() + "Incorrect BaseType: " + baseType.Name);
				return;
			}
			IEnumerable<Type> enumerable = allTypes.Where((Type type) => !type.IsAbstract && type.IsSubclassOf(baseType));
			if (enumerable.Count() <= 0)
			{
				return;
			}
			Log.Debug(Log.Combine(baseType.Name) + "Initializing");
			foreach (Type item in enumerable)
			{
				string text = Log.Combine(base

ModularEclipse.dll.old

Decompiled a month ago
using System;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using On.RoR2;
using RoR2;
using UnityEngine;

[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 = "")]
[assembly: AssemblyCompany("ModularEclipse")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ModularEclipse")]
[assembly: AssemblyTitle("ModularEclipse")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace ModularEclipse;

[BepInPlugin("com.HouseOfFruits.ModularEclipse", "ModularEclipse", "1.0.0")]
public class ModularEclipsePlugin : BaseUnityPlugin
{
	public const string guid = "com.HouseOfFruits.ModularEclipse";

	public const string teamName = "HouseOfFruits";

	public const string modName = "ModularEclipse";

	public const string version = "1.0.0";

	public static PluginInfo PInfo { get; private set; }

	internal static ConfigFile ArtifactWhitelistConfig { get; set; }

	public static void SetArtifactDefaultWhitelist(ArtifactDef artifactDef, bool defaultValue)
	{
		string cachedName = artifactDef.cachedName;
		if (cachedName == "")
		{
			Debug.LogError((object)("Artifact " + artifactDef.nameToken + " has no cached name! The Eclipse rule choice selection will not work for it."));
		}
		else
		{
			ArtifactWhitelistConfig.Bind<bool>("Eclipse: Whitelisted Artifacts", cachedName, defaultValue, "If true, this artifact will be *allowed* for use in the Eclipse gamemode. Recommended only difficulty artifacts should be enabled.");
		}
	}

	private void Awake()
	{
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Expected O, but got Unknown
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Expected O, but got Unknown
		ArtifactWhitelistConfig = new ConfigFile(Paths.ConfigPath + "\\ModularEclipse.cfg", true);
		EclipseRun.OverrideRuleChoices += new hook_OverrideRuleChoices(EclipseRuleChoices);
	}

	private void EclipseRuleChoices(orig_OverrideRuleChoices orig, EclipseRun self, RuleChoiceMask mustInclude, RuleChoiceMask mustExclude, ulong runSeed)
	{
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
		int num = 0;
		ReadOnlyCollection<NetworkUser> readOnlyInstancesList = NetworkUser.readOnlyInstancesList;
		for (int i = 0; i < readOnlyInstancesList.Count; i++)
		{
			NetworkUser val = readOnlyInstancesList[i];
			SurvivorDef survivorPreference = val.GetSurvivorPreference();
			if (Object.op_Implicit((Object)(object)survivorPreference))
			{
				int num2 = EclipseRun.GetNetworkUserSurvivorCompletedEclipseLevel(val, survivorPreference) + 1;
				num = ((num > 0) ? Math.Min(num, num2) : num2);
			}
		}
		num = Math.Min(num, EclipseRun.maxEclipseLevel);
		DifficultyIndex eclipseDifficultyIndex = EclipseRun.GetEclipseDifficultyIndex(num);
		RuleDef val2 = RuleCatalog.FindRuleDef("Difficulty");
		foreach (RuleChoiceDef choice in val2.choices)
		{
			if (choice.excludeByDefault && choice.difficultyIndex <= eclipseDifficultyIndex)
			{
				if (choice.difficultyIndex == eclipseDifficultyIndex)
				{
					val2.defaultChoiceIndex = choice.localIndex;
				}
				((SerializableBitArray)mustInclude)[choice.globalIndex] = true;
				((SerializableBitArray)mustExclude)[choice.globalIndex] = false;
			}
			else
			{
				((SerializableBitArray)mustInclude)[choice.globalIndex] = false;
				((SerializableBitArray)mustExclude)[choice.globalIndex] = true;
			}
		}
		((Run)self).ForceChoice(mustInclude, mustExclude, "Items." + ((Object)Items.LunarTrinket).name + ".Off");
		for (int j = 0; j < ArtifactCatalog.artifactCount; j++)
		{
			ArtifactDef artifactDef = ArtifactCatalog.GetArtifactDef((ArtifactIndex)j);
			string cachedName = artifactDef.cachedName;
			if (cachedName == "")
			{
				Debug.LogError((object)("Artifact " + artifactDef.nameToken + " has no cached name! The Eclipse rule choice selection will not work for it."));
				continue;
			}
			Debug.LogWarning((object)cachedName);
			if (!ArtifactWhitelistConfig.Bind<bool>("Eclipse: Whitelisted Artifacts", cachedName, false, "If true, this artifact will be *allowed* for use in the Eclipse gamemode. Recommended only difficulty artifacts should be enabled.").Value)
			{
				RuleDef val3 = RuleCatalog.FindRuleDef("Artifacts." + cachedName);
				((Run)self).ForceChoice(mustInclude, mustExclude, val3.FindChoice("Off"));
			}
		}
	}
}