Decompiled source of Booster Tweaker v1.2.1

BepInEx/plugins/Hikaria.BoosterTweaker/Hikaria.BoosterTweaker.dll

Decompiled 7 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Unity.IL2CPP;
using BoosterImplants;
using Clonesoft.Json;
using Clonesoft.Json.Linq;
using DropServer.BoosterImplants;
using GameData;
using Hikaria.BoosterTweaker.Managers;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using Localization;
using TheArchive;
using TheArchive.Core;
using TheArchive.Core.Attributes;
using TheArchive.Core.Attributes.Feature;
using TheArchive.Core.Attributes.Feature.Settings;
using TheArchive.Core.FeaturesAPI;
using TheArchive.Core.FeaturesAPI.Components;
using TheArchive.Core.Localization;
using TheArchive.Core.ModulesAPI;
using TheArchive.Interfaces;
using TheArchive.Loader;
using TheArchive.Utilities;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("Hikaria.BoosterTweaker")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+4b51ffe0699664700c04ac6f429db0810c27b301")]
[assembly: AssemblyProduct("Hikaria.BoosterTweaker")]
[assembly: AssemblyTitle("Hikaria.BoosterTweaker")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Hikaria.BoosterTweaker
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("Hikaria.BoosterTweaker", "BoosterTweaker", "1.2.1")]
	public class EntryPoint : BasePlugin, IArchiveModule
	{
		public bool ApplyHarmonyPatches => false;

		public bool UsesLegacyPatches => false;

		public ArchiveLegacyPatcher Patcher { get; set; }

		public static EntryPoint Instance { get; private set; }

		public string ModuleGroup => "Perfect Booster";

		public Dictionary<Language, string> ModuleGroupLanguages => new Dictionary<Language, string>
		{
			{
				(Language)1,
				"完美强化剂"
			},
			{
				(Language)0,
				"Perfect Booster"
			}
		};

		public override void Load()
		{
			Instance = this;
			ArchiveMod.RegisterArchiveModule(typeof(EntryPoint));
			Logs.LogMessage("OK");
		}

		public void Init()
		{
		}

		public void OnExit()
		{
		}

		public void OnLateUpdate()
		{
		}

		public void OnSceneWasLoaded(int buildIndex, string sceneName)
		{
		}
	}
	internal static class Logs
	{
		private static IArchiveLogger _logger;

		private static IArchiveLogger Logger => _logger ?? (_logger = LoaderWrapper.CreateLoggerInstance("Hikaria.BoosterTweaker", ConsoleColor.White));

		public static void LogDebug(object data)
		{
			Logger.Debug(data.ToString());
		}

		public static void LogError(object data)
		{
			Logger.Error(data.ToString());
		}

		public static void LogInfo(object data)
		{
			Logger.Info(data.ToString());
		}

		public static void LogMessage(object data)
		{
			Logger.Msg(ConsoleColor.White, data.ToString());
		}

		public static void LogWarning(object data)
		{
			Logger.Warning(data.ToString());
		}

		public static void LogNotice(object data)
		{
			Logger.Notice(data.ToString());
		}

		public static void LogSuccess(object data)
		{
			Logger.Success(data.ToString());
		}

		public static void LogException(Exception ex)
		{
			Logger.Exception(ex);
		}
	}
	public static class PluginInfo
	{
		public const string GUID = "Hikaria.BoosterTweaker";

		public const string NAME = "BoosterTweaker";

		public const string VERSION = "1.2.1";
	}
}
namespace Hikaria.BoosterTweaker.Managers
{
	public static class BoosterImplantTemplateManager
	{
		public class bBoosterImplantTemplate
		{
			public uint BoosterImplantID { get; set; }

			public int TemplateIndex { get; set; }

			public BoosterImplantCategory ImplantCategory { get; set; }

			public Dictionary<int, List<bBoosterImplantEffectTemplate>> EffectGroups { get; set; } = new Dictionary<int, List<bBoosterImplantEffectTemplate>>();


			public Dictionary<int, List<bBoosterImplantConditionTemplate>> ConditionGroups { get; set; } = new Dictionary<int, List<bBoosterImplantConditionTemplate>>();


			public bBoosterImplantTemplate(BoosterImplantTemplate template)
			{
				//IL_0041: Unknown result type (might be due to invalid IL or missing references)
				//IL_005c: Unknown result type (might be due to invalid IL or missing references)
				BoosterImplantID = template.BoosterImplantID;
				ImplantCategory = template.ImplantCategory;
				TemplateIndex = BoosterImplantTemplatesLookup.Value[template.ImplantCategory].Count((bBoosterImplantTemplate p) => p.BoosterImplantID == template.BoosterImplantID);
				int num = 0;
				foreach (List<BoosterImplantEffectTemplate> effectGroup in template.EffectGroups)
				{
					List<bBoosterImplantEffectTemplate> list = new List<bBoosterImplantEffectTemplate>();
					foreach (BoosterImplantEffectTemplate item in effectGroup)
					{
						list.Add(new bBoosterImplantEffectTemplate(item));
					}
					EffectGroups.Add(num++, list);
				}
				num = 0;
				foreach (List<uint> conditionGroup in template.ConditionGroups)
				{
					List<bBoosterImplantConditionTemplate> list2 = new List<bBoosterImplantConditionTemplate>();
					foreach (uint item2 in conditionGroup)
					{
						list2.Add(new bBoosterImplantConditionTemplate(GameDataBlockBase<BoosterImplantConditionDataBlock>.GetBlock(item2)));
					}
					ConditionGroups.Add(num++, list2);
				}
			}
		}

		public class bBoosterImplantEffectTemplate
		{
			public uint ID { get; set; }

			public AgentModifier Effect { get; set; }

			public float MaxValue { get; set; }

			public float MinValue { get; set; }

			public bBoosterImplantEffectTemplate(BoosterImplantEffectTemplate effectTemplate)
			{
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				ID = effectTemplate.BoosterImplantEffect;
				Effect = GameDataBlockBase<BoosterImplantEffectDataBlock>.GetBlock(ID).Effect;
				MaxValue = effectTemplate.EffectMaxValue;
				MinValue = effectTemplate.EffectMinValue;
			}
		}

		public class bBoosterImplantConditionTemplate
		{
			public uint ID { get; set; }

			public BoosterCondition Condition { get; set; }

			public bBoosterImplantConditionTemplate(BoosterImplantConditionDataBlock block)
			{
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				ID = ((GameDataBlockBase<BoosterImplantConditionDataBlock>)(object)block).persistentID;
				Condition = block.Condition;
			}
		}

		public class LocalizedTextJsonConverter : JsonConverter
		{
			public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
			{
				writer.WriteValue(string.Empty);
			}

			public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
			{
				return BoosterImplantTemplateDataBlock.UNKNOWN_BLOCK.PublicName;
			}

			public override bool CanConvert(Type objectType)
			{
				return objectType == typeof(LocalizedText);
			}
		}

		public class ListOfTConverter<T> : JsonConverter<List<T>>
		{
			public override List<T> ReadJson(JsonReader reader, Type objectType, List<T> existingValue, bool hasExistingValue, JsonSerializer serializer)
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_000e: Invalid comparison between Unknown and I4
				JToken val = JToken.Load(reader);
				if ((int)val.Type == 2)
				{
					return SharedUtils.ToIL2CPPListIfNecessary<T>(val.ToObject<List<T>>(serializer));
				}
				return null;
			}

			public override void WriteJson(JsonWriter writer, List<T> value, JsonSerializer serializer)
			{
				JToken.FromObject((object)value).WriteTo(writer, Array.Empty<JsonConverter>());
			}

			public ListOfTConverter()
			{
				((JsonConverter<List<List<T>>>)(object)this)..ctor();
			}
		}

		public class ListOfListOfTConverter<T> : JsonConverter<List<List<T>>>
		{
			public override List<List<T>> ReadJson(JsonReader reader, Type objectType, List<List<T>> existingValue, bool hasExistingValue, JsonSerializer serializer)
			{
				//IL_000e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0014: Invalid comparison between Unknown and I4
				//IL_001a: Unknown result type (might be due to invalid IL or missing references)
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0034: Unknown result type (might be due to invalid IL or missing references)
				//IL_003a: Invalid comparison between Unknown and I4
				//IL_0045: 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)
				JToken val = JToken.Load(reader);
				List<List<T>> val2 = (List<List<T>>)(object)new List<List<List<T>>>();
				if ((int)val.Type == 2)
				{
					foreach (JToken item in val.Children())
					{
						if ((int)item.Type != 2)
						{
							continue;
						}
						List<T> val3 = new List<T>();
						foreach (JToken item2 in item.Children())
						{
							T val4 = item2.ToObject<T>(serializer);
							val3.Add(val4);
						}
						((List<List<List<T>>>)(object)val2).Add((List<List<T>>)(object)val3);
					}
				}
				return val2;
			}

			public override void WriteJson(JsonWriter writer, List<List<T>> value, JsonSerializer serializer)
			{
				JToken.FromObject((object)value).WriteTo(writer, Array.Empty<JsonConverter>());
			}

			public ListOfListOfTConverter()
			{
				((JsonConverter<List<List<List<List<T>>>>>)(object)this)..ctor();
			}
		}

		public class BoosterImplantEffectTemplate
		{
			public uint BoosterImplantEffect { get; set; }

			public float EffectMaxValue { get; set; }

			public float EffectMinValue { get; set; }

			public BoosterImplantEffectTemplate(BoosterImplantEffectInstance effect)
			{
				EffectMaxValue = effect.MaxValue;
				EffectMinValue = effect.MinValue;
				BoosterImplantEffect = effect.BoosterImplantEffect;
			}
		}

		public class BoosterImplantTemplate
		{
			public uint BoosterImplantID { get; set; }

			public BoosterImplantCategory ImplantCategory { get; set; }

			[JsonIgnore]
			public List<BoosterImplantEffectTemplate> Effects { get; set; } = new List<BoosterImplantEffectTemplate>();


			[JsonIgnore]
			public List<List<BoosterImplantEffectTemplate>> RandomEffects { get; set; } = new List<List<BoosterImplantEffectTemplate>>();


			[JsonIgnore]
			public List<uint> Conditions { get; set; } = new List<uint>();


			[JsonIgnore]
			public List<uint> RandomConditions { get; set; } = new List<uint>();


			[JsonIgnore]
			public BoosterImplantTemplateDataBlock TemplateDataBlock { get; private set; }

			public List<List<BoosterImplantEffectTemplate>> EffectGroups { get; set; } = new List<List<BoosterImplantEffectTemplate>>();


			public List<List<uint>> ConditionGroups { get; set; } = new List<List<uint>>();


			public BoosterImplantTemplate(BoosterImplantTemplateDataBlock block)
			{
				//IL_005d: Unknown result type (might be due to invalid IL or missing references)
				TemplateDataBlock = block;
				BoosterImplantID = ((GameDataBlockBase<BoosterImplantTemplateDataBlock>)(object)block).persistentID;
				ImplantCategory = block.ImplantCategory;
				for (int i = 0; i < block.Effects.Count; i++)
				{
					Effects.Add(new BoosterImplantEffectTemplate(block.Effects[i]));
				}
				for (int j = 0; j < block.RandomEffects.Count; j++)
				{
					List<BoosterImplantEffectTemplate> list = new List<BoosterImplantEffectTemplate>();
					for (int k = 0; k < block.RandomEffects[j].Count; k++)
					{
						list.Add(new BoosterImplantEffectTemplate(block.RandomEffects[j][k]));
					}
					RandomEffects.Add(list);
				}
				Conditions.AddRange((IEnumerable<uint>)block.Conditions.ToArray());
				RandomConditions.AddRange((IEnumerable<uint>)block.RandomConditions.ToArray());
				EffectGroups = GenerateEffectGroups();
				ConditionGroups = GenerateConditionGroups();
			}

			private List<List<BoosterImplantEffectTemplate>> GenerateEffectGroups()
			{
				List<List<BoosterImplantEffectTemplate>> list = new List<List<BoosterImplantEffectTemplate>>();
				List<List<BoosterImplantEffectTemplate>> nElementCombinations = GetNElementCombinations(RandomEffects);
				for (int i = 0; i < nElementCombinations.Count; i++)
				{
					List<BoosterImplantEffectTemplate> list2 = Effects.ToList();
					list2.AddRange(nElementCombinations[i]);
					list.Add(list2);
				}
				return list;
			}

			private List<List<uint>> GenerateConditionGroups()
			{
				return GetNElementCombinations(new List<List<uint>> { Conditions, RandomConditions });
			}

			private static List<List<T>> GetNElementCombinations<T>(List<List<T>> lists)
			{
				List<List<T>> list = new List<List<T>>();
				GetNElementCombinationsHelper(lists, new List<T>(), 0, list);
				return list;
			}

