Decompiled source of MagicPlugin v1.9.1

MagicPlugin.dll

Decompiled 3 weeks ago
using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using AzuExtendedPlayerInventory;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using ItemManager;
using JetBrains.Annotations;
using Jewelcrafting;
using LocalizationManager;
using MagicPlugin.Functions;
using MagicPlugin.JCAdditions;
using MagicPlugin.SE;
using Microsoft.CodeAnalysis;
using ServerSync;
using TMPro;
using UnityEngine;
using UnityEngine.SceneManagement;
using YamlDotNet.Core;
using YamlDotNet.Core.Events;
using YamlDotNet.Core.Tokens;
using YamlDotNet.Helpers;
using YamlDotNet.Serialization;
using YamlDotNet.Serialization.Converters;
using YamlDotNet.Serialization.EventEmitters;
using YamlDotNet.Serialization.NamingConventions;
using YamlDotNet.Serialization.NodeDeserializers;
using YamlDotNet.Serialization.NodeTypeResolvers;
using YamlDotNet.Serialization.ObjectFactories;
using YamlDotNet.Serialization.ObjectGraphTraversalStrategies;
using YamlDotNet.Serialization.ObjectGraphVisitors;
using YamlDotNet.Serialization.Schemas;
using YamlDotNet.Serialization.TypeInspectors;
using YamlDotNet.Serialization.TypeResolvers;
using YamlDotNet.Serialization.Utilities;
using YamlDotNet.Serialization.ValueDeserializers;

[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyTitle("MagicPlugin")]
[assembly: AssemblyDescription("https://valheim.thunderstore.io/package/blacks7ar/MagicPlugin/")]
[assembly: AssemblyConfiguration("")]
[assembly: CompilationRelaxations(8)]
[assembly: AssemblyCompany("blacks7ar")]
[assembly: AssemblyProduct("MagicPlugin")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyFileVersion("1.9.1")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("0119FA22-B3BE-4E92-B9A3-3B9637D974C5")]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.9.1.0")]
[module: UnverifiableCode]
[module: <8a131073-a019-4c5e-aaf2-698655f0c6a9>RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[<e2d04820-e8a7-42ec-a79b-9b7d49817114>Embedded]
	internal sealed class <e2d04820-e8a7-42ec-a79b-9b7d49817114>EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	[<e2d04820-e8a7-42ec-a79b-9b7d49817114>Embedded]
	[CompilerGenerated]
	internal sealed class <b616b9a5-a702-4fad-b30d-16e7703e6aff>NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public <b616b9a5-a702-4fad-b30d-16e7703e6aff>NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public <b616b9a5-a702-4fad-b30d-16e7703e6aff>NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	[CompilerGenerated]
	[<e2d04820-e8a7-42ec-a79b-9b7d49817114>Embedded]
	internal sealed class <2a6f028c-a38d-4e0d-91f9-e724f92deb58>NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public <2a6f028c-a38d-4e0d-91f9-e724f92deb58>NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	[CompilerGenerated]
	[<e2d04820-e8a7-42ec-a79b-9b7d49817114>Embedded]
	internal sealed class <8a131073-a019-4c5e-aaf2-698655f0c6a9>RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public <8a131073-a019-4c5e-aaf2-698655f0c6a9>RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace MagicPlugin
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("blacks7ar.MagicPlugin", "MagicPlugin", "1.9.1")]
	public class Plugin : BaseUnityPlugin
	{
		private const string modGUID = "blacks7ar.MagicPlugin";

		public const string modName = "MagicPlugin";

		public const string modAuthor = "blacks7ar";

		public const string modVersion = "1.9.1";

		public const string modLink = "https://valheim.thunderstore.io/package/blacks7ar/MagicPlugin/";

		private static string configFileName = "blacks7ar.MagicPlugin.cfg";

		private static string configFileFullPath;

		public static readonly ManualLogSource MPLogger;

		private static readonly Harmony _harmony;

		private static readonly ConfigSync _configSync;

		private static ConfigEntry<MagicPlugin.Functions.Toggle> _serverConfigLocked;

		public static ConfigEntry<float> _magicVelocity;

		public static ConfigEntry<float> _magciAccuracy;

		public static ConfigEntry<MagicSource> _magicSource;

		public static ConfigEntry<MagicPlugin.Functions.Toggle> _enableExpMultiplier;

		public static ConfigEntry<MagicPlugin.Functions.Toggle> _displayExpGained;

		public static ConfigEntry<float> _bmExpMultiplier;

		public static ConfigEntry<float> _emExpMultiplier;

		public static ConfigEntry<MagicPlugin.Functions.Toggle> _enableTomeSlot;

		public static ConfigEntry<MagicPlugin.Functions.Toggle> _enableEarringSlot;

		public static GameObject _PrefabContainer;

		public static Sprite _skullTotemIcon;

		public static Sprite _neckTotemIcon;

		public static Sprite _wolfTotemIcon;

		public static Sprite _crystalTotemIcon;

		public static Sprite _modersIcon;

		public static Sprite _yagluthsIcon;

		public static GameObject _skullTotemProjectile;

		public static GameObject _armoredSkellies;

		public static AssetBundle _magicBundle;

		public static Plugin _Instance;

		public ConfigEntry<T> config<T>(string group, string name, T value, ConfigDescription description, bool _synchronizedConfig = true)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			ConfigDescription val = new ConfigDescription(description.Description + (_synchronizedConfig ? " [Synced with Server]" : " [Not Synced with Server]"), description.AcceptableValues, description.Tags);
			ConfigEntry<T> val2 = ((BaseUnityPlugin)this).Config.Bind<T>(group, name, value, val);
			_configSync.AddConfigEntry<T>(val2).SynchronizedConfig = _synchronizedConfig;
			return val2;
		}

		private void ConfigWatcher()
		{
			FileSystemWatcher fileSystemWatcher = new FileSystemWatcher(Paths.ConfigPath, configFileName);
			fileSystemWatcher.Changed += OnConfigChanged;
			fileSystemWatcher.Created += OnConfigChanged;
			fileSystemWatcher.Renamed += OnConfigChanged;
			fileSystemWatcher.IncludeSubdirectories = true;
			fileSystemWatcher.SynchronizingObject = ThreadingHelper.SynchronizingObject;
			fileSystemWatcher.EnableRaisingEvents = true;
		}

		private void OnConfigChanged(object sender, FileSystemEventArgs e)
		{
			if (!File.Exists(configFileFullPath))
			{
				return;
			}
			try
			{
				Logging.LogDebug("OnConfigChanged called..");
				((BaseUnityPlugin)this).Config.Reload();
			}
			catch
			{
				Logging.LogError("There was an issue loading your " + configFileName);
				Logging.LogError("Please check you config entries for spelling and format!");
			}
		}

		public void Awake()
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Expected O, but got Unknown
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Expected O, but got Unknown
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Expected O, but got Unknown
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Expected O, but got Unknown
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Expected O, but got Unknown
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Expected O, but got Unknown
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Expected O, but got Unknown
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Expected O, but got Unknown
			//IL_022f: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: Expected O, but got Unknown
			//IL_0268: Unknown result type (might be due to invalid IL or missing references)
			//IL_0273: Expected O, but got Unknown
			_Instance = this;
			Localizer.Load();
			_magicBundle = PrefabManager.RegisterAssetBundle("magicbundle");
			_serverConfigLocked = config("1- ServerSync", "Lock Configuration", MagicPlugin.Functions.Toggle.On, new ConfigDescription("If On, the configuration is locked and can be changed by server admins only.", (AcceptableValueBase)null, Array.Empty<object>()));
			_configSync.AddLockingConfigEntry<MagicPlugin.Functions.Toggle>(_serverConfigLocked);
			_magicVelocity = config("2- General", "Velocity Multiplier", 2f, new ConfigDescription("Magic projectiles velocity multiplier.\nRecommended: 2", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 5f), Array.Empty<object>()));
			_magciAccuracy = config("2- General", "Accuracy Multiplier", 0f, new ConfigDescription("Magic projectiles accuracy multiplier.\nRecommended: 0", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), new object[1]
			{
				new MagicPlugin.Functions.ConfigurationManagerAttributes
				{
					ShowRangeAsPercent = false
				}
			}));
			_magicSource = config("2- General", "Magic Source", MagicSource.Eitr, new ConfigDescription("What fuels your magic?", (AcceptableValueBase)null, Array.Empty<object>()));
			_enableTomeSlot = config("2- General", "Enable Tome Slot", MagicPlugin.Functions.Toggle.On, new ConfigDescription("If On, tomes or books has a dedicated slot when using Azu ExtendPlayerInventory mod.", (AcceptableValueBase)null, Array.Empty<object>()));
			_enableTomeSlot.SettingChanged += delegate
			{
				MagicSlot.AddCustomSlot(_enableTomeSlot);
			};
			MagicSlot.AddCustomSlot(_enableTomeSlot);
			_enableEarringSlot = config("2- General", "Enable Earring Slot", MagicPlugin.Functions.Toggle.On, new ConfigDescription("If On, earrings has a dedicated slot when using Azu ExtendedPlayerInventory mod.", (AcceptableValueBase)null, Array.Empty<object>()));
			_enableEarringSlot.SettingChanged += delegate
			{
				MagicSlot.AddCustomSlot(_enableEarringSlot);
			};
			MagicSlot.AddCustomSlot(_enableEarringSlot);
			_enableExpMultiplier = config("4- Skill Exp", "Enable Exp Multiplier", MagicPlugin.Functions.Toggle.On, new ConfigDescription("Enable/Disables exp multiplier.", (AcceptableValueBase)null, Array.Empty<object>()));
			_displayExpGained = config("4- Skill Exp", "Display Exp Gained", MagicPlugin.Functions.Toggle.On, new ConfigDescription("Enable/Disables exp gain notifications", (AcceptableValueBase)null, Array.Empty<object>()));
			_bmExpMultiplier = config("4- Skill Exp", "BloodMagic Exp Multiplier", 1f, new ConfigDescription("Exp multiplier for BloodMagic skill.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 5f), Array.Empty<object>()));
			_emExpMultiplier = config("4- Skill Exp", "ElementalMagic Exp Multiplier", 1f, new ConfigDescription("Exp multiplier for ElementalMagic skill.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 5f), Array.Empty<object>()));
			PrefabContainer();
			ConfigSetup.Init();
			PrefabsSetup.Init();
			RingsAndNecklaces.Init();
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			_harmony.PatchAll(executingAssembly);
			ConfigWatcher();
		}

		private void OnDestroy()
		{
			((BaseUnityPlugin)this).Config.Save();
		}

		public static void PrefabContainer()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Expected O, but got Unknown
			_PrefabContainer = new GameObject("BMP_ClonedPrefabs");
			_PrefabContainer.SetActive(false);
			Object.DontDestroyOnLoad((Object)(object)_PrefabContainer);
		}

		static Plugin()
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Expected O, but got Unknown
			string configPath = Paths.ConfigPath;
			char directorySeparatorChar = Path.DirectorySeparatorChar;
			configFileFullPath = configPath + directorySeparatorChar + configFileName;
			MPLogger = Logger.CreateLogSource("MagicPlugin");
			_harmony = new Harmony("blacks7ar.MagicPlugin");
			_configSync = new ConfigSync("blacks7ar.MagicPlugin")
			{
				DisplayName = "MagicPlugin",
				CurrentVersion = "1.9.1",
				MinimumRequiredVersion = "1.9.1",
				ModRequired = true
			};
		}
	}
}
namespace MagicPlugin.SE
{
	public class AddEitrAndRegen : StatusEffect
	{
		public float m_eitr;

		public void Awake()
		{
			base.m_tooltip = "Boost wearer's Eitr and Eitr regen." + $"\n<color=orange>Eitr: +{m_eitr}</color>";
		}

		public void SetEitr(float eitr)
		{
			m_eitr = eitr;
			base.m_tooltip = "Boost wearer's Eitr and Eitr regen." + $"\n<color=orange>Eitr: +{m_eitr}</color>";
		}
	}
	public class ArcticBuff : StatusEffect
	{
		private float m_eitrRegen;

		public void Awake()
		{
			base.m_name = "Arctic Buff";
			((Object)this).name = base.m_name;
			base.m_tooltip = $"The Polarwolf armor set gives enough protection against cold and freezing. It is imbued with magic so its wearer will replenish eitr faster.\n\nEitr regen increased by <color=orange>+{Mathf.FloorToInt(m_eitrRegen)}%\nResistant</color> VS <color=orange>Cold</color> and <color=orange>Freezing</color>";
		}

		public void SetEitrRegen(float bonus)
		{
			m_eitrRegen = bonus;
			base.m_tooltip = $"The Polarwolf armor set gives enough protection against cold and freezing. It is imbued with magic so its wearer will replenish eitr faster.\n\nEitr regen increased by <color=orange>+{Mathf.FloorToInt(m_eitrRegen)}%\nResistant</color> VS <color=orange>Cold</color> and <color=orange>Freezing</color>";
		}

