Decompiled source of Monster Modifiers v1.0.15

MonsterModifiers.dll

Decompiled 2 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.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 System.Threading;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using JetBrains.Annotations;
using Jotunn;
using Jotunn.Entities;
using Jotunn.Managers;
using Jotunn.Utils;
using Microsoft.CodeAnalysis;
using MonsterModifiers.Custom_Components;
using MonsterModifiers.Modifiers;
using MonsterModifiers.StatusEffects;
using ServerSync;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
using YamlDotNet.Core;
using YamlDotNet.Core.Events;
using YamlDotNet.Core.Tokens;
using YamlDotNet.Helpers;
using YamlDotNet.Serialization;
using YamlDotNet.Serialization.BufferedDeserialization;
using YamlDotNet.Serialization.BufferedDeserialization.TypeDiscriminators;
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: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("MonsterModifiers")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyProduct("MonsterModifiers")]
[assembly: AssemblyCopyright("Copyright ©  2022")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("E0E2F92E-557C-4A05-9D89-AA92A0BD75C4")]
[assembly: AssemblyFileVersion("1.0.15")]
[assembly: AssemblyCompany("warpalicious")]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.15.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[<d546b5e5-b089-4c29-b415-70483a99102a>Embedded]
	internal sealed class <d546b5e5-b089-4c29-b415-70483a99102a>EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[<d546b5e5-b089-4c29-b415-70483a99102a>Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	[CompilerGenerated]
	internal sealed class <fc5be810-4db8-41b3-ad01-e0fc32c8cff7>NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public <fc5be810-4db8-41b3-ad01-e0fc32c8cff7>NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public <fc5be810-4db8-41b3-ad01-e0fc32c8cff7>NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[<d546b5e5-b089-4c29-b415-70483a99102a>Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class <702fd9c8-9d57-4b33-a10d-166849d4a270>NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public <702fd9c8-9d57-4b33-a10d-166849d4a270>NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace MonsterModifiers
{
	[<fc5be810-4db8-41b3-ad01-e0fc32c8cff7>Nullable(0)]
	[BepInPlugin("warpalicious.MonsterModifiers", "MonsterModifiers", "1.0.15")]
	[<702fd9c8-9d57-4b33-a10d-166849d4a270>NullableContext(1)]
	public class MonsterModifiersPlugin : BaseUnityPlugin
	{
		[<702fd9c8-9d57-4b33-a10d-166849d4a270>NullableContext(0)]
		public enum Toggle
		{
			On = 1,
			Off = 0
		}

		[<702fd9c8-9d57-4b33-a10d-166849d4a270>NullableContext(0)]
		private class ConfigurationManagerAttributes
		{
			[UsedImplicitly]
			public int? Order = null;

			[UsedImplicitly]
			public bool? Browsable = null;

			[UsedImplicitly]
			[<fc5be810-4db8-41b3-ad01-e0fc32c8cff7>Nullable(2)]
			public string Category = null;

			[UsedImplicitly]
			[<fc5be810-4db8-41b3-ad01-e0fc32c8cff7>Nullable(new byte[] { 2, 1 })]
			public Action<ConfigEntryBase> CustomDrawer = null;
		}

		[<fc5be810-4db8-41b3-ad01-e0fc32c8cff7>Nullable(0)]
		private class AcceptableShortcuts : AcceptableValueBase
		{
			public AcceptableShortcuts()
				: base(typeof(KeyboardShortcut))
			{
			}

			public override object Clamp(object value)
			{
				return value;
			}

			public override bool IsValid(object value)
			{
				return true;
			}

			public override string ToDescriptionString()
			{
				return "# Acceptable values: " + string.Join(", ", UnityInput.Current.SupportedKeyCodes);
			}
		}

		internal const string ModName = "MonsterModifiers";

		internal const string ModVersion = "1.0.15";

		internal const string Author = "warpalicious";

		private const string ModGUID = "warpalicious.MonsterModifiers";

		private static string ConfigFileName = "warpalicious.MonsterModifiers.cfg";

		private static string ConfigFileFullPath;

		internal static string ConnectionError;

		private readonly Harmony _harmony = new Harmony("warpalicious.MonsterModifiers");

		public static readonly ManualLogSource MonsterModifiersLogger;

		private static readonly ConfigSync ConfigSync;

		public Texture2D tex = null;

		private static ConfigEntry<Toggle> _serverConfigLocked;

		public void Awake()
		{
			bool saveOnConfigSet = ((BaseUnityPlugin)this).Config.SaveOnConfigSet;
			((BaseUnityPlugin)this).Config.SaveOnConfigSet = false;
			_serverConfigLocked = config("1 - General", "Lock Configuration", Toggle.On, "If on, the configuration is locked and can be changed by server admins only.");
			ConfigSync.AddLockingConfigEntry<Toggle>(_serverConfigLocked);
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			_harmony.PatchAll(executingAssembly);
			SetupWatcher();
			if (saveOnConfigSet)
			{
				((BaseUnityPlugin)this).Config.SaveOnConfigSet = saveOnConfigSet;
				((BaseUnityPlugin)this).Config.Save();
			}
			YamlUtils.ParseDefaultYamls();
			TranslationUtils.AddLocalizations();
			ModifierAssetUtils.Setup();
			ModifierAssetUtils.LoadAllIcons();
			ShieldDome.LoadShieldDome();
			CompatibilityUtils.RunCompatibiltyChecks();
			StatusEffectUtils.CreateCustomStatusEffects();
			PrefabManager.OnVanillaPrefabsAvailable += PrefabUtils.CreateCustomPrefabs;
		}

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

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

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

		private ConfigEntry<T> config<[<fc5be810-4db8-41b3-ad01-e0fc32c8cff7>Nullable(2)] T>(string group, string name, T value, ConfigDescription description, bool synchronizedSetting = true)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			ConfigDescription val = new ConfigDescription(description.Description + (synchronizedSetting ? " [Synced with Server]" : " [Not Synced with Server]"), description.AcceptableValues, description.Tags);
			ConfigEntry<T> val2 = ((BaseUnityPlugin)this).Config.Bind<T>(group, name, value, val);
			SyncedConfigEntry<T> syncedConfigEntry = ConfigSync.AddConfigEntry<T>(val2);
			syncedConfigEntry.SynchronizedConfig = synchronizedSetting;
			return val2;
		}

		private ConfigEntry<T> config<[<fc5be810-4db8-41b3-ad01-e0fc32c8cff7>Nullable(2)] T>(string group, string name, T value, string description, bool synchronizedSetting = true)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			return config(group, name, value, new ConfigDescription(description, (AcceptableValueBase)null, Array.Empty<object>()), synchronizedSetting);
		}

		static MonsterModifiersPlugin()
		{
			string configPath = Paths.ConfigPath;
			char directorySeparatorChar = Path.DirectorySeparatorChar;
			ConfigFileFullPath = configPath + directorySeparatorChar + ConfigFileName;
			ConnectionError = "";
			MonsterModifiersLogger = Logger.CreateLogSource("MonsterModifiers");
			ConfigSync = new ConfigSync("warpalicious.MonsterModifiers")
			{
				DisplayName = "MonsterModifiers",
				CurrentVersion = "1.0.15",
				MinimumRequiredVersion = "1.0.15"
			};
			_serverConfigLocked = null;
		}
	}
	public static class KeyboardExtensions
	{
		public static bool IsKeyDown(this KeyboardShortcut shortcut)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			return (int)((KeyboardShortcut)(ref shortcut)).MainKey != 0 && Input.GetKeyDown(((KeyboardShortcut)(ref shortcut)).MainKey) && ((KeyboardShortcut)(ref shortcut)).Modifiers.All((Func<KeyCode, bool>)Input.GetKey);
		}

		public static bool IsKeyHeld(this KeyboardShortcut shortcut)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			return (int)((KeyboardShortcut)(ref shortcut)).MainKey != 0 && Input.GetKey(((KeyboardShortcut)(ref shortcut)).MainKey) && ((KeyboardShortcut)(ref shortcut)).Modifiers.All((Func<KeyCode, bool>)Input.GetKey);
		}
	}
	public class CompatibilityUtils
	{
		public static void RunCompatibiltyChecks()
		{
			if (Chainloader.PluginInfos.ContainsKey("CreatureLevelControl"))
			{
				MonsterModifiersPlugin.MonsterModifiersLogger.LogWarning((object)"CreatureLevelandLootControl plugin is installed. Please ensure special effects and infusions are disabled in CLLC configuration.");
			}
		}
	}
	[<702fd9c8-9d57-4b33-a10d-166849d4a270>NullableContext(1)]
	[<fc5be810-4db8-41b3-ad01-e0fc32c8cff7>Nullable(0)]
	public class DamageUtils
	{
		public static float TryCurrentWeapon(Humanoid humanoid)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			ItemData currentWeapon = humanoid.GetCurrentWeapon();
			if (currentWeapon == null)
			{
				return 10f;
			}
			DamageTypes damage = currentWeapon.GetDamage();
			if (((DamageTypes)(ref damage)).HaveDamage())
			{
				return 10f;
			}
			float totalDamage = ((DamageTypes)(ref damage)).GetTotalDamage();
			if (totalDamage == 0f)
			{
				return 10f;
			}
			DamageTypes damage2 = humanoid.GetCurrentWeapon().GetDamage();
			return ((DamageTypes)(ref damage2)).GetTotalDamage();
		}

		public static float TryWeaponList(GameObject[] weaponArray)
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			float num = 10f;
			List<GameObject> list = weaponArray.ToList();
			if (list.Count > 0)
			{
				foreach (GameObject item in list)
				{
					ItemData itemData = item.GetComponent<ItemDrop>().m_itemData;
					if (itemData != null)
					{
						DamageTypes damage = itemData.GetDamage();
						float totalDamage = ((DamageTypes)(ref damage)).GetTotalDamage();
						if (totalDamage > num)
						{
							num = totalDamage;
						}
					}
				}
			}
			if (num > 0f)
			{
			}
			return num;
		}

		public static float CalculateDamage(Character character)
		{
			Humanoid val = (Humanoid)(object)((character is Humanoid) ? character : null);
			if ((Object)(object)val == (Object)null)
			{
				return 10f;
			}
			float num = 10f;
			float num2 = TryCurrentWeapon(val);
			if (num2 > 0f && num2 > num)
			{
				num = num2;
			}
			float num3 = TryWeaponList(val.m_defaultItems);
			if (num3 > 0f && num3 > num)
			{
				num = num3;
			}
			float num4 = TryWeaponList(val.m_randomWeapon);
			if (num4 > 0f && num4 > num)
			{
				num = num4;
			}
			return num * 0.5f;
		}
	}
	[<fc5be810-4db8-41b3-ad01-e0fc32c8cff7>Nullable(0)]
	[<702fd9c8-9d57-4b33-a10d-166849d4a270>NullableContext(1)]
	public class ModifierAssetUtils
	{
		public static AssetBundle ashlandsAssetBundle;

		public static AssetBundle statusEffectBundle;

		public static AssetBundle modiferIconsBundle;

		public static Sprite swordIcon;

		public static Sprite shieldIcon;

		public static Sprite plusSquareIcon;

		public static Sprite circleIcon;

		public static Sprite soulIcon;

		public static Sprite skullIcon;

		public static Sprite appleIcon;

		public static Sprite shieldBrokenIcon;

		public static Sprite potionIcon;

		public static Sprite bloodIcon;

		public static Sprite bloodIconRed;

		public static Sprite heartIcon;

		public static void Setup()
		{
			ashlandsAssetBundle = AssetUtils.LoadAssetBundleFromResources("monster_modifiers_ashlands", Assembly.GetExecutingAssembly());
			statusEffectBundle = AssetUtils.LoadAssetBundleFromResources("statusicon", Assembly.GetExecutingAssembly());
			modiferIconsBundle = AssetUtils.LoadAssetBundleFromResources("modifiericons", Assembly.GetExecutingAssembly());
		}

		public static void LoadAllIcons()
		{
			swordIcon = modiferIconsBundle.LoadAsset<Sprite>("Assets/WarpProjects/Modifiers/NewModifierIcons/Sword.png");
			shieldIcon = modiferIconsBundle.LoadAsset<Sprite>("Assets/WarpProjects/Modifiers/NewModifierIcons/Shield.png");
			plusSquareIcon = modiferIconsBundle.LoadAsset<Sprite>("Assets/WarpProjects/Modifiers/NewModifierIcons/PlusBox.png");
			circleIcon = modiferIconsBundle.LoadAsset<Sprite>("Assets/WarpProjects/Modifiers/NewModifierIcons/Circle.png");
			soulIcon = modiferIconsBundle.LoadAsset<Sprite>("Assets/WarpProjects/Modifiers/NewModifierIcons/SoulEater.png");
			skullIcon = modiferIconsBundle.LoadAsset<Sprite>("Assets/WarpProjects/Modifiers/NewModifierIcons/Skull.png");
			appleIcon = modiferIconsBundle.LoadAsset<Sprite>("Assets/WarpProjects/Modifiers/NewModifierIcons/Apple.png");
			shieldBrokenIcon = modiferIconsBundle.LoadAsset<Sprite>("Assets/WarpProjects/Modifiers/NewModifierIcons/ShieldBroken.png");
			potionIcon = modiferIconsBundle.LoadAsset<Sprite>("Assets/WarpProjects/Modifiers/NewModifierIcons/Potion.png");
			heartIcon = modiferIconsBundle.LoadAsset<Sprite>("Assets/WarpProjects/Modifiers/NewModifierIcons/heartIcon.png");
			bloodIcon = statusEffectBundle.LoadAsset<Sprite>("Assets/WarpProjects/Modifiers/NewModifierIcons/bloodIcon.png");
			bloodIconRed = statusEffectBundle.LoadAsset<Sprite>("Assets/WarpProjects/Modifiers/NewModifierIcons/bloodIconRed.png");
		}
	}
	public enum MonsterModifierTypes
	{
		StaminaSiphon,
		EitrSiphon,
		ShieldBreaker,
		FoodDrain,
		IgnoreArmor,
		PoisonDeath,
		FrostDeath,
		FireDeath,
		HealDeath,
		StaggerDeath,
		TarDeath,
		PersonalShield,
		ShieldDome,
		SoulEater,
		RemoveStatusEffect,
		StaggerImmune,
		FireInfused,
		PoisonInfused,
		FrostInfused,
		LightningInfused,
		ElementalImmunity,
		PhysicalImmunity,
		FastMovement,
		FastAttackSpeed,
		DistantDetection,
		BloodLoss,
		Absorption
	}
	[<702fd9c8-9d57-4b33-a10d-166849d4a270>NullableContext(1)]
	[<fc5be810-4db8-41b3-ad01-e0fc32c8cff7>Nullable(0)]
	public class ModifierData
	{
		public int weight { get; set; }

		public List<float> color { get; set; }
	}
	[<702fd9c8-9d57-4b33-a10d-166849d4a270>NullableContext(1)]
	[<fc5be810-4db8-41b3-ad01-e0fc32c8cff7>Nullable(0)]
	public class ModifierUtils
	{
		public static Dictionary<MonsterModifierTypes, ModifierData> modifiers;

		public static Color GetModifierColor(MonsterModifierTypes modifier)
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			List<float> color = modifiers[modifier].color;
			Color result = default(Color);
			((Color)(ref result))..ctor(color[0], color[1], color[2], color[3]);
			return result;
		}

		public static Sprite GetModifierIcon(MonsterModifierTypes modifier)
		{
			if (modifier == MonsterModifierTypes.FireInfused || modifier == MonsterModifierTypes.FrostInfused || modifier == MonsterModifierTypes.PoisonInfused || modifier == MonsterModifierTypes.LightningInfused || modifier == MonsterModifierTypes.RemoveStatusEffect)
			{
				return ModifierAssetUtils.swordIcon;
			}
			if (modifier == MonsterModifierTypes.ShieldBreaker || modifier == MonsterModifierTypes.IgnoreArmor)
			{
				return ModifierAssetUtils.shieldBrokenIcon;
			}
			if (modifier == MonsterModifierTypes.StaminaSiphon || modifier == MonsterModifierTypes.EitrSiphon)
			{
				return ModifierAssetUtils.potionIcon;
			}
			switch (modifier)
			{
			case MonsterModifierTypes.FoodDrain:
				return ModifierAssetUtils.appleIcon;
			default:
				if (modifier != MonsterModifierTypes.TarDeath)
				{
					if (modifier == MonsterModifierTypes.ElementalImmunity || modifier == MonsterModifierTypes.PhysicalImmunity || modifier == MonsterModifierTypes.StaggerImmune)
					{
						return ModifierAssetUtils.shieldIcon;
					}
					if (modifier == MonsterModifierTypes.PersonalShield || modifier == MonsterModifierTypes.ShieldDome)
					{
						return ModifierAssetUtils.circleIcon;
					}
					switch (modifier)
					{
					case MonsterModifierTypes.SoulEater:
						return ModifierAssetUtils.soulIcon;
					default:
						if (modifier != MonsterModifierTypes.DistantDetection)
						{
							switch (modifier)
							{
							case MonsterModifierTypes.BloodLoss:
								return ModifierAssetUtils.bloodIcon;
							case MonsterModifierTypes.Absorption:
								return ModifierAssetUtils.heartIcon;
							default:
								Debug.Log((object)"Could not find icon for modifier");
								return ModifierAssetUtils.plusSquareIcon;
							}
						}
						goto case MonsterModifierTypes.FastMovement;
					case MonsterModifierTypes.FastMovement:
					case MonsterModifierTypes.FastAttackSpeed:
						return ModifierAssetUtils.plusSquareIcon;
					}
				}
				goto case MonsterModifierTypes.PoisonDeath;
			case MonsterModifierTypes.PoisonDeath:
			case MonsterModifierTypes.FrostDeath:
			case MonsterModifierTypes.FireDeath:
			case MonsterModifierTypes.HealDeath:
			case MonsterModifierTypes.StaggerDeath:
				return ModifierAssetUtils.skullIcon;
			}
		}

		public static int GetModifierWeight(MonsterModifierTypes modifier)
		{
			return modifiers[modifier].weight;
		}

		public static List<MonsterModifierTypes> RollRandomModifiers(int numModifiers)
		{
			List<MonsterModifierTypes> list = new List<MonsterModifierTypes>();
			Dictionary<MonsterModifierTypes, ModifierData> dictionary = new Dictionary<MonsterModifierTypes, ModifierData>(modifiers);
			for (int i = 0; i < numModifiers; i++)
			{
				int num = 0;
				foreach (ModifierData value in dictionary.Values)
				{
					num += value.weight;
				}
				int num2 = Random.Range(0, num);
				int num3 = 0;
				MonsterModifierTypes monsterModifierTypes = MonsterModifierTypes.StaminaSiphon;
				foreach (KeyValuePair<MonsterModifierTypes, ModifierData> item in dictionary)
				{
					num3 += item.Value.weight;
					if (num2 < num3)
					{
						monsterModifierTypes = item.Key;
						break;
					}
				}
				list.Add(monsterModifierTypes);
				dictionary.Remove(monsterModifierTypes);
				if (monsterModifierTypes == MonsterModifierTypes.ElementalImmunity)
				{
					dictionary.Remove(MonsterModifierTypes.PhysicalImmunity);
				}
				if (monsterModifierTypes == MonsterModifierTypes.PhysicalImmunity)
				{
					dictionary.Remove(MonsterModifierTypes.ElementalImmunity);
				}
			}
			return list;
		}

		public static void RunBiomeChecks()
		{
		}

		public static bool RunRPCDamageChecks(Character character, HitData hit)
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Invalid comparison between Unknown and I4
			if (hit == null || (Object)(object)character == (Object)null)
			{
				return false;
			}
			if (((DamageTypes)(ref hit.m_damage)).GetTotalDamage() == 0f)
			{
				return false;
			}
			if ((int)hit.m_hitType != 1)
			{
				return false;
			}
			return true;
		}

		public static bool RunRPCDamageChecks(Character character, HitData hit, bool isMonsterAttackingPlayer)
		{
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Invalid comparison between Unknown and I4
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Invalid comparison between Unknown and I4
			if (hit == null || (Object)(object)character == (Object)null)
			{
				Debug.Log((object)"Hit or character is null");
				return true;
			}
			if (((DamageTypes)(ref hit.m_damage)).GetTotalDamage() == 0f)
			{
				Debug.Log((object)"Total damage is 0");
				return true;
			}
			if (isMonsterAttackingPlayer)
			{
				if ((int)hit.m_hitType != 1)
				{
					Debug.Log((object)"hit type is not enemy hit");
					return true;
				}
			}
			else if ((int)hit.m_hitType != 2)
			{
				Debug.Log((object)"hit type is not player hit");
				return true;
			}
			return true;
		}

		public static bool RunHitChecks(HitData hit, bool isMonsterAttackingPlayer)
		{
			Character attacker = hit.GetAttacker();
			if ((Object)(object)attacker == (Object)null)
			{
				return false;
			}
			if (isMonsterAttackingPlayer && attacker.IsPlayer())
			{
				return false;
			}
			if (!isMonsterAttackingPlayer && attacker.IsPlayer())
			{
				return true;
			}
			return true;
		}
	}
	[<702fd9c8-9d57-4b33-a10d-166849d4a270>NullableContext(1)]
	[<fc5be810-4db8-41b3-ad01-e0fc32c8cff7>Nullable(0)]
	public class PrefabUtils
	{
		public static GameObject leechDeathVFX;

		public static GameObject leechDeathSFX;

		public static void CreateCustomPrefabs()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected O, but got Unknown
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Expected O, but got Unknown
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Expected O, but got Unknown
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			GameObject prefab = PrefabManager.Instance.GetPrefab("shaman_heal_aoe");
			GameObject val = PrefabManager.Instance.CreateClonedPrefab("healCustomPrefab", prefab);
			CustomPrefab val2 = new CustomPrefab(val, false);
			Aoe component = val2.Prefab.GetComponent<Aoe>();
			component.m_statusEffect = "";
			GameObject prefab2 = PrefabManager.Instance.GetPrefab("Mistile");
			GameObject val3 = PrefabManager.Instance.CreateClonedPrefab("mistleCustomPrefab", prefab2);
			CustomPrefab val4 = new CustomPrefab(val3, false);
			Character component2 = (Character)(object)val4.Prefab.GetComponent<Humanoid>();
			component2.m_speed = 0f;
			component2.m_flyFastSpeed = 0f;
			component2.m_flySlowSpeed = 0f;
			component2.m_name = "$modifier_mistile";
			val4.Prefab.GetComponent<CharacterTimedDestruction>().m_timeoutMin = 2f;
			val4.Prefab.GetComponent<CharacterTimedDestruction>().m_timeoutMax = 4f;
			GameObject prefab3 = PrefabManager.Instance.GetPrefab("fx_DvergerMage_Mistile_attack");
			GameObject val5 = PrefabManager.Instance.CreateClonedPrefab("staggerDeathNovaCustomPrefab", prefab3);
			CustomPrefab val6 = new CustomPrefab(val5, false);
			GameObject gameObject = ((Component)ExposedGameObjectExtension.FindDeepChild(val6.Prefab, "shockwave (1)", (IterativeSearchType)1)).gameObject;
			ParticleSystem component3 = gameObject.GetComponent<ParticleSystem>();
			MainModule main = component3.main;
			((MainModule)(ref main)).startRotationX = new MinMaxCurve((float)Math.PI / 2f);
			((MainModule)(ref main)).startRotationY = new MinMaxCurve(0f);
			((MainModule)(ref main)).startRotationZ = new MinMaxCurve(0f);
			PrefabManager.Instance.AddPrefab(val2);
			PrefabManager.Instance.AddPrefab(val4);
			PrefabManager.Instance.AddPrefab(val6);
			leechDeathVFX = PrefabManager.Instance.GetPrefab("vfx_leech_death");
			leechDeathSFX = PrefabManager.Instance.GetPrefab("sfx_leech_death");
			PrefabManager.OnVanillaPrefabsAvailable -= CreateCustomPrefabs;
		}
	}
	public static class SpawnCommands
	{
		[HarmonyPatch(typeof(Terminal), "InitTerminal")]
		private static class Patch_Terminal_InitTerminal
		{
			[Serializable]
			[CompilerGenerated]
			private sealed class <>c
			{
				public static readonly <>c <>9 = new <>c();

				public static ConsoleEvent <>9__1_0;

				[<702fd9c8-9d57-4b33-a10d-166849d4a270>NullableContext(1)]
				internal void <Postfix>b__1_0(ConsoleEventArgs args)
				{
					if (args.Length > 2)
					{
						string creatureName = args[1];
						string modifierName = args[2];
						SpawnModifier(creatureName, modifierName);
					}
					else
					{
						args.Context.AddString("Usage: modifier [creature] [modifier]");
					}
				}
			}

			[HarmonyPriority(800)]
			private static void Prefix(out bool __state)
			{
				__state = Terminal.m_terminalInitialized;
			}

			private static void Postfix(bool __state)
			{
				//IL_004b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0037: Unknown result type (might be due to invalid IL or missing references)
				//IL_003c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0042: Expected O, but got Unknown
				if (__state)
				{
					return;
				}
				MonsterModifiersPlugin.MonsterModifiersLogger.LogInfo((object)"Adding Terminal Commands for monster modifier spawning.");
				object obj = <>c.<>9__1_0;
				if (obj == null)
				{
					ConsoleEvent val = [<702fd9c8-9d57-4b33-a10d-166849d4a270>NullableContext(1)] (ConsoleEventArgs args) =>
					{
						if (args.Length > 2)
						{
							string creatureName = args[1];
							string modifierName = args[2];
							SpawnModifier(creatureName, modifierName);
						}
						else
						{
							args.Context.AddString("Usage: modifier [creature] [modifier]");
						}
					};
					<>c.<>9__1_0 = val;
					obj = (object)val;
				}
				new ConsoleCommand("modifier", "[creature] [modifier]", (ConsoleEvent)obj, true, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false);
			}
		}

		[<702fd9c8-9d57-4b33-a10d-166849d4a270>NullableContext(1)]
		public static void SpawnModifier(string creatureName, string modifierName)
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: 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_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			GameObject prefab = ZNetScene.instance.GetPrefab(creatureName);
			MonsterModifierTypes result;
			if ((Object)(object)prefab == (Object)null)
			{
				((Character)Player.m_localPlayer).Message((MessageType)1, "Missing object " + creatureName, 0, (Sprite)null);
			}
			else if (Enum.TryParse<MonsterModifierTypes>(modifierName, ignoreCase: true, out result))
			{
				Vector3 insideUnitSphere = Random.insideUnitSphere;
				GameObject val = Object.Instantiate<GameObject>(prefab, ((Component)Player.m_localPlayer).transform.position + ((Component)Player.m_localPlayer).transform.forward * 2f + Vector3.up + insideUnitSphere, Quaternion.identity);
				Character component = val.GetComponent<Character>();
				if (component.m_nview.GetZDO().IsOwner())
				{
					component.SetLevel(2);
					string text = string.Join(",", modifierName);
					component.m_nview.GetZDO().Set("modifiers", text);
				}
			}
			else
			{
				((Character)Player.m_localPlayer).Message((MessageType)1, "Invalid modifier name: " + modifierName, 0, (Sprite)null);
			}
		}
	}
	public class StatusEffectUtils
	{
		public static void CreateCustomStatusEffects()
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: 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
			BloodLoss_SE bloodLoss_SE = ScriptableObject.CreateInstance<BloodLoss_SE>();
			((Object)bloodLoss_SE).name = "BloodLossStatusEffect";
			((StatusEffect)bloodLoss_SE).m_name = "$se_bloodLoss";
			((StatusEffect)bloodLoss_SE).m_icon = ModifierAssetUtils.bloodIconRed;
			CustomStatusEffect val = new CustomStatusEffect((StatusEffect)(object)bloodLoss_SE, false);
			HealDeath_SE healDeath_SE = ScriptableObject.CreateInstance<HealDeath_SE>();
			((Object)healDeath_SE).name = "HealDeathStatusEffect";
			((StatusEffect)healDeath_SE).m_name = "$se_healDeath";
			((StatusEffect)healDeath_SE).m_ttl = 5f;
			((SE_Stats)healDeath_SE).m_tickInterval = 1f;
			((SE_Stats)healDeath_SE).m_healthOverTimeDuration = 5f;
			((SE_Stats)healDeath_SE).m_healthOverTimeInterval = 0.5f;
			((SE_Stats)healDeath_SE).m_healthOverTimeTicks = 10f;
			((SE_Stats)healDeath_SE).m_healthOverTime = 0f;
			CustomStatusEffect val2 = new CustomStatusEffect((StatusEffect)(object)healDeath_SE, false);
			ItemManager.Instance.AddStatusEffect(val);
			ItemManager.Instance.AddStatusEffect(val2);
		}
	}
	public class TranslationUtils
	{
		[<fc5be810-4db8-41b3-ad01-e0fc32c8cff7>Nullable(1)]
		public static CustomLocalization Localization;

		public static void AddLocalizations()
		{
			Localization = LocalizationManager.Instance.GetLocalization();
			CustomLocalization localization = Localization;
			string text = "English";
			localization.AddTranslation(ref text, new Dictionary<string, string>
			{
				{ "$se_bloodLoss", "Blood Loss" },
				{ "$modifier_mistile", "Stagger Bomb" }
			});
		}
	}
	public class WorldUtils
	{
		[<702fd9c8-9d57-4b33-a10d-166849d4a270>NullableContext(1)]
		public static List<Character> GetAllCharacter(Vector3 position, float range)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			Collider[] array = Physics.OverlapBox(position, Vector3.one * range, Quaternion.identity);
			List<Character> list = new List<Character>();
			Collider[] array2 = array;
			foreach (Collider val in array2)
			{
				Character componentInChildren = ((Component)((Component)val).transform.root).gameObject.GetComponentInChildren<Character>();
				if ((Object)(object)componentInChildren != (Object)null)
				{
					list.Add(componentInChildren);
				}
			}
			return list;
		}
	}
	public class YamlUtils
	{
		[<fc5be810-4db8-41b3-ad01-e0fc32c8cff7>Nullable(1)]
		public static string defaultModifierValues;

		public static void ParseDefaultYamls()
		{
			defaultModifierValues = AssetUtils.LoadTextFromResources("modifierValues.yml");
			IDeserializer deserializer = new DeserializerBuilder().WithNamingConvention(CamelCaseNamingConvention.Instance).Build();
			ModifierUtils.modifiers = deserializer.Deserialize<Dictionary<MonsterModifierTypes, ModifierData>>(new StringReader(defaultModifierValues));
		}
	}
	[HarmonyPatch(typeof(ZNet), "OnNewConnection")]
	public static class RegisterAndCheckVersion
	{
		[<702fd9c8-9d57-4b33-a10d-166849d4a270>NullableContext(1)]
		private static void Prefix(ZNetPeer peer, ref ZNet __instance)
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			MonsterModifiersPlugin.MonsterModifiersLogger.LogDebug((object)"Registering version RPC handler");
			peer.m_rpc.Register<ZPackage>("MonsterModifiers_VersionCheck", (Action<ZRpc, ZPackage>)RpcHandlers.RPC_MonsterModifiers_Version);
			MonsterModifiersPlugin.MonsterModifiersLogger.LogDebug((object)"Invoking version check");
			ZPackage val = new ZPackage();
			val.Write("1.0.15");
			peer.m_rpc.Invoke("MonsterModifiers_VersionCheck", new object[1] { val });
		}
	}
	[HarmonyPatch(typeof(ZNet), "RPC_PeerInfo")]
	[<fc5be810-4db8-41b3-ad01-e0fc32c8cff7>Nullable(0)]
	[<702fd9c8-9d57-4b33-a10d-166849d4a270>NullableContext(1)]
	public static class VerifyClient
	{
		private static bool Prefix(ZRpc rpc, ZPackage pkg, ref ZNet __instance)
		{
			if (!__instance.IsServer() || RpcHandlers.ValidatedPeers.Contains(rpc))
			{
				return true;
			}
			MonsterModifiersPlugin.MonsterModifiersLogger.LogWarning((object)("Peer (" + rpc.m_socket.GetHostName() + ") never sent version or couldn't due to previous disconnect, disconnecting"));
			rpc.Invoke("Error", new object[1] { 3 });
			return false;
		}

		private static void Postfix(ZNet __instance)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			ZRoutedRpc.instance.InvokeRoutedRPC(ZRoutedRpc.instance.GetServerPeerID(), "MonsterModifiersRequestAdminSync", new object[1] { (object)new ZPackage() });
		}
	}
	[HarmonyPatch(typeof(FejdStartup), "ShowConnectError")]
	public class ShowConnectionError
	{
		[<702fd9c8-9d57-4b33-a10d-166849d4a270>NullableContext(1)]
		private static void Postfix(FejdStartup __instance)
		{
			if (__instance.m_connectionFailedPanel.activeSelf)
			{
				__instance.m_connectionFailedError.fontSizeMax = 25f;
				__instance.m_connectionFailedError.fontSizeMin = 15f;
				TMP_Text connectionFailedError = __instance.m_connectionFailedError;
				connectionFailedError.text = connectionFailedError.text + "\n" + MonsterModifiersPlugin.ConnectionError;
			}
		}
	}
	[HarmonyPatch(typeof(ZNet), "Disconnect")]
	public static class RemoveDisconnectedPeerFromVerified
	{
		[<702fd9c8-9d57-4b33-a10d-166849d4a270>NullableContext(1)]
		private static void Prefix(ZNetPeer peer, ref ZNet __instance)
		{
			if (__instance.IsServer())
			{
				MonsterModifiersPlugin.MonsterModifiersLogger.LogInfo((object)("Peer (" + peer.m_rpc.m_socket.GetHostName() + ") disconnected, removing from validated list"));
				RpcHandlers.ValidatedPeers.Remove(peer.m_rpc);
			}
		}
	}
	[<fc5be810-4db8-41b3-ad01-e0fc32c8cff7>Nullable(0)]
	[<702fd9c8-9d57-4b33-a10d-166849d4a270>NullableContext(1)]
	public static class RpcHandlers
	{
		public static readonly List<ZRpc> ValidatedPeers = new List<ZRpc>();

		public static void RPC_MonsterModifiers_Version(ZRpc rpc, ZPackage pkg)
		{
			string text = pkg.ReadString();
			MonsterModifiersPlugin.MonsterModifiersLogger.LogInfo((object)("Version check, local: 1.0.15,  remote: " + text));
			if (text != "1.0.15")
			{
				MonsterModifiersPlugin.ConnectionError = "MonsterModifiers Installed: 1.0.15\n Needed: " + text;
				if (ZNet.instance.IsServer())
				{
					MonsterModifiersPlugin.MonsterModifiersLogger.LogWarning((object)("Peer (" + rpc.m_socket.GetHostName() + ") has incompatible version, disconnecting..."));
					rpc.Invoke("Error", new object[1] { 3 });
				}
			}
			else if (!ZNet.instance.IsServer())
			{
				MonsterModifiersPlugin.MonsterModifiersLogger.LogInfo((object)"Received same version from server!");
			}
			else
			{
				MonsterModifiersPlugin.MonsterModifiersLogger.LogInfo((object)("Adding peer (" + rpc.m_socket.GetHostName() + ") to validated list"));
				ValidatedPeers.Add(rpc);
			}
		}
	}
}
namespace MonsterModifiers.StatusEffects
{
	[<fc5be810-4db8-41b3-ad01-e0fc32c8cff7>Nullable(0)]
	[<702fd9c8-9d57-4b33-a10d-166849d4a270>NullableContext(1)]
	public class BloodLoss_SE : StatusEffect
	{
		public int bloodLossAmount = 0;