			private static void GetNElementCombinationsHelper<T>(List<List<T>> lists, List<T> currentCombination, int currentIndex, List<List<T>> combinations)
			{
				if (currentIndex == lists.Count)
				{
					combinations.Add(new List<T>(currentCombination));
					return;
				}
				List<T> list = lists[currentIndex];
				if (list.Count == 0)
				{
					GetNElementCombinationsHelper(lists, currentCombination, currentIndex + 1, combinations);
					return;
				}
				foreach (T item in list)
				{
					currentCombination.Add(item);
					GetNElementCombinationsHelper(lists, currentCombination, currentIndex + 1, combinations);
					currentCombination.RemoveAt(currentCombination.Count - 1);
				}
			}
		}

		private const string R5BoosterTemplatesJson = "[{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":1,\"y\":1},\"DropWeight\":2,\"Conditions\":[],\"RandomConditions\":[],\"Effects\":[{\"BoosterImplantEffect\":8,\"MinValue\":1.1,\"MaxValue\":1.13}],\"RandomEffects\":[[{\"BoosterImplantEffect\":7,\"MinValue\":1.1,\"MaxValue\":1.15},{\"BoosterImplantEffect\":50,\"MinValue\":1.1,\"MaxValue\":1.15}]],\"ImplantCategory\":0,\"MainEffectType\":2,\"name\":\"Muted_HealthSupport_Revive\",\"internalEnabled\":true,\"persistentID\":1},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":1,\"y\":1},\"DropWeight\":1,\"Conditions\":[],\"RandomConditions\":[],\"Effects\":[{\"BoosterImplantEffect\":12,\"MinValue\":1.15,\"MaxValue\":1.25}],\"RandomEffects\":[],\"ImplantCategory\":0,\"MainEffectType\":2,\"name\":\"Muted_HealthSupport_InfectionRes\",\"internalEnabled\":true,\"persistentID\":22},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":1,\"y\":1},\"DropWeight\":3,\"Conditions\":[],\"RandomConditions\":[5,26],\"Effects\":[{\"BoosterImplantEffect\":6,\"MinValue\":1.15,\"MaxValue\":1.25}],\"RandomEffects\":[],\"ImplantCategory\":0,\"MainEffectType\":2,\"name\":\"Muted_Health_RegenSpeed\",\"internalEnabled\":true,\"persistentID\":18},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":1,\"y\":1},\"DropWeight\":4,\"Conditions\":[],\"RandomConditions\":[5,29],\"Effects\":[],\"RandomEffects\":[[{\"BoosterImplantEffect\":10,\"MinValue\":1.05,\"MaxValue\":1.1},{\"BoosterImplantEffect\":11,\"MinValue\":1.05,\"MaxValue\":1.1}]],\"ImplantCategory\":0,\"MainEffectType\":2,\"name\":\"Muted_Health_Single_Resistance\",\"internalEnabled\":true,\"persistentID\":23},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":1,\"y\":1},\"DropWeight\":4,\"Conditions\":[],\"RandomConditions\":[1,7],\"Effects\":[{\"BoosterImplantEffect\":10,\"MinValue\":1.05,\"MaxValue\":1.1},{\"BoosterImplantEffect\":11,\"MinValue\":1.05,\"MaxValue\":1.1}],\"RandomEffects\":[],\"ImplantCategory\":0,\"MainEffectType\":2,\"name\":\"Muted_Health_Double_Resistance\",\"internalEnabled\":true,\"persistentID\":24},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":1,\"y\":1},\"DropWeight\":2,\"Conditions\":[],\"RandomConditions\":[1,29],\"Effects\":[],\"RandomEffects\":[[{\"BoosterImplantEffect\":54,\"MinValue\":1.05,\"MaxValue\":1.1}]],\"ImplantCategory\":0,\"MainEffectType\":1,\"name\":\"Muted_MeleeDamage\",\"internalEnabled\":true,\"persistentID\":4},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":1,\"y\":1},\"DropWeight\":7,\"Conditions\":[],\"RandomConditions\":[1,7,5],\"Effects\":[],\"RandomEffects\":[[{\"BoosterImplantEffect\":52,\"MinValue\":1.05,\"MaxValue\":1.1},{\"BoosterImplantEffect\":53,\"MinValue\":1.05,\"MaxValue\":1.1}]],\"ImplantCategory\":0,\"MainEffectType\":1,\"name\":\"Muted_WeaponDamage\",\"internalEnabled\":true,\"persistentID\":25},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":1,\"y\":1},\"DropWeight\":4,\"Conditions\":[],\"RandomConditions\":[],\"Effects\":[],\"RandomEffects\":[[{\"BoosterImplantEffect\":27,\"MinValue\":1.15,\"MaxValue\":1.25},{\"BoosterImplantEffect\":28,\"MinValue\":1.1,\"MaxValue\":1.15},{\"BoosterImplantEffect\":29,\"MinValue\":1.05,\"MaxValue\":1.1},{\"BoosterImplantEffect\":31,\"MinValue\":1.1,\"MaxValue\":1.15},{\"BoosterImplantEffect\":32,\"MinValue\":1.2,\"MaxValue\":1.3}]],\"ImplantCategory\":0,\"MainEffectType\":4,\"name\":\"Muted_ToolStrength\",\"internalEnabled\":true,\"persistentID\":7},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":1,\"y\":1},\"DropWeight\":2,\"Conditions\":[],\"RandomConditions\":[],\"Effects\":[],\"RandomEffects\":[[{\"BoosterImplantEffect\":40,\"MinValue\":1.2,\"MaxValue\":1.3},{\"BoosterImplantEffect\":39,\"MinValue\":1.2,\"MaxValue\":1.3},{\"BoosterImplantEffect\":33,\"MinValue\":1.05,\"MaxValue\":1.1}]],\"ImplantCategory\":0,\"MainEffectType\":4,\"name\":\"Muted_ToolWeakEffects\",\"internalEnabled\":true,\"persistentID\":20},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":1,\"y\":1},\"DropWeight\":1,\"Conditions\":[],\"RandomConditions\":[],\"Effects\":[{\"BoosterImplantEffect\":34,\"MinValue\":1.2,\"MaxValue\":1.4},{\"BoosterImplantEffect\":35,\"MinValue\":1.05,\"MaxValue\":1.1}],\"RandomEffects\":[],\"ImplantCategory\":0,\"MainEffectType\":3,\"name\":\"Muted_ProcessingSpeed\",\"internalEnabled\":true,\"persistentID\":10},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":1,\"y\":1},\"DropWeight\":2,\"Conditions\":[],\"RandomConditions\":[7,27],\"Effects\":[],\"RandomEffects\":[[{\"BoosterImplantEffect\":41,\"MinValue\":1.13,\"MaxValue\":1.18}]],\"ImplantCategory\":0,\"MainEffectType\":3,\"name\":\"Muted_BioscanSpeed\",\"internalEnabled\":true,\"persistentID\":21},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":1,\"y\":1},\"DropWeight\":4,\"Conditions\":[],\"RandomConditions\":[],\"Effects\":[],\"RandomEffects\":[[{\"BoosterImplantEffect\":36,\"MinValue\":1.1,\"MaxValue\":1.2},{\"BoosterImplantEffect\":37,\"MinValue\":1.1,\"MaxValue\":1.2},{\"BoosterImplantEffect\":38,\"MinValue\":1.1,\"MaxValue\":1.2},{\"BoosterImplantEffect\":5,\"MinValue\":1.15,\"MaxValue\":1.25}]],\"ImplantCategory\":0,\"MainEffectType\":0,\"name\":\"Muted_InitialState\",\"internalEnabled\":true,\"persistentID\":13},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":1,\"y\":2},\"DropWeight\":1,\"Conditions\":[],\"RandomConditions\":[],\"Effects\":[{\"BoosterImplantEffect\":7,\"MinValue\":1.2,\"MaxValue\":1.3},{\"BoosterImplantEffect\":8,\"MinValue\":1.2,\"MaxValue\":1.3},{\"BoosterImplantEffect\":50,\"MinValue\":1.2,\"MaxValue\":1.3}],\"RandomEffects\":[],\"ImplantCategory\":1,\"MainEffectType\":2,\"name\":\"Bold_HealthSupport_Revive\",\"internalEnabled\":true,\"persistentID\":26},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":1,\"y\":2},\"DropWeight\":1,\"Conditions\":[],\"RandomConditions\":[],\"Effects\":[{\"BoosterImplantEffect\":12,\"MinValue\":1.4,\"MaxValue\":1.6}],\"RandomEffects\":[],\"ImplantCategory\":1,\"MainEffectType\":2,\"name\":\"Bold_HealthSupport_InfectionRes\",\"internalEnabled\":true,\"persistentID\":27},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":1,\"y\":2},\"DropWeight\":2,\"Conditions\":[],\"RandomConditions\":[5,26],\"Effects\":[{\"BoosterImplantEffect\":6,\"MinValue\":1.6,\"MaxValue\":2}],\"RandomEffects\":[],\"ImplantCategory\":1,\"MainEffectType\":2,\"name\":\"Bold_Health_RegenSpeed\",\"internalEnabled\":true,\"persistentID\":28},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":1,\"y\":2},\"DropWeight\":4,\"Conditions\":[],\"RandomConditions\":[5,29],\"Effects\":[],\"RandomEffects\":[[{\"BoosterImplantEffect\":10,\"MinValue\":1.15,\"MaxValue\":1.2},{\"BoosterImplantEffect\":11,\"MinValue\":1.15,\"MaxValue\":1.2}]],\"ImplantCategory\":1,\"MainEffectType\":2,\"name\":\"Bold_Health_Single_Resistance\",\"internalEnabled\":true,\"persistentID\":29},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":1,\"y\":2},\"DropWeight\":2,\"Conditions\":[],\"RandomConditions\":[1,7],\"Effects\":[{\"BoosterImplantEffect\":10,\"MinValue\":1.15,\"MaxValue\":1.2},{\"BoosterImplantEffect\":11,\"MinValue\":1.15,\"MaxValue\":1.2}],\"RandomEffects\":[],\"ImplantCategory\":1,\"MainEffectType\":2,\"name\":\"Bold_Health_Double_Resistance\",\"internalEnabled\":true,\"persistentID\":30},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":1,\"y\":2},\"DropWeight\":2,\"Conditions\":[],\"RandomConditions\":[1,29],\"Effects\":[],\"RandomEffects\":[[{\"BoosterImplantEffect\":54,\"MinValue\":1.2,\"MaxValue\":1.3}]],\"ImplantCategory\":1,\"MainEffectType\":1,\"name\":\"Bold_MeleeDamage\",\"internalEnabled\":true,\"persistentID\":31},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":1,\"y\":2},\"DropWeight\":7,\"Conditions\":[],\"RandomConditions\":[1,7,5],\"Effects\":[],\"RandomEffects\":[[{\"BoosterImplantEffect\":52,\"MinValue\":1.15,\"MaxValue\":1.2},{\"BoosterImplantEffect\":53,\"MinValue\":1.15,\"MaxValue\":1.2}]],\"ImplantCategory\":1,\"MainEffectType\":1,\"name\":\"Bold_WeaponDamage\",\"internalEnabled\":true,\"persistentID\":32},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":1,\"y\":2},\"DropWeight\":5,\"Conditions\":[],\"RandomConditions\":[],\"Effects\":[],\"RandomEffects\":[[{\"BoosterImplantEffect\":27,\"MinValue\":1.4,\"MaxValue\":1.6},{\"BoosterImplantEffect\":28,\"MinValue\":1.2,\"MaxValue\":1.25},{\"BoosterImplantEffect\":29,\"MinValue\":1.15,\"MaxValue\":1.2},{\"BoosterImplantEffect\":31,\"MinValue\":1.2,\"MaxValue\":1.3},{\"BoosterImplantEffect\":32,\"MinValue\":1.45,\"MaxValue\":1.55}],[{\"BoosterImplantEffect\":39,\"MinValue\":1.2,\"MaxValue\":1.3},{\"BoosterImplantEffect\":33,\"MinValue\":1.12,\"MaxValue\":1.18},{\"BoosterImplantEffect\":40,\"MinValue\":1.3,\"MaxValue\":1.4}]],\"ImplantCategory\":1,\"MainEffectType\":4,\"name\":\"Bold_ToolStrength\",\"internalEnabled\":true,\"persistentID\":33},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":1,\"y\":2},\"DropWeight\":1,\"Conditions\":[],\"RandomConditions\":[],\"Effects\":[{\"BoosterImplantEffect\":34,\"MinValue\":1.6,\"MaxValue\":1.8},{\"BoosterImplantEffect\":35,\"MinValue\":1.12,\"MaxValue\":1.18}],\"RandomEffects\":[[{\"BoosterImplantEffect\":49,\"MinValue\":0.91,\"MaxValue\":0.95}]],\"ImplantCategory\":1,\"MainEffectType\":3,\"name\":\"Bold_ProcessingSpeed\",\"internalEnabled\":true,\"persistentID\":35},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":1,\"y\":2},\"DropWeight\":2,\"Conditions\":[],\"RandomConditions\":[7,27],\"Effects\":[],\"RandomEffects\":[[{\"BoosterImplantEffect\":41,\"MinValue\":1.13,\"MaxValue\":1.18}]],\"ImplantCategory\":1,\"MainEffectType\":3,\"name\":\"Bold_BioscanSpeed\",\"internalEnabled\":true,\"persistentID\":36},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":1,\"y\":2},\"DropWeight\":7,\"Conditions\":[],\"RandomConditions\":[],\"Effects\":[],\"RandomEffects\":[[{\"BoosterImplantEffect\":36,\"MinValue\":1.25,\"MaxValue\":1.35},{\"BoosterImplantEffect\":37,\"MinValue\":1.25,\"MaxValue\":1.35},{\"BoosterImplantEffect\":38,\"MinValue\":1.25,\"MaxValue\":1.35},{\"BoosterImplantEffect\":5,\"MinValue\":1.4,\"MaxValue\":1.6}],[{\"BoosterImplantEffect\":6,\"MinValue\":0.8,\"MaxValue\":0.87},{\"BoosterImplantEffect\":34,\"MinValue\":0.71,\"MaxValue\":0.83}]],\"ImplantCategory\":1,\"MainEffectType\":0,\"name\":\"Bold_InitialState\",\"internalEnabled\":true,\"persistentID\":37},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":2,\"y\":3},\"DropWeight\":4,\"Conditions\":[],\"RandomConditions\":[],\"Effects\":[{\"BoosterImplantEffect\":7,\"MinValue\":1.4,\"MaxValue\":1.5},{\"BoosterImplantEffect\":8,\"MinValue\":1.8,\"MaxValue\":2},{\"BoosterImplantEffect\":50,\"MinValue\":1.4,\"MaxValue\":1.5}],\"RandomEffects\":[[{\"BoosterImplantEffect\":54,\"MinValue\":0.91,\"MaxValue\":0.95},{\"BoosterImplantEffect\":12,\"MinValue\":0.8,\"MaxValue\":0.87},{\"BoosterImplantEffect\":11,\"MinValue\":0.8,\"MaxValue\":0.87}]],\"ImplantCategory\":2,\"MainEffectType\":2,\"name\":\"Aggressive_HealthSupport_Revive\",\"internalEnabled\":true,\"persistentID\":38},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":2,\"y\":3},\"DropWeight\":1,\"Conditions\":[],\"RandomConditions\":[],\"Effects\":[{\"BoosterImplantEffect\":12,\"MinValue\":1.8,\"MaxValue\":2}],\"RandomEffects\":[[{\"BoosterImplantEffect\":54,\"MinValue\":0.91,\"MaxValue\":0.95}]],\"ImplantCategory\":2,\"MainEffectType\":2,\"name\":\"Aggressive_HealthSupport_InfectionRes\",\"internalEnabled\":true,\"persistentID\":39},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":2,\"y\":3},\"DropWeight\":2,\"Conditions\":[],\"RandomConditions\":[5,26],\"Effects\":[{\"BoosterImplantEffect\":6,\"MinValue\":2.2,\"MaxValue\":2.5}],\"RandomEffects\":[],\"ImplantCategory\":2,\"MainEffectType\":2,\"name\":\"Aggressive_Health_RegenSpeed\",\"internalEnabled\":true,\"persistentID\":40},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":2,\"y\":3},\"DropWeight\":4,\"Conditions\":[],\"RandomConditions\":[5,29],\"Effects\":[],\"RandomEffects\":[[{\"BoosterImplantEffect\":10,\"MinValue\":1.3,\"MaxValue\":1.4},{\"BoosterImplantEffect\":11,\"MinValue\":1.3,\"MaxValue\":1.4}]],\"ImplantCategory\":2,\"MainEffectType\":2,\"name\":\"Aggressive_Health_Single_Resistance\",\"internalEnabled\":true,\"persistentID\":41},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":2,\"y\":3},\"DropWeight\":4,\"Conditions\":[],\"RandomConditions\":[1,7],\"Effects\":[{\"BoosterImplantEffect\":10,\"MinValue\":1.3,\"MaxValue\":1.4},{\"BoosterImplantEffect\":11,\"MinValue\":1.3,\"MaxValue\":1.4}],\"RandomEffects\":[],\"ImplantCategory\":2,\"MainEffectType\":2,\"name\":\"Aggressive_Health_Double_Resistance\",\"internalEnabled\":true,\"persistentID\":42},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":2,\"y\":3},\"DropWeight\":1,\"Conditions\":[],\"RandomConditions\":[1,29],\"Effects\":[{\"BoosterImplantEffect\":49,\"MinValue\":1.5,\"MaxValue\":1.6}],\"RandomEffects\":[[{\"BoosterImplantEffect\":11,\"MinValue\":0.83,\"MaxValue\":0.9}]],\"ImplantCategory\":2,\"MainEffectType\":1,\"name\":\"Aggressive_MeleeDamage\",\"internalEnabled\":true,\"persistentID\":43},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":2,\"y\":3},\"DropWeight\":7,\"Conditions\":[],\"RandomConditions\":[1,7,5],\"Effects\":[],\"RandomEffects\":[[{\"BoosterImplantEffect\":52,\"MinValue\":1.25,\"MaxValue\":1.3},{\"BoosterImplantEffect\":53,\"MinValue\":1.25,\"MaxValue\":1.3}]],\"ImplantCategory\":2,\"MainEffectType\":1,\"name\":\"Aggressive_WeaponDamage\",\"internalEnabled\":true,\"persistentID\":44},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":2,\"y\":3},\"DropWeight\":6,\"Conditions\":[],\"RandomConditions\":[],\"Effects\":[],\"RandomEffects\":[[{\"BoosterImplantEffect\":27,\"MinValue\":1.8,\"MaxValue\":2},{\"BoosterImplantEffect\":28,\"MinValue\":1.3,\"MaxValue\":1.4},{\"BoosterImplantEffect\":29,\"MinValue\":1.25,\"MaxValue\":1.3},{\"BoosterImplantEffect\":31,\"MinValue\":1.35,\"MaxValue\":1.4},{\"BoosterImplantEffect\":32,\"MinValue\":1.7,\"MaxValue\":2}],[{\"BoosterImplantEffect\":40,\"MinValue\":1.35,\"MaxValue\":1.4},{\"BoosterImplantEffect\":39,\"MinValue\":1.35,\"MaxValue\":1.4},{\"BoosterImplantEffect\":33,\"MinValue\":1.2,\"MaxValue\":1.3}],[{\"BoosterImplantEffect\":49,\"MinValue\":0.77,\"MaxValue\":0.83},{\"BoosterImplantEffect\":11,\"MinValue\":0.83,\"MaxValue\":0.87},{\"BoosterImplantEffect\":12,\"MinValue\":0.62,\"MaxValue\":0.71}]],\"ImplantCategory\":2,\"MainEffectType\":4,\"name\":\"Aggressive_ToolStrength\",\"internalEnabled\":true,\"persistentID\":45},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":2,\"y\":3},\"DropWeight\":6,\"Conditions\":[],\"RandomConditions\":[],\"Effects\":[],\"RandomEffects\":[[{\"BoosterImplantEffect\":34,\"MinValue\":2,\"MaxValue\":2.2},{\"BoosterImplantEffect\":35,\"MinValue\":1.2,\"MaxValue\":1.3}],[{\"BoosterImplantEffect\":28,\"MinValue\":1.3,\"MaxValue\":1.4},{\"BoosterImplantEffect\":33,\"MinValue\":1.2,\"MaxValue\":1.3},{\"BoosterImplantEffect\":50,\"MinValue\":1.4,\"MaxValue\":1.5}],[{\"BoosterImplantEffect\":49,\"MinValue\":0.77,\"MaxValue\":0.83},{\"BoosterImplantEffect\":11,\"MinValue\":0.83,\"MaxValue\":0.87}]],\"ImplantCategory\":2,\"MainEffectType\":3,\"name\":\"Aggressive_ProcessingSpeed\",\"internalEnabled\":true,\"persistentID\":47},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":2,\"y\":3},\"DropWeight\":2,\"Conditions\":[],\"RandomConditions\":[7,27],\"Effects\":[],\"RandomEffects\":[[{\"BoosterImplantEffect\":41,\"MinValue\":1.2,\"MaxValue\":1.25}]],\"ImplantCategory\":2,\"MainEffectType\":3,\"name\":\"Aggressive_BioscanSpeed\",\"internalEnabled\":true,\"persistentID\":48},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":2,\"y\":3},\"DropWeight\":7,\"Conditions\":[],\"RandomConditions\":[],\"Effects\":[],\"RandomEffects\":[[{\"BoosterImplantEffect\":36,\"MinValue\":1.4,\"MaxValue\":1.53},{\"BoosterImplantEffect\":37,\"MinValue\":1.4,\"MaxValue\":1.53},{\"BoosterImplantEffect\":38,\"MinValue\":1.4,\"MaxValue\":1.53},{\"BoosterImplantEffect\":5,\"MinValue\":1.8,\"MaxValue\":2}],[{\"BoosterImplantEffect\":11,\"MinValue\":0.83,\"MaxValue\":0.87},{\"BoosterImplantEffect\":12,\"MinValue\":0.62,\"MaxValue\":0.71},{\"BoosterImplantEffect\":34,\"MinValue\":0.56,\"MaxValue\":0.62}]],\"ImplantCategory\":2,\"MainEffectType\":0,\"name\":\"Aggressive_InitialState\",\"internalEnabled\":true,\"persistentID\":49}]";