		public override void ModifyEitrRegen(ref float eitrRegen)
		{
			eitrRegen += m_eitrRegen / 100f;
		}
	}
	public class AddEitr : StatusEffect
	{
		public float m_Eitr;

		public void Awake()
		{
			base.m_tooltip = "Increase wearer's Eitr." + $"\n<color=orange>Eitr: +{m_Eitr}</color>";
		}

		public void SetEitr(float value)
		{
			m_Eitr = value;
			base.m_tooltip = "Increase wearer's Eitr." + $"\n<color=orange>Eitr: +{m_Eitr}</color>";
		}
	}
	public class Elementalist : StatusEffect
	{
		public float m_elementalMagic;

		public void Awake()
		{
			((Object)this).name = "bmp_elementalist";
			base.m_name = "Elementalist Belt";
			base.m_tooltip = "Boost Elemental Magics skill level." + $"\n<color=orange>ElementalMagic: +{m_elementalMagic}</color>";
		}

		public void SetElementalMagic(float value)
		{
			m_elementalMagic = value;
			base.m_tooltip = "Boost Elemental Magics skill level." + $"\n<color=orange>ElementalMagic: +{m_elementalMagic}</color>";
		}
	}
	public class ForestMagic : StatusEffect
	{
		private float m_eitrRegen;

		public void Awake()
		{
			base.m_name = "Forest Magic";
			((Object)this).name = base.m_name;
			base.m_tooltip = $"This pair of armor doesn't give enough armor defense to its wearer but will be beneficial to a newborn Mage.\n\nEitr regen increased by <color=orange>+{Mathf.FloorToInt(m_eitrRegen)}%</color>";
		}

		public void SetEitrRegen(float bonus)
		{
			m_eitrRegen = bonus;
			base.m_tooltip = $"This pair of armor doesn't give enough armor defense to its wearer but will be beneficial to a newborn Mage.\n\nEitr regen increased by <color=orange>+{Mathf.FloorToInt(m_eitrRegen)}%</color>";
		}

		public override void ModifyEitrRegen(ref float eitrRegen)
		{
			eitrRegen += m_eitrRegen / 100f;
		}
	}
	public class HealGroup : StatusEffect
	{
		public float m_healthOverTime;

		public float m_healthOverTimeInterval;

		public float m_healthOverTimeDuration;

		public float m_healthOverTimeTimer;

		public float m_healthOverTimeTicks;

		public float m_healthOverTimeTickHP;

		public void Awake()
		{
			base.m_name = "Staff Of Healing";
			((Object)this).name = "healstaff_cooldown";
			base.m_tooltip = "Heals everyone over time." + $"\n<color=orange>HealOverTime: {Mathf.FloorToInt(m_healthOverTime / (m_healthOverTimeDuration / m_healthOverTimeInterval))}</color>" + $"\n<color=orange>Duration: {m_healthOverTimeDuration}secs</color>";
			base.m_icon = ((IEnumerable<Sprite>)Resources.FindObjectsOfTypeAll<Sprite>()).FirstOrDefault((Func<Sprite, bool>)((Sprite x) => ((Object)x).name == "health_icon"));
		}

		public void SetHealthOverTimeInterval(float value)
		{
			m_healthOverTimeInterval = value;
			base.m_tooltip = "Heals everyone over time." + $"\n<color=orange>HealOverTime: {Mathf.FloorToInt(m_healthOverTime / (m_healthOverTimeDuration / m_healthOverTimeInterval))}</color>" + $"\n<color=orange>Duration: {m_healthOverTimeDuration}secs</color>";
		}

		public void SetHealthOverTime(float value)
		{
			m_healthOverTime = value;
			base.m_tooltip = "Heals everyone over time." + $"\n<color=orange>HealOverTime: {Mathf.FloorToInt(m_healthOverTime / (m_healthOverTimeDuration / m_healthOverTimeInterval))}</color>" + $"\n<color=orange>Duration: {m_healthOverTimeDuration}secs</color>";
		}

		public void SetHealthOverTimeDuration(float value)
		{
			m_healthOverTimeDuration = value;
			base.m_tooltip = "Heals everyone over time." + $"\n<color=orange>HealOverTime: {Mathf.FloorToInt(m_healthOverTime / (m_healthOverTimeDuration / m_healthOverTimeInterval))}</color>" + $"\n<color=orange>Duration: {m_healthOverTimeDuration}secs</color>";
		}

		public override void Setup(Character character)
		{
			((StatusEffect)this).Setup(character);
			if (m_healthOverTime > 0f && m_healthOverTimeInterval > 0f)
			{
				if (m_healthOverTimeDuration <= 0f)
				{
					m_healthOverTimeDuration = base.m_ttl;
				}
				m_healthOverTimeTicks = m_healthOverTimeDuration / m_healthOverTimeInterval;
				m_healthOverTimeTickHP = m_healthOverTime / m_healthOverTimeTicks;
			}
		}

		public override void UpdateStatusEffect(float dt)
		{
			((StatusEffect)this).UpdateStatusEffect(dt);
			if (m_healthOverTimeTicks > 0f)
			{
				m_healthOverTimeTimer += dt;
				if (m_healthOverTimeTimer > m_healthOverTimeInterval)
				{
					m_healthOverTimeTimer = 0f;
					m_healthOverTimeTicks -= 1f;
					base.m_character.Heal(m_healthOverTimeTickHP, true);
				}
			}
		}
	}
	public class Hogwarts : StatusEffect
	{
		public float m_damageMultiplier;

		public void Awake()
		{
			((Object)this).name = "bmp_hogwarts";
			base.m_name = "Hogwarts Belt";
			base.m_tooltip = "Boost wearer's elemental damages." + $"\n<color=orange>Damage Multiplier: {m_damageMultiplier}x</color>";
		}

		public void SetDamageMultiplier(float value)
		{
			m_damageMultiplier = value;
			base.m_tooltip = "Boost wearer's elemental damages." + $"\n<color=orange>Damage Multiplier: {m_damageMultiplier}x</color>";
		}
	}
	public class Necromancer : StatusEffect
	{
		public float m_bloodMagic;

		public void Awake()
		{
			((Object)this).name = "bmp_necromancer";
			base.m_name = "Necromancers Belt";
			base.m_tooltip = "Boost Blood Magics skill level." + $"\n<color=orange>BloodMagic: +{m_bloodMagic}</color>";
		}