		public int bloodLossCap;

		private float reductionTimer = 0f;

		private bool shouldRemove = false;

		public override void Setup(Character character)
		{
			((StatusEffect)this).Setup(character);
			bloodLossCap = Mathf.FloorToInt(character.GetMaxHealth());
		}

		public override void UpdateStatusEffect(float dt)
		{
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Expected O, but got Unknown
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			reductionTimer += dt;
			if (reductionTimer >= 60f)
			{
				bloodLossAmount = Mathf.Max(0, bloodLossAmount - 10);
				shouldRemove = true;
				reductionTimer = 0f;
			}
			if (bloodLossAmount > bloodLossCap)
			{
				bloodLossAmount = 0;
				HitData val = new HitData
				{
					m_damage = 
					{
						m_slash = base.m_character.GetMaxHealth() * 0.3f
					}
				};
				base.m_character.Damage(val);
				Object.Instantiate<GameObject>(PrefabUtils.leechDeathSFX, ((Component)base.m_character).transform.position, ((Component)base.m_character).transform.rotation);
				Object.Instantiate<GameObject>(PrefabUtils.leechDeathVFX, ((Component)base.m_character).transform.position, ((Component)base.m_character).transform.rotation);
				shouldRemove = true;
			}
		}

		public override string GetIconText()
		{
			return bloodLossAmount.ToString();
		}