		private static List<BoosterImplantTemplateDataBlock> OldBoosterImplantTemplateDataBlocks = new List<BoosterImplantTemplateDataBlock>();

		public static float BoosterPositiveEffectMultiplier { get; set; } = 1f;


		public static bool DisableBoosterConditions { get; set; } = false;


		public static bool DisableBoosterNegativeEffects { get; set; } = false;


		public static bool EnableCustomPerfectBooster { get; set; } = false;


		public static bool EnableCustomBooster { get; set; } = false;


		public static CustomSetting<Dictionary<BoosterImplantCategory, List<bBoosterImplantTemplate>>> BoosterImplantTemplatesLookup { get; set; } = new CustomSetting<Dictionary<BoosterImplantCategory, List<bBoosterImplantTemplate>>>("BoosterImplantTemplatesLookup", new Dictionary<BoosterImplantCategory, List<bBoosterImplantTemplate>>
		{
			{
				(BoosterImplantCategory)0,
				new List<bBoosterImplantTemplate>()
			},
			{
				(BoosterImplantCategory)1,
				new List<bBoosterImplantTemplate>()
			},
			{
				(BoosterImplantCategory)2,
				new List<bBoosterImplantTemplate>()
			}
		}, (Action<Dictionary<BoosterImplantCategory, List<bBoosterImplantTemplate>>>)null, (LoadingTime)0, false);


		public static List<BoosterImplantTemplate> BoosterImplantTemplates { get; } = new List<BoosterImplantTemplate>();


