Decompiled source of TTATweaks v1.2.0

TTATweaks.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using EntityStates.ArtifactShell;
using HG;
using IL.RoR2;
using IL.RoR2.Items;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using MonoMod.RuntimeDetour.HookGen;
using Newtonsoft.Json;
using On.EntityStates.ArtifactShell;
using On.RoR2;
using R2API;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
using RoR2.Artifacts;
using RoR2.Items;
using RoR2.Projectile;
using TTATweaks.Tweaks;
using UnityEngine;
using UnityEngine.Networking;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("TTATweaks")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+ac9b2c108970ac31fa526d2ce2855f9e14482a00")]
[assembly: AssemblyProduct("TTATweaks")]
[assembly: AssemblyTitle("TTATweaks")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.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 TTATweaks
{
	public class Assets
	{
		public static AssetBundle assetBundle;

		public static Sprite icon;

		public static void Init()
		{
			GetAssetBundle();
			icon = assetBundle.LoadAsset<Sprite>("icon");
		}

		private static void GetAssetBundle()
		{
			using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("TTATweaks.ttatweaks");
			if (stream != null)
			{
				assetBundle = AssetBundle.LoadFromStream(stream);
			}
		}
	}
	internal static class Log
	{
		private static ManualLogSource _logSource;

		internal static void Init(ManualLogSource logSource)
		{
			_logSource = logSource;
		}

		internal static void Debug(object data)
		{
			_logSource.LogDebug(data);
		}

		internal static void Error(object data)
		{
			_logSource.LogError(data);
		}

		internal static void Fatal(object data)
		{
			_logSource.LogFatal(data);
		}

		internal static void Info(object data)
		{
			_logSource.LogInfo(data);
		}

		internal static void Message(object data)
		{
			_logSource.LogMessage(data);
		}

		internal static void Warning(object data)
		{
			_logSource.LogWarning(data);
		}
	}
	public class Options
	{
		private static bool? _rooEnabled;

		public static bool rooEnabled
		{
			get
			{
				if (!_rooEnabled.HasValue)
				{
					_rooEnabled = Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions");
				}
				return _rooEnabled.Value;
			}
		}

		public static ConfigEntry<bool> syncMinionItems { get; set; }

		public static ConfigEntry<bool> honorEliteMinions { get; set; }

		public static ConfigEntry<bool> honorEliteUrchins { get; set; }

		public static ConfigEntry<bool> honorEliteUmbras { get; set; }

		public static ConfigEntry<bool> honorElitePlayers { get; set; }

		public static ConfigEntry<bool> honorGildedAurelionite { get; set; }

		public static ConfigEntry<bool> honorGildedReliquary { get; set; }

		public static ConfigEntry<bool> minionEliteBuffs { get; set; }

		public static ConfigEntry<float> glacialSlowDurationMult { get; set; }

		public static ConfigEntry<bool> glacialSkipExplosion { get; set; }

		public static ConfigEntry<bool> collectiveSkipExplosion { get; set; }

		public static ConfigEntry<bool> stygiansDisableHealing { get; set; }

		public static ConfigEntry<bool> twistedInflictsCripple { get; set; }

		public static ConfigEntry<bool> celestineBuffsSpeeds { get; set; }

		public static ConfigEntry<bool> mendingCanHealMending { get; set; }

		public static ConfigEntry<bool> mendingLifeSteal { get; set; }

		public static ConfigEntry<bool> stygiansDontKillPlayerMinions { get; set; }

		public static ConfigEntry<bool> stygianInT2Pool { get; set; }

		public static ConfigEntry<string> blacklistJson { get; set; }

		public static ConfigEntry<string> allyAurelioniteItemsJson { get; set; }

		private static void BlacklistChanged()
		{
			try
			{
				Dictionary<string, string[]> jsonObject = JsonConvert.DeserializeObject<Dictionary<string, string[]>>("{" + blacklistJson.Value + "}");
				SyncItems.blacklist = SyncItems.GenerateBlacklist(jsonObject);
				Log.Info("Blacklist valid!");
				SyncItems.useCustomBlacklist = true;
			}
			catch (Exception ex)
			{
				if (ex is JsonReaderException || ex is JsonSerializationException)
				{
					Log.Warning("Blacklist currently invalid!");
				}
				else
				{
					Log.Error(ex.ToString());
				}
				SyncItems.useCustomBlacklist = false;
			}
		}

		private static void AllyAurelioniteItemsChanged()
		{
			try
			{
				Dictionary<string, int> jsonObject = JsonConvert.DeserializeObject<Dictionary<string, int>>("{" + allyAurelioniteItemsJson.Value + "}");
				HonorTweaks.allyAurelioniteItems = HonorTweaks.GenerateAllyAurelioniteItems(jsonObject);
				Log.Info("Item list valid!");
				HonorTweaks.giveAurelioniteItems = true;
			}
			catch (Exception ex)
			{
				if (ex is JsonReaderException || ex is JsonSerializationException)
				{
					Log.Warning("Item list currently invalid!");
				}
				else
				{
					Log.Error(ex.ToString());
				}
				HonorTweaks.giveAurelioniteItems = false;
			}
		}

		public static void Init()
		{
			syncMinionItems = TTATweaks.config.Bind<bool>("General", "Sync Minion Items", true, "Whether or not minions share most of their owner's items (like Engi turrets).");
			glacialSlowDurationMult = TTATweaks.config.Bind<float>("Glacial Elites", "Glacial Slow Duration Multiplier", 2f, "A multiplier for how long Glacial elites inflict the slow debuff for. At a multiplier of 1, the slow lasts for 1.5s, scaled by proc coefficient.");
			glacialSkipExplosion = TTATweaks.config.Bind<bool>("Glacial Elites", "Disable Glacial Explosion", true, "Whether or not Glacial elites should no longer generate the freeze explosion on death.");
			collectiveSkipExplosion = TTATweaks.config.Bind<bool>("Collective Elites", "Disable Collective Explosion", true, "Whether or not Collective elites should no longer generate the inventory-disabling explosion on death.");
			twistedInflictsCripple = TTATweaks.config.Bind<bool>("Twisted Elites", "Twisted Inflicts Cripple", true, "Whether or not Twisted elites should inflict the Cripple debuff on hit, like Perfected elites.");
			celestineBuffsSpeeds = TTATweaks.config.Bind<bool>("Celestine Elites", "Celestine Buffs Speeds", true, "Whether or not Celestine elites and allies within their radius gain a 20% increase to attack and movement speed.");
			mendingCanHealMending = TTATweaks.config.Bind<bool>("Mending Elites", "Mending Can Heal Mending", true, "Whether or not Mending elites can heal other Mending elites.");
			mendingLifeSteal = TTATweaks.config.Bind<bool>("Mending Elites", "Mending Life Steal", true, "Whether or not Mending elites heal for 10% of their damage dealt.");
			stygianInT2Pool = TTATweaks.config.Bind<bool>("Stygian Elites", "Stygian In T2 Pool", true, "Whether or not Stygian elites should be part of the T2 elite pool.");
			stygianInT2Pool.SettingChanged += delegate
			{
				EliteTweaks.SetStygianInT2Pool(stygianInT2Pool.Value);
			};
			stygiansDisableHealing = TTATweaks.config.Bind<bool>("Stygian Elites", "Stygians Disable Healing", true, "Whether or not Stygian elites disable healing on hit, like Malachite elites.");
			stygiansDontKillPlayerMinions = TTATweaks.config.Bind<bool>("Stygian Elites", "Prevent Killing Player Minions", true, "Whether or not minions are no longer automatically killed when an entity on the Player team loses the Stygian affix.");
			honorEliteMinions = TTATweaks.config.Bind<bool>("Artifact of Honor", "Elite Minions", true, "Whether or not minions spawn as a tier 1 elite while the Artifact of Honor is active.");
			minionEliteBuffs = TTATweaks.config.Bind<bool>("Artifact of Honor", "Elite Minion Stat Buffs", true, "Whether or not minions spawning as a tier 1 elites also acquire the elite stat buff while the Artifact of Honor is active.");
			honorEliteUrchins = TTATweaks.config.Bind<bool>("Artifact of Honor", "Elite Urchins", true, "Whether or not Malachite urchins spawn as a tier 1 elite while the Artifact of Honor is active.");
			honorEliteUmbras = TTATweaks.config.Bind<bool>("Artifact of Honor", "Elite Umbras", true, "Whether or not Artifact of Vengeance umbras are given a tier 1 elite equipment while the Artifact of Honor is active.");
			honorElitePlayers = TTATweaks.config.Bind<bool>("Artifact of Honor", "Elite Players", false, "Whether or not players start with a tier 1 elite equipment while the Artifact of Honor is active.");
			honorGildedAurelionite = TTATweaks.config.Bind<bool>("Artifact of Honor", "Gilded Aurelionite", true, "Whether or not ally Aurelionite spawns as a gilded elite while the Artifact of Honor is active.");
			honorGildedReliquary = TTATweaks.config.Bind<bool>("Artifact of Honor", "Gilded Artifact Reliquary", true, "Whether or not the Artifact Reliquary spawns as a gilded elite while the Artifact of Honor is active.");
			blacklistJson = TTATweaks.config.Bind<string>("General", "Minion Item Blacklist", "\"all\":[\"MinorConstructOnKill\", \"DroneWeapons\", \"RoboBallBuddy\", \"FocusConvergence\", \"TitanGoldDuringTP\", \"TPHealingNova\", \"VoidMegaCrabItem\", \"BeetleGland\", \"WardOnLevel\", \"PhysicsProjectile\", \"DronesDropDynamite\"]", "What items shouldn't be inherited by all or specific minions. Format example: `\"internal_enemy_name_1\":[\"internal_item_name_1\",\"internal_item_name_2\"], \"internal_enemy_name_2\":[\"internal_item_name_3\",\"internal_item_name_4\"]`");
			blacklistJson.SettingChanged += delegate
			{
				BlacklistChanged();
				AllyAurelioniteItemsChanged();
			};
			allyAurelioniteItemsJson = TTATweaks.config.Bind<string>("General", "Ally Aurelionite Items", "\"GoldOnHurt\": 1, \"BonusGoldPackOnKill\": 5, \"Knurl\": 1", "What items ally Aurelionite should spawn with. Format example: `\"item_1_name:\" item_1_count, \"item_2_name:\" item_2_count`.\n\nThe logic for finding items from names is copied from DebugToolkit - names are not strict, unlike with the minion item blacklist, and approximate names will work.");
			allyAurelioniteItemsJson.SettingChanged += delegate
			{
				AllyAurelioniteItemsChanged();
			};
			if (rooEnabled)
			{
				RoOInit();
			}
		}

		private static void RoOInit()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Expected O, but got Unknown
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: 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_0046: Expected O, but got Unknown
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Expected O, but got Unknown
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Expected O, but got Unknown
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Expected O, but got Unknown
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Expected O, but got Unknown
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Expected O, but got Unknown
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Expected O, but got Unknown
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Expected O, but got Unknown
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Expected O, but got Unknown
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Expected O, but got Unknown
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Expected O, but got Unknown
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Expected O, but got Unknown
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Expected O, but got Unknown
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Expected O, but got Unknown
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Expected O, but got Unknown
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Expected O, but got Unknown
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Expected O, but got Unknown
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Expected O, but got Unknown
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Expected O, but got Unknown
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Expected O, but got Unknown
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Expected O, but got Unknown
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Expected O, but got Unknown
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Expected O, but got Unknown
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Expected O, but got Unknown
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Expected O, but got Unknown
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Expected O, but got Unknown
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Expected O, but got Unknown
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Expected O, but got Unknown
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Expected O, but got Unknown
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Expected O, but got Unknown
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Expected O, but got Unknown
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Expected O, but got Unknown
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Expected O, but got Unknown
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Expected O, but got Unknown
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Expected O, but got Unknown
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Expected O, but got Unknown
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: Expected O, but got Unknown
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(syncMinionItems, new CheckBoxConfig()));
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(glacialSlowDurationMult, new StepSliderConfig
			{
				min = 0f,
				max = 30f,
				increment = 1f
			}));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(glacialSkipExplosion, new CheckBoxConfig()));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(stygianInT2Pool, new CheckBoxConfig()));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(stygiansDisableHealing, new CheckBoxConfig()));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(twistedInflictsCripple, new CheckBoxConfig()));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(celestineBuffsSpeeds, new CheckBoxConfig()));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(stygiansDontKillPlayerMinions, new CheckBoxConfig()));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(mendingCanHealMending, new CheckBoxConfig()));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(mendingLifeSteal, new CheckBoxConfig()));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(collectiveSkipExplosion, new CheckBoxConfig()));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(honorEliteMinions, new CheckBoxConfig()));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(minionEliteBuffs, new CheckBoxConfig()));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(honorEliteUrchins, new CheckBoxConfig()));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(honorEliteUmbras, new CheckBoxConfig()));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(honorElitePlayers, new CheckBoxConfig()));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(honorGildedAurelionite, new CheckBoxConfig()));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(honorGildedReliquary, new CheckBoxConfig()));
			ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(blacklistJson, new InputFieldConfig()));
			ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(allyAurelioniteItemsJson, new InputFieldConfig()));
			ModSettingsManager.SetModDescription("Various tweaks relating to elites, minions, and the Artifact of Honor.");
			ModSettingsManager.SetModIcon(Assets.icon);
		}

		public static void OnLoadFinished()
		{
			BlacklistChanged();
			AllyAurelioniteItemsChanged();
			EliteTweaks.SetStygianInT2Pool(stygianInT2Pool.Value);
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("mwmw.TTATweaks", "TTATweaks", "1.2.0")]
	public class TTATweaks : BaseUnityPlugin
	{
		public const string PluginGUID = "mwmw.TTATweaks";

		public const string PluginAuthor = "mwmw";

		public const string PluginName = "TTATweaks";

		public const string PluginVersion = "1.2.0";

		public static ConfigFile config;

		public static BaseUnityPlugin plugin;

		public const BindingFlags allFlags = BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;

		public void Awake()
		{
			Log.Init(((BaseUnityPlugin)this).Logger);
			config = ((BaseUnityPlugin)this).Config;
			plugin = (BaseUnityPlugin)(object)this;
			Assets.Init();
			Options.Init();
			HonorTweaks.Init();
			EliteTweaks.Init();
			SyncItems.Init();
			RoR2Application.onLoadFinished = (Action)Delegate.Combine(RoR2Application.onLoadFinished, new Action(OnLoadFinished));
		}

		private void OnLoadFinished()
		{
			Options.OnLoadFinished();
		}
	}
	public static class Utils
	{
		private struct MatchSimilarity
		{
			public int similarity;

			public object item;
		}

		public static ItemIndex GetItemFromPartial(string name)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			return GetItemsFromPartial(name).DefaultIfEmpty((ItemIndex)(-1)).First();
		}

		private static IEnumerable<ItemIndex> GetItemsFromPartial(string name)
		{
			int i = default(int);
			if (TextSerialization.TryParseInvariant(name, ref i))
			{
				ItemIndex index = (ItemIndex)i;
				if (ItemCatalog.IsIndexValid(ref index))
				{
					yield return index;
				}
				yield break;
			}
			name = name.ToUpperInvariant();
			List<MatchSimilarity> matches = new List<MatchSimilarity>();
			Enumerator<ItemDef> enumerator = ItemCatalog.allItemDefs.GetEnumerator();
			try
			{
				while (enumerator.MoveNext())
				{
					ItemDef item = enumerator.Current;
					string langInvar = GetLangInvar(item.nameToken).ToUpper();
					if (((Object)item).name.ToUpper().Contains(name) || langInvar.Contains(name))
					{
						matches.Add(new MatchSimilarity
						{
							similarity = Math.Max(GetSimilarity(((Object)item).name, name), GetSimilarity(langInvar, name)),
							item = item.itemIndex
						});
					}
				}
			}
			finally
			{
				((IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose();
			}
			foreach (MatchSimilarity item2 in matches.OrderByDescending((MatchSimilarity m) => m.similarity))
			{
				yield return (ItemIndex)item2.item;
			}
		}

		private static string GetLangInvar(string baseToken)
		{
			if (baseToken == null)
			{
				return "";
			}
			return RemoveSpacesAndAlike(Language.GetString(baseToken));
		}

		private static int GetSimilarity(string s, string partial)
		{
			if (string.IsNullOrEmpty(partial) || !s.ToUpper().Contains(partial))
			{
				return int.MinValue;
			}
			int num = (s.StartsWith(partial, StringComparison.InvariantCultureIgnoreCase) ? 1000 : 0);
			return num + partial.Length - s.Length;
		}

		private static string RemoveSpacesAndAlike(string input)
		{
			return Regex.Replace(input, "[ '(),-]|\\{\\d+\\}", string.Empty);
		}
	}
}
namespace TTATweaks.Tweaks
{
	public static class EliteTweaks
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static Manipulator <0>__StygianDisablesHealing;