		public override void OnDamaged(HitData hit, Character attacker)
		{
			if (ModifierUtils.RunRPCDamageChecks(attacker, hit) && ModifierUtils.RunHitChecks(hit, isMonsterAttackingPlayer: true))
			{
				MonsterModifier component = ((Component)attacker).GetComponent<MonsterModifier>();
				if (!((Object)(object)component == (Object)null) && component.Modifiers.Contains(MonsterModifierTypes.BloodLoss))
				{
					bloodLossAmount += Mathf.FloorToInt(hit.GetTotalDamage());
				}
			}
		}

		public override bool IsDone()
		{
			return shouldRemove || ((StatusEffect)this).IsDone();
		}
	}
	public class HealDeath_SE : SE_Stats
	{
		public override void SetLevel(int itemLevel, float skillLevel)
		{
			base.m_healthPerTick = skillLevel / 10f;
		}
	}
}
namespace MonsterModifiers.Patches
{
	[HarmonyPatch(typeof(EnemyHud), "ShowHud")]
	[<fc5be810-4db8-41b3-ad01-e0fc32c8cff7>Nullable(0)]
	[<702fd9c8-9d57-4b33-a10d-166849d4a270>NullableContext(1)]
	public static class EnemyHud_ShowHud_Patch
	{
		private static void Postfix(EnemyHud __instance, Character c, bool isMount)
		{
			if (!(c.IsPlayer() || isMount))
			{
				MonsterModifier component = ((Component)c).GetComponent<MonsterModifier>();
				if (!((Object)(object)component == (Object)null))
				{
					ChangeEnemyStars(c, component.Modifiers);
				}
			}
		}