		public static void LoadTemplateData()
		{
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			OldBoosterImplantTemplateDataBlocks.Clear();
			OldBoosterImplantTemplateDataBlocks.AddRange(JsonConvert.DeserializeObject<List<BoosterImplantTemplateDataBlock>>("[{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":1,\"y\":1},\"DropWeight\":2,\"Conditions\":[],\"RandomConditions\":[],\"Effects\":[{\"BoosterImplantEffect\":8,\"MinValue\":1.1,\"MaxValue\":1.13}],\"RandomEffects\":[[{\"BoosterImplantEffect\":7,\"MinValue\":1.1,\"MaxValue\":1.15},{\"BoosterImplantEffect\":50,\"MinValue\":1.1,\"MaxValue\":1.15}]],\"ImplantCategory\":0,\"MainEffectType\":2,\"name\":\"Muted_HealthSupport_Revive\",\"internalEnabled\":true,\"persistentID\":1},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":1,\"y\":1},\"DropWeight\":1,\"Conditions\":[],\"RandomConditions\":[],\"Effects\":[{\"BoosterImplantEffect\":12,\"MinValue\":1.15,\"MaxValue\":1.25}],\"RandomEffects\":[],\"ImplantCategory\":0,\"MainEffectType\":2,\"name\":\"Muted_HealthSupport_InfectionRes\",\"internalEnabled\":true,\"persistentID\":22},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":1,\"y\":1},\"DropWeight\":3,\"Conditions\":[],\"RandomConditions\":[5,26],\"Effects\":[{\"BoosterImplantEffect\":6,\"MinValue\":1.15,\"MaxValue\":1.25}],\"RandomEffects\":[],\"ImplantCategory\":0,\"MainEffectType\":2,\"name\":\"Muted_Health_RegenSpeed\",\"internalEnabled\":true,\"persistentID\":18},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":1,\"y\":1},\"DropWeight\":4,\"Conditions\":[],\"RandomConditions\":[5,29],\"Effects\":[],\"RandomEffects\":[[{\"BoosterImplantEffect\":10,\"MinValue\":1.05,\"MaxValue\":1.1},{\"BoosterImplantEffect\":11,\"MinValue\":1.05,\"MaxValue\":1.1}]],\"ImplantCategory\":0,\"MainEffectType\":2,\"name\":\"Muted_Health_Single_Resistance\",\"internalEnabled\":true,\"persistentID\":23},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":1,\"y\":1},\"DropWeight\":4,\"Conditions\":[],\"RandomConditions\":[1,7],\"Effects\":[{\"BoosterImplantEffect\":10,\"MinValue\":1.05,\"MaxValue\":1.1},{\"BoosterImplantEffect\":11,\"MinValue\":1.05,\"MaxValue\":1.1}],\"RandomEffects\":[],\"ImplantCategory\":0,\"MainEffectType\":2,\"name\":\"Muted_Health_Double_Resistance\",\"internalEnabled\":true,\"persistentID\":24},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":1,\"y\":1},\"DropWeight\":2,\"Conditions\":[],\"RandomConditions\":[1,29],\"Effects\":[],\"RandomEffects\":[[{\"BoosterImplantEffect\":54,\"MinValue\":1.05,\"MaxValue\":1.1}]],\"ImplantCategory\":0,\"MainEffectType\":1,\"name\":\"Muted_MeleeDamage\",\"internalEnabled\":true,\"persistentID\":4},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":1,\"y\":1},\"DropWeight\":7,\"Conditions\":[],\"RandomConditions\":[1,7,5],\"Effects\":[],\"RandomEffects\":[[{\"BoosterImplantEffect\":52,\"MinValue\":1.05,\"MaxValue\":1.1},{\"BoosterImplantEffect\":53,\"MinValue\":1.05,\"MaxValue\":1.1}]],\"ImplantCategory\":0,\"MainEffectType\":1,\"name\":\"Muted_WeaponDamage\",\"internalEnabled\":true,\"persistentID\":25},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":1,\"y\":1},\"DropWeight\":4,\"Conditions\":[],\"RandomConditions\":[],\"Effects\":[],\"RandomEffects\":[[{\"BoosterImplantEffect\":27,\"MinValue\":1.15,\"MaxValue\":1.25},{\"BoosterImplantEffect\":28,\"MinValue\":1.1,\"MaxValue\":1.15},{\"BoosterImplantEffect\":29,\"MinValue\":1.05,\"MaxValue\":1.1},{\"BoosterImplantEffect\":31,\"MinValue\":1.1,\"MaxValue\":1.15},{\"BoosterImplantEffect\":32,\"MinValue\":1.2,\"MaxValue\":1.3}]],\"ImplantCategory\":0,\"MainEffectType\":4,\"name\":\"Muted_ToolStrength\",\"internalEnabled\":true,\"persistentID\":7},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":1,\"y\":1},\"DropWeight\":2,\"Conditions\":[],\"RandomConditions\":[],\"Effects\":[],\"RandomEffects\":[[{\"BoosterImplantEffect\":40,\"MinValue\":1.2,\"MaxValue\":1.3},{\"BoosterImplantEffect\":39,\"MinValue\":1.2,\"MaxValue\":1.3},{\"BoosterImplantEffect\":33,\"MinValue\":1.05,\"MaxValue\":1.1}]],\"ImplantCategory\":0,\"MainEffectType\":4,\"name\":\"Muted_ToolWeakEffects\",\"internalEnabled\":true,\"persistentID\":20},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":1,\"y\":1},\"DropWeight\":1,\"Conditions\":[],\"RandomConditions\":[],\"Effects\":[{\"BoosterImplantEffect\":34,\"MinValue\":1.2,\"MaxValue\":1.4},{\"BoosterImplantEffect\":35,\"MinValue\":1.05,\"MaxValue\":1.1}],\"RandomEffects\":[],\"ImplantCategory\":0,\"MainEffectType\":3,\"name\":\"Muted_ProcessingSpeed\",\"internalEnabled\":true,\"persistentID\":10},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":1,\"y\":1},\"DropWeight\":2,\"Conditions\":[],\"RandomConditions\":[7,27],\"Effects\":[],\"RandomEffects\":[[{\"BoosterImplantEffect\":41,\"MinValue\":1.13,\"MaxValue\":1.18}]],\"ImplantCategory\":0,\"MainEffectType\":3,\"name\":\"Muted_BioscanSpeed\",\"internalEnabled\":true,\"persistentID\":21},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":1,\"y\":1},\"DropWeight\":4,\"Conditions\":[],\"RandomConditions\":[],\"Effects\":[],\"RandomEffects\":[[{\"BoosterImplantEffect\":36,\"MinValue\":1.1,\"MaxValue\":1.2},{\"BoosterImplantEffect\":37,\"MinValue\":1.1,\"MaxValue\":1.2},{\"BoosterImplantEffect\":38,\"MinValue\":1.1,\"MaxValue\":1.2},{\"BoosterImplantEffect\":5,\"MinValue\":1.15,\"MaxValue\":1.25}]],\"ImplantCategory\":0,\"MainEffectType\":0,\"name\":\"Muted_InitialState\",\"internalEnabled\":true,\"persistentID\":13},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":1,\"y\":2},\"DropWeight\":1,\"Conditions\":[],\"RandomConditions\":[],\"Effects\":[{\"BoosterImplantEffect\":7,\"MinValue\":1.2,\"MaxValue\":1.3},{\"BoosterImplantEffect\":8,\"MinValue\":1.2,\"MaxValue\":1.3},{\"BoosterImplantEffect\":50,\"MinValue\":1.2,\"MaxValue\":1.3}],\"RandomEffects\":[],\"ImplantCategory\":1,\"MainEffectType\":2,\"name\":\"Bold_HealthSupport_Revive\",\"internalEnabled\":true,\"persistentID\":26},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":1,\"y\":2},\"DropWeight\":1,\"Conditions\":[],\"RandomConditions\":[],\"Effects\":[{\"BoosterImplantEffect\":12,\"MinValue\":1.4,\"MaxValue\":1.6}],\"RandomEffects\":[],\"ImplantCategory\":1,\"MainEffectType\":2,\"name\":\"Bold_HealthSupport_InfectionRes\",\"internalEnabled\":true,\"persistentID\":27},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":1,\"y\":2},\"DropWeight\":2,\"Conditions\":[],\"RandomConditions\":[5,26],\"Effects\":[{\"BoosterImplantEffect\":6,\"MinValue\":1.6,\"MaxValue\":2}],\"RandomEffects\":[],\"ImplantCategory\":1,\"MainEffectType\":2,\"name\":\"Bold_Health_RegenSpeed\",\"internalEnabled\":true,\"persistentID\":28},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":1,\"y\":2},\"DropWeight\":4,\"Conditions\":[],\"RandomConditions\":[5,29],\"Effects\":[],\"RandomEffects\":[[{\"BoosterImplantEffect\":10,\"MinValue\":1.15,\"MaxValue\":1.2},{\"BoosterImplantEffect\":11,\"MinValue\":1.15,\"MaxValue\":1.2}]],\"ImplantCategory\":1,\"MainEffectType\":2,\"name\":\"Bold_Health_Single_Resistance\",\"internalEnabled\":true,\"persistentID\":29},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":1,\"y\":2},\"DropWeight\":2,\"Conditions\":[],\"RandomConditions\":[1,7],\"Effects\":[{\"BoosterImplantEffect\":10,\"MinValue\":1.15,\"MaxValue\":1.2},{\"BoosterImplantEffect\":11,\"MinValue\":1.15,\"MaxValue\":1.2}],\"RandomEffects\":[],\"ImplantCategory\":1,\"MainEffectType\":2,\"name\":\"Bold_Health_Double_Resistance\",\"internalEnabled\":true,\"persistentID\":30},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":1,\"y\":2},\"DropWeight\":2,\"Conditions\":[],\"RandomConditions\":[1,29],\"Effects\":[],\"RandomEffects\":[[{\"BoosterImplantEffect\":54,\"MinValue\":1.2,\"MaxValue\":1.3}]],\"ImplantCategory\":1,\"MainEffectType\":1,\"name\":\"Bold_MeleeDamage\",\"internalEnabled\":true,\"persistentID\":31},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":1,\"y\":2},\"DropWeight\":7,\"Conditions\":[],\"RandomConditions\":[1,7,5],\"Effects\":[],\"RandomEffects\":[[{\"BoosterImplantEffect\":52,\"MinValue\":1.15,\"MaxValue\":1.2},{\"BoosterImplantEffect\":53,\"MinValue\":1.15,\"MaxValue\":1.2}]],\"ImplantCategory\":1,\"MainEffectType\":1,\"name\":\"Bold_WeaponDamage\",\"internalEnabled\":true,\"persistentID\":32},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":1,\"y\":2},\"DropWeight\":5,\"Conditions\":[],\"RandomConditions\":[],\"Effects\":[],\"RandomEffects\":[[{\"BoosterImplantEffect\":27,\"MinValue\":1.4,\"MaxValue\":1.6},{\"BoosterImplantEffect\":28,\"MinValue\":1.2,\"MaxValue\":1.25},{\"BoosterImplantEffect\":29,\"MinValue\":1.15,\"MaxValue\":1.2},{\"BoosterImplantEffect\":31,\"MinValue\":1.2,\"MaxValue\":1.3},{\"BoosterImplantEffect\":32,\"MinValue\":1.45,\"MaxValue\":1.55}],[{\"BoosterImplantEffect\":39,\"MinValue\":1.2,\"MaxValue\":1.3},{\"BoosterImplantEffect\":33,\"MinValue\":1.12,\"MaxValue\":1.18},{\"BoosterImplantEffect\":40,\"MinValue\":1.3,\"MaxValue\":1.4}]],\"ImplantCategory\":1,\"MainEffectType\":4,\"name\":\"Bold_ToolStrength\",\"internalEnabled\":true,\"persistentID\":33},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":1,\"y\":2},\"DropWeight\":1,\"Conditions\":[],\"RandomConditions\":[],\"Effects\":[{\"BoosterImplantEffect\":34,\"MinValue\":1.6,\"MaxValue\":1.8},{\"BoosterImplantEffect\":35,\"MinValue\":1.12,\"MaxValue\":1.18}],\"RandomEffects\":[[{\"BoosterImplantEffect\":49,\"MinValue\":0.91,\"MaxValue\":0.95}]],\"ImplantCategory\":1,\"MainEffectType\":3,\"name\":\"Bold_ProcessingSpeed\",\"internalEnabled\":true,\"persistentID\":35},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":1,\"y\":2},\"DropWeight\":2,\"Conditions\":[],\"RandomConditions\":[7,27],\"Effects\":[],\"RandomEffects\":[[{\"BoosterImplantEffect\":41,\"MinValue\":1.13,\"MaxValue\":1.18}]],\"ImplantCategory\":1,\"MainEffectType\":3,\"name\":\"Bold_BioscanSpeed\",\"internalEnabled\":true,\"persistentID\":36},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":1,\"y\":2},\"DropWeight\":7,\"Conditions\":[],\"RandomConditions\":[],\"Effects\":[],\"RandomEffects\":[[{\"BoosterImplantEffect\":36,\"MinValue\":1.25,\"MaxValue\":1.35},{\"BoosterImplantEffect\":37,\"MinValue\":1.25,\"MaxValue\":1.35},{\"BoosterImplantEffect\":38,\"MinValue\":1.25,\"MaxValue\":1.35},{\"BoosterImplantEffect\":5,\"MinValue\":1.4,\"MaxValue\":1.6}],[{\"BoosterImplantEffect\":6,\"MinValue\":0.8,\"MaxValue\":0.87},{\"BoosterImplantEffect\":34,\"MinValue\":0.71,\"MaxValue\":0.83}]],\"ImplantCategory\":1,\"MainEffectType\":0,\"name\":\"Bold_InitialState\",\"internalEnabled\":true,\"persistentID\":37},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":2,\"y\":3},\"DropWeight\":4,\"Conditions\":[],\"RandomConditions\":[],\"Effects\":[{\"BoosterImplantEffect\":7,\"MinValue\":1.4,\"MaxValue\":1.5},{\"BoosterImplantEffect\":8,\"MinValue\":1.8,\"MaxValue\":2},{\"BoosterImplantEffect\":50,\"MinValue\":1.4,\"MaxValue\":1.5}],\"RandomEffects\":[[{\"BoosterImplantEffect\":54,\"MinValue\":0.91,\"MaxValue\":0.95},{\"BoosterImplantEffect\":12,\"MinValue\":0.8,\"MaxValue\":0.87},{\"BoosterImplantEffect\":11,\"MinValue\":0.8,\"MaxValue\":0.87}]],\"ImplantCategory\":2,\"MainEffectType\":2,\"name\":\"Aggressive_HealthSupport_Revive\",\"internalEnabled\":true,\"persistentID\":38},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":2,\"y\":3},\"DropWeight\":1,\"Conditions\":[],\"RandomConditions\":[],\"Effects\":[{\"BoosterImplantEffect\":12,\"MinValue\":1.8,\"MaxValue\":2}],\"RandomEffects\":[[{\"BoosterImplantEffect\":54,\"MinValue\":0.91,\"MaxValue\":0.95}]],\"ImplantCategory\":2,\"MainEffectType\":2,\"name\":\"Aggressive_HealthSupport_InfectionRes\",\"internalEnabled\":true,\"persistentID\":39},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":2,\"y\":3},\"DropWeight\":2,\"Conditions\":[],\"RandomConditions\":[5,26],\"Effects\":[{\"BoosterImplantEffect\":6,\"MinValue\":2.2,\"MaxValue\":2.5}],\"RandomEffects\":[],\"ImplantCategory\":2,\"MainEffectType\":2,\"name\":\"Aggressive_Health_RegenSpeed\",\"internalEnabled\":true,\"persistentID\":40},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":2,\"y\":3},\"DropWeight\":4,\"Conditions\":[],\"RandomConditions\":[5,29],\"Effects\":[],\"RandomEffects\":[[{\"BoosterImplantEffect\":10,\"MinValue\":1.3,\"MaxValue\":1.4},{\"BoosterImplantEffect\":11,\"MinValue\":1.3,\"MaxValue\":1.4}]],\"ImplantCategory\":2,\"MainEffectType\":2,\"name\":\"Aggressive_Health_Single_Resistance\",\"internalEnabled\":true,\"persistentID\":41},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":2,\"y\":3},\"DropWeight\":4,\"Conditions\":[],\"RandomConditions\":[1,7],\"Effects\":[{\"BoosterImplantEffect\":10,\"MinValue\":1.3,\"MaxValue\":1.4},{\"BoosterImplantEffect\":11,\"MinValue\":1.3,\"MaxValue\":1.4}],\"RandomEffects\":[],\"ImplantCategory\":2,\"MainEffectType\":2,\"name\":\"Aggressive_Health_Double_Resistance\",\"internalEnabled\":true,\"persistentID\":42},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":2,\"y\":3},\"DropWeight\":1,\"Conditions\":[],\"RandomConditions\":[1,29],\"Effects\":[{\"BoosterImplantEffect\":49,\"MinValue\":1.5,\"MaxValue\":1.6}],\"RandomEffects\":[[{\"BoosterImplantEffect\":11,\"MinValue\":0.83,\"MaxValue\":0.9}]],\"ImplantCategory\":2,\"MainEffectType\":1,\"name\":\"Aggressive_MeleeDamage\",\"internalEnabled\":true,\"persistentID\":43},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":2,\"y\":3},\"DropWeight\":7,\"Conditions\":[],\"RandomConditions\":[1,7,5],\"Effects\":[],\"RandomEffects\":[[{\"BoosterImplantEffect\":52,\"MinValue\":1.25,\"MaxValue\":1.3},{\"BoosterImplantEffect\":53,\"MinValue\":1.25,\"MaxValue\":1.3}]],\"ImplantCategory\":2,\"MainEffectType\":1,\"name\":\"Aggressive_WeaponDamage\",\"internalEnabled\":true,\"persistentID\":44},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":2,\"y\":3},\"DropWeight\":6,\"Conditions\":[],\"RandomConditions\":[],\"Effects\":[],\"RandomEffects\":[[{\"BoosterImplantEffect\":27,\"MinValue\":1.8,\"MaxValue\":2},{\"BoosterImplantEffect\":28,\"MinValue\":1.3,\"MaxValue\":1.4},{\"BoosterImplantEffect\":29,\"MinValue\":1.25,\"MaxValue\":1.3},{\"BoosterImplantEffect\":31,\"MinValue\":1.35,\"MaxValue\":1.4},{\"BoosterImplantEffect\":32,\"MinValue\":1.7,\"MaxValue\":2}],[{\"BoosterImplantEffect\":40,\"MinValue\":1.35,\"MaxValue\":1.4},{\"BoosterImplantEffect\":39,\"MinValue\":1.35,\"MaxValue\":1.4},{\"BoosterImplantEffect\":33,\"MinValue\":1.2,\"MaxValue\":1.3}],[{\"BoosterImplantEffect\":49,\"MinValue\":0.77,\"MaxValue\":0.83},{\"BoosterImplantEffect\":11,\"MinValue\":0.83,\"MaxValue\":0.87},{\"BoosterImplantEffect\":12,\"MinValue\":0.62,\"MaxValue\":0.71}]],\"ImplantCategory\":2,\"MainEffectType\":4,\"name\":\"Aggressive_ToolStrength\",\"internalEnabled\":true,\"persistentID\":45},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":2,\"y\":3},\"DropWeight\":6,\"Conditions\":[],\"RandomConditions\":[],\"Effects\":[],\"RandomEffects\":[[{\"BoosterImplantEffect\":34,\"MinValue\":2,\"MaxValue\":2.2},{\"BoosterImplantEffect\":35,\"MinValue\":1.2,\"MaxValue\":1.3}],[{\"BoosterImplantEffect\":28,\"MinValue\":1.3,\"MaxValue\":1.4},{\"BoosterImplantEffect\":33,\"MinValue\":1.2,\"MaxValue\":1.3},{\"BoosterImplantEffect\":50,\"MinValue\":1.4,\"MaxValue\":1.5}],[{\"BoosterImplantEffect\":49,\"MinValue\":0.77,\"MaxValue\":0.83},{\"BoosterImplantEffect\":11,\"MinValue\":0.83,\"MaxValue\":0.87}]],\"ImplantCategory\":2,\"MainEffectType\":3,\"name\":\"Aggressive_ProcessingSpeed\",\"internalEnabled\":true,\"persistentID\":47},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":2,\"y\":3},\"DropWeight\":2,\"Conditions\":[],\"RandomConditions\":[7,27],\"Effects\":[],\"RandomEffects\":[[{\"BoosterImplantEffect\":41,\"MinValue\":1.2,\"MaxValue\":1.25}]],\"ImplantCategory\":2,\"MainEffectType\":3,\"name\":\"Aggressive_BioscanSpeed\",\"internalEnabled\":true,\"persistentID\":48},{\"Deprecated\":false,\"PublicName\":0,\"Description\":\"\",\"DurationRange\":{\"x\":2,\"y\":3},\"DropWeight\":7,\"Conditions\":[],\"RandomConditions\":[],\"Effects\":[],\"RandomEffects\":[[{\"BoosterImplantEffect\":36,\"MinValue\":1.4,\"MaxValue\":1.53},{\"BoosterImplantEffect\":37,\"MinValue\":1.4,\"MaxValue\":1.53},{\"BoosterImplantEffect\":38,\"MinValue\":1.4,\"MaxValue\":1.53},{\"BoosterImplantEffect\":5,\"MinValue\":1.8,\"MaxValue\":2}],[{\"BoosterImplantEffect\":11,\"MinValue\":0.83,\"MaxValue\":0.87},{\"BoosterImplantEffect\":12,\"MinValue\":0.62,\"MaxValue\":0.71},{\"BoosterImplantEffect\":34,\"MinValue\":0.56,\"MaxValue\":0.62}]],\"ImplantCategory\":2,\"MainEffectType\":0,\"name\":\"Aggressive_InitialState\",\"internalEnabled\":true,\"persistentID\":49}]", (JsonConverter[])(object)new JsonConverter[4]
			{
				new LocalizedTextJsonConverter(),
				(JsonConverter)new ListOfTConverter<uint>(),
				(JsonConverter)new ListOfTConverter<BoosterImplantEffectInstance>(),
				(JsonConverter)new ListOfListOfTConverter<BoosterImplantEffectInstance>()
			}));
			BoosterImplantTemplates.Clear();
			Il2CppArrayBase<BoosterImplantTemplateDataBlock> allBlocksForEditor = GameDataBlockBase<BoosterImplantTemplateDataBlock>.GetAllBlocksForEditor();
			for (int i = 0; i < allBlocksForEditor.Count; i++)
			{
				BoosterImplantTemplates.Add(new BoosterImplantTemplate(allBlocksForEditor[i]));
			}
			for (int j = 0; j < OldBoosterImplantTemplateDataBlocks.Count; j++)
			{
				BoosterImplantTemplates.Add(new BoosterImplantTemplate(OldBoosterImplantTemplateDataBlocks[j]));
			}
			BoosterImplantTemplatesLookup.Value = new Dictionary<BoosterImplantCategory, List<bBoosterImplantTemplate>>
			{
				{
					(BoosterImplantCategory)0,
					new List<bBoosterImplantTemplate>()
				},
				{
					(BoosterImplantCategory)1,
					new List<bBoosterImplantTemplate>()
				},
				{
					(BoosterImplantCategory)2,
					new List<bBoosterImplantTemplate>()
				}
			};
			for (int k = 0; k < BoosterImplantTemplates.Count; k++)
			{
				BoosterImplantTemplatesLookup.Value[BoosterImplantTemplates[k].ImplantCategory].Add(new bBoosterImplantTemplate(BoosterImplantTemplates[k]));
			}
			BoosterImplantTemplatesLookup.Save();
		}