			public static Manipulator <1>__StygianAdjustKillMinionsBehaviour;

			public static Manipulator <2>__CollectiveSkipExplosion;

			public static Manipulator <3>__GlacialSkipExplosion;

			public static Manipulator <4>__GlacialAdjustSlow;

			public static Manipulator <5>__TwistedInflictsCripple;

			public static Manipulator <6>__MendingCanHealMending;

			public static Manipulator <7>__MendingLifeSteal;

			public static StatHookEventHandler <8>__CelestineBuffsSpeeds;
		}

		public static void Init()
		{
			//IL_0011: 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_001c: Expected O, but got Unknown
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Expected O, but got Unknown
			//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_007f: Expected O, but got Unknown
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Expected O, but got Unknown
			//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_00c1: Expected O, but got Unknown
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Expected O, but got Unknown
			//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)
			//IL_0103: Expected O, but got Unknown
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Expected O, but got Unknown
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Expected O, but got Unknown
			object obj = <>O.<0>__StygianDisablesHealing;
			if (obj == null)
			{
				Manipulator val = StygianDisablesHealing;
				<>O.<0>__StygianDisablesHealing = val;
				obj = (object)val;
			}
			GlobalEventManager.ProcessHitEnemy += (Manipulator)obj;
			object obj2 = <>O.<1>__StygianAdjustKillMinionsBehaviour;
			if (obj2 == null)
			{
				Manipulator val2 = StygianAdjustKillMinionsBehaviour;
				<>O.<1>__StygianAdjustKillMinionsBehaviour = val2;
				obj2 = (object)val2;
			}
			NetworkedAffixDeathBehaviour.KillAllGhostsServer += (Manipulator)obj2;
			object obj3 = <>O.<2>__CollectiveSkipExplosion;
			if (obj3 == null)
			{
				Manipulator val3 = CollectiveSkipExplosion;
				<>O.<2>__CollectiveSkipExplosion = val3;
				obj3 = (object)val3;
			}
			AffixCollectiveAttachmentBehaviour.DeathChainUpdate += (Manipulator)obj3;
			object obj4 = <>O.<2>__CollectiveSkipExplosion;
			if (obj4 == null)
			{
				Manipulator val4 = CollectiveSkipExplosion;
				<>O.<2>__CollectiveSkipExplosion = val4;
				obj4 = (object)val4;
			}
			AffixCollectiveAttachmentBehaviour.HandleDeath += (Manipulator)obj4;
			object obj5 = <>O.<3>__GlacialSkipExplosion;
			if (obj5 == null)
			{
				Manipulator val5 = GlacialSkipExplosion;
				<>O.<3>__GlacialSkipExplosion = val5;
				obj5 = (object)val5;
			}
			GlobalEventManager.OnCharacterDeath += (Manipulator)obj5;
			object obj6 = <>O.<4>__GlacialAdjustSlow;
			if (obj6 == null)
			{
				Manipulator val6 = GlacialAdjustSlow;
				<>O.<4>__GlacialAdjustSlow = val6;
				obj6 = (object)val6;
			}
			GlobalEventManager.ProcessHitEnemy += (Manipulator)obj6;
			object obj7 = <>O.<5>__TwistedInflictsCripple;
			if (obj7 == null)
			{
				Manipulator val7 = TwistedInflictsCripple;
				<>O.<5>__TwistedInflictsCripple = val7;
				obj7 = (object)val7;
			}
			HealthComponent.TakeDamageProcess += (Manipulator)obj7;
			object obj8 = <>O.<6>__MendingCanHealMending;
			if (obj8 == null)
			{
				Manipulator val8 = MendingCanHealMending;
				<>O.<6>__MendingCanHealMending = val8;
				obj8 = (object)val8;
			}
			HealNearbyController.Tick += (Manipulator)obj8;
			object obj9 = <>O.<7>__MendingLifeSteal;
			if (obj9 == null)
			{
				Manipulator val9 = MendingLifeSteal;
				<>O.<7>__MendingLifeSteal = val9;
				obj9 = (object)val9;
			}
			GlobalEventManager.ProcessHitEnemy += (Manipulator)obj9;
			object obj10 = <>O.<8>__CelestineBuffsSpeeds;
			if (obj10 == null)
			{
				StatHookEventHandler val10 = CelestineBuffsSpeeds;
				<>O.<8>__CelestineBuffsSpeeds = val10;
				obj10 = (object)val10;
			}
			RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)obj10;
		}

		private static void MendingLifeSteal(ILContext il)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			Action<CharacterBody, DamageInfo> action = delegate(CharacterBody body, DamageInfo damageInfo)
			{
				//IL_0033: Unknown result type (might be due to invalid IL or missing references)
				if (Options.mendingLifeSteal.Value && body.HasBuff(Buffs.EliteEarth))
				{
					body.healthComponent.Heal(0.1f * damageInfo.damage, damageInfo.procChainMask, true);
				}
			};
			ILCursor val = new ILCursor(il);
			int bodyLoc = 0;
			int damageInfoArg = 0;
			ILLabel val2 = default(ILLabel);
			if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[5]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref bodyLoc),
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "LifeSteal"),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CharacterBody>(x, "HasBuff"),
				(Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref val2),
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, ref damageInfoArg)
			}))
			{
				val.Goto(0, (MoveType)0, false);
				if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(GlobalEventManager), "ProcDeathMark")
				}))
				{
					val.Emit(OpCodes.Ldloc, bodyLoc);
					val.Emit(OpCodes.Ldarg, damageInfoArg);
					val.EmitDelegate<Action<CharacterBody, DamageInfo>>(action);
				}
				else
				{
					Log.Error("Part 2 of MendingLifeSteal IL hook failed! Mending elites will not have life steal.");
				}
			}
			else
			{
				Log.Error("Part 1 of MendingLifeSteal IL hook failed! Mending elites will not have life steal.");
			}
		}

		private static void MendingCanHealMending(ILContext il)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			Func<bool> func = () => Options.mendingCanHealMending.Value;
			ILCursor val = new ILCursor(il);
			ILLabel val2 = val.DefineLabel();
			int num = default(int);
			ILLabel val3 = default(ILLabel);
			if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[6]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<HurtBox>(x, "healthComponent"),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<HealthComponent>(x, "body"),
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "EliteEarth"),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CharacterBody>(x, "HasBuff"),
				(Instruction x) => ILPatternMatchingExt.MatchBrtrue(x, ref val3)
			}))
			{
				val.EmitDelegate<Func<bool>>(func);
				val.Emit(OpCodes.Brtrue, (object)val2);
				val.Index += 6;
				val.MarkLabel(val2);
			}
			else
			{
				Log.Error("MendingCanHealMending IL hook failed! Mending elites cannot heal each other.");
			}
		}

		private static void CelestineBuffsSpeeds(CharacterBody body, StatHookEventArgs args)
		{
			if (Object.op_Implicit((Object)(object)body) && ((Options.celestineBuffsSpeeds.Value && body.HasBuff(Buffs.AffixHaunted)) || body.HasBuff(Buffs.AffixHauntedRecipient)))
			{
				args.attackSpeedMultAdd += 0.2f;
				args.moveSpeedMultAdd += 0.2f;
			}
		}

		private static void TwistedInflictsCripple(ILContext il)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			Func<CharacterBody, bool> func = (CharacterBody body) => Options.twistedInflictsCripple.Value && body.HasBuff(Buffs.EliteBead);
			ILCursor val = new ILCursor(il);
			ILLabel val2 = val.DefineLabel();
			int displayClassLoc = 0;
			FieldInfo attackerField = typeof(HealthComponent).GetNestedTypes(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)?.FirstOrDefault((Type x) => x.GetField("attackerBody") != null)?.GetField("attackerBody");
			ILLabel val3 = default(ILLabel);
			if (attackerField != null && val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[5]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref displayClassLoc),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld(x, attackerField),
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "AffixLunar"),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CharacterBody>(x, "HasBuff"),
				(Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref val3)
			}))
			{
				val.Emit(OpCodes.Ldloc, displayClassLoc);
				val.Emit(OpCodes.Ldfld, attackerField);
				val.EmitDelegate<Func<CharacterBody, bool>>(func);
				val.Emit(OpCodes.Brtrue, (object)val2);
				val.Index += 5;
				val.MarkLabel(val2);
			}
			else
			{
				Log.Error("TwistedInflictsCripple IL hook failed! Twisted elites cannot apply cripple on hit.");
			}
		}

		private static void CollectiveSkipExplosion(ILContext il)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			Func<bool> func = () => Options.collectiveSkipExplosion.Value;
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(Util), "PlaySound")
			}))
			{
				ILLabel val2 = val.MarkLabel();
				val.Goto(0, (MoveType)0, false);
				if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchInitobj<FireProjectileInfo>(x)
				}))
				{
					val.EmitDelegate<Func<bool>>(func);
					val.Emit(OpCodes.Brtrue, (object)val2);
				}
				else
				{
					Log.Error("Part 2 of CollectiveSkipExplosion IL hook failed! Collective elite death explosions will still occur.");
				}
			}
			else
			{
				Log.Error("Part 1 of CollectiveSkipExplosion IL hook failed! Collective elite death explosions will still occur.");
			}
		}

		private static void StygianAdjustKillMinionsBehaviour(ILContext il)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			Func<NetworkedAffixDeathBehaviour, bool> func = (NetworkedAffixDeathBehaviour affixBehaviour) => Options.stygiansDontKillPlayerMinions.Value && Object.op_Implicit((Object)(object)affixBehaviour.attachedBody) && Object.op_Implicit((Object)(object)affixBehaviour.attachedBody.teamComponent) && (int)affixBehaviour.attachedBody.teamComponent.teamIndex == 1;
			ILCursor val = new ILCursor(il);
			ILLabel retAddress = val.DefineLabel();
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref retAddress)
			}))
			{
				val.Emit(OpCodes.Ldarg_0);
				val.EmitDelegate<Func<NetworkedAffixDeathBehaviour, bool>>(func);
				val.Emit(OpCodes.Brtrue, (object)retAddress);
			}
			else
			{
				Log.Error("StygianAdjustKillMinionsBehaviour IL hook failed! Losing the Stygian affix may still kill all minions for entities on the Player team.");
			}
		}

		private static void StygianDisablesHealing(ILContext il)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			//IL_00b6: 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)
			Func<CharacterBody, bool> func = (CharacterBody body) => Options.stygiansDisableHealing.Value && body.HasBuff(Buffs.EliteDeath);
			ILCursor val = new ILCursor(il);
			ILLabel afterAffixAddress = val.DefineLabel();
			int bodyLoc = 1;
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[4]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref bodyLoc),
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "AffixPoison"),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CharacterBody>(x, "HasBuff"),
				(Instruction x) => ILPatternMatchingExt.MatchBrtrue(x, ref afterAffixAddress)
			}))
			{
				val.Emit(OpCodes.Ldloc, bodyLoc);
				val.EmitDelegate<Func<CharacterBody, bool>>(func);
				val.Emit(OpCodes.Brtrue, (object)afterAffixAddress);
			}
			else
			{
				Log.Error("StygianDisablesHealing IL hook failed! Stygians cannot apply DisabledHealing on hit.");
			}
		}

		public static void SetStygianInT2Pool(bool setInPool)
		{
			EliteDef death = Elites.Death;
			if (CombatDirector.eliteTiers == null || CombatDirector.eliteTiers.Length == 0 || !Object.op_Implicit((Object)(object)death))
			{
				return;
			}
			EliteTierDef val = CombatDirector.eliteTiers[5];
			if (setInPool)
			{
				if (!val.eliteTypes.Contains(death))
				{
					ArrayUtils.ArrayAppend<EliteDef>(ref val.eliteTypes, ref death);
				}
			}
			else if (val.eliteTypes.Contains(death))
			{
				ArrayUtils.ArrayRemoveAtAndResize<EliteDef>(ref val.eliteTypes, Array.IndexOf(val.eliteTypes, death), 1);
			}
		}

		private static void GlacialSkipExplosion(ILContext il)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			Func<bool, bool> func = (bool hasGlacial) => hasGlacial && !Options.glacialSkipExplosion.Value;
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "AffixWhite")
			}) && val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CharacterBody>(x, "HasBuff")
			}))
			{
				val.EmitDelegate<Func<bool, bool>>(func);
			}
			else
			{
				Log.Error("GlacialSkipExplosion IL hook failed! Glacial elite explosion behaviour will always occur.");
			}
		}

		private static void GlacialAdjustSlow(ILContext il)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			Func<int, int> func = (int hasBuff) => (hasBuff > 0) ? ((int)Options.glacialSlowDurationMult.Value * hasBuff) : 0;
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "AffixWhite")
			}) && val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 1)
			}))
			{
				val.EmitDelegate<Func<int, int>>(func);
			}
			else
			{
				Log.Error("DoubleGlacialSlow IL hook failed! Glacial elite slow duration is unchanged.");
			}
		}
	}
	public class HonorTweaks
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static Action<ILContext> <0>__DoppelgangersSpawnElite;

			public static Action<ILContext> <1>__AllyAurelioniteTweaks;

			public static Action<CharacterBody> <2>__MinionsSpawnElite;

			public static Manipulator <3>__UrchinsSpawnElite;

			public static Action<Run> <4>__PlayersSpawnElite;

			public static hook_OnEnter <5>__ArtifactReliquarySpawnsGilded;
		}

		public static bool giveAurelioniteItems;

		public static Dictionary<string, int> allyAurelioniteItems;

		public const string defaultAllyAurelioniteItemsString = "\"GoldOnHurt\": 1, \"BonusGoldPackOnKill\": 5, \"Knurl\": 1";

		private static Xoroshiro128Plus rng;

		private static Type aurelioniteDisplayClass;

		public static void Init()
		{
			//IL_0183: 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_018e: Expected O, but got Unknown
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Expected O, but got Unknown
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Expected O, but got Unknown
			Type[] nestedTypes = typeof(DoppelgangerInvasionManager).GetNestedTypes(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
			MethodInfo methodInfo = ((nestedTypes == null) ? null : nestedTypes[0]?.GetMethods(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)?.FirstOrDefault((MethodInfo x) => x.Name.Contains("<CreateDoppelganger>b__")));
			if (methodInfo != null)
			{
				HookEndpointManager.Modify((MethodBase)methodInfo, (Delegate)new Action<ILContext>(DoppelgangersSpawnElite));
			}
			else
			{
				Log.Error("Could not find CreateDoppelganger method! Failed to apply DoppelgangersSpawnElite IL hook!");
			}
			MethodInfo methodInfo2 = null;
			Type[] nestedTypes2 = typeof(GoldTitanManager).GetNestedTypes(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
			Type[] array = nestedTypes2;
			for (int num = 0; num < array.Length; num++)
			{
				methodInfo2 = (aurelioniteDisplayClass = array[num]).GetMethods(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)?.FirstOrDefault((MethodInfo x) => x.Name.Contains("<TryStartChannelingTitansServer>g__OnSpawnedServer"));
				if (methodInfo2 != null)
				{
					HookEndpointManager.Modify((MethodBase)methodInfo2, (Delegate)new Action<ILContext>(AllyAurelioniteTweaks));
					break;
				}
			}
			if (methodInfo2 == null)
			{
				Log.Error("Could not find TryStartChannelingTitansServer method! Failed to apply AllyAurelioniteTweaks IL hook!");
			}
			CharacterBody.onBodyStartGlobal += MinionsSpawnElite;
			object obj = <>O.<3>__UrchinsSpawnElite;
			if (obj == null)
			{
				Manipulator val = UrchinsSpawnElite;
				<>O.<3>__UrchinsSpawnElite = val;
				obj = (object)val;
			}
			GlobalEventManager.OnCharacterDeath += (Manipulator)obj;
			Run.onRunStartGlobal += PlayersSpawnElite;
			object obj2 = <>O.<5>__ArtifactReliquarySpawnsGilded;
			if (obj2 == null)
			{
				hook_OnEnter val2 = ArtifactReliquarySpawnsGilded;
				<>O.<5>__ArtifactReliquarySpawnsGilded = val2;
				obj2 = (object)val2;
			}
			WaitForKey.OnEnter += (hook_OnEnter)obj2;
			rng = new Xoroshiro128Plus(RoR2Application.rng.nextUlong);
		}

		public static Dictionary<string, int> GenerateAllyAurelioniteItems(Dictionary<string, int> jsonObject)
		{
			Dictionary<string, int> dictionary = new Dictionary<string, int>();
			foreach (KeyValuePair<string, int> item in jsonObject)
			{
				dictionary[item.Key] = item.Value;
			}
			return dictionary;
		}

		private static void ArtifactReliquarySpawnsGilded(orig_OnEnter orig, WaitForKey self)
		{
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			if (NetworkServer.active && ((EntityState)self).healthComponent.combinedHealthFraction >= 1f && CombatDirector.IsEliteOnlyArtifactActive() && Options.honorGildedReliquary.Value)
			{
				((EntityState)self).characterBody.master.inventory.SetEquipmentIndex(Elites.AurelioniteHonor.eliteEquipmentDef.equipmentIndex, true);
			}
		}

		private static void AllyAurelioniteTweaks(ILContext il)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			//IL_0060: 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_00b1: 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_00ce: Unknown result type (might be due to invalid IL or missing references)
			Action<SpawnResult> action = delegate(SpawnResult result)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0049: Unknown result type (might be due to invalid IL or missing references)
				//IL_0083: Unknown result type (might be due to invalid IL or missing references)
				//IL_0088: Unknown result type (might be due to invalid IL or missing references)
				//IL_008a: Unknown result type (might be due to invalid IL or missing references)
				//IL_008d: Invalid comparison between Unknown and I4
				//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
				GameObject spawnedInstance = result.spawnedInstance;
				CharacterMaster val2 = ((spawnedInstance != null) ? spawnedInstance.GetComponent<CharacterMaster>() : null);
				if (val2 != null)
				{
					if (CombatDirector.IsEliteOnlyArtifactActive() && Options.honorGildedAurelionite.Value)
					{
						val2.inventory.SetEquipmentIndex(Elites.AurelioniteHonor.eliteEquipmentDef.equipmentIndex, true);
					}
					if (giveAurelioniteItems)
					{
						foreach (string key in allyAurelioniteItems.Keys)
						{
							ItemIndex itemFromPartial = Utils.GetItemFromPartial(key);
							if ((int)itemFromPartial != -1)
							{
								Log.Info($"Giving {key}x{allyAurelioniteItems[key]} to Aurelionite");
								val2.inventory.GiveItemPermanent(itemFromPartial, allyAurelioniteItems[key]);
							}
							else
							{
								Log.Warning("Couldn't find an item from item name '" + key + "'!");
							}
						}
					}
				}
			};
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdfld(x, aurelioniteDisplayClass, "currentBoostHpCoefficient")
			}))
			{
				val.Emit(OpCodes.Ldc_R4, 3.5f);
				val.Emit(OpCodes.Mul);
				if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdfld(x, aurelioniteDisplayClass, "currentBoostDamageCoefficient")
				}))
				{
					val.Emit(OpCodes.Ldc_R4, 2f);
					val.Emit(OpCodes.Mul);
					val.Emit(OpCodes.Ldarg_1);
					val.EmitDelegate<Action<SpawnResult>>(action);
				}
				else
				{
					Log.Error("Part 2 of AurelioniteSpawnsGilded IL hook failed! Aurelionite will not correctly spawn as gilded in Artifact of Honor.");
				}
			}
			else
			{
				Log.Error("Part 1 of AurelioniteSpawnsGilded IL hook failed! Aurelionite will not correctly spawn as gilded in Artifact of Honor.");
			}
		}

		private static void PlayersSpawnElite(Run run)
		{
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active)
			{
				return;
			}
			foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances)
			{
				object obj;
				if (instance == null)
				{
					obj = null;
				}
				else
				{
					CharacterMaster master = instance.master;
					obj = ((master != null) ? master.inventory : null);
				}
				Inventory val = (Inventory)obj;
				if (val != null && CombatDirector.IsEliteOnlyArtifactActive() && Options.honorElitePlayers.Value)
				{
					EliteDef randomAvailableT1EliteDefUnconditional = GetRandomAvailableT1EliteDefUnconditional(rng);
					val.SetEquipmentIndex(randomAvailableT1EliteDefUnconditional.eliteEquipmentDef.equipmentIndex, true);
				}
			}
		}

		private static void DoppelgangersSpawnElite(ILContext il)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			Action<SpawnResult> action = delegate(SpawnResult result)
			{
				//IL_0001: 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)
				GameObject spawnedInstance = result.spawnedInstance;
				CharacterMaster val2 = ((spawnedInstance != null) ? spawnedInstance.GetComponent<CharacterMaster>() : null);
				if (val2 != null && CombatDirector.IsEliteOnlyArtifactActive() && Options.honorEliteUmbras.Value)
				{
					EliteDef randomAvailableT1EliteDef = GetRandomAvailableT1EliteDef(rng);
					val2.inventory.SetEquipmentIndex(randomAvailableT1EliteDef.eliteEquipmentDef.equipmentIndex, true);
				}
			};
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CombatSquad>(x, "AddMember")
			}))
			{
				val.Emit(OpCodes.Ldarg_1);
				val.EmitDelegate<Action<SpawnResult>>(action);
			}
			else
			{
				Log.Error("DoppelgangersSpawnElite IL hook failed! Vengeance doppelgangers will be unchanged in Artifact of Honor.");
			}
		}

		private static void MinionsSpawnElite(CharacterBody body)
		{
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			if (!Options.honorEliteMinions.Value || !NetworkServer.active || !CombatDirector.IsEliteOnlyArtifactActive() || !Object.op_Implicit((Object)(object)body) || !(((Object)((Component)body).gameObject).name != "EquipmentDroneBody(Clone)"))
			{
				return;
			}
			CharacterMaster master = body.master;
			MinionOwnership val = ((master != null) ? ((Component)master).GetComponent<MinionOwnership>() : null);
			if ((Object)(object)val != (Object)null && !body.isElite && (Object)(object)val.ownerMaster != (Object)null)
			{
				EliteDef randomAvailableT1HonorEliteDef = GetRandomAvailableT1HonorEliteDef(rng);
				master.inventory.SetEquipmentIndex(randomAvailableT1HonorEliteDef.eliteEquipmentDef.equipmentIndex, false);
				if (Options.minionEliteBuffs.Value)
				{
					master.inventory.GiveItemPermanent(Items.BoostHp, Mathf.RoundToInt((randomAvailableT1HonorEliteDef.healthBoostCoefficient - 1f) * 10f));
					master.inventory.GiveItemPermanent(Items.BoostDamage, Mathf.RoundToInt(randomAvailableT1HonorEliteDef.damageBoostCoefficient - 1f) * 10);
				}
			}
		}

		private static void UrchinsSpawnElite(ILContext il)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Expected O, but got Unknown
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			Action<CharacterMaster> action = delegate(CharacterMaster master)
			{
				//IL_0039: Unknown result type (might be due to invalid IL or missing references)
				if (Object.op_Implicit((Object)(object)master) && CombatDirector.IsEliteOnlyArtifactActive() && Options.honorEliteUrchins.Value)
				{
					EliteDef randomAvailableT1HonorEliteDef = GetRandomAvailableT1HonorEliteDef(rng);
					master.inventory.SetEquipmentIndex(randomAvailableT1HonorEliteDef.eliteEquipmentDef.equipmentIndex, false);
					master.inventory.GiveItemPermanent(Items.BoostHp, Mathf.RoundToInt((randomAvailableT1HonorEliteDef.healthBoostCoefficient - 1f) * 10f));
					master.inventory.GiveItemPermanent(Items.BoostDamage, Mathf.RoundToInt(randomAvailableT1HonorEliteDef.damageBoostCoefficient - 1f) * 10);
				}
			};
			int characterMasterLoc = 0;
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdstr(x, "Prefabs/CharacterMasters/UrchinTurretMaster")
			}) && val.TryGotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<GameObject>(x, "GetComponent")
			}) && val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref characterMasterLoc)
			}))
			{
				val.Emit(OpCodes.Ldloc, characterMasterLoc);
				val.EmitDelegate<Action<CharacterMaster>>(action);
			}
			else
			{
				Log.Error("UrchinsSpawnElite IL hook failed! Malachite urchins will be unchanged in Artifact of Honor.");
			}
		}

		private static EliteDef GetRandomAvailableT1EliteDef(Xoroshiro128Plus rng)
		{
			EliteTierDef val = ((Run.instance.stageClearCount >= 2) ? CombatDirector.eliteTiers[4] : CombatDirector.eliteTiers[1]);
			return val.GetRandomAvailableEliteDef(rng);
		}

		private static EliteDef GetRandomAvailableT1EliteDefUnconditional(Xoroshiro128Plus rng)
		{
			return CombatDirector.eliteTiers[4].GetRandomAvailableEliteDef(rng);
		}

		private static EliteDef GetRandomAvailableT1HonorEliteDef(Xoroshiro128Plus rng)
		{
			EliteTierDef val = ((Run.instance.stageClearCount >= 2) ? CombatDirector.eliteTiers[3] : CombatDirector.eliteTiers[2]);
			return val.GetRandomAvailableEliteDef(rng);
		}
	}
	public static class SyncItems
	{
		private class MirrorSource : MonoBehaviour
		{
			public event Action<ItemIndex, int> onItemGiven;

			public event Action<EquipmentState> onEquipmentGiven;

			public void InvokeItemGivenEvent(ItemIndex item, int count)
			{
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				this.onItemGiven?.Invoke(item, count);
			}

			public void InvokeEquipGivenEvent(EquipmentState equipmentState)
			{
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				this.onEquipmentGiven?.Invoke(equipmentState);
			}
		}

		private class MirrorLink : MonoBehaviour
		{
			private MirrorSource mirrorSource;

			private Inventory droneInventory;

			public void Init(MirrorSource mirrorSource, Inventory droneInventory)
			{
				this.droneInventory = droneInventory;
				this.mirrorSource = mirrorSource;
				if (Object.op_Implicit((Object)(object)mirrorSource))
				{
					mirrorSource.onItemGiven += OnOwnerGetItem;
					mirrorSource.onEquipmentGiven += OnOwnerGetEquip;
				}
			}

			private void OnOwnerGetItem(ItemIndex item, int amount)
			{
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				//IL_0043: Unknown result type (might be due to invalid IL or missing references)
				//IL_0044: Unknown result type (might be due to invalid IL or missing references)
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				if (NetworkServer.active && Object.op_Implicit((Object)(object)mirrorSource) && Object.op_Implicit((Object)(object)droneInventory))
				{
					droneInventory.ChangeItemStacksCount<GiveItemPermanentImpl>(new GiveItemPermanentImpl
					{
						inventory = droneInventory
					}, item, ItemFilter(item, ((Object)droneInventory).name) ? amount : 0);
				}
			}

			private void OnOwnerGetEquip(EquipmentState equipmentState)
			{
				if (NetworkServer.active && Object.op_Implicit((Object)(object)mirrorSource) && Object.op_Implicit((Object)(object)droneInventory))
				{
					SetToOwnerEquip(((Component)mirrorSource).GetComponent<Inventory>(), droneInventory);
				}
			}

			private void OnDestroy()
			{
				if (Object.op_Implicit((Object)(object)mirrorSource))
				{
					mirrorSource.onItemGiven -= OnOwnerGetItem;
				}
			}
		}

		[CompilerGenerated]
		private static class <>O
		{
			public static Action<CharacterMaster> <0>__LinkAllies;

			public static hook_Add <1>__FireItemGetEvent;

			public static hook_SetEquipmentInternal_EquipmentState_uint_uint <2>__FireEquipmentGetEvent;

			public static hook_UpdateMinionInventory <3>__AddDevotionInventoryBack;

			public static Manipulator <4>__SkipFriendUnitItemUpdate;

			public static Func<ItemIndex, string, bool> <5>__ItemFilter;
		}

		public static Dictionary<string, HashSet<string>> blacklist;

		public static Dictionary<string, HashSet<string>> defaultBlacklist;

		public const string defaultBlacklistString = "\"all\":[\"MinorConstructOnKill\", \"DroneWeapons\", \"RoboBallBuddy\", \"FocusConvergence\", \"TitanGoldDuringTP\", \"TPHealingNova\", \"VoidMegaCrabItem\", \"BeetleGland\", \"WardOnLevel\", \"PhysicsProjectile\", \"DronesDropDynamite\"]";

		public static bool useCustomBlacklist;

		public static void Init()
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Expected O, but got Unknown
			//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_007f: Expected O, but got Unknown
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Expected O, but got Unknown
			CharacterMaster.onStartGlobal += LinkAllies;
			object obj = <>O.<1>__FireItemGetEvent;
			if (obj == null)
			{
				hook_Add val = FireItemGetEvent;
				<>O.<1>__FireItemGetEvent = val;
				obj = (object)val;
			}
			GiveItemPermanentImpl.Add += (hook_Add)obj;
			object obj2 = <>O.<2>__FireEquipmentGetEvent;
			if (obj2 == null)
			{
				hook_SetEquipmentInternal_EquipmentState_uint_uint val2 = FireEquipmentGetEvent;
				<>O.<2>__FireEquipmentGetEvent = val2;
				obj2 = (object)val2;
			}
			Inventory.SetEquipmentInternal_EquipmentState_uint_uint += (hook_SetEquipmentInternal_EquipmentState_uint_uint)obj2;
			object obj3 = <>O.<3>__AddDevotionInventoryBack;
			if (obj3 == null)
			{
				hook_UpdateMinionInventory val3 = AddDevotionInventoryBack;
				<>O.<3>__AddDevotionInventoryBack = val3;
				obj3 = (object)val3;
			}
			DevotionInventoryController.UpdateMinionInventory += (hook_UpdateMinionInventory)obj3;
			object obj4 = <>O.<4>__SkipFriendUnitItemUpdate;
			if (obj4 == null)
			{
				Manipulator val4 = SkipFriendUnitItemUpdate;
				<>O.<4>__SkipFriendUnitItemUpdate = val4;
				obj4 = (object)val4;
			}
			PhysicsProjectileBehavior.UpdateFriendUnitMovementItems += (Manipulator)obj4;
			defaultBlacklist = GenerateBlacklist(JsonConvert.DeserializeObject<Dictionary<string, string[]>>("{\"all\":[\"MinorConstructOnKill\", \"DroneWeapons\", \"RoboBallBuddy\", \"FocusConvergence\", \"TitanGoldDuringTP\", \"TPHealingNova\", \"VoidMegaCrabItem\", \"BeetleGland\", \"WardOnLevel\", \"PhysicsProjectile\", \"DronesDropDynamite\"]}"));
		}

		public static Dictionary<string, HashSet<string>> GenerateBlacklist(Dictionary<string, string[]> jsonObject)
		{
			Dictionary<string, HashSet<string>> dictionary = new Dictionary<string, HashSet<string>>();
			foreach (KeyValuePair<string, string[]> item in jsonObject)
			{
				dictionary[item.Key] = new HashSet<string>(item.Value);
			}
			return dictionary;
		}

		private static void LinkAllies(CharacterMaster master)
		{
			if (NetworkServer.active && Options.syncMinionItems.Value && NetworkServer.active && Object.op_Implicit((Object)(object)master) && Object.op_Implicit((Object)(object)master.inventory))
			{
				MinionOwnership component = ((Component)master).GetComponent<MinionOwnership>();
				if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.ownerMaster) && (Object)(object)component.ownerMaster.playerCharacterMasterController != (Object)null && !Object.op_Implicit((Object)(object)((Component)master).GetComponent<MirrorLink>()))
				{
					((MonoBehaviour)TTATweaks.plugin).StartCoroutine(DeferredLink(master));
				}
			}
		}

		private static IEnumerator DeferredLink(CharacterMaster master)
		{
			yield return null;
			object obj;
			if (master == null)
			{
				obj = null;
			}
			else
			{
				MinionOwnership component = ((Component)master).GetComponent<MinionOwnership>();
				obj = ((component != null) ? component.ownerMaster : null);
			}
			CharacterMaster ownerMaster = (CharacterMaster)obj;
			Inventory ownerInventory = ((ownerMaster != null) ? ownerMaster.inventory : null);
			Inventory droneInventory = master.inventory;
			if (!((Object)(object)ownerInventory == (Object)null) && !((Object)(object)droneInventory == (Object)null))
			{
				MirrorSource mirrorSource = ((ownerInventory != null) ? ((Component)ownerInventory).GetComponent<MirrorSource>() : null);
				if ((Object)(object)mirrorSource == (Object)null)
				{
					mirrorSource = ((Component)ownerInventory).gameObject.AddComponent<MirrorSource>();
				}
				((Component)master).gameObject.AddComponent<MirrorLink>().Init(mirrorSource, droneInventory);
				if (!((Object)((Component)master).gameObject).name.Contains("EngiTurret"))
				{
					AddFullOwnerInventory(ownerInventory, droneInventory);
				}
			}
		}

		private static void FireItemGetEvent(orig_Add orig, ref GiveItemPermanentImpl self, ItemIndex itemIndex, int countToAdd)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(ref self, itemIndex, countToAdd);
			MirrorSource component = ((Component)self.inventory).GetComponent<MirrorSource>();
			if (Object.op_Implicit((Object)(object)component))
			{
				component.InvokeItemGivenEvent(itemIndex, countToAdd);
			}
		}

		private static bool FireEquipmentGetEvent(orig_SetEquipmentInternal_EquipmentState_uint_uint orig, Inventory self, EquipmentState equipmentState, uint slot, uint set)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			bool result = orig.Invoke(self, equipmentState, slot, set);
			MirrorSource component = ((Component)self).GetComponent<MirrorSource>();
			if (Object.op_Implicit((Object)(object)component))
			{
				component.InvokeEquipGivenEvent(equipmentState);
			}
			return result;
		}

		private static void AddDevotionInventoryBack(orig_UpdateMinionInventory orig, DevotionInventoryController self, DevotedLemurianController devotedLemurianController, bool shouldEvolve)
		{
			orig.Invoke(self, devotedLemurianController, shouldEvolve);
			MirrorLink component = ((Component)devotedLemurianController).GetComponent<MirrorLink>();
			CharacterMaster lemurianMaster = devotedLemurianController._lemurianMaster;
			object obj;
			if (lemurianMaster == null)
			{
				obj = null;
			}
			else
			{
				MinionOwnership minionOwnership = lemurianMaster.minionOwnership;
				if (minionOwnership == null)
				{
					obj = null;
				}
				else
				{
					CharacterMaster ownerMaster = minionOwnership.ownerMaster;
					obj = ((ownerMaster != null) ? ownerMaster.inventory : null);
				}
			}
			Inventory ownerInventory = (Inventory)obj;
			if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)devotedLemurianController.LemurianInventory))
			{
				AddFullOwnerInventory(ownerInventory, devotedLemurianController.LemurianInventory);
			}
		}

		private static void SkipFriendUnitItemUpdate(ILContext il)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			Func<bool> func = () => Options.syncMinionItems.Value;
			ILCursor val = new ILCursor(il);
			ILLabel val2 = val.DefineLabel();
			if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0)
			}))
			{
				val.EmitDelegate<Func<bool>>(func);
				val.Emit(OpCodes.Brtrue, (object)val2);
				if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<PhysicsProjectileBehavior>(x, "UpdateFriendUnit")
				}))
				{
					val.MarkLabel(val2);
				}
			}
		}

		private static void AddFullOwnerInventory(Inventory ownerInventory, Inventory minionInventory)
		{
			SetToOwnerEquip(ownerInventory, minionInventory);
			minionInventory.AddItemsFrom(ownerInventory, ItemFilter);
		}

		private static void SetToOwnerEquip(Inventory ownerInventory, Inventory minionInventory)
		{
			if (Object.op_Implicit((Object)(object)ownerInventory) && Object.op_Implicit((Object)(object)minionInventory) && !CombatDirector.IsEliteOnlyArtifactActive() && ((Object)((Component)minionInventory).gameObject).name != "EquipmentDroneMaster(Clone)")
			{
				minionInventory.CopyEquipmentFrom(ownerInventory, true);
			}
		}

		public static void AddItemsFrom(this Inventory owner, Inventory other, Func<ItemIndex, string, bool> bodyFilter)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active)
			{
				Debug.LogWarning((object)"[Server] function 'System.Void RoR2.Inventory::AddItemsFrom(RoR2.Inventory,System.Func`2<RoR2.ItemIndex,System.Boolean>)' called on client");
				return;
			}
			InventoryChangeScope val = default(InventoryChangeScope);
			((InventoryChangeScope)(ref val))..ctor(owner);
			try
			{
				List<ItemIndex> list = default(List<ItemIndex>);
				DisposableRental<ItemIndex, List<ItemIndex>> val2 = CollectionPool<ItemIndex, List<ItemIndex>>.RentCollection(ref list);
				try
				{
					((ItemCollection)(ref other.permanentItemStacks)).GetNonZeroIndices(list);
					foreach (ItemIndex item in list)
					{
						owner.ChangeItemStacksCount<GiveItemPermanentImpl>(new GiveItemPermanentImpl
						{
							inventory = owner
						}, item, bodyFilter(item, ((Object)owner).name) ? ((ItemCollection)(ref other.permanentItemStacks)).GetStackValue(item) : 0);
					}
				}
				finally
				{
					val2.Dispose();
				}
			}
			finally
			{
				((InventoryChangeScope)(ref val)).Dispose();
			}
		}

		public static bool ItemFilter(ItemIndex itemIndex, string masterName)
		{
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			if (masterName.EndsWith("Master(Clone)"))
			{
				masterName = masterName.Substring(0, masterName.Length - "Master(Clone)".Length);
			}
			if (useCustomBlacklist)
			{
				if (blacklist.TryGetValue("all", out var value) && value.Contains(((Object)ItemCatalog.GetItemDef(itemIndex)).name))
				{
					return false;
				}
				if (blacklist.TryGetValue(masterName, out value) && value.Contains(((Object)ItemCatalog.GetItemDef(itemIndex)).name))
				{
					return false;
				}
				return true;
			}
			return !defaultBlacklist["all"].Contains(((Object)ItemCatalog.GetItemDef(itemIndex)).name);
		}
	}
}