		public void SetBloodMagic(float value)
		{
			m_bloodMagic = value;
			base.m_tooltip = "Boost Blood Magics skill level." + $"\n<color=orange>BloodMagic: +{m_bloodMagic}</color>";
		}
	}
}
namespace MagicPlugin.Patches
{
	[HarmonyPatch]
	public class AttackPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(Attack), "Start")]
		public static void AttackStart_Postfix(Attack __instance)
		{
			if (__instance == null)
			{
				return;
			}
			Humanoid character = __instance.m_character;
			Player val = (Player)(object)((character is Player) ? character : null);
			if (val == null)
			{
				return;
			}
			string name = __instance.m_weapon.m_shared.m_name;
			if (name == null)
			{
				return;
			}
			switch (name.Length)
			{
			case 18:
				switch (name[5])
				{
				case 's':
					if (name == "$bmp_surtlingstaff")
					{
						float damageMultiplier9 = 1f + 2f * ((Character)val).GetSkillFactor((SkillType)9);
						__instance.m_weapon.m_shared.m_attack.m_damageMultiplier = damageMultiplier9;
					}
					break;
				case 'e':
					if (name == "$bmp_eikthyrsstaff")
					{
						float damageMultiplier10 = 1f + 2f * ((Character)val).GetSkillFactor((SkillType)9);
						__instance.m_weapon.m_shared.m_attack.m_damageMultiplier = damageMultiplier10;
					}
					break;
				case 'l':
					if (name == "$bmp_lightningwand")
					{
						float damageMultiplier8 = 1f + 2f * ((Character)val).GetSkillFactor((SkillType)9);
						__instance.m_weapon.m_shared.m_attack.m_damageMultiplier = damageMultiplier8;
					}
					break;
				}
				break;
			case 16:
				switch (name[5])
				{
				case 'a':
					if (name == "$bmp_arcticstaff")
					{
						float damageMultiplier6 = 1f + 2f * ((Character)val).GetSkillFactor((SkillType)9);
						__instance.m_weapon.m_shared.m_attack.m_damageMultiplier = damageMultiplier6;
					}
					break;
				case 'p':
					if (name == "$bmp_poisonstaff")
					{
						float damageMultiplier5 = 1f + 2f * ((Character)val).GetSkillFactor((SkillType)9);
						__instance.m_weapon.m_shared.m_attack.m_damageMultiplier = damageMultiplier5;
					}
					break;
				}
				break;
			case 15:
				switch (name[5])
				{
				case 'f':
					if (name == "$bmp_flamestaff")
					{
						float damageMultiplier3 = 1f + 2f * ((Character)val).GetSkillFactor((SkillType)9);
						__instance.m_weapon.m_shared.m_attack.m_damageMultiplier = damageMultiplier3;
					}
					break;
				case 'p':
					if (name == "$bmp_poisonwand")
					{
						float damageMultiplier2 = 1f + 2f * ((Character)val).GetSkillFactor((SkillType)9);
						__instance.m_weapon.m_shared.m_attack.m_damageMultiplier = damageMultiplier2;
					}
					break;
				}
				break;
			case 14:
				switch (name[5])
				{
				case 's':
					if (name == "$bmp_staffheal")
					{
						((Character)val).RaiseSkill((SkillType)10, 0.1f);
					}
					break;
				case 'f':
					if (name == "$bmp_flamewand")
					{
						float damageMultiplier11 = 1f + 2f * ((Character)val).GetSkillFactor((SkillType)9);
						__instance.m_weapon.m_shared.m_attack.m_damageMultiplier = damageMultiplier11;
					}
					break;
				}
				break;
			case 19:
				if (name == "$bmp_lightningstaff")
				{
					float damageMultiplier7 = 1f + 2f * ((Character)val).GetSkillFactor((SkillType)9);
					__instance.m_weapon.m_shared.m_attack.m_damageMultiplier = damageMultiplier7;
				}
				break;
			case 17:
				if (name == "$bmp_thunderstaff")
				{
					float damageMultiplier4 = 1f + 2f * ((Character)val).GetSkillFactor((SkillType)9);
					__instance.m_weapon.m_shared.m_attack.m_damageMultiplier = damageMultiplier4;
				}
				break;
			case 12:
				if (name == "$bmp_icewand")
				{
					float damageMultiplier = 1f + 2f * ((Character)val).GetSkillFactor((SkillType)9);
					__instance.m_weapon.m_shared.m_attack.m_damageMultiplier = damageMultiplier;
				}
				break;
			case 13:
				break;
			}
		}

		[HarmonyPatch(typeof(Attack), "FireProjectileBurst")]
		[HarmonyPrefix]
		public static bool FireProjectileBurst_Prefix(Attack __instance)
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Invalid comparison between Unknown and I4
			//IL_0674: Unknown result type (might be due to invalid IL or missing references)
			//IL_083b: Unknown result type (might be due to invalid IL or missing references)
			if (__instance != null)
			{
				Humanoid character = __instance.m_character;
				Player player = (Player)(object)((character is Player) ? character : null);
				if (player != null)
				{
					SkillType skillType = __instance.m_weapon.m_shared.m_skillType;
					if (__instance.m_weapon == null || (int)skillType != 9)
					{
						return true;
					}
					string name = __instance.m_weapon.m_shared.m_name;
					if (__instance.m_weapon.m_shared.m_name.EndsWith("scepter") || __instance.m_weapon.m_shared.m_name.Contains("flamestaff") || __instance.m_weapon.m_shared.m_name.Contains("thunderstaff") || (__instance.m_weapon.m_shared.m_name.StartsWith("$bmr_") && __instance.m_weapon.m_shared.m_name.EndsWith("staff")))
					{
						return true;
					}
					if ((Object)(object)__instance.m_weapon.m_shared.m_secondaryAttack.m_attackProjectile != (Object)null && ((Object)__instance.m_weapon.m_shared.m_secondaryAttack.m_attackProjectile).name == "BDS_DvergerStaffFire_clusterbomb_projectile")
					{
						return true;
					}
					if ((name == "$bmp_arcticstaff" || name == "$item_stafficeshards") ? true : false)
					{
						Attack obj = __instance;
						obj.m_projectileVel *= 1.2f;
						Attack obj2 = __instance;
						obj2.m_projectileVelMin *= 1.2f;
						Attack obj3 = __instance;
						obj3.m_projectileAccuracy *= 0f;
						Attack obj4 = __instance;
						obj4.m_projectileAccuracyMin *= 0f;
					}
					else
					{
						Plugin._magicVelocity.SettingChanged += delegate
						{
							Attack obj11 = __instance;
							obj11.m_projectileVel *= Plugin._magicVelocity.Value;
							Attack obj12 = __instance;
							obj12.m_projectileVelMin *= Plugin._magicVelocity.Value;
						};
						Attack obj5 = __instance;
						obj5.m_projectileVel *= Plugin._magicVelocity.Value;
						Attack obj6 = __instance;
						obj6.m_projectileVelMin *= Plugin._magicVelocity.Value;
						Plugin._magciAccuracy.SettingChanged += delegate
						{
							Attack obj9 = __instance;
							obj9.m_projectileAccuracy *= Plugin._magciAccuracy.Value;
							Attack obj10 = __instance;
							obj10.m_projectileAccuracyMin *= Plugin._magciAccuracy.Value;
						};
						Attack obj7 = __instance;
						obj7.m_projectileAccuracy *= Plugin._magciAccuracy.Value;
						Attack obj8 = __instance;
						obj8.m_projectileAccuracyMin *= Plugin._magciAccuracy.Value;
					}
					if (((Object)__instance.m_attackProjectile).name.ToLower().Contains("surtlingstaff"))
					{
						ConfigSetup._surtlingStaffAOE.SettingChanged += delegate
						{
							__instance.m_attackProjectile.gameObject.GetComponent<Projectile>().m_aoe = ConfigSetup._surtlingStaffAOE.Value + 2f * ((Character)player).GetSkillFactor((SkillType)9);
						};
						__instance.m_attackProjectile.gameObject.GetComponent<Projectile>().m_aoe = ConfigSetup._surtlingStaffAOE.Value + 2f * ((Character)player).GetSkillFactor((SkillType)9);
					}
					if (((Object)__instance.m_attackProjectile).name.ToLower().Contains("eikthyrsstaff"))
					{
						ConfigSetup._eikthyrStaffAOE.SettingChanged += delegate
						{
							__instance.m_attackProjectile.gameObject.GetComponent<Projectile>().m_aoe = ConfigSetup._eikthyrStaffAOE.Value + 2f * ((Character)player).GetSkillFactor((SkillType)9);
						};
						__instance.m_attackProjectile.gameObject.GetComponent<Projectile>().m_aoe = ConfigSetup._eikthyrStaffAOE.Value + 2f * ((Character)player).GetSkillFactor((SkillType)9);
					}
					if (((Object)__instance.m_attackProjectile).name.ToLower().Contains("lightningstaff"))
					{
						ConfigSetup._lightningStaffAOE.SettingChanged += delegate
						{
							__instance.m_attackProjectile.gameObject.GetComponent<Projectile>().m_aoe = ConfigSetup._lightningStaffAOE.Value + 2f * ((Character)player).GetSkillFactor((SkillType)9);
						};
						__instance.m_attackProjectile.gameObject.GetComponent<Projectile>().m_aoe = ConfigSetup._lightningStaffAOE.Value + 2f * ((Character)player).GetSkillFactor((SkillType)9);
					}
					if (((Object)__instance.m_attackProjectile).name.ToLower().Contains("poisonstaff"))
					{
						ConfigSetup._poisonStaffAOE.SettingChanged += delegate
						{
							__instance.m_attackProjectile.gameObject.GetComponent<Projectile>().m_aoe = ConfigSetup._poisonStaffAOE.Value + 2f * ((Character)player).GetSkillFactor((SkillType)9);
						};
						__instance.m_attackProjectile.gameObject.GetComponent<Projectile>().m_aoe = ConfigSetup._poisonStaffAOE.Value + 2f * ((Character)player).GetSkillFactor((SkillType)9);
					}
					if (((Object)__instance.m_attackProjectile).name.ToLower().Contains("arcticstaff"))
					{
						ConfigSetup._arcticStaffAOE.SettingChanged += delegate
						{
							__instance.m_attackProjectile.gameObject.GetComponent<Projectile>().m_aoe = ConfigSetup._arcticStaffAOE.Value + 2f * ((Character)player).GetSkillFactor((SkillType)9);
						};
						__instance.m_attackProjectile.gameObject.GetComponent<Projectile>().m_aoe = ConfigSetup._arcticStaffAOE.Value + 2f * ((Character)player).GetSkillFactor((SkillType)9);
					}
					if (((Object)__instance.m_attackProjectile).name == "bmp_spawn_iceblast")
					{
						SpawnAbility component = __instance.m_attackProjectile.gameObject.GetComponent<SpawnAbility>();
						Projectile iceblast = component.m_spawnPrefab[0].gameObject.GetComponent<Projectile>();
						ConfigSetup._modersAoeRange.SettingChanged += delegate
						{
							iceblast.m_aoe = ConfigSetup._modersAoeRange.Value + 2f * ((Character)player).GetSkillFactor((SkillType)9);
						};
						iceblast.m_aoe = ConfigSetup._modersAoeRange.Value + 2f * ((Character)player).GetSkillFactor((SkillType)9);
						ConfigSetup._modersChopDamage.SettingChanged += delegate
						{
							iceblast.m_damage.m_chop = ConfigSetup._modersChopDamage.Value;
						};
						iceblast.m_damage.m_chop = ConfigSetup._modersChopDamage.Value;
						ConfigSetup._modersFrostDamage.SettingChanged += delegate
						{
							iceblast.m_damage.m_frost = ConfigSetup._modersFrostDamage.Value + ConfigSetup._modersFrostDamage.Value * ((Character)player).GetSkillFactor((SkillType)9);
						};
						iceblast.m_damage.m_frost = ConfigSetup._modersFrostDamage.Value + ConfigSetup._modersFrostDamage.Value * ((Character)player).GetSkillFactor((SkillType)9);
						ConfigSetup._modersPickaxeDamage.SettingChanged += delegate
						{
							iceblast.m_damage.m_pickaxe = ConfigSetup._modersPickaxeDamage.Value;
						};
						iceblast.m_damage.m_pickaxe = ConfigSetup._modersPickaxeDamage.Value;
						ConfigSetup._modersPierceDamage.SettingChanged += delegate
						{
							iceblast.m_damage.m_pierce = ConfigSetup._modersPierceDamage.Value;
						};
						iceblast.m_damage.m_pierce = ConfigSetup._modersPierceDamage.Value;
						component.m_spawnAtTarget = true;
						component.m_spawnRadius = 16f;
						component.m_spawnDelay = 0.03f;
						component.m_targetType = (TargetType)0;
						component.m_maxTargetRange = 10f;
					}
					if (((Object)__instance.m_attackProjectile).name == "bmp_spawn_meteors")
					{
						SpawnAbility component2 = __instance.m_attackProjectile.gameObject.GetComponent<SpawnAbility>();
						Projectile meteors = component2.m_spawnPrefab[0].gameObject.GetComponent<Projectile>();
						ConfigSetup._yagluthAoeRange.SettingChanged += delegate
						{
							meteors.m_aoe = ConfigSetup._yagluthAoeRange.Value + 2f * ((Character)player).GetSkillFactor((SkillType)9);
						};
						meteors.m_aoe = ConfigSetup._yagluthAoeRange.Value + 2f * ((Character)player).GetSkillFactor((SkillType)9);
						ConfigSetup._yagluthBluntDamage.SettingChanged += delegate
						{
							meteors.m_damage.m_blunt = ConfigSetup._yagluthBluntDamage.Value;
						};
						meteors.m_damage.m_blunt = ConfigSetup._yagluthBluntDamage.Value;
						ConfigSetup._yagluthChopDamage.SettingChanged += delegate
						{
							meteors.m_damage.m_chop = ConfigSetup._yagluthChopDamage.Value;
						};
						meteors.m_damage.m_chop = ConfigSetup._yagluthChopDamage.Value;
						ConfigSetup._yagluthFireDamage.SettingChanged += delegate
						{
							meteors.m_damage.m_fire = ConfigSetup._yagluthFireDamage.Value + ConfigSetup._yagluthFireDamage.Value * ((Character)player).GetSkillFactor((SkillType)9);
						};
						meteors.m_damage.m_fire = ConfigSetup._yagluthFireDamage.Value + ConfigSetup._yagluthFireDamage.Value * ((Character)player).GetSkillFactor((SkillType)9);
						ConfigSetup._yagluthPickaxeDamage.SettingChanged += delegate
						{
							meteors.m_damage.m_pickaxe = ConfigSetup._yagluthPickaxeDamage.Value;
						};
						meteors.m_damage.m_pickaxe = ConfigSetup._yagluthPickaxeDamage.Value;
						component2.m_spawnAtTarget = true;
						component2.m_spawnRadius = 16f;
						component2.m_spawnDelay = 0.03f;
						component2.m_targetType = (TargetType)0;
						component2.m_maxTargetRange = 10f;
					}
					return true;
				}
			}
			return true;
		}
	}
	[HarmonyPatch]
	public class DestructiblePatch
	{
		[HarmonyPatch(typeof(Destructible), "RPC_Damage")]
		public static class RpcDamagePatch
		{
			private static bool Prefix(Destructible __instance, HitData hit)
			{
				//IL_0049: Unknown result type (might be due to invalid IL or missing references)
				//IL_004f: Invalid comparison between Unknown and I4
				//IL_00da: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e0: Invalid comparison between Unknown and I4
				//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e9: Invalid comparison between Unknown and I4
				Character attacker = hit.GetAttacker();
				Player val = (Player)(object)((attacker is Player) ? attacker : null);
				if (val == null || ((Humanoid)val).GetCurrentWeapon() == null || ((Humanoid)val).GetCurrentWeapon() == ((Humanoid)val).m_unarmedWeapon.m_itemData)
				{
					return true;
				}
				if (((Object)((Humanoid)val).GetCurrentWeapon().m_dropPrefab).name == "BMP_SurtlingStaff" && (int)__instance.m_destructibleType == 2 && hit.m_damage.m_chop > 0f && __instance.m_nview.IsValid() && __instance.m_nview.IsOwner())
				{
					hit.m_toolTier = (short)((Humanoid)val).GetCurrentWeapon().m_quality;
					((Character)val).RaiseSkill((SkillType)13, 0.2f);
				}
				if ((((Object)((Humanoid)val).GetCurrentWeapon().m_dropPrefab).name == "BMP_EikthyrsStaff" || ((Object)((Humanoid)val).GetCurrentWeapon().m_dropPrefab).name == "BMP_LightningStaff") && (int)__instance.m_damages.m_pickaxe != 3 && (int)__instance.m_destructibleType != 2 && hit.m_damage.m_pickaxe > 0f && __instance.m_nview.IsValid() && __instance.m_nview.IsOwner())
				{
					hit.m_toolTier = (short)((Humanoid)val).GetCurrentWeapon().m_quality;
					((Character)val).RaiseSkill((SkillType)12, 0.2f);
				}
				return true;
			}
		}
	}
	[HarmonyPatch]
	public class HumanoidPatch
	{
		[HarmonyPatch(typeof(Humanoid), "IsItemEquiped")]
		[HarmonyPostfix]
		private static void IsItemEquipped_Postfix(Humanoid __instance, ItemData item, ref bool __result)
		{
			Player val = (Player)(object)((__instance is Player) ? __instance : null);
			if (val != null && MagicSlot._magicSlots.TryGetValue(((Humanoid)val).m_visEquipment, out var value) && (value._equippedTomeItem == item || value._equippedEarringItem == item))
			{
				__result = true;
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Humanoid), "SetupVisEquipment")]
		private static void SetupVisEquipment_Prefix(Humanoid __instance)
		{
			Player val = (Player)(object)((__instance is Player) ? __instance : null);
			if (val != null && MagicSlot._magicSlots.TryGetValue(((Humanoid)val).m_visEquipment, out var value))
			{
				value.SetTomeItem((value._equippedTomeItem == null) ? "" : ((Object)value._equippedTomeItem.m_dropPrefab).name);
				value.SetEarringItem((value._equippedEarringItem == null) ? "" : ((Object)value._equippedEarringItem.m_dropPrefab).name);
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Humanoid), "UnequipAllItems")]
		private static void UnEquipAllItems_Prefix(Humanoid __instance)
		{
			Player val = (Player)(object)((__instance is Player) ? __instance : null);
			if (val != null)
			{
				((Humanoid)val).UnequipItem(MagicSlot._magicSlots[((Humanoid)val).m_visEquipment]._equippedTomeItem, false);
				((Humanoid)val).UnequipItem(MagicSlot._magicSlots[((Humanoid)val).m_visEquipment]._equippedEarringItem, false);
			}
		}

		[HarmonyPatch(typeof(Humanoid), "EquipItem")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> EquipItemTranspiler(IEnumerable<CodeInstruction> instructions)
		{
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Expected O, but got Unknown
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Expected O, but got Unknown
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Expected O, but got Unknown
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Expected O, but got Unknown
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Expected O, but got Unknown
			List<CodeInstruction> list = instructions.ToList();
			int num = list.FindLastIndex((CodeInstruction i) => CodeInstructionExtensions.LoadsConstant(i, (Enum)(object)(ItemType)18));
			Label? label = default(Label?);
			do
			{
				num++;
			}
			while (!CodeInstructionExtensions.Branches(list[num], ref label));
			list.InsertRange(num + 1, (IEnumerable<CodeInstruction>)(object)new CodeInstruction[5]
			{
				new CodeInstruction(OpCodes.Ldarg_0, (object)null),
				new CodeInstruction(OpCodes.Ldarg_1, (object)null),
				new CodeInstruction(OpCodes.Ldarg_2, (object)null),
				new CodeInstruction(OpCodes.Call, (object)AccessTools.DeclaredMethod(typeof(HumanoidPatch), "EquipItem", (Type[])null, (Type[])null)),
				new CodeInstruction(OpCodes.Brtrue, (object)label.Value)
			});
			return list;
		}

		[HarmonyTranspiler]
		[HarmonyPatch(typeof(Humanoid), "UnequipItem")]
		private static IEnumerable<CodeInstruction> UnEquipItemTranspiler(IEnumerable<CodeInstruction> instructions)
		{
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Expected O, but got Unknown
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Expected O, but got Unknown
			MethodInfo methodInfo = AccessTools.DeclaredMethod(typeof(Humanoid), "SetupEquipment", (Type[])null, (Type[])null);
			List<CodeInstruction> list = instructions.ToList();
			int num = list.FindIndex((CodeInstruction i) => CodeInstructionExtensions.Calls(i, methodInfo));
			list.InsertRange(num - 1, (IEnumerable<CodeInstruction>)(object)new CodeInstruction[3]
			{
				new CodeInstruction(OpCodes.Ldarg_0, (object)null),
				new CodeInstruction(OpCodes.Ldarg_1, (object)null),
				new CodeInstruction(OpCodes.Call, (object)AccessTools.DeclaredMethod(typeof(HumanoidPatch), "UnEquipItem", (Type[])null, (Type[])null))
			});
			return list;
		}

		[HarmonyTranspiler]
		[HarmonyPatch(typeof(Humanoid), "UpdateEquipmentStatusEffects")]
		private static IEnumerable<CodeInstruction> StatusEffectsTranspiler(IEnumerable<CodeInstruction> instructions)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Expected O, but got Unknown
			List<CodeInstruction> list = instructions.ToList();
			list.InsertRange(2, (IEnumerable<CodeInstruction>)(object)new CodeInstruction[3]
			{
				new CodeInstruction(OpCodes.Ldarg_0, (object)null),
				new CodeInstruction(OpCodes.Ldloc_0, (object)null),
				new CodeInstruction(OpCodes.Call, (object)AccessTools.DeclaredMethod(typeof(HumanoidPatch), "AddStatusEffects", (Type[])null, (Type[])null))
			});
			return list;
		}

		private static bool EquipItem(Humanoid humanoid, ItemData item, bool triggerEquipmentEffects)
		{
			Player val = (Player)(object)((humanoid is Player) ? humanoid : null);
			if (val == null)
			{
				return false;
			}
			if (MagicSlot.IsTomeItem(item))
			{
				((Humanoid)val).UnequipItem(MagicSlot._magicSlots[((Humanoid)val).m_visEquipment]._equippedTomeItem, triggerEquipmentEffects);
				MagicSlot._magicSlots[((Humanoid)val).m_visEquipment]._equippedTomeItem = item;
				return true;
			}
			if (MagicSlot.IsEarringItem(item))
			{
				((Humanoid)val).UnequipItem(MagicSlot._magicSlots[((Humanoid)val).m_visEquipment]._equippedEarringItem, triggerEquipmentEffects);
				MagicSlot._magicSlots[((Humanoid)val).m_visEquipment]._equippedEarringItem = item;
				return true;
			}
			return false;
		}

		private static void UnEquipItem(Humanoid humanoid, ItemData item)
		{
			Player val = (Player)(object)((humanoid is Player) ? humanoid : null);
			if (val != null)
			{
				if (MagicSlot._magicSlots[((Humanoid)val).m_visEquipment]._equippedTomeItem == item)
				{
					MagicSlot._magicSlots[((Humanoid)val).m_visEquipment]._equippedTomeItem = null;
				}
				if (MagicSlot._magicSlots[((Humanoid)val).m_visEquipment]._equippedEarringItem == item)
				{
					MagicSlot._magicSlots[((Humanoid)val).m_visEquipment]._equippedEarringItem = null;
				}
			}
		}

		private static void AddStatusEffects(Humanoid humanoid, HashSet<StatusEffect> statusEffects)
		{
			Player val = (Player)(object)((humanoid is Player) ? humanoid : null);
			if (val != null && MagicSlot._magicSlots.TryGetValue(((Humanoid)val).m_visEquipment, out var value))
			{
				StatusEffect val2 = value._equippedTomeItem?.m_shared.m_equipStatusEffect;
				if (val2 != null)
				{
					statusEffects.Add(val2);
				}
				StatusEffect val3 = value._equippedEarringItem?.m_shared.m_equipStatusEffect;
				if (val3 != null)
				{
					statusEffects.Add(val3);
				}
			}
		}
	}
	[HarmonyPatch]
	public class ItemDataPatch
	{
		[HarmonyPatch(typeof(ItemData), "GetDamage", new Type[]
		{
			typeof(int),
			typeof(float)
		})]
		[HarmonyPostfix]
		public static void GetDamage_Postfix(ItemData __instance, ref DamageTypes __result)
		{
			Player localPlayer = Player.m_localPlayer;
			if (!((Object)(object)localPlayer == (Object)null) && ((Humanoid)localPlayer).m_inventory.m_inventory.Exists((ItemData x) => x == __instance))
			{
				float skillFactor = ((Character)localPlayer).GetSkillFactor((SkillType)9);
				if (((Character)localPlayer).GetSEMan().HaveStatusEffect("bmp_hogwarts"))
				{
					float num = 1f + skillFactor * ConfigSetup._hogwartsBeltBonus.Value;
					__result.m_fire *= num;
					__result.m_frost *= num;
					__result.m_lightning *= num;
					__result.m_poison *= num;
					__result.m_spirit *= num;
				}
			}
		}
	}
	[HarmonyPatch]
	public class ItemDropPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(ItemDrop), "Awake")]
		public static void ItemDropAwake_Postfix(ItemDrop __instance)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			Scene activeScene = SceneManager.GetActiveScene();
			if (((Scene)(ref activeScene)).name != "main" || (Object)(object)__instance == (Object)null)
			{
				return;
			}
			string name = __instance.m_itemData.m_shared.m_name;
			if (name == null)
			{
				return;
			}
			switch (name.Length)
			{
			case 22:
				switch (name[5])
				{
				case 'm':
					if (name == "$bmp_modersinheritence")
					{
						StatsSetup.ModersHeritage(__instance);
					}
					break;
				case 'a':
					if (name == "$bmp_advance_magicbook")
					{
						StatsSetup.AdvanceMagicBook(__instance);
					}
					break;
				}
				break;
			case 24:
				switch (name[5])
				{
				case 'y':
					if (name == "$bmp_yagluthsinheritence")
					{
						StatsSetup.YagluthsHeritage(__instance);
					}
					break;
				case 'b':
					if (name == "$bmp_beginners_magicbook")
					{
						StatsSetup.BeginnersMagicBook(__instance);
					}
					break;
				}
				break;
			case 21:
				switch (name[5])
				{
				case 'a':
					if (name == "$bmp_advancewizardhat")
					{
						StatsSetup.AdvanceWizardHat(__instance);
					}
					break;
				case 'l':
					if (name == "$bmp_lightningscepter")
					{
						StatsSetup.LightningScepter(__instance);
					}
					break;
				}
				break;
			case 19:
				switch (name[15])
				{
				case 'c':
					if (name == "$bmp_redwizard_cape")
					{
						StatsSetup.RedWizardCape(__instance);
					}
					break;
				case 'h':
					if (name == "$bmp_redwizard_helm")
					{
						StatsSetup.RedWizardHelm(__instance);
					}
					break;
				case 'l':
					if (name == "$bmp_redwizard_legs")
					{
						StatsSetup.RedWizardLegs(__instance);
					}
					break;
				case 'r':
					if (!(name == "$bmp_dvergr_earring"))
					{
						if (name == "$jc_ring_dvergrring")
						{
							StatsSetup.DvergrRing(__instance);
						}
					}
					else
					{
						StatsSetup.DvergrEarring(__instance);
					}
					break;
				}
				break;
			case 17:
				switch (name[5])
				{
				case 'r':
					if (name == "$bmp_redwizardhat")
					{
						StatsSetup.RedWizardHat(__instance);
					}
					break;
				case 'f':
					if (name == "$bmp_flamescepter")
					{
						StatsSetup.FlameScepter(__instance);
					}
					break;
				}
				break;
			case 15:
				switch (name[6])
				{
				case 'c':
					if (name == "$bmp_icescepter")
					{
						StatsSetup.IceScepter(__instance);
					}
					break;
				case 'v':
					if (name == "$bmp_dvergrbelt")
					{
						StatsSetup.DvergrBelt(__instance);
					}
					break;
				case 'r':
					if (name == "$bmp_druidstome")
					{
						StatsSetup.DruidsTome(__instance);
					}
					break;
				}
				break;
			case 23:
				if (name == "$bmp_beginnerswizardhat")
				{
					StatsSetup.BeginnersWizardHat(__instance);
				}
				break;
			case 14:
				if (name == "$bmp_shamanhat")
				{
					StatsSetup.ShamanHat(__instance);
				}
				break;
			case 20:
				if (name == "$bmp_redwizard_chest")
				{
					StatsSetup.RedWizardChest(__instance);
				}
				break;
			case 27:
				if (name == "$jc_necklace_dvergrnecklace")
				{
					StatsSetup.DvergrNecklace(__instance);
				}
				break;
			case 16:
			case 18:
			case 25:
			case 26:
				break;
			}
		}
	}
	[HarmonyPatch]
	public class MineRock5Patch
	{
		[HarmonyPatch(typeof(MineRock5), "RPC_Damage")]
		public static class RpcDamagePatch
		{
			private static void Prefix(MineRock5 __instance, HitData hit)
			{
				Character attacker = hit.GetAttacker();
				Player val = (Player)(object)((attacker is Player) ? attacker : null);
				if (val != null && ((Humanoid)val).GetCurrentWeapon() != null && ((Humanoid)val).GetCurrentWeapon() != ((Humanoid)val).m_unarmedWeapon.m_itemData)
				{
					int quality = ((Humanoid)val).GetCurrentWeapon().m_quality;
					if ((!(((Object)((Humanoid)val).GetCurrentWeapon().m_dropPrefab).name != "BMP_EikthyrsStaff") || !(((Object)((Humanoid)val).GetCurrentWeapon().m_dropPrefab).name != "BMP_LightningStaff")) && quality >= __instance.m_minToolTier && hit.m_damage.m_pickaxe > 0f && __instance.m_nview.IsValid() && __instance.m_nview.IsOwner())
					{
						hit.m_toolTier = (short)quality;
						((Character)val).RaiseSkill((SkillType)12, 0.2f);
					}
				}
			}
		}

		[HarmonyPatch(typeof(MineRock5), "DamageArea")]
		public static class DamageAreaPatch
		{
			private static void Prefix(MineRock5 __instance, HitData hit)
			{
				Character attacker = hit.GetAttacker();
				Player val = (Player)(object)((attacker is Player) ? attacker : null);
				if (val != null && ((Humanoid)val).GetCurrentWeapon() != null && ((Humanoid)val).GetCurrentWeapon() != ((Humanoid)val).m_unarmedWeapon.m_itemData)
				{
					int quality = ((Humanoid)val).GetCurrentWeapon().m_quality;
					if ((!(((Object)((Humanoid)val).GetCurrentWeapon().m_dropPrefab).name != "BMP_EikthyrsStaff") || !(((Object)((Humanoid)val).GetCurrentWeapon().m_dropPrefab).name != "BMP_LightningStaff")) && quality >= __instance.m_minToolTier && hit.m_damage.m_pickaxe > 0f && __instance.m_nview.IsValid() && __instance.m_nview.IsOwner())
					{
						hit.m_toolTier = (short)quality;
						((Character)val).RaiseSkill((SkillType)12, 0.2f);
					}
				}
			}
		}
	}
	[HarmonyPatch]
	public class MineRockPatch
	{
		[HarmonyPatch(typeof(MineRock), "RPC_Hit")]
		public static class RpcHitPatch
		{
			private static void Prefix(MineRock __instance, HitData hit)
			{
				Character attacker = hit.GetAttacker();
				Player val = (Player)(object)((attacker is Player) ? attacker : null);
				if (val != null && ((Humanoid)val).GetCurrentWeapon() != null && ((Humanoid)val).GetCurrentWeapon() != ((Humanoid)val).m_unarmedWeapon.m_itemData)
				{
					int? num = ((Humanoid)val).GetCurrentWeapon()?.m_quality;
					if ((!(((Object)((Humanoid)val).GetCurrentWeapon().m_dropPrefab).name != "BMP_EikthyrsStaff") || !(((Object)((Humanoid)val).GetCurrentWeapon().m_dropPrefab).name != "BMP_LightningStaff")) && !(num < __instance.m_minToolTier) && hit.m_damage.m_pickaxe > 0f && __instance.m_nview.IsValid() && __instance.m_nview.IsOwner())
					{
						hit.m_toolTier = (short)num.Value;
						((Character)val).RaiseSkill((SkillType)12, 0.2f);
					}
				}
			}
		}
	}
	[HarmonyPatch]
	public class ObjectDBPatch
	{
		[HarmonyPriority(700)]
		[HarmonyPostfix]
		[HarmonyPatch(typeof(ObjectDB), "Awake")]
		private static void Awake_Postfix(ObjectDB __instance)
		{
			__instance.m_StatusEffects.Add((StatusEffect)(object)Helper.CreateCooldown("necktotem_cooldown", "NeckTotem", Plugin._neckTotemIcon));
			__instance.m_StatusEffects.Add((StatusEffect)(object)Helper.CreateCooldown("wolftotem_cooldown", "WolfTotem", Plugin._wolfTotemIcon));
			__instance.m_StatusEffects.Add((StatusEffect)(object)Helper.CreateCooldown("crystaltotem_cooldown", "CrystalTotem", Plugin._crystalTotemIcon));
			__instance.m_StatusEffects.Add((StatusEffect)(object)Helper.CreateCooldown("skulltotem_cooldown", "SkullTotem", Plugin._skullTotemIcon));
			__instance.m_StatusEffects.Add((StatusEffect)(object)Helper.CreateCooldown("modersheritage_cooldown", "ModersHeritage", Plugin._modersIcon));
			__instance.m_StatusEffects.Add((StatusEffect)(object)Helper.CreateCooldown("yagluthsheritage_cooldown", "YagluthsHeritage", Plugin._yagluthsIcon));
		}
	}
	[HarmonyPatch]
	public class PlayerPatch
	{
		[HarmonyPatch(typeof(Player), "UpdateEnvStatusEffects")]
		[HarmonyPrefix]
		private static bool UpdateEnvStatusEffect_Prefix(Player __instance)
		{
			if (!((Character)__instance).GetSEMan().HaveStatusEffect("Arctic Buff"))
			{
				return true;
			}
			if (EnvMan.instance.IsCold())
			{
				((Character)__instance).GetSEMan().RemoveStatusEffect(StringExtensionMethods.GetStableHashCode("Cold"), false);
			}
			if (EnvMan.instance.IsFreezing())
			{
				((Character)__instance).GetSEMan().RemoveStatusEffect(StringExtensionMethods.GetStableHashCode("Freezing"), false);
			}
			return true;
		}

		[HarmonyPatch(typeof(Player), "GetTotalFoodValue")]
		[HarmonyPostfix]
		public static void GetTotalFoodValue_Postfix(ref Player __instance, ref float eitr)
		{
			if (!((Object)(object)__instance == (Object)null))
			{
				if (((Character)__instance).GetSEMan().HaveStatusEffect("bmp_eitrbelt"))
				{
					eitr += ConfigSetup._eitrBeltEitrBonus.Value;
				}
				if (((Character)__instance).GetSEMan().HaveStatusEffect("bmp_eitr_earring"))
				{
					eitr += ConfigSetup._eitrEarringEitr.Value;
				}
				if (((Character)__instance).GetSEMan().HaveStatusEffect("bmp_eitr_ring"))
				{
					eitr += RingsAndNecklaces._eitrRingEitr.Value;
				}
				if (((Character)__instance).GetSEMan().HaveStatusEffect("bmp_eitr_necklace"))
				{
					eitr += RingsAndNecklaces._eitrNecklaceEitr.Value;
				}
				if (((Character)__instance).GetSEMan().HaveStatusEffect("bmp_beginners_magicbook"))
				{
					eitr += ConfigSetup._beginnersBookEitr.Value;
				}
				if (((Character)__instance).GetSEMan().HaveStatusEffect("bmp_advance_magicbook"))
				{
					eitr += ConfigSetup._advanceBookEitr.Value;
				}
				if (((Character)__instance).GetSEMan().HaveStatusEffect("bmp_druidstome"))
				{
					eitr += ConfigSetup._druidsTomeEitr.Value;
				}
				if (((Character)__instance).GetSEMan().HaveStatusEffect("bmp_beginners_wizardhat"))
				{
					eitr += ConfigSetup._beginnersWizardHatEitr.Value;
				}
				if (((Character)__instance).GetSEMan().HaveStatusEffect("bmp_advance_wizardhat"))
				{
					eitr += ConfigSetup._advanceWizardHatEitr.Value;
				}
				if (((Character)__instance).GetSEMan().HaveStatusEffect("bmp_redwizardhat"))
				{
					eitr += ConfigSetup._redWizardHatEitr.Value;
				}
				if (((Character)__instance).GetSEMan().HaveStatusEffect("bmp_shamanhat"))
				{
					eitr += ConfigSetup._shamanHatEitr.Value;
				}
			}
		}

		[HarmonyPatch(typeof(Player), "UpdateStats", new Type[] { typeof(float) })]
		[HarmonyPostfix]
		public static void UpdateStats_Postfix(Player __instance)
		{
			if (!((Character)__instance).GetSEMan().HaveStatusEffect("healstaff_cooldown"))
			{
				return;
			}
			foreach (string item in new List<string> { "Frost", "Smoked", "Burning", "Poison", "Wet", "Tared", "Freezing", "Frost" }.Where((string se) => ((Character)__instance).GetSEMan().HaveStatusEffect(se)))
			{
				((Character)__instance).GetSEMan().RemoveStatusEffect(StringExtensionMethods.GetStableHashCode(item), false);
			}
		}

		[HarmonyPriority(800)]
		[HarmonyPrefix]
		[HarmonyPatch(typeof(Player), "Awake")]
		private static void Awake_Prefix(Player __instance)
		{
			MagicSlot._magicSlots.Add(((Component)__instance).GetComponent<VisEquipment>(), new MagicSlot(((Component)__instance).GetComponent<VisEquipment>()));
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Player), "GetEquipmentEitrRegenModifier")]
		public static void GetEquipmentEitrRegenModifier_Postfix(ref Player __instance, ref float __result)
		{
			if (AzuExtendedPlayerInventory.API.IsLoaded())
			{
				__result += ((Humanoid)__instance).GetInventory().GetEquippedItems().Where(MagicSlot.IsTomeItem)
					.Sum((ItemData item) => item.m_shared.m_eitrRegenModifier);
				__result += (from i in ((Humanoid)__instance).GetInventory().GetEquippedItems()
					where i.m_shared.m_name.StartsWith("$jc_ring_") || i.m_shared.m_name.StartsWith("$jc_necklace_")
					select i).Sum((ItemData i) => i.m_shared.m_eitrRegenModifier);
				__result += ((Humanoid)__instance).GetInventory().GetEquippedItems().Where(MagicSlot.IsEarringItem)
					.Sum((ItemData item) => item.m_shared.m_eitrRegenModifier);
			}
		}
	}
	[HarmonyPatch]
	public class SEManPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch(typeof(SEMan), "Internal_AddStatusEffect")]
		public static bool InternalAddStatusEffect_Prefix(SEMan __instance, ref int nameHash)
		{
			if (!__instance.HaveStatusEffect("Arctic Buff"))
			{
				return true;
			}
			if (nameHash != StringExtensionMethods.GetStableHashCode("Freezing"))
			{
				return nameHash != StringExtensionMethods.GetStableHashCode("Cold");
			}
			return false;
		}
	}
	[HarmonyPatch]
	public static class SkillsPatch
	{
		[HarmonyPatch(typeof(Skills), "RaiseSkill")]
		public static class RaiseSkillPatch
		{
			public static void Prefix(ref SkillType skillType, ref float factor)
			{
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0014: Invalid comparison between Unknown and I4
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Invalid comparison between Unknown and I4
				if (Plugin._enableExpMultiplier.Value != MagicPlugin.Functions.Toggle.On)
				{
					return;
				}
				SkillType val = skillType;
				if ((int)val != 9)
				{
					if ((int)val == 10)
					{
						factor *= Plugin._bmExpMultiplier.Value;
					}
				}
				else
				{
					factor *= Plugin._emExpMultiplier.Value;
				}
			}

			public static void Postfix(Skills __instance, SkillType skillType)
			{
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				//IL_001e: Invalid comparison between Unknown and I4
				//IL_0020: Unknown result type (might be due to invalid IL or missing references)
				//IL_0023: Invalid comparison between Unknown and I4
				//IL_004b: 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)
				if (Plugin._enableExpMultiplier.Value != MagicPlugin.Functions.Toggle.On || Plugin._displayExpGained.Value != MagicPlugin.Functions.Toggle.On || ((int)skillType != 10 && (int)skillType != 9))
				{
					return;
				}
				try
				{
					if (__instance.GetSkillLevel((SkillType)10) < 100f || __instance.GetSkillLevel((SkillType)9) < 100f)
					{
						Skill skill = __instance.GetSkill(skillType);
						float value = skill.m_accumulator / (skill.GetNextLevelRequirement() / 100f);
						((Character)__instance.m_player).Message((MessageType)1, $"Level {skill.m_level.tFloat(0)} {skill.m_info.m_skill} [{skill.m_accumulator.tFloat(2)}/{skill.GetNextLevelRequirement().tFloat(2)}] ({value.tFloat(0)}%)", 0, skill.m_info.m_icon);
					}
				}
				catch
				{
				}
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Skills), "GetSkillLevel")]
		public static void GetSkillLevel_Postfix(Skills __instance, SkillType skillType, ref float __result)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Invalid comparison between Unknown and I4
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			if ((int)skillType != 9)
			{
				if ((int)skillType == 10)
				{
					float level = __instance.GetSkill(skillType).m_level;
					if (((Character)__instance.m_player).GetSEMan().HaveStatusEffect("bmp_necromancer"))
					{
						level += ConfigSetup._necromancerBeltBonus.Value;
						((Character)__instance.m_player).GetSEMan().ModifySkillLevel(skillType, ref level);
						__result = level;
					}
					else
					{
						((Character)__instance.m_player).GetSEMan().ModifySkillLevel(skillType, ref level);
						__result = level;
					}
				}
			}
			else
			{
				float level2 = __instance.GetSkill(skillType).m_level;
				if (((Character)__instance.m_player).GetSEMan().HaveStatusEffect("bmp_elementalist"))
				{
					level2 += ConfigSetup._elementalistBeltBonus.Value;
					((Character)__instance.m_player).GetSEMan().ModifySkillLevel(skillType, ref level2);
					__result = level2;
				}
				else
				{
					((Character)__instance.m_player).GetSEMan().ModifySkillLevel(skillType, ref level2);
					__result = level2;
				}
			}
		}
	}
	[HarmonyPatch]
	public class SpawnAbilityPatch
	{
		[HarmonyPatch(typeof(SpawnAbility), "Spawn")]
		[HarmonyPrefix]
		private static bool Spawn_Prefix(SpawnAbility __instance)
		{
			//IL_03c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c2: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)__instance == (Object)null) && __instance.m_weapon != null)
			{
				Character owner = __instance.m_owner;
				Player val = (Player)(object)((owner is Player) ? owner : null);
				if (val != null)
				{
					switch (__instance.m_weapon.m_shared.m_name)
					{
					case "$bmp_necktotem":
					{
						if (((Character)val).GetSEMan().HaveStatusEffect("necktotem_cooldown"))
						{
							((Character)val).Message((MessageType)2, "<size=28>Gate of Valhalla is not yet ready.</size>", 0, (Sprite)null);
							return false;
						}
						StatusEffect statusEffect = ObjectDB.instance.GetStatusEffect(StringExtensionMethods.GetStableHashCode("necktotem_cooldown"));
						ConfigSetup._neckTotemCooldown.SettingChanged += delegate
						{
							statusEffect.m_ttl = ConfigSetup._neckTotemCooldown.Value;
						};
						statusEffect.m_ttl = ConfigSetup._neckTotemCooldown.Value;
						((Character)val).GetSEMan().AddStatusEffect(statusEffect, false, 0, 0f);
						return true;
					}
					case "$bmp_wolftotem":
					{
						if (((Character)val).GetSkillLevel((SkillType)10) < (float)ConfigSetup._wolfTotemLevel.Value)
						{
							((Character)val).Message((MessageType)2, "<size=28>You're not worthy to summon the <color=red>God of Flames</color></size>", 0, (Sprite)null);
							return false;
						}
						if (((Character)val).GetSEMan().HaveStatusEffect("wolftotem_cooldown"))
						{
							((Character)val).Message((MessageType)2, "<size=28>Gate of Valhalla is not yet ready!</size>", 0, (Sprite)null);
							return false;
						}
						StatusEffect statusEffect2 = ObjectDB.instance.GetStatusEffect(StringExtensionMethods.GetStableHashCode("wolftotem_cooldown"));
						ConfigSetup._wolfTotemCooldown.SettingChanged += delegate
						{
							statusEffect2.m_ttl = ConfigSetup._wolfTotemCooldown.Value;
						};
						statusEffect2.m_ttl = ConfigSetup._wolfTotemCooldown.Value;
						((Character)val).GetSEMan().AddStatusEffect(statusEffect2, false, 0, 0f);
						return true;
					}
					case "$bmp_crystaltotem":
					{
						if (((Character)val).GetSEMan().HaveStatusEffect("crystaltotem_cooldown"))
						{
							((Character)val).Message((MessageType)2, "<size=28>Gate of Valhalla is not yet ready!</size>", 0, (Sprite)null);
							return false;
						}
						StatusEffect statusEffect3 = ObjectDB.instance.GetStatusEffect(StringExtensionMethods.GetStableHashCode("crystaltotem_cooldown"));
						ConfigSetup._crystalTotemCooldown.SettingChanged += delegate
						{
							statusEffect3.m_ttl = ConfigSetup._crystalTotemCooldown.Value;
						};
						statusEffect3.m_ttl = ConfigSetup._crystalTotemCooldown.Value;
						((Character)val).GetSEMan().AddStatusEffect(statusEffect3, false, 0, 0f);
						return true;
					}
					case "$bmp_skulltotem":
					{
						if (((Character)val).GetSEMan().HaveStatusEffect("skulltotem_cooldown"))
						{
							((Character)val).Message((MessageType)2, "<size=28>Gate of Valhalla is not yet ready!</size>", 0, (Sprite)null);
							return false;
						}
						StatusEffect statusEffect4 = ObjectDB.instance.GetStatusEffect(StringExtensionMethods.GetStableHashCode("skulltotem_cooldown"));
						ConfigSetup._skullTotemCooldown.SettingChanged += delegate
						{
							statusEffect4.m_ttl = ConfigSetup._skullTotemCooldown.Value;
						};
						statusEffect4.m_ttl = ConfigSetup._skullTotemCooldown.Value;
						((Character)val).GetSEMan().AddStatusEffect(statusEffect4, false, 0, 0f);
						return true;
					}
					case "$bmp_modersinheritence":
					{
						float value2 = ConfigSetup._modersStaminaDrain.Value;
						if (value2 > 0f && !((Character)val).HaveStamina(value2 + 0.1f))
						{
							Hud.instance.StaminaBarEmptyFlash();
							return false;
						}
						if (((Character)val).GetSEMan().HaveStatusEffect("modersheritage_cooldown"))
						{
							((Character)val).Message((MessageType)2, "<size=28>Attack not ready!</size>", 0, (Sprite)null);
							return false;
						}
						StatusEffect statusEffect5 = ObjectDB.instance.GetStatusEffect(StringExtensionMethods.GetStableHashCode("modersheritage_cooldown"));
						ConfigSetup._modersCooldown.SettingChanged += delegate
						{
							statusEffect5.m_ttl = ConfigSetup._modersCooldown.Value;
						};
						statusEffect5.m_ttl = ConfigSetup._modersCooldown.Value;
						if (ConfigSetup._modersCooldown.Value > 0f)
						{
							((Character)val).GetSEMan().AddStatusEffect(statusEffect5, false, 0, 0f);
						}
						Object.Instantiate<GameObject>(ZNetScene.instance.GetPrefab("fx_himminafl_aoe"), ((Character)val).GetCenterPoint(), Quaternion.identity);
						((Character)val).RaiseSkill((SkillType)9, 0.1f);
						return true;
					}
					case "$bmp_yagluthsinheritence":
					{
						float value = ConfigSetup._yagluthsStaminaDrain.Value;
						if (value > 0f && !((Character)val).HaveStamina(value + 0.1f))
						{
							Hud.instance.StaminaBarEmptyFlash();
							return false;
						}
						if (((Character)val).GetSEMan().HaveStatusEffect("yagluthsheritage_cooldown"))
						{
							((Character)val).Message((MessageType)2, "<size=28>Attack not ready!</size>", 0, (Sprite)null);
							return false;
						}
						StatusEffect statusEffect6 = ObjectDB.instance.GetStatusEffect(StringExtensionMethods.GetStableHashCode("yagluthsheritage_cooldown"));
						ConfigSetup._yagluthsCooldown.SettingChanged += delegate
						{
							statusEffect6.m_ttl = ConfigSetup._yagluthsCooldown.Value;
						};
						statusEffect6.m_ttl = ConfigSetup._yagluthsCooldown.Value;
						if (ConfigSetup._yagluthsCooldown.Value > 0f)
						{
							((Character)val).GetSEMan().AddStatusEffect(statusEffect6, false, 0, 0f);
						}
						Object.Instantiate<GameObject>(ZNetScene.instance.GetPrefab("fx_himminafl_aoe"), ((Character)val).GetCenterPoint(), Quaternion.identity);
						((Character)val).RaiseSkill((SkillType)9, 0.1f);
						return true;
					}
					default:
						return true;
					}
				}
			}
			return true;
		}
	}
	[HarmonyPatch]
	public class TreeBasePatch
	{
		[HarmonyPatch(typeof(TreeBase), "RPC_Damage")]
		public static class RpcDamagePatch
		{
			private static void Prefix(TreeBase __instance, HitData hit)
			{
				Character attacker = hit.GetAttacker();
				Player val = (Player)(object)((attacker is Player) ? attacker : null);
				if (val != null && ((Humanoid)val).GetCurrentWeapon() != null && ((Humanoid)val).GetCurrentWeapon() != ((Humanoid)val).m_unarmedWeapon.m_itemData)
				{
					int quality = ((Humanoid)val).GetCurrentWeapon().m_quality;
					if (!(((Object)((Humanoid)val).GetCurrentWeapon().m_dropPrefab).name != "BMP_SurtlingStaff") && quality >= __instance.m_minToolTier && hit.m_damage.m_chop > 0f && __instance.m_nview.IsValid() && __instance.m_nview.IsOwner())
					{
						hit.m_toolTier = (short)quality;
						((Character)val).RaiseSkill((SkillType)13, 0.2f);
					}
				}
			}
		}
	}
	[HarmonyPatch]
	public class TreeLogPatch
	{
		[HarmonyPatch(typeof(TreeLog), "RPC_Damage")]
		public static class RpcDamagePatch
		{
			private static void Prefix(TreeLog __instance, HitData hit)
			{
				Character attacker = hit.GetAttacker();
				Player val = (Player)(object)((attacker is Player) ? attacker : null);
				if (val != null && ((Humanoid)val).GetCurrentWeapon() != null && ((Humanoid)val).GetCurrentWeapon() != ((Humanoid)val).m_unarmedWeapon.m_itemData)
				{
					int quality = ((Humanoid)val).GetCurrentWeapon().m_quality;
					if (!(((Object)((Humanoid)val).GetCurrentWeapon().m_dropPrefab).name != "BMP_SurtlingStaff") && quality >= __instance.m_minToolTier && hit.m_damage.m_chop > 0f && __instance.m_nview.IsValid() && __instance.m_nview.IsOwner())
					{
						hit.m_toolTier = (short)quality;
						((Character)val).RaiseSkill((SkillType)13, 0.2f);
					}
				}
			}
		}
	}
	[HarmonyPatch]
	public class VisEquipmentPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(VisEquipment), "OnEnable")]
		private static void OnEnable_Postfix(VisEquipment __instance)
		{
			if (!MagicSlot._magicSlots.ContainsKey(__instance) && __instance.m_isPlayer)
			{
				MagicSlot._magicSlots[__instance] = new MagicSlot(__instance);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(VisEquipment), "OnDisable")]
		private static void OnDisable_Postfix(VisEquipment __instance)
		{
			MagicSlot._magicSlots.Remove(__instance);
		}

		[HarmonyPatch(typeof(VisEquipment), "UpdateEquipmentVisuals")]
		[HarmonyPostfix]
		private static void UpdateEquipmentVisuals_Postfix(VisEquipment __instance)
		{
			if (__instance.m_isPlayer)
			{
				MagicSlot._magicSlots[__instance].UpdateEquipmentVisuals();
			}
		}
	}
	[HarmonyPatch(typeof(ZNetScene), "Awake")]
	public class ZNetScenePatch
	{
		public static void Postfix(ZNetScene __instance)
		{
			//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_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Expected O, but got Unknown
			if (!((Object)(object)__instance == (Object)null))
			{
				List<GameObject> prefabs = __instance.m_prefabs;
				if (prefabs != null && prefabs.Count > 0)
				{
					Plugin.PrefabContainer();
					PrefabsSetup.CreateSummon(__instance);
					SpawnAbility component = Plugin._skullTotemProjectile.GetComponent<SpawnAbility>();
					component.m_spawnPrefab = (GameObject[])(object)new GameObject[1] { Plugin._armoredSkellies };
					component.m_preSpawnEffects.m_effectPrefabs = (EffectData[])(object)new EffectData[1]
					{
						new EffectData
						{
							m_prefab = __instance.GetPrefab("fx_summon_skeleton_spawn"),
							m_enabled = true,
							m_variant = 0
						}
					};
				}
			}
		}
	}
}
namespace MagicPlugin.JCAdditions
{
	public static class RingsAndNecklaces
	{
		public static ConfigEntry<float> _dvergrRingEitrRegen;