		public static void ApplyPerfectBoosterFromTemplate(BoosterImplant boosterImplant, List<BoosterImplantEffectTemplate> effectGroup, List<uint> conditions)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			List<Effect> list = new List<Effect>();
			foreach (BoosterImplantEffectTemplate item in effectGroup)
			{
				list.Add(new Effect
				{
					Id = item.BoosterImplantEffect,
					Value = ((item.EffectMaxValue <= 1f && DisableBoosterNegativeEffects) ? 1f : ((item.EffectMaxValue - 1f) * BoosterPositiveEffectMultiplier + 1f))
				});
			}
			boosterImplant.Effects = Il2CppStructArray<Effect>.op_Implicit(list.ToArray());
			boosterImplant.Conditions = Il2CppStructArray<uint>.op_Implicit(DisableBoosterConditions ? Array.Empty<uint>() : conditions.ToArray());
		}

		public static bool TryGetBoosterImplantTemplate(BoosterImplant boosterImplant, out BoosterImplantTemplate template, out List<BoosterImplantEffectTemplate> effectGroup, out List<uint> conditionGroup, out int effectGroupIndex, out int conditionGroupIndex)
		{
			template = null;
			effectGroup = new List<BoosterImplantEffectTemplate>();
			conditionGroup = new List<uint>();
			effectGroupIndex = -1;
			conditionGroupIndex = -1;
			uint persistenID = boosterImplant.TemplateId;
			List<BoosterImplantTemplate> list = BoosterImplantTemplates.FindAll((BoosterImplantTemplate p) => p.BoosterImplantID == persistenID && p.ImplantCategory == boosterImplant.Category);
			for (int k = 0; k < list.Count; k++)
			{
				if (list[k].TemplateDataBlock == null)
				{
					continue;
				}
				List<List<uint>> conditionGroups = list[k].ConditionGroups;
				int count = ((Il2CppArrayBase<uint>)(object)boosterImplant.Conditions).Count;
				bool flag = count == 0;
				Il2CppStructArray<uint> conditions = boosterImplant.Conditions;
				if (count > 0)
				{
					int j;
					for (j = 0; j < conditionGroups.Count; j++)
					{
						if (count != conditionGroups[j].Count)
						{
							continue;
						}
						bool num = ((IEnumerable<uint>)conditions).All((uint p) => conditionGroups[j].Any((uint q) => q == p));
						bool flag2 = conditionGroups[j].All((uint p) => ((IEnumerable<uint>)conditions).Any((uint q) => q == p));
						if (num && flag2)
						{
							flag = true;
							conditionGroup = conditionGroups[j];
							conditionGroupIndex = j;
							break;
						}
					}
				}
				if (!flag)
				{
					continue;
				}
				conditionGroupIndex = 0;
				int count2 = ((Il2CppArrayBase<Effect>)(object)boosterImplant.Effects).Count;
				bool flag3 = false;
				List<List<BoosterImplantEffectTemplate>> effectGroups = list[k].EffectGroups;
				List<Effect> effects = ((IEnumerable<Effect>)boosterImplant.Effects).ToList();
				int i;
				for (i = 0; i < effectGroups.Count; i++)
				{
					if (effectGroups[i].Count != count2)
					{
						continue;
					}
					for (int l = 0; l < effectGroups[i].Count; l++)
					{
						bool num2 = effects.All((Effect p) => effectGroups[i].Any((BoosterImplantEffectTemplate q) => q.BoosterImplantEffect == p.Id));
						bool flag4 = effectGroups[i].All((BoosterImplantEffectTemplate p) => effects.Any((Effect q) => q.Id == p.BoosterImplantEffect));
						if (num2 && flag4)
						{
							flag3 = true;
							effectGroup = effectGroups[i];
							effectGroupIndex = i;
							break;
						}
					}
					if (flag3)
					{
						break;
					}
				}
				if (flag3)
				{
					return true;
				}
			}
			return false;
		}
	}
	public static class CustomBoosterImplantManager
	{
		public class CustomBoosterImplant
		{
			public class Effect
			{
				public uint Id { get; set; }

				public float Value { get; set; } = 1f;


				public Effect(Effect effect)
				{
					//IL_0012: Unknown result type (might be due to invalid IL or missing references)
					//IL_001e: Unknown result type (might be due to invalid IL or missing references)
					Id = effect.Id;
					Value = effect.Value;
				}

				public Effect()
				{
				}
			}

			public string Name { get; set; } = string.Empty;


			public BoosterImplantCategory Category { get; set; } = (BoosterImplantCategory)3;


			public uint TemplateId { get; set; }

			public List<uint> Conditions { get; set; } = new List<uint>();


			public List<Effect> Effects { get; set; } = new List<Effect>();


			public bool Enabled { get; set; }

			public CustomBoosterImplant(BoosterImplant implant)
			{
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				//IL_005a: Unknown result type (might be due to invalid IL or missing references)
				//IL_007e: 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_008a: Unknown result type (might be due to invalid IL or missing references)
				Name = implant.GetCompositPublicName(true);
				TemplateId = implant.TemplateId;
				Conditions = ((IEnumerable<uint>)implant.Conditions).ToList();
				Category = implant.Category;
				Effects.Clear();
				foreach (Effect item in (Il2CppArrayBase<Effect>)(object)implant.Effects)
				{
					Effects.Add(new Effect(item));
				}
				Enabled = true;
			}

			public CustomBoosterImplant()
			{
			}//IL_000d: Unknown result type (might be due to invalid IL or missing references)

		}

		public static CustomSetting<Dictionary<BoosterImplantCategory, List<CustomBoosterImplant>>> CustomBoosterImplants { get; set; } = new CustomSetting<Dictionary<BoosterImplantCategory, List<CustomBoosterImplant>>>("CustomBoosterImplants", new Dictionary<BoosterImplantCategory, List<CustomBoosterImplant>>
		{
			{
				(BoosterImplantCategory)0,
				new List<CustomBoosterImplant>()
			},
			{
				(BoosterImplantCategory)1,
				new List<CustomBoosterImplant>()
			},
			{
				(BoosterImplantCategory)2,
				new List<CustomBoosterImplant>()
			}
		}, (Action<Dictionary<BoosterImplantCategory, List<CustomBoosterImplant>>>)null, (LoadingTime)1, true);


		public static void CreateCustomBoosterImplantsFromInventory()
		{
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			CustomBoosterImplants.Value = new Dictionary<BoosterImplantCategory, List<CustomBoosterImplant>>
			{
				{
					(BoosterImplantCategory)0,
					new List<CustomBoosterImplant>()
				},
				{
					(BoosterImplantCategory)1,
					new List<CustomBoosterImplant>()
				},
				{
					(BoosterImplantCategory)2,
					new List<CustomBoosterImplant>()
				}
			};
			foreach (Category item in (Il2CppArrayBase<Category>)(object)PersistentInventoryManager.Current.m_boosterImplantInventory.Categories)
			{
				Enumerator<BoosterImplantInventoryItem> enumerator2 = item.Inventory.GetEnumerator();
				while (enumerator2.MoveNext())
				{
					BoosterImplantInventoryItem current = enumerator2.Current;
					CustomBoosterImplants.Value[current.Implant.Category].Add(new CustomBoosterImplant(current.Implant));
				}
			}
		}

		public static void ApplyCustomBoosterImplants()
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: 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_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: 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_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Expected O, but got Unknown
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Expected O, but got Unknown
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			uint num = 3223718u;
			for (int i = 0; i < 3; i++)
			{
				List<BoosterImplantInventoryItem> inventory = ((Il2CppArrayBase<Category>)(object)PersistentInventoryManager.Current.m_boosterImplantInventory.Categories)[i].Inventory;
				inventory.Clear();
				BoosterImplantCategory key = (BoosterImplantCategory)i;
				for (int j = 0; j < CustomBoosterImplants.Value[key].Count; j++)
				{
					CustomBoosterImplant customBoosterImplant = CustomBoosterImplants.Value[key][j];
					if (!customBoosterImplant.Enabled || GameDataBlockBase<BoosterImplantTemplateDataBlock>.GetBlock(customBoosterImplant.TemplateId) == null || customBoosterImplant.Effects.Any((CustomBoosterImplant.Effect p) => p.Id == 0) || customBoosterImplant.Conditions.Any((uint p) => p == 0))
					{
						continue;
					}
					List<BoosterImplantEffect> list = new List<BoosterImplantEffect>();
					foreach (CustomBoosterImplant.Effect effect in customBoosterImplant.Effects)
					{
						list.Add(new BoosterImplantEffect
						{
							Id = effect.Id,
							Param = effect.Value
						});
					}
					BoosterImplantInventoryItem val = new BoosterImplantInventoryItem(new BoosterImplantInventoryItem
					{
						Conditions = Il2CppStructArray<uint>.op_Implicit(customBoosterImplant.Conditions.ToArray()),
						Effects = Il2CppStructArray<BoosterImplantEffect>.op_Implicit(list.ToArray()),
						Id = num,
						TemplateId = customBoosterImplant.TemplateId,
						Flags = 1u
					});
					inventory.Add(val);
					val.Implant.InstanceId = num;
					val.Implant.Uses = (int)val.Implant.Template.DurationRange.y;
					customBoosterImplant.Name = val.Implant.GetCompositPublicName(true);
					num++;
				}
			}
		}
	}
	public static class CustomPerfectBoosterImplantManager
	{
		public class CustomPerfectBoosterImplant
		{
			public string Name { get; set; } = string.Empty;


			public BoosterImplantCategory Category { get; set; } = (BoosterImplantCategory)3;


			public uint TemplateId { get; set; }

			public int TemplateIndex { get; set; }

			public int EffectGroupIndex { get; set; }

			public int ConditionGroupIndex { get; set; }

			public bool Enabled { get; set; }

			public CustomPerfectBoosterImplant(BoosterImplant implant)
			{
				//IL_000d: 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)
				Name = implant.GetCompositPublicName(true);
				TemplateId = implant.TemplateId;
				Category = implant.Category;
				if (BoosterImplantTemplateManager.TryGetBoosterImplantTemplate(implant, out var _, out var _, out var _, out var effectGroupIndex, out var conditionGroupIndex))
				{
					ConditionGroupIndex = conditionGroupIndex;
					EffectGroupIndex = effectGroupIndex;
				}
				Enabled = true;
			}

			public CustomPerfectBoosterImplant()
			{
			}//IL_000d: Unknown result type (might be due to invalid IL or missing references)

		}

		public static CustomSetting<Dictionary<BoosterImplantCategory, List<CustomPerfectBoosterImplant>>> CustomPerfectBoosterImplants { get; set; } = new CustomSetting<Dictionary<BoosterImplantCategory, List<CustomPerfectBoosterImplant>>>("CustomPerfectBoosterImplants", new Dictionary<BoosterImplantCategory, List<CustomPerfectBoosterImplant>>
		{
			{
				(BoosterImplantCategory)0,
				new List<CustomPerfectBoosterImplant>()
			},
			{
				(BoosterImplantCategory)1,
				new List<CustomPerfectBoosterImplant>()
			},
			{
				(BoosterImplantCategory)2,
				new List<CustomPerfectBoosterImplant>()
			}
		}, (Action<Dictionary<BoosterImplantCategory, List<CustomPerfectBoosterImplant>>>)null, (LoadingTime)2, true);


		public static void CreateCustomPerfectBoosterImplantsFromInventory()
		{
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			CustomPerfectBoosterImplants.Value = new Dictionary<BoosterImplantCategory, List<CustomPerfectBoosterImplant>>
			{
				{
					(BoosterImplantCategory)0,
					new List<CustomPerfectBoosterImplant>()
				},
				{
					(BoosterImplantCategory)1,
					new List<CustomPerfectBoosterImplant>()
				},
				{
					(BoosterImplantCategory)2,
					new List<CustomPerfectBoosterImplant>()
				}
			};
			foreach (Category item in (Il2CppArrayBase<Category>)(object)PersistentInventoryManager.Current.m_boosterImplantInventory.Categories)
			{
				Enumerator<BoosterImplantInventoryItem> enumerator2 = item.Inventory.GetEnumerator();
				while (enumerator2.MoveNext())
				{
					BoosterImplantInventoryItem current = enumerator2.Current;
					CustomPerfectBoosterImplants.Value[current.Implant.Category].Add(new CustomPerfectBoosterImplant(current.Implant));
				}
			}
		}

		public static void ApplyCustomPerfectBoosterImplants()
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_029d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: 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_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0216: 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_0234: Expected O, but got Unknown
			//IL_022f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0236: Expected O, but got Unknown
			//IL_025e: Unknown result type (might be due to invalid IL or missing references)
			uint num = 7225460u;
			for (int i = 0; i < 3; i++)
			{
				List<BoosterImplantInventoryItem> inventory = ((Il2CppArrayBase<Category>)(object)PersistentInventoryManager.Current.m_boosterImplantInventory.Categories)[i].Inventory;
				inventory.Clear();
				BoosterImplantCategory key = (BoosterImplantCategory)i;
				for (int j = 0; j < CustomPerfectBoosterImplants.Value[key].Count; j++)
				{
					CustomPerfectBoosterImplant CustomPerfectBoosterImplant = CustomPerfectBoosterImplants.Value[key][j];
					if (!CustomPerfectBoosterImplant.Enabled || GameDataBlockBase<BoosterImplantTemplateDataBlock>.GetBlock(CustomPerfectBoosterImplant.TemplateId) == null)
					{
						continue;
					}
					List<BoosterImplantTemplateManager.BoosterImplantTemplate> list = BoosterImplantTemplateManager.BoosterImplantTemplates.FindAll((BoosterImplantTemplateManager.BoosterImplantTemplate p) => p.BoosterImplantID == CustomPerfectBoosterImplant.TemplateId);
					if (!list.Any() || CustomPerfectBoosterImplant.TemplateIndex <= -1 || CustomPerfectBoosterImplant.TemplateIndex >= list.Count)
					{
						continue;
					}
					BoosterImplantTemplateManager.BoosterImplantTemplate boosterImplantTemplate = list[CustomPerfectBoosterImplant.TemplateIndex];
					if (boosterImplantTemplate == null || boosterImplantTemplate.BoosterImplantID == 0 || CustomPerfectBoosterImplant.ConditionGroupIndex >= boosterImplantTemplate.ConditionGroups.Count || CustomPerfectBoosterImplant.EffectGroupIndex >= boosterImplantTemplate.EffectGroups.Count || CustomPerfectBoosterImplant.ConditionGroupIndex <= -1 || CustomPerfectBoosterImplant.EffectGroupIndex <= -1)
					{
						continue;
					}
					List<BoosterImplantEffect> list2 = new List<BoosterImplantEffect>();
					foreach (BoosterImplantTemplateManager.BoosterImplantEffectTemplate item in boosterImplantTemplate.EffectGroups[CustomPerfectBoosterImplant.EffectGroupIndex])
					{
						list2.Add(new BoosterImplantEffect
						{
							Id = item.BoosterImplantEffect,
							Param = item.EffectMaxValue
						});
					}
					BoosterImplantInventoryItem val = new BoosterImplantInventoryItem(new BoosterImplantInventoryItem
					{
						Conditions = Il2CppStructArray<uint>.op_Implicit(boosterImplantTemplate.ConditionGroups[CustomPerfectBoosterImplant.ConditionGroupIndex].ToArray()),
						Effects = Il2CppStructArray<BoosterImplantEffect>.op_Implicit(list2.ToArray()),
						Id = num,
						TemplateId = CustomPerfectBoosterImplant.TemplateId,
						Flags = 1u
					});
					inventory.Add(val);
					val.Implant.InstanceId = num;
					val.Implant.Uses = (int)val.Implant.Template.DurationRange.y;
					CustomPerfectBoosterImplant.Name = val.Implant.GetCompositPublicName(true);
					num++;
				}
			}
		}
	}
}
namespace Hikaria.BoosterTweaker.Features
{
	[DisallowInGameToggle]
	[EnableFeatureByDefault]
	[HideInModSettings]
	public class CustomBooster : Feature
	{
		public class CustomBoosterSetting
		{
			[FSDisplayName("正面效果倍率")]
			public float BoosterPositiveEffectMultiplier
			{
				get
				{
					return BoosterImplantTemplateManager.BoosterPositiveEffectMultiplier;
				}
				set
				{
					BoosterImplantTemplateManager.BoosterPositiveEffectMultiplier = value;
				}
			}

