Decompiled source of EpicJewels v0.9.5

plugins/EpicJewels.dll

Decompiled 3 weeks ago
using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
using System.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 EpicJewels.Common;
using EpicJewels.GemEffects;
using HarmonyLib;
using JetBrains.Annotations;
using Jewelcrafting;
using LocalizationManager;
using Microsoft.CodeAnalysis;
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.Callbacks;
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.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("EpicJewels")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EpicJewels")]
[assembly: AssemblyCopyright("Copyright ©  2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("e3243d22-4307-4008-ba36-9f326008cde5")]
[assembly: AssemblyFileVersion("0.0.1.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.1.0")]
[module: UnverifiableCode]
namespace EpicJewels
{
	public class CustomGems
	{
		public CustomGems(AssetBundle embeddedResources)
		{
			AddGems(embeddedResources);
		}

		public void AddGems(AssetBundle embeddedResources)
		{
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: 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)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			Material material = embeddedResources.LoadAsset<Material>("assets/custom/fbx_exports/gems/jade/gem_jade.mat");
			Material material2 = embeddedResources.LoadAsset<Material>("assets/custom/fbx_exports/gems/garnet/garnet_gem.mat");
			Material material3 = embeddedResources.LoadAsset<Material>("assets/custom/fbx_exports/gems/amber/amber_gem.mat");
			Material material4 = embeddedResources.LoadAsset<Material>("assets/custom/fbx_exports/gems/opal/opal_gem.mat");
			Material material5 = embeddedResources.LoadAsset<Material>("assets/custom/fbx_exports/gems/amethyst/amethyst_gem.mat");
			Material material6 = embeddedResources.LoadAsset<Material>("assets/custom/fbx_exports/gems/aquamarine/aquamarine_gem.mat");
			API.AddGems("Jade", "jade", material, new Color(0.031f, 0.69f, 0.043f, 1f));
			API.AddGems("Amber", "amber", material3, new Color(1f, 0.776f, 0.071f, 1f));
			API.AddGems("Aquamarine", "aquamarine", material6, new Color(0.259f, 0.663f, 0.71f, 1f));
			API.AddGems("Garnet", "garnet", material2, new Color(1f, 0.141f, 0.039f));
			API.AddGems("Opal", "opal", material4, new Color(0.945f, 0.988f, 0.988f, 1f));
			API.AddGems("Amethyst", "amethyst", material5, new Color(0.784f, 0.302f, 0.98f, 1f));
			API.AddGemConfig(EpicJewels.LoadEmbeddedAssetToString("EJConfig.yaml"));
		}
	}
	[BepInPlugin("MidnightsFX.EpicJewels", "EpicJewels", "0.9.5")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	internal class EpicJewels : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(InventoryGui), "Awake")]
		public static class EnableSynergyTextfit
		{
			[HarmonyPriority(0)]
			public static void Postfix()
			{
				IEnumerable<GameObject> enumerable = from obj in Resources.FindObjectsOfTypeAll<GameObject>()
					where ((Object)obj).name.StartsWith("JC_Synergies_Window")
					select obj;
				EJLog.LogDebug((object)$"Found {enumerable.Count()} Synergy panels to update.");
				foreach (GameObject item in enumerable)
				{
					try
					{
						EJLog.LogDebug((object)$"Updating Synergy GO {item}");
						((Component)item.transform.Find("Bkg/Left_Text/Left_Text_1")).gameObject.GetComponent<Text>().resizeTextForBestFit = true;
					}
					catch (Exception)
					{
					}
				}
			}
		}

		public const string PluginGUID = "MidnightsFX.EpicJewels";

		public const string PluginName = "EpicJewels";

		public const string PluginVersion = "0.9.5";

		public static readonly ManualLogSource EJLog = Logger.CreateLogSource("EpicJewels");

		internal Config cfg;

		internal static AssetBundle EmbeddedResourceBundle;

		internal static Harmony Harmony = new Harmony("MidnightsFX.EpicJewels");

		public static IDeserializer yamldeserializer = new DeserializerBuilder().WithNamingConvention(CamelCaseNamingConvention.Instance).Build();

		public static ISerializer yamlserializer = new SerializerBuilder().WithNamingConvention(CamelCaseNamingConvention.Instance).DisableAliases().Build();

		public static Material spiritCreature;

		private void Awake()
		{
			Localizer.Load();
			cfg = new Config(((BaseUnityPlugin)this).Config);
			EmbeddedResourceBundle = LoadAssetBundle("EpicJewels.AssetsEmbedded.epicjewels");
			EJLog.LogDebug((object)"Logging embedded assets.");
			string[] allAssetNames = EmbeddedResourceBundle.GetAllAssetNames();
			foreach (string text in allAssetNames)
			{
				EJLog.LogDebug((object)text);
			}
			EJLog.LogInfo((object)"Let the gems flow.");
			EffectList.AddGemEffects();
			new CustomGems(EmbeddedResourceBundle);
			spiritCreature = EmbeddedResourceBundle.LoadAsset<Material>("assets/custom/fbx_exports/gems/spirit_animal_mat.mat");
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			Harmony.PatchAll(executingAssembly);
		}

		public static AssetBundle LoadAssetBundle(string bundleName)
		{
			Assembly assembly = typeof(EpicJewels).Assembly;
			string name = null;
			try
			{
				name = assembly.GetManifestResourceNames().Single((string str) => str.EndsWith(bundleName));
			}
			catch (Exception)
			{
			}
			using Stream stream = assembly.GetManifestResourceStream(name);
			return AssetBundle.LoadFromStream(stream);
		}

		public static string LoadEmbeddedAssetToString(string assetName)
		{
			Assembly assembly = typeof(EpicJewels).Assembly;
			string text = null;
			try
			{
				text = assembly.GetManifestResourceNames().Single((string str) => str.EndsWith(assetName));
			}
			catch (Exception)
			{
			}
			if (text == null)
			{
				return null;
			}
			using Stream stream = assembly.GetManifestResourceStream(text);
			using StreamReader streamReader = new StreamReader(stream);
			return streamReader.ReadToEnd();
		}
	}
}
namespace EpicJewels.GemEffects
{
	public static class AddBluntDamage
	{
		[PublicAPI]
		public struct Config
		{
			[AdditivePower]
			public float Power;
		}
	}
	public static class AddChopDamage
	{
		[PublicAPI]
		public struct Config
		{
			[AdditivePower]
			public float Power;
		}
	}
	public static class CombatSpirit
	{
		[PublicAPI]
		public struct Config
		{
			[AdditivePower]
			public float Power;
		}

		[HarmonyPatch(typeof(Player), "OnTargeted")]
		public static class CombatCompanion
		{
			private static void Postfix(Player __instance, bool sensed, bool alerted)
			{
				//IL_0102: Unknown result type (might be due to invalid IL or missing references)
				//IL_0228: Unknown result type (might be due to invalid IL or missing references)
				//IL_022d: Unknown result type (might be due to invalid IL or missing references)
				//IL_023d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0242: Unknown result type (might be due to invalid IL or missing references)
				//IL_0258: Unknown result type (might be due to invalid IL or missing references)
				//IL_0259: Unknown result type (might be due to invalid IL or missing references)
				if (!((Object)(object)Player.m_localPlayer != (Object)null && Player.m_localPlayer.GetEffectPower<Config>("Combat Spirit").Power > 0f && (Object)(object)__instance == (Object)(object)Player.m_localPlayer && sensed && alerted))
				{
					return;
				}
				if ((Object)(object)wolf == (Object)null)
				{
					ZNetScene.instance.m_namedPrefabs.TryGetValue(StringExtensionMethods.GetStableHashCode("Wolf"), out wolf);
					((Renderer)wolf.GetComponentInChildren<SkinnedMeshRenderer>()).material = EpicJewels.spiritCreature;
					Object.Destroy((Object)(object)wolf.GetComponent<CharacterDrop>());
					Object.Destroy((Object)(object)wolf.GetComponent<Tameable>());
					Humanoid component = wolf.GetComponent<Humanoid>();
					wolf.GetComponent<Character>();
					wolf.GetComponent<MonsterAI>().m_attackPlayerObjects = false;
					((Character)component).m_health = 1000f;
					((Character)component).m_deathEffects.m_effectPrefabs[1].m_enabled = false;
					((Character)component).m_deathEffects.m_effectPrefabs[0].m_enabled = false;
					if ((Object)(object)component != (Object)null)
					{
						((Character)component).m_faction = (Faction)0;
					}
					((Object)wolf).name = "Spirit Wolf";
				}
				EpicJewels.EJLog.LogDebug((object)$"checking for spawning spirit companion {recheck_spirit_spawn_timer} has companion? {have_spirit_companion} cooldown {cooldown_timer}");
				float deltaTime = Time.deltaTime;
				if (cooldown_timer > 0f)
				{
					if (deltaTime > cooldown_timer * 60f)
					{
						cooldown_timer = 0f;
					}
					cooldown_timer -= deltaTime;
					if (cooldown_timer < 0f)
					{
						cooldown_timer = 0f;
					}
					return;
				}
				if (recheck_spirit_spawn_timer > 3f)
				{
					recheck_spirit_spawn_timer = 0f;
					if (Character.s_characters.Any((Character c) => Vector3.Distance(((Component)Player.m_localPlayer).gameObject.transform.position, ((Component)c).transform.position) < 100f && ((Object)c).name == "Spirit Wolf"))
					{
						EpicJewels.EJLog.LogDebug((object)"Already have spirit wolf");
						have_spirit_companion = true;
					}
					else
					{
						have_spirit_companion = false;
					}
				}
				else
				{
					recheck_spirit_spawn_timer += Time.deltaTime;
				}
				if (!have_spirit_companion)
				{
					Quaternion val = Quaternion.Euler(0f, Random.Range(0f, 360f), 0f);
					Vector3 position = ((Component)Player.m_localPlayer).gameObject.transform.position;
					position.x += 1f;
					GameObject obj = Object.Instantiate<GameObject>(wolf, position, val);
					cooldown_timer = 120f;
					have_spirit_companion = true;
					obj.AddComponent<CharacterTimedDestruction>();
					Character component2 = wolf.GetComponent<Character>();
					obj.GetComponent<CharacterTimedDestruction>().m_character = component2;
					obj.GetComponent<CharacterTimedDestruction>().Trigger(Player.m_localPlayer.GetEffectPower<Config>("Combat Spirit").Power);
				}
			}
		}

		private static GameObject wolf = null;

		private static bool have_spirit_companion = false;

		private static float recheck_spirit_spawn_timer = 0f;

		private static float cooldown_timer = 5f;
	}
	public static class CoverOfDarkness
	{
		[PublicAPI]
		public struct Config
		{
			[InverseMultiplicativePercentagePower]
			public float Power;

			[InverseMultiplicativePercentagePower]
			public float Chance;
		}

		[HarmonyPatch(typeof(Character), "Damage")]
		public static class SummonBatHelpers
		{
			private static void Prefix(HitData hit)
			{
				if (hit.GetAttacker() is Player && Player.m_localPlayer.GetEffectPower<Config>("Cover of Darkness").Power > 0f && Random.value < Player.m_localPlayer.GetEffectPower<Config>("Cover of Darkness").Chance / 100f)
				{
					EpicJewels.EJLog.LogDebug((object)string.Format("Cover of darkness triggered darkness power: {0}", Player.m_localPlayer.GetEffectPower<Config>("Cover of Darkness").Power));
					int stars = 1;
					float power = Player.m_localPlayer.GetEffectPower<Config>("Cover of Darkness").Power;
					if (power > 70f)
					{
						stars = 4;
					}
					else if (power > 50f)
					{
						stars = 3;
					}
					else if (power > 30f)
					{
						stars = 2;
					}
					if (Player.m_localPlayer.GetEffectPower<Config>("Cover of Darkness").Power > 90f)
					{
						SpawnBat(stars);
						SpawnBat(stars);
					}
					else
					{
						SpawnBat(stars);
					}
				}
			}
		}

		private static GameObject bat;