		public static ConfigEntry<float> _dvergrNecklaceEitrRegen;

		public static ConfigEntry<float> _eitrRingEitr;

		public static ConfigEntry<float> _eitrNecklaceEitr;

		public static void Init()
		{
			if (Jewelcrafting.API.IsLoaded())
			{
				DvergrRing();
				EitrRing();
				FireResistRing();
				FrostResistRing();
				PoisonResistRing();
				DvergrNecklace();
				EitrNecklace();
				FireResistNecklace();
				FrostResistNecklace();
				PoisonResistNecklace();
			}
		}

		private static void DvergrRing()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Expected O, but got Unknown
			Item item = new Item(Jewelcrafting.API.CreateRingFromTemplate("Blue", Color.blue));
			ItemDrop component = item.Prefab.GetComponent<ItemDrop>();
			component.m_itemData.m_shared.m_name = "$jc_ring_dvergrring";
			component.m_itemData.m_shared.m_description = "$jc_ring_dvergrring_description";
			component.m_itemData.m_shared.m_maxQuality = 1;
			string group = Localization.instance.Localize("$jc_ring_dvergrring").Trim();
			_dvergrRingEitrRegen = Plugin._Instance.config(group, "Eitr Regen", 0.25f, new ConfigDescription("Dvergr ring eitr regen.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			StatsSetup.DvergrRing(component);
			item.Crafting.Add(((Object)Jewelcrafting.API.GetGemcuttersTable()).name, 3);
			item.MaximumRequiredStationLevel = 3;
			item.RequiredItems.Add("Perfect_Blue_Socket", 5);
			item.RequiredItems.Add("Chain", 2);
			item.RequiredItems.Add("Eitr", 16);
			item.Configurable = Configurability.Recipe;
		}

		private static void EitrRing()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Expected O, but got Unknown
			Item item = new Item(Jewelcrafting.API.CreateRingFromTemplate("Purple", new Color(128f, 0f, 128f)));
			ItemDrop component = item.Prefab.GetComponent<ItemDrop>();
			component.m_itemData.m_shared.m_name = "$jc_ring_eitrring";
			component.m_itemData.m_shared.m_description = "$jc_ring_eitrring_description";
			component.m_itemData.m_shared.m_maxQuality = 1;
			string group = Localization.instance.Localize("$jc_ring_eitrring").Trim();
			_eitrRingEitr = Plugin._Instance.config(group, "Eitr Bonus", 46f, new ConfigDescription("Eitr ring eitr bonus.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f), new object[1]
			{
				new MagicPlugin.Functions.ConfigurationManagerAttributes
				{
					ShowRangeAsPercent = false
				}
			}));
			item.Crafting.Add(((Object)Jewelcrafting.API.GetGemcuttersTable()).name, 3);
			item.MaximumRequiredStationLevel = 3;
			item.RequiredItems.Add("Perfect_Purple_Socket", 5);
			item.RequiredItems.Add("Chain", 2);
			item.RequiredItems.Add("Eitr", 16);
			item.Configurable = Configurability.Recipe;
			AddEitr statusEffect = ScriptableObject.CreateInstance<AddEitr>();
			((Object)statusEffect).name = "bmp_eitr_ring";
			((StatusEffect)statusEffect).m_name = component.m_itemData.m_shared.m_name;
			((StatusEffect)statusEffect).m_icon = component.m_itemData.GetIcon();
			_eitrRingEitr.SettingChanged += delegate
			{
				statusEffect.SetEitr(_eitrRingEitr.Value);
			};
			statusEffect.SetEitr(_eitrRingEitr.Value);
			component.m_itemData.m_shared.m_equipStatusEffect = (StatusEffect)(object)statusEffect;
		}