			[FSDisplayName("禁用条件")]
			public bool DisableBoosterConditions
			{
				get
				{
					return BoosterImplantTemplateManager.DisableBoosterConditions;
				}
				set
				{
					BoosterImplantTemplateManager.DisableBoosterConditions = value;
				}
			}

			[FSDisplayName("禁用负面效果")]
			public bool DisableBoosterNegativeEffects
			{
				get
				{
					return BoosterImplantTemplateManager.DisableBoosterNegativeEffects;
				}
				set
				{
					BoosterImplantTemplateManager.DisableBoosterNegativeEffects = value;
				}
			}

			[FSDisplayName("强化剂自定义")]
			[FSDescription("自定义将导致完美强化剂与模板首选项以及其他作弊选项失效")]
			public bool EnableCustomBooster
			{
				get
				{
					return BoosterImplantTemplateManager.EnableCustomBooster;
				}
				set
				{
					BoosterImplantTemplateManager.EnableCustomBooster = value;
				}
			}

			[FSDisplayName("通过现有强化剂生成自定义强化剂")]
			public FButton CreateCustomBoosterFromInventory { get; set; } = new FButton("生成", "生成自定义强化剂", (Action)CustomBoosterImplantManager.CreateCustomBoosterImplantsFromInventory, false);


			[FSDisplayName("通过设置文件重载自定义强化剂")]
			public FButton LoadCustomBoosterFromSettings { get; set; } = new FButton("重载", "重载自定义强化剂设置", (Action)CustomBoosterImplantManager.CustomBoosterImplants.Load, false);


