Decompiled source of Poltergeist Extended v1.0.0

PoltergeistExtended.dll

Decompiled 2 weeks ago
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("OutwardModTemplate")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OutwardModTemplate")]
[assembly: AssemblyCopyright("Copyright ©  2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("c5450fe0-edcf-483f-b9ea-4b1ef9d36da7")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace PoltergeistExtended;

[BepInPlugin("Tchernobill.PoltergeistExtended", "PoltergeistExtended", "1.0.0")]
public class PoltergeistExtended : BaseUnityPlugin
{
	[HarmonyPatch(typeof(RecipeManager), "LoadEnchantingRecipe")]
	public class RecipeManager_LoadEnchantingRecipe
	{
		[HarmonyPostfix]
		public static void Postfix(RecipeManager __instance)
		{
			//IL_0025: 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_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: 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_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Expected O, but got Unknown
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			EnchantmentRecipe val = __instance.m_enchantmentRecipes[92];
			if (!((Object)(object)val != (Object)null) || !(val.CompatibleEquipments.EquipmentTag.Tag.TagName == "Weapon") || val.CompatibleEquipments.CompatibleEquipments.Length != 1)
			{
				return;
			}
			Tag tag = GetTag("Item");
			((UidSelector<Tag>)(object)val.CompatibleEquipments.EquipmentTag).Set(tag);
			List<IngredientData> list = new List<IngredientData>();
			foreach (string tag3 in tagList)
			{
				Tag tag2 = GetTag(tag3);
				IngredientData item = default(IngredientData);
				item.Type = (IngredientType)0;
				item.IngredientTag = new TagSourceSelector(tag2);
				list.Add(item);
			}
			val.CompatibleEquipments.CompatibleEquipments = list.ToArray();
		}
	}

	public const string GUID = "Tchernobill.PoltergeistExtended";

	public const string NAME = "PoltergeistExtended";

	public const string VERSION = "1.0.0";

	public const int PoltergeistId = 92;

	private static List<string> tagList = new List<string> { "Weapon", "Trinket", "Helmet", "Armor", "Boots" };

	internal static ManualLogSource Log;

	internal void Awake()
	{
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		Log = ((BaseUnityPlugin)this).Logger;
		new Harmony("Tchernobill.PoltergeistExtended").PatchAll();
	}

	public static Tag GetTag(string TagName)
	{
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		for (int i = 0; i < TagSourceManager.Instance.m_tags.Length; i++)
		{
			Tag val = TagSourceManager.Instance.m_tags[i];
			if (val.TagName == TagName)
			{
				return val;
			}
		}
		return Tag.None;
	}
}