		public static void ChangeEnemyStars(Character character, List<MonsterModifierTypes> modifiers)
		{
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			if (character.GetLevel() <= 1 || character.IsBoss() || !EnemyHud.instance.m_huds.TryGetValue(character, out var value))
			{
				return;
			}
			GameObject gui = value.m_gui;
			for (int i = 0; i < gui.transform.childCount; i++)
			{
				Transform child = gui.transform.GetChild(i);
				if (!((Object)child).name.StartsWith("level_" + (modifiers.Count + 1)) || !((Component)child).gameObject.activeSelf)
				{
					continue;
				}
				for (int j = 0; j < ((Component)child).transform.childCount; j++)
				{
					Transform child2 = ((Component)child).transform.GetChild(j);
					((Component)child2).GetComponent<Image>().sprite = ModifierUtils.GetModifierIcon(modifiers[Mathf.Min(j, character.GetLevel() - 2)]);
					((Graphic)((Component)child2).GetComponent<Image>()).color = ModifierUtils.GetModifierColor(modifiers[Mathf.Min(j, character.GetLevel() - 2)]);
					if (((Object)child2).name.StartsWith("star") && ((Component)child2).gameObject.activeSelf)
					{
						((Component)child2.GetChild(0)).gameObject.SetActive(false);
					}
				}
			}
		}
	}
}
namespace MonsterModifiers.Modifiers
{
	public class Absorption
	{
		[<fc5be810-4db8-41b3-ad01-e0fc32c8cff7>Nullable(0)]
		[HarmonyPatch(typeof(Character), "RPC_Damage")]
		[<702fd9c8-9d57-4b33-a10d-166849d4a270>NullableContext(1)]
		public class Absorption_Character_RPC_Damage_Patch
		{
			public static void Prefix(Character __instance, HitData hit)
			{
				//IL_006c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0071: Unknown result type (might be due to invalid IL or missing references)
				//IL_0073: Unknown result type (might be due to invalid IL or missing references)
				//IL_0087: Unknown result type (might be due to invalid IL or missing references)
				//IL_009b: Unknown result type (might be due to invalid IL or missing references)
				//IL_00af: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
				//IL_0102: Unknown result type (might be due to invalid IL or missing references)
				//IL_011a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0132: Unknown result type (might be due to invalid IL or missing references)
				if (hit != null && !((Object)(object)__instance == (Object)null))
				{
					MonsterModifier component = ((Component)__instance).GetComponent<MonsterModifier>();
					if (!((Object)(object)component == (Object)null) && component.Modifiers.Contains(MonsterModifierTypes.Absorption) && ((DamageTypes)(ref hit.m_damage)).GetTotalDamage() != 0f)
					{
						DamageModifiers damageModifiers = __instance.GetDamageModifiers((WeakSpot)null);
						HealIfImmune(__instance, damageModifiers, (DamageType)1, hit.m_damage.m_blunt);
						HealIfImmune(__instance, damageModifiers, (DamageType)2, hit.m_damage.m_slash);
						HealIfImmune(__instance, damageModifiers, (DamageType)4, hit.m_damage.m_pierce);
						HealIfImmune(__instance, damageModifiers, (DamageType)8, hit.m_damage.m_chop);
						HealIfImmune(__instance, damageModifiers, (DamageType)16, hit.m_damage.m_pickaxe);
						HealIfImmune(__instance, damageModifiers, (DamageType)32, hit.m_damage.m_fire);
						HealIfImmune(__instance, damageModifiers, (DamageType)64, hit.m_damage.m_frost);
						HealIfImmune(__instance, damageModifiers, (DamageType)128, hit.m_damage.m_lightning);
						HealIfImmune(__instance, damageModifiers, (DamageType)256, hit.m_damage.m_poison);
						HealIfImmune(__instance, damageModifiers, (DamageType)512, hit.m_damage.m_spirit);
					}
				}
			}

			public static void HealIfImmune(Character character, DamageModifiers modifiers, DamageType type, float damage)
			{
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				//IL_000a: Unknown result type (might be due to invalid IL or missing references)
				if (damage > 0f && IsDamageTypeImmune(modifiers, type))
				{
					character.Heal(damage, true);
				}
			}

			public static bool IsDamageTypeImmune(DamageModifiers modifiers, DamageType type)
			{
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Invalid comparison between Unknown and I4
				//IL_0042: Unknown result type (might be due to invalid IL or missing references)
				//IL_0048: Invalid comparison between Unknown and I4
				//IL_000a: Unknown result type (might be due to invalid IL or missing references)
				//IL_000c: Invalid comparison between Unknown and I4
				//IL_005e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0064: Invalid comparison between Unknown and I4
				//IL_004a: Unknown result type (might be due to invalid IL or missing references)
				//IL_004d: Invalid comparison between Unknown and I4
				//IL_0031: Unknown result type (might be due to invalid IL or missing references)
				//IL_0034: Invalid comparison between Unknown and I4
				//IL_000e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				//IL_0026: Expected I4, but got Unknown
				//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d9: Invalid comparison between Unknown and I4
				//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c1: Invalid comparison between Unknown and I4
				//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a9: Invalid comparison between Unknown and I4
				//IL_0072: 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_0079: Invalid comparison between Unknown and I4
				//IL_007e: Unknown result type (might be due to invalid IL or missing references)
				//IL_007f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0085: Invalid comparison between Unknown and I4
				//IL_008a: Unknown result type (might be due to invalid IL or missing references)
				//IL_008b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0091: Invalid comparison between Unknown and I4
				//IL_0068: Unknown result type (might be due to invalid IL or missing references)
				//IL_006e: Invalid comparison between Unknown and I4
				//IL_0051: Unknown result type (might be due to invalid IL or missing references)
				//IL_0057: Invalid comparison between Unknown and I4
				//IL_0038: Unknown result type (might be due to invalid IL or missing references)
				//IL_003b: Invalid comparison between Unknown and I4
				//IL_0028: Unknown result type (might be due to invalid IL or missing references)
				//IL_002a: Invalid comparison between Unknown and I4
				//IL_00de: Unknown result type (might be due to invalid IL or missing references)
				//IL_00df: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e5: Invalid comparison between Unknown and I4
				//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00cd: Invalid comparison between Unknown and I4
				//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
				//IL_00af: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b5: Invalid comparison between Unknown and I4
				//IL_0096: Unknown result type (might be due to invalid IL or missing references)
				//IL_0097: Unknown result type (might be due to invalid IL or missing references)
				//IL_009d: Invalid comparison between Unknown and I4
				if (1 == 0)
				{
				}
				bool result;
				if ((int)type <= 32)
				{
					if ((int)type <= 8)
					{
						switch (type - 1)
						{
						case 0:
							goto IL_0072;
						case 1:
							goto IL_007e;
						case 3:
							goto IL_008a;
						case 2:
							goto IL_00ea;
						}
						if ((int)type != 8)
						{
							goto IL_00ea;
						}
						result = (int)modifiers.m_chop == 3;
					}
					else if ((int)type != 16)
					{
						if ((int)type != 32)
						{
							goto IL_00ea;
						}
						result = (int)modifiers.m_fire == 3;
					}
					else
					{
						result = (int)modifiers.m_pickaxe == 3;
					}
				}
				else if ((int)type <= 128)
				{
					if ((int)type != 64)
					{
						if ((int)type != 128)
						{
							goto IL_00ea;
						}
						result = (int)modifiers.m_lightning == 3;
					}
					else
					{
						result = (int)modifiers.m_frost == 3;
					}
				}
				else if ((int)type != 256)
				{
					if ((int)type != 512)
					{
						goto IL_00ea;
					}
					result = (int)modifiers.m_spirit == 3;
				}
				else
				{
					result = (int)modifiers.m_poison == 3;
				}
				goto IL_00ee;
				IL_008a:
				result = (int)modifiers.m_pierce == 3;
				goto IL_00ee;
				IL_007e:
				result = (int)modifiers.m_slash == 3;
				goto IL_00ee;
				IL_0072:
				result = (int)modifiers.m_blunt == 3;
				goto IL_00ee;
				IL_00ee:
				if (1 == 0)
				{
				}
				return result;
				IL_00ea:
				result = false;
				goto IL_00ee;
			}
		}
	}
	public class BloodLoss
	{
		[HarmonyPatch(typeof(Character), "RPC_Damage")]
		public class RemoveMead_Character_RPC_Damage_Patch
		{
			[<702fd9c8-9d57-4b33-a10d-166849d4a270>NullableContext(1)]
			public static void Postfix(Character __instance, HitData hit)
			{
				if (ModifierUtils.RunRPCDamageChecks(__instance, hit) && ModifierUtils.RunHitChecks(hit, isMonsterAttackingPlayer: true))
				{
					Character attacker = hit.GetAttacker();
					MonsterModifier component = ((Component)attacker).GetComponent<MonsterModifier>();
					if (!((Object)(object)component == (Object)null) && component.Modifiers.Contains(MonsterModifierTypes.BloodLoss) && !__instance.IsBlocking() && !__instance.GetSEMan().HaveStatusEffect(StringExtensionMethods.GetStableHashCode("BloodLossStatusEffect")))
					{
						__instance.GetSEMan().AddStatusEffect(StringExtensionMethods.GetStableHashCode("BloodLossStatusEffect"), false, 0, 0f);
					}
				}
			}
		}
	}
	[<fc5be810-4db8-41b3-ad01-e0fc32c8cff7>Nullable(0)]
	[<702fd9c8-9d57-4b33-a10d-166849d4a270>NullableContext(1)]
	public class DistantDetection
	{
		public static void AddDistantDetection(Character character)
		{
			BaseAI baseAI = character.m_baseAI;
			if ((Object)(object)baseAI != (Object)null)
			{
				baseAI.m_hearRange *= 2f;
				baseAI.m_viewRange *= 2f;
			}
		}