			[FSDisplayName("应用自定义强化剂")]
			public FButton ApplyCustomBoosters { get; set; } = new FButton("应用", "应用自定义强化剂", (Action)CustomBoosterImplantManager.ApplyCustomBoosterImplants, false);


			[JsonIgnore]
			[FSReadOnly(true)]
			[FSDisplayName("编辑自定义强化剂")]
			public Dictionary<BoosterImplantCategory, CustomBoosterImplantEntryListEntry> CustomBoosterImplantsEntry
			{
				get
				{
					//IL_000b: Unknown result type (might be due to invalid IL or missing references)
					//IL_004b: Unknown result type (might be due to invalid IL or missing references)
					//IL_0022: Unknown result type (might be due to invalid IL or missing references)
					//IL_0059: Unknown result type (might be due to invalid IL or missing references)
					Dictionary<BoosterImplantCategory, CustomBoosterImplantEntryListEntry> dictionary = new Dictionary<BoosterImplantCategory, CustomBoosterImplantEntryListEntry>();
					for (int i = 0; i < 3; i++)
					{
						BoosterImplantCategory key = (BoosterImplantCategory)i;
						List<CustomBoosterImplantEntry> list = new List<CustomBoosterImplantEntry>();
						for (int j = 0; j < CustomBoosterImplantManager.CustomBoosterImplants.Value[key].Count; j++)
						{
							list.Add(new CustomBoosterImplantEntry(CustomBoosterImplantManager.CustomBoosterImplants.Value[key][j]));
						}
						dictionary[key] = new CustomBoosterImplantEntryListEntry(list);
					}
					return dictionary;
				}
				set
				{
				}
			}
		}

		public class CustomBoosterImplantEntryListEntry
		{
			[FSInline]
			[FSDisplayName("强化剂列表")]
			public List<CustomBoosterImplantEntry> Entries { get; set; } = new List<CustomBoosterImplantEntry>();


			public CustomBoosterImplantEntryListEntry(List<CustomBoosterImplantEntry> entries)
			{
				Entries = entries;
			}
		}

		public class CustomBoosterImplantEntry
		{
			[FSSeparator]
			[FSReadOnly(true)]
			[FSDisplayName("名称")]
			public string Name
			{
				get
				{
					return Implant.Name;
				}
				set
				{
				}
			}

			[FSReadOnly(true)]
			[FSDisplayName("类别")]
			public BoosterImplantCategory Category
			{
				get
				{
					//IL_0006: Unknown result type (might be due to invalid IL or missing references)
					return Implant.Category;
				}
				set
				{
				}
			}

			[FSReadOnly(true)]
			[FSDisplayName("ID")]
			public uint TemplateId
			{
				get
				{
					return Implant.TemplateId;
				}
				set
				{
				}
			}

			[FSDisplayName("效果列表")]
			public List<CustomBoosterImplantEffectEntry> Effects
			{
				get
				{
					List<CustomBoosterImplantEffectEntry> list = new List<CustomBoosterImplantEffectEntry>();
					for (int i = 0; i < Implant.Effects.Count; i++)
					{
						list.Add(new CustomBoosterImplantEffectEntry(Implant.Effects[i]));
					}
					return list;
				}
				set
				{
				}
			}

			[FSDisplayName("条件列表")]
			public List<CustomBoosterImplantConditionEntry> Conditions
			{
				get
				{
					List<CustomBoosterImplantConditionEntry> list = new List<CustomBoosterImplantConditionEntry>();
					for (int i = 0; i < Implant.Conditions.Count; i++)
					{
						list.Add(new CustomBoosterImplantConditionEntry(i, Implant));
					}
					return list;
				}
				set
				{
				}
			}

			[FSDisplayName("状态")]
			public bool Enabled
			{
				get
				{
					return Implant.Enabled;
				}
				set
				{
					Implant.Enabled = value;
				}
			}

			[FSDisplayName("修改")]
			public BoosterImplantModifier Modifier { get; set; }

			[FSIgnore]
			private CustomBoosterImplantManager.CustomBoosterImplant Implant { get; set; }

			public CustomBoosterImplantEntry(CustomBoosterImplantManager.CustomBoosterImplant implant)
			{
				Implant = implant;
				Modifier = new BoosterImplantModifier(implant);
			}
		}

		[Localized]
		public enum ModifyType
		{
			Add,
			Remove,
			Modify
		}

		[Localized]
		public enum ModifyTarget
		{
			Effect,
			Condition
		}

		public class BoosterImplantModifier
		{
			[FSDisplayName("ID")]
			public uint Id { get; set; }

			[FSDisplayName("值")]
			public float Value { get; set; } = 1f;


			[FSDisplayName("修改模式")]
			public ModifyType type { get; set; } = ModifyType.Modify;


			[FSDisplayName("修改对象")]
			public ModifyTarget target { get; set; }

			[FSDisplayName("应用修改")]
			public FButton Modify { get; set; }

			private CustomBoosterImplantManager.CustomBoosterImplant Implant { get; set; }

			public BoosterImplantModifier(CustomBoosterImplantManager.CustomBoosterImplant implant)
			{
				//IL_0037: Unknown result type (might be due to invalid IL or missing references)
				//IL_0041: Expected O, but got Unknown
				Implant = implant;
				Modify = new FButton("应用", "应用修改", (Action)DoModify, false);
			}

			private void DoModify()
			{
				List<CustomBoosterImplantManager.CustomBoosterImplant.Effect> effects = Implant.Effects;
				List<uint> conditions = Implant.Conditions;
				switch (type)
				{
				case ModifyType.Modify:
					if (target == ModifyTarget.Effect)
					{
						int num3 = effects.FindIndex((CustomBoosterImplantManager.CustomBoosterImplant.Effect p) => p.Id == Id);
						if (num3 != -1)
						{
							effects[num3].Value = Value;
						}
					}
					else
					{
						int num4 = conditions.FindIndex((uint p) => p == Id);
						if (num4 != -1)
						{
							conditions[num4] = Id;
						}
					}
					break;
				case ModifyType.Add:
					if (target == ModifyTarget.Effect)
					{
						if (effects.FindIndex((CustomBoosterImplantManager.CustomBoosterImplant.Effect p) => p.Id == Id) == -1)
						{
							effects.Add(new CustomBoosterImplantManager.CustomBoosterImplant.Effect
							{
								Id = Id,
								Value = Value
							});
						}
					}
					else if (conditions.FindIndex((uint p) => p == Id) == -1)
					{
						conditions.Add(Id);
					}
					break;
				case ModifyType.Remove:
					if (target == ModifyTarget.Effect)
					{
						int num = effects.FindIndex((CustomBoosterImplantManager.CustomBoosterImplant.Effect p) => p.Id == Id);
						if (num != -1)
						{
							effects.RemoveAt(num);
						}
					}
					else
					{
						int num2 = conditions.FindIndex((uint p) => p == Id);
						if (num2 != -1)
						{
							conditions.RemoveAt(num2);
						}
					}
					break;
				}
			}
		}

		public class CustomBoosterImplantEffectEntry
		{
			[FSSeparator]
			[FSDisplayName("效果ID")]
			public uint Id
			{
				get
				{
					return Effect.Id;
				}
				set
				{
					Effect.Id = value;
				}
			}

			[FSDisplayName("效果数值")]
			public float Value
			{
				get
				{
					return Effect.Value;
				}
				set
				{
					Effect.Value = value;
				}
			}

			[FSIgnore]
			private CustomBoosterImplantManager.CustomBoosterImplant.Effect Effect { get; set; }

			public CustomBoosterImplantEffectEntry(CustomBoosterImplantManager.CustomBoosterImplant.Effect effect)
			{
				Effect = effect;
			}
		}

		public class CustomBoosterImplantConditionEntry
		{
			[FSIgnore]
			public int Index { get; set; }

			[FSSeparator]
			[FSDisplayName("条件")]
			public uint Condition
			{
				get
				{
					return Implant.Conditions[Index];
				}
				set
				{
					Implant.Conditions[Index] = value;
				}
			}

			[FSIgnore]
			private CustomBoosterImplantManager.CustomBoosterImplant Implant { get; set; }

			public CustomBoosterImplantConditionEntry(int index, CustomBoosterImplantManager.CustomBoosterImplant implant)
			{
				Index = index;
				Implant = implant;
			}
		}

		[ArchivePatch(/*Could not decode attribute arguments.*/)]
		private class CM_PageLoadout__ProcessBoosterImplantEvents__Patch
		{
			private static bool Prefix()
			{
				if (Settings.EnableCustomBooster)
				{
					return false;
				}
				return true;
			}
		}

		[ArchivePatch(/*Could not decode attribute arguments.*/)]
		private class PersistentInventoryManager__Setup__Patch
		{
			private static void Postfix(PersistentInventoryManager __instance)
			{
				__instance.OnBoosterImplantInventoryChanged += Action.op_Implicit((Action)delegate
				{
					if (Settings.EnableCustomBooster)
					{
						CustomBoosterImplantManager.ApplyCustomBoosterImplants();
					}
				});
			}
		}

		[ArchivePatch(/*Could not decode attribute arguments.*/)]
		internal static class DropServerManager__NewGameSession__Patch
		{
			public static void Prefix(ref uint[] boosterIds)
			{
				if (Settings.EnableCustomBooster)
				{
					boosterIds = null;
				}
			}
		}

		[ArchivePatch(/*Could not decode attribute arguments.*/)]
		private class DropServerGameSession__ConsumeBoosters__Patch
		{
			private static bool Prefix()
			{
				return !Settings.EnableCustomBooster;
			}
		}

		[ArchivePatch(/*Could not decode attribute arguments.*/)]
		private class BoosterUtils__BoosterCurrencyFromHeatAndArtifactCount__Patch
		{
			private static void Postfix(ref int __result)
			{
				if (Settings.EnableCustomBooster)
				{
					__result = 0;
				}
			}
		}

		public override string Name => "Custom Booster";

		[FeatureConfig]
		public static CustomBoosterSetting Settings { get; set; }

		public override bool RequiresRestart => true;

		public override Type[] LocalizationExternalTypes => new Type[3]
		{
			typeof(BoosterImplantCategory),
			typeof(AgentModifier),
			typeof(BoosterCondition)
		};
	}
	[DisallowInGameToggle]
	[EnableFeatureByDefault]
	public class PerfectBooster : Feature
	{
		public class PerfectBoosterSetting
		{
			[FSDisplayName("快速刷取")]
			public bool EnableBoosterFarmer { get; set; }

			[RequiresRestart]
			[FSDisplayName("完美强化剂")]
			public bool EnablePerfectBooster { get; set; } = true;


			[FSDisplayName("禁用消耗")]
			public bool DisableBoosterConsume { get; set; } = true;


			[FSHeader("自定义强化剂", true)]
			[FSDisplayName("启用自定义强化剂")]
			public bool EnableCustomPerfectBooster
			{
				get
				{
					return BoosterImplantTemplateManager.EnableCustomPerfectBooster;
				}
				set
				{
					BoosterImplantTemplateManager.EnableCustomPerfectBooster = value;
				}
			}

			[FSDisplayName("通过现有强化剂生成自定义强化剂")]
			public FButton CreateCustomPerfectBoosterFromInventory { get; set; } = new FButton("生成", "生成自定义强化剂", (Action)CustomPerfectBoosterImplantManager.CreateCustomPerfectBoosterImplantsFromInventory, false);


			[FSDisplayName("通过设置文件重载自定义强化剂")]
			public FButton LoadCustomPerfectBoosterFromSettings { get; set; } = new FButton("重载", "重载自定义强化剂设置", (Action)CustomPerfectBoosterImplantManager.CustomPerfectBoosterImplants.Load, false);


			[FSDisplayName("应用自定义强化剂")]
			public FButton ApplyCustomPerfectBoosters { get; set; } = new FButton("应用", "应用自定义强化剂", (Action)CustomPerfectBoosterImplantManager.ApplyCustomPerfectBoosterImplants, false);