		private static void FireResistRing()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			Item item = new Item(Jewelcrafting.API.CreateRingFromTemplate("Red", Color.red));
			ItemDrop component = item.Prefab.GetComponent<ItemDrop>();
			component.m_itemData.m_shared.m_name = "$jc_ring_fireresistring";
			component.m_itemData.m_shared.m_description = "$jc_ring_fireresistring_description";
			component.m_itemData.m_shared.m_maxQuality = 1;
			item.Crafting.Add(((Object)Jewelcrafting.API.GetGemcuttersTable()).name, 3);
			item.MaximumRequiredStationLevel = 3;
			item.RequiredItems.Add("Perfect_Red_Socket", 5);
			item.RequiredItems.Add("Chain", 2);
			item.RequiredItems.Add("TrophySurtling", 1);
			item.Configurable = Configurability.Recipe;
			SE_Stats val = ScriptableObject.CreateInstance<SE_Stats>();
			((Object)val).name = "bmp_fireresist_ring";
			((StatusEffect)val).m_name = component.m_itemData.m_shared.m_name;
			((StatusEffect)val).m_icon = component.m_itemData.GetIcon();
			val.m_mods = new List<DamageModPair>
			{
				new DamageModPair
				{
					m_type = (DamageType)32,
					m_modifier = (DamageModifier)5
				}
			};
			component.m_itemData.m_shared.m_equipStatusEffect = (StatusEffect)(object)val;
		}