		public static void RemoveDistantDetection(Character character)
		{
			BaseAI baseAI = character.m_baseAI;
			if ((Object)(object)baseAI != (Object)null)
			{
				baseAI.m_hearRange /= 2f;
				baseAI.m_viewRange /= 2f;
			}
		}
	}
	public class EitrSiphon
	{
		[HarmonyPatch(typeof(Character), "RPC_Damage")]
		public class EitrSiphon_Character_RPC_Damage_Patch
		{
			[<702fd9c8-9d57-4b33-a10d-166849d4a270>NullableContext(1)]
			public static void Postfix(Character __instance, HitData hit)
			{
				if (ModifierUtils.RunRPCDamageChecks(__instance, hit) && ModifierUtils.RunHitChecks(hit, isMonsterAttackingPlayer: true) && !__instance.IsBlocking())
				{
					Character attacker = hit.GetAttacker();
					MonsterModifier component = ((Component)attacker).GetComponent<MonsterModifier>();
					if (!((Object)(object)component == (Object)null) && component.Modifiers.Contains(MonsterModifierTypes.EitrSiphon))
					{
						__instance.UseEitr(hit.GetTotalDamage());
					}
				}
			}
		}
	}
	public class FastAttackSpeed
	{
		[HarmonyPatch(typeof(CharacterAnimEvent), "CustomFixedUpdate")]
		public static class FastAttackSpeed_CharacterAnimEvent_CustomFixedUpdate_Patch
		{
			[<702fd9c8-9d57-4b33-a10d-166849d4a270>NullableContext(1)]
			public static void Prefix(Character ___m_character, ref Animator ___m_animator)
			{
				if (!___m_character.InAttack() || ___m_character.IsPlayer())
				{
					return;
				}
				MonsterModifier component = ((Component)___m_character).GetComponent<MonsterModifier>();
				if (!((Object)(object)component == (Object)null) && component.Modifiers.Contains(MonsterModifierTypes.FastAttackSpeed))
				{
					double num = (double)___m_animator.speed * 10000000.0 % 100.0;
					float num2 = 0.5f;
					if ((!(num < 30.0) || !(num > 10.0)) && !(___m_animator.speed <= 0.001f))
					{
						___m_animator.speed = ___m_animator.speed * (1f + num2) + 1.9E-06f;
					}
				}
			}
		}

		[HarmonyPatch(typeof(Attack), "Start")]
		public static class FastAttackSpeed_Attack_Start_Patch
		{
			[<702fd9c8-9d57-4b33-a10d-166849d4a270>NullableContext(1)]
			private static void Postfix(Humanoid character, ItemData weapon, bool __result)
			{
				if (((Character)character).InAttack() && !((Character)character).IsPlayer())
				{
					MonsterModifier component = ((Component)character).GetComponent<MonsterModifier>();
					if (!((Object)(object)component == (Object)null) && component.Modifiers.Contains(MonsterModifierTypes.FastAttackSpeed) && !((Character)character).IsPlayer() && __result && !((Character)character).IsBoss())
					{
						float num = 0.5f;
						weapon.m_lastAttackTime -= weapon.m_shared.m_aiAttackInterval * Mathf.Max(0f, num);
					}
				}
			}
		}
	}
	[<fc5be810-4db8-41b3-ad01-e0fc32c8cff7>Nullable(0)]
	[<702fd9c8-9d57-4b33-a10d-166849d4a270>NullableContext(1)]
	public class FastMovement
	{
		public static void AddFastMovement(Character character)
		{
			character.m_speed *= 1.5f;
			character.m_runSpeed *= 1.5f;
			character.m_walkSpeed *= 1.5f;
		}

		public static void RemoveFastMovement(Character character)
		{
			character.m_speed /= 1.5f;
			character.m_runSpeed /= 1.5f;
			character.m_walkSpeed /= 1.5f;
		}
	}
	public class FoodDrain
	{
		[HarmonyPatch(typeof(Character), "RPC_Damage")]
		public class FoodDrain_Character_RPC_Damage_Patch
		{
			[<702fd9c8-9d57-4b33-a10d-166849d4a270>NullableContext(1)]
			public static void Postfix(Character __instance, HitData hit)
			{
				if (!ModifierUtils.RunRPCDamageChecks(__instance, hit) || !ModifierUtils.RunHitChecks(hit, isMonsterAttackingPlayer: true) || __instance.IsBlocking())
				{
					return;
				}
				Character attacker = hit.GetAttacker();
				MonsterModifier component = ((Component)attacker).GetComponent<MonsterModifier>();
				if ((Object)(object)component == (Object)null || !component.Modifiers.Contains(MonsterModifierTypes.FoodDrain))
				{
					return;
				}
				Player val = (Player)(object)((__instance is Player) ? __instance : null);
				if ((Object)(object)val != (Object)null)
				{
					List<Food> foods = val.GetFoods();
					int count = foods.Count;
					if (count > 0)
					{
						int index = Random.Range(0, count);
						Food obj = foods[index];
						obj.m_time *= 0.5f;
					}
				}
			}
		}
	}
	public class ElementalInfusions
	{
		[HarmonyPatch(typeof(Character), "RPC_Damage")]
		public class ElementalInfusions_Character_RPC_Damage_Patch
		{
			[<702fd9c8-9d57-4b33-a10d-166849d4a270>NullableContext(1)]
			public static void Prefix(Character __instance, HitData hit)
			{
				if (!ModifierUtils.RunRPCDamageChecks(__instance, hit) || !ModifierUtils.RunHitChecks(hit, isMonsterAttackingPlayer: true) || __instance.IsBlocking())
				{
					return;
				}
				Character attacker = hit.GetAttacker();
				MonsterModifier component = ((Component)attacker).GetComponent<MonsterModifier>();
				if (!((Object)(object)component == (Object)null))
				{
					if (component.Modifiers.Contains(MonsterModifierTypes.PoisonInfused))
					{
						hit.m_damage.m_poison += hit.GetTotalDamage();
					}
					if (component.Modifiers.Contains(MonsterModifierTypes.FireInfused))
					{
						hit.m_damage.m_fire += hit.GetTotalDamage();
					}
					if (component.Modifiers.Contains(MonsterModifierTypes.LightningInfused))
					{
						hit.m_damage.m_lightning += hit.GetTotalDamage();
					}
					if (component.Modifiers.Contains(MonsterModifierTypes.FrostInfused))
					{
						hit.m_damage.m_frost += hit.GetTotalDamage();
					}
				}
			}
		}
	}
	public class IgnoreArmor
	{
		[HarmonyPatch(typeof(Character), "RPC_Damage")]
		public class IgnoreArmor_Character_RPC_Damage_Patch
		{
			[<702fd9c8-9d57-4b33-a10d-166849d4a270>NullableContext(1)]
			public static void Prefix(Character __instance, HitData hit)
			{
				if (ModifierUtils.RunRPCDamageChecks(__instance, hit) && ModifierUtils.RunHitChecks(hit, isMonsterAttackingPlayer: true))
				{
					Character attacker = hit.GetAttacker();
					MonsterModifier component = ((Component)attacker).GetComponent<MonsterModifier>();
					if (!((Object)(object)component == (Object)null) && component.Modifiers.Contains(MonsterModifierTypes.IgnoreArmor))
					{
						shouldIgnoreArmor = true;
					}
				}
			}
		}

		[HarmonyPatch(typeof(Player), "GetBodyArmor")]
		public class IgnoreArmor_Player_GetBodyArmor_Patch
		{
			public static void Postfix(ref float __result)
			{
				if (shouldIgnoreArmor)
				{
					__result *= 0.5f;
					shouldIgnoreArmor = false;
				}
			}
		}

		public static bool shouldIgnoreArmor;
	}
	public class StaggerDeath
	{
		[HarmonyPatch(typeof(Character), "OnDeath")]
		public class StaggerDeath_Character_OnDeath_Patch
		{
			[<702fd9c8-9d57-4b33-a10d-166849d4a270>NullableContext(1)]
			public static void Prefix(Character __instance)
			{
				//IL_005b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0060: Unknown result type (might be due to invalid IL or missing references)
				//IL_008d: Unknown result type (might be due to invalid IL or missing references)
				//IL_009d: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b3: 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_00c8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
				//IL_0172: Unknown result type (might be due to invalid IL or missing references)
				//IL_0142: Unknown result type (might be due to invalid IL or missing references)
				//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)__instance == (Object)null || __instance.IsPlayer() || (Object)(object)__instance.m_nview == (Object)null || !(((Object)((Component)__instance).gameObject).name == "mistleCustomPrefab(Clone)"))
				{
					return;
				}
				Vector3 position = ((Component)__instance).transform.position;
				GameObject prefab = PrefabManager.Instance.GetPrefab("staggerDeathNovaCustomPrefab");
				if (!((Object)(object)prefab != (Object)null))
				{
					return;
				}
				Object.Instantiate<GameObject>(prefab, new Vector3(((Component)__instance).transform.position.x, ((Component)__instance).transform.position.y - 1f, ((Component)__instance).transform.position.z), ((Component)__instance).transform.rotation);
				List<Character> allCharacter = WorldUtils.GetAllCharacter(((Component)__instance).transform.position, 5f);
				foreach (Character item in allCharacter)
				{
					if (!((Object)(object)item == (Object)(object)__instance) && !((Object)(object)item == (Object)null) && !((Object)(object)item.m_nview == (Object)null) && !item.IsPlayer())
					{
						item.Stagger(position);
					}
				}
				List<Player> list = new List<Player>();
				Player.GetPlayersInRange(((Component)__instance).transform.position, 5f, list);
				foreach (Player item2 in list)
				{
					if (!((Object)(object)item2 == (Object)null) && !((Object)(object)((Character)item2).m_nview == (Object)null))
					{
						((Character)item2).Stagger(position);
					}
				}
			}
		}
	}
	public class StaggerImmune
	{
		[HarmonyPatch(typeof(Character), "Stagger")]
		public class StaminaSiphon_Character_RPC_Damage_Patch
		{
			[<702fd9c8-9d57-4b33-a10d-166849d4a270>NullableContext(1)]
			public static bool Prefix(Character __instance)
			{
				if ((Object)(object)__instance == (Object)null)
				{
					return true;
				}
				MonsterModifier component = ((Component)__instance).GetComponent<MonsterModifier>();
				if ((Object)(object)component == (Object)null)
				{
					return true;
				}
				if (component.Modifiers.Contains(MonsterModifierTypes.StaggerImmune))
				{
					return false;
				}
				return true;
			}
		}

		[<702fd9c8-9d57-4b33-a10d-166849d4a270>NullableContext(1)]
		public static void AddStaggerImmune(Character character)
		{
			character.m_staggerWhenBlocked = false;
		}

		[<702fd9c8-9d57-4b33-a10d-166849d4a270>NullableContext(1)]
		public static void RemoveStaggerImmune(Character character)
		{
			character.m_staggerWhenBlocked = true;
		}
	}
	public class DamageModifiers
	{
		[HarmonyPatch(typeof(Character), "RPC_Damage")]
		public class ModiferDamageModifiers_Character_RPC_Damage_Patch
		{
			[<702fd9c8-9d57-4b33-a10d-166849d4a270>NullableContext(1)]
			public static void Prefix(Character __instance, HitData hit)
			{
				//IL_0067: 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_007f: Unknown result type (might be due to invalid IL or missing references)
				//IL_008b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0097: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
				if (hit == null || (Object)(object)__instance == (Object)null || ((DamageTypes)(ref hit.m_damage)).GetTotalDamage() == 0f)
				{
					return;
				}
				MonsterModifier component = ((Component)__instance).GetComponent<MonsterModifier>();
				if (!((Object)(object)component == (Object)null))
				{
					if (component.Modifiers.Contains(MonsterModifierTypes.PhysicalImmunity))
					{
						__instance.m_damageModifiers.m_blunt = (DamageModifier)3;
						__instance.m_damageModifiers.m_pierce = (DamageModifier)3;
						__instance.m_damageModifiers.m_slash = (DamageModifier)3;
						__instance.m_damageModifiers.m_chop = (DamageModifier)3;
						__instance.m_damageModifiers.m_pickaxe = (DamageModifier)3;
					}
					if (component.Modifiers.Contains(MonsterModifierTypes.ElementalImmunity))
					{
						__instance.m_damageModifiers.m_fire = (DamageModifier)3;
						__instance.m_damageModifiers.m_frost = (DamageModifier)3;
						__instance.m_damageModifiers.m_lightning = (DamageModifier)3;
						__instance.m_damageModifiers.m_poison = (DamageModifier)3;
						__instance.m_damageModifiers.m_spirit = (DamageModifier)3;
					}
				}
			}
		}
	}
	public class RemoveStatusEffect
	{
		[HarmonyPatch(typeof(Character), "RPC_Damage")]
		public class RemoveMead_Character_RPC_Damage_Patch
		{
			[<702fd9c8-9d57-4b33-a10d-166849d4a270>NullableContext(1)]
			public static void Postfix(Character __instance, HitData hit)
			{
				if (!ModifierUtils.RunRPCDamageChecks(__instance, hit) || !ModifierUtils.RunHitChecks(hit, isMonsterAttackingPlayer: true) || __instance.IsBlocking())
				{
					return;
				}
				Character attacker = hit.GetAttacker();
				MonsterModifier component = ((Component)attacker).GetComponent<MonsterModifier>();
				if (!((Object)(object)component == (Object)null) && component.Modifiers.Contains(MonsterModifierTypes.RemoveStatusEffect))
				{
					List<StatusEffect> statusEffects = __instance.GetSEMan().GetStatusEffects();
					if (statusEffects.Count > 1)
					{
						int index = Random.Range(0, statusEffects.Count);
						__instance.GetSEMan().RemoveStatusEffect(statusEffects[index], false);
					}
				}
			}
		}
	}
	public class ShieldBreaker
	{
		[HarmonyPatch(typeof(Humanoid), "BlockAttack")]
		public class ShieldBreaker_Humanoid_BlockAttack_Patch
		{
			[<702fd9c8-9d57-4b33-a10d-166849d4a270>NullableContext(1)]
			public static void Postfix(Humanoid __instance, HitData hit, Character attacker)
			{
				if (hit == null || (Object)(object)__instance == (Object)null || (Object)(object)attacker == (Object)null || attacker.IsPlayer())
				{
					return;
				}
				MonsterModifier component = ((Component)attacker).GetComponent<MonsterModifier>();
				if (!((Object)(object)component == (Object)null) && component.Modifiers.Contains(MonsterModifierTypes.ShieldBreaker))
				{
					ItemData currentBlocker = __instance.GetCurrentBlocker();
					if (currentBlocker != null && (double)currentBlocker.m_durability > (double)currentBlocker.GetMaxDurability() * 0.1)
					{
						currentBlocker.m_durability *= 0.5f;
					}
				}
			}
		}
	}
	[<fc5be810-4db8-41b3-ad01-e0fc32c8cff7>Nullable(0)]
	[<702fd9c8-9d57-4b33-a10d-166849d4a270>NullableContext(1)]
	public class ShieldDome : MonoBehaviour
	{
		public static CustomPrefab ShieldGenereatorBubbleCustomPrefab;