		private static void SpawnBat(int stars = 1)
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)bat == (Object)null)
			{
				ZNetScene.instance.m_namedPrefabs.TryGetValue(StringExtensionMethods.GetStableHashCode("Bat"), out bat);
			}
			Quaternion val = Quaternion.Euler(0f, Random.Range(0f, 360f), 0f);
			Vector3 position = ((Component)Player.m_localPlayer).gameObject.transform.position;
			position.z += 0.5f;
			GameObject val2 = Object.Instantiate<GameObject>(bat, position, val);
			Character component = val2.GetComponent<Character>();
			component.m_level = stars;
			Object.Destroy((Object)(object)val2.GetComponent<CharacterDrop>());
			Humanoid component2 = val2.GetComponent<Humanoid>();
			if ((Object)(object)component2 != (Object)null)
			{
				((Character)component2).m_faction = (Faction)0;
			}
			else
			{
				Object.Destroy((Object)(object)val2);
			}
			val2.AddComponent<CharacterTimedDestruction>();
			val2.GetComponent<CharacterTimedDestruction>().m_character = component;
			val2.GetComponent<CharacterTimedDestruction>().Trigger(Player.m_localPlayer.GetEffectPower<Config>("Cover of Darkness").Power);
		}
	}
	public static class EitrConversion
	{
		[PublicAPI]
		public struct Config
		{
			[AdditivePower]
			public float Power;

			[InverseMultiplicativePercentagePower]
			public float Chance;
		}

		[HarmonyPatch(typeof(Humanoid), "BlockAttack")]
		private static class HealOnParry
		{
			private static void Postfix(Humanoid __instance, ref bool __result)
			{
				Player val = (Player)(object)((__instance is Player) ? __instance : null);
				if (val != null && val.GetEffectPower<Config>("Eitr Conversion").Power > 0f)
				{
					float value = Random.value;
					float num = Player.m_localPlayer.GetEffectPower<Config>("Eitr Conversion").Chance / 100f;
					EpicJewels.EJLog.LogDebug((object)$"Eitr Conversion chance roll: {value} < {num}");
					if (value < num)
					{
						((Character)val).AddEitr(((Character)val).GetMaxEitr() * (val.GetEffectPower<Config>("Eitr Conversion").Power / 100f));
					}
				}
			}
		}
	}
	public static class EitrFused
	{
		[PublicAPI]
		public struct Config
		{
			[InverseMultiplicativePercentagePower]
			public float Power;

			[AdditivePower]
			public float Cost;
		}
	}
	public static class FlamingGuard
	{
		[PublicAPI]
		public struct Config
		{
			[AdditivePower]
			public float Power;

			[AdditivePower]
			public float Chance;
		}

		[HarmonyPatch(typeof(Humanoid), "BlockAttack")]
		private static class FlamingBlock_Patch
		{
			private static int burningstatus = StringExtensionMethods.GetStableHashCode("Burning");

			private static void Postfix(Humanoid __instance, HitData hit, Character attacker, ref bool __result)
			{
				//IL_007e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0084: Expected O, but got Unknown
				Player val = (Player)(object)((__instance is Player) ? __instance : null);
				if (val != null && val.GetEffectPower<Config>("Burning Guard").Chance > 0f && __result && !attacker.IsDead())
				{
					float value = Random.value;
					float num = Player.m_localPlayer.GetEffectPower<Config>("Burning Guard").Chance / 100f;
					EpicJewels.EJLog.LogDebug((object)$"Burning Guard chance roll: {value} < {num}");
					if (value < num)
					{
						HitData val2 = new HitData();
						val2.m_damage.m_fire = val.GetEffectPower<Config>("Burning Guard").Power / 100f * ((DamageTypes)(ref hit.m_damage)).GetTotalDamage();
						attacker.ApplyDamage(val2, true, true, (DamageModifier)0);
						attacker.m_seman.AddStatusEffect(burningstatus, true, 1, Player.m_localPlayer.m_skills.GetSkill((SkillType)6).m_level);
					}
				}
			}
		}
	}
	internal class FreezingGuard
	{
		[PublicAPI]
		public struct Config
		{
			[AdditivePower]
			public float Power;

			[AdditivePower]
			public float Chance;
		}

		[HarmonyPatch(typeof(Humanoid), "BlockAttack")]
		private static class FreezingBlock_Patch
		{
			private static int froststatus = StringExtensionMethods.GetStableHashCode("Frost");

			private static void Postfix(Humanoid __instance, HitData hit, Character attacker, ref bool __result)
			{
				//IL_007e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0084: Expected O, but got Unknown
				Player val = (Player)(object)((__instance is Player) ? __instance : null);
				if (val != null && val.GetEffectPower<Config>("Freezing Guard").Chance > 0f && __result && !attacker.IsDead())
				{
					float value = Random.value;
					float num = Player.m_localPlayer.GetEffectPower<Config>("Freezing Guard").Chance / 100f;
					EpicJewels.EJLog.LogDebug((object)$"Freezing guard chance roll: {value} < {num}");
					if (value < num)
					{
						HitData val2 = new HitData();
						val2.m_damage.m_frost = val.GetEffectPower<Config>("Freezing Guard").Power / 100f * ((DamageTypes)(ref hit.m_damage)).GetTotalDamage();
						attacker.ApplyDamage(val2, true, true, (DamageModifier)0);
						attacker.m_seman.AddStatusEffect(froststatus, true, 3, Player.m_localPlayer.m_skills.GetSkill((SkillType)6).m_level);
					}
				}
			}
		}
	}
	public static class Inferno
	{
		[PublicAPI]
		public struct Config
		{
			[MultiplicativePercentagePower]
			public float Power;

			[MultiplicativePercentagePower]
			public float Chance;
		}
	}
	public static class AddLightningDamage
	{
		[PublicAPI]
		public struct Config
		{
			[AdditivePower]
			public float Power;
		}
	}
	internal class AddPickaxeDamage
	{
		[PublicAPI]
		public struct Config
		{
			[AdditivePower]
			public float Power;
		}
	}
	public static class AddPierceDamage
	{
		[PublicAPI]
		public struct Config
		{
			[AdditivePower]
			public float Power;
		}
	}
	public static class AddSlashDamage
	{
		[PublicAPI]
		public struct Config
		{
			[AdditivePower]
			public float Power;
		}
	}
	public static class AddSpiritDamage
	{
		[PublicAPI]
		public struct Config
		{
			[AdditivePower]
			public float Power;
		}
	}
	public static class BlockReduceStamina
	{
		[PublicAPI]
		public struct Config
		{
			[AdditivePower]
			public float Power;
		}

		[HarmonyPatch(typeof(Humanoid), "BlockAttack")]
		public static class ModifyBlockStaminaUse_Humanoid_BlockAttack_Patch
		{
			public static void Prefix(Humanoid __instance, HitData hit, Character attacker)
			{
				if (((Character)__instance).IsPlayer() && Player.m_localPlayer.GetEffectPower<Config>("Block Reduce Stamina").Power > 0f)
				{
					float num = 100f / (100f + Player.m_localPlayer.GetEffectPower<Config>("Block Reduce Stamina").Power);
					EpicJewels.EJLog.LogDebug((object)$"Multiplying block stamina cost by {num}");
					__instance.m_blockStaminaDrain *= num;
				}
			}
		}
	}
	public static class BluntResistance
	{
		[PublicAPI]
		public struct Config
		{
			[InverseMultiplicativePercentagePower]
			public float Power;
		}

		[HarmonyPatch(typeof(Character), "RPC_Damage")]
		public static class ReduceBluntDamageTaken
		{
			[UsedImplicitly]
			private static void Prefix(Character __instance, HitData hit)
			{
				Player val = (Player)(object)((__instance is Player) ? __instance : null);
				if (val != null)
				{
					Character attacker = hit.GetAttacker();
					if (attacker != null && (Object)(object)attacker != (Object)(object)__instance && hit.m_damage.m_blunt > 0f && val.GetEffectPower<Config>("Blunt Resistance").Power > 0f)
					{
						float num = (100f - val.GetEffectPower<Config>("Blunt Resistance").Power) / 100f;
						EpicJewels.EJLog.LogDebug((object)$"Blunt Resistance is reducing Blunt damage {1f - num}");
						hit.m_damage.m_slash *= num;
					}
				}
			}
		}
	}
	public static class BurningFrenzy
	{
		[PublicAPI]
		public struct Config
		{
			[AdditivePower]
			public float Power;
		}

		[HarmonyPatch(typeof(Character), "Damage")]
		private class AddBonusBonusDamageWhileOnFire
		{
			private static void Prefix(HitData hit)
			{
				if (hit.GetAttacker() is Player)
				{
					bool flag = ((Character)Player.m_localPlayer).GetSEMan().HaveStatusEffect(burningstatus);
					EpicJewels.EJLog.LogDebug((object)$"Frenzy checking for burning viking {flag}");
					if (flag)
					{
						float num = (100f + Player.m_localPlayer.GetEffectPower<Config>("Burning Frenzy").Power) / 100f;
						EpicJewels.EJLog.LogDebug((object)$"VikingOnFire Damage multiplier {num}");
						hit.m_damage.m_blunt *= num;
						hit.m_damage.m_pierce *= num;
						hit.m_damage.m_pierce *= num;
						hit.m_damage.m_fire *= num;
						hit.m_damage.m_lightning *= num;
						hit.m_damage.m_frost *= num;
						hit.m_damage.m_spirit *= num;
						hit.m_damage.m_poison *= num;
						hit.m_damage.m_pickaxe *= num;
					}
				}
			}
		}

		private static int burningstatus = StringExtensionMethods.GetStableHashCode("Burning");
	}
	public static class BurningViking
	{
		[PublicAPI]
		public struct Config
		{
			[InverseMultiplicativePercentagePower]
			public float Power;
		}

		[HarmonyPatch(typeof(Player), "GetJogSpeedFactor")]
		private class IncreaseJogSpeed
		{
			private static void Postfix(Player __instance, ref float __result)
			{
				if (((Character)Player.m_localPlayer).GetSEMan().HaveStatusEffect(burningstatus) && __instance.GetEffectPower<Config>("Burning Viking").Power > 0f)
				{
					__result *= (__instance.GetEffectPower<Config>("Burning Viking").Power + 100f) / 100f;
				}
			}
		}

		[HarmonyPatch(typeof(Player), "GetRunSpeedFactor")]
		private class IncreaseRunSpeed
		{
			private static void Postfix(Player __instance, ref float __result)
			{
				if (((Character)Player.m_localPlayer).GetSEMan().HaveStatusEffect(burningstatus) && __instance.GetEffectPower<Config>("Burning Viking").Power > 0f)
				{
					__result *= (__instance.GetEffectPower<Config>("Burning Viking").Power + 100f) / 100f;
				}
			}
		}

		private static int burningstatus = StringExtensionMethods.GetStableHashCode("Burning");
	}
	public static class CoinGreed
	{
		[PublicAPI]
		public struct Config
		{
			[AdditivePower]
			public float Power;

			[InverseMultiplicativePercentagePower]
			public float Chance;
		}

		[HarmonyPatch(typeof(Character), "OnDeath")]
		public static class AddGreedOnDeathFromPlayer
		{
			[UsedImplicitly]
			private static void Postfix(Character __instance)
			{
				//IL_0100: Unknown result type (might be due to invalid IL or missing references)
				//IL_0110: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)Player.m_localPlayer == (Object)null || (Object)(object)__instance.m_lastHit.GetAttacker() != (Object)(object)Player.m_localPlayer)
				{
					return;
				}
				float power = Player.m_localPlayer.GetEffectPower<Config>("Coin Greed").Power;
				EpicJewels.EJLog.LogDebug((object)$"Coingreed enabled? {power > 0f}");
				if (power > 0f)
				{
					float num = Player.m_localPlayer.GetEffectPower<Config>("Coin Greed").Chance / 100f;
					float value = Random.value;
					EpicJewels.EJLog.LogDebug((object)$"Coingreed: {value} < {num} = {value < num}");
					if (value < num)
					{
						float num2 = Random.Range(1f, Math.Max(1f, power));
						EpicJewels.EJLog.LogDebug((object)$"coingreed drop {(int)num2}");
						Object.Instantiate<GameObject>(ObjectDB.instance.GetItemPrefab("Coins"), ((Component)__instance).gameObject.transform.position, ((Component)__instance).gameObject.transform.rotation).GetComponent<ItemDrop>().m_itemData.m_stack = (int)num2;
					}
				}
			}
		}
	}
	internal class CoinHoarder
	{
		[PublicAPI]
		public struct Config
		{
			[InverseMultiplicativePercentagePower]
			public float Power;
		}

		[HarmonyPatch(typeof(Character), "Damage")]
		private class IncreaseAllDamageByCoins
		{
			private static void Prefix(HitData hit)
			{
				if (!(hit.GetAttacker() is Player) || !((Object)(object)Player.m_localPlayer != (Object)null) || !(Player.m_localPlayer.GetEffectPower<Config>("Coin Hoarder").Power > 0f))
				{
					return;
				}
				ItemData[] array = (from val in ((Humanoid)Player.m_localPlayer).m_inventory.GetAllItems()
					where ((Object)val.m_dropPrefab).name == "Coins"
					select val).ToArray();
				if (array.Length != 0)
				{
					float num = 0f;
					ItemData[] array2 = array;
					foreach (ItemData val2 in array2)
					{
						num += (float)val2.m_stack;
					}
					float num2 = (float)Math.Log10(Player.m_localPlayer.GetEffectPower<Config>("Coin Hoarder").Power * num);
					float num3 = num2 * 5.5f / 100f + 1f;
					EpicJewels.EJLog.LogDebug((object)$"Coinhorder bonus multipler {num3} coin log bonus: {num2} inv coins: {num}");
					hit.m_damage.m_blunt *= num3;
					hit.m_damage.m_pierce *= num3;
					hit.m_damage.m_slash *= num3;
					hit.m_damage.m_fire *= num3;
					hit.m_damage.m_lightning *= num3;
					hit.m_damage.m_frost *= num3;
					hit.m_damage.m_spirit *= num3;
					hit.m_damage.m_poison *= num3;
					hit.m_damage.m_pickaxe *= num3;
				}
			}
		}
	}
	public static class EffectList
	{
		public enum DmgEffect
		{
			AddBluntDamage,
			AddPierceDamage,
			AddSlashDamage,
			AddSpiritDamage,
			AddLightningDamage,
			AddPickaxeDamage,
			AddChopDamage
		}

		public static void AddGemEffects()
		{
			API.AddGemEffect<BluntResistance.Config>("Blunt Resistance", "$EJ_blunt_resistance_header.", "$EJ_blunt_resistance_header $EJ_by $1%.");
			API.AddGemEffect<PierceResistance.Config>("Pierce Resistance", "$EJ_pierce_resistance_header.", "$EJ_pierce_resistance_header $EJ_by $1%.");
			API.AddGemEffect<SlashResistance.Config>("Slash Resistance", "$EJ_slash_resistance_header.", "$EJ_slash_resistance_header $EJ_by $1%.");
			API.AddGemEffect<FireResistance.Config>("Fire Resistance", "$EJ_fire_resistance_header.", "$EJ_fire_resistance_header $EJ_by $1%.");
			API.AddGemEffect<PoisonResistance.Config>("Poison Resistance", "$EJ_poison_resistance_header.", "$EJ_poison_resistance_header $EJ_by $1%.");
			API.AddGemEffect<LightningResistance.Config>("Lightning Resistance", "$EJ_lightning_resistance_header.", "$EJ_lightning_resistance_header $EJ_by $1%.");
			API.AddGemEffect<AddBluntDamage.Config>("Add Blunt Damage", "$EJ_blunt_dmg_header.", "$EJ_blunt_dmg_header $EJ_eq $1% $EJ_dmg_explained_end $EJ_dmg_tooltip");
			API.AddGemEffect<AddPierceDamage.Config>("Add Pierce Damage", "$EJ_pierce_dmg_header.", "$EJ_pierce_dmg_header $EJ_eq $1% $EJ_dmg_explained_end $EJ_dmg_tooltip");
			API.AddGemEffect<AddSlashDamage.Config>("Add Slash Damage", "$EJ_slash_dmg_header.", "$EJ_slash_dmg_header $EJ_eq $1% $EJ_dmg_explained_end $EJ_dmg_tooltip");
			API.AddGemEffect<AddSpiritDamage.Config>("Add Spirit Damage", "$EJ_spirit_dmg_header.", "$EJ_spirit_dmg_header $EJ_eq $1% $EJ_dmg_explained_end $EJ_dmg_tooltip");
			API.AddGemEffect<AddLightningDamage.Config>("Add Lightning Damage", "$EJ_lightning_dmg_header.", "$EJ_lightning_dmg_header $EJ_eq $1% $EJ_dmg_explained_end $EJ_dmg_tooltip");
			API.AddGemEffect<AddPickaxeDamage.Config>("Add Pickaxe Damage", "$EJ_pickaxe_dmg_header.", "$EJ_pickaxe_dmg_header $EJ_eq $1% $EJ_dmg_explained_end");
			API.AddGemEffect<AddChopDamage.Config>("Add Chop Damage", "$EJ_woodcutting_dmg_header.", "$EJ_woodcutting_dmg_header $EJ_eq $1% $EJ_dmg_explained_end");
			API.AddGemEffect<Inferno.Config>("Inferno", "$EJ_inferno_header", "$2% $EJ_inferno_ep1 $1% $EJ_inferno_ep2");
			API.AddGemEffect<IncreaseEitr.Config>("Increase Eitr", "$EJ_more_eitr_header", "$EJ_more_eitr_details $1.");
			API.AddGemEffect<IncreaseStamina.Config>("Increase Stamina", "$EJ_more_stamina_header", "$EJ_more_stamina_explained $1.");
			API.AddGemEffect<IncreaseStaminaRegen.Config>("Increase Stamina Regen", "$EJ_stamina_regen_header", "$EJ_stamina_regen_explained $1%.");
			API.AddGemEffect<BlockReduceStamina.Config>("Block Reduce Stamina", "$EJ_stamina_block_cost_header", "$EJ_stamina_block_cost_explained $1%.");
			API.AddGemEffect<WeaponReducedStamina.Config>("Weapon Reduced Stamina", "$EJ_stamina_weapon_cost_header", "$EJ_stamina_weapon_cost_explained $1%.");
			API.AddGemEffect<CoinGreed.Config>("Coin Greed", "$EJ_coingreed_header", "$EJ_coingreed_pt1 $2% $EJ_coingreed_pt2 1-$1 $EJ_coingreed_pt3");
			API.AddGemEffect<CoinHoarder.Config>("Coin Hoarder", "$EJ_coinhoarder", "Increase all of your damage by a fraction of the coins you carry.");
			API.AddGemEffect<WaterResistant.Config>("Water Resistant", "$EJ_water_prevent", "$EJ_water_prevent_pt1 $1 $EJ_water_prevent_pt2");
			API.AddGemEffect<WaterFrenzy.Config>("Water Frenzy", "$EJ_water_dmg_buff", "$EJ_dmg_buff_pt1 $1% $EJ_water_dmg_buff_pt2");
			API.AddGemEffect<WaterSwiftness.Config>("Water Swiftness", "$EJ_water_speed_buff", "$EJ_speed_buff_pt1 $1% $EJ_water_speed_buff_pt2");
			API.AddGemEffect<BurningViking.Config>("Burning Viking", "$EJ_fire_speed_buff", "$EJ_speed_buff_pt1 $1% $EJ_fire_speed_buff_pt2");
			API.AddGemEffect<BurningFrenzy.Config>("Burning Frenzy", "$EJ_fire_dmg_buff", "$EJ_dmg_buff_pt1 $1% $EJ_fire_dmg_buff_pt2");
			API.AddGemEffect<ExpertFisher.Config>("Expert Fisher", "$EJ_skill_fishing", "$EJ_skill_fishing_pt1 $1% $EJ_skill_higher $EJ_skill_inc_visible");
			API.AddGemEffect<ExpertMage.Config>("Expert Mage", "$EJ_skill_magic", "$EJ_skill_magic_pt1 $1% $EJ_skill_higher $EJ_skill_inc_visible");
			API.AddGemEffect<ExpertHarvester.Config>("Expert Harvester", "$EJ_skill_harvest", "$EJ_skill_harvest_pt1 $1% $EJ_skill_higher $EJ_skill_inc_visible");
			API.AddGemEffect<ExpertBrawler.Config>("Expert Brawler", "$EJ_brawling", "$EJ_brawling_pt1 $1% $EJ_skill_higher $EJ_skill_inc_visible");
			API.AddGemEffect<ExpertAcrobat.Config>("Expert Acrobat", "$EJ_jump", "$EJ_jump_pt1 $1% $EJ_skill_higher $EJ_skill_inc_visible");
			API.AddGemEffect<ExpertDaggers.Config>("Expert Daggers", "$EJ_knives", "$EJ_knives_pt1 $1% $EJ_skill_higher $EJ_skill_inc_visible");
			API.AddGemEffect<ExpertSwordsman.Config>("Expert Swordsman", "$EJ_swords", "$EJ_swords_pt1 $1% $EJ_skill_higher $EJ_skill_inc_visible");
			API.AddGemEffect<ExpertSmasher.Config>("Expert Smasher", "$EJ_maces", "$EJ_maces_pt1 $1% $EJ_skill_higher $EJ_skill_inc_visible");
			API.AddGemEffect<ExpertPolearms.Config>("Expert Polearms", "$EJ_polearms", "$EJ_polearms_pt1 $1% $EJ_skill_higher $EJ_skill_inc_visible");
			API.AddGemEffect<ExpertSpearmaiden.Config>("Expert Spearmaiden", "$EJ_spears", "$EJ_spears_pt1 $1% $EJ_skill_higher $EJ_skill_inc_visible");
			API.AddGemEffect<ExpertAxemaster.Config>("Expert Axemaster", "$EJ_axes", "$EJ_axes_pt1 $1% $EJ_skill_higher $EJ_skill_inc_visible");
			API.AddGemEffect<ExpertSprinter.Config>("Expert Sprinter", "$EJ_sprinter", "$EJ_sprinter_pt1 $1% $EJ_skill_higher $EJ_skill_inc_visible");
			API.AddGemEffect<ReduceWeight.Config>("Reduce Weight", "$EJ_weight_reduce", "$EJ_weight_reduce_pt1 $1% $EJ_weight_reduce_pt2");
			API.AddGemEffect<CoverOfDarkness.Config>("Cover of Darkness", "$EJ_cover_darkness", "$2% $EJ_cover_darkness_pt1 $1% $EJ_cover_darkness_pt2");
			API.AddGemEffect<EitrConversion.Config>("Eitr Conversion", "$EJ_eitr_conversion", "$2% $EJ_eitr_conversion_pt1 $1% $EJ_eitr_conversion_pt2");
			API.AddGemEffect<Retribution.Config>("Retribution", "$EJ_retribution", "$2% $EJ_retribution_pt1 $1% $EJ_retribution_pt2");
			API.AddGemEffect<StaggeringBlock.Config>("Staggering Block", "Blocking can stagger attackers.", "$1% chance to stagger your attacker.");
			API.AddGemEffect<FlamingGuard.Config>("Burning Guard", "On block chance to return fire damage.", "$1% chance to set your attacker on fire for $2% of the blocked damage.");
			API.AddGemEffect<FreezingGuard.Config>("Freezing Guard", "On block chance to  return frost damage.", "$1% chance to return frost damage for $2% of the blocked damage.");
			API.AddGemEffect<WetWorker.Config>("Wet Worker", "Reduces stamina usage when wet.", "$1% usage stamina cost reduction when wet.");
			API.AddGemEffect<EitrFused.Config>("Eitr Fused", "Uses eitr to increase damage.", "$1% increase to damage at the cost of $2 eitr per hit.");
			API.AddGemEffect<Farmer.Config>("Farmer", "Chance for bigger harvests.", "$2% chance to get $1 additional crops when harvesting.");
			API.AddGemEffect<CombatSpirit.Config>("Combat Spirit", "A spirit helps you in combat.", "A spirit aids you in combat for $1 seconds. Returns after a cooldown.");
			API.AddGemEffect<IntenseFire.Config>("Intense Fire", "An affinity for fire.", "You are +$1% fire resistant and have a higher chance to trigger Inferno.");
			API.AddGemEffect<SlipperyWhenWet.Config>("Slippery When Wet", "Water quickens you.", "You are $1% faster when wet.");
			API.AddGemEffect<SlipperyWhenWet.Config>("Waterproof", "You do not get wet.", "You do not get wet.");
			API.AddGemEffect<WeaponMaster.Config>("Weapon Master", "Experianced with weapons.", "Your skill with all weapons is $1% higher.");
			API.AddGemEffect<Spellsword.Config>("Spellsword", "Use eitr to increase weapon damage.", "$1% increase to damage at the cost of 5 eitr per hit.");
		}
	}
	public static class ExpertAcrobat
	{
		[PublicAPI]
		public struct Config
		{
			[InverseMultiplicativePercentagePower]
			public float Power;
		}
	}
	public static class ExpertAxemaster
	{
		[PublicAPI]
		public struct Config
		{
			[InverseMultiplicativePercentagePower]
			public float Power;
		}
	}
	public static class ExpertBrawler
	{
		[PublicAPI]
		public struct Config
		{
			[InverseMultiplicativePercentagePower]
			public float Power;
		}
	}
	public static class ExpertDaggers
	{
		[PublicAPI]
		public struct Config
		{
			[InverseMultiplicativePercentagePower]
			public float Power;
		}
	}
	public static class ExpertHarvester
	{
		[PublicAPI]
		public struct Config
		{
			[InverseMultiplicativePercentagePower]
			public float Power;
		}
	}
	public static class ExpertMage
	{
		[PublicAPI]
		public struct Config
		{
			[InverseMultiplicativePercentagePower]
			public float Power;
		}
	}
	public static class ExpertFisher
	{
		[PublicAPI]
		public struct Config
		{
			[InverseMultiplicativePercentagePower]
			public float Power;
		}
	}
	public static class ExpertPolearms
	{
		[PublicAPI]
		public struct Config
		{
			[InverseMultiplicativePercentagePower]
			public float Power;
		}
	}
	public static class ExpertSmasher
	{
		[PublicAPI]
		public struct Config
		{
			[InverseMultiplicativePercentagePower]
			public float Power;
		}
	}
	public static class ExpertSpearmaiden
	{
		[PublicAPI]
		public struct Config
		{
			[InverseMultiplicativePercentagePower]
			public float Power;
		}
	}
	public static class ExpertSprinter
	{
		[PublicAPI]
		public struct Config
		{
			[InverseMultiplicativePercentagePower]
			public float Power;
		}
	}
	public static class ExpertSwordsman
	{
		[PublicAPI]
		public struct Config
		{
			[InverseMultiplicativePercentagePower]
			public float Power;
		}
	}
	public static class FireResistance
	{
		[PublicAPI]
		public struct Config
		{
			[InverseMultiplicativePercentagePower]
			public float Power;
		}

		[HarmonyPatch(typeof(Character), "RPC_Damage")]
		public static class ReducePierceDamageTaken
		{
			[UsedImplicitly]
			private static void Prefix(Character __instance, HitData hit)
			{
				Player val = (Player)(object)((__instance is Player) ? __instance : null);
				if (val != null)
				{
					Character attacker = hit.GetAttacker();
					if (attacker != null && (Object)(object)attacker != (Object)(object)__instance && hit.m_damage.m_fire > 0f && (val.GetEffectPower<Config>("Fire Resistance").Power > 0f || val.GetEffectPower<Config>("Intense Fire").Power > 0f))
					{
						float num = (100f - (val.GetEffectPower<Config>("Fire Resistance").Power + val.GetEffectPower<Config>("Intense Fire").Power)) / 100f;
						EpicJewels.EJLog.LogDebug((object)$"Fire Resistance is reducing fire damage {1f - num}");
						hit.m_damage.m_fire *= num;
					}
				}
			}
		}
	}
	public static class IncreaseEitr
	{
		[PublicAPI]
		public struct Config
		{
			[AdditivePower]
			public float Power;
		}

		[HarmonyPatch(typeof(Player), "GetTotalFoodValue")]
		public static class IncreaseTotalStamina
		{
			public static void Postfix(Player __instance, ref float eitr)
			{
				eitr += __instance.GetEffectPower<Config>("Increase Eitr").Power;
			}
		}
	}
	public static class IncreaseStamina
	{
		[PublicAPI]
		public struct Config
		{
			[AdditivePower]
			public float Power;
		}

		[HarmonyPatch(typeof(Player), "GetTotalFoodValue")]
		public static class IncreaseTotalStamina
		{
			public static void Postfix(Player __instance, ref float stamina)
			{
				stamina += __instance.GetEffectPower<Config>("Increase Stamina").Power;
			}
		}
	}
	public static class IncreaseStaminaRegen
	{
		[PublicAPI]
		public struct Config
		{
			[InverseMultiplicativePercentagePower]
			public float Power;
		}

		[HarmonyPatch(typeof(SEMan), "ModifyStaminaRegen")]
		public static class IncreasePlayerStaminaRegen
		{
			public static void Postfix(SEMan __instance, ref float staminaMultiplier)
			{
				if (__instance.m_character.IsPlayer() && Player.m_localPlayer.GetEffectPower<Config>("Increase Stamina Regen").Power > 0f)
				{
					float num = (Player.m_localPlayer.GetEffectPower<Config>("Increase Stamina Regen").Power + 100f) / 100f;
					staminaMultiplier *= num;
				}
			}
		}
	}
	public static class IntenseFire
	{
		[PublicAPI]
		public struct Config
		{
			[AdditivePower]
			public float Power;
		}
	}
	public static class LightningResistance
	{
		[PublicAPI]
		public struct Config
		{
			[InverseMultiplicativePercentagePower]
			public float Power;
		}

		[HarmonyPatch(typeof(Character), "RPC_Damage")]
		public static class ReducePierceDamageTaken
		{
			[UsedImplicitly]
			private static void Prefix(Character __instance, HitData hit)
			{
				Player val = (Player)(object)((__instance is Player) ? __instance : null);
				if (val != null)
				{
					Character attacker = hit.GetAttacker();
					if (attacker != null && (Object)(object)attacker != (Object)(object)__instance && hit.m_damage.m_lightning > 0f && val.GetEffectPower<Config>("Lightning Resistance").Power > 0f)
					{
						float num = (100f - val.GetEffectPower<Config>("Lightning Resistance").Power) / 100f;
						EpicJewels.EJLog.LogDebug((object)$"Lightning Resistance is reducing lightning damage {1f - num}");
						hit.m_damage.m_fire *= num;
					}
				}
			}
		}
	}
	public static class PierceResistance
	{
		[PublicAPI]
		public struct Config
		{
			[InverseMultiplicativePercentagePower]
			public float Power;
		}

		[HarmonyPatch(typeof(Character), "RPC_Damage")]
		public static class ReducePierceDamageTaken
		{
			[UsedImplicitly]
			private static void Prefix(Character __instance, HitData hit)
			{
				Player val = (Player)(object)((__instance is Player) ? __instance : null);
				if (val != null)
				{
					Character attacker = hit.GetAttacker();
					if (attacker != null && (Object)(object)attacker != (Object)(object)__instance && hit.m_damage.m_pierce > 0f && val.GetEffectPower<Config>("Pierce Resistance").Power > 0f)
					{
						float num = (100f - val.GetEffectPower<Config>("Pierce Resistance").Power) / 100f;
						EpicJewels.EJLog.LogDebug((object)$"Pierce Resistance is reducing Pierce damage {1f - num}");
						hit.m_damage.m_pierce *= num;
					}
				}
			}
		}
	}
	public static class PoisonResistance
	{
		[PublicAPI]
		public struct Config
		{
			[InverseMultiplicativePercentagePower]
			public float Power;
		}

		[HarmonyPatch(typeof(Character), "RPC_Damage")]
		public static class ReducePoisonDamageTaken
		{
			[UsedImplicitly]
			private static void Prefix(Character __instance, HitData hit)
			{
				Player val = (Player)(object)((__instance is Player) ? __instance : null);
				if (val != null)
				{
					Character attacker = hit.GetAttacker();
					if (attacker != null && (Object)(object)attacker != (Object)(object)__instance && hit.m_damage.m_poison > 0f && val.GetEffectPower<Config>("Poison Resistance").Power > 0f)
					{
						float num = (100f - val.GetEffectPower<Config>("Poison Resistance").Power) / 100f;
						EpicJewels.EJLog.LogDebug((object)$"Poison Resistance is reducing poison damage {1f - num}");
						hit.m_damage.m_poison *= num;
					}
				}
			}
		}
	}
	public static class PracticedGemcutter
	{
		[PublicAPI]
		public struct Config
		{
			[InverseMultiplicativePercentagePower]
			public float Power;
		}

		[UsedImplicitly]
		private static void Postfix(Skills __instance, SkillType skillType, ref float __result)
		{
			if (!(((object)(SkillType)(ref skillType)).ToString() != "gemcutting") && !((Object)(object)Player.m_localPlayer == (Object)null))
			{
				__result += Mathf.RoundToInt(Player.m_localPlayer.GetEffectPower<Config>("PracticedGemcutter").Power);
			}
		}
	}
	public static class ReduceWeight
	{
		[PublicAPI]
		public struct Config
		{
			[InverseMultiplicativePercentagePower]
			public float Power;
		}

		[HarmonyPatch(typeof(ItemData), "GetWeight")]
		public static class ReduceWeight_ItemData_GetWeight_Patch
		{
			public static void Postfix(ref float __result)
			{
				if (!((Object)(object)Player.m_localPlayer == (Object)null) && Player.m_localPlayer.GetEffectPower<Config>("Reduce Weight").Power > 0f)
				{
					float num = 100f / (Player.m_localPlayer.GetEffectPower<Config>("Reduce Weight").Power + 100f);
					__result *= num;
				}
			}
		}

		[HarmonyPatch(typeof(ItemData), "GetNonStackedWeight")]
		public static class ReduceWeight_ItemData_GetNonstackedWeight_Patch
		{
			public static void Postfix(ref float __result)
			{
				if (!((Object)(object)Player.m_localPlayer == (Object)null) && Player.m_localPlayer.GetEffectPower<Config>("Reduce Weight").Power > 0f)
				{
					float num = 100f / (Player.m_localPlayer.GetEffectPower<Config>("Reduce Weight").Power + 100f);
					__result *= num;
				}
			}
		}

		[HarmonyPatch(typeof(Inventory), "GetTotalWeight")]
		public static class ReduceWeight_Player_Weight
		{
			public static void Postfix(ref float __result)
			{
				if (!((Object)(object)Player.m_localPlayer == (Object)null) && Player.m_localPlayer.GetEffectPower<Config>("Reduce Weight").Power > 0f)
				{
					float num = 100f / (Player.m_localPlayer.GetEffectPower<Config>("Reduce Weight").Power + 100f);
					__result *= num;
				}
			}
		}
	}
	public static class Retribution
	{
		[PublicAPI]
		public struct Config
		{
			[AdditivePower]
			public float Power;

			[InverseMultiplicativePercentagePower]
			public float Chance;
		}

		[HarmonyPatch(typeof(Humanoid), "BlockAttack")]
		private static class Retribution_Patch
		{
			private static void Postfix(Humanoid __instance, HitData hit, Character attacker, ref bool __result)
			{
				//IL_0073: Unknown result type (might be due to invalid IL or missing references)
				//IL_0079: Expected O, but got Unknown
				Player val = (Player)(object)((__instance is Player) ? __instance : null);
				if (val != null && val.GetEffectPower<Config>("Retribution").Power > 0f && __result)
				{
					float value = Random.value;
					float num = Player.m_localPlayer.GetEffectPower<Config>("Retribution").Chance / 100f;
					EpicJewels.EJLog.LogDebug((object)$"Retribution chance roll: {value} < {num}");
					if (value < num)
					{
						HitData val2 = new HitData();
						float totalDamage = hit.GetTotalDamage();
						val2.m_damage.m_damage = totalDamage * (val.GetEffectPower<Config>("Retribution").Power / 100f);
						EpicJewels.EJLog.LogDebug((object)$"Hit dmg {totalDamage} Retribution returning damage {val2.m_damage.m_damage}");
						attacker.Damage(val2);
					}
				}
			}
		}
	}
	public static class SlashResistance
	{
		[PublicAPI]
		public struct Config
		{
			[InverseMultiplicativePercentagePower]
			public float Power;
		}

		[HarmonyPatch(typeof(Character), "RPC_Damage")]
		public static class ReduceSlashDamageTaken
		{
			[UsedImplicitly]
			private static void Prefix(Character __instance, HitData hit)
			{
				Player val = (Player)(object)((__instance is Player) ? __instance : null);
				if (val != null)
				{
					Character attacker = hit.GetAttacker();
					if (attacker != null && (Object)(object)attacker != (Object)(object)__instance && hit.m_damage.m_slash > 0f && val.GetEffectPower<Config>("Slash Resistance").Power > 0f)
					{
						float num = (100f - val.GetEffectPower<Config>("Slash Resistance").Power) / 100f;
						EpicJewels.EJLog.LogDebug((object)$"Slash Resistance is reducing Slash damage {1f - num}");
						hit.m_damage.m_slash *= num;
					}
				}
			}
		}
	}
	public static class SlipperyWhenWet
	{
		[PublicAPI]
		public struct Config
		{
			[AdditivePower]
			public float Power;
		}
	}
	public static class Spellsword
	{
		[PublicAPI]
		public struct Config
		{
			[AdditivePower]
			public float Power;
		}
	}
	public static class StaggeringBlock
	{
		[PublicAPI]
		public struct Config
		{
			[AdditivePower]
			public float Power;
		}

		[HarmonyPatch(typeof(Humanoid), "BlockAttack")]
		private static class StaggeringBlock_Patch
		{
			private static void Postfix(Humanoid __instance, HitData hit, Character attacker, ref bool __result)
			{
				//IL_008b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0090: Unknown result type (might be due to invalid IL or missing references)
				Player val = (Player)(object)((__instance is Player) ? __instance : null);
				if (val != null && val.GetEffectPower<Config>("Staggering Block").Power > 0f && __result && !attacker.IsDead())
				{
					float value = Random.value;
					float num = Player.m_localPlayer.GetEffectPower<Config>("Staggering Block").Power / 100f;
					EpicJewels.EJLog.LogDebug((object)$"Staggering block chance roll: {value} < {num}");
					if (value < num)
					{
						EpicJewels.EJLog.LogDebug((object)"Staggering attacker");
						attacker.AddStaggerDamage(999f, -hit.m_dir);
					}
				}
			}
		}
	}
	public static class Farmer
	{
		[PublicAPI]
		public struct Config
		{
			[AdditivePower]
			public float Power;

			[AdditivePower]
			public float Chance;
		}

		[HarmonyPatch(typeof(Pickable), "Interact")]
		public static class IncreaseCarryWeight
		{
			public static void Postfix(ref bool __result, Humanoid character, Pickable __instance)
			{
				if (!__result || !((Object)(object)character != (Object)null) || !(character is Player) || !(Player.m_localPlayer.GetEffectPower<Config>("Farmer").Power > 0f))
				{
					return;
				}
				string text = ((Object)__instance.m_itemPrefab).name.Replace("(Clone)", "").Replace("Pickable_", "");
				if (UnallowedGreenThumbPickables.Contains(text))
				{
					EpicJewels.EJLog.LogDebug((object)("Pickable type (" + text + ") is not allowed for farmer perk."));
					return;
				}
				float value = Random.value;
				float num = Player.m_localPlayer.GetEffectPower<Config>("Farmer").Chance / 100f;
				EpicJewels.EJLog.LogDebug((object)$"Farmer chance roll: {value} < {num}");
				if (value < num)
				{
					int num2 = 0;
					for (int i = 0; (float)i < Player.m_localPlayer.GetEffectPower<Config>("Farmer").Power; i++)
					{
						__instance.Drop(__instance.m_itemPrefab, num2++, 1);
					}
				}
			}
		}

		[HarmonyPatch(typeof(Player), "Update")]
		public static class AutoPickupNearby_Pickables
		{
			private static readonly int pickableMask = LayerMask.GetMask(new string[3] { "piece_nonsolid", "item", "Default_small" });

			private static float fdt = Time.fixedDeltaTime;

			private static float last_update = 0f;

			private static float current_tick_time = 0f;

			public static void Postfix(Player __instance)
			{
				//IL_0073: Unknown result type (might be due to invalid IL or missing references)
				if (!((Object)(object)Player.m_localPlayer != (Object)null) || !((Object)(object)__instance == (Object)(object)Player.m_localPlayer) || !(Player.m_localPlayer.GetEffectPower<Config>("Farmer").Power > 0f))
				{
					return;
				}
				current_tick_time += fdt;
				if (!(current_tick_time > last_update + 1f))
				{
					return;
				}
				last_update = current_tick_time;
				Collider[] array = Physics.OverlapSphere(((Component)__instance).transform.position, 3f, pickableMask);
				foreach (Collider val in array)
				{
					object obj = ((Component)val).GetComponent<Pickable>();
					if (obj == null)
					{
						Transform parent = ((Component)val).transform.parent;
						obj = ((parent != null) ? ((Component)parent).GetComponent<Pickable>() : null);
					}
					Pickable val2 = (Pickable)obj;
					if ((Object)(object)val2 != (Object)null)
					{
						string text = ((Object)val2).name.Replace("(Clone)", "").Replace("Pickable_", "");
						if (!UnallowedGreenThumbPickables.Contains(text) && val2.CanBePicked())
						{
							EpicJewels.EJLog.LogDebug((object)("Autopicking: " + text));
							val2.Interact((Humanoid)(object)Player.m_localPlayer, false, false);
						}
					}
				}
			}
		}

		private static List<string> UnallowedGreenThumbPickables = new List<string> { "SurtlingCore", "Flint", "Wood", "Stone", "Amber", "AmberPearl", "Coins", "Ruby" };
	}
	public static class WaterFrenzy
	{
		[PublicAPI]
		public struct Config
		{
			[AdditivePower]
			public float Power;
		}

		[HarmonyPatch(typeof(Character), "Damage")]
		private class AddBonusSlashDamage
		{
			private static void Prefix(HitData hit)
			{
				if (hit.GetAttacker() is Player)
				{
					bool flag = ((Character)Player.m_localPlayer).GetSEMan().HaveStatusEffect(wetstatus);
					EpicJewels.EJLog.LogDebug((object)$"Frenzy checking for wet viking {flag}");
					if (flag)
					{
						float num = (Player.m_localPlayer.GetEffectPower<Config>("Water Frenzy").Power + 100f) / 100f;
						EpicJewels.EJLog.LogDebug((object)$"WetDogViking Damage multiplier {num}");
						hit.m_damage.m_blunt *= num;
						hit.m_damage.m_pierce *= num;
						hit.m_damage.m_pierce *= num;
						hit.m_damage.m_fire *= num;
						hit.m_damage.m_lightning *= num;
						hit.m_damage.m_frost *= num;
						hit.m_damage.m_spirit *= num;
						hit.m_damage.m_poison *= num;
						hit.m_damage.m_pickaxe *= num;
					}
				}
			}
		}

		private static int wetstatus = StringExtensionMethods.GetStableHashCode("Wet");
	}
	public static class Waterproof
	{
		[PublicAPI]
		public struct Config
		{
			[AdditivePower]
			public float Power;
		}
	}
	internal class WaterResistant
	{
		[PublicAPI]
		public struct Config
		{
			[InverseMultiplicativePercentagePower]
			public float Power;
		}

		[HarmonyPatch(typeof(SEMan), "AddStatusEffect", new Type[]
		{
			typeof(int),
			typeof(bool),
			typeof(int),
			typeof(float)
		})]
		public static class Waterproof_SEMan_AddStatusEffect_Patch
		{
			public static bool Prefix(SEMan __instance, int nameHash)
			{
				if (__instance.m_character.IsPlayer() && nameHash == wet_hash)
				{
					if (Player.m_localPlayer.GetEffectPower<Waterproof.Config>("Waterproof").Power > 0f)
					{
						return false;
					}
					if (Player.m_localPlayer.GetEffectPower<Config>("Water Resistant").Power > 0f)
					{
						if (delayWetTill == 0f)
						{
							delayWetTill = Time.time + Player.m_localPlayer.GetEffectPower<Config>("Water Resistant").Power;
							EpicJewels.EJLog.LogDebug((object)$"Set water resistance timeout: {delayWetTill}");
							return false;
						}
						if (delayWetTill < Time.time)
						{
							EpicJewels.EJLog.LogDebug((object)"Water resistance is expired.");
							if (delayWetTill + 2f < Time.time)
							{
								EpicJewels.EJLog.LogDebug((object)"Reset water resistance.");
								delayWetTill = 0f;
								return false;
							}
							delayWetTill = 0f;
							return true;
						}
						return false;
					}
				}
				return true;
			}
		}

		private static float delayWetTill = 0f;

		private static int wet_hash = "Wet".GetHashCode();
	}
	public static class WaterSwiftness
	{
		[PublicAPI]
		public struct Config
		{
			[InverseMultiplicativePercentagePower]
			public float Power;
		}

		[HarmonyPatch(typeof(Player), "GetJogSpeedFactor")]
		private class IncreaseJogSpeed
		{
			private static void Postfix(Player __instance, ref float __result)
			{
				if (((Character)__instance).GetSEMan().HaveStatusEffect(wetstatus) || (__instance.GetEffectPower<Waterproof.Config>("Waterproof").Power > 0f && (__instance.GetEffectPower<Config>("Water Swiftness").Power > 0f || __instance.GetEffectPower<Config>("Slippery When Wet").Power > 0f)))
				{
					float num = (__instance.GetEffectPower<Config>("Water Swiftness").Power + __instance.GetEffectPower<Config>("Slippery When Wet").Power + 100f) / 100f;
					__result *= num;
				}
			}
		}

		[HarmonyPatch(typeof(Player), "GetRunSpeedFactor")]
		private class IncreaseRunSpeed
		{
			private static void Postfix(Player __instance, ref float __result)
			{
				if (((Character)__instance).GetSEMan().HaveStatusEffect(wetstatus) || (__instance.GetEffectPower<Waterproof.Config>("Waterproof").Power > 0f && (__instance.GetEffectPower<Config>("Water Swiftness").Power > 0f || __instance.GetEffectPower<Config>("Slippery When Wet").Power > 0f)))
				{
					float num = (__instance.GetEffectPower<Config>("Water Swiftness").Power + __instance.GetEffectPower<Config>("Slippery When Wet").Power + 100f) / 100f;
					__result *= num;
				}
			}
		}

		private static int wetstatus = StringExtensionMethods.GetStableHashCode("Wet");
	}
	public static class WeaponMaster
	{
		[PublicAPI]
		public struct Config
		{
			[AdditivePower]
			public float Power;
		}
	}
	public static class WeaponReducedStamina
	{
		[PublicAPI]
		public struct Config
		{
			[InverseMultiplicativePercentagePower]
			public float Power;
		}

		[HarmonyPatch(typeof(Attack), "GetAttackStamina")]
		public class ReduceStaminaCostForAttack
		{
			public static void Postfix(Attack __instance, ref float __result)
			{
				Humanoid character = __instance.m_character;
				Player val = (Player)(object)((character is Player) ? character : null);
				if (val != null && Player.m_localPlayer.GetEffectPower<Config>("Weapon Reduced Stamina").Power > 0f)
				{
					float num = 100f / (val.GetEffectPower<Config>("Weapon Reduced Stamina").Power + 100f);
					EpicJewels.EJLog.LogDebug((object)$"Stamina Reduction multipler: {num}");
					__result *= num;
				}
			}
		}
	}
	public static class WetWorker
	{
		[PublicAPI]
		public struct Config
		{
			[AdditivePower]
			public float Power;
		}

		[HarmonyPatch(typeof(Attack), "GetAttackStamina")]
		public class ReduceStaminaCostWet_Patch
		{
			public static void Postfix(Attack __instance, ref float __result)
			{
				Humanoid character = __instance.m_character;
				Player val = (Player)(object)((character is Player) ? character : null);
				if (val != null && Player.m_localPlayer.GetEffectPower<Config>("Wet Worker").Power > 0f && ((Character)Player.m_localPlayer).GetSEMan().HaveStatusEffect(wetstatus))
				{
					float num = 100f / (val.GetEffectPower<Config>("Wet Worker").Power + 100f);
					EpicJewels.EJLog.LogDebug((object)$"Wet Worker Stamina Reduction multipler: {num}");
					__result *= num;
				}
			}
		}

		private static int wetstatus = StringExtensionMethods.GetStableHashCode("Wet");
	}
}
namespace EpicJewels.EffectHelpers
{
	public static class AddDamageHarvestables
	{
		[HarmonyPatch(typeof(MineRock), "RPC_Hit")]
		private static class DamageRock
		{
			private static void Prefix(HitData hit)
			{
				ModifyHarvestDamage(hit);
			}
		}