		private static void FrostResistRing()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			Item item = new Item(Jewelcrafting.API.CreateRingFromTemplate("Cyan", Color.cyan));
			ItemDrop component = item.Prefab.GetComponent<ItemDrop>();
			component.m_itemData.m_shared.m_name = "$jc_ring_frostresistring";
			component.m_itemData.m_shared.m_description = "$jc_ring_frostresistring_description";
			component.m_itemData.m_shared.m_maxQuality = 1;
			item.Crafting.Add(((Object)Jewelcrafting.API.GetGemcuttersTable()).name, 3);
			item.MaximumRequiredStationLevel = 3;
			item.RequiredItems.Add("Perfect_Blue_Socket", 5);
			item.RequiredItems.Add("Chain", 2);
			item.RequiredItems.Add("FreezeGland", 16);
			item.Configurable = Configurability.Recipe;
			SE_Stats val = ScriptableObject.CreateInstance<SE_Stats>();
			((Object)val).name = "bmp_frostresist_ring";
			((StatusEffect)val).m_name = component.m_itemData.m_shared.m_name;
			((StatusEffect)val).m_icon = component.m_itemData.GetIcon();
			val.m_mods = new List<DamageModPair>
			{
				new DamageModPair
				{
					m_type = (DamageType)64,
					m_modifier = (DamageModifier)5
				}
			};
			component.m_itemData.m_shared.m_equipStatusEffect = (StatusEffect)(object)val;
		}

		private static void PoisonResistRing()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			Item item = new Item(Jewelcrafting.API.CreateRingFromTemplate("Green", Color.green));
			ItemDrop component = item.Prefab.GetComponent<ItemDrop>();
			component.m_itemData.m_shared.m_name = "$jc_ring_poisonresistring";
			component.m_itemData.m_shared.m_description = "$jc_ring_poisonresistring_description";
			component.m_itemData.m_shared.m_maxQuality = 1;
			item.Crafting.Add(((Object)Jewelcrafting.API.GetGemcuttersTable()).name, 3);
			item.MaximumRequiredStationLevel = 3;
			item.RequiredItems.Add("Perfect_Green_Socket", 5);
			item.RequiredItems.Add("Chain", 2);
			item.RequiredItems.Add("Guck", 16);
			item.Configurable = Configurability.Recipe;
			SE_Stats val = ScriptableObject.CreateInstance<SE_Stats>();
			((Object)val).name = "bmp_poisonresist_ring";
			((StatusEffect)val).m_name = component.m_itemData.m_shared.m_name;
			((StatusEffect)val).m_icon = component.m_itemData.GetIcon();
			val.m_mods = new List<DamageModPair>
			{
				new DamageModPair
				{
					m_type = (DamageType)256,
					m_modifier = (DamageModifier)5
				}
			};
			component.m_itemData.m_shared.m_equipStatusEffect = (StatusEffect)(object)val;
		}

		private static void DvergrNecklace()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Expected O, but got Unknown
			Item item = new Item(Jewelcrafting.API.CreateNecklaceFromTemplate("Blue", Color.blue));
			ItemDrop component = item.Prefab.GetComponent<ItemDrop>();
			component.m_itemData.m_shared.m_name = "$jc_necklace_dvergrnecklace";
			component.m_itemData.m_shared.m_description = "$jc_necklace_dvergrnecklace_description";
			component.m_itemData.m_shared.m_maxQuality = 1;
			string group = Localization.instance.Localize("$jc_necklace_dvergrnecklace").Trim();
			_dvergrNecklaceEitrRegen = Plugin._Instance.config(group, "Eitr Regen", 0.25f, new ConfigDescription("Dvergr necklace eitr regen.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			StatsSetup.DvergrNecklace(component);
			component.m_itemData.m_shared.m_eitrRegenModifier = _dvergrNecklaceEitrRegen.Value;
			item.Crafting.Add(((Object)Jewelcrafting.API.GetGemcuttersTable()).name, 3);
			item.MaximumRequiredStationLevel = 3;
			item.RequiredItems.Add("Perfect_Blue_Socket", 5);
			item.RequiredItems.Add("Chain", 2);
			item.Configurable = Configurability.Recipe;
		}

		private static void EitrNecklace()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Expected O, but got Unknown
			Item item = new Item(Jewelcrafting.API.CreateNecklaceFromTemplate("Purple", new Color(128f, 0f, 128f)));
			ItemDrop component = item.Prefab.GetComponent<ItemDrop>();
			component.m_itemData.m_shared.m_name = "$jc_necklace_eitrnecklace";
			component.m_itemData.m_shared.m_description = "$jc_necklace_eitrnecklace_description";
			component.m_itemData.m_shared.m_maxQuality = 1;
			string group = Localization.instance.Localize("$jc_necklace_eitrnecklace").Trim();
			_eitrNecklaceEitr = Plugin._Instance.config(group, "Eitr Bonus", 42f, new ConfigDescription("Eitr necklace eitr bonus.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f), new object[1]
			{
				new MagicPlugin.Functions.ConfigurationManagerAttributes
				{
					ShowRangeAsPercent = false
				}
			}));
			item.Crafting.Add(((Object)Jewelcrafting.API.GetGemcuttersTable()).name, 3);
			item.MaximumRequiredStationLevel = 3;
			item.RequiredItems.Add("Perfect_Purple_Socket", 5);
			item.RequiredItems.Add("Chain", 2);
			item.RequiredItems.Add("Eitr", 16);
			item.Configurable = Configurability.Recipe;
			AddEitr statusEffect = ScriptableObject.CreateInstance<AddEitr>();
			((Object)statusEffect).name = "bmp_eitr_necklace";
			((StatusEffect)statusEffect).m_name = component.m_itemData.m_shared.m_name;
			((StatusEffect)statusEffect).m_icon = component.m_itemData.GetIcon();
			_eitrNecklaceEitr.SettingChanged += delegate
			{
				statusEffect.SetEitr(_eitrNecklaceEitr.Value);
			};
			statusEffect.SetEitr(_eitrNecklaceEitr.Value);
			component.m_itemData.m_shared.m_equipStatusEffect = (StatusEffect)(object)statusEffect;
		}

		private static void FireResistNecklace()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			Item item = new Item(Jewelcrafting.API.CreateNecklaceFromTemplate("Red", Color.red));
			ItemDrop component = item.Prefab.GetComponent<ItemDrop>();
			component.m_itemData.m_shared.m_name = "$jc_necklace_fireresistnecklace";
			component.m_itemData.m_shared.m_description = "$jc_necklace_fireresistnecklace_description";
			component.m_itemData.m_shared.m_maxQuality = 1;
			item.Crafting.Add(((Object)Jewelcrafting.API.GetGemcuttersTable()).name, 3);
			item.MaximumRequiredStationLevel = 3;
			item.RequiredItems.Add("Perfect_Red_Socket", 5);
			item.RequiredItems.Add("Chain", 2);
			item.RequiredItems.Add("TrophySurtling", 1);
			item.Configurable = Configurability.Recipe;
			SE_Stats val = ScriptableObject.CreateInstance<SE_Stats>();
			((Object)val).name = "bmp_fireresist_necklace";
			((StatusEffect)val).m_name = component.m_itemData.m_shared.m_name;
			((StatusEffect)val).m_icon = component.m_itemData.GetIcon();
			val.m_mods = new List<DamageModPair>
			{
				new DamageModPair
				{
					m_type = (DamageType)32,
					m_modifier = (DamageModifier)5
				}
			};
			component.m_itemData.m_shared.m_equipStatusEffect = (StatusEffect)(object)val;
		}

		private static void FrostResistNecklace()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			Item item = new Item(Jewelcrafting.API.CreateNecklaceFromTemplate("Cyan", Color.cyan));
			ItemDrop component = item.Prefab.GetComponent<ItemDrop>();
			component.m_itemData.m_shared.m_name = "$jc_necklace_frostresistnecklace";
			component.m_itemData.m_shared.m_description = "$jc_necklace_frostresistnecklace_description";
			component.m_itemData.m_shared.m_maxQuality = 1;
			item.Crafting.Add(((Object)Jewelcrafting.API.GetGemcuttersTable()).name, 3);
			item.MaximumRequiredStationLevel = 3;
			item.RequiredItems.Add("Perfect_Blue_Socket", 5);
			item.RequiredItems.Add("Chain", 2);
			item.RequiredItems.Add("FreezeGland", 16);
			item.Configurable = Configurability.Recipe;
			SE_Stats val = ScriptableObject.CreateInstance<SE_Stats>();
			((Object)val).name = "bmp_frostresist_necklace";
			((StatusEffect)val).m_name = component.m_itemData.m_shared.m_name;
			((StatusEffect)val).m_icon = component.m_itemData.GetIcon();
			val.m_mods = new List<DamageModPair>
			{
				new DamageModPair
				{
					m_type = (DamageType)64,
					m_modifier = (DamageModifier)5
				}
			};
			component.m_itemData.m_shared.m_equipStatusEffect = (StatusEffect)(object)val;
		}

		private static void PoisonResistNecklace()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			Item item = new Item(Jewelcrafting.API.CreateNecklaceFromTemplate("Green", Color.green));
			ItemDrop component = item.Prefab.GetComponent<ItemDrop>();
			component.m_itemData.m_shared.m_name = "$jc_necklace_poisonresistnecklace";
			component.m_itemData.m_shared.m_description = "$jc_necklace_poisonresistnecklace_description";
			component.m_itemData.m_shared.m_maxQuality = 1;
			item.Crafting.Add(((Object)Jewelcrafting.API.GetGemcuttersTable()).name, 3);
			item.MaximumRequiredStationLevel = 3;
			item.RequiredItems.Add("Perfect_Green_Socket", 5);
			item.RequiredItems.Add("Chain", 2);
			item.RequiredItems.Add("Guck", 16);
			item.Configurable = Configurability.Recipe;
			SE_Stats val = ScriptableObject.CreateInstance<SE_Stats>();
			((Object)val).name = "bmp_poisonresist_necklace";
			((StatusEffect)val).m_name = component.m_itemData.m_shared.m_name;
			((StatusEffect)val).m_icon = component.m_itemData.GetIcon();
			val.m_mods = new List<DamageModPair>
			{
				new DamageModPair
				{
					m_type = (DamageType)256,
					m_modifier = (DamageModifier)5
				}
			};
			component.m_itemData.m_shared.m_equipStatusEffect = (StatusEffect)(object)val;
		}
	}
}
namespace MagicPlugin.Functions
{
	public class ArmoredSkeleton : MonoBehaviour
	{
		public string[] m_weapons2h = new string[8] { "THSwordKrom", "Battleaxe", "BattleaxeCrystal", "AtgeirBlackmetal", "AtgeirHimminAfl", "AtgeirIron", "SledgeDemolisher", "SledgeIron" };