		public static EffectData shieldDomeBubbleSFX;

		public GameObject shieldGenereatorBubble;

		public Character m_character;

		public ShieldGenerator m_shieldGenerator;

		public ShieldDomeImageEffect m_shieldDomeImageEffect;

		public ZNetView m_nview;

		public static void LoadShieldDome()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			ShieldGenereatorBubbleCustomPrefab = new CustomPrefab(ModifierAssetUtils.ashlandsAssetBundle, "ShieldDome_Bubble", true);
			PrefabManager.Instance.AddPrefab(ShieldGenereatorBubbleCustomPrefab);
		}

		public void AddShieldDome(Character character)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			((Component)character).gameObject.AddComponent<ShieldDome>();
			shieldGenereatorBubble = Object.Instantiate<GameObject>(ShieldGenereatorBubbleCustomPrefab.Prefab, ((Component)character).transform.position, ((Component)character).transform.rotation);
			m_character = character;
			m_shieldGenerator = shieldGenereatorBubble.GetComponent<ShieldGenerator>();
			m_nview = shieldGenereatorBubble.GetComponent<ZNetView>();
			m_shieldGenerator.m_nview = m_nview;
			m_shieldGenerator.m_defaultFuel = 999;
			m_shieldGenerator.m_radius = 10f;
			m_shieldGenerator.m_maxShieldRadius = 10f;
			m_shieldGenerator.m_minShieldRadius = 10f;
			m_shieldDomeImageEffect = Object.FindFirstObjectByType<ShieldDomeImageEffect>();
			if ((Object)(object)m_nview != (Object)null)
			{
				m_nview.Register("RPC_DestroyShieldDome", (Action<long>)RPC_DestroyShieldDome);
			}
		}

		public void Update()
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)m_character != (Object)null && (Object)(object)shieldGenereatorBubble != (Object)null)
			{
				m_shieldGenerator.m_shieldDome.transform.position = ((Component)m_character).transform.position;
				m_shieldGenerator.m_shieldDome.transform.rotation = ((Component)m_character).transform.rotation;
				m_shieldDomeImageEffect.SetShieldData(m_shieldGenerator, ((Component)m_character).transform.position, 10f, m_shieldGenerator.m_lastFuel, m_shieldGenerator.m_lastHitTime);
			}
		}

		public void OnDestroy()
		{
			if ((Object)(object)m_nview != (Object)null && m_nview.IsValid() && m_nview.IsOwner())
			{
				m_nview.InvokeRPC(ZNetView.Everybody, "RPC_DestroyShieldDome", Array.Empty<object>());
			}
		}

		private void RPC_DestroyShieldDome(long sender)
		{
			DestroyShieldDome();
		}

		private void DestroyShieldDome()
		{
			if ((Object)(object)m_shieldGenerator != (Object)null)
			{
				m_shieldDomeImageEffect.RemoveShield(m_shieldGenerator);
			}
			if ((Object)(object)shieldGenereatorBubble != (Object)null)
			{
				ZNetScene.instance.Destroy(shieldGenereatorBubble);
			}
			if ((Object)(object)m_shieldGenerator.m_shieldDome != (Object)null)
			{
				ZNetScene.instance.Destroy(m_shieldGenerator.m_shieldDome);
			}
		}
	}
	[<fc5be810-4db8-41b3-ad01-e0fc32c8cff7>Nullable(0)]
	[<702fd9c8-9d57-4b33-a10d-166849d4a270>NullableContext(1)]
	public class PersonalShield
	{
		public static void AddPersonalShield(Character character)
		{
			int stableHashCode = StringExtensionMethods.GetStableHashCode("GoblinShaman_shield");
			character.GetSEMan().AddStatusEffect(stableHashCode, true, 10, 2f);
		}

		public static void RemovePersonalShield(Character character)
		{
			int stableHashCode = StringExtensionMethods.GetStableHashCode("GoblinShaman_shield");
			character.GetSEMan().RemoveStatusEffect(stableHashCode, false);
		}
	}
	public class DeathSpawns
	{
		[HarmonyPatch(typeof(Character), "OnDeath")]
		public class DeathSpawns_Character_OnDeath_Patch
		{
			[<702fd9c8-9d57-4b33-a10d-166849d4a270>NullableContext(1)]
			public static void Prefix(Character __instance)
			{
				//IL_0076: Unknown result type (might be due to invalid IL or missing references)
				//IL_0081: Unknown result type (might be due to invalid IL or missing references)
				//IL_008c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0091: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a0: Expected O, but got Unknown
				//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
				//IL_0323: Unknown result type (might be due to invalid IL or missing references)
				//IL_0333: Unknown result type (might be due to invalid IL or missing references)
				//IL_0349: Unknown result type (might be due to invalid IL or missing references)
				//IL_0353: Unknown result type (might be due to invalid IL or missing references)
				//IL_035e: Unknown result type (might be due to invalid IL or missing references)
				//IL_015f: Unknown result type (might be due to invalid IL or missing references)
				//IL_016f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0185: Unknown result type (might be due to invalid IL or missing references)
				//IL_018f: Unknown result type (might be due to invalid IL or missing references)
				//IL_019a: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
				//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b9: Expected O, but got Unknown
				//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
				//IL_03b7: Unknown result type (might be due to invalid IL or missing references)
				//IL_03c7: Unknown result type (might be due to invalid IL or missing references)
				//IL_03dd: Unknown result type (might be due to invalid IL or missing references)
				//IL_03e7: Unknown result type (might be due to invalid IL or missing references)
				//IL_03f2: Unknown result type (might be due to invalid IL or missing references)
				//IL_0278: Unknown result type (might be due to invalid IL or missing references)
				//IL_0288: Unknown result type (might be due to invalid IL or missing references)
				//IL_029e: Unknown result type (might be due to invalid IL or missing references)
				//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
				//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
				//IL_02be: Unknown result type (might be due to invalid IL or missing references)
				//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
				//IL_02d2: Expected O, but got Unknown
				//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
				//IL_0584: Unknown result type (might be due to invalid IL or missing references)
				//IL_0594: Unknown result type (might be due to invalid IL or missing references)
				//IL_05aa: Unknown result type (might be due to invalid IL or missing references)
				//IL_05b4: Unknown result type (might be due to invalid IL or missing references)
				//IL_05bf: Unknown result type (might be due to invalid IL or missing references)
				//IL_0418: Unknown result type (might be due to invalid IL or missing references)
				//IL_05e5: 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)
				//IL_0692: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)__instance == (Object)null || __instance.IsPlayer())
				{
					return;
				}
				MonsterModifier component = ((Component)__instance).GetComponent<MonsterModifier>();
				if ((Object)(object)component == (Object)null)
				{
					return;
				}
				if (component.Modifiers.Contains(MonsterModifierTypes.PoisonDeath))
				{
					float poison = DamageUtils.CalculateDamage(__instance);
					GameObject prefab = ZNetScene.instance.GetPrefab("blob_aoe");
					if ((Object)(object)prefab != (Object)null)
					{
						Object.Instantiate<GameObject>(prefab, ((Component)__instance).transform.position, ((Component)__instance).transform.rotation);
						HitData hit = new HitData
						{
							m_damage = 
							{
								m_poison = poison
							}
						};
						ApplyDamageToNearbyPlayers(((Component)__instance).transform.position, hit);
					}
				}
				if (component.Modifiers.Contains(MonsterModifierTypes.FireDeath))
				{
					float fire = DamageUtils.CalculateDamage(__instance);
					GameObject prefab2 = ZNetScene.instance.GetPrefab("fx_fireskeleton_nova");
					ParticleSystem[] componentsInChildren = prefab2.GetComponentsInChildren<ParticleSystem>();
					ParticleSystem[] array = componentsInChildren;
					foreach (ParticleSystem val in array)
					{
						val.startDelay = 0f;
					}
					ZSFX componentInChildren = prefab2.GetComponentInChildren<ZSFX>();
					componentInChildren.m_delay = 0f;
					componentInChildren.m_minDelay = 0f;
					componentInChildren.m_maxDelay = 0f;
					if ((Object)(object)prefab2 != (Object)null)
					{
						Object.Instantiate<GameObject>(prefab2, new Vector3(((Component)__instance).transform.position.x, ((Component)__instance).transform.position.y + 1.25f, ((Component)__instance).transform.position.z), ((Component)__instance).transform.rotation);
						HitData hit2 = new HitData
						{
							m_damage = 
							{
								m_fire = fire
							}
						};
						ApplyDamageToNearbyPlayers(((Component)__instance).transform.position, hit2);
					}
				}
				if (component.Modifiers.Contains(MonsterModifierTypes.FrostDeath))
				{
					float frost = DamageUtils.CalculateDamage(__instance);
					GameObject prefab3 = ZNetScene.instance.GetPrefab("fx_DvergerMage_Nova_ring");
					ParticleSystem[] componentsInChildren2 = prefab3.GetComponentsInChildren<ParticleSystem>();
					ParticleSystem[] array2 = componentsInChildren2;
					foreach (ParticleSystem val2 in array2)
					{
						val2.startDelay = 0f;
					}
					ZSFX componentInChildren2 = prefab3.GetComponentInChildren<ZSFX>();
					componentInChildren2.m_delay = 0f;
					componentInChildren2.m_minDelay = 0f;
					componentInChildren2.m_maxDelay = 0f;
					if ((Object)(object)prefab3 != (Object)null)
					{
						Object.Instantiate<GameObject>(prefab3, new Vector3(((Component)__instance).transform.position.x, ((Component)__instance).transform.position.y + 1f, ((Component)__instance).transform.position.z), ((Component)__instance).transform.rotation);
						HitData hit3 = new HitData
						{
							m_damage = 
							{
								m_frost = frost
							}
						};
						ApplyDamageToNearbyPlayers(((Component)__instance).transform.position, hit3);
					}
				}
				if (component.Modifiers.Contains(MonsterModifierTypes.StaggerDeath))
				{
					GameObject prefab4 = PrefabManager.Instance.GetPrefab("mistleCustomPrefab");
					if ((Object)(object)prefab4 != (Object)null)
					{
						Object.Instantiate<GameObject>(prefab4, new Vector3(((Component)__instance).transform.position.x, ((Component)__instance).transform.position.y + 1f, ((Component)__instance).transform.position.z), ((Component)__instance).transform.rotation);
					}
				}
				if (component.Modifiers.Contains(MonsterModifierTypes.HealDeath))
				{
					GameObject prefab5 = PrefabManager.Instance.GetPrefab("healCustomPrefab");
					float num = __instance.GetMaxHealth() * 0.75f;
					if ((Object)(object)prefab5 != (Object)null)
					{
						Object.Instantiate<GameObject>(prefab5, new Vector3(((Component)__instance).transform.position.x, ((Component)__instance).transform.position.y + 1f, ((Component)__instance).transform.position.z), ((Component)__instance).transform.rotation);
					}
					if (((Character)Player.m_localPlayer).IsOwner())
					{
						List<Character> allCharacter = WorldUtils.GetAllCharacter(((Component)__instance).transform.position, 15f);
						foreach (Character item in allCharacter)
						{
							if (!((Object)(object)item == (Object)(object)__instance) && !((Object)(object)item == (Object)null) && !((Object)(object)item.m_nview == (Object)null) && !item.IsPlayer())
							{
								item.GetSEMan().AddStatusEffect(StringExtensionMethods.GetStableHashCode("HealDeathStatusEffect"), false, 0, num);
							}
						}
						List<Player> list = new List<Player>();
						Player.GetPlayersInRange(((Component)__instance).transform.position, 15f, list);
						foreach (Player item2 in list)
						{
							if (!((Object)(object)item2 == (Object)null) && !((Object)(object)((Character)item2).m_nview == (Object)null))
							{
								((Character)item2).GetSEMan().AddStatusEffect(StringExtensionMethods.GetStableHashCode("HealDeathStatusEffect"), true, 0, num);
							}
						}
					}
				}
				if (!component.Modifiers.Contains(MonsterModifierTypes.TarDeath))
				{
					return;
				}
				GameObject prefab6 = ZNetScene.instance.GetPrefab("blobtar_projectile_tarball");
				if ((Object)(object)prefab6 != (Object)null)
				{
					Object.Instantiate<GameObject>(prefab6, new Vector3(((Component)__instance).transform.position.x, ((Component)__instance).transform.position.y + 1f, ((Component)__instance).transform.position.z), ((Component)__instance).transform.rotation);
				}
				if (!((Character)Player.m_localPlayer).IsOwner())
				{
					return;
				}
				List<Character> allCharacter2 = WorldUtils.GetAllCharacter(((Component)__instance).transform.position, 5f);
				foreach (Character item3 in allCharacter2)
				{
					if (!((Object)(object)item3 == (Object)(object)__instance) && !((Object)(object)item3 == (Object)null) && !((Object)(object)item3.m_nview == (Object)null) && !item3.IsPlayer())
					{
						item3.GetSEMan().AddStatusEffect(StringExtensionMethods.GetStableHashCode("Tared"), false, 0, 0f);
					}
				}
				List<Player> list2 = new List<Player>();
				Player.GetPlayersInRange(((Component)__instance).transform.position, 5f, list2);
				foreach (Player item4 in list2)
				{
					if (!((Object)(object)item4 == (Object)null) && !((Object)(object)((Character)item4).m_nview == (Object)null))
					{
						((Character)item4).GetSEMan().AddStatusEffect(StringExtensionMethods.GetStableHashCode("Tared"), false, 0, 0f);
					}
				}
			}
		}

		[<702fd9c8-9d57-4b33-a10d-166849d4a270>NullableContext(1)]
		public static void ApplyDamageToNearbyPlayers(Vector3 position, HitData hit)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			List<Player> list = new List<Player>();
			Player.GetPlayersInRange(position, 5f, list);
			foreach (Player item in list)
			{
				((Character)item).Damage(hit);
			}
		}
	}
	public class SoulEater : MonoBehaviour
	{
		[HarmonyPatch(typeof(Character), "OnDeath")]
		public class SoulEater_Character_OnDeath_Patch
		{
			[<702fd9c8-9d57-4b33-a10d-166849d4a270>NullableContext(1)]
			public static void Prefix(Character __instance)
			{
				//IL_004a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0147: Unknown result type (might be due to invalid IL or missing references)
				//IL_0151: Unknown result type (might be due to invalid IL or missing references)
				MonsterModifier monsterModifier = default(MonsterModifier);
				if ((Object)(object)__instance == (Object)null || __instance.IsPlayer() || (((Component)__instance).TryGetComponent<MonsterModifier>(ref monsterModifier) && monsterModifier.Modifiers.Contains(MonsterModifierTypes.SoulEater)))
				{
					return;
				}
				List<Character> allCharacter = WorldUtils.GetAllCharacter(((Component)__instance).transform.position, 5f);
				foreach (Character item in allCharacter)
				{
					if (!((Object)(object)item == (Object)null) && !((Object)(object)item.m_nview == (Object)null) && item.m_nview.GetZDO() != null && item.m_nview.GetZDO().IsOwner())
					{
						MonsterModifier component = ((Component)item).GetComponent<MonsterModifier>();
						if ((Object)(object)component != (Object)null && component.Modifiers.Contains(MonsterModifierTypes.SoulEater) && item.m_nview.GetZDO().GetInt("MM_soulEaterCount", 0) < 3)
						{
							int num = item.m_nview.GetZDO().GetInt("MM_soulEaterCount", 0) + 1;
							item.m_nview.GetZDO().Set("MM_soulEaterCount", num);
							Transform transform = ((Component)item).transform;
							transform.localScale *= 1.1f;
							Physics.SyncTransforms();
							item.m_health *= 1.1f;
						}
					}
				}
			}
		}

		[HarmonyPatch(typeof(Character), "RPC_Damage")]
		public class SoulEater_Character_RPC_Damage_Patch
		{
			[<702fd9c8-9d57-4b33-a10d-166849d4a270>NullableContext(1)]
			public static void Prefix(Character __instance, HitData hit)
			{
				if (!ModifierUtils.RunRPCDamageChecks(__instance, hit) || !ModifierUtils.RunHitChecks(hit, isMonsterAttackingPlayer: true))
				{
					return;
				}
				Character attacker = hit.GetAttacker();
				MonsterModifier component = ((Component)attacker).GetComponent<MonsterModifier>();
				if (!((Object)(object)component == (Object)null) && component.Modifiers.Contains(MonsterModifierTypes.SoulEater) && attacker.m_nview.GetZDO().GetInt("MM_soulEaterCount", 0) > 0)
				{
					int @int = attacker.m_nview.GetZDO().GetInt("MM_soulEaterCount", 0);
					float totalDamage = hit.GetTotalDamage();
					float num = totalDamage;
					switch (@int)
					{
					case 1:
						hit.ApplyModifier(1.1f);
						num = totalDamage * 1.1f;
						break;
					case 2:
						hit.ApplyModifier(1.2f);
						num = totalDamage * 1.2f;
						break;
					case 3:
						hit.ApplyModifier(1.3f);
						num = totalDamage * 1.3f;
						break;
					default:
						hit.ApplyModifier(1f);
						num = totalDamage * 1f;
						break;
					}
				}
			}
		}
	}
	public class StaminaSiphon
	{
		[HarmonyPatch(typeof(Character), "RPC_Damage")]
		public class StaminaSiphon_Character_RPC_Damage_Patch
		{
			[<702fd9c8-9d57-4b33-a10d-166849d4a270>NullableContext(1)]
			public static void Postfix(Character __instance, HitData hit)
			{
				if (ModifierUtils.RunRPCDamageChecks(__instance, hit) && ModifierUtils.RunHitChecks(hit, isMonsterAttackingPlayer: true))
				{
					Character attacker = hit.GetAttacker();
					MonsterModifier component = ((Component)attacker).GetComponent<MonsterModifier>();
					if (!((Object)(object)component == (Object)null) && component.Modifiers.Contains(MonsterModifierTypes.StaminaSiphon) && !__instance.IsBlocking())
					{
						__instance.UseStamina(hit.GetTotalDamage());
					}
				}
			}
		}
	}
}
namespace MonsterModifiers.Custom_Components
{
	[<702fd9c8-9d57-4b33-a10d-166849d4a270>NullableContext(1)]
	[<fc5be810-4db8-41b3-ad01-e0fc32c8cff7>Nullable(0)]
	public class MonsterModifier : MonoBehaviour
	{
		public List<MonsterModifierTypes> Modifiers = new List<MonsterModifierTypes>();

