Decompiled source of TacoHCChanges v1.0.1

TacoHCChanges.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using EntityStates.Acolyte.Backpack;
using EntityStates.Enforcer;
using HG;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using RoR2;
using RoR2.Quests.TrialQuests;
using RoR2.Skills;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace TacoHCChanges
{
	[HarmonyPatch(typeof(TrialQuestSadismMoney), "OnEnter")]
	internal static class Patch_Greed_OnEnter
	{
		internal static bool GreedActive;

		private static void Prefix(TrialQuestSadismMoney __instance)
		{
			GreedActive = true;
			if (NetworkServer.active)
			{
				__instance.requiredMoneyScalingCoeff *= Plugin.GreedGoldMultiplier.Value;
				Plugin.Log.LogInfo((object)("[greed] requiredMoneyScalingCoeff now " + __instance.requiredMoneyScalingCoeff));
			}
		}

		private static void Postfix(TrialQuestSadismMoney __instance)
		{
			//IL_0085: 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)
			if (!NetworkServer.active)
			{
				return;
			}
			try
			{
				ShrineCombatBehavior[] array = Object.FindObjectsOfType<ShrineCombatBehavior>();
				foreach (ShrineCombatBehavior val in array)
				{
					CombatDirector component = ((Component)val).GetComponent<CombatDirector>();
					if (Object.op_Implicit((Object)(object)component))
					{
						float value = Traverse.Create((object)val).Property("monsterCredit", (object[])null).GetValue<float>();
						DirectorCard val2 = component.SelectMonsterCardForCombatShrine(value);
						if (val2 != null)
						{
							Traverse.Create((object)val).Field("chosenDirectorCard").SetValue((object)val2);
						}
						Plugin.Log.LogInfo((object)("[greed] shrine at " + ((object)((Component)val).transform.position/*cast due to .constrained prefix*/).ToString() + " credit=" + value + " card=" + Patch_Greed_ShrineCard.CardName(val2)));
					}
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogWarning((object)("[greed] could not re-roll shrines: " + ex));
			}
		}
	}
	[HarmonyPatch(typeof(TrialQuestSadismMoney), "OnExit")]
	internal static class Patch_Greed_OnExit
	{
		private static void Postfix()
		{
			Patch_Greed_OnEnter.GreedActive = false;
		}
	}
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	internal static class Patch_Greed_ShrineCredit
	{
		private static void Postfix(ref float __result)
		{
			if (Patch_Greed_OnEnter.GreedActive)
			{
				__result *= Plugin.GreedCreditMultiplier.Value;
			}
		}
	}
	[HarmonyPatch(typeof(CombatDirector), "SelectMonsterCardForCombatShrine")]
	internal static class Patch_Greed_ShrineCard
	{
		private static bool busy;

		internal static string CardName(DirectorCard card)
		{
			if (card == null)
			{
				return "none";
			}
			SpawnCard spawnCard = card.GetSpawnCard();
			if ((Object)(object)spawnCard != (Object)null && Object.op_Implicit((Object)(object)spawnCard.prefab))
			{
				return ((Object)spawnCard.prefab).name;
			}
			return "unknown";
		}

		private static void Postfix(CombatDirector __instance, float monsterCredit, ref DirectorCard __result)
		{
			if (busy || !Patch_Greed_OnEnter.GreedActive || __result == null)
			{
				return;
			}
			busy = true;
			try
			{
				DirectorCard val = __result;
				if (Random.value >= Plugin.GreedShrineBigChance.Value)
				{
					try
					{
						if (AccessTools.Method(typeof(Util), "CreateReasonableDirectorCardSpawnList", (Type[])null, (Type[])null).Invoke(null, new object[3]
						{
							monsterCredit,
							__instance.maximumNumberToSpawnBeforeSkipping,
							Plugin.GreedShrineSmallMinCount.Value
						}) is WeightedSelection<DirectorCard> val2 && val2.Count > 0)
						{
							val = val2.Evaluate(Random.value);
						}
					}
					catch (Exception ex)
					{
						Plugin.Log.LogWarning((object)("[greed] small pick failed: " + ex.Message));
					}
				}
				__result = val;
			}
			finally
			{
				busy = false;
			}
		}
	}
	internal static class TrialPages
	{
		internal static int completedTrials;

		internal static readonly HashSet<string> forced = new HashSet<string>();

		internal static void OnRunStart()
		{
			completedTrials = 0;
			forced.Clear();
		}

		internal static void OnTrialCompleted()
		{
			completedTrials++;
			Plugin.Log.LogInfo((object)("[pages] trial completed. count=" + completedTrials + " needed=" + Plugin.ReincarnationPageAfterTrials.Value));
		}

		internal static ItemDef FindItem(string name)
		{
			//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_0009: Invalid comparison between Unknown and I4
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			ItemIndex val = ItemCatalog.FindItemIndex(name);
			if ((int)val != -1)
			{
				return ItemCatalog.GetItemDef(val);
			}
			return null;
		}

		internal static bool HasPage(Inventory inventory, string baseName)
		{
			string[] array = new string[3]
			{
				baseName,
				baseName + "Consumed",
				baseName + "Cooldown"
			};
			for (int i = 0; i < array.Length; i++)
			{
				ItemDef val = FindItem(array[i]);
				if ((Object)(object)val != (Object)null && inventory.GetItemCountEffective(val) > 0)
				{
					return true;
				}
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(PickupDropletController), "CreatePickupDroplet", new Type[]
	{
		typeof(CreatePickupInfo),
		typeof(Vector3),
		typeof(Vector3)
	})]
	internal static class Patch_PageDroplet
	{
		private static void Prefix(ref CreatePickupInfo pickupInfo, Vector3 position)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Invalid comparison between Unknown and I4
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Invalid comparison between Unknown and I4
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_0227: Unknown result type (might be due to invalid IL or missing references)
			//IL_022c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0231: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				int value = Plugin.ReincarnationPageAfterTrials.Value;
				if (value <= 0 || !NetworkServer.active)
				{
					return;
				}
				PickupDef pickupDef = PickupCatalog.GetPickupDef(((CreatePickupInfo)(ref pickupInfo)).pickup.pickupIndex);
				if (pickupDef == null || (int)pickupDef.itemIndex == -1)
				{
					return;
				}
				ItemDef itemDef = ItemCatalog.GetItemDef(pickupDef.itemIndex);
				if ((Object)(object)itemDef == (Object)null || !((Object)itemDef).name.StartsWith("Page") || ((Object)itemDef).name.EndsWith("Consumed") || ((Object)itemDef).name.EndsWith("Cooldown"))
				{
					return;
				}
				TrialController val = Object.FindObjectOfType<TrialController>();
				if (!Object.op_Implicit((Object)(object)val))
				{
					return;
				}
				int num = TrialPages.completedTrials + (((int)val.trialControllerState != 2) ? 1 : 0);
				Plugin.Log.LogInfo((object)("[pages] page droplet " + ((Object)itemDef).name + " during trial #" + num + " (state " + ((object)val.trialControllerState/*cast due to .constrained prefix*/).ToString() + ")"));
				if (num < value)
				{
					return;
				}
				string value2 = Plugin.ReincarnationPageItem.Value;
				ItemDef val2 = TrialPages.FindItem(value2);
				if ((Object)(object)val2 == (Object)null || (Object)(object)itemDef == (Object)(object)val2)
				{
					return;
				}
				CharacterBody val3 = null;
				float num2 = float.MaxValue;
				foreach (CharacterBody readOnlyInstances in CharacterBody.readOnlyInstancesList)
				{
					if (readOnlyInstances.isPlayerControlled && Object.op_Implicit((Object)(object)readOnlyInstances.inventory))
					{
						Vector3 val4 = readOnlyInstances.corePosition - position;
						float sqrMagnitude = ((Vector3)(ref val4)).sqrMagnitude;
						if (sqrMagnitude < num2)
						{
							num2 = sqrMagnitude;
							val3 = readOnlyInstances;
						}
					}
				}
				if (Object.op_Implicit((Object)(object)val3) && Object.op_Implicit((Object)(object)val3.master))
				{
					string item = ((Object)val3.master).GetInstanceID().ToString();
					if (!TrialPages.forced.Contains(item) && !TrialPages.HasPage(val3.inventory, value2))
					{
						TrialPages.forced.Add(item);
						((CreatePickupInfo)(ref pickupInfo)).pickup = new UniquePickup(PickupCatalog.FindPickupIndex(val2.itemIndex));
						Plugin.Log.LogInfo((object)("[pages] replaced " + ((Object)itemDef).name + " with " + ((Object)val2).name + " for " + val3.GetUserName()));
					}
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogWarning((object)("[pages] droplet patch failed: " + ex.Message));
			}
		}
	}
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	internal static class Patch_TrialController_State
	{
		private static void Prefix(TrialController __instance, TrialControllerState value)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Invalid comparison between Unknown and I4
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Invalid comparison between Unknown and I4
			if (NetworkServer.active && (int)value == 2 && (int)__instance.trialControllerState != 2)
			{
				TrialPages.OnTrialCompleted();
			}
		}
	}
	[HarmonyPatch(typeof(BlightZoneController), "OnStartClient")]
	internal static class Patch_Blight_Start
	{
		private static void Postfix(BlightZoneController __instance)
		{
			float value = Plugin.CorpseLilyFullSizeFraction.Value;
			Traverse val = Traverse.Create((object)__instance).Field("expectedTimeOfMaxSizeNormalized");
			float value2 = val.GetValue<float>();
			if (value > 0f && value < value2)
			{
				val.SetValue((object)value);
				Plugin.Log.LogInfo((object)("[lily] full size at charge " + value + " (was " + value2 + ")"));
			}
		}
	}
	[HarmonyPatch(typeof(BlightZoneController), "GetAdjustedRadius")]
	internal static class Patch_Blight_Radius
	{
		private static void Prefix(BlightZoneController __instance, ref float holdoutZoneCurrentRadius)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Invalid comparison between Unknown and I4
			if (Plugin.CorpseLilyIgnoreEclipseShrink.Value && Object.op_Implicit((Object)(object)Run.instance) && (int)Run.instance.selectedDifficulty >= 4)
			{
				HoldoutZoneController value = Traverse.Create((object)__instance).Field("_holdoutZoneController").GetValue<HoldoutZoneController>();
				if (!((Object)(object)value != (Object)null) || !value.ignoreRadiusModifiers)
				{
					holdoutZoneCurrentRadius *= 2f;
				}
			}
		}
	}
	[HarmonyPatch(typeof(BrotherSuperArmorController), "OnDamageDealtServer")]
	internal static class Patch_KarmicShell
	{
		private static bool Prefix()
		{
			return !Plugin.RemoveKarmicShell.Value;
		}
	}
	[HarmonyPatch(typeof(CharacterBody), "OnInventoryChanged")]
	internal static class Patch_Mithrix_Items
	{
		private static void Postfix(CharacterBody __instance)
		{
			if (!NetworkServer.active || (!BrotherKarmaUtils.IsBrotherStrict(__instance) && !BrotherKarmaUtils.IsBrotherHurt(__instance)))
			{
				return;
			}
			Inventory inventory = __instance.inventory;
			if (!Object.op_Implicit((Object)(object)inventory))
			{
				return;
			}
			BrotherSuperArmorController component = ((Component)__instance).GetComponent<BrotherSuperArmorController>();
			int num = ((!Object.op_Implicit((Object)(object)component)) ? 1 : component.requiredKarma);
			if ((Object.op_Implicit((Object)(object)KarmaManager.instance) ? KarmaManager.instance.GetEffectiveKarma() : 0) >= num)
			{
				int value = Plugin.MithrixAdaptiveArmorStacks.Value;
				int itemCountEffective = inventory.GetItemCountEffective(Items.AdaptiveArmor);
				if (value > itemCountEffective)
				{
					inventory.GiveItemPermanent(Items.AdaptiveArmor, value - itemCountEffective);
					Plugin.Log.LogInfo((object)("[mithrix] gave " + (value - itemCountEffective) + " Adaptive Armor to " + ((Object)__instance).name));
				}
				int value2 = Plugin.MithrixBoostHpStacks.Value;
				CharacterMaster master = __instance.master;
				if (value2 > 0 && Object.op_Implicit((Object)(object)master) && !Object.op_Implicit((Object)(object)((Component)master).GetComponent<TacoMithrixHpMarker>()))
				{
					((Component)master).gameObject.AddComponent<TacoMithrixHpMarker>();
					inventory.GiveItemPermanent(Items.BoostHp, value2);
					Plugin.Log.LogInfo((object)("[mithrix] gave " + value2 + " BoostHp stacks to " + ((Object)__instance).name + ". maxHealth=" + __instance.maxHealth));
				}
			}
		}
	}
	internal class TacoMithrixHpMarker : MonoBehaviour
	{
	}
	[HarmonyPatch(typeof(CombatDirector), "CombatShrineActivation")]
	internal static class Patch_Greed_ShrineActivationReroll
	{
		private static void Prefix(CombatDirector __instance, float monsterCredit, ref DirectorCard chosenDirectorCard)
		{
			if (!Patch_Greed_OnEnter.GreedActive)
			{
				return;
			}
			try
			{
				DirectorCard val = __instance.SelectMonsterCardForCombatShrine(monsterCredit);
				if (val != null)
				{
					chosenDirectorCard = val;
				}
				Plugin.Log.LogInfo((object)("[greed] shrine activation credit=" + monsterCredit + " card=" + Patch_Greed_ShrineCard.CardName(chosenDirectorCard)));
			}
			catch (Exception ex)
			{
				Plugin.Log.LogWarning((object)("[greed] reroll failed: " + ex.Message));
			}
		}
	}
	[HarmonyPatch(typeof(BossGroup), "DropRewards")]
	internal static class Patch_ScavDeath_Basilica
	{
		private static string PathOf(Transform t)
		{
			string text = (Object.op_Implicit((Object)(object)t) ? ((Object)t).name : "(null)");
			while (Object.op_Implicit((Object)(object)t) && Object.op_Implicit((Object)(object)t.parent))
			{
				t = t.parent;
				text = ((Object)t).name + "/" + text;
			}
			return text;
		}

		private static bool Prefix(BossGroup __instance)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if (!NetworkServer.active)
				{
					return true;
				}
				Scene activeScene = SceneManager.GetActiveScene();
				string name = ((Scene)(ref activeScene)).name;
				bool flag = (Object)(object)((Component)__instance).GetComponentInParent<TeleporterInteraction>() != (Object)null || (Object.op_Implicit((Object)(object)TeleporterInteraction.instance) && (Object)(object)((Component)TeleporterInteraction.instance).GetComponent<BossGroup>() == (Object)(object)__instance);
				Plugin.Log.LogInfo((object)("[basilica] BossGroup.DropRewards enabled=" + Plugin.BasilicaChestEnabled.Value + " scene=" + name + " group=" + PathOf(((Component)__instance).transform) + " dropPosition=" + PathOf(__instance.dropPosition) + " teleporterGroup=" + flag));
				string value = Plugin.BasilicaSceneMatch.Value;
				bool flag2 = name.IndexOf("sanctum", StringComparison.OrdinalIgnoreCase) >= 0 || (!string.IsNullOrWhiteSpace(value) && name.IndexOf(value, StringComparison.OrdinalIgnoreCase) >= 0) || PathOf(((Component)__instance).transform).IndexOf("Sanctum", StringComparison.OrdinalIgnoreCase) >= 0;
				if (!Plugin.BasilicaChestEnabled.Value || !flag2 || flag || !Object.op_Implicit((Object)(object)__instance.dropPosition))
				{
					return true;
				}
				bool num = SpawnChests(__instance.dropPosition.position);
				if (num)
				{
					Plugin.Log.LogInfo((object)"[basilica] replaced the hand drop with a chest.");
				}
				return !num;
			}
			catch (Exception ex)
			{
				Plugin.Log.LogWarning((object)("[basilica] patch failed: " + ex));
				return true;
			}
		}

		private unsafe static bool SpawnChests(Vector3 center)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: 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_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: 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_00e5: 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_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Expected O, but got Unknown
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Expected O, but got Unknown
			if (!Object.op_Implicit((Object)(object)Run.instance) || !Object.op_Implicit((Object)(object)DirectorCore.instance))
			{
				return false;
			}
			SpawnCard val = Addressables.LoadAssetAsync<SpawnCard>((object)Plugin.BasilicaChestAddress.Value).WaitForCompletion();
			if ((Object)(object)val == (Object)null)
			{
				Plugin.Log.LogWarning((object)("[basilica] could not load chest card '" + Plugin.BasilicaChestAddress.Value + "'."));
				return false;
			}
			int num = ((!Plugin.BasilicaChestPerPlayer.Value) ? 1 : Math.Max(1, Run.instance.participatingPlayerCount));
			int cost = Plugin.BasilicaChestCost.Value;
			int num2 = 0;
			for (int i = 0; i < num; i++)
			{
				Vector3 val2 = ((num > 1) ? (Quaternion.AngleAxis(360f / (float)num * (float)i, Vector3.up) * (Vector3.forward * 4f)) : Vector3.zero);
				DirectorPlacementRule val3 = new DirectorPlacementRule
				{
					placementMode = (PlacementMode)0,
					position = center + val2,
					rotation = Quaternion.identity
				};
				DirectorSpawnRequest val4 = new DirectorSpawnRequest(val, val3, Run.instance.runRNG);
				val4.onSpawnedServer = (Action<SpawnResult>)Delegate.Combine(val4.onSpawnedServer, (Action<SpawnResult>)delegate(SpawnResult result)
				{
					//IL_0000: 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_0016: Unknown result type (might be due to invalid IL or missing references)
					if (result.success && Object.op_Implicit((Object)(object)result.spawnedInstance))
					{
						PurchaseInteraction component = result.spawnedInstance.GetComponent<PurchaseInteraction>();
						if (Object.op_Implicit((Object)(object)component))
						{
							component.Networkcost = cost;
						}
					}
				});
				if (Object.op_Implicit((Object)(object)DirectorCore.instance.TrySpawnObject(val4)))
				{
					num2++;
				}
			}
			ManualLogSource log = Plugin.Log;
			string text = num2.ToString();
			Vector3 val5 = center;
			log.LogInfo((object)("[basilica] spawned " + text + " chest(s) at " + ((object)(*(Vector3*)(&val5))/*cast due to .constrained prefix*/).ToString()));
			return num2 > 0;
		}
	}
	[HarmonyPatch(typeof(CharacterBody), "FixedUpdate")]
	internal static class Patch_Echo_ArmorBoost
	{
		private static void Postfix(CharacterBody __instance)
		{
			AcolyteFormController val = default(AcolyteFormController);
			if (NetworkServer.active && Plugin.EchoArmorBoost.Value && ((Component)__instance).TryGetComponent<AcolyteFormController>(ref val))
			{
				BuffDef armorBoost = Buffs.ArmorBoost;
				bool isEchoForm = val.isEchoForm;
				bool flag = __instance.HasBuff(armorBoost);
				if (isEchoForm && !flag)
				{
					__instance.AddBuff(armorBoost);
				}
				else if (!isEchoForm && flag)
				{
					__instance.RemoveBuff(armorBoost);
				}
			}
		}
	}
	internal sealed class Locked<T>
	{
		public T Value;

		public Locked(T value)
		{
			Value = value;
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.taco.tacohcchanges", "TacoHCChanges", "1.0.1")]
	public class Plugin : BaseUnityPlugin
	{
		public const string PluginGuid = "com.taco.tacohcchanges";

		public const string PluginName = "TacoHCChanges";

		public const string PluginVersion = "1.0.1";

		internal static ManualLogSource Log;

		internal static ConfigEntry<bool> KeepBarrierOnKineticExplode;

		internal static ConfigEntry<bool> MatchKineticWalkPenaltyToNormal;

		internal static ConfigEntry<float> KineticDurationMultiplier;

		internal static ConfigEntry<float> KineticDamageLimitMultiplier;

		internal static ConfigEntry<bool> EchoResetCooldownsOnEnter;

		internal static ConfigEntry<bool> EchoResetCooldownsOnExit;

		internal static ConfigEntry<float> EchoCooldownReduction;

		internal static ConfigEntry<bool> MoveDampCaverns;

		internal static Locked<string> DampCavernsSceneName;

		internal static Locked<float> DampCavernsWeight;

		internal static Locked<int> DampCavernsInteractableCredits;

		internal static Locked<bool> DampCavernsBlockAccessNode;

		internal static Locked<string> AccessNodeNameMatch;

		internal static Locked<bool> ReaperGreenExecute;

		internal static Locked<bool> ReaperGreenProjectiles;

		internal static Locked<string> ReaperExecuteNumbers;

		internal static ConfigEntry<bool> EchoArmorBoost;

		internal static ConfigEntry<float> GreedGoldMultiplier;

		internal static ConfigEntry<float> GreedCreditMultiplier;

		internal static ConfigEntry<float> GreedShrineBigChance;

		internal static ConfigEntry<int> GreedShrineSmallMinCount;

		internal static ConfigEntry<int> ReincarnationPageAfterTrials;

		internal static Locked<string> ReincarnationPageItem;

		internal static ConfigEntry<float> CorpseLilyFullSizeFraction;

		internal static ConfigEntry<bool> CorpseLilyIgnoreEclipseShrink;

		internal static ConfigEntry<bool> RemoveKarmicShell;

		internal static ConfigEntry<int> MithrixAdaptiveArmorStacks;

		internal static ConfigEntry<int> MithrixBoostHpStacks;

		internal static ConfigEntry<bool> BasilicaChestEnabled;

		internal static Locked<string> BasilicaSceneMatch;

		internal static Locked<string> BasilicaChestAddress;

		internal static Locked<int> BasilicaChestCost;

		internal static ConfigEntry<bool> BasilicaChestPerPlayer;

		internal static ConfigEntry<bool> VerboseLogging;

		private void Awake()
		{
			//IL_0390: Unknown result type (might be due to invalid IL or missing references)
			//IL_04cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f1: Expected O, but got Unknown
			Log = ((BaseUnityPlugin)this).Logger;
			KeepBarrierOnKineticExplode = ((BaseUnityPlugin)this).Config.Bind<bool>("Enforcer", "KeepBarrierOnKineticExplode", true, "If true, Kinetic Charge keeps its barrier damage scaling but no longer wipes all your barrier when it ends.");
			MatchKineticWalkPenaltyToNormal = ((BaseUnityPlugin)this).Config.Bind<bool>("Enforcer", "MatchKineticWalkPenaltyToNormal", true, "If true, Kinetic Charge uses the same walk speed penalty as the normal secondary (Protect and Serve).");
			KineticDurationMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Enforcer", "KineticDurationMultiplier", 1f, "Multiplier on how long Kinetic Charge can be held before it fires automatically. 1 = vanilla, 2 = twice as long.");
			KineticDamageLimitMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Enforcer", "KineticDamageLimitMultiplier", 1f, "Multiplier on how much damage Kinetic Charge can absorb (as a fraction of max health) before it fires, for the damage-limited variant. 1 = vanilla.");
			EchoResetCooldownsOnEnter = ((BaseUnityPlugin)this).Config.Bind<bool>("Acolyte", "EchoResetCooldownsOnEnter", true, "If true, entering Echo form resets all skill cooldowns except Sacrifice.");
			EchoResetCooldownsOnExit = ((BaseUnityPlugin)this).Config.Bind<bool>("Acolyte", "EchoResetCooldownsOnExit", false, "If true, leaving Echo form resets all skill cooldowns except Sacrifice.");
			EchoCooldownReduction = ((BaseUnityPlugin)this).Config.Bind<float>("Acolyte", "EchoCooldownReduction", 0.5f, "Fraction of skill cooldown removed while in Echo form (Sacrifice excluded). 0.5 = 50% shorter cooldowns, 0 = off.");
			MoveDampCaverns = ((BaseUnityPlugin)this).Config.Bind<bool>("Stages", "MoveDampCaverns", true, "If true, Damp Caverns moves from the stage 3 pool to the stage 2 pool.");
			DampCavernsSceneName = new Locked<string>("fungal");
			DampCavernsWeight = new Locked<float>(1f);
			DampCavernsInteractableCredits = new Locked<int>(280);
			DampCavernsBlockAccessNode = new Locked<bool>(value: true);
			AccessNodeNameMatch = new Locked<string>("AccessNodeFights,Access Codes Node");
			ReaperGreenExecute = new Locked<bool>(value: true);
			ReaperGreenProjectiles = new Locked<bool>(value: true);
			ReaperExecuteNumbers = new Locked<string>("6,66,666,6666,66000,666000");
			EchoArmorBoost = ((BaseUnityPlugin)this).Config.Bind<bool>("Acolyte", "EchoArmorBoost", true, "If true, Echo form gives the Armor Boost buff (+200 armor, about 67% less damage) for as long as you are transformed.");
			GreedGoldMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Trials", "GreedGoldMultiplier2", 1f, "Multiplier on the gold required to finish the Trial of Infernal Greed. 0.75 = 25% less gold, 1 = vanilla.");
			GreedCreditMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Trials", "GreedCreditMultiplier3", 1f, "Multiplier on the monster credits used by combat shrines during the Trial of Infernal Greed. Lower = weaker waves. 1 = vanilla.");
			GreedShrineBigChance = ((BaseUnityPlugin)this).Config.Bind<float>("Trials", "GreedShrineBigChance", 0.2f, "Chance a combat shrine uses the normal pick (can be the most expensive enemy, e.g. Greater Wisp or Parent). Otherwise it must pick an enemy cheap enough to spawn several.");
			GreedShrineSmallMinCount = ((BaseUnityPlugin)this).Config.Bind<int>("Trials", "GreedShrineSmallMinCount", 5, "In the non-big case, the shrine's credits must afford at least this many of the chosen enemy.");
			ReincarnationPageAfterTrials = ((BaseUnityPlugin)this).Config.Bind<int>("Trials", "ReincarnationPageAfterTrials", 3, "After this many trials are completed in one run, every player who has no Reincarnation page is given one. 0 = off.");
			ReincarnationPageItem = new Locked<string>("PageDie");
			CorpseLilyFullSizeFraction = ((BaseUnityPlugin)this).Config.Bind<float>("Items", "CorpseLilyFullSizeFraction", 0.33f, "Corpse Lily reaches full size once the teleporter charge reaches this fraction. 1 = vanilla (full charge), 0.33 = a third of the event.");
			CorpseLilyIgnoreEclipseShrink = ((BaseUnityPlugin)this).Config.Bind<bool>("Items", "CorpseLilyIgnoreEclipseShrink", true, "If true, Corpse Lily is no longer capped by the Eclipse 2 teleporter radius reduction.");
			RemoveKarmicShell = ((BaseUnityPlugin)this).Config.Bind<bool>("Mithrix", "RemoveKarmicShell", true, "If true, Mithrix never gains the Karmic Shell (the 1 damage window every 10% health).");
			MithrixAdaptiveArmorStacks = ((BaseUnityPlugin)this).Config.Bind<int>("Mithrix", "AdaptiveArmorStacks2", 2, "Stacks of Adaptive Armor given to Mithrix whenever the Karmic Shell would have been active. More stacks = armor builds faster (the cap is fixed). 0 = none.");
			MithrixBoostHpStacks = ((BaseUnityPlugin)this).Config.Bind<int>("Mithrix", "BoostHpStacks2", 0, "Extra max health stacks for Mithrix (each stack is about +10% max health). 0 = none (default).");
			BasilicaChestEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Stages", "BasilicaChestEnabled", true, "If true, Lurid Basilica spawns a free legendary chest instead of dropping its boss reward item.");
			BasilicaSceneMatch = new Locked<string>("sanctum");
			BasilicaChestAddress = new Locked<string>("RoR2/Base/GoldChest/iscGoldChest.asset");
			BasilicaChestCost = new Locked<int>(0);
			BasilicaChestPerPlayer = ((BaseUnityPlugin)this).Config.Bind<bool>("Stages", "BasilicaChestPerPlayer", true, "If true, one chest spawns per player.");
			VerboseLogging = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "VerboseLogging", false, "Log extra information to the BepInEx log. Useful while we tune things.");
			new Harmony("com.taco.tacohcchanges").PatchAll(typeof(Plugin).Assembly);
			RiskOfOptionsSupport.TryRegister((BaseUnityPlugin)(object)this);
			Run.onRunStartGlobal += OnRunStart;
			SceneManager.activeSceneChanged += OnSceneChanged;
			Stage.onStageStartGlobal += OnStageStart;
			SceneDirector.onPrePopulateSceneServer += CavernsTuning.OnPrePopulate;
			SceneDirector.onPostPopulateSceneServer += CavernsTuning.OnPostPopulate;
			Log.LogInfo((object)"TacoHCChanges 1.0.1 loaded.");
			RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(RegisterDumpCommand));
			try
			{
				string[] array = new string[2] { "InitConVars", "Awake" };
				foreach (string text in array)
				{
					MethodInfo methodInfo = AccessTools.Method(typeof(Console), text, (Type[])null, (Type[])null);
					if (methodInfo != null)
					{
						new Harmony("com.taco.tacohcchanges.con").Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(typeof(Plugin), "ConsoleHook", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
					}
				}
			}
			catch (Exception ex)
			{
				Log.LogWarning((object)("[dump] console hook failed: " + ex.Message));
			}
		}

		private static void OnSceneChanged(Scene oldScene, Scene newScene)
		{
			if (VerboseLogging.Value)
			{
				Log.LogInfo((object)("[scene] " + ((Scene)(ref newScene)).name));
			}
		}

		private static void OnStageStart(Stage stage)
		{
			GreenRecolor.ApplyReaperMaterials();
			if (VerboseLogging.Value)
			{
				SceneDef sceneDefForCurrentScene = SceneCatalog.GetSceneDefForCurrentScene();
				if ((Object)(object)sceneDefForCurrentScene != (Object)null)
				{
					Log.LogInfo((object)("[scene] stage start: cachedName=" + sceneDefForCurrentScene.cachedName + " nameToken=" + sceneDefForCurrentScene.nameToken));
				}
			}
		}

		private static void OnRunStart(Run run)
		{
			TrialPages.OnRunStart();
			StageMover.Prepare();
			GreenRecolor.ApplyExecuteEffect();
			TacoTicker.Ensure();
			GreenRecolor.ApplyReaperMaterials();
			if (!VerboseLogging.Value)
			{
				return;
			}
			try
			{
				Log.LogInfo((object)("[recon] KineticCharge2Activate.durationLimit = " + KineticCharge2Activate.durationLimit));
				Log.LogInfo((object)("[recon] KineticCharge2Activate.damageLimitFraction = " + KineticCharge2Activate.damageLimitFraction));
				Log.LogInfo((object)("[recon] KineticChargeShieldActive.duration = " + KineticChargeShieldActive.duration));
				float? num = Patch_Kinetic2_OnEnter.ReadNormalWalkPenalty();
				Log.LogInfo((object)("[recon] ProtectAndServeActivate.walkSpeedPenalty = " + (num.HasValue ? num.Value.ToString() : "unreadable")));
				EntityState obj = EntityStateCatalog.InstantiateState(typeof(KineticCharge2Activate));
				KineticCharge2Activate val = (KineticCharge2Activate)(object)((obj is KineticCharge2Activate) ? obj : null);
				if (val != null)
				{
					Log.LogInfo((object)("[recon] KineticCharge2Activate.walkSpeedPenalty = " + ((ProtectAndServeBaseState)val).walkSpeedPenalty));
				}
				Log.LogInfo((object)("[recon] DLC4TrialSelector.totalAllotedSecondsForTrials = " + DLC4TrialSelector.totalAllotedSecondsForTrials));
			}
			catch (Exception ex)
			{
				Log.LogWarning((object)("[recon] failed: " + ex));
			}
		}

		[ConCommand(/*Could not decode attribute arguments.*/)]
		private static void ConsoleHook()
		{
			RegisterDumpCommand();
		}

		private static void RegisterDumpCommand()
		{
			try
			{
				Console instance = Console.instance;
				if (!((Object)(object)instance == (Object)null))
				{
					BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;
					FieldInfo field = typeof(Console).GetField("concommandCatalog", bindingAttr);
					if (field == null)
					{
						Log.LogWarning((object)"[dump] concommandCatalog not found");
					}
					else if (field.GetValue(instance) is IDictionary dictionary && !dictionary.Contains("taco_purple_watch"))
					{
						Type? nestedType = typeof(Console).GetNestedType("ConCommand", bindingAttr);
						Type nestedType2 = typeof(Console).GetNestedType("ConCommandDelegate", bindingAttr);
						object obj = Activator.CreateInstance(nestedType);
						nestedType.GetField("flags", bindingAttr)?.SetValue(obj, (object)(ConVarFlags)0);
						nestedType.GetField("helpText", bindingAttr)?.SetValue(obj, "taco_dump <key>: dump a prefab to the BepInEx log.");
						Delegate value = Delegate.CreateDelegate(nestedType2, typeof(Plugin).GetMethod("CCTacoDump"));
						nestedType.GetField("action", bindingAttr).SetValue(obj, value);
						dictionary["taco_dump"] = obj;
						object obj2 = Activator.CreateInstance(nestedType);
						nestedType.GetField("flags", bindingAttr)?.SetValue(obj2, (object)(ConVarFlags)0);
						nestedType.GetField("helpText", bindingAttr)?.SetValue(obj2, "taco_dump_state <EntityStates type>");
						nestedType.GetField("action", bindingAttr).SetValue(obj2, Delegate.CreateDelegate(nestedType2, typeof(Plugin).GetMethod("CCTacoDumpState")));
						dictionary["taco_dump_state"] = obj2;
						object obj3 = Activator.CreateInstance(nestedType);
						nestedType.GetField("flags", bindingAttr)?.SetValue(obj3, (object)(ConVarFlags)0);
						nestedType.GetField("helpText", bindingAttr)?.SetValue(obj3, "taco_purple_watch 1/0");
						nestedType.GetField("action", bindingAttr).SetValue(obj3, Delegate.CreateDelegate(nestedType2, typeof(Plugin).GetMethod("CCPurpleWatch")));
						dictionary["taco_purple_watch"] = obj3;
						Log.LogInfo((object)"[dump] registered taco_dump");
					}
				}
			}
			catch (Exception ex)
			{
				Log.LogWarning((object)("[dump] register failed: " + ex));
			}
		}

		public static void CCTacoDump(ConCommandArgs args)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				CCTacoDumpInner(args);
			}
			catch (Exception ex)
			{
				Log.LogError((object)("[dump] failed: " + ex));
			}
		}

		private static void CCTacoDumpInner(ConCommandArgs args)
		{
			//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)
			Log.LogInfo((object)("[dump] command received, argc=" + ((ConCommandArgs)(ref args)).Count));
			if (((ConCommandArgs)(ref args)).Count < 1)
			{
				Debug.Log((object)"Usage: taco_dump <addressable key or Resources path>");
				return;
			}
			string[] array = new string[((ConCommandArgs)(ref args)).Count];
			for (int i = 0; i < ((ConCommandArgs)(ref args)).Count; i++)
			{
				array[i] = ((ConCommandArgs)(ref args)).GetArgString(i);
			}
			string text = string.Join("/", array);
			GameObject val = null;
			try
			{
				val = LegacyResourcesAPI.Load<GameObject>(text);
			}
			catch (Exception)
			{
			}
			if (!Object.op_Implicit((Object)(object)val))
			{
				try
				{
					val = Addressables.LoadAssetAsync<GameObject>((object)text).WaitForCompletion();
				}
				catch (Exception ex2)
				{
					Log.LogWarning((object)("[dump] could not load '" + text + "': " + ex2.Message));
					return;
				}
			}
			if (!Object.op_Implicit((Object)(object)val))
			{
				Log.LogWarning((object)("[dump] nothing found for '" + text + "'."));
				return;
			}
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.AppendLine("[dump] ===== " + text + " =====");
			DumpTransform(val.transform, 0, stringBuilder);
			Log.LogInfo((object)stringBuilder.ToString());
			Debug.Log((object)("Dumped '" + text + "' to the BepInEx log."));
		}

		[ConCommand(/*Could not decode attribute arguments.*/)]
		public static void CCPurpleWatch(ConCommandArgs args)
		{
			try
			{
				int result = 1;
				if (((ConCommandArgs)(ref args)).Count >= 1)
				{
					int.TryParse(((ConCommandArgs)(ref args)).GetArgString(0), out result);
				}
				TacoWatcher.SetMode(result);
			}
			catch (Exception ex)
			{
				Log.LogError((object)("[purple] command failed: " + ex));
			}
		}

		private unsafe static string GradStr(MinMaxGradient g)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Invalid comparison between Unknown and I4
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if ((int)((MinMaxGradient)(ref g)).mode == 1 || (int)((MinMaxGradient)(ref g)).mode == 4)
				{
					Gradient gradient = ((MinMaxGradient)(ref g)).gradient;
					if (gradient == null)
					{
						return "gradient=null";
					}
					string text = "gradient colors:";
					GradientColorKey[] colorKeys = gradient.colorKeys;
					for (int i = 0; i < colorKeys.Length; i++)
					{
						GradientColorKey val = colorKeys[i];
						string[] obj = new string[6]
						{
							text,
							" (",
							val.time.ToString("0.00"),
							":",
							null,
							null
						};
						Color color = val.color;
						obj[4] = ((object)(*(Color*)(&color))/*cast due to .constrained prefix*/).ToString();
						obj[5] = ")";
						text = string.Concat(obj);
					}
					return text;
				}
				return "mode=" + ((object)((MinMaxGradient)(ref g)).mode/*cast due to .constrained prefix*/).ToString();
			}
			catch (Exception)
			{
				return "gradient=?";
			}
		}

		[ConCommand(/*Could not decode attribute arguments.*/)]
		public static void CCTacoDumpState(ConCommandArgs args)
		{
			try
			{
				string[] array = new string[((ConCommandArgs)(ref args)).Count];
				for (int i = 0; i < ((ConCommandArgs)(ref args)).Count; i++)
				{
					array[i] = ((ConCommandArgs)(ref args)).GetArgString(i);
				}
				string text = string.Join(" ", array).Trim();
				Type type = AccessTools.TypeByName(text);
				if (type == null)
				{
					Type[] types = typeof(EntityState).Assembly.GetTypes();
					foreach (Type type2 in types)
					{
						if (string.Equals(type2.FullName, text, StringComparison.OrdinalIgnoreCase))
						{
							type = type2;
							break;
						}
					}
				}
				if (type == null)
				{
					Log.LogWarning((object)("[dumpstate] no type '" + text + "'"));
					return;
				}
				object obj = null;
				try
				{
					obj = EntityStateCatalog.InstantiateState(type);
				}
				catch (Exception)
				{
				}
				StringBuilder stringBuilder = new StringBuilder();
				stringBuilder.AppendLine("[dumpstate] ===== " + type.FullName + " =====");
				BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy;
				FieldInfo[] fields = type.GetFields(bindingAttr);
				foreach (FieldInfo fieldInfo in fields)
				{
					object obj2 = null;
					try
					{
						obj2 = fieldInfo.GetValue(fieldInfo.IsStatic ? null : obj);
					}
					catch (Exception)
					{
						continue;
					}
					GameObject val = (GameObject)((obj2 is GameObject) ? obj2 : null);
					if ((Object)(object)val == (Object)null && obj2 != null && fieldInfo.FieldType.Name == "EntityStateGameObject")
					{
						MethodInfo[] methods = fieldInfo.FieldType.GetMethods(BindingFlags.Static | BindingFlags.Public);
						foreach (MethodInfo methodInfo in methods)
						{
							if (methodInfo.Name == "op_Implicit" && methodInfo.ReturnType == typeof(GameObject) && methodInfo.GetParameters().Length == 1 && methodInfo.GetParameters()[0].ParameterType == fieldInfo.FieldType)
							{
								object? obj3 = methodInfo.Invoke(null, new object[1] { obj2 });
								val = (GameObject)((obj3 is GameObject) ? obj3 : null);
								break;
							}
						}
					}
					if ((Object)(object)val != (Object)null)
					{
						stringBuilder.AppendLine("## field " + fieldInfo.Name + " -> " + ((Object)val).name);
						DumpTransform(val.transform, 0, stringBuilder);
					}
					else if (fieldInfo.FieldType.IsPrimitive || fieldInfo.FieldType == typeof(string))
					{
						stringBuilder.AppendLine("# " + fieldInfo.Name + " = " + obj2);
					}
				}
				Log.LogInfo((object)stringBuilder.ToString());
				Debug.Log((object)("Dumped state '" + type.FullName + "' to the BepInEx log."));
			}
			catch (Exception ex3)
			{
				Log.LogError((object)("[dumpstate] failed: " + ex3));
			}
		}

		private unsafe static void DumpTransform(Transform t, int depth, StringBuilder sb)
		{
			//IL_0085: 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_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: 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_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_0236: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_025f: Unknown result type (might be due to invalid IL or missing references)
			//IL_027e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0283: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0304: Unknown result type (might be due to invalid IL or missing references)
			//IL_0349: Unknown result type (might be due to invalid IL or missing references)
			//IL_034e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0382: Unknown result type (might be due to invalid IL or missing references)
			//IL_0387: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_03df: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_040b: Unknown result type (might be due to invalid IL or missing references)
			//IL_040f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0411: Unknown result type (might be due to invalid IL or missing references)
			//IL_0416: Unknown result type (might be due to invalid IL or missing references)
			//IL_045f: Unknown result type (might be due to invalid IL or missing references)
			//IL_047b: Unknown result type (might be due to invalid IL or missing references)
			//IL_047e: Invalid comparison between Unknown and I4
			//IL_056a: Unknown result type (might be due to invalid IL or missing references)
			//IL_056d: Invalid comparison between Unknown and I4
			//IL_0586: Unknown result type (might be due to invalid IL or missing references)
			//IL_0588: Unknown result type (might be due to invalid IL or missing references)
			//IL_058d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0591: Unknown result type (might be due to invalid IL or missing references)
			//IL_0596: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_055c: Unknown result type (might be due to invalid IL or missing references)
			//IL_048d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0491: Unknown result type (might be due to invalid IL or missing references)
			//IL_0496: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_079a: Unknown result type (might be due to invalid IL or missing references)
			//IL_079f: Unknown result type (might be due to invalid IL or missing references)
			//IL_07fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_083a: Unknown result type (might be due to invalid IL or missing references)
			//IL_083f: Unknown result type (might be due to invalid IL or missing references)
			string text = new string(' ', depth * 2);
			sb.AppendLine(text + "- " + ((Object)t).name);
			Component[] components = ((Component)t).GetComponents<Component>();
			foreach (Component val in components)
			{
				if ((Object)(object)val == (Object)null || val is Transform)
				{
					continue;
				}
				sb.AppendLine(text + "    [" + ((object)val).GetType().FullName + "]");
				ParticleSystem val2 = (ParticleSystem)(object)((val is ParticleSystem) ? val : null);
				if ((Object)(object)val2 != (Object)null)
				{
					MainModule main = val2.main;
					MinMaxGradient startColor = ((MainModule)(ref main)).startColor;
					sb.AppendLine(text + "        startColor mode=" + ((object)((MinMaxGradient)(ref startColor)).mode/*cast due to .constrained prefix*/).ToString() + " color=" + ((object)((MinMaxGradient)(ref startColor)).color/*cast due to .constrained prefix*/).ToString() + " colorMin=" + ((object)((MinMaxGradient)(ref startColor)).colorMin/*cast due to .constrained prefix*/).ToString() + " colorMax=" + ((object)((MinMaxGradient)(ref startColor)).colorMax/*cast due to .constrained prefix*/).ToString());
					string[] obj = new string[7] { text, "        customData enabled=", null, null, null, null, null };
					CustomDataModule customData = val2.customData;
					obj[2] = ((CustomDataModule)(ref customData)).enabled.ToString();
					obj[3] = " startLifetime=";
					MinMaxCurve val3 = ((MainModule)(ref main)).startLifetime;
					obj[4] = ((MinMaxCurve)(ref val3)).constant.ToString();
					obj[5] = " maxParticles=";
					obj[6] = ((MainModule)(ref main)).maxParticles.ToString();
					sb.AppendLine(string.Concat(obj));
					ColorOverLifetimeModule colorOverLifetime = val2.colorOverLifetime;
					sb.AppendLine(text + "        colorOverLifetime enabled=" + ((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled + " " + GradStr(((ColorOverLifetimeModule)(ref colorOverLifetime)).color));
					string[] obj2 = new string[11]
					{
						text, "        startSize=", null, null, null, null, null, null, null, null,
						null
					};
					val3 = ((MainModule)(ref main)).startSize;
					obj2[2] = ((MinMaxCurve)(ref val3)).constantMin.ToString();
					obj2[3] = "..";
					val3 = ((MainModule)(ref main)).startSize;
					obj2[4] = ((MinMaxCurve)(ref val3)).constantMax.ToString();
					obj2[5] = " startSpeed=";
					val3 = ((MainModule)(ref main)).startSpeed;
					obj2[6] = ((MinMaxCurve)(ref val3)).constantMin.ToString();
					obj2[7] = "..";
					val3 = ((MainModule)(ref main)).startSpeed;
					obj2[8] = ((MinMaxCurve)(ref val3)).constantMax.ToString();
					obj2[9] = " scalingMode=";
					obj2[10] = ((object)((MainModule)(ref main)).scalingMode/*cast due to .constrained prefix*/).ToString();
					sb.AppendLine(string.Concat(obj2));
					EmissionModule emission = val2.emission;
					string[] obj3 = new string[7]
					{
						text,
						"        emission enabled=",
						((EmissionModule)(ref emission)).enabled.ToString(),
						" rate=",
						null,
						null,
						null
					};
					val3 = ((EmissionModule)(ref emission)).rateOverTime;
					obj3[4] = ((MinMaxCurve)(ref val3)).constant.ToString();
					obj3[5] = " bursts=";
					obj3[6] = ((EmissionModule)(ref emission)).burstCount.ToString();
					sb.AppendLine(string.Concat(obj3));
					for (int j = 0; j < ((EmissionModule)(ref emission)).burstCount; j++)
					{
						Burst burst = ((EmissionModule)(ref emission)).GetBurst(j);
						string[] obj4 = new string[7]
						{
							text,
							"          burst t=",
							((Burst)(ref burst)).time.ToString(),
							" count=",
							null,
							null,
							null
						};
						val3 = ((Burst)(ref burst)).count;
						obj4[4] = ((MinMaxCurve)(ref val3)).constantMin.ToString();
						obj4[5] = "..";
						val3 = ((Burst)(ref burst)).count;
						obj4[6] = ((MinMaxCurve)(ref val3)).constantMax.ToString();
						sb.AppendLine(string.Concat(obj4));
					}
					CustomDataModule customData2 = val2.customData;
					if (((CustomDataModule)(ref customData2)).enabled)
					{
						ParticleSystemCustomData[] array = (ParticleSystemCustomData[])(object)new ParticleSystemCustomData[2]
						{
							default(ParticleSystemCustomData),
							(ParticleSystemCustomData)1
						};
						for (int k = 0; k < array.Length; k++)
						{
							ParticleSystemCustomData val4 = array[k];
							ParticleSystemCustomDataMode mode = ((CustomDataModule)(ref customData2)).GetMode(val4);
							sb.AppendLine(text + "        customData " + ((object)(*(ParticleSystemCustomData*)(&val4))/*cast due to .constrained prefix*/).ToString() + " mode=" + ((object)(*(ParticleSystemCustomDataMode*)(&mode))/*cast due to .constrained prefix*/).ToString() + " components=" + ((CustomDataModule)(ref customData2)).GetVectorComponentCount(val4));
							if ((int)mode == 1)
							{
								for (int l = 0; l < ((CustomDataModule)(ref customData2)).GetVectorComponentCount(val4); l++)
								{
									MinMaxCurve vector = ((CustomDataModule)(ref customData2)).GetVector(val4, l);
									sb.AppendLine(text + "          [" + l + "] curveMode=" + ((object)((MinMaxCurve)(ref vector)).mode/*cast due to .constrained prefix*/).ToString() + " const=" + ((MinMaxCurve)(ref vector)).constant + " min=" + ((MinMaxCurve)(ref vector)).constantMin + " max=" + ((MinMaxCurve)(ref vector)).constantMax + " mult=" + ((MinMaxCurve)(ref vector)).curveMultiplier);
								}
							}
							else if ((int)mode == 2)
							{
								string[] obj5 = new string[5] { text, "          color ", null, null, null };
								MinMaxGradient color = ((CustomDataModule)(ref customData2)).GetColor(val4);
								obj5[2] = ((object)((MinMaxGradient)(ref color)).mode/*cast due to .constrained prefix*/).ToString();
								obj5[3] = " ";
								obj5[4] = GradStr(((CustomDataModule)(ref customData2)).GetColor(val4));
								sb.AppendLine(string.Concat(obj5));
							}
						}
					}
					ParticleSystemRenderer component = ((Component)val2).GetComponent<ParticleSystemRenderer>();
					if (Object.op_Implicit((Object)(object)component))
					{
						List<ParticleSystemVertexStream> list = new List<ParticleSystemVertexStream>();
						component.GetActiveVertexStreams(list);
						sb.AppendLine(text + "        vertexStreams=" + string.Join(",", list.ConvertAll((ParticleSystemVertexStream s) => ((object)(*(ParticleSystemVertexStream*)(&s))/*cast due to .constrained prefix*/).ToString()).ToArray()));
					}
				}
				Renderer val5 = (Renderer)(object)((val is Renderer) ? val : null);
				if (!((Object)(object)val5 != (Object)null))
				{
					continue;
				}
				Material[] sharedMaterials = val5.sharedMaterials;
				foreach (Material val6 in sharedMaterials)
				{
					if ((Object)(object)val6 == (Object)null)
					{
						continue;
					}
					sb.AppendLine(text + "        material=" + ((Object)val6).name + " shader=" + (Object.op_Implicit((Object)(object)val6.shader) ? ((Object)val6.shader).name : "null"));
					string[] texturePropertyNames = val6.GetTexturePropertyNames();
					foreach (string text2 in texturePropertyNames)
					{
						Texture texture = val6.GetTexture(text2);
						if (Object.op_Implicit((Object)(object)texture))
						{
							Texture2D val7 = (Texture2D)(object)((texture is Texture2D) ? texture : null);
							sb.AppendLine(text + "            tex " + text2 + " = " + ((Object)texture).name + " " + texture.width + "x" + texture.height + (Object.op_Implicit((Object)(object)val7) ? (" readable=" + ((Texture)val7).isReadable + " fmt=" + ((object)val7.format/*cast due to .constrained prefix*/).ToString()) : ""));
						}
					}
					if (!Object.op_Implicit((Object)(object)val6.shader))
					{
						continue;
					}
					int propertyCount = val6.shader.GetPropertyCount();
					for (int num2 = 0; num2 < propertyCount; num2++)
					{
						if ((int)val6.shader.GetPropertyType(num2) == 0)
						{
							string propertyName = val6.shader.GetPropertyName(num2);
							sb.AppendLine(text + "            " + propertyName + " = " + ((object)val6.GetColor(propertyName)/*cast due to .constrained prefix*/).ToString());
						}
					}
				}
			}
			for (int num3 = 0; num3 < t.childCount; num3++)
			{
				DumpTransform(t.GetChild(num3), depth + 1, sb);
			}
		}

		internal static bool IsSacrificeSkill(GenericSkill skill)
		{
			if (!Object.op_Implicit((Object)(object)skill))
			{
				return false;
			}
			SkillDef skillDef = skill.skillDef;
			if ((Object)(object)skillDef == (Object)null)
			{
				return false;
			}
			Type stateType = ((SerializableEntityStateType)(ref skillDef.activationState)).stateType;
			if (stateType == null)
			{
				return false;
			}
			return stateType.Name.IndexOf("Sacrifice", StringComparison.OrdinalIgnoreCase) >= 0;
		}

		internal static void ResetAllExceptSacrifice(GameObject bodyObject)
		{
			if (!Object.op_Implicit((Object)(object)bodyObject))
			{
				return;
			}
			SkillLocator component = bodyObject.GetComponent<SkillLocator>();
			if (!Object.op_Implicit((Object)(object)component))
			{
				return;
			}
			GenericSkill[] allSkills = component.AllSkills;
			if (allSkills == null)
			{
				return;
			}
			GenericSkill[] array = allSkills;
			foreach (GenericSkill val in array)
			{
				if (Object.op_Implicit((Object)(object)val) && !IsSacrificeSkill(val))
				{
					val.Reset();
				}
			}
		}
	}
	[HarmonyPatch(typeof(KineticChargeExplode), "FixedUpdate")]
	internal static class Patch_KineticExplode_FixedUpdate
	{
		internal static bool InsideExplode;

		private static void Prefix()
		{
			InsideExplode = true;
		}

		private static void Finalizer()
		{
			InsideExplode = false;
		}
	}
	[HarmonyPatch(typeof(HealthComponent), "ClearAllExtraHealthAuthority")]
	internal static class Patch_ClearAllExtraHealth
	{
		private static bool Prefix()
		{
			if (Patch_KineticExplode_FixedUpdate.InsideExplode && Plugin.KeepBarrierOnKineticExplode.Value)
			{
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(KineticCharge2Activate), "OnEnter")]
	internal static class Patch_Kinetic2_OnEnter
	{
		private static float originalDurationLimit = -1f;

		private static float originalDamageLimitFraction = -1f;

		internal static float? ReadNormalWalkPenalty()
		{
			try
			{
				EntityState obj = EntityStateCatalog.InstantiateState(typeof(ProtectAndServeActivate));
				ProtectAndServeBaseState val = (ProtectAndServeBaseState)(object)((obj is ProtectAndServeBaseState) ? obj : null);
				if (val != null)
				{
					return val.walkSpeedPenalty;
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogWarning((object)("Could not read the normal secondary walk penalty: " + ex.Message));
			}
			return null;
		}

		private static void Prefix(KineticCharge2Activate __instance)
		{
			try
			{
				if (Plugin.MatchKineticWalkPenaltyToNormal.Value)
				{
					float? num = ReadNormalWalkPenalty();
					if (num.HasValue)
					{
						Plugin.Log.LogInfo((object)("[kinetic] walk penalty " + ((ProtectAndServeBaseState)__instance).walkSpeedPenalty + " -> " + num.Value));
						((ProtectAndServeBaseState)__instance).walkSpeedPenalty = num.Value;
					}
				}
				if (originalDurationLimit < 0f)
				{
					originalDurationLimit = KineticCharge2Activate.durationLimit;
				}
				KineticCharge2Activate.durationLimit = originalDurationLimit * Plugin.KineticDurationMultiplier.Value;
				if (originalDamageLimitFraction < 0f)
				{
					originalDamageLimitFraction = KineticCharge2Activate.damageLimitFraction;
				}
				KineticCharge2Activate.damageLimitFraction = originalDamageLimitFraction * Plugin.KineticDamageLimitMultiplier.Value;
			}
			catch (Exception ex)
			{
				Plugin.Log.LogWarning((object)("Kinetic Charge patch failed: " + ex));
			}
		}
	}
	[HarmonyPatch(typeof(BackpackActivate), "OnEnter")]
	internal static class Patch_Echo_OnEnter
	{
		private static void Postfix(BackpackActivate __instance)
		{
			if (Plugin.EchoResetCooldownsOnEnter.Value)
			{
				GameObject val = (Object.op_Implicit((Object)(object)((EntityState)__instance).outer) ? ((Component)((EntityState)__instance).outer).gameObject : null);
				if (Object.op_Implicit((Object)(object)val) && Util.HasEffectiveAuthority(val))
				{
					Plugin.ResetAllExceptSacrifice(val);
				}
			}
		}
	}
	[HarmonyPatch(typeof(BackpackActivate), "OnExit")]
	internal static class Patch_Echo_OnExit
	{
		private static void Postfix(BackpackActivate __instance)
		{
			if (Plugin.EchoResetCooldownsOnExit.Value)
			{
				GameObject val = (Object.op_Implicit((Object)(object)((EntityState)__instance).outer) ? ((Component)((EntityState)__instance).outer).gameObject : null);
				if (Object.op_Implicit((Object)(object)val) && Util.HasEffectiveAuthority(val))
				{
					Plugin.ResetAllExceptSacrifice(val);
				}
			}
		}
	}
	internal static class GreenRecolor
	{
		private static readonly Dictionary<Texture, Texture> texCache = new Dictionary<Texture, Texture>();

		private static readonly Dictionary<Texture, Texture> texCacheYG = new Dictionary<Texture, Texture>();

		private static readonly HashSet<Material> reaperDone = new HashSet<Material>();

		private static readonly Dictionary<Material, Material> matCache = new Dictionary<Material, Material>();

		private static bool executeDone;

		private static readonly Dictionary<Texture, bool> rampPurpleCache = new Dictionary<Texture, bool>();

		private static readonly Dictionary<Texture, Texture> texCacheGold = new Dictionary<Texture, Texture>();

		private static readonly Dictionary<Material, Material> matCacheGold = new Dictionary<Material, Material>();

		internal static Color ToGreen(Color c)
		{
			//IL_0000: 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_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: 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_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			float num = default(float);
			float num2 = default(float);
			float num3 = default(float);
			Color.RGBToHSV(new Color(Mathf.Clamp01(c.r), Mathf.Clamp01(c.g), Mathf.Clamp01(c.b)), ref num, ref num2, ref num3);
			if (num2 < 0.12f)
			{
				return c;
			}
			float num4 = (num - 0.72f + 1.5f) % 1f - 0.5f;
			Color val = Color.HSVToRGB(0.34f + num4 * 0.2f, num2, num3);
			float num5 = Mathf.Max(c.r, Mathf.Max(c.g, c.b));
			if (num5 > 1f)
			{
				val *= num5;
			}
			val.a = c.a;
			return val;
		}

		private static Texture ShiftTexture(Texture src, bool yellowGreen = false)
		{
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Expected O, but got Unknown
			//IL_007a: 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_00f2: 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_00a9: 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_00c3: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)src))
			{
				return src;
			}
			Dictionary<Texture, Texture> dictionary = (yellowGreen ? texCacheYG : texCache);
			if (dictionary.TryGetValue(src, out var value))
			{
				return value;
			}
			RenderTexture temporary = RenderTexture.GetTemporary(src.width, src.height, 0, (RenderTextureFormat)0);
			RenderTexture active = RenderTexture.active;
			Graphics.Blit(src, temporary);
			RenderTexture.active = temporary;
			Texture2D val = new Texture2D(src.width, src.height, (TextureFormat)4, false);
			val.ReadPixels(new Rect(0f, 0f, (float)src.width, (float)src.height), 0, 0);
			RenderTexture.active = active;
			RenderTexture.ReleaseTemporary(temporary);
			Color[] pixels = val.GetPixels();
			for (int i = 0; i < pixels.Length; i++)
			{
				pixels[i] = (yellowGreen ? ToYellowGreen(pixels[i]) : ToGreen(pixels[i]));
			}
			val.SetPixels(pixels);
			val.Apply();
			((Texture)val).wrapMode = src.wrapMode;
			((Texture)val).filterMode = src.filterMode;
			((Object)val).name = ((Object)src).name + "_taco_green";
			dictionary[src] = (Texture)(object)val;
			return (Texture)(object)val;
		}

		private static Material GreenMaterial(Material m)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)m) || !m.HasProperty("_RemapTex"))
			{
				return m;
			}
			if (matCache.TryGetValue(m, out var value))
			{
				return value;
			}
			Material val = new Material(m);
			((Object)val).name = ((Object)m).name + "_taco_green";
			val.SetTexture("_RemapTex", ShiftTexture(m.GetTexture("_RemapTex")));
			if (m.HasProperty("_TintColor"))
			{
				val.SetColor("_TintColor", ToGreen(m.GetColor("_TintColor")));
			}
			matCache[m] = val;
			return val;
		}

		private static MinMaxGradient GreenGradient(MinMaxGradient g)
		{
			//IL_0002: 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_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//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_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Invalid comparison between Unknown and I4
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			ParticleSystemGradientMode mode = ((MinMaxGradient)(ref g)).mode;
			if ((int)mode != 0)
			{
				if ((int)mode == 2)
				{
					return new MinMaxGradient(ToGreen(((MinMaxGradient)(ref g)).colorMin), ToGreen(((MinMaxGradient)(ref g)).colorMax));
				}
				return g;
			}
			return new MinMaxGradient(ToGreen(((MinMaxGradient)(ref g)).color));
		}

		internal static void RecolorHierarchy(GameObject root, params string[] skipNames)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			ParticleSystem[] componentsInChildren = root.GetComponentsInChildren<ParticleSystem>(true);
			foreach (ParticleSystem val in componentsInChildren)
			{
				if (Array.IndexOf(skipNames, ((Object)((Component)val).gameObject).name) >= 0)
				{
					continue;
				}
				MainModule main = val.main;
				((MainModule)(ref main)).startColor = GreenGradient(((MainModule)(ref main)).startColor);
				ParticleSystemRenderer component = ((Component)val).GetComponent<ParticleSystemRenderer>();
				if (Object.op_Implicit((Object)(object)component))
				{
					Material[] sharedMaterials = ((Renderer)component).sharedMaterials;
					for (int j = 0; j < sharedMaterials.Length; j++)
					{
						sharedMaterials[j] = GreenMaterial(sharedMaterials[j]);
					}
					((Renderer)component).sharedMaterials = sharedMaterials;
				}
			}
			Light[] componentsInChildren2 = root.GetComponentsInChildren<Light>(true);
			foreach (Light obj in componentsInChildren2)
			{
				obj.color = ToGreen(obj.color);
			}
		}

		internal static Color ToYellowGreen(Color c)
		{
			//IL_0000: 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_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: 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_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: 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_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: 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_00f8: 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)
			float num = default(float);
			float num2 = default(float);
			float num3 = default(float);
			Color.RGBToHSV(new Color(Mathf.Clamp01(c.r), Mathf.Clamp01(c.g), Mathf.Clamp01(c.b)), ref num, ref num2, ref num3);
			Color val;
			if (num2 >= 0.12f)
			{
				float num4 = (num - 0.72f + 1.5f) % 1f - 0.5f;
				val = Color.HSVToRGB(0.31f + num4 * 0.05f, Mathf.Max(num2, 0.75f), num3 * 0.85f);
			}
			else
			{
				if (!(num3 > 0.7f))
				{
					return c;
				}
				val = Color.Lerp(new Color(c.r, c.g, c.b), new Color(0.55f, 0.95f, 0.5f) * num3, 0.55f);
			}
			float num5 = Mathf.Max(c.r, Mathf.Max(c.g, c.b));
			if (num5 > 1f)
			{
				val *= Mathf.Min(num5, 1.2f);
			}
			val.a = c.a;
			return val;
		}

		internal static Color ToGold(Color c)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			return ToYellowGreen(c);
		}

		internal static bool IsPurple(Color c)
		{
			//IL_0000: 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_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			float num = default(float);
			float num2 = default(float);
			float num3 = default(float);
			Color.RGBToHSV(new Color(Mathf.Clamp01(c.r), Mathf.Clamp01(c.g), Mathf.Clamp01(c.b)), ref num, ref num2, ref num3);
			if (num2 > 0.3f && num3 > 0.3f && num > 0.68f)
			{
				return num < 0.9f;
			}
			return false;
		}

		private static bool IsReaperMaterialName(string n)
		{
			if (n != null && !n.Contains("_taco_green"))
			{
				if (n.IndexOf("Reaper", StringComparison.OrdinalIgnoreCase) < 0)
				{
					return n.IndexOf("LilReap", StringComparison.OrdinalIgnoreCase) >= 0;
				}
				return true;
			}
			return false;
		}

		internal static void ApplyReaperMaterials()
		{
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: 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_01a8: Invalid comparison between Unknown and I4
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: 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_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			if (!Plugin.ReaperGreenProjectiles.Value)
			{
				return;
			}
			try
			{
				int num = 0;
				Material[] array = Resources.FindObjectsOfTypeAll<Material>();
				foreach (Material val in array)
				{
					if (Object.op_Implicit((Object)(object)val) && !reaperDone.Contains(val) && IsReaperMaterialName(((Object)val).name) && val.HasProperty("_RemapTex"))
					{
						Texture texture = val.GetTexture("_RemapTex");
						if (Object.op_Implicit((Object)(object)texture))
						{
							val.SetTexture("_RemapTex", ShiftTexture(texture, yellowGreen: true));
						}
						if (val.HasProperty("_TintColor"))
						{
							val.SetColor("_TintColor", ToYellowGreen(val.GetColor("_TintColor")));
						}
						reaperDone.Add(val);
						num++;
						Plugin.Log.LogInfo((object)("[green] recolored material " + ((Object)val).name));
					}
				}
				int num2 = 0;
				ParticleSystemRenderer[] array2 = Resources.FindObjectsOfTypeAll<ParticleSystemRenderer>();
				foreach (ParticleSystemRenderer val2 in array2)
				{
					if (!Object.op_Implicit((Object)(object)val2))
					{
						continue;
					}
					bool flag = false;
					array = ((Renderer)val2).sharedMaterials;
					foreach (Material val3 in array)
					{
						if (Object.op_Implicit((Object)(object)val3) && reaperDone.Contains(val3))
						{
							flag = true;
							break;
						}
					}
					if (!flag)
					{
						continue;
					}
					ParticleSystem component = ((Component)val2).GetComponent<ParticleSystem>();
					if (Object.op_Implicit((Object)(object)component))
					{
						MainModule main = component.main;
						MinMaxGradient startColor = ((MainModule)(ref main)).startColor;
						if ((int)((MinMaxGradient)(ref startColor)).mode == 0)
						{
							((MainModule)(ref main)).startColor = new MinMaxGradient(ToYellowGreen(((MinMaxGradient)(ref startColor)).color));
							num2++;
						}
						else if ((int)((MinMaxGradient)(ref startColor)).mode == 2)
						{
							((MainModule)(ref main)).startColor = new MinMaxGradient(ToYellowGreen(((MinMaxGradient)(ref startColor)).colorMin), ToYellowGreen(((MinMaxGradient)(ref startColor)).colorMax));
							num2++;
						}
					}
				}
				if (num > 0 || num2 > 0)
				{
					Plugin.Log.LogInfo((object)("[green] reaper pass: " + num + " material(s), " + num2 + " particle system(s)."));
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogWarning((object)("[green] reaper material pass failed: " + ex));
			}
		}

		internal static bool RampIsPurple(Texture src)
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Expected O, but got Unknown
			//IL_005d: 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)
			if (!Object.op_Implicit((Object)(object)src))
			{
				return false;
			}
			if (rampPurpleCache.TryGetValue(src, out var value))
			{
				return value;
			}
			bool flag = false;
			try
			{
				RenderTexture temporary = RenderTexture.GetTemporary(32, 1, 0, (RenderTextureFormat)0);
				RenderTexture active = RenderTexture.active;
				Graphics.Blit(src, temporary);
				RenderTexture.active = temporary;
				Texture2D val = new Texture2D(32, 1, (TextureFormat)4, false);
				val.ReadPixels(new Rect(0f, 0f, 32f, 1f), 0, 0);
				RenderTexture.active = active;
				RenderTexture.ReleaseTemporary(temporary);
				int num = 0;
				Color[] pixels = val.GetPixels();
				for (int i = 0; i < pixels.Length; i++)
				{
					if (IsPurple(pixels[i]))
					{
						num++;
					}
				}
				Object.Destroy((Object)(object)val);
				flag = num >= 3;
			}
			catch (Exception)
			{
			}
			rampPurpleCache[src] = flag;
			return flag;
		}

		internal static Gradient RecolorGradient(Gradient g, Func<Color, Color> f)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			//IL_0020: 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_002a: 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)
			Gradient val = new Gradient();
			GradientColorKey[] colorKeys = g.colorKeys;
			for (int i = 0; i < colorKeys.Length; i++)
			{
				colorKeys[i].color = f(colorKeys[i].color);
			}
			val.SetKeys(colorKeys, g.alphaKeys);
			val.mode = g.mode;
			return val;
		}

		internal static bool GradientHasPurple(Gradient g)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			if (g == null)
			{
				return false;
			}
			GradientColorKey[] colorKeys = g.colorKeys;
			for (int i = 0; i < colorKeys.Length; i++)
			{
				if (IsPurple(colorKeys[i].color))
				{
					return true;
				}
			}
			return false;
		}

		internal static bool MinMaxGradientHasPurple(MinMaxGradient g)
		{
			//IL_0002: 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_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected I4, but got Unknown
			//IL_0026: 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_0041: Unknown result type (might be due to invalid IL or missing references)
			ParticleSystemGradientMode mode = ((MinMaxGradient)(ref g)).mode;
			switch ((int)mode)
			{
			case 0:
				return IsPurple(((MinMaxGradient)(ref g)).color);
			case 2:
				if (!IsPurple(((MinMaxGradient)(ref g)).colorMin))
				{
					return IsPurple(((MinMaxGradient)(ref g)).colorMax);
				}
				return true;
			case 1:
			case 4:
				return GradientHasPurple(((MinMaxGradient)(ref g)).gradient);
			case 3:
				if (!GradientHasPurple(((MinMaxGradient)(ref g)).gradientMin))
				{
					return GradientHasPurple(((MinMaxGradient)(ref g)).gradientMax);
				}
				return true;
			default:
				return false;
			}
		}

		internal static MinMaxGradient RecolorMinMaxGradient(MinMaxGradient g, Func<Color, Color> f)
		{
			//IL_0002: 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_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected I4, but got Unknown
			//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_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: 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)
			ParticleSystemGradientMode mode = ((MinMaxGradient)(ref g)).mode;
			switch ((int)mode)
			{
			case 0:
				return new MinMaxGradient(f(((MinMaxGradient)(ref g)).color));
			case 2:
				return new MinMaxGradient(f(((MinMaxGradient)(ref g)).colorMin), f(((MinMaxGradient)(ref g)).colorMax));
			case 1:
			case 4:
				return new MinMaxGradient(RecolorGradient(((MinMaxGradient)(ref g)).gradient, f));
			case 3:
				return new MinMaxGradient(RecolorGradient(((MinMaxGradient)(ref g)).gradientMin, f), RecolorGradient(((MinMaxGradient)(ref g)).gradientMax, f));
			default:
				return g;
			}
		}

		private static Texture GoldTexture(Texture src)
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Expected O, but got Unknown
			//IL_0064: 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_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			if (texCacheGold.TryGetValue(src, out var value))
			{
				return value;
			}
			RenderTexture temporary = RenderTexture.GetTemporary(src.width, src.height, 0, (RenderTextureFormat)0);
			RenderTexture active = RenderTexture.active;
			Graphics.Blit(src, temporary);
			RenderTexture.active = temporary;
			Texture2D val = new Texture2D(src.width, src.height, (TextureFormat)4, false);
			val.ReadPixels(new Rect(0f, 0f, (float)src.width, (float)src.height), 0, 0);
			RenderTexture.active = active;
			RenderTexture.ReleaseTemporary(temporary);
			Color[] pixels = val.GetPixels();
			for (int i = 0; i < pixels.Length; i++)
			{
				pixels[i] = (IsPurple(pixels[i]) ? ToGold(pixels[i]) : pixels[i]);
			}
			val.SetPixels(pixels);
			val.Apply();
			((Texture)val).wrapMode = src.wrapMode;
			((Texture)val).filterMode = src.filterMode;
			((Object)val).name = ((Object)src).name + "_taco_green_leftover";
			texCacheGold[src] = (Texture)(object)val;
			return (Texture)(object)val;
		}

		private static Material GoldMaterial(Material m)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			if (matCacheGold.TryGetValue(m, out var value))
			{
				return value;
			}
			Material val = new Material(m);
			((Object)val).name = ((Object)m).name + "_taco_gold";
			val.SetTexture("_RemapTex", GoldTexture(m.GetTexture("_RemapTex")));
			matCacheGold[m] = val;
			return val;
		}

		private static bool PathLooksReaper(Transform t)
		{
			while (Object.op_Implicit((Object)(object)t))
			{
				string name = ((Object)t).name;
				if (name.IndexOf("Reap", StringComparison.OrdinalIgnoreCase) >= 0 || name.IndexOf("Harvester", StringComparison.OrdinalIgnoreCase) >= 0 || name.IndexOf("SlashStorm", StringComparison.OrdinalIgnoreCase) >= 0 || name.IndexOf("BigSlash", StringComparison.OrdinalIgnoreCase) >= 0 || name.IndexOf("ChainStorm", StringComparison.OrdinalIgnoreCase) >= 0 || name.IndexOf("SoulStorm", StringComparison.OrdinalIgnoreCase) >= 0)
				{
					return true;
				}
				t = t.parent;
			}
			return false;
		}

		internal static void GoldPurpleLeftovers()
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: 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_0085: 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_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: 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_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: 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_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: 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_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_031f: Unknown result type (might be due to invalid IL or missing references)
			//IL_032f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0334: Unknown result type (might be due to invalid IL or missing references)
			if (!Plugin.ReaperGreenProjectiles.Value)
			{
				return;
			}
			try
			{
				int num = 0;
				ParticleSystem[] array = Resources.FindObjectsOfTypeAll<ParticleSystem>();
				foreach (ParticleSystem val in array)
				{
					if (!Object.op_Implicit((Object)(object)val) || !PathLooksReaper(((Component)val).transform))
					{
						continue;
					}
					MainModule main = val.main;
					if (MinMaxGradientHasPurple(((MainModule)(ref main)).startColor))
					{
						((MainModule)(ref main)).startColor = RecolorMinMaxGradient(((MainModule)(ref main)).startColor, ToGold);
						num++;
					}
					ColorOverLifetimeModule colorOverLifetime = val.colorOverLifetime;
					if (((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled && MinMaxGradientHasPurple(((ColorOverLifetimeModule)(ref colorOverLifetime)).color))
					{
						((ColorOverLifetimeModule)(ref colorOverLifetime)).color = RecolorMinMaxGradient(((ColorOverLifetimeModule)(ref colorOverLifetime)).color, ToGold);
						num++;
					}
					TrailModule trails = val.trails;
					if (((TrailModule)(ref trails)).enabled)
					{
						if (MinMaxGradientHasPurple(((TrailModule)(ref trails)).colorOverLifetime))
						{
							((TrailModule)(ref trails)).colorOverLifetime = RecolorMinMaxGradient(((TrailModule)(ref trails)).colorOverLifetime, ToGold);
							num++;
						}
						if (MinMaxGradientHasPurple(((TrailModule)(ref trails)).colorOverTrail))
						{
							((TrailModule)(ref trails)).colorOverTrail = RecolorMinMaxGradient(((TrailModule)(ref trails)).colorOverTrail, ToGold);
							num++;
						}
					}
					ParticleSystemRenderer component = ((Component)val).GetComponent<ParticleSystemRenderer>();
					if (!Object.op_Implicit((Object)(object)component))
					{
						continue;
					}
					Material[] sharedMaterials = ((Renderer)component).sharedMaterials;
					bool flag = false;
					for (int j = 0; j < sharedMaterials.Length; j++)
					{
						Material val2 = sharedMaterials[j];
						if (Object.op_Implicit((Object)(object)val2) && val2.HasProperty("_RemapTex") && ((Object)val2).name.IndexOf("_taco_", StringComparison.Ordinal) < 0 && RampIsPurple(val2.GetTexture("_RemapTex")))
						{
							sharedMaterials[j] = GoldMaterial(val2);
							flag = true;
							num++;
						}
					}
					if (flag)
					{
						((Renderer)component).sharedMaterials = sharedMaterials;
					}
				}
				TrailRenderer[] array2 = Resources.FindObjectsOfTypeAll<TrailRenderer>();
				foreach (TrailRenderer val3 in array2)
				{
					if (Object.op_Implicit((Object)(object)val3) && PathLooksReaper(((Component)val3).transform) && GradientHasPurple(val3.colorGradient))
					{
						val3.colorGradient = RecolorGradient(val3.colorGradient, ToGold);
						num++;
					}
				}
				LineRenderer[] array3 = Resources.FindObjectsOfTypeAll<LineRenderer>();
				foreach (LineRenderer val4 in array3)
				{
					if (Object.op_Implicit((Object)(object)val4) && PathLooksReaper(((Component)val4).transform) && GradientHasPurple(val4.colorGradient))
					{
						val4.colorGradient = RecolorGradient(val4.colorGradient, ToGold);
						num++;
					}
				}
				Light[] array4 = Resources.FindObjectsOfTypeAll<Light>();
				foreach (Light val5 in array4)
				{
					if (Object.op_Implicit((Object)(object)val5) && PathLooksReaper(((Component)val5).transform) && IsPurple(val5.color))
					{
						val5.color = ToGold(val5.color);
						num++;
					}
				}
				if (num > 0)
				{
					Plugin.Log.LogInfo((object)("[green] turned " + num + " purple leftover(s) gold."));
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogWarning((object)("[green] gold pass failed: " + ex.Message));
			}
		}

		internal static bool PathLooksReaperPublic(Transform t)
		{
			return PathLooksReaper(t);
		}

		internal static void ApplyExecuteEffect()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			if (executeDone || !Plugin.ReaperGreenExecute.Value)
			{
				return;
			}
			executeDone = true;
			try
			{
				GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC4/LilReaper/AcoLilReapExecuteEffect.prefab").WaitForCompletion();
				if (!Object.op_Implicit((Object)(object)val))
				{
					Plugin.Log.LogWarning((object)"[green] execute effect prefab not found.");
					return;
				}
				RecolorHierarchy(val, "FakeDamageNumbers");
				if (!Object.op_Implicit((Object)(object)val.GetComponent<TacoReaperNumbers>()))
				{
					val.AddComponent<TacoReaperNumbers>();
				}
				Plugin.Log.LogInfo((object)"[green] recolored the Reaper execute effect.");
			}
			catch (Exception ex)
			{
				Plugin.Log.LogWarning((object)("[green] execute recolor failed: " + ex));
			}
		}
	}
	internal class TacoReaperNumbers : MonoBehaviour
	{
		private readonly List<ParticleSystem> systems = new List<ParticleSystem>();

		private bool built;

		private void Build()
		{
			//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_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_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: 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)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Expected O, but got Unknown
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0215: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0221: Unknown result type (might be due to invalid IL or missing references)
			//IL_0228: Unknown result type (might be due to invalid IL or missing references)
			//IL_0232: Unknown result type (might be due to invalid IL or missing references)
			//IL_0237: Unknown result type (might be due to invalid IL or missing references)
			//IL_0244: Unknown result type (might be due to invalid IL or missing references)
			//IL_0249: Unknown result type (might be due to invalid IL or missing references)
			//IL_024f: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0260: Unknown result type (might be due to invalid IL or missing references)
			//IL_026e: Unknown result type (might be due to invalid IL or missing references)
			built = true;
			Transform val = ((Component)this).transform.Find("FakeDamageNumbers");
			if (!Object.op_Implicit((Object)(object)val))
			{
				return;
			}
			ParticleSystem component = ((Component)val).GetComponent<ParticleSystem>();
			if (!Object.op_Implicit((Object)(object)component))
			{
				return;
			}
			List<float> list = new List<float>();
			string[] array = Plugin.ReaperExecuteNumbers.Value.Split(',');
			for (int i = 0; i < array.Length; i++)
			{
				if (float.TryParse(array[i].Trim(), out var result))
				{
					list.Add(result);
				}
			}
			if (list.Count == 0)
			{
				return;
			}
			ColorOverLifetimeModule colorOverLifetime = component.colorOverLifetime;
			MinMaxGradient color = ((ColorOverLifetimeModule)(ref colorOverLifetime)).color;
			object obj;
			if (((MinMaxGradient)(ref color)).gradient == null)
			{
				obj = new GradientAlphaKey[2]
				{
					new GradientAlphaKey(1f, 0f),
					new GradientAlphaKey(1f, 1f)
				};
			}
			else
			{
				colorOverLifetime = component.colorOverLifetime;
				color = ((ColorOverLifetimeModule)(ref colorOverLifetime)).color;
				obj = ((MinMaxGradient)(ref color)).gradient.alphaKeys;
			}
			GradientAlphaKey[] array2 = (GradientAlphaKey[])obj;
			Color val2 = default(Color);
			((Color)(ref val2))..ctor(0.05f, 0.32f, 0.08f, 1f);
			Color val3 = default(Color);
			((Color)(ref val3))..ctor(0.72f, 1f, 0.66f, 1f);
			for (int j = 0; j < list.Count; j++)
			{
				float num = ((list.Count > 1) ? ((float)j / (float)(list.Count - 1)) : 0.5f);
				Color val4 = Color.Lerp(val2, val3, num);
				if (list.Count > 1 && j == list.Count - 1)
				{
					((Color)(ref val4))..ctor(1f, 0.82f, 0.28f, 1f);
				}
				ParticleSystem val5 = ((j == 0) ? component : Object.Instantiate<GameObject>(((Component)val).gameObject, ((Component)this).transform).GetComponent<ParticleSystem>());
				((Object)((Component)val5).gameObject).name = "FakeDamageNumbers_taco" + j;
				MainModule main = val5.main;
				((MainModule)(ref main)).startColor = new MinMaxGradient(val4);
				Gradient val6 = new Gradient();
				val6.SetKeys((GradientColorKey[])(object)new GradientColorKey[3]
				{
					new GradientColorKey(Color.Lerp(val4, Color.white, 0.5f), 0.04f),
					new GradientColorKey(val4, 0.05f),
					new GradientColorKey(val4 * 0.45f, 1f)
				}, array2);
				ColorOverLifetimeModule colorOverLifetime2 = val5.colorOverLifetime;
				((ColorOverLifetimeModule)(ref colorOverLifetime2)).color = new MinMaxGradient(val6);
				CustomDataModule customData = val5.customData;
				((CustomDataModule)(ref customData)).SetVector((ParticleSystemCustomData)0, 2, new MinMaxCurve(list[j]));
				systems.Add(val5);
			}
		}

		private void OnEnable()
		{
			if (!built)
			{
				Build();
			}
			foreach (ParticleSystem system in systems)
			{
				if (Object.op_Implicit((Object)(object)system))
				{
					system.Clear(true);
					system.Play(true);
				}
			}
		}
	}
	internal class TacoWatcher : MonoBehaviour
	{
		private static TacoWatcher instance;

		private int mode;

		private float nextScan;

		private float nextBeat;

		private readonly HashSet<string> seen = new HashSet<string>();

		internal static void SetMode(int mode)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			if ((Object)(object)instance == (Object)null)
			{
				GameObject val = new GameObject("TacoWatcher");
				Object.DontDestroyOnLoad((Object)val);
				instance = val.AddComponent<TacoWatcher>();
			}
			instance.mode = mode;
			instance.seen.Clear();
			Plugin.Log.LogInfo((object)("[purple] mode " + mode + ((mode == 0) ? " (off)" : "")));
			if (mode != 0)
			{
				instance.Scan();
			}
		}

		private static string PathOf(Transform t)
		{
			string text = ((Object)t).name;
			while (Object.op_Implicit((Object)(object)t.parent))
			{
				t = t.parent;
				text = ((Object)t).name + "/" + text;
			}
			return text;
		}

		private static string Col(Color c)
		{
			return "(" + c.r.ToString("0.00") + "," + c.g.ToString("0.00") + "," + c.b.ToString("0.00") + ")";
		}

		private void Update()
		{
			if (mode != 0 && Time.unsca