Decompiled source of ArtifactOfLimit v1.1.1

plugins/viliger-ArtifactOfLimit/ArtifactOfLimit.dll

Decompiled a week ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HG.Reflection;
using On.RoR2;
using ProperSave;
using ProperSave.Data;
using RoR2;
using RoR2.ContentManagement;
using RoR2.Items;
using UnityEngine;
using UnityEngine.Networking;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("ArtifactOfLimit")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ArtifactOfLimit")]
[assembly: AssemblyTitle("ArtifactOfLimit")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace ArtifactOfLimit;

public static class ArtifactOfLimitManager
{
	public static ArtifactDef myArtifact;

	internal static ItemMask newAvailableItems;

	private static ItemMask oldAvailableItems;

	[SystemInitializer(new Type[] { typeof(ArtifactCatalog) })]
	private static void Init()
	{
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: Expected O, but got Unknown
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Expected O, but got Unknown
		if (ArtifactOfLimitPlugin.isLoaded)
		{
			RunArtifactManager.onArtifactEnabledGlobal += new ArtifactStateChangeDelegate(RunArtifactManager_onArtifactEnabledGlobal);
			RunArtifactManager.onArtifactDisabledGlobal += new ArtifactStateChangeDelegate(RunArtifactManager_onArtifactDisabledGlobal);
		}
	}

	private static void RunArtifactManager_onArtifactEnabledGlobal(RunArtifactManager runArtifactManager, ArtifactDef artifactDef)
	{
		if (NetworkServer.active && (Object)(object)artifactDef == (Object)(object)myArtifact)
		{
			Run.onRunStartGlobal += Run_onRunStartGlobal;
			Run.onRunDestroyGlobal += Run_onRunDestroyGlobal;
		}
	}

	private static void RunArtifactManager_onArtifactDisabledGlobal(RunArtifactManager runArtifactManager, ArtifactDef artifactDef)
	{
		if ((Object)(object)artifactDef == (Object)(object)myArtifact)
		{
			Run.onRunStartGlobal -= Run_onRunStartGlobal;
			Run.onRunDestroyGlobal -= Run_onRunDestroyGlobal;
		}
	}

	private static void Run_onRunDestroyGlobal(Run run)
	{
		if (NetworkServer.active)
		{
			if (oldAvailableItems != null)
			{
				run.availableItems = oldAvailableItems;
			}
			if (newAvailableItems != null)
			{
				ItemMask.Return(newAvailableItems);
			}
		}
	}

	private static void Run_onRunStartGlobal(Run run)
	{
		if (!NetworkServer.active)
		{
			return;
		}
		oldAvailableItems = run.availableItems;
		newAvailableItems = null;
		if (ProperSaveCompat.enabled)
		{
			if (ProperSaveCompat.IsLoading())
			{
				ProperSaveCompat.LoadItemMask(out newAvailableItems);
			}
			else
			{
				FillArtifactItemMask(ref newAvailableItems, run);
			}
		}
		else
		{
			FillArtifactItemMask(ref newAvailableItems, run);
		}
		run.availableItems = newAvailableItems;
		run.BuildDropTable();
	}

	private static void FillArtifactItemMask(ref ItemMask newAvailableItems, Run run)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Invalid comparison between Unknown and I4
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_017b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0180: Unknown result type (might be due to invalid IL or missing references)
		//IL_0191: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_0188: Unknown result type (might be due to invalid IL or missing references)
		//IL_018d: Unknown result type (might be due to invalid IL or missing references)
		newAvailableItems = ItemMask.Rent();
		string[] array = Config.Whitelist.Value.Split(",", StringSplitOptions.RemoveEmptyEntries);
		for (int i = 0; i < array.Length; i++)
		{
			ItemIndex val = ItemCatalog.FindItemIndex(array[i]);
			if ((int)val != -1)
			{
				PickupIndex val2 = PickupCatalog.FindPickupIndex(val);
				if (!(val2 == PickupIndex.none) && (run.availableTier1DropList.Contains(val2) || run.availableTier2DropList.Contains(val2) || run.availableTier3DropList.Contains(val2)))
				{
					newAvailableItems.Add(val);
				}
			}
		}
		GenerateItemPool(ref newAvailableItems, run.runRNG, run.availableTier1DropList, Config.Tier1ItemCount.Value, Config.Tier1DamageTag.Value, Config.Tier1HealingTag.Value, Config.Tier1UtilityTag.Value, run.availableVoidTier1DropList);
		GenerateItemPool(ref newAvailableItems, run.runRNG, run.availableTier2DropList, Config.Tier2ItemCount.Value, Config.Tier2DamageTag.Value, Config.Tier2HealingTag.Value, Config.Tier2UtilityTag.Value, run.availableVoidTier2DropList);
		GenerateItemPool(ref newAvailableItems, run.runRNG, run.availableTier3DropList, Config.Tier3ItemCount.Value, Config.Tier3DamageTag.Value, Config.Tier3HealingTag.Value, Config.Tier3UtilityTag.Value, run.availableVoidTier3DropList);
		if (Config.AffectVoidItems.Value)
		{
			if (ItemCountInMask(newAvailableItems, run.availableVoidTier1DropList) + ItemCountInMask(newAvailableItems, run.availableVoidTier2DropList) + ItemCountInMask(newAvailableItems, run.availableVoidTier3DropList) == 0)
			{
				for (int j = 0; j < Config.PityVoidItemCount.Value; j++)
				{
					ItemIndex val3 = GetRandomVoidItem(run);
					int num = 0;
					while (newAvailableItems.Contains(val3) && num < 5)
					{
						val3 = GetRandomVoidItem(run);
					}
					if (!newAvailableItems.Contains(val3))
					{
						newAvailableItems.Add(val3);
					}
				}
			}
		}
		else
		{
			AddAllItemsToItemMask(ref newAvailableItems, run.availableVoidTier1DropList);
			AddAllItemsToItemMask(ref newAvailableItems, run.availableVoidTier2DropList);
			AddAllItemsToItemMask(ref newAvailableItems, run.availableVoidTier3DropList);
		}
		AddAllItemsToItemMask(ref newAvailableItems, run.availableLunarItemDropList);
		AddAllItemsToItemMask(ref newAvailableItems, run.availableBossDropList);
		AddAllItemsToItemMask(ref newAvailableItems, run.availableVoidBossDropList);
		AddAllItemsToItemMask(ref newAvailableItems, run.availableFoodTierDropList);
		AddAllItemsToItemMask(ref newAvailableItems, run.availablePowerShapeItemsDropList);
		if (!Config.PrintItemList.Value)
		{
			return;
		}
		Log.Info("Artifact Of Limit Item List: ");
		for (int k = 0; k < newAvailableItems.array.Length; k++)
		{
			if (newAvailableItems.array[k])
			{
				Log.Info(ItemCatalog.GetItemDef((ItemIndex)k));
			}
		}
		static void AddAllItemsToItemMask(ref ItemMask itemMask, List<PickupIndex> itemList)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Invalid comparison between Unknown and I4
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			foreach (PickupIndex item in itemList)
			{
				PickupDef pickupDef = PickupCatalog.GetPickupDef(item);
				if ((int)pickupDef.itemIndex != -1)
				{
					itemMask.Add(pickupDef.itemIndex);
				}
			}
		}
		static ItemIndex GetRandomVoidItem(Run run)
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			return PickupCatalog.GetPickupDef((PickupIndex)(run.runRNG.RangeInt(0, 3) switch
			{
				1 => run.availableVoidTier2DropList[run.runRNG.RangeInt(0, run.availableVoidTier2DropList.Count)], 
				2 => run.availableVoidTier2DropList[run.runRNG.RangeInt(0, run.availableVoidTier3DropList.Count)], 
				_ => run.availableVoidTier1DropList[run.runRNG.RangeInt(0, run.availableVoidTier1DropList.Count)], 
			})).itemIndex;
		}
		static int ItemCountInMask(ItemMask itemMask, List<PickupIndex> itemList)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Invalid comparison between Unknown and I4
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			int num2 = 0;
			foreach (PickupIndex item2 in itemList)
			{
				PickupDef pickupDef2 = PickupCatalog.GetPickupDef(item2);
				if ((int)pickupDef2.itemIndex != -1 && itemMask.Contains(pickupDef2.itemIndex))
				{
					num2++;
				}
			}
			return num2;
		}
	}

	private static void GenerateItemPool(ref ItemMask newAvailableItems, Xoroshiro128Plus runRng, List<PickupIndex> dropList, int totalItemCount, float damagePercent, float healingPercent, float utilityPercent, List<PickupIndex> voidItemPool)
	{
		//IL_0233: Unknown result type (might be due to invalid IL or missing references)
		//IL_0238: Unknown result type (might be due to invalid IL or missing references)
		//IL_023c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0247: Unknown result type (might be due to invalid IL or missing references)
		List<ItemIndex> voidItemPool2 = voidItemPool.ConvertAll((PickupIndex item) => PickupCatalog.GetPickupDef(item).itemIndex);
		float num = damagePercent + healingPercent + utilityPercent;
		int num2 = (int)((float)totalItemCount * (damagePercent / num));
		int num3 = (int)((float)totalItemCount * (healingPercent / num));
		int num4 = (int)((float)totalItemCount * (utilityPercent / num));
		if (totalItemCount != num2 + num3 + num4)
		{
			for (int num5 = totalItemCount - (num2 + num3 + num4); num5 > 0; num5--)
			{
				switch (runRng.RangeInt(0, 3))
				{
				default:
					num2++;
					break;
				case 1:
					num4++;
					break;
				case 2:
					num3++;
					break;
				}
			}
		}
		List<ItemIndex> items2 = dropList.Where((PickupIndex item) => SelectItemWithTag(item, (ItemTag)1)).ToList().ConvertAll((PickupIndex item) => PickupCatalog.GetPickupDef(item).itemIndex);
		List<ItemIndex> items3 = dropList.Where((PickupIndex item) => SelectItemWithTag(item, (ItemTag)3)).ToList().ConvertAll((PickupIndex item) => PickupCatalog.GetPickupDef(item).itemIndex);
		List<ItemIndex> items4 = dropList.Where((PickupIndex item) => SelectItemWithTag(item, (ItemTag)2)).ToList().ConvertAll((PickupIndex item) => PickupCatalog.GetPickupDef(item).itemIndex);
		int num6 = AddItemsToItemMask(ref newAvailableItems, ref items2, num2, voidItemPool2);
		int num7 = AddItemsToItemMask(ref newAvailableItems, ref items3, num4, voidItemPool2);
		int num8 = AddItemsToItemMask(ref newAvailableItems, ref items4, num3, voidItemPool2);
		List<ItemIndex> list = new List<ItemIndex>(items2.Count + items3.Count + items4.Count);
		list.AddRange(items2);
		list.AddRange(items3);
		list.AddRange(items4);
		if (num6 + num7 + num8 == totalItemCount)
		{
			return;
		}
		int num9 = totalItemCount - (num6 + num7 + num8);
		int num10 = 0;
		while (num9 > 0 && num10 < 10)
		{
			ItemIndex val = list[runRng.RangeInt(0, list.Count)];
			if (!newAvailableItems.Contains(val))
			{
				newAvailableItems.Add(val);
				num9--;
			}
			num10++;
		}
		int AddItemsToItemMask(ref ItemMask itemMask, ref List<ItemIndex> items, int itemCount, List<ItemIndex> voidItemPool)
		{
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			int num11 = 0;
			if (items.Count <= itemCount)
			{
				foreach (ItemIndex item in items)
				{
					itemMask.Add(item);
					num11++;
				}
				items.Clear();
			}
			else
			{
				for (int i = 0; i < itemCount; i++)
				{
					ItemIndex val2 = items[runRng.RangeInt(0, items.Count)];
					int num12 = 0;
					while (itemMask.Contains(val2) && num12 < 5)
					{
						val2 = items[runRng.RangeInt(0, items.Count)];
						num12++;
					}
					if (!itemMask.Contains(val2))
					{
						itemMask.Add(val2);
						items.Remove(val2);
						num11++;
						ItemCatalog.GetItemDef(val2);
						if (Config.AffectVoidItems.Value)
						{
							for (int j = 0; j < ContagiousItemManager.transformationInfos.Length; j++)
							{
								if (((TransformationInfo)ContagiousItemManager.transformationInfos[j]).originalItem == val2 && voidItemPool.Contains(((TransformationInfo)ContagiousItemManager.transformationInfos[j]).transformedItem))
								{
									itemMask.Add(((TransformationInfo)ContagiousItemManager.transformationInfos[j]).transformedItem);
									break;
								}
							}
						}
					}
				}
			}
			return num11;
		}
		static bool SelectItemWithTag(PickupIndex item, ItemTag tag)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Invalid comparison between Unknown and I4
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			PickupDef pickupDef = PickupCatalog.GetPickupDef(item);
			if ((int)pickupDef.itemIndex != -1)
			{
				return Array.IndexOf(ItemCatalog.GetItemDef(pickupDef.itemIndex).tags, tag) != -1;
			}
			return false;
		}
	}
}
[BepInPlugin("com.viliger.ArtifactOfLimit", "ArtifactOfLimit", "1.1.1")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class ArtifactOfLimitPlugin : BaseUnityPlugin
{
	public const string Author = "viliger";

	public const string ModName = "ArtifactOfLimit";

	public const string Version = "1.1.1";

	public const string GUID = "com.viliger.ArtifactOfLimit";

	public static bool isLoaded;

	private void Awake()
	{
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Expected O, but got Unknown
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Expected O, but got Unknown
		Log.Init(((BaseUnityPlugin)this).Logger);
		if (Chainloader.PluginInfos.ContainsKey("dolso.ItemBlacklist"))
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)"Mod is incompatible with ItemBlacklist and will not load to prevent game breaking bugs. I suggest you use alternatives such as LobbyRulebookDefSaver or LobbyVotesSave instead.");
			return;
		}
		Config.PopulateConfig(((BaseUnityPlugin)this).Config);
		ContentManager.collectContentPackProviders += new CollectContentPackProvidersDelegate(ContentManager_collectContentPackProviders);
		Language.collectLanguageRootFolders += Language_collectLanguageRootFolders;
		if (ProperSaveCompat.enabled)
		{
			ProperSaveCompat.RegisterSaveData();
		}
		Run.Start += new hook_Start(Run_Start);
		isLoaded = true;
	}

	private void Run_Start(orig_Start orig, Run self)
	{
		orig.Invoke(self);
		if (RunArtifactManager.instance.IsArtifactEnabled(ArtifactOfLimitManager.myArtifact))
		{
			PickupDropTable.RegenerateAll(self);
		}
	}

	private void Language_collectLanguageRootFolders(List<string> folders)
	{
		folders.Add(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "Language"));
	}

	private void ContentManager_collectContentPackProviders(AddContentPackProviderDelegate addContentPackProvider)
	{
		addContentPackProvider.Invoke((IContentPackProvider)(object)new ContentProvider());
	}
}
public class ContentProvider : IContentPackProvider
{
	private readonly ContentPack _contentPack = new ContentPack();