		[HarmonyPatch(typeof(MineRock5), "RPC_Damage")]
		private static class DamageRock5
		{
			private static void Prefix(HitData hit)
			{
				ModifyHarvestDamage(hit);
			}
		}

		[HarmonyPatch(typeof(TreeBase), "RPC_Damage")]
		private static class DamageTreebase
		{
			private static void Prefix(HitData hit)
			{
				ModifyHarvestDamage(hit);
			}
		}

		[HarmonyPatch(typeof(TreeLog), "RPC_Damage")]
		private static class DamageTreeLog
		{
			private static void Prefix(HitData hit)
			{
				ModifyHarvestDamage(hit);
			}
		}

		[HarmonyPatch(typeof(Destructible), "RPC_Damage")]
		private static class DamageDestructible
		{
			private static void Prefix(HitData hit)
			{
				ModifyHarvestDamage(hit);
			}
		}

		private static HitData ModifyHarvestDamage(HitData hit)
		{
			if (hit.GetAttacker() is Player)
			{
				float totalDamage = ((DamageTypes)(ref hit.m_damage)).GetTotalDamage();
				float num = totalDamage * (Player.m_localPlayer.GetEffectPower<AddPickaxeDamage.Config>("Add Pickaxe Damage").Power / 100f);
				float num2 = totalDamage * (Player.m_localPlayer.GetEffectPower<AddChopDamage.Config>("Add Chop Damage").Power / 100f);
				if (Player.m_localPlayer.GetEffectPower<EitrFused.Config>("Eitr Fused").Power > 0f || Player.m_localPlayer.GetEffectPower<Spellsword.Config>("Spellsword").Power > 0f)
				{
					float num3 = Player.m_localPlayer.GetEffectPower<EitrFused.Config>("Eitr Fused").Cost;
					if (Player.m_localPlayer.GetEffectPower<Spellsword.Config>("Spellsword").Power > 0f)
					{
						num3 += 5f;
					}
					if (((Character)Player.m_localPlayer).HaveEitr(num3))
					{
						float num4 = (Player.m_localPlayer.GetEffectPower<EitrFused.Config>("Eitr Fused").Power + Player.m_localPlayer.GetEffectPower<Spellsword.Config>("Spellsword").Power) / 100f;
						EpicJewels.EJLog.LogDebug((object)$"Eitr powered attack powered up multiplier {num4} cost {num3}");
						num2 += hit.m_damage.m_chop * num4;
						num += hit.m_damage.m_pickaxe * num4;
						((Character)Player.m_localPlayer).UseEitr(num3);
					}
					else
					{
						EpicJewels.EJLog.LogDebug((object)$"Eitr powered attack not triggered due to cost {num3}");
					}
				}
				float num5 = num2 + num;
				EpicJewels.EJLog.LogDebug((object)$"Added Damage {num5} = pickaxe: {num} chop: {num2} original_total_dmg {totalDamage}");
				hit.m_damage.m_chop += num2;
				hit.m_damage.m_pickaxe += num;
			}
			return hit;
		}
	}
	[HarmonyPatch(typeof(Character), "Damage")]
	public static class IncreaseDamageByPowers
	{
		private static void Prefix(HitData hit)
		{
			if (!(hit.GetAttacker() is Player))
			{
				return;
			}
			float totalDamage = ((DamageTypes)(ref hit.m_damage)).GetTotalDamage();
			float num = totalDamage * (Player.m_localPlayer.GetEffectPower<AddBluntDamage.Config>("Add Blunt Damage").Power / 100f);
			float num2 = totalDamage * (Player.m_localPlayer.GetEffectPower<AddSlashDamage.Config>("Add Slash Damage").Power / 100f);
			float num3 = totalDamage * (Player.m_localPlayer.GetEffectPower<AddPierceDamage.Config>("Add Pierce Damage").Power / 100f);
			float num4 = totalDamage * (Player.m_localPlayer.GetEffectPower<AddLightningDamage.Config>("Add Lightning Damage").Power / 100f);
			float num5 = totalDamage * (Player.m_localPlayer.GetEffectPower<AddSpiritDamage.Config>("Add Spirit Damage").Power / 100f);
			float num6 = totalDamage * (Player.m_localPlayer.GetEffectPower<AddPickaxeDamage.Config>("Add Pickaxe Damage").Power / 100f);
			float num7 = totalDamage * (Player.m_localPlayer.GetEffectPower<AddChopDamage.Config>("Add Chop Damage").Power / 100f);
			if (Player.m_localPlayer.GetEffectPower<EitrFused.Config>("Eitr Fused").Power > 0f || Player.m_localPlayer.GetEffectPower<Spellsword.Config>("Spellsword").Power > 0f)
			{
				float num8 = Player.m_localPlayer.GetEffectPower<EitrFused.Config>("Eitr Fused").Cost;
				if (Player.m_localPlayer.GetEffectPower<Spellsword.Config>("Spellsword").Power > 0f)
				{
					num8 += 5f;
				}
				if (((Character)Player.m_localPlayer).HaveEitr(num8))
				{
					float num9 = (Player.m_localPlayer.GetEffectPower<EitrFused.Config>("Eitr Fused").Power + Player.m_localPlayer.GetEffectPower<Spellsword.Config>("Spellsword").Power) / 100f + 1f;
					EpicJewels.EJLog.LogDebug((object)$"Eitr powered attack powered up multiplier {num9} cost {num8}");
					num7 += hit.m_damage.m_chop * num9;
					num6 += hit.m_damage.m_pickaxe * num9;
					num5 += hit.m_damage.m_spirit * num9;
					num4 += hit.m_damage.m_lightning * num9;
					num3 += hit.m_damage.m_pierce * num9;
					num2 += hit.m_damage.m_slash * num9;
					num += hit.m_damage.m_blunt * num9;
					((Character)Player.m_localPlayer).UseEitr(num8);
				}
				else
				{
					EpicJewels.EJLog.LogDebug((object)$"Eitr powered attack not triggered due to cost {num8}");
				}
			}
			float num10 = num + num2 + num3 + num4 + num5 + num6 + num7;
			float num11 = Player.m_localPlayer.GetEffectPower<Inferno.Config>("Inferno").Chance;
			if (Player.m_localPlayer.GetEffectPower<IntenseFire.Config>("Intense Fire").Power > 0f)
			{
				num11 *= 1.5f;
			}
			num11 /= 100f;
			float value = Random.value;
			EpicJewels.EJLog.LogDebug((object)$"Inferno activation chance: {value} < {num11}");
			if (Player.m_localPlayer.GetEffectPower<Inferno.Config>("Inferno").Power > 0f && value < num11)
			{
				float num12 = totalDamage * (Player.m_localPlayer.GetEffectPower<Inferno.Config>("Inferno").Power / 100f);
				hit.m_damage.m_fire += num12;
				EpicJewels.EJLog.LogDebug((object)$"Inferno activated, added fire damage: {num12}");
			}
			EpicJewels.EJLog.LogDebug((object)$"Added Damage {num10} = blunt:{num} slash:{num2} pierce:{num3} lightning: {num4} spirit: {num5} pickaxe: {num6} original_total_dmg {totalDamage}");
			hit.m_damage.m_blunt += num;
			hit.m_damage.m_pierce += num3;
			hit.m_damage.m_slash += num2;
			hit.m_damage.m_lightning += num4;
			hit.m_damage.m_spirit += num5;
			hit.m_damage.m_chop += num7;
			hit.m_damage.m_pickaxe += num6;
		}
	}
	[HarmonyPatch(typeof(DamageTypes), "GetTooltipString", new Type[] { typeof(SkillType) })]
	public static class ItemDisplay
	{
		private class DmgModDetails
		{
			public string localizedName { get; set; }