			[JsonIgnore]
			[FSReadOnly(true)]
			[FSDisplayName("编辑自定义强化剂")]
			public Dictionary<BoosterImplantCategory, CustomPerfectBoosterImplantEntryListEntry> CustomPerfectBoosterImplantsEntry
			{
				get
				{
					//IL_000b: Unknown result type (might be due to invalid IL or missing references)
					//IL_004b: Unknown result type (might be due to invalid IL or missing references)
					//IL_0022: Unknown result type (might be due to invalid IL or missing references)
					//IL_0059: Unknown result type (might be due to invalid IL or missing references)
					Dictionary<BoosterImplantCategory, CustomPerfectBoosterImplantEntryListEntry> dictionary = new Dictionary<BoosterImplantCategory, CustomPerfectBoosterImplantEntryListEntry>();
					for (int i = 0; i < 3; i++)
					{
						BoosterImplantCategory key = (BoosterImplantCategory)i;
						List<CustomPerfectBoosterImplantEntry> list = new List<CustomPerfectBoosterImplantEntry>();
						for (int j = 0; j < CustomPerfectBoosterImplantManager.CustomPerfectBoosterImplants.Value[key].Count; j++)
						{
							list.Add(new CustomPerfectBoosterImplantEntry(CustomPerfectBoosterImplantManager.CustomPerfectBoosterImplants.Value[key][j]));
						}
						dictionary[key] = new CustomPerfectBoosterImplantEntryListEntry(list);
					}
					return dictionary;
				}
				set
				{
				}
			}
		}

		public class CustomPerfectBoosterImplantEntryListEntry
		{
			[FSInline]
			[FSDisplayName("强化剂列表")]
			public List<CustomPerfectBoosterImplantEntry> Entries { get; set; } = new List<CustomPerfectBoosterImplantEntry>();


			public CustomPerfectBoosterImplantEntryListEntry(List<CustomPerfectBoosterImplantEntry> entries)
			{
				Entries = entries;
			}
		}

		public class CustomPerfectBoosterImplantEntry
		{
			[FSSeparator]
			[FSReadOnly(true)]
			[FSDisplayName("名称")]
			public string Name
			{
				get
				{
					return Implant.Name;
				}
				set
				{
				}
			}

			[FSReadOnly(true)]
			[FSDisplayName("类别")]
			public BoosterImplantCategory Category
			{
				get
				{
					//IL_0006: Unknown result type (might be due to invalid IL or missing references)
					return Implant.Category;
				}
				set
				{
				}
			}

			[FSReadOnly(true)]
			[FSDisplayName("ID")]
			public uint TemplateId
			{
				get
				{
					return Implant.TemplateId;
				}
				set
				{
				}
			}

			[FSDisplayName("模版索引")]
			public int TemplateIndex
			{
				get
				{
					return Implant.TemplateIndex;
				}
				set
				{
					Implant.TemplateIndex = value;
					UpdateTemplate();
				}
			}

			[FSDisplayName("效果组索引")]
			public int EffectsGroupIndex
			{
				get
				{
					return Implant.EffectGroupIndex;
				}
				set
				{
					Implant.EffectGroupIndex = value;
				}
			}

			[FSDisplayName("条件组索引")]
			public int ConditionsGroupIndex
			{
				get
				{
					return Implant.ConditionGroupIndex;
				}
				set
				{
					Implant.ConditionGroupIndex = value;
				}
			}

			[FSDisplayName("状态")]
			public bool Enabled
			{
				get
				{
					return Implant.Enabled;
				}
				set
				{
					Implant.Enabled = value;
				}
			}

			[JsonIgnore]
			[FSInline]
			[FSDisplayName("可选模板")]
			public CustomPerfectBoosterTemplateEntry Templates { get; set; } = new CustomPerfectBoosterTemplateEntry();


			[FSIgnore]
			private CustomPerfectBoosterImplantManager.CustomPerfectBoosterImplant Implant { get; set; }

			public CustomPerfectBoosterImplantEntry(CustomPerfectBoosterImplantManager.CustomPerfectBoosterImplant implant)
			{
				Implant = implant;
				TemplateId = implant.TemplateId;
				BoosterImplantTemplateManager.BoosterImplantTemplate boosterImplantTemplate = BoosterImplantTemplateManager.BoosterImplantTemplates.FindAll((BoosterImplantTemplateManager.BoosterImplantTemplate p) => p.BoosterImplantID == implant.TemplateId)[implant.TemplateIndex];
				if (boosterImplantTemplate != null && boosterImplantTemplate.BoosterImplantID != 0)
				{
					Templates.EffectsTemplates.Clear();
					for (int i = 0; i < boosterImplantTemplate.EffectGroups.Count; i++)
					{
						Templates.EffectsTemplates.Add(new BoosterImplantEffectGroupPreferenceEntry(i, boosterImplantTemplate.EffectGroups[i]));
					}
					Templates.ConditionsTemplates.Clear();
					for (int j = 0; j < boosterImplantTemplate.ConditionGroups.Count; j++)
					{
						Templates.ConditionsTemplates.Add(new BoosterImplantConditionGroupPreferenceEntry(j, boosterImplantTemplate.ConditionGroups[j]));
					}
					TemplateId = boosterImplantTemplate.BoosterImplantID;
				}
			}

			private void UpdateTemplate()
			{
				List<BoosterImplantTemplateManager.BoosterImplantTemplate> list = BoosterImplantTemplateManager.BoosterImplantTemplates.FindAll((BoosterImplantTemplateManager.BoosterImplantTemplate p) => p.BoosterImplantID == TemplateId);
				if (TemplateIndex <= -1 || TemplateIndex >= list.Count)
				{
					return;
				}
				BoosterImplantTemplateManager.BoosterImplantTemplate boosterImplantTemplate = list[TemplateIndex];
				if (boosterImplantTemplate != null && boosterImplantTemplate.BoosterImplantID != 0)
				{
					Templates.EffectsTemplates.Clear();
					for (int i = 0; i < boosterImplantTemplate.EffectGroups.Count; i++)
					{
						Templates.EffectsTemplates.Add(new BoosterImplantEffectGroupPreferenceEntry(i, boosterImplantTemplate.EffectGroups[i]));
					}
					Templates.ConditionsTemplates.Clear();
					for (int j = 0; j < boosterImplantTemplate.ConditionGroups.Count; j++)
					{
						Templates.ConditionsTemplates.Add(new BoosterImplantConditionGroupPreferenceEntry(j, boosterImplantTemplate.ConditionGroups[j]));
					}
					TemplateId = boosterImplantTemplate.BoosterImplantID;
				}
			}
		}

		public class CustomPerfectBoosterTemplateEntry
		{
			[FSReadOnly(true)]
			[FSDisplayName("可选效果模板")]
			public List<BoosterImplantEffectGroupPreferenceEntry> EffectsTemplates { get; set; } = new List<BoosterImplantEffectGroupPreferenceEntry>();


			[FSReadOnly(true)]
			[FSDisplayName("可选条件模板")]
			public List<BoosterImplantConditionGroupPreferenceEntry> ConditionsTemplates { get; set; } = new List<BoosterImplantConditionGroupPreferenceEntry>();

		}

		public class BoosterImplantEffectGroupPreferenceEntry
		{
			public class EffectEntry
			{
				[FSReadOnly(true)]
				[FSDisplayName("效果")]
				public AgentModifier Effect { get; set; }

				public EffectEntry(BoosterImplantEffectDataBlock block)
				{
					//IL_0008: Unknown result type (might be due to invalid IL or missing references)
					Effect = block.Effect;
				}
			}

			[FSSeparator]
			[FSReadOnly(true)]
			[FSDisplayName("效果组索引")]
			public int Index { get; set; }

			[FSReadOnly(true)]
			[FSInline]
			[FSDisplayName("效果列表")]
			public List<EffectEntry> Effects { get; set; } = new List<EffectEntry>();


			public BoosterImplantEffectGroupPreferenceEntry(int index, List<BoosterImplantTemplateManager.BoosterImplantEffectTemplate> effectGroup)
			{
				Index = index;
				Effects.Clear();
				for (int i = 0; i < effectGroup.Count; i++)
				{
					BoosterImplantEffectDataBlock block = GameDataBlockBase<BoosterImplantEffectDataBlock>.GetBlock(effectGroup[i].BoosterImplantEffect);
					if (block != null)
					{
						Effects.Add(new EffectEntry(block));
					}
				}
			}
		}

		public class BoosterImplantConditionGroupPreferenceEntry
		{
			public class ConditionEntry
			{
				[FSReadOnly(true)]
				[FSDisplayName("条件")]
				public BoosterCondition Condition { get; set; }

				public ConditionEntry(BoosterImplantConditionDataBlock block)
				{
					//IL_0008: Unknown result type (might be due to invalid IL or missing references)
					Condition = block.Condition;
				}
			}

			[FSSeparator]
			[FSReadOnly(true)]
			[FSDisplayName("条件组索引")]
			public int Index { get; set; }

			[FSReadOnly(true)]
			[FSInline]
			[FSDisplayName("条件列表")]
			public List<ConditionEntry> Conditions { get; set; } = new List<ConditionEntry>();


			public BoosterImplantConditionGroupPreferenceEntry(int index, List<uint> conditionGroup)
			{
				Index = index;
				Conditions.Clear();
				for (int i = 0; i < conditionGroup.Count; i++)
				{
					BoosterImplantConditionDataBlock block = GameDataBlockBase<BoosterImplantConditionDataBlock>.GetBlock(conditionGroup[i]);
					if (block != null)
					{
						Conditions.Add(new ConditionEntry(block));
					}
				}
			}
		}

		[ArchivePatch(/*Could not decode attribute arguments.*/)]
		private class LocalizationManager__Setup__Patch
		{
			private static void Postfix()
			{
				CustomPerfectBoosterImplantManager.CustomPerfectBoosterImplants.Load();
			}
		}

		[ArchivePatch(/*Could not decode attribute arguments.*/)]
		private class PersistentInventoryManager__Setup__Patch
		{
			private static void Postfix(PersistentInventoryManager __instance)
			{
				__instance.OnBoosterImplantInventoryChanged += Action.op_Implicit((Action)delegate
				{
					if (Settings.EnableCustomPerfectBooster)
					{
						CustomPerfectBoosterImplantManager.ApplyCustomPerfectBoosterImplants();
					}
				});
			}
		}

		[ArchivePatch(/*Could not decode attribute arguments.*/)]
		private class BoosterImplantManager__OnActiveBoosterImplantsChanged__Patch
		{
			private static void Prefix()
			{
				if (!Settings.EnablePerfectBooster || Settings.EnableCustomPerfectBooster)
				{
					return;
				}
				for (int i = 0; i < ((Il2CppArrayBase<Category>)(object)PersistentInventoryManager.Current.m_boosterImplantInventory.Categories).Count; i++)
				{
					List<BoosterImplantInventoryItem> inventory = ((Il2CppArrayBase<Category>)(object)PersistentInventoryManager.Current.m_boosterImplantInventory.Categories)[i].Inventory;
					for (int j = 0; j < inventory.Count; j++)
					{
						BoosterImplant implant = inventory[j].Implant;
						if (BoosterImplantTemplateManager.TryGetBoosterImplantTemplate(implant, out var _, out var effectGroup, out var conditionGroup, out var _, out var _))
						{
							BoosterImplantTemplateManager.ApplyPerfectBoosterFromTemplate(implant, effectGroup, conditionGroup);
						}
					}
				}
			}
		}

		[ArchivePatch(/*Could not decode attribute arguments.*/)]
		private class CM_PageLoadout__ProcessBoosterImplantEvents__Patch
		{
			private static bool Prefix()
			{
				if (Settings.EnableCustomPerfectBooster)
				{
					return false;
				}
				return true;
			}
		}

		[ArchivePatch(/*Could not decode attribute arguments.*/)]
		internal static class DropServerManager__NewGameSession__Patch
		{
			public static void Prefix(ref uint[] boosterIds)
			{
				if (Settings.DisableBoosterConsume || Settings.EnablePerfectBooster)
				{
					boosterIds = null;
				}
			}
		}

		[ArchivePatch(/*Could not decode attribute arguments.*/)]
		private class DropServerGameSession__ConsumeBoosters__Patch
		{
			private static bool Prefix()
			{
				if (!Settings.DisableBoosterConsume)
				{
					return !Settings.EnableCustomPerfectBooster;
				}
				return false;
			}
		}

		[ArchivePatch(/*Could not decode attribute arguments.*/)]
		private class BoosterUtils__BoosterCurrencyFromHeatAndArtifactCount__Patch
		{
			private static void Postfix(ref int __result)
			{
				if (Settings.EnableCustomPerfectBooster)
				{
					__result = 0;
				}
				else if (Settings.EnableBoosterFarmer)
				{
					__result = 100000;
				}
			}
		}

		public override string Name => "Perfect Booster";

		[FeatureConfig]
		public static PerfectBoosterSetting Settings { get; set; }

		public override bool RequiresRestart => true;

		public override Type[] LocalizationExternalTypes => new Type[3]
		{
			typeof(BoosterImplantCategory),
			typeof(AgentModifier),
			typeof(BoosterCondition)
		};

		public override void OnGameDataInitialized()
		{
			BoosterImplantTemplateManager.LoadTemplateData();
		}
	}
}