	public string identifier => "com.viliger.ArtifactOfLimit.ContentPack";

	public IEnumerator FinalizeAsync(FinalizeAsyncArgs args)
	{
		args.ReportProgress(1f);
		yield break;
	}

	public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args)
	{
		ContentPack.Copy(_contentPack, args.output);
		args.ReportProgress(1f);
		yield break;
	}

	public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args)
	{
		_contentPack.identifier = identifier;
		string path = Path.Combine(Path.GetDirectoryName(typeof(ContentProvider).Assembly.Location), "AssetBundles");
		AssetBundle assetbundle = null;
		yield return LoadAssetBundle(Path.Combine(path, "artifactoflimit"), args.progressReceiver, delegate(AssetBundle resultAssetBundle)
		{
			assetbundle = resultAssetBundle;
		});
		ArtifactDef val = ScriptableObject.CreateInstance<ArtifactDef>();
		((Object)val).name = "viliger_ArtifactOfLimit";
		val.nameToken = "VILIGER_ARTIFACT_OF_LIMIT_NAME";
		val.descriptionToken = "VILIGER_ARTIFACT_OF_LIMIT_NAME_DESC";
		val.smallIconSelectedSprite = assetbundle.LoadAsset<Sprite>("Assets/ArtifactOfLimit/limiton.png");
		val.smallIconDeselectedSprite = assetbundle.LoadAsset<Sprite>("Assets/ArtifactOfLimit/limitoff.png");
		ArtifactOfLimitManager.myArtifact = val;
		_contentPack.artifactDefs.Add((ArtifactDef[])(object)new ArtifactDef[1] { val });
	}

	private IEnumerator LoadAssetBundle(string assetBundleFullPath, IProgress<float> progress, Action<AssetBundle> onAssetBundleLoaded)
	{
		AssetBundleCreateRequest assetBundleCreateRequest = AssetBundle.LoadFromFileAsync(assetBundleFullPath);
		while (!((AsyncOperation)assetBundleCreateRequest).isDone)
		{
			progress.Report(((AsyncOperation)assetBundleCreateRequest).progress);
			yield return null;
		}
		onAssetBundleLoaded(assetBundleCreateRequest.assetBundle);
	}
}
public static class Config
{
	public static ConfigEntry<string> Whitelist;