		public Character character;

		public int level;

		private void Start()
		{
			character = ((Component)this).GetComponent<Character>();
			level = character.GetLevel();
			if (level <= 1)
			{
				return;
			}
			string @string = character.m_nview.GetZDO().GetString("modifiers", string.Empty);
			if (string.IsNullOrEmpty(@string))
			{
				foreach (MonsterModifierTypes item in ModifierUtils.RollRandomModifiers(level - 1))
				{
					Modifiers.Add(item);
				}
				if (character.m_nview.GetZDO().IsOwner())
				{
					string text = string.Join(",", Modifiers);
					character.m_nview.GetZDO().Set("modifiers", text);
				}
			}
			else
			{
				Modifiers = new List<MonsterModifierTypes>(Array.ConvertAll(@string.Split(new char[1] { ',' }), [<702fd9c8-9d57-4b33-a10d-166849d4a270>NullableContext(0)] (string str) => (MonsterModifierTypes)Enum.Parse(typeof(MonsterModifierTypes), str)));
			}
			ApplyStartModifiers();
		}

		public void ChangeModifiers(List<MonsterModifierTypes> modifierTypesList, int numModifiers)
		{
			if (level <= 1)
			{
				return;
			}
			foreach (MonsterModifierTypes modifierTypes in modifierTypesList)
			{
				Modifiers.Add(modifierTypes);
				Debug.Log((object)("Monster with name " + ((Object)character).name + " has has changed modifiers. New modifier: " + modifierTypes));
			}
			if (character.m_nview.GetZDO().IsOwner())
			{
				string text = string.Join(",", Modifiers);
				character.m_nview.GetZDO().Set("modifiers", text);
			}
		}

		public void ApplyStartModifiers()
		{
			if (Modifiers.Contains(MonsterModifierTypes.PersonalShield))
			{
				PersonalShield.AddPersonalShield(character);
			}
			if (Modifiers.Contains(MonsterModifierTypes.ShieldDome))
			{
				ShieldDome shieldDome = ((Component)character).gameObject.AddComponent<ShieldDome>();
				shieldDome.AddShieldDome(character);
			}
			if (Modifiers.Contains(MonsterModifierTypes.StaggerImmune))
			{
				StaggerImmune.AddStaggerImmune(character);
			}
			if (Modifiers.Contains(MonsterModifierTypes.FastMovement))
			{
				FastMovement.AddFastMovement(character);
			}
			if (Modifiers.Contains(MonsterModifierTypes.DistantDetection))
			{
				DistantDetection.AddDistantDetection(character);
			}
		}
	}
	public class AddMonsterModifiersToCharacter
	{
		[HarmonyPriority(800)]
		[HarmonyPatch(typeof(Character), "Awake")]
		public static class Character_Awake_Patch
		{
			[<702fd9c8-9d57-4b33-a10d-166849d4a270>NullableContext(1)]
			private static void Postfix(Character __instance)
			{
				if (!__instance.IsPlayer() && !__instance.IsBoss())
				{
					((Component)__instance).gameObject.AddComponent<MonsterModifier>();
				}
			}
		}
	}
}
namespace LocalizationManager
{
	[<702fd9c8-9d57-4b33-a10d-166849d4a270>NullableContext(1)]
	[<fc5be810-4db8-41b3-ad01-e0fc32c8cff7>Nullable(0)]
	[PublicAPI]
	public class Localizer
	{
		private static readonly Dictionary<string, Dictionary<string, Func<string>>> PlaceholderProcessors;

		private static readonly Dictionary<string, Dictionary<string, string>> loadedTexts;

		private static readonly ConditionalWeakTable<Localization, string> localizationLanguage;

		private static readonly List<WeakReference<Localization>> localizationObjects;

		[<fc5be810-4db8-41b3-ad01-e0fc32c8cff7>Nullable(2)]
		private static BaseUnityPlugin _plugin;

		private static readonly List<string> fileExtensions;

		private static BaseUnityPlugin plugin
		{
			get
			{
				//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b2: Expected O, but got Unknown
				if (_plugin == null)
				{
					IEnumerable<TypeInfo> source;
					try
					{
						source = Assembly.GetExecutingAssembly().DefinedTypes.ToList();
					}
					catch (ReflectionTypeLoadException ex)
					{
						source = from t in ex.Types
							where t != null
							select t.GetTypeInfo();
					}
					_plugin = (BaseUnityPlugin)Chainloader.ManagerObject.GetComponent((Type)source.First([<702fd9c8-9d57-4b33-a10d-166849d4a270>NullableContext(0)] (TypeInfo t) => t.IsClass && typeof(BaseUnityPlugin).IsAssignableFrom(t)));
				}
				return _plugin;
			}
		}

		private static void UpdatePlaceholderText(Localization localization, string key)
		{
			localizationLanguage.TryGetValue(localization, out var value);
			string text = loadedTexts[value][key];
			if (PlaceholderProcessors.TryGetValue(key, out var value2))
			{
				text = value2.Aggregate(text, [<702fd9c8-9d57-4b33-a10d-166849d4a270>NullableContext(0)] (string current, KeyValuePair<string, Func<string>> kv) => current.Replace("{" + kv.Key + "}", kv.Value()));
			}
			localization.AddWord(key, text);
		}

		public static void AddPlaceholder<T>(string key, string placeholder, ConfigEntry<T> config, [<fc5be810-4db8-41b3-ad01-e0fc32c8cff7>Nullable(new byte[] { 2, 1, 1 })] Func<T, string> convertConfigValue = null)
		{
			if (convertConfigValue == null)
			{
				convertConfigValue = (T val) => val.ToString();
			}
			if (!PlaceholderProcessors.ContainsKey(key))
			{
				PlaceholderProcessors[key] = new Dictionary<string, Func<string>>();
			}
			config.SettingChanged += [<702fd9c8-9d57-4b33-a10d-166849d4a270>NullableContext(0)] (object _, EventArgs _) =>
			{
				UpdatePlaceholder();
			};
			if (loadedTexts.ContainsKey(Localization.instance.GetSelectedLanguage()))
			{
				UpdatePlaceholder();
			}
			void UpdatePlaceholder()
			{
				PlaceholderProcessors[key][placeholder] = () => convertConfigValue(config.Value);
				UpdatePlaceholderText(Localization.instance, key);
			}
		}

		public static void AddText(string key, string text)
		{
			List<WeakReference<Localization>> list = new List<WeakReference<Localization>>();
			foreach (WeakReference<Localization> localizationObject in localizationObjects)
			{
				if (localizationObject.TryGetTarget(out var target))
				{
					Dictionary<string, string> dictionary = loadedTexts[localizationLanguage.GetOrCreateValue(target)];
					if (!target.m_translations.ContainsKey(key))
					{
						dictionary[key] = text;
						target.AddWord(key, text);
					}
				}
				else
				{
					list.Add(localizationObject);
				}
			}
			foreach (WeakReference<Localization> item in list)
			{
				localizationObjects.Remove(item);
			}
		}

		public static void Load()
		{
			LoadLocalization(Localization.instance, Localization.instance.GetSelectedLanguage());
		}

		private static void LoadLocalization(Localization __instance, string language)
		{
			if (!localizationLanguage.Remove(__instance))
			{
				localizationObjects.Add(new WeakReference<Localization>(__instance));
			}
			localizationLanguage.Add(__instance, language);
			Dictionary<string, string> dictionary = new Dictionary<string, string>();
			foreach (string item in from f in Directory.GetFiles(Path.GetDirectoryName(Paths.PluginPath), plugin.Info.Metadata.Name + ".*", SearchOption.AllDirectories)
				where fileExtensions.IndexOf(Path.GetExtension(f)) >= 0
				select f)
			{
				string text = Path.GetFileNameWithoutExtension(item).Split(new char[1] { '.' })[1];
				if (dictionary.ContainsKey(text))
				{
					Debug.LogWarning((object)("Duplicate key " + text + " found for " + plugin.Info.Metadata.Name + ". The duplicate file found at " + item + " will be skipped."));
				}
				else
				{
					dictionary[text] = item;
				}
			}
			byte[] array = LoadTranslationFromAssembly("English");
			if (array == null)
			{
				throw new Exception("Found no English localizations in mod " + plugin.Info.Metadata.Name + ". Expected an embedded resource translations/English.json or translations/English.yml.");
			}
			Dictionary<string, string> dictionary2 = new DeserializerBuilder().IgnoreFields().Build().Deserialize<Dictionary<string, string>>(Encoding.UTF8.GetString(array));
			if (dictionary2 == null)
			{
				throw new Exception("Localization for mod " + plugin.Info.Metadata.Name + " failed: Localization file was empty.");
			}
			string text2 = null;
			if (language != "English")
			{
				if (dictionary.ContainsKey(language))
				{
					text2 = File.ReadAllText(dictionary[language]);
				}
				else
				{
					byte[] array2 = LoadTranslationFromAssembly(language);
					if (array2 != null)
					{
						text2 = Encoding.UTF8.GetString(array2);
					}
				}
			}
			if (text2 == null && dictionary.ContainsKey("English"))
			{
				text2 = File.ReadAllText(dictionary["English"]);
			}
			if (text2 != null)
			{
				foreach (KeyValuePair<string, string> item2 in new DeserializerBuilder().IgnoreFields().Build().Deserialize<Dictionary<string, string>>(text2) ?? new Dictionary<string, string>())
				{
					dictionary2[item2.Key] = item2.Value;
				}
			}
			loadedTexts[language] = dictionary2;
			foreach (KeyValuePair<string, string> item3 in dictionary2)
			{
				UpdatePlaceholderText(__instance, item3.Key);
			}
		}

		static Localizer()
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Expected O, but got Unknown
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Expected O, but got Unknown
			PlaceholderProcessors = new Dictionary<string, Dictionary<string, Func<string>>>();
			loadedTexts = new Dictionary<string, Dictionary<string, string>>();
			localizationLanguage = new ConditionalWeakTable<Localization, string>();
			localizationObjects = new List<WeakReference<Localization>>();
			fileExtensions = new List<string> { ".json", ".yml" };
			Harmony val = new Harmony("org.bepinex.helpers.LocalizationManager");
			val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(Localization), "LoadCSV", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(AccessTools.DeclaredMethod(typeof(Localizer), "LoadLocalization", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		}

		[return: <fc5be810-4db8-41b3-ad01-e0fc32c8cff7>Nullable(2)]
		private static byte[] LoadTranslationFromAssembly(string language)
		{
			foreach (string fileExtension in fileExtensions)
			{
				byte[] array = ReadEmbeddedFileBytes("translations." + language + fileExtension);
				if (array != null)
				{
					return array;
				}
			}
			return null;
		}

		[<702fd9c8-9d57-4b33-a10d-166849d4a270>NullableContext(2)]
		public static byte[] ReadEmbeddedFileBytes([<fc5be810-4db8-41b3-ad01-e0fc32c8cff7>Nullable(1)] string resourceFileName, Assembly containingAssembly = null)
		{
			using MemoryStream memoryStream = new MemoryStream();
			if ((object)containingAssembly == null)
			{
				containingAssembly = Assembly.GetCallingAssembly();
			}
			string text = containingAssembly.GetManifestResourceNames().FirstOrDefault([<702fd9c8-9d57-4b33-a10d-166849d4a270>NullableContext(0)] (string str) => str.EndsWith(resourceFileName, StringComparison.Ordinal));
			if (text != null)
			{
				containingAssembly.GetManifestResourceStream(text)?.CopyTo(memoryStream);
			}
			return (memoryStream.Length == 0L) ? null : memoryStream.ToArray();
		}
	}
}
namespace Microsoft.CodeAnalysis
{
	[<fec35f53-3a02-4ae3-9736-c34ba294ebbf>Embedded]
	[CompilerGenerated]
	internal sealed class <fec35f53-3a02-4ae3-9736-c34ba294ebbf>EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[<fec35f53-3a02-4ae3-9736-c34ba294ebbf>Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class <ec923b27-2515-4081-bbb3-9bf00dd0c8f1>NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public <ec923b27-2515-4081-bbb3-9bf00dd0c8f1>NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public <ec923b27-2515-4081-bbb3-9bf00dd0c8f1>NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	[<fec35f53-3a02-4ae3-9736-c34ba294ebbf>Embedded]
	[CompilerGenerated]
	internal sealed class <450bd53f-2bce-401b-bc1e-4f522232e11d>NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public <450bd53f-2bce-401b-bc1e-4f522232e11d>NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	[<fec35f53-3a02-4ae3-9736-c34ba294ebbf>Embedded]
	[CompilerGenerated]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace ServerSync
{
	[<450bd53f-2bce-401b-bc1e-4f522232e11d>NullableContext(1)]
	[<ec923b27-2515-4081-bbb3-9bf00dd0c8f1>Nullable(0)]
	[PublicAPI]
	internal abstract class OwnConfigEntryBase
	{
		[<ec923b27-2515-4081-bbb3-9bf00dd0c8f1>Nullable(2)]
		public object LocalBaseValue;

		public bool SynchronizedConfig = true;

		public abstract ConfigEntryBase BaseConfig { get; }
	}
	[<450bd53f-2bce-401b-bc1e-4f522232e11d>NullableContext(1)]
	[PublicAPI]
	[<ec923b27-2515-4081-bbb3-9bf00dd0c8f1>Nullable(0)]
	internal class SyncedConfigEntry<[<ec923b27-2515-4081-bbb3-9bf00dd0c8f1>Nullable(2)] T> : OwnConfigEntryBase
	{
		public readonly ConfigEntry<T> SourceConfig;

		public override ConfigEntryBase BaseConfig => (ConfigEntryBase)(object)SourceConfig;

		public T Value
		{
			get
			{
				return SourceConfig.Value;
			}
			set
			{
				SourceConfig.Value = value;
			}
		}

		public SyncedConfigEntry(ConfigEntry<T> sourceConfig)
		{
			SourceConfig = sourceConfig;
		}

		public void AssignLocalValue(T value)
		{
			if (LocalBaseValue == null)
			{
				Value = value;
			}
			else
			{
				LocalBaseValue = value;
			}
		}
	}
	[<ec923b27-2515-4081-bbb3-9bf00dd0c8f1>Nullable(0)]
	[<450bd53f-2bce-401b-bc1e-4f522232e11d>NullableContext(2)]
	internal abstract class CustomSyncedValueBase
	{
		public object LocalBaseValue;

		[<ec923b27-2515-4081-bbb3-9bf00dd0c8f1>Nullable(1)]
		public readonly string Identifier;

		[<ec923b27-2515-4081-bbb3-9bf00dd0c8f1>Nullable(1)]
		public readonly Type Type;

		private object boxedValue;

		protected bool localIsOwner;

		public readonly int Priority;

		public object BoxedValue
		{
			get
			{
				return boxedValue;
			}
			set
			{
				boxedValue = value;
				this.ValueChanged?.Invoke();
			}
		}

		public event Action ValueChanged;

		[<450bd53f-2bce-401b-bc1e-4f522232e11d>NullableContext(1)]
		protected CustomSyncedValueBase(ConfigSync configSync, string identifier, Type type, int priority)
		{
			Priority = priority;
			Identifier = identifier;
			Type = type;
			configSync.AddCustomValue(this);
			localIsOwner = configSync.IsSourceOfTruth;
			configSync.SourceOfTruthChanged += delegate(bool truth)
			{
				localIsOwner = truth;
			};
		}
	}
	[<ec923b27-2515-4081-bbb3-9bf00dd0c8f1>Nullable(0)]
	[<450bd53f-2bce-401b-bc1e-4f522232e11d>NullableContext(1)]
	[PublicAPI]
	internal sealed class CustomSyncedValue<[<ec923b27-2515-4081-bbb3-9bf00dd0c8f1>Nullable(2)] T> : CustomSyncedValueBase
	{
		public T Value
		{
			get
			{
				return (T)base.BoxedValue;
			}
			set
			{
				base.BoxedValue = value;
			}
		}

		public CustomSyncedValue(ConfigSync configSync, string identifier, T value = default(T), int priority = 0)
			: base(configSync, identifier, typeof(T), priority)
		{
			Value = value;
		}

		public void AssignLocalValue(T value)
		{
			if (localIsOwner)
			{
				Value = value;
			}
			else
			{
				LocalBaseValue = value;
			}
		}
	}
	internal class ConfigurationManagerAttributes
	{
		[UsedImplicitly]
		public bool? ReadOnly = false;
	}
	[<450bd53f-2bce-401b-bc1e-4f522232e11d>NullableContext(1)]
	[PublicAPI]
	[<ec923b27-2515-4081-bbb3-9bf00dd0c8f1>Nullable(0)]
	internal class ConfigSync
	{
		[<450bd53f-2bce-401b-bc1e-4f522232e11d>NullableContext(0)]
		[HarmonyPatch(typeof(ZRpc), "HandlePackage")]
		private static class SnatchCurrentlyHandlingRPC
		{
			[<ec923b27-2515-4081-bbb3-9bf00dd0c8f1>Nullable