		public string[] m_helmet = new string[4] { "HelmetIron", "HelmetDrake", "HelmetPadded", "HelmetCarapace" };

		public string[] m_chest = new string[4] { "ArmorIronChest", "ArmorWolfChest", "ArmorPaddedCuirass", "ArmorCarapaceChest" };

		public string[] m_legs = new string[4] { "ArmorIronLegs", "ArmorWolfLegs", "ArmorPaddedGreaves", "ArmorCarapaceLegs" };

		public string[] m_cape = new string[3] { "CapeWolf", "CapeFeather", "CapeLox" };

		private ZNetView m_nview;

		private VisEquipment m_visEquipment;

		private Humanoid m_humanoid;

		private void Awake()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			m_nview = ((Component)this).GetComponent<ZNetView>();
			m_visEquipment = ((Component)this).GetComponent<VisEquipment>();
			m_humanoid = ((Component)this).GetComponent<Humanoid>();
			Helper.seed += (int)((((Component)this).gameObject.transform.position.x + ((Component)this).gameObject.transform.position.y) * 1000f);
			SetupRandomEquipment();
			SetupRandomWeapons();
		}

		private void SetupRandomEquipment()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Expected O, but got Unknown
			ItemSet[] array = new ItemSet[1];
			ItemSet val = new ItemSet();
			val.m_items = (GameObject[])(object)new GameObject[4]
			{
				ObjectDB.instance.GetItemPrefab(m_helmet.GetRandomElement()),
				ObjectDB.instance.GetItemPrefab(m_chest.GetRandomElement()),
				ObjectDB.instance.GetItemPrefab(m_legs.GetRandomElement()),
				ObjectDB.instance.GetItemPrefab(m_cape.GetRandomElement())
			};
			array[0] = val;
			ItemSet[] randomSets = (ItemSet[])(object)array;
			m_humanoid.m_randomSets = randomSets;
		}

		private void SetupRandomWeapons()
		{
			m_humanoid.m_randomWeapon = (GameObject[])(object)new GameObject[1] { ObjectDB.instance.GetItemPrefab(m_weapons2h.GetRandomElement()) };
			m_visEquipment.SetRightItem(((Object)ObjectDB.instance.GetItemPrefab(m_weapons2h.GetRandomElement())).name);
			m_visEquipment.SetRightHandEquipped(StringExtensionMethods.GetStableHashCode(((Object)ObjectDB.instance.GetItemPrefab(m_weapons2h.GetRandomElement())).name));
		}
	}
	public static class ConfigSetup
	{
		public static ConfigEntry<float> _arcticBuffEitrRegen;

		public static ConfigEntry<float> _forestMagicEitrRegen;

		public static ConfigEntry<float> _eitrBeltEitrBonus;

		public static ConfigEntry<float> _elementalistBeltBonus;

		public static ConfigEntry<float> _necromancerBeltBonus;

		public static ConfigEntry<float> _dvergrBeltBonus;

		public static ConfigEntry<float> _hogwartsBeltBonus;

		public static ConfigEntry<float> _surtlingStaffAOE;

		public static ConfigEntry<float> _neckTotemCooldown;

		public static ConfigEntry<float> _wolfTotemCooldown;

		public static ConfigEntry<int> _wolfTotemLevel;

		public static ConfigEntry<float> _crystalTotemCooldown;

		public static ConfigEntry<float> _skullTotemCooldown;

		public static ConfigEntry<float> _eikthyrStaffAOE;

		public static ConfigEntry<float> _lightningStaffAOE;

		public static ConfigEntry<float> _arcticStaffAOE;

		public static ConfigEntry<float> _healOverTime;

		public static ConfigEntry<float> _healOverTimeDuration;

		public static ConfigEntry<float> _healOverTimeInterval;

		public static ConfigEntry<float> _healStaffCooldown;

		public static ConfigEntry<float> _poisonStaffAOE;

		public static ConfigEntry<float> _modersPierceDamage;

		public static ConfigEntry<float> _modersChopDamage;

		public static ConfigEntry<float> _modersPickaxeDamage;

		public static ConfigEntry<float> _modersFrostDamage;

		public static ConfigEntry<float> _modersAoeRange;

		public static ConfigEntry<float> _modersEitrDrain;

		public static ConfigEntry<float> _modersStaminaDrain;

		public static ConfigEntry<float> _yagluthBluntDamage;

		public static ConfigEntry<float> _yagluthChopDamage;

		public static ConfigEntry<float> _yagluthPickaxeDamage;

		public static ConfigEntry<float> _yagluthFireDamage;

		public static ConfigEntry<float> _yagluthAoeRange;

		public static ConfigEntry<float> _yagluthsEitrDrain;

		public static ConfigEntry<float> _yagluthsStaminaDrain;

		public static ConfigEntry<float> _neckzillaHealth;

		public static ConfigEntry<float> _neckzillaAtkDmgSlash;

		public static ConfigEntry<float> _neckzillaAtkDmgPoison;

		public static ConfigEntry<float> _neckzillaAtkDmg2;

		public static ConfigEntry<float> _occultistHealth;

		public static ConfigEntry<float> _occultistAtk1Slash;

		public static ConfigEntry<float> _occultistAtk1Fire;

		public static ConfigEntry<float> _occultistAtk2Slash;

		public static ConfigEntry<float> _occultistAtk2Fire;

		public static ConfigEntry<float> _occultistAtk3Fire;

		public static ConfigEntry<float> _armoredSkeletonHealth;

		public static ConfigEntry<float> _toxicSlimeHealth;

		public static ConfigEntry<float> _toxicSlimeAoe;

		public static ConfigEntry<float> _fierySlimeHealth;

		public static ConfigEntry<float> _fierySlimeAoe;

		public static ConfigEntry<float> _frostySlimeHealth;

		public static ConfigEntry<float> _frostySlimeAoe;

		public static ConfigEntry<float> _lightningSlimeHealth;

		public static ConfigEntry<float> _lightningSlimeAoe;

		public static ConfigEntry<float> _beginnersBookEitr;

		public static ConfigEntry<float> _beginnersBookEitrRegen;

		public static ConfigEntry<float> _advanceBookEitr;

		public static ConfigEntry<float> _advanceBookEitrRegen;

		public static ConfigEntry<float> _druidsTomeEitr;

		public static ConfigEntry<float> _druidsTomeEitrRegen;

		public static ConfigEntry<float> _beginnersWizardHatEitr;

		public static ConfigEntry<float> _beginnersWizardHatEitrRegen;

		public static ConfigEntry<float> _advanceWizardHatEitr;

		public static ConfigEntry<float> _advanceWizardHatEitrRegen;

		public static ConfigEntry<float> _redWizardHatEitr;

		public static ConfigEntry<float> _redWizardHatEitrRegen;

		public static ConfigEntry<float> _shamanHatEitr;

		public static ConfigEntry<float> _shamanHatEitrRegen;

		public static ConfigEntry<float> _redWizardCapeEitrRegen;

		public static ConfigEntry<float> _redWizardChestEitrRegen;

		public static ConfigEntry<float> _redWizardHelmEitrRegen;

		public static ConfigEntry<float> _redWizardLegsEitrRegen;

		public static ConfigEntry<float> _flameScepterMagicSourcePrimary;

		public static ConfigEntry<float> _flameScepterMagicSourceSecondary;

		public static ConfigEntry<float> _iceScepterMagicSourcePrimary;

		public static ConfigEntry<float> _iceScepterMagicSourceSecondary;

		public static ConfigEntry<float> _lightningScepterMagicSourcePrimary;

		public static ConfigEntry<float> _lightningScepterMagicSourceSecondary;

		public static ConfigEntry<float> _dvergrEarringEitrRegen;

		public static ConfigEntry<float> _eitrEarringEitr;

		public static ConfigEntry<float> _modersCooldown;

		public static ConfigEntry<float> _yagluthsCooldown;

		public static void Init()
		{
			DvergrBelt();
			EitrBelt();
			ElementalistBelt();
			HogwartsBelt();
			NecromancerBelt();
			CrystalTotem();
			EikthyrStaff();
			LightningStaff();
			ArcticStaff();
			HealStaff();
			ModersHeritage();
			NeckTotem();
			PoisonStaff();
			SurtlingStaff();
			WolfTotem();
			YagluthsHeritage();
			SkullTotem();
			Others();
			BeginnersBook();
			AdvanceBook();
			BeginnersWizardHat();
			AdvanceWizardHat();
			RedWizardSet();
			FlameScepter();
			IceScepter();
			LightningScepter();
			DruidsTome();
			Earrings();
		}

		private static void Earrings()
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Expected O, but got Unknown
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Expected O, but got Unknown
			string group = Localization.instance.Localize("$bmp_dvergr_earring").Trim();
			_dvergrEarringEitrRegen = Plugin._Instance.config(group, "Eitr Regen", 0.25f, new ConfigDescription("Dvergr earrings eitr regen.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			string group2 = Localization.instance.Localize("$bmp_eitr_earring").Trim();
			_eitrEarringEitr = Plugin._Instance.config(group2, "Eitr Bonus", 48f, new ConfigDescription("Eitr earring eitr bonus.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f), new object[1]
			{
				new ConfigurationManagerAttributes
				{
					ShowRangeAsPercent = false
				}
			}));
		}

		private static void BeginnersWizardHat()
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Expected O, but got Unknown
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Expected O, but got Unknown
			string group = Localization.instance.Localize("$bmp_beginnerswizardhat").Trim();
			_beginnersWizardHatEitr = Plugin._Instance.config(group, "Eitr Bonus", 24f, new ConfigDescription("Beginners wizard hat eitr bonus.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 50f), Array.Empty<object>()));
			_beginnersWizardHatEitrRegen = Plugin._Instance.config(group, "Eitr Regen", 0.15f, new ConfigDescription("Beginners wizard hat eitr regen.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
		}

		private static void AdvanceWizardHat()
		{
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Expected O, but got Unknown
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Expected O, but got Unknown
			string group = Localization.instance.Localize("$bmp_advancewizardhat").Trim();
			_advanceWizardHatEitr = Plugin._Instance.config(group, "Eitr Bonus", 52f, new ConfigDescription("Advance wizard hat eitr bonus.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f), new object[1]
			{
				new ConfigurationManagerAttributes
				{
					ShowRangeAsPercent = false
				}
			}));
			_advanceWizardHatEitrRegen = Plugin._Instance.config(group, "Eitr Regen", 0.25f, new ConfigDescription("Advance wizard hat eitr regen.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
		}

		private static void RedWizardSet()
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Expected O, but got Unknown
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Expected O, but got Unknown
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Expected O, but got Unknown
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Expected O, but got Unknown
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Expected O, but got Unknown
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Expected O, but got Unknown
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Expected O, but got Unknown
			//IL_023b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0246: Expected O, but got Unknown
			string group = Localization.instance.Localize("$bmp_redwizardhat").Trim();
			_redWizardHatEitr = Plugin._Instance.config(group, "Eitr Bonus", 32f, new ConfigDescription("Red wizard hat eitr bonus.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 70f), Array.Empty<object>()));
			_redWizardHatEitrRegen = Plugin._Instance.config(group, "Eitr Regen", 0.25f, new ConfigDescription("Red wizard hat eitr regen.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			string group2 = Localization.instance.Localize("$bmp_redwizard_helm").Trim();
			_redWizardHelmEitrRegen = Plugin._Instance.config(group2, "Eitr Regen", 0.25f, new ConfigDescription("Red wizard helm eitr regen.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			string group3 = Localization.instance.Localize("$bmp_redwizard_chest").Trim();
			_redWizardChestEitrRegen = Plugin._Instance.config(group3, "Eitr Regen", 0.25f, new ConfigDescription("Red wizard chest eitr regen.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			string group4 = Localization.instance.Localize("$bmp_redwizard_legs").Trim();
			_redWizardLegsEitrRegen = Plugin._Instance.config(group4, "Eitr Regen", 0.25f, new ConfigDescription("Red wizard legs eitr regen.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			string group5 = Localization.instance.Localize("$bmp_redwizard_cape").Trim();
			_redWizardCapeEitrRegen = Plugin._Instance.config(group5, "Eitr Regen", 0.25f, new ConfigDescription("Red wizard cape eitr regen.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			string group6 = Localization.instance.Localize("$bmp_shamanhat").Trim();
			_shamanHatEitr = Plugin._Instance.config(group6, "Eitr Bonus", 16f, new ConfigDescription("Shaman hat eitr bonus.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 50f), Array.Empty<object>()));
			_shamanHatEitrRegen = Plugin._Instance.config(group6, "Eitr Regen", 0.15f, new ConfigDescription("Shaman hat eitr regen.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
		}

		private static void FlameScepter()
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Expected O, but got Unknown
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Expected O, but got Unknown
			string group = Localization.instance.Localize("$bmp_flamescepter").Trim();
			_flameScepterMagicSourcePrimary = Plugin._Instance.config(group, "PrimaryAttack Magic Source Drain", 35f, new ConfigDescription("Base magic source amount needed for primary attack.\nYou can set it to use either\nStamina, Eitr or Both in General Section", (AcceptableValueBase)(object)new AcceptableValueRange<float>(5f, 300f), Array.Empty<object>()));
			_flameScepterMagicSourceSecondary = Plugin._Instance.config(group, "SecondaryAttack Magic Source Drain", 80f, new ConfigDescription("Base magic source amount needed for secondary attack.\nYou can set it to use either\nStamina, Eitr or Both in General Section", (AcceptableValueBase)(object)new AcceptableValueRange<float>(5f, 300f), Array.Empty<object>()));
		}

		private static void IceScepter()
		{
			//IL_003e: Un