	public static ConfigEntry<bool> PrintItemList;

	public static ConfigEntry<int> Tier1ItemCount;

	public static ConfigEntry<float> Tier1DamageTag;

	public static ConfigEntry<float> Tier1HealingTag;

	public static ConfigEntry<float> Tier1UtilityTag;

	public static ConfigEntry<int> Tier2ItemCount;

	public static ConfigEntry<float> Tier2DamageTag;

	public static ConfigEntry<float> Tier2HealingTag;

	public static ConfigEntry<float> Tier2UtilityTag;

	public static ConfigEntry<int> Tier3ItemCount;

	public static ConfigEntry<float> Tier3DamageTag;

	public static ConfigEntry<float> Tier3HealingTag;

	public static ConfigEntry<float> Tier3UtilityTag;

	public static ConfigEntry<bool> AffectVoidItems;

	public static ConfigEntry<int> PityVoidItemCount;

	public static void PopulateConfig(ConfigFile config)
	{
		Whitelist = config.Bind<string>("General", "Whitelist", "", "Whitelist of items that are always included, separated by coma(,). Fill only Tier1, Tier2 and Tier3 items. These items ARE NOT included in tier counts, so adjust number of items in each tier accordingly if you want the number to be the same with these items included. This setting will still respect rulebook.");
		PrintItemList = config.Bind<bool>("General", "Print Item List", false, "Prints item list at the start of the run into the log.");
		Tier1ItemCount = config.Bind<int>("Tier 1", "Total Number of Items", 24, "Total number of Tier 1 items to be used each run.");
		Tier1DamageTag = config.Bind<float>("Tier 1", "Share of Damage Items", 10f, "Share of Tier 1 items with Damage tag. You can use any value you want, since all Share will be added together and then relative will be calculated.");
		Tier1HealingTag = config.Bind<float>("Tier 1", "Share of Healing Items", 6f, "Share of Tier 1 items with Healing tag. You can use any value you want, since all Share will be added together and then relative will be calculated.");
		Tier1UtilityTag = config.Bind<float>("Tier 1", "Share of Utility Items", 8f, "Share of Tier 1 items with Utility tag. You can use any value you want, since all Share will be added together and then relative will be calculated.");
		Tier2ItemCount = config.Bind<int>("Tier 2", "Total Number of Items", 24, "Total number of Tier 2 items to be used each run.");
		Tier2DamageTag = config.Bind<float>("Tier 2", "Share of Damage Items", 12f, "Share of Tier 2 items with Damage tag. You can use any value you want, since all Share will be added together and then relative will be calculated.");
		Tier2HealingTag = config.Bind<float>("Tier 2", "Share of Healing Items", 4f, "Share of Tier 2 items with Healing tag. You can use any value you want, since all Share will be added together and then relative will be calculated.");
		Tier2UtilityTag = config.Bind<float>("Tier 2", "Share of Utility Items", 8f, "Share of Tier 2 items with Utility tag. You can use any value you want, since all Share will be added together and then relative will be calculated.");
		Tier3ItemCount = config.Bind<int>("Tier 3", "Total Number of Items", 21, "Total number of Tier 3 items to be used each run.");
		Tier3DamageTag = config.Bind<float>("Tier 3", "Share of Damage Items", 11f, "Share of Tier 3 items with Damage tag. You can use any value you want, since all Share will be added together and then relative will be calculated.");
		Tier3HealingTag = config.Bind<float>("Tier 3", "Share of Healing Items", 3f, "Share of Tier 3 items with Healing tag. You can use any value you want, since all Share will be added together and then relative will be calculated.");
		Tier3UtilityTag = config.Bind<float>("Tier 3", "Share of Utility Items", 7f, "Share of Tier 3 items with Utility tag. You can use any value you want, since all Share will be added together and then relative will be calculated.");
		AffectVoidItems = config.Bind<bool>("Void Items", "Affect Void Items", true, "Only those Void Items that can be converted from selected Tier1-3 item will be selected. Newly Hatched Zoea (and all VoidBoss items) will be always included.");
		PityVoidItemCount = config.Bind<int>("Void Items", "Pity Void Items Count", 5, "Count of Void Items that will be used if selected item pool has zero corruptable items. Values below 3 will most likely lead to а bad time.");
	}
}
internal static class Log
{
	private static ManualLogSource _logSource;

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

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

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

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

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

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