			public bool added { get; set; }

			public float power { get; set; }
		}

		private static void Postfix(DamageTypes __instance, SkillType skillType, ref string __result)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_0268: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)Player.m_localPlayer == (Object)null)
			{
				return;
			}
			float min = default(float);
			float max = default(float);
			((Character)Player.m_localPlayer).GetSkills().GetRandomSkillRange(ref min, ref max, skillType);
			float totalDamage = ((DamageTypes)(ref __instance)).GetTotalDamage();
			Dictionary<string, DmgModDetails> dictionary = DetermineCharacterDamageModifiers();
			List<string> list = __result.Split(new char[1] { '\n' }).ToList();
			List<string> list2 = new List<string>(list);
			for (int i = 0; i < list.Count; i++)
			{
				if (list[i].Length < 17)
				{
					continue;
				}
				string text = list[i].Split(new char[1] { ':' })[0].Trim();
				EpicJewels.EJLog.LogDebug((object)("ItemDescription " + list[i] + " |" + text + "|"));
				switch (text)
				{
				case "$inventory_blunt":
					if (dictionary.ContainsKey("Add Blunt Damage"))
					{
						dictionary["Add Blunt Damage"].added = true;
						list2[i] = AddModifierExplainer(list[i], totalDamage, __instance.m_blunt, min, max, dictionary["Add Blunt Damage"].power);
					}
					break;
				case "$inventory_slash":
					if (dictionary.ContainsKey("Add Slash Damage"))
					{
						dictionary["Add Slash Damage"].added = true;
						list2[i] = AddModifierExplainer(list[i], totalDamage, __instance.m_slash, min, max, dictionary["Add Slash Damage"].power);
					}
					break;
				case "$inventory_pierce":
					if (dictionary.ContainsKey("Add Pierce Damage"))
					{
						dictionary["Add Pierce Damage"].added = true;
						list2[i] = AddModifierExplainer(list[i], totalDamage, __instance.m_pierce, min, max, dictionary["Add Pierce Damage"].power);
					}
					break;
				case "$inventory_lightning":
					if (dictionary.ContainsKey("Add Lightning Damage"))
					{
						dictionary["Add Lightning Damage"].added = true;
						list2[i] = AddModifierExplainer(list[i], totalDamage, __instance.m_lightning, min, max, dictionary["Add Lightning Damage"].power);
					}
					break;
				case "$inventory_spirit":
					if (dictionary.ContainsKey("Add Spirit Damage"))
					{
						dictionary["Add Spirit Damage"].added = true;
						list2[i] = AddModifierExplainer(list[i], totalDamage, __instance.m_spirit, min, max, dictionary["Add Spirit Damage"].power);
					}
					break;
				}
			}
			foreach (KeyValuePair<string, DmgModDetails> item in dictionary)
			{
				if (!item.Value.added)
				{
					list2.Add(BuildModifierExplainer(item.Value.localizedName, totalDamage, min, max, item.Value.power));
				}
			}
			string text2 = string.Join("\n", list2.ToArray());
			EpicJewels.EJLog.LogDebug((object)("ItemDescription " + text2));
			__result = text2;
		}

		private static Dictionary<string, DmgModDetails> DetermineCharacterDamageModifiers()
		{
			Dictionary<string, DmgModDetails> dictionary = new Dictionary<string, DmgModDetails>();
			if (Player.m_localPlayer.GetEffectPower<AddSpiritDamage.Config>("Add Spirit Damage").Power > 0f)
			{
				dictionary.Add("Add Spirit Damage", new DmgModDetails
				{
					added = false,
					localizedName = "$inventory_spirit",
					power = Player.m_localPlayer.GetEffectPower<AddSpiritDamage.Config>("Add Spirit Damage").Power
				});
			}
			if (Player.m_localPlayer.GetEffectPower<AddLightningDamage.Config>("Add Lightning Damage").Power > 0f)
			{
				dictionary.Add("Add Lightning Damage", new DmgModDetails
				{
					added = false,
					localizedName = "$inventory_lightning",
					power = Player.m_localPlayer.GetEffectPower<AddLightningDamage.Config>("Add Lightning Damage").Power
				});
			}
			if (Player.m_localPlayer.GetEffectPower<AddPierceDamage.Config>("Add Pierce Damage").Power > 0f)
			{
				dictionary.Add("Add Pierce Damage", new DmgModDetails
				{
					added = false,
					localizedName = "$inventory_pierce",
					power = Player.m_localPlayer.GetEffectPower<AddPierceDamage.Config>("Add Pierce Damage").Power
				});
			}
			if (Player.m_localPlayer.GetEffectPower<AddSlashDamage.Config>("Add Slash Damage").Power > 0f)
			{
				dictionary.Add("Add Slash Damage", new DmgModDetails
				{
					added = false,
					localizedName = "$inventory_slash",
					power = Player.m_localPlayer.GetEffectPower<AddSlashDamage.Config>("Add Slash Damage").Power
				});
			}
			if (Player.m_localPlayer.GetEffectPower<AddBluntDamage.Config>("Add Blunt Damage").Power > 0f)
			{
				dictionary.Add("Add Blunt Damage", new DmgModDetails
				{
					added = false,
					localizedName = "$inventory_blunt",
					power = Player.m_localPlayer.GetEffectPower<AddBluntDamage.Config>("Add Blunt Damage").Power
				});
			}
			return dictionary;
		}

		private static string AddModifierExplainer(string current_line, float total_dmg, float m_dmg_value, float min, float max, float bonus_power)
		{
			float num = total_dmg * (bonus_power / 100f);
			string[] array = current_line.Split(new char[1] { ' ' });
			EpicJewels.EJLog.LogDebug((object)("Modifying " + array[1]));
			float num2 = int.Parse(array[1].Replace("<color=orange>", "").Replace("</color>", ""));
			array[1] = "<color=purple>" + (num2 + num).ToString("F1") + "</color>";
			ref string reference = ref array[1];
			reference = reference + " <color=purple>[+" + num.ToString("F1") + "]</color>";
			array[2] = $"<color=purple>({Mathf.RoundToInt((m_dmg_value + num) * min)}-{Mathf.RoundToInt((m_dmg_value + num) * max)})";
			EpicJewels.EJLog.LogDebug((object)("Result " + array[1]));
			return string.Join(" ", array);
		}

		private static string BuildModifierExplainer(string dmg_localization, float total_dmg, float min, float max, float bonus_power)
		{
			float num = total_dmg * (bonus_power / 100f);
			return string.Format("{0}: <color=purple>{1}</color> <color=purple>({2}-{3})</color>", dmg_localization, num.ToString("F1"), Mathf.RoundToInt(num * min), Mathf.RoundToInt(num * max));
		}
	}
	[HarmonyPatch(typeof(Skills), "GetSkillFactor")]
	public static class IncreaseSkillPatch
	{
		[HarmonyPatch(typeof(SkillsDialog), "Setup")]
		public static class DisplayExtraSkillLevels_SkillsDialog_Setup_Patch
		{
			[UsedImplicitly]
			private static void Postfix(SkillsDialog __instance, Player player)
			{
				//IL_0065: Unknown result type (might be due to invalid IL or missing references)
				//IL_007e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0131: Unknown result type (might be due to invalid IL or missing references)
				//IL_013b: Unknown result type (might be due to invalid IL or missing references)
				//IL_014c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0177: Unknown result type (might be due to invalid IL or missing references)
				List<Skill> skillList = player.m_skills.GetSkillList();
				new List<GameObject>();
				foreach (GameObject element in __instance.m_elements)
				{
					UITooltip tooltipComponent = element.GetComponentInChildren<UITooltip>();
					Skill val = skillList.Find((Skill s) => s.m_info.m_description == tooltipComponent.m_text);
					if (val == null)
					{
						continue;
					}
					float level = player.m_skills.GetSkill(val.m_info.m_skill).m_level;
					float num = DetermineSkillIncrease(player, val.m_info.m_skill, level);
					if (num > level)
					{
						float num2 = num - level;
						Transform val2 = Utils.FindChild(element.transform, "bar", (IterativeSearchType)0);
						Transform obj = Utils.FindChild(element.transform, "extrabar", (IterativeSearchType)0);
						GameObject val3 = ((obj != null) ? ((Component)obj).gameObject : null);
						if ((Object)(object)val3 == (Object)null)
						{
							val3 = Object.Instantiate<GameObject>(((Component)val2).gameObject, val2.parent);
							val3.transform.SetSiblingIndex(val2.GetSiblingIndex());
							((Object)val3).name = "extrabar";
						}
						val3.SetActive(true);
						RectTransform component = val3.GetComponent<RectTransform>();
						component.sizeDelta = new Vector2((val.m_level + num2) * 1.6f, component.sizeDelta.y);
						((Graphic)val3.GetComponent<Image>()).color = Color.magenta;
						TMP_Text component2 = ((Component)Utils.FindChild(element.transform, "leveltext", (IterativeSearchType)0)).GetComponent<TMP_Text>();
						component2.text += $"  <color=#{ColorUtility.ToHtmlStringRGBA(Color.magenta)}>+{num2:#0.0}</color>";
					}
					else
					{
						Transform val4 = Utils.FindChild(element.transform, "extrabar", (IterativeSearchType)0);
						if ((Object)(object)val4 != (Object)null)
						{
							((Component)val4).gameObject.SetActive(false);
						}
					}
				}
			}
		}

		[UsedImplicitly]
		private static void Postfix(Skills __instance, SkillType skillType, ref float __result)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			__result = DetermineSkillIncrease(__instance.m_player, skillType, __result);
		}

		private static float DetermineSkillIncrease(Player player, SkillType selectedSkill, float current_skill_level)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected I4, but got Unknown
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Expected I4, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Invalid comparison between Unknown and I4
			float num = 0f;
			switch ((int)selectedSkill)
			{
			default:
				switch (selectedSkill - 100)
				{
				default:
					if ((int)selectedSkill == 999)
					{
						float power = player.GetEffectPower<WeaponMaster.Config>("Weapon Master").Power;
						num += player.GetEffectPower<ExpertHarvester.Config>("Expert Harvester").Power;
						num += player.GetEffectPower<ExpertHarvester.Config>("Expert Harvester").Power;
						num += power + player.GetEffectPower<ExpertSwordsman.Config>("Expert Swordsman").Power;
						num += power + player.GetEffectPower<ExpertSpearmaiden.Config>("Expert Spearmaiden").Power;
						num += power + player.GetEffectPower<ExpertSmasher.Config>("Expert Smasher").Power;
						num += power + player.GetEffectPower<ExpertPolearms.Config>("Expert Polearms").Power;
						num += player.GetEffectPower<ExpertMage.Config>("Expert Mage").Power;
						num += player.GetEffectPower<ExpertMage.Config>("Expert Mage").Power;
						num += player.GetEffectPower<ExpertFisher.Config>("Expert Fisher").Power;
						num += power + player.GetEffectPower<ExpertDaggers.Config>("Expert Daggers").Power;
						num += power + player.GetEffectPower<ExpertBrawler.Config>("Expert Brawler").Power;
						num += power + player.GetEffectPower<ExpertAxemaster.Config>("Expert Axemaster").Power;
						num += player.GetEffectPower<ExpertAcrobat.Config>("Expert Acrobat").Power;
						EpicJewels.EJLog.LogDebug((object)$"All skills increase {num}");
					}
					break;
				case 4:
					if (player.GetEffectPower<ExpertFisher.Config>("Expert Fisher").Power > 0f)
					{
						num += player.GetEffectPower<ExpertFisher.Config>("Expert Fisher").Power;
						EpicJewels.EJLog.LogDebug((object)$"Fishing skill increase {num}");
					}
					break;
				case 0:
					if (player.GetEffectPower<ExpertAcrobat.Config>("Expert Acrobat").Power > 0f)
					{
						num += player.GetEffectPower<ExpertAcrobat.Config>("Expert Acrobat").Power;
						EpicJewels.EJLog.LogDebug((object)$"Jump skill increase {num}");
					}
					break;
				case 2:
					if (player.GetEffectPower<ExpertSprinter.Config>("Expert Sprinter").Power > 0f)
					{
						num += player.GetEffectPower<ExpertSprinter.Config>("Expert Sprinter").Power;
						EpicJewels.EJLog.LogDebug((object)$"Run skill increase {num}");
					}
					break;
				case 1:
				case 3:
				case 5:
				case 6:
				case 7:
				case 8:
				case 9:
				case 10:
					break;
				}
				break;
			case 1:
				if (player.GetEffectPower<ExpertSwordsman.Config>("Expert Swordsman").Power > 0f || player.GetEffectPower<WeaponMaster.Config>("Weapon Master").Power > 0f)
				{
					num += player.GetEffectPower<ExpertSwordsman.Config>("Expert Swordsman").Power;
					num += player.GetEffectPower<WeaponMaster.Config>("Weapon Master").Power;
					EpicJewels.EJLog.LogDebug((object)$"Swords skill increase {num}");
				}
				break;
			case 5:
				if (player.GetEffectPower<ExpertSpearmaiden.Config>("Expert Spearmaiden").Power > 0f || player.GetEffectPower<WeaponMaster.Config>("Weapon Master").Power > 0f)
				{
					num += player.GetEffectPower<ExpertSpearmaiden.Config>("Expert Spearmaiden").Power;
					num += player.GetEffectPower<WeaponMaster.Config>("Weapon Master").Power;
					EpicJewels.EJLog.LogDebug((object)$"Spears skill increase {num}");
				}
				break;
			case 3:
				if (player.GetEffectPower<ExpertSmasher.Config>("Expert Smasher").Power > 0f || player.GetEffectPower<WeaponMaster.Config>("Weapon Master").Power > 0f)
				{
					num += player.GetEffectPower<ExpertSmasher.Config>("Expert Smasher").Power;
					num += player.GetEffectPower<WeaponMaster.Config>("Weapon Master").Power;
					EpicJewels.EJLog.LogDebug((object)$"Clubs skill increase {num}");
				}
				break;
			case 4:
				if (player.GetEffectPower<ExpertPolearms.Config>("Expert Polearms").Power > 0f || player.GetEffectPower<WeaponMaster.Config>("Weapon Master").Power > 0f)
				{
					num += player.GetEffectPower<ExpertPolearms.Config>("Expert Polearms").Power;
					num += player.GetEffectPower<WeaponMaster.Config>("Weapon Master").Power;
					EpicJewels.EJLog.LogDebug((object)$"Polearms skill increase {num}");
				}
				break;
			case 9:
			case 10:
				if (player.GetEffectPower<ExpertMage.Config>("Expert Mage").Power > 0f)
				{
					num += player.GetEffectPower<ExpertMage.Config>("Expert Mage").Power;
					EpicJewels.EJLog.LogDebug((object)$"Magic skill increase {num}");
				}
				break;
			case 2:
				if (player.GetEffectPower<ExpertDaggers.Config>("Expert Daggers").Power > 0f || player.GetEffectPower<WeaponMaster.Config>("Weapon Master").Power > 0f)
				{
					num += player.GetEffectPower<ExpertDaggers.Config>("Expert Daggers").Power;
					num += player.GetEffectPower<WeaponMaster.Config>("Weapon Master").Power;
					EpicJewels.EJLog.LogDebug((object)$"Knives skill increase {num}");
				}
				break;
			case 11:
				if (player.GetEffectPower<ExpertBrawler.Config>("Expert Brawler").Power > 0f || player.GetEffectPower<WeaponMaster.Config>("Weapon Master").Power > 0f)
				{
					num += player.GetEffectPower<ExpertBrawler.Config>("Expert Brawler").Power;
					num += player.GetEffectPower<WeaponMaster.Config>("Weapon Master").Power;
					EpicJewels.EJLog.LogDebug((object)$"Unarmed skill increase {num}");
				}
				break;
			case 7:
				if (player.GetEffectPower<ExpertAxemaster.Config>("Expert Axemaster").Power > 0f || player.GetEffectPower<WeaponMaster.Config>("Weapon Master").Power > 0f)
				{
					num += player.GetEffectPower<ExpertAxemaster.Config>("Expert Axemaster").Power;
					num += player.GetEffectPower<WeaponMaster.Config>("Weapon Master").Power;
					EpicJewels.EJLog.LogDebug((object)$"Axes skill increase {num}");
				}
				break;
			case 12:
			case 13:
				if (player.GetEffectPower<ExpertHarvester.Config>("Expert Harvester").Power > 0f)
				{
					num += player.GetEffectPower<ExpertHarvester.Config>("Expert Harvester").Power;
					EpicJewels.EJLog.LogDebug((object)$"Pickaxe & woodcutting skill increase {num}");
				}
				break;
			case 14:
				if (player.GetEffectPower<WeaponMaster.Config>("Weapon Master").Power > 0f)
				{
					num += player.GetEffectPower<WeaponMaster.Config>("Weapon Master").Power;
					EpicJewels.EJLog.LogDebug((object)$"Crossbow skill increase {num}");
				}
				break;
			case 0:
			case 6:
			case 8:
				break;
			}
			float num2 = (num + 100f) / 100f;
			return current_skill_level * num2;
		}
	}
}
namespace EpicJewels.Common
{
	internal class Config
	{
		public static ConfigFile cfg;

		public static ConfigEntry<bool> EnableDebugMode;

		public Config(ConfigFile cfgref)
		{
			cfg = cfgref;
			cfg.SaveOnConfigSet = true;
			CreateConfigValues(cfgref);
		}

		private void CreateConfigValues(ConfigFile Config)
		{
		}
	}
}
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Jewelcrafting
{
	[PublicAPI]
	internal static class API
	{
		[PublicAPI]
		public class GemInfo
		{
			public readonly string gemPrefab;

			public readonly Sprite gemSprite;

			public readonly Dictionary<string, float> gemEffects;

			public GemInfo(string gemPrefab, Sprite gemSprite, Dictionary<string, float> gemEffects)
			{
				this.gemPrefab = gemPrefab;
				this.gemSprite = gemSprite;
				this.gemEffects = gemEffects;
			}
		}

		public delegate bool GemBreakHandler(ItemData? container, ItemData gem, int count = 1);

		public delegate bool ItemBreakHandler(ItemData? container);

		public delegate bool ItemMirroredHandler(ItemData? item);

		public static event Action? OnEffectRecalc;

		public static bool IsLoaded()
		{
			return false;
		}

		internal static void InvokeEffectRecalc()
		{
			API.OnEffectRecalc?.Invoke();
		}

		public static GameObject CreateNecklaceFromTemplate(string colorName, Color color)
		{
			return null;
		}

		public static GameObject CreateNecklaceFromTemplate(string colorName, Material material)
		{
			return null;
		}

		public static GameObject CreateRingFromTemplate(string colorName, Color color)
		{
			return null;
		}

		public static GameObject CreateRingFromTemplate(string colorName, Material material)
		{
			return null;
		}

		public static void MarkJewelry(GameObject jewelry)
		{
		}

		public static void AddGems(string type, string colorName, Color color)
		{
		}

		public static List<GameObject> AddGems(string type, string colorName, Material material, Color color)
		{
			return null;
		}

		public static GameObject AddDestructibleFromTemplate(string type, string colorName, Color color)
		{
			return null;
		}

		public static GameObject AddDestructibleFromTemplate(string type, string colorName, Material material)
		{
			return null;
		}

		public static GameObject AddUncutFromTemplate(string type, string colorName, Color color)
		{
			return null;
		}

		public static GameObject AddUncutFromTemplate(string type, string colorName, Material material)
		{
			return null;
		}

		public static GameObject AddAndRegisterUncutFromTemplate(string type, string colorName, Color color)
		{
			return null;
		}

		public static GameObject AddAndRegisterUncutFromTemplate(string type, string colorName, Material material)
		{
			return null;
		}

		public static GameObject AddShardFromTemplate(string type, string colorName, Color color)
		{
			return null;
		}

		public static GameObject AddShardFromTemplate(string type, string colorName, Material material)
		{
			return null;
		}

		public static GameObject[] AddTieredGemFromTemplate(string type, string colorName, Color color)
		{
			return null;
		}

		public static GameObject[] AddTieredGemFromTemplate(string type, string colorName, Material material, Color color)
		{
			return null;
		}

		public static void AddGem(GameObject prefab, string colorName)
		{
		}

		public static void AddShard(GameObject prefab, string colorName)
		{
		}

		public static void AddDestructible(GameObject prefab, string colorName)
		{
		}

		public static void AddUncutGem(GameObject prefab, string colorName, ConfigEntry<float>? dropChance = null)
		{
		}

		public static void AddGemEffect<T>(string name, string? englishDescription = null, string? englishDescriptionDetailed = null) where T : struct
		{
		}

		public static void AddGemConfig(string yaml)
		{
		}

		public static T GetEffectPower<T>(this Player player, string name) where T : struct
		{
			return default(T);
		}

		public static List<GemInfo?> GetGems(ItemData item)
		{
			return new List<GemInfo>();
		}

		public static bool SetGems(ItemData item, List<GemInfo?> gems)
		{
			return false;
		}

		public static Sprite GetSocketBorder()
		{
			return null;
		}

		public static GameObject GetGemcuttersTable()
		{
			return null;
		}

		public static void AddParticleEffect(string prefabName, GameObject effect, VisualEffectCondition displayCondition)
		{
		}

		public static void SetSocketsLock(ItemData item, bool enabled)
		{
		}

		public static void OnGemBreak(GemBreakHandler callback)
		{
		}

		public static void OnItemBreak(ItemBreakHandler callback)
		{
		}

		public static void OnItemMirrored(ItemMirroredHandler callback)
		{
		}

		public static bool IsJewelryEquipped(Player player, string prefabName)
		{
			return false;
		}

		public static bool BlacklistItem(GameObject item)
		{
			return false;
		}
	}
	[AttributeUsage(AttributeTargets.Field)]
	internal abstract class PowerAttribute : Attribute
	{
		public abstract float Add(float a, float b);
	}
	internal class AdditivePowerAttribute : PowerAttribute
	{
		public override float Add(float a, float b)
		{
			return a + b;
		}
	}
	internal class MultiplicativePercentagePowerAttribute : PowerAttribute
	{
		public override float Add(float a, float b)
		{
			return ((1f + a / 100f) * (1f + b / 100f) - 1f) * 100f;
		}
	}
	internal class InverseMultiplicativePercentagePowerAttribute : PowerAttribute
	{
		public override float Add(float a, float b)
		{
			return (1f - (1f - a / 100f) * (1f - b / 100f)) * 100f;
		}
	}
	internal class MinPowerAttribute : PowerAttribute
	{
		public override float Add(float a, float b)
		{
			return Mathf.Min(a, b);
		}
	}
	internal class MaxPowerAttribute : PowerAttribute
	{
		public override float Add(float a, float b)
		{
			return Mathf.Max(a, b);
		}
	}
	[AttributeUsage(AttributeTargets.Field)]
	internal class OptionalPowerAttribute : Attribute
	{
		public readonly float DefaultValue;

		public OptionalPowerAttribute(float defaultValue)
		{
			DefaultValue = defaultValue;
		}
	}
	[Flags]
	internal enum VisualEffectCondition : uint
	{
		IsSkill = 0xFFFu,
		Swords = 1u,
		Knives = 2u,
		Clubs = 3u,
		Polearms = 4u,
		Spears = 5u,
		Blocking = 6u,
		Axes = 7u,
		Bows = 8u,
		Unarmed = 0xBu,
		Pickaxes = 0xCu,
		WoodCutting = 0xDu,
		Crossbows = 0xEu,
		IsItem = 0xFF000u,
		Helmet = 0x6000u,
		Chest = 0x7000u,
		Legs = 0xB000u,
		Hands = 0xC000u,
		Shoulder = 0x11000u,
		Tool = 0x13000u,
		GenericExtraAttributes = 0xFF000000u,
		Blackmetal = 0x40000000u,
		TwoHanded = 0x80000000u,
		SpecificExtraAttributes = 0xF00000u,
		Hammer = 0x113000u,
		Hoe = 0x213000u,
		Buckler = 0x100006u,
		Towershield = 0x200006u,
		FineWoodBow = 0x100008u,
		BowHuntsman = 0x200008u,
		BowDraugrFang = 0x300008u,
		PickaxeIron = 0x10000Cu,
		Club = 0x100003u
	}
}
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[<b89b921d-8954-4084-bd4d-1feb826a594e>Embedded]
	internal sealed class <b89b921d-8954-4084-bd4d-1feb826a594e>EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[<b89b921d-8954-4084-bd4d-1feb826a594e>Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class <f6f8ff5f-fa45-43ba-9489-b740a9e7c98b>NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public <f6f8ff5f-fa45-43ba-9489-b740a9e7c98b>NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public <f6f8ff5f-fa45-43ba-9489-b740a9e7c98b>NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[<b89b921d-8954-4084-bd4d-1feb826a594e>Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	[CompilerGenerated]
	internal sealed class <bb5e3e5e-5c47-485a-88ef-ea5afd7f01c7>NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public <bb5e3e5e-5c47-485a-88ef-ea5afd7f01c7>NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace LocalizationManager
{
	[<f6f8ff5f-fa45-43ba-9489-b740a9e7c98b>Nullable(0)]
	[PublicAPI]
	[<bb5e3e5e-5c47-485a-88ef-ea5afd7f01c7>NullableContext(1)]
	internal 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;

		[<f6f8ff5f-fa45-43ba-9489-b740a9e7c98b>Nullable(2)]
		private static BaseUnityPlugin _plugin;

		private static readonly List<string> fileExtensions;

		private static BaseUnityPlugin plugin
		{
			get
			{
				//IL_009b: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a5: 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([<bb5e3e5e-5c47-485a-88ef-ea5afd7f01c7>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, [<bb5e3e5e-5c47-485a-88ef-ea5afd7f01c7>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, [<f6f8ff5f-fa45-43ba-9489-b740a9e7c98b>Nullable(new byte[] { 2, 1, 1 })] Func<T, string> convertConfigValue = null)
		{
			if (convertConfigValue == null)
			{
				convertConfigValue = [<bb5e3e5e-5c47-485a-88ef-ea5afd7f01c7>NullableContext(0)] [return: <f6f8ff5f-fa45-43ba-9489-b740a9e7c98b>Nullable(1)] (T val) => val.ToString();
			}
			if (!PlaceholderProcessors.ContainsKey(key))
			{
				PlaceholderProcessors[key] = new Dictionary<string, Func<string>>();
			}
			config.SettingChanged += [<bb5e3e5e-5c47-485a-88ef-ea5afd7f01c7>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 <c1115aee-2ebb-4910-9809-e81b758f145c>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 <c1115aee-2ebb-4910-9809-e81b758f145c>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_004d: 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_008c: 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" };
			new Harmony("org.bepinex.helpers.LocalizationManager").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: <f6f8ff5f-fa45-43ba-9489-b740a9e7c98b>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;
		}

		[<bb5e3e5e-5c47-485a-88ef-ea5afd7f01c7>NullableContext(2)]
		public static byte[] ReadEmbeddedFileBytes([<f6f8ff5f-fa45-43ba-9489-b740a9e7c98b>Nullable(1)] string resourceFileName, Assembly containingAssembly = null)
		{
			using MemoryStream memoryStream = new MemoryStream();
			if ((object)containingAssembly == null)
			{
				containingAssembly = Assembly.GetCallingAssembly();
			}
			string text = containingAssembly.GetManifestResourceNames().FirstOrDefault([<bb5e3e5e-5c47-485a-88ef-ea5afd7f01c7>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 System.Diagnostics.CodeAnalysis
{
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class <c1115aee-2ebb-4910-9809-e81b758f145c>AllowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class <c1115aee-2ebb-4910-9809-e81b758f145c>DisallowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Method, Inherited = false)]
	internal sealed class <c1115aee-2ebb-4910-9809-e81b758f145c>DoesNotReturnAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class <c1115aee-2ebb-4910-9809-e81b758f145c>DoesNotReturnIfAttribute : Attribute
	{
		public bool ParameterValue { get; }

		public <c1115aee-2ebb-4910-9809-e81b758f145c>DoesNotReturnIfAttribute(bool parameterValue)
		{
			ParameterValue = parameterValue;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class <c1115aee-2ebb-4910-9809-e81b758f145c>MaybeNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class <c1115aee-2ebb-4910-9809-e81b758f145c>MaybeNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public <c1115aee-2ebb-4910-9809-e81b758f145c>MaybeNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class <c1115aee-2ebb-4910-9809-e81b758f145c>NotNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)]
	internal sealed class <c1115aee-2ebb-4910-9809-e81b758f145c>NotNullIfNotNullAttribute : Attribute
	{
		public string ParameterName { get; }

		public <c1115aee-2ebb-4910-9809-e81b758f145c>NotNullIfNotNullAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class <c1115aee-2ebb-4910-9809-e81b758f145c>NotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public <c1115aee-2ebb-4910-9809-e81b758f145c>NotNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
}
namespace System.Collections.Generic
{
	internal static class DeconstructionExtensions
	{
		public static void Deconstruct<TKey, TValue>(this KeyValuePair<TKey, TValue> pair, out TKey key, out TValue value)
		{
			key = pair.Key;
			value = pair.Value;
		}
	}
}
namespace YamlDotNet
{
	internal sealed class <c1115aee-2ebb-4910-9809-e81b758f145c>CultureInfoAdapter : CultureInfo
	{
		private readonly IFormatProvider provider;

		public <c1115aee-2ebb-4910-9809-e81b758f145c>CultureInfoAdapter(CultureInfo baseCulture, IFormatProvider provider)
			: base(baseCulture.LCID)
		{
			this.provider = provider;
		}

		public override object? GetFormat(Type? formatType)
		{
			return provider.GetFormat(formatType);
		}
	}
	internal static class <c1115aee-2ebb-4910-9809-e81b758f145c>ReflectionExtensions
	{
		private static readonly FieldInfo? RemoteStackTraceField = typeof(Exception).GetField("_remoteStackTraceString", BindingFlags.Instance | BindingFlags.NonPublic);

		public static Type? BaseType(this Type type)
		{
			return type.BaseType;
		}

		public static bool IsValueType(this Type type)
		{
			return type.IsValueType;
		}

		public static bool IsGenericType(this Type type)
		{
			return type.IsGenericType;
		}

		public static bool IsGenericTypeDefinition(this Type type)
		{
			return type.IsGenericTypeDefinition;
		}

		public static bool IsInterface(this Type type)
		{
			return type.IsInterface;
		}

		public static bool IsEnum(this Type type)
		{
			return type.IsEnum;
		}

		public static bool IsDbNull(this object value)
		{
			return value is DBNull;
		}

		public static bool HasDefaultConstructor(this Type type)
		{
			if (!type.IsValueType)
			{
				return type.GetConstructor(BindingFlags.Instance | BindingFlags.Public, n