	internal static void Warning(object data)
	{
		_logSource.LogWarning(data);
	}
}
internal static class ProperSaveCompat
{
	public const string MOD_GUID = "com.KingEnderBrine.ProperSave";

	private static bool? _enabled;

	private const string SAVE_DATA_NAME = "viliger_artifactoflimit_save";

	public static bool enabled
	{
		get
		{
			if (!_enabled.HasValue)
			{
				_enabled = Chainloader.PluginInfos.ContainsKey("com.KingEnderBrine.ProperSave");
			}
			return _enabled.Value;
		}
	}

	public static bool IsFirstRun()
	{
		return Loading.FirstRunStage;
	}

	public static bool IsLoading()
	{
		return Loading.IsLoading;
	}

	public static void RegisterSaveData()
	{
		SaveFile.OnGatherSaveData += SaveFile_OnGatherSaveData;
	}

	public static void LoadItemMask(out ItemMask itemMask)
	{
		Loading.CurrentSave.GetModdedData<ItemMaskData>("viliger_artifactoflimit_save").LoadDataOut(ref itemMask);
	}

	private static void SaveFile_OnGatherSaveData(Dictionary<string, object> saveData)
	{
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Expected O, but got Unknown
		if (RunArtifactManager.instance.IsArtifactEnabled(ArtifactOfLimitManager.myArtifact))
		{
			saveData.Add("viliger_artifactoflimit_save", (object)new ItemMaskData(ArtifactOfLimitManager.newAvailableItems));
		}
	}
}