Decompiled source of MoreSkills v0.2.7

MoreSkills.dll

Decompiled 2 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using MoreSkills.Config;
using MoreSkills.UI;
using MoreSkills.Utility;
using Pipakin.FitnessSkillMod.Config;
using Pipakin.SkillInjectorMod;
using TMPro;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("MoreSkills")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MoreSkills")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("10ba59fd-7bfc-46e9-92a3-a7691d15918c")]
[assembly: AssemblyFileVersion("0.2.7")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.2.7.0")]
[module: UnverifiableCode]
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;
		}
	}
}
namespace Pipakin.FitnessSkillMod
{
	public class FitnessConfig
	{
		private GenericConfigVariable<bool> fitnessSkillEnabled;

		private GenericConfigVariable<float> configSkillIncrease;

		private GenericConfigVariable<float> maxStaminaMultiplier;

		private GenericConfigVariable<float> regenStaminaMultiplier;

		private GenericConfigVariable<float> baseStaminaRegen;

		private GenericConfigVariable<float> baseStamina;

		private GenericConfigVariable<float> skillGainIncrement;

		public bool SkillEnabled => fitnessSkillEnabled.Value;

		public float SkillIncrease => configSkillIncrease.Value;

		public float MaxStaminaMultiplier => maxStaminaMultiplier.Value;

		public float RegenStaminaMultiplier => regenStaminaMultiplier.Value;

		public float BaseStaminaRegen => baseStaminaRegen.Value;

		public float BaseStamina => baseStamina.Value;

		public float SkillGainIncrement => skillGainIncrement.Value;

		public void InitConfig(string id, ConfigFile config)
		{
			config.Bind<int>("General", "NexusID", 388, "Nexus mod ID for updates");
			Assembly assembly = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault((Assembly a) => a.GetName().Name == "ModConfigEnforcer");
			if (assembly != null)
			{
				Debug.Log((object)"[FitnessMod] Mod Config Enforcer detected, registering mod...");
				Type type = assembly.GetType("ModConfigEnforcer.ConfigManager");
				Traverse.Create(type).Method("RegisterMod", new object[2] { id, config }).GetValue(new object[2] { id, config });
			}
			else
			{
				Debug.Log((object)"Mod Config Enforcer not detected.");
			}
			fitnessSkillEnabled = new GenericConfigVariable<bool>(assembly, config, id, "FitnessSkillEnabled", defaultValue: true, "Enablers", "Enable or Disable the Fitness Skill", localOnly: true);
			configSkillIncrease = new GenericConfigVariable<float>(assembly, config, id, "LevelingIncrement", 1f, "Progression", "Increment to increase skill per use of a full bar of stamina", localOnly: true);
			baseStamina = new GenericConfigVariable<float>(assembly, config, id, "BaseMaximum", 75f, "Stamina", "Base Max Stamina. The default is 75 which is the same as the umodded game", localOnly: true);
			maxStaminaMultiplier = new GenericConfigVariable<float>(assembly, config, id, "MaxMultiplier", 1.5f, "Stamina", "Maximum stamina multiplier (at level 100). Minimum 1", localOnly: true);
			baseStaminaRegen = new GenericConfigVariable<float>(assembly, config, id, "BaseRegen", 5f, "Stamina", "Base Regen. The default is 5 which is the same as the umodded game", localOnly: true);
			regenStaminaMultiplier = new GenericConfigVariable<float>(assembly, config, id, "RegenMultiplier", 1.5f, "Stamina", "Stamina regen multiplier (at level 100). Minimum 1", localOnly: true);
			skillGainIncrement = new GenericConfigVariable<float>(assembly, config, id, "GainIncrement", 25f, "Stamina", "Amount of stamina used before any skill is gained", localOnly: true);
		}
	}
	[BepInPlugin("com.pipakin.FitnessSkillMod", "FitnessSkillMod", "2.0.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class FitnessSkill : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(Player), "SetMaxStamina")]
		public static class ApplyFitnessEffects
		{
			[HarmonyPrefix]
			public static void Prefix(ref float stamina, Player __instance)
			{
				if (fitnessConfig.SkillEnabled)
				{
					try
					{
						float skillFactor = ((Character)__instance).GetSkillFactor((SkillType)243);
						float num = (float)Math.Ceiling(skillFactor * (fitnessConfig.MaxStaminaMultiplier - 1f) * fitnessConfig.BaseStamina);
						stamina += num + fitnessConfig.BaseStamina - 75f;
					}
					catch (Exception ex)
					{
						Debug.LogError((object)("Error adusting base stamina: " + ex.ToString()));
					}
				}
			}
		}

		[HarmonyPatch]
		public static class ApplyFitnessRegen
		{
			public static MethodBase TargetMethod()
			{
				return AccessTools.DeclaredMethod(typeof(Player), "UpdateStats", new Type[0], (Type[])null);
			}

			[HarmonyPrefix]
			public static void Prefix(Player __instance, ref float ___m_staminaRegen)
			{
				if (fitnessConfig.SkillEnabled)
				{
					try
					{
						float skillFactor = ((Character)__instance).GetSkillFactor((SkillType)243);
						float num = (float)Math.Ceiling((skillFactor * (fitnessConfig.RegenStaminaMultiplier - 1f) + 1f) * fitnessConfig.BaseStaminaRegen);
						___m_staminaRegen = num;
					}
					catch (Exception ex)
					{
						Debug.LogError((object)("Error adusting stamina regen: " + ex.ToString()));
					}
				}
			}
		}

		[HarmonyPatch(typeof(Player), "RPC_UseStamina")]
		public static class IncreaseFitnessSkill
		{
			[HarmonyPrefix]
			public static void Prefix(float v, Player __instance, ZNetView ___m_nview)
			{
				if (!fitnessConfig.SkillEnabled)
				{
					return;
				}
				try
				{
					float @float = ___m_nview.GetZDO().GetFloat("fitness_progress", 0f);
					@float += v;
					if (@float > fitnessConfig.SkillGainIncrement)
					{
						float num = @float / ((Character)__instance).GetMaxStamina();
						((Character)__instance).RaiseSkill((SkillType)243, num * fitnessConfig.SkillIncrease);
						___m_nview.GetZDO().Set("fitness_progress", 0f);
					}
					else
					{
						___m_nview.GetZDO().Set("fitness_progress", @float);
					}
				}
				catch (Exception ex)
				{
					Debug.LogError((object)("Error increasing fitness skill: " + ex.ToString()));
				}
			}
		}

		private const string MOD_ID = "com.pipakin.FitnessSkillMod";

		private readonly Harmony harmony = new Harmony("com.pipakin.FitnessSkillMod");

		private static FitnessConfig fitnessConfig = new FitnessConfig();

		private static Dictionary<string, Texture2D> cachedTextures = new Dictionary<string, Texture2D>();

		public const int SKILL_TYPE = 243;

		private static string iconPath = "Assets.Icons.";

		private static string iconFileName = "fitness.png";

		public static Sprite FitnessIcon;

		public static Sprite Load_FitnessIcon()
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Stream stream = EmbeddedAssets.LoadAssets(iconPath + iconFileName);
				Texture2D val = Helper.LoadPng(stream);
				FitnessIcon = Sprite.Create(val, new Rect(0f, 0f, 32f, 32f), Vector2.zero);
				stream.Dispose();
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("Unable to load skill icon '" + iconFileName + "': " + ex.Message));
			}
			return FitnessIcon;
		}

		private void Awake()
		{
			fitnessConfig.InitConfig("com.pipakin.FitnessSkillMod", ((BaseUnityPlugin)this).Config);
			harmony.PatchAll(typeof(ApplyFitnessEffects));
			harmony.PatchAll(typeof(ApplyFitnessRegen));
			harmony.PatchAll(typeof(IncreaseFitnessSkill));
			if (fitnessConfig.SkillEnabled)
			{
				SkillInjector.RegisterNewSkill(243, "Fitness", "Affects maximum stamina level", 1f, Load_FitnessIcon(), (SkillType)102);
			}
		}
	}
}
namespace Pipakin.FitnessSkillMod.Config
{
	internal class GenericConfigVariable<T>
	{
		private object backingStore;

		public T Value => Traverse.Create(backingStore).Property("Value", (object[])null).GetValue<T>();

		public GenericConfigVariable(Assembly assembly, ConfigFile config, string id, string varName, T defaultValue, string configSection, string configDescription, bool localOnly)
		{
			if (assembly != null)
			{
				MethodInfo methodInfo = assembly.GetType("ModConfigEnforcer.ConfigManager").GetMethods().First((MethodInfo x) => x.Name == "RegisterModConfigVariable" && x.IsGenericMethod)
					.MakeGenericMethod(typeof(T));
				backingStore = methodInfo.Invoke(null, new object[6] { id, varName, defaultValue, configSection, configDescription, localOnly });
			}
			else
			{
				backingStore = config.Bind<T>(configSection, varName, defaultValue, configDescription);
			}
		}
	}
}
namespace MoreSkills.Info
{
	public static class PluginInfo
	{
		public const string Name = "MoreSkills";

		public const string Guid = "com.macharastormwing.moreskills";

		public const string Version = "0.2.7";
	}
}
namespace MoreSkills.Utility
{
	internal class EmbeddedAssets
	{
		public static Stream LoadAssets(string assetPath)
		{
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			string[] manifestResourceNames = executingAssembly.GetManifestResourceNames();
			if (executingAssembly.GetManifestResourceInfo(executingAssembly.GetName().Name + "." + assetPath) != null)
			{
				return executingAssembly.GetManifestResourceStream(executingAssembly.GetName().Name + "." + assetPath);
			}
			return null;
		}
	}
	public static class Helper
	{
		public struct HuntingDrops
		{
			public string CreaturePrefab { get; }

			public int Max { get; }

			public int Min { get; }

			public float Chance { get; }

			public HuntingDrops(string creatureprefab, int max, int min, float chance)
			{
				CreaturePrefab = creatureprefab;
				Max = max;
				Min = min;
				Chance = chance;
			}
		}

		public struct TamingSaves
		{
			public string CreatureZDOID { get; }

			public ZDOID TamerID { get; }

			public float TameTime { get; }

			public float EatTime { get; }

			public float MasterLevel { get; }

			public float TamerLevel { get; }

			public float UnlockLevel { get; }

			public TamingSaves(string creatureZDOID, ZDOID tamerid, float tametime, float eattime, float unlockLevel, float tamerLevel, float masterLevel)
			{
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				//IL_000a: Unknown result type (might be due to invalid IL or missing references)
				CreatureZDOID = creatureZDOID;
				TamerID = tamerid;
				TameTime = tametime;
				EatTime = eattime;
				UnlockLevel = unlockLevel;
				TamerLevel = tamerLevel;
				MasterLevel = masterLevel;
			}
		}

		public struct TamingLevels
		{
			public string CreatureName { get; }

			public float MasterLevel { get; }

			public float TamerLevel { get; }

			public float UnlockLevel { get; }

			public float TameTime { get; }

			public TamingLevels(string creatureName, float masterLevel, float tamerLevel, float unlockLevel, float tametime)
			{
				CreatureName = creatureName;
				MasterLevel = masterLevel;
				TamerLevel = tamerLevel;
				UnlockLevel = unlockLevel;
				TameTime = tametime;
			}
		}

		public struct CreatureTameLevels
		{
			public string CreatureName { get; }

			public float UnlockLevel { get; }

			public float TamerLevel { get; }

			public float MasterLevel { get; }

			public CreatureTameLevels(string creatureNamel, float unlockLevel, float tamerLevel, float masterLevel)
			{
				CreatureName = creatureNamel;
				UnlockLevel = unlockLevel;
				TamerLevel = tamerLevel;
				MasterLevel = masterLevel;
			}
		}

		public struct TamingFix
		{
			public string CreatureZDOID { get; }

			public bool Fixed { get; }

			public TamingFix(string creaturezdoid, bool tfixed)
			{
				CreatureZDOID = creaturezdoid;
				Fixed = tfixed;
			}
		}

		public struct TamingGotFar
		{
			public string CreatureZDOID { get; }

			public bool GotFar { get; }

			public TamingGotFar(string creaturezdoid, bool gotfar)
			{
				CreatureZDOID = creaturezdoid;
				GotFar = gotfar;
			}
		}

		public struct TamingDoubleCheck
		{
			public string CreatureZDOID { get; }

			public int DoubleCheck { get; }

			public TamingDoubleCheck(string creaturezdoid, int doublecheck)
			{
				CreatureZDOID = creaturezdoid;
				DoubleCheck = doublecheck;
			}
		}

		public struct CraftingSaves
		{
			public string ObjNumItem { get; }

			public float ObjNum { get; }

			public float ItemCNum { get; }

			public float ItemUNum { get; }

			public CraftingSaves(string objnumitem, float objnum, float itemcnum, float itemunum)
			{
				ObjNumItem = objnumitem;
				ObjNum = objnum;
				ItemCNum = itemcnum;
				ItemUNum = itemunum;
			}
		}

		public struct FishStats
		{
			public string FishName { get; }

			public float BHookChance { get; }

			public int ItemStackSize { get; }

			public float StaminaUse { get; }

			public FishStats(string fishname, float bhookchance, int itemstacksize, float staminause)
			{
				FishName = fishname;
				BHookChance = bhookchance;
				ItemStackSize = itemstacksize;
				StaminaUse = staminause;
			}
		}

		public struct FishSizes
		{
			public string FishNameZDOID { get; }

			public Vector3 FishSize { get; }

			public float FishHeight { get; }

			public float FishSpeed { get; }

			public FishSizes(string fishnamezdoid, Vector3 fishsize, float fishheight, float fishspeed)
			{
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				//IL_000a: Unknown result type (might be due to invalid IL or missing references)
				FishNameZDOID = fishnamezdoid;
				FishSize = fishsize;
				FishHeight = fishheight;
				FishSpeed = fishspeed;
			}
		}

		public static Texture2D LoadPng(Stream fileStream)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			Texture2D val = null;
			if (fileStream != null)
			{
				using MemoryStream memoryStream = new MemoryStream();
				fileStream.CopyTo(memoryStream);
				val = new Texture2D(2, 2);
				ImageConversion.LoadImage(val, memoryStream.ToArray());
			}
			return val;
		}
	}
	public class MoreSkills_Instances
	{
		[HarmonyPatch(typeof(Vagon), "UpdateMass")]
		public static class SI_Vagon
		{
			public static void Postfix(ref Vagon __instance)
			{
				if ((Object)(object)__instance != (Object)null)
				{
					_cart = __instance;
				}
			}
		}

		[HarmonyPatch]
		public static class SI_Player
		{
			public static MethodBase TargetMethod()
			{
				return AccessTools.DeclaredMethod(typeof(Player), "UpdateStats", new Type[0], (Type[])null);
			}

			public static void Postfix(ref Player __instance)
			{
				if ((Object)(object)__instance != (Object)null)
				{
					_player = __instance;
				}
			}
		}

		[HarmonyPatch(typeof(Inventory), "UpdateTotalWeight")]
		public static class SI_Inventory
		{
			public static void Postfix(ref Inventory __instance)
			{
				if (__instance != null)
				{
					_inventory = __instance;
				}
			}
		}

		[HarmonyPatch(typeof(ItemDrop), "SlowUpdate")]
		public static class SI_ItemDrop
		{
			public static void Postfix(ref ItemDrop __instance)
			{
				if ((Object)(object)__instance != (Object)null)
				{
					_itemDrop = __instance;
				}
			}
		}

		[HarmonyPatch(typeof(ObjectDB), "Awake")]
		public static class SI_ObjectDB
		{
			public static void Postfix(ref ObjectDB __instance)
			{
				if ((Object)(object)__instance != (Object)null)
				{
					_objectDB = __instance;
				}
			}
		}

		[HarmonyPatch(typeof(InventoryGui), "Awake")]
		public static class SI_InventoryGui
		{
			public static void Postfix(ref InventoryGui __instance)
			{
				if ((Object)(object)__instance != (Object)null)
				{
					_inventoryGui = __instance;
				}
			}
		}

		[HarmonyPatch(typeof(ZNetView), "Awake")]
		public static class SI_ZNetView
		{
			public static void Postfix(ref ZNetView __instance)
			{
				if ((Object)(object)__instance != (Object)null)
				{
					_zNetView = __instance;
				}
			}
		}

		[HarmonyPatch(typeof(MineRock5), "Start")]
		public static class SI_MineRock5
		{
			public static void Postfix(ref MineRock5 __instance)
			{
				_mineRock5 = __instance;
			}
		}

		[HarmonyPatch(typeof(Character), "Damage")]
		public static class SI_CDamage
		{
			public static void Postfix(ref Character __instance, HitData hit)
			{
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)_player != (Object)null)
				{
					_CDamage = __instance;
					_CDAttacker = hit.m_attacker;
				}
			}
		}

		[HarmonyPatch(typeof(Destructible), "Damage")]
		public static class Si_DDamage
		{
			public static void Postfix(ref Destructible __instance, HitData hit)
			{
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)_player != (Object)null)
				{
					_DDamage = __instance;
					_DDAttacker = hit.m_attacker;
				}
			}
		}

		[HarmonyPatch(typeof(MineRock5), "Damage")]
		public static class SI_MR5Damage
		{
			public static void Postfix(ref MineRock5 __instance, HitData hit)
			{
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)_player != (Object)null)
				{
					_MR5Damage = __instance;
					_MR5DAttacker = hit.m_attacker;
				}
			}
		}

		[HarmonyPatch(typeof(TreeBase), "Damage")]
		public static class SI_TBDamage
		{
			public static void Postfix(ref TreeBase __instance, HitData hit)
			{
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)_player != (Object)null)
				{
					_TBDamage = __instance;
					_TBDAttacker = hit.m_attacker;
				}
			}
		}

		[HarmonyPatch(typeof(TreeLog), "Damage")]
		public static class SI_TLDamage
		{
			public static void Postfix(ref TreeLog __instance, HitData hit)
			{
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)_player != (Object)null)
				{
					_TLDamage = __instance;
					_TLDAttacker = hit.m_attacker;
				}
			}
		}

		public static Vagon _cart;

		public static Player _player;

		public static Inventory _inventory;

		public static ItemDrop _itemDrop;

		public static ObjectDB _objectDB;

		public static InventoryGui _inventoryGui;

		public static ZNetView _zNetView;

		public static MineRock5 _mineRock5;

		public static Character _CDamage;

		public static ZDOID _CDAttacker;

		public static Destructible _DDamage;

		public static ZDOID _DDAttacker;

		public static MineRock5 _MR5Damage;

		public static ZDOID _MR5DAttacker;

		public static TreeBase _TBDamage;

		public static ZDOID _TBDAttacker;

		public static TreeLog _TLDamage;

		public static ZDOID _TLDAttacker;
	}
	public class Utilities
	{
		internal static void TextAreaDrawer(ConfigEntryBase entry)
		{
			GUILayout.ExpandHeight(true);
			GUILayout.ExpandWidth(true);
			entry.BoxedValue = GUILayout.TextArea((string)entry.BoxedValue, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.ExpandWidth(true),
				GUILayout.ExpandHeight(true)
			});
		}

		public static void Log(string message, [CallerMemberName] string method = null)
		{
			Debug.Log((object)("[MoreSkills].[" + (method ?? "null") + "] " + message));
		}

		public static void LogWarning(string message, [CallerMemberName] string method = null)
		{
			Debug.LogWarning((object)("[MoreSkills].[" + (method ?? "null") + "] " + message));
		}

		public static void LogError(string message, [CallerMemberName] string method = null)
		{
			Debug.LogError((object)("[MoreSkills].[" + (method ?? "null") + "] " + message));
		}
	}
}
namespace MoreSkills.UI
{
	internal static class SkillIcons
	{
		public static Sprite VitalityIcon;

		public static Sprite StrengthIcon;

		public static Sprite SailingIcon;

		public static Sprite CraftingIcon;

		public static Sprite HuntingIcon;

		public static Sprite TamingIcon;

		public static Sprite FishingIcon;

		public static Sprite Load_VitalityIcon()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			Stream stream = EmbeddedAssets.LoadAssets("Assets.Icons.vitalityicon.png");
			Texture2D val = Helper.LoadPng(stream);
			VitalityIcon = Sprite.Create(val, new Rect(0f, 0f, 32f, 32f), Vector2.zero);
			stream.Dispose();
			return VitalityIcon;
		}

		public static Sprite Load_StrengthIcon()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			Stream stream = EmbeddedAssets.LoadAssets("Assets.Icons.strengthicon.png");
			Texture2D val = Helper.LoadPng(stream);
			StrengthIcon = Sprite.Create(val, new Rect(0f, 0f, 32f, 32f), Vector2.zero);
			stream.Dispose();
			return StrengthIcon;
		}

		public static Sprite Load_SailingIcon()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			Stream stream = EmbeddedAssets.LoadAssets("Assets.Icons.sailingicon.png");
			Texture2D val = Helper.LoadPng(stream);
			SailingIcon = Sprite.Create(val, new Rect(0f, 0f, 32f, 32f), Vector2.zero);
			stream.Dispose();
			return SailingIcon;
		}

		public static Sprite Load_CraftingIcon()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			Stream stream = EmbeddedAssets.LoadAssets("Assets.Icons.craftingicon.png");
			Texture2D val = Helper.LoadPng(stream);
			CraftingIcon = Sprite.Create(val, new Rect(0f, 0f, 32f, 32f), Vector2.zero);
			stream.Dispose();
			return CraftingIcon;
		}

		public static Sprite Load_HuntingIcon()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			Stream stream = EmbeddedAssets.LoadAssets("Assets.Icons.huntingicon.png");
			Texture2D val = Helper.LoadPng(stream);
			HuntingIcon = Sprite.Create(val, new Rect(0f, 0f, 32f, 32f), Vector2.zero);
			stream.Dispose();
			return HuntingIcon;
		}

		public static Sprite Load_TamingIcon()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			Stream stream = EmbeddedAssets.LoadAssets("Assets.Icons.tamingicon.png");
			Texture2D val = Helper.LoadPng(stream);
			TamingIcon = Sprite.Create(val, new Rect(0f, 0f, 32f, 32f), Vector2.zero);
			stream.Dispose();
			return TamingIcon;
		}

		public static Sprite Load_FishingIcon()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			Stream stream = EmbeddedAssets.LoadAssets("Assets.Icons.fishingicon.png");
			Texture2D val = Helper.LoadPng(stream);
			FishingIcon = Sprite.Create(val, new Rect(0f, 0f, 32f, 32f), Vector2.zero);
			stream.Dispose();
			return FishingIcon;
		}
	}
}
namespace MoreSkills.ModSkills
{
	internal class MoreSkills_DropsRocksWood
	{
		[HarmonyPatch(typeof(DropTable), "GetDropList", new Type[] { typeof(int) })]
		public static class DropTable_DropsRocksWood
		{
			private class DropObjectContainer
			{
				public int NumItems { get; set; }

				public DropObjectAssocinatedSkillType SkillType { get; set; }

				public GameObject DropItem { get; set; }

				public DropObjectContainer(int numItems, DropObjectAssocinatedSkillType skillType, GameObject dropItem)
				{
					NumItems = numItems;
					SkillType = skillType;
					DropItem = dropItem;
				}
			}

			private enum DropObjectAssocinatedSkillType
			{
				Woodworking,
				Pickaxe,
				Hunting
			}

			public static void Postfix(ref DropTable __instance, ref List<GameObject> __result, int amount)
			{
				//IL_0054: Unknown result type (might be due to invalid IL or missing references)
				//IL_005e: Unknown result type (might be due to invalid IL or missing references)
				//IL_006a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0074: Unknown result type (might be due to invalid IL or missing references)
				//IL_0080: Unknown result type (might be due to invalid IL or missing references)
				//IL_008a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0096: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
				if (!((Object)(object)MoreSkills_Instances._player != (Object)null) || __result == null || __result.Count <= 0 || (!MoreSkills_OverhaulsConfig.EnableWoodCuttingDropMod.Value && !MoreSkills_OverhaulsConfig.EnablePickaxeDropMod.Value && !MoreSkills_HuntingConfig.EnableHuntingSkill.Value) || (!(MoreSkills_Instances._DDAttacker == ((Character)MoreSkills_Instances._player).GetZDOID()) && !(MoreSkills_Instances._MR5DAttacker == ((Character)MoreSkills_Instances._player).GetZDOID()) && !(MoreSkills_Instances._TBDAttacker == ((Character)MoreSkills_Instances._player).GetZDOID()) && !(MoreSkills_Instances._TLDAttacker == ((Character)MoreSkills_Instances._player).GetZDOID())))
				{
					return;
				}
				bool value = MoreSkills_OverhaulsConfig.EnableDetailedLogging.Value;
				if (value)
				{
					Utilities.Log("Starting DropsRocksWood.Postfix with " + __result.Count + " drops", "Postfix");
				}
				List<GameObject> list = new List<GameObject>();
				float num = 0f;
				float appliedStoneLootFactor = 0f;
				float num2 = 0f;
				if (useNewDropMethod)
				{
					string[] array = MoreSkills_OverhaulsConfig.WoodCuttingApplyForItems.Value.Split(commaSeparator, StringSplitOptions.RemoveEmptyEntries);
					string[] array2 = MoreSkills_OverhaulsConfig.PickaxeApplyForItems.Value.Split(commaSeparator, StringSplitOptions.RemoveEmptyEntries);
					string[] array3 = MoreSkills_OverhaulsConfig.HuntingApplyForItems.Value.Split(commaSeparator, StringSplitOptions.RemoveEmptyEntries);
					string[] collection = MoreSkills_OverhaulsConfig.IgnoreDropItemNames.Value.Split(commaSeparator, StringSplitOptions.RemoveEmptyEntries);
					HashSet<string> hashSet = new HashSet<string>(collection);
					string[] collection2 = MoreSkills_OverhaulsConfig.DontDropItemNames.Value.Split(commaSeparator, StringSplitOptions.RemoveEmptyEntries);
					HashSet<string> hashSet2 = new HashSet<string>(collection2);
					Dictionary<string, DropObjectContainer> dictionary = new Dictionary<string, DropObjectContainer>();
					string[] array4 = array;
					foreach (string text in array4)
					{
						if (!dictionary.ContainsKey(text))
						{
							dictionary.Add(text, new DropObjectContainer(0, DropObjectAssocinatedSkillType.Woodworking, null));
							continue;
						}
						Utilities.LogWarning("Key '" + text + "' already exists in '" + ((ConfigEntryBase)MoreSkills_OverhaulsConfig.WoodCuttingApplyForItems).Definition.Key + "' found in config 'MoreSkills.OverhaulsConfig.cfg'. Did you configure it twice?", "Postfix");
					}
					string[] array5 = array2;
					foreach (string text2 in array5)
					{
						if (!dictionary.ContainsKey(text2))
						{
							dictionary.Add(text2, new DropObjectContainer(0, DropObjectAssocinatedSkillType.Pickaxe, null));
							continue;
						}
						Utilities.LogWarning("Key '" + text2 + "' already exists in '" + ((ConfigEntryBase)MoreSkills_OverhaulsConfig.PickaxeApplyForItems).Definition.Key + "' found in config 'MoreSkills.OverhaulsConfig.cfg'. Did you configure it twice?", "Postfix");
					}
					string[] array6 = array3;
					foreach (string text3 in array6)
					{
						if (!dictionary.ContainsKey(text3))
						{
							dictionary.Add(text3, new DropObjectContainer(0, DropObjectAssocinatedSkillType.Hunting, null));
							continue;
						}
						Utilities.LogWarning("Key '" + text3 + "' already exists in '" + ((ConfigEntryBase)MoreSkills_OverhaulsConfig.HuntingApplyForItems).Definition.Key + "' found in config 'MoreSkills.OverhaulsConfig.cfg'. Did you configure it twice?", "Postfix");
					}
					foreach (GameObject item23 in __result)
					{
						if ((Object)(object)item23 == (Object)null)
						{
							continue;
						}
						if (dictionary.TryGetValue(((Object)item23).name, out var value2))
						{
							if ((Object)(object)value2.DropItem == (Object)null)
							{
								value2.DropItem = item23;
							}
							value2.NumItems++;
							if (value)
							{
								Utilities.Log("Added drop '" + ((Object)item23).name + "' to dropObjects map (skillType=" + value2.SkillType.ToString() + ", NumItems=" + value2.NumItems + ")", "Postfix");
							}
						}
						else if (hashSet2.Contains(((Object)item23).name))
						{
							if (value)
							{
								Utilities.LogWarning("Not dropping Drop '" + ((Object)item23).name + "' because it was found in DontDropItemNames.", "Postfix");
							}
						}
						else
						{
							if (!hashSet.Contains(((Object)item23).name))
							{
								Utilities.LogWarning("Unknown Drop '" + ((Object)item23).name + "'. Ignoring skill and just dropping item.", "Postfix");
							}
							list.Add(item23);
						}
					}
					num = getAppliedWoodLootFactor(num);
					appliedStoneLootFactor = getAppliedStoneLootFactor(appliedStoneLootFactor);
					num2 = getAppliedHuntingLootFactor(num2);
					foreach (string key in dictionary.Keys)
					{
						if (dictionary.TryGetValue(key, out var value3) && value3.NumItems > 0 && (Object)(object)value3.DropItem != (Object)null)
						{
							int num3 = 0;
							switch (value3.SkillType)
							{
							case DropObjectAssocinatedSkillType.Woodworking:
								num3 = (MoreSkills_OverhaulsConfig.EnableWoodCuttingDropMod.Value ? ((int)((float)value3.NumItems + (float)value3.NumItems * num)) : value3.NumItems);
								break;
							case DropObjectAssocinatedSkillType.Pickaxe:
								num3 = (MoreSkills_OverhaulsConfig.EnablePickaxeDropMod.Value ? ((int)((float)value3.NumItems + (float)value3.NumItems * appliedStoneLootFactor)) : value3.NumItems);
								break;
							case DropObjectAssocinatedSkillType.Hunting:
								num3 = (MoreSkills_HuntingConfig.EnableHuntingSkill.Value ? ((int)((float)value3.NumItems + (float)value3.NumItems * num2)) : value3.NumItems);
								break;
							default:
								Utilities.LogWarning("Unknown dropContainer Skilltype '" + value3.SkillType.ToString() + "'", "Postfix");
								break;
							}
							if (value)
							{
								Utilities.Log("Dropping " + num3 + " " + ((Object)value3.DropItem).name + " (original drops: " + value3.NumItems + ")", "Postfix");
							}
							for (int l = 0; l < num3; l++)
							{
								list.Add(value3.DropItem);
							}
						}
					}
				}
				else
				{
					float num4 = 0f;
					GameObject item = null;
					float num5 = 0f;
					GameObject item2 = null;
					float num6 = 0f;
					GameObject item3 = null;
					float num7 = 0f;
					GameObject item4 = null;
					float num8 = 0f;
					GameObject item5 = null;
					float num9 = 0f;
					GameObject item6 = null;
					float num10 = 0f;
					GameObject item7 = null;
					float num11 = 0f;
					GameObject item8 = null;
					float num12 = 0f;
					GameObject item9 = null;
					float num13 = 0f;
					GameObject item10 = null;
					float num14 = 0f;
					GameObject item11 = null;
					float num15 = 0f;
					GameObject item12 = null;
					float num16 = 0f;
					GameObject item13 = null;
					float num17 = 0f;
					GameObject item14 = null;
					float num18 = 0f;
					GameObject item15 = null;
					float num19 = 0f;
					GameObject item16 = null;
					float num20 = 0f;
					GameObject item17 = null;
					float num21 = 0f;
					GameObject item18 = null;
					float num22 = 0f;
					GameObject item19 = null;
					float num23 = 0f;
					GameObject item20 = null;
					float num24 = 0f;
					GameObject item21 = null;
					float num25 = 0f;
					GameObject item22 = null;
					foreach (GameObject item24 in __result)
					{
						if (!((Object)(object)item24 == (Object)null))
						{
							if (((Object)item24).name == "BeechSeeds")
							{
								num4 += 1f;
								item = item24;
							}
							else if (((Object)item24).name == "BirchCone")
							{
								num12 += 1f;
								item9 = item24;
							}
							else if (((Object)item24).name == "OakSeeds")
							{
								num13 += 1f;
								item10 = item24;
							}
							else if (((Object)item24).name == "Acorn")
							{
								num14 += 1f;
								item11 = item24;
							}
							else if (((Object)item24).name == "ElderBark")
							{
								num5 += 1f;
								item2 = item24;
							}
							else if (((Object)item24).name == "FineWood")
							{
								num6 += 1f;
								item3 = item24;
							}
							else if (((Object)item24).name == "FirCone")
							{
								num7 += 1f;
								item4 = item24;
							}
							else if (((Object)item24).name == "PineCone")
							{
								num8 += 1f;
								item5 = item24;
							}
							else if (((Object)item24).name == "Resin")
							{
								num9 += 1f;
								item6 = item24;
							}
							else if (((Object)item24).name == "RoundLog")
							{
								num10 += 1f;
								item7 = item24;
							}
							else if (((Object)item24).name == "Wood")
							{
								num11 += 1f;
								item8 = item24;
							}
							else if (((Object)item24).name == "Chitin")
							{
								num15 += 1f;
								item12 = item24;
							}
							else if (((Object)item24).name == "CopperOre")
							{
								num16 += 1f;
								item13 = item24;
							}
							else if (((Object)item24).name == "IronScrap")
							{
								num17 += 1f;
								item14 = item24;
							}
							else if (((Object)item24).name == "Obsidian")
							{
								num18 += 1f;
								item15 = item24;
							}
							else if (((Object)item24).name == "SilverOre")
							{
								num19 += 1f;
								item16 = item24;
							}
							else if (((Object)item24).name == "TinOre")
							{
								num21 += 1f;
								item18 = item24;
							}
							else if (((Object)item24).name == "Stone")
							{
								num20 += 1f;
								item17 = item24;
							}
							else if (((Object)item24).name == "Feathers")
							{
								num22 += 1f;
								item19 = item24;
							}
							else if (((Object)item24).name == "Guck")
							{
								num23 += 1f;
								item20 = item24;
							}
							else if (((Object)item24).name == "LeatherScraps")
							{
								num24 += 1f;
								item21 = item24;
							}
							else if (((Object)item24).name == "WitheredBone")
							{
								num25 += 1f;
								item22 = item24;
							}
							else
							{
								Utilities.LogWarning("Report Missing/Unknown Drop: '" + ((Object)item24).name + "'", "Postfix");
								list.Add(item24);
							}
						}
					}
					if (MoreSkills_OverhaulsConfig.EnableWoodCuttingDropMod.Value)
					{
						num = getAppliedWoodLootFactor(num);
						for (int m = 0; m < (int)(num4 + num4 * num); m++)
						{
							list.Add(item);
						}
						for (int n = 0; n < (int)(num12 + num12 * num); n++)
						{
							list.Add(item9);
						}
						for (int num26 = 0; num26 < (int)(num13 + num13 * num); num26++)
						{
							list.Add(item10);
						}
						for (int num27 = 0; num27 < (int)(num14 + num14 * num); num27++)
						{
							list.Add(item11);
						}
						for (int num28 = 0; num28 < (int)(num5 + num5 * num); num28++)
						{
							list.Add(item2);
						}
						for (int num29 = 0; num29 < (int)(num6 + num6 * num); num29++)
						{
							list.Add(item3);
						}
						for (int num30 = 0; num30 < (int)(num7 + num7 * num); num30++)
						{
							list.Add(item4);
						}
						for (int num31 = 0; num31 < (int)(num8 + num8 * num); num31++)
						{
							list.Add(item5);
						}
						for (int num32 = 0; num32 < (int)(num9 + num9 * num); num32++)
						{
							list.Add(item6);
						}
						for (int num33 = 0; num33 < (int)(num10 + num10 * num); num33++)
						{
							list.Add(item7);
						}
						for (int num34 = 0; num34 < (int)(num11 + num11 * num); num34++)
						{
							list.Add(item8);
						}
					}
					else
					{
						for (int num35 = 0; num35 < (int)num4; num35++)
						{
							list.Add(item);
						}
						for (int num36 = 0; num36 < (int)num12; num36++)
						{
							list.Add(item9);
						}
						for (int num37 = 0; num37 < (int)num13; num37++)
						{
							list.Add(item10);
						}
						for (int num38 = 0; num38 < (int)num14; num38++)
						{
							list.Add(item11);
						}
						for (int num39 = 0; num39 < (int)num5; num39++)
						{
							list.Add(item2);
						}
						for (int num40 = 0; num40 < (int)num6; num40++)
						{
							list.Add(item3);
						}
						for (int num41 = 0; num41 < (int)num7; num41++)
						{
							list.Add(item4);
						}
						for (int num42 = 0; num42 < (int)num8; num42++)
						{
							list.Add(item5);
						}
						for (int num43 = 0; num43 < (int)num9; num43++)
						{
							list.Add(item6);
						}
						for (int num44 = 0; num44 < (int)num10; num44++)
						{
							list.Add(item7);
						}
						for (int num45 = 0; num45 < (int)num11; num45++)
						{
							list.Add(item8);
						}
					}
					if (MoreSkills_OverhaulsConfig.EnablePickaxeDropMod.Value)
					{
						appliedStoneLootFactor = getAppliedStoneLootFactor(appliedStoneLootFactor);
						for (int num46 = 0; num46 < (int)(num15 + num15 * appliedStoneLootFactor); num46++)
						{
							list.Add(item12);
						}
						for (int num47 = 0; num47 < (int)(num16 + num16 * appliedStoneLootFactor); num47++)
						{
							list.Add(item13);
						}
						for (int num48 = 0; num48 < (int)(num17 + num17 * appliedStoneLootFactor); num48++)
						{
							list.Add(item14);
						}
						for (int num49 = 0; num49 < (int)(num18 + num18 * appliedStoneLootFactor); num49++)
						{
							list.Add(item15);
						}
						for (int num50 = 0; num50 < (int)(num19 + num19 * appliedStoneLootFactor); num50++)
						{
							list.Add(item16);
						}
						for (int num51 = 0; num51 < (int)(num20 + num20 * appliedStoneLootFactor); num51++)
						{
							list.Add(item17);
						}
						for (int num52 = 0; num52 < (int)(num21 + num21 * appliedStoneLootFactor); num52++)
						{
							list.Add(item18);
						}
					}
					else
					{
						for (int num53 = 0; num53 < (int)num15; num53++)
						{
							list.Add(item12);
						}
						for (int num54 = 0; num54 < (int)num16; num54++)
						{
							list.Add(item13);
						}
						for (int num55 = 0; num55 < (int)num17; num55++)
						{
							list.Add(item14);
						}
						for (int num56 = 0; num56 < (int)num18; num56++)
						{
							list.Add(item15);
						}
						for (int num57 = 0; num57 < (int)num19; num57++)
						{
							list.Add(item16);
						}
						for (int num58 = 0; num58 < (int)num20; num58++)
						{
							list.Add(item17);
						}
						for (int num59 = 0; num59 < (int)num21; num59++)
						{
							list.Add(item18);
						}
					}
					if (MoreSkills_HuntingConfig.EnableHuntingSkill.Value)
					{
						appliedStoneLootFactor = getAppliedHuntingLootFactor(num);
						for (int num60 = 0; num60 < (int)(num22 + num22 * num2); num60++)
						{
							list.Add(item19);
						}
						for (int num61 = 0; num61 < (int)(num23 + num23 * num2); num61++)
						{
							list.Add(item20);
						}
						for (int num62 = 0; num62 < (int)(num24 + num24 * num2); num62++)
						{
							list.Add(item21);
						}
						for (int num63 = 0; num63 < (int)(num25 + num25 * num2); num63++)
						{
							list.Add(item22);
						}
					}
					else
					{
						for (int num64 = 0; num64 < (int)num22; num64++)
						{
							list.Add(item19);
						}
						for (int num65 = 0; num65 < (int)num23; num65++)
						{
							list.Add(item20);
						}
						for (int num66 = 0; num66 < (int)num24; num66++)
						{
							list.Add(item21);
						}
						for (int num67 = 0; num67 < (int)num25; num67++)
						{
							list.Add(item22);
						}
					}
				}
				__result = list;
				if (!value)
				{
					return;
				}
				string text4 = "";
				foreach (GameObject item25 in __result)
				{
					text4 = text4 + "'" + ((Object)item25).name + "',";
				}
				Utilities.Log("Returning Drops: " + text4, "Postfix");
			}
		}

		private static bool useNewDropMethod = true;

		private static char[] commaSeparator = new char[1] { ',' };

		private static float getAppliedWoodLootFactor(float appliedWoodLootFactor)
		{
			if (appliedWoodLootFactor == 0f)
			{
				float skillFactor = ((Character)MoreSkills_Instances._player).GetSkillFactor((SkillType)13);
				appliedWoodLootFactor = (MoreSkills_OverhaulsConfig.WoodCuttingMultiplier.Value - 1f) * skillFactor;
			}
			return appliedWoodLootFactor;
		}

		private static float getAppliedStoneLootFactor(float appliedStoneLootFactor)
		{
			if (appliedStoneLootFactor == 0f)
			{
				float skillFactor = ((Character)MoreSkills_Instances._player).GetSkillFactor((SkillType)12);
				appliedStoneLootFactor = (MoreSkills_OverhaulsConfig.PickaxeMultiplier.Value - 1f) * skillFactor;
			}
			return appliedStoneLootFactor;
		}

		private static float getAppliedHuntingLootFactor(float appliedHuntingLootFactor)
		{
			if (appliedHuntingLootFactor == 0f)
			{
				float skillFactor = ((Character)MoreSkills_Instances._player).GetSkillFactor((SkillType)704);
				appliedHuntingLootFactor = (MoreSkills_HuntingConfig.HuntingDropMultiplier.Value - 1f) * skillFactor;
			}
			return appliedHuntingLootFactor;
		}
	}
	internal class MoreSkills_Crafting
	{
		[HarmonyPatch(typeof(InventoryGui), "Show")]
		public static class CraftingSkill_InventoryShow
		{
			public static void Postfix()
			{
				if (!((Object)(object)MoreSkills_Instances._player != (Object)null) || !MoreSkills_CraftingConfig.EnableCraftingSkill.Value)
				{
					return;
				}
				IGUI = true;
				if (!Saved)
				{
					foreach (Recipe recipe in MoreSkills_Instances._objectDB.m_recipes)
					{
						Requirement[] resources = recipe.m_resources;
						foreach (Requirement val in resources)
						{
							if (!((Object)(object)recipe == (Object)null) && !((Object)(object)recipe.m_item == (Object)null))
							{
								string objnumitem2 = string.Concat(((Object)recipe.m_item).name + ":" + recipe.m_amount + ":" + ((Object)val.m_resItem).name);
								float objnum = recipe.m_amount;
								float itemcnum = val.m_amount;
								float itemunum = val.m_amountPerLevel;
								if (cSaves.Find((Helper.CraftingSaves csaves) => csaves.ObjNumItem == objnumitem2).ObjNumItem != objnumitem2)
								{
									cSaves.Add(new Helper.CraftingSaves(objnumitem2, objnum, itemcnum, itemunum));
								}
							}
						}
					}
					Saved = true;
					Utilities.Log("Saved All Objects in DataBase", "Postfix");
				}
				bool value = MoreSkills_CraftingConfig.EnableDetailedLogging.Value;
				float num = calculateAppliedItemMultiplier(value, "Show (Crafting)");
				foreach (Recipe recipe2 in MoreSkills_Instances._objectDB.m_recipes)
				{
					Requirement[] resources2 = recipe2.m_resources;
					foreach (Requirement val2 in resources2)
					{
						if ((Object)(object)recipe2 == (Object)null || (Object)(object)recipe2.m_item == (Object)null)
						{
							continue;
						}
						string objnumitem = string.Concat(((Object)recipe2.m_item).name + ":" + recipe2.m_amount + ":" + ((Object)val2.m_resItem).name);
						Helper.CraftingSaves craftingSaves = cSaves.Find((Helper.CraftingSaves csaves) => csaves.ObjNumItem == objnumitem);
						if (craftingSaves.ObjNumItem == objnumitem)
						{
							if (val2.m_amount >= 1)
							{
								val2.m_amount = Mathf.RoundToInt(craftingSaves.ItemCNum * num);
								if (val2.m_amount < 1)
								{
									val2.m_amount = 1;
								}
							}
							if (val2.m_amountPerLevel >= 1)
							{
								val2.m_amountPerLevel = Mathf.RoundToInt(craftingSaves.ItemUNum * num);
								if (val2.m_amountPerLevel < 1)
								{
									val2.m_amountPerLevel = 1;
								}
							}
							if (value)
							{
								Utilities.Log("Show (Crafting): Handling ObjNumItem '" + craftingSaves.ObjNumItem + "': old amount: " + craftingSaves.ItemCNum + " new amount: " + val2.m_amount + " (amountPerLevel: " + val2.m_amountPerLevel + " ) after applying item multiplier: " + num, "Postfix");
							}
						}
						else
						{
							Utilities.LogWarning("Show (Crafting): Stored objnumitem '" + craftingSaves.ObjNumItem + "' does not match expected objnumitm '" + objnumitem + "'", "Postfix");
						}
					}
				}
			}
		}

		[HarmonyPatch(typeof(InventoryGui), "DoCrafting")]
		public static class CraftingSkillMod_SkillIncrease
		{
			public static void Postfix()
			{
				if (!((Object)(object)MoreSkills_Instances._player != (Object)null) || !MoreSkills_CraftingConfig.EnableCraftingSkill.Value)
				{
					return;
				}
				bool value = MoreSkills_CraftingConfig.EnableDetailedLogging.Value;
				float num = calculateAppliedItemMultiplier(value, "DoCrafting");
				foreach (Recipe recipe in MoreSkills_Instances._objectDB.m_recipes)
				{
					Requirement[] resources = recipe.m_resources;
					foreach (Requirement val in resources)
					{
						if ((Object)(object)recipe == (Object)null || (Object)(object)recipe.m_item == (Object)null)
						{
							continue;
						}
						string objnumitem = string.Concat(((Object)recipe.m_item).name + ":" + recipe.m_amount + ":" + ((Object)val.m_resItem).name);
						Helper.CraftingSaves craftingSaves = cSaves.Find((Helper.CraftingSaves csaves) => csaves.ObjNumItem == objnumitem);
						if (craftingSaves.ObjNumItem == objnumitem)
						{
							if (val.m_amount >= 1)
							{
								val.m_amount = Mathf.RoundToInt(craftingSaves.ItemCNum * num);
								if (val.m_amount < 1)
								{
									val.m_amount = 1;
								}
							}
							if (val.m_amountPerLevel >= 1)
							{
								val.m_amountPerLevel = Mathf.RoundToInt(craftingSaves.ItemUNum * num);
								if (val.m_amountPerLevel < 1)
								{
									val.m_amountPerLevel = 1;
								}
							}
							if (value)
							{
								Utilities.Log("DoCrafting: Handling ObjNumItem '" + craftingSaves.ObjNumItem + "': old amount: " + craftingSaves.ItemCNum + " new amount: " + val.m_amount + " (amountPerLevel: " + val.m_amountPerLevel + " ) after applying item multiplier: " + num, "Postfix");
							}
						}
						else
						{
							Utilities.LogWarning("DoCrafting: Stored objnumitem '" + craftingSaves.ObjNumItem + "' does not match expected objnumitm '" + objnumitem + "'", "Postfix");
						}
					}
				}
				foreach (Recipe recipe2 in MoreSkills_Instances._objectDB.m_recipes)
				{
					if ((Object)(object)recipe2 == (Object)null || (Object)(object)recipe2.m_item == (Object)null || !((Object)(object)recipe2.m_item == (Object)(object)MoreSkills_Instances._inventoryGui.m_selectedRecipe.Key.m_item))
					{
						continue;
					}
					Requirement[] resources2 = recipe2.m_resources;
					foreach (Requirement val2 in resources2)
					{
						if (val2 != null && !((Object)(object)val2.m_resItem == (Object)null))
						{
							CraftSkillInc += val2.m_amount;
							CraftSkillInc += val2.m_amountPerLevel;
						}
					}
				}
				((Character)MoreSkills_Instances._player).RaiseSkill((SkillType)703, CraftSkillInc * MoreSkills_CraftingConfig.CraftingSkillIncreaseMultiplier.Value / 10f);
				Utilities.Log("Granted Crafting EXP: " + CraftSkillInc * MoreSkills_CraftingConfig.CraftingSkillIncreaseMultiplier.Value, "Postfix");
				CraftSkillInc = 0f;
			}
		}

		public static bool IGUI;

		public static float CraftSkillInc;

		public static bool Saved;

		public static List<Helper.CraftingSaves> cSaves = new List<Helper.CraftingSaves>();

		private static float calculateAppliedItemMultiplier(bool advancedLogging, string caltculatedAt)
		{
			float skillFactor = ((Character)MoreSkills_Instances._player).GetSkillFactor((SkillType)703);
			float num = MoreSkills_CraftingConfig.CraftingMiddleLevel.Value / 100;
			if (num < 0f)
			{
				num = 0f;
			}
			else if (num > 1f)
			{
				num = 1f;
			}
			float num2 = 1f;
			if (skillFactor < num)
			{
				float value = MoreSkills_CraftingConfig.CraftingLevelMultiplier.Value;
				num2 = value - skillFactor * (1f / num) * (value - 1f);
				if (advancedLogging)
				{
					Utilities.Log(caltculatedAt + ": calculated appliedItemMultiplier " + num2 + " based on crafing skill level " + skillFactor + " and multiplier " + value + " because skill is below " + num, "calculateAppliedItemMultiplier");
				}
			}
			else
			{
				float value2 = MoreSkills_CraftingConfig.CraftingLevelDivider.Value;
				float num3 = 1f + (skillFactor - num) * (1f / (1f - num)) * (value2 - 1f);
				num2 = 1f / num3;
				if (advancedLogging)
				{
					Utilities.Log(caltculatedAt + ": calculated appliedItemMultiplier " + num2 + " based on crafing skill level " + skillFactor + " and divider " + value2 + " because skill is aboveequal " + num, "calculateAppliedItemMultiplier");
				}
			}
			return num2;
		}
	}
	internal class MoreSkills_Sailing
	{
		[HarmonyPatch(typeof(Ship), "GetSailForce")]
		public static class Sailing_Skill
		{
			public static bool SittingInBoat;

			public static float Captain;

			public static float SittingCrew;

			public static float StandingCrew;

			public static void Postfix()
			{
				//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
				//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
				//IL_025f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0264: Unknown result type (might be due to invalid IL or missing references)
				//IL_059a: Unknown result type (might be due to invalid IL or missing references)
				//IL_059f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0504: Unknown result type (might be due to invalid IL or missing references)
				//IL_0509: Unknown result type (might be due to invalid IL or missing references)
				//IL_0289: Unknown result type (might be due to invalid IL or missing references)
				//IL_028e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0437: Unknown result type (might be due to invalid IL or missing references)
				//IL_043c: Unknown result type (might be due to invalid IL or missing references)
				//IL_05d5: Unknown result type (might be due to invalid IL or missing references)
				//IL_05da: Unknown result type (might be due to invalid IL or missing references)
				//IL_053f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0544: Unknown result type (might be due to invalid IL or missing references)
				//IL_0472: Unknown result type (might be due to invalid IL or missing references)
				//IL_0477: Unknown result type (might be due to invalid IL or missing references)
				//IL_02fa: Unknown result type (might be due to invalid IL or missing references)
				//IL_02ff: Unknown result type (might be due to invalid IL or missing references)
				//IL_0324: Unknown result type (might be due to invalid IL or missing references)
				//IL_0329: Unknown result type (might be due to invalid IL or missing references)
				//IL_038a: Unknown result type (might be due to invalid IL or missing references)
				//IL_038f: Unknown result type (might be due to invalid IL or missing references)
				//IL_03b4: Unknown result type (might be due to invalid IL or missing references)
				//IL_03b9: Unknown result type (might be due to invalid IL or missing references)
				if (!((Object)(object)MoreSkills_Instances._player != (Object)null) || !MoreSkills_SailingConfig.EnableSailingMod.Value)
				{
					return;
				}
				float num2;
				float num3;
				float num5;
				float backwardForce;
				float num6;
				Speed speedSetting;
				if ((Object)(object)MoreSkills_Instances._player.GetControlledShip() != (Object)null)
				{
					float num = Mathf.Floor(((Character)MoreSkills_Instances._player).GetSkillFactor((SkillType)702) * 100f + 1E-06f);
					num2 = (MoreSkills_SailingConfig.BaseMaxBForce.Value - MoreSkills_SailingConfig.BaseBForce.Value) / 100f * num;
					num3 = (MoreSkills_SailingConfig.BaseMaxRSpeed.Value - MoreSkills_SailingConfig.BaseRSpeed.Value) / 100f * num;
					float num4 = (MoreSkills_SailingConfig.BaseMaxSForce.Value - MoreSkills_SailingConfig.BaseSForce.Value) / 100f * num;
					num5 = (MoreSkills_SailingConfig.BaseMaxDSideways.Value - MoreSkills_SailingConfig.BaseDSideways.Value) / 100f * num;
					backwardForce = MoreSkills_Instances._player.GetControlledShip().m_backwardForce;
					float sailForceFactor = MoreSkills_Instances._player.GetControlledShip().m_sailForceFactor;
					num6 = MoreSkills_SailingConfig.BaseBForce.Value + num2 + MoreSkills_SailingConfig.CrewMembersBForceAdd.Value * num2 / 5f * (float)MoreSkills_Instances._player.GetControlledShip().m_players.Count;
					if (!MoreSkills_SailingConfig.EnableShipAcceleration.Value)
					{
						if (!MoreSkills_SailingConfig.EnableShipCrew.Value)
						{
							MoreSkills_Instances._player.GetControlledShip().m_backwardForce = MoreSkills_SailingConfig.BaseBForce.Value + num2;
						}
						else
						{
							MoreSkills_Instances._player.GetControlledShip().m_backwardForce = MoreSkills_SailingConfig.BaseBForce.Value + num2 + MoreSkills_SailingConfig.CrewMembersBForceAdd.Value * num2 / 5f * (float)MoreSkills_Instances._player.GetControlledShip().m_players.Count;
						}
						MoreSkills_Instances._player.GetControlledShip().m_sailForceFactor = MoreSkills_SailingConfig.BaseSForce.Value + num4;
					}
					else
					{
						speedSetting = MoreSkills_Instances._player.GetControlledShip().GetSpeedSetting();
						if (((object)(Speed)(ref speedSetting)).ToString() == "Stop")
						{
							MoreSkills_Instances._player.GetControlledShip().m_sailForceFactor = 0.01f;
							MoreSkills_Instances._player.GetControlledShip().m_backwardForce = 0.01f;
						}
						else
						{
							if (!(sailForceFactor < MoreSkills_SailingConfig.BaseSForce.Value + num4))
							{
								goto IL_02d3;
							}
							speedSetting = MoreSkills_Instances._player.GetControlledShip().GetSpeedSetting();
							if (!(((object)(Speed)(ref speedSetting)).ToString() == "Half"))
							{
								speedSetting = MoreSkills_Instances._player.GetControlledShip().GetSpeedSetting();
								if (!(((object)(Speed)(ref speedSetting)).ToString() == "Full"))
								{
									goto IL_02d3;
								}
							}
							Ship controlledShip = MoreSkills_Instances._player.GetControlledShip();
							controlledShip.m_sailForceFactor += 0.0001f;
						}
					}
					goto IL_03fa;
				}
				if (!((Object)(object)((Character)MoreSkills_Instances._player).GetStandingOnShip() != (Object)null) && !SittingInBoat)
				{
					return;
				}
				Vector3 velocity;
				if (((Character)MoreSkills_Instances._player).IsAttached())
				{
					SittingInBoat = true;
					velocity = ((Character)MoreSkills_Instances._player).GetVelocity();
					if (((Vector3)(ref velocity)).magnitude >= 1f)
					{
						if (SittingCrew < 0.5f)
						{
							float sittingCrew = SittingCrew;
							velocity = ((Character)MoreSkills_Instances._player).GetVelocity();
							SittingCrew = sittingCrew + ((Vector3)(ref velocity)).magnitude / 8000f * MoreSkills_SailingConfig.SailingSkillIncreaseMultiplier.Value;
						}
						else
						{
							((Character)MoreSkills_Instances._player).RaiseSkill((SkillType)702, SittingCrew);
							SittingCrew = 0f;
						}
					}
					return;
				}
				SittingInBoat = false;
				velocity = ((Character)MoreSkills_Instances._player).GetVelocity();
				if (((Vector3)(ref velocity)).magnitude >= 1f)
				{
					if (StandingCrew < 0.5f)
					{
						float standingCrew = StandingCrew;
						velocity = ((Character)MoreSkills_Instances._player).GetVelocity();
						StandingCrew = standingCrew + ((Vector3)(ref velocity)).magnitude / 16000f * MoreSkills_SailingConfig.SailingSkillIncreaseMultiplier.Value;
					}
					else
					{
						((Character)MoreSkills_Instances._player).RaiseSkill((SkillType)702, StandingCrew);
						StandingCrew = 0f;
					}
				}
				return;
				IL_036e:
				if (backwardForce < num6 && MoreSkills_SailingConfig.EnableShipCrew.Value)
				{
					speedSetting = MoreSkills_Instances._player.GetControlledShip().GetSpeedSetting();
					if (!(((object)(Speed)(ref speedSetting)).ToString() == "Slow"))
					{
						speedSetting = MoreSkills_Instances._player.GetControlledShip().GetSpeedSetting();
						if (!(((object)(Speed)(ref speedSetting)).ToString() == "Back"))
						{
							goto IL_03fa;
						}
					}
					Ship controlledShip2 = MoreSkills_Instances._player.GetControlledShip();
					controlledShip2.m_backwardForce += 0.001f;
				}
				goto IL_03fa;
				IL_02d3:
				if (!(backwardForce < MoreSkills_SailingConfig.BaseBForce.Value + num2) || MoreSkills_SailingConfig.EnableShipCrew.Value)
				{
					goto IL_036e;
				}
				speedSetting = MoreSkills_Instances._player.GetControlledShip().GetSpeedSetting();
				if (!(((object)(Speed)(ref speedSetting)).ToString() == "Slow"))
				{
					speedSetting = MoreSkills_Instances._player.GetControlledShip().GetSpeedSetting();
					if (!(((object)(Speed)(ref speedSetting)).ToString() == "Back"))
					{
						goto IL_036e;
					}
				}
				Ship controlledShip3 = MoreSkills_Instances._player.GetControlledShip();
				controlledShip3.m_backwardForce += 0.001f;
				goto IL_03fa;
				IL_03fa:
				MoreSkills_Instances._player.GetControlledShip().m_rudderSpeed = MoreSkills_SailingConfig.BaseRSpeed.Value + num3;
				MoreSkills_Instances._player.GetControlledShip().m_dampingSideway = MoreSkills_SailingConfig.BaseDSideways.Value + num5;
				velocity = ((Character)MoreSkills_Instances._player).GetVelocity();
				if (((Vector3)(ref velocity)).magnitude >= 1f)
				{
					if (Captain < 0.5f)
					{
						float captain = Captain;
						velocity = ((Character)MoreSkills_Instances._player).GetVelocity();
						Captain = captain + ((Vector3)(ref velocity)).magnitude / 4000f * MoreSkills_SailingConfig.SailingSkillIncreaseMultiplier.Value;
					}
					else
					{
						((Character)MoreSkills_Instances._player).RaiseSkill((SkillType)702, Captain);
						Captain = 0f;
					}
				}
			}
		}
	}
	internal class MoreSkills_Vitality
	{
		[HarmonyPatch(typeof(Player), "SetMaxHealth")]
		public static class Vitality_ApplyBaseHealthMod
		{
			public static void Prefix(ref float health)
			{
				if ((Object)(object)MoreSkills_Instances._player != (Object)null && MoreSkills_VitalityConfig.EnableHealthMod.Value)
				{
					float num = Mathf.Floor(((Character)MoreSkills_Instances._player).GetSkillFactor((SkillType)701) * 100f + 1E-06f);
					float num2 = (MoreSkills_VitalityConfig.BaseMaxHealth.Value - MoreSkills_VitalityConfig.BaseHealth.Value) / 100f * num;
					health += MoreSkills_VitalityConfig.BaseHealth.Value + num2 - 25f;
				}
			}
		}

		[HarmonyPatch]
		public static class Vitality_HealthRegen
		{
			public static MethodBase TargetMethod()
			{
				return AccessTools.DeclaredMethod(typeof(Player), "UpdateStats", new Type[0], (Type[])null);
			}

			public static void Postfix()
			{
				if (!((Object)(object)MoreSkills_Instances._player != (Object)null) || !MoreSkills_VitalityConfig.EnableHealthMod.Value || !(((Character)MoreSkills_Instances._player).GetHealth() < ((Character)MoreSkills_Instances._player).GetMaxHealth()))
				{
					return;
				}
				if (Damaged)
				{
					if (lastattackcounter > 1800)
					{
						Damaged = false;
					}
					else
					{
						lastattackcounter++;
					}
				}
				else if (healcounter > 600)
				{
					((Character)MoreSkills_Instances._player).Heal(((Character)MoreSkills_Instances._player).GetSkillFactor((SkillType)701), true);
					healcounter = 0;
				}
				else
				{
					healcounter++;
				}
			}
		}

		[HarmonyPatch(typeof(Player), "OnDamaged")]
		public static class Vitality_RaiseSkill
		{
			public static float IncVitality;

			public static void Postfix(ref HitData hit)
			{
				if ((Object)(object)MoreSkills_Instances._player != (Object)null && MoreSkills_VitalityConfig.EnableHealthMod.Value)
				{
					Damaged = true;
					healcounter = 0;
					lastattackcounter = 0;
					if (IncVitality < 0.1f)
					{
						IncVitality += hit.GetTotalDamage() / 10f * MoreSkills_VitalityConfig.VitalitySkillIncreaseMultiplier.Value;
						return;
					}
					((Character)MoreSkills_Instances._player).RaiseSkill((SkillType)701, IncVitality);
					IncVitality = 0f;
				}
			}
		}

		public static int lastattackcounter;

		public static int healcounter;

		public static bool Damaged;
	}
	internal class MoreSkills_Strength
	{
		[HarmonyPatch]
		public static class RaiseSkill_Strength
		{
			public static float IncEncumbred;

			public static float IncHalfnRunning;

			public static float IncHalfnMoving;

			public static int count;

			public static MethodBase TargetMethod()
			{
				return AccessTools.DeclaredMethod(typeof(Player), "UpdateStats", new Type[0], (Type[])null);
			}

			public static void Postfix()
			{
				//IL_0121: Unknown result type (might be due to invalid IL or missing references)
				//IL_0126: Unknown result type (might be due to invalid IL or missing references)
				if (!((Object)(object)MoreSkills_Instances._player != (Object)null) || !MoreSkills_StrengthConfig.EnableStrengthMod.Value)
				{
					return;
				}
				bool flag = ((Humanoid)MoreSkills_Instances._player).GetInventory().GetTotalWeight() > MoreSkills_Instances._player.GetMaxCarryWeight() / 2f;
				float magnitude = ((Vector3)(ref ((Character)MoreSkills_Instances._player).m_currentVel)).magnitude;
				bool flag2 = Mathf.Floor(magnitude) > 1f;
				float num = Mathf.Floor(((Character)MoreSkills_Instances._player).GetSkillFactor((SkillType)700) * 100f + 1E-06f);
				float num2 = (MoreSkills_StrengthConfig.BaseMaxWeight.Value - MoreSkills_StrengthConfig.BaseWeight.Value) / 100f * num;
				float num3 = num / ((((Humanoid)MoreSkills_Instances._player).GetInventory().GetTotalWeight() - MoreSkills_Instances._player.GetMaxCarryWeight()) * 50f) * MoreSkills_StrengthConfig.StrengthStaminaMultiplier.Value;
				if (MoreSkills_StrengthConfig.EnableWeightMod.Value)
				{
					MoreSkills_Instances._player.m_maxCarryWeight = MoreSkills_StrengthConfig.BaseWeight.Value + num2;
				}
				if (MoreSkills_StrengthConfig.EnableStrengthStaminaMod.Value)
				{
					if (((Character)MoreSkills_Instances._player).IsEncumbered())
					{
						Vector3 velocity = ((Character)MoreSkills_Instances._player).GetVelocity();
						if (((Vector3)(ref velocity)).magnitude < 0.1f)
						{
							if (count > 200)
							{
								count++;
							}
							((Character)MoreSkills_Instances._player).AddStamina(num3);
							goto IL_0176;
						}
					}
					count = 0;
				}
				goto IL_0176;
				IL_0176:
				if (!(flag && flag2))
				{
					return;
				}
				if (((Character)MoreSkills_Instances._player).IsEncumbered())
				{
					if (IncEncumbred < 0.1f)
					{
						IncEncumbred += ((Humanoid)MoreSkills_Instances._player).GetInventory().GetTotalWeight() / 20000f * MoreSkills_StrengthConfig.StrengthSkillIncreaseMultiplier.Value;
						return;
					}
					((Character)MoreSkills_Instances._player).RaiseSkill((SkillType)700, IncEncumbred);
					IncEncumbred = 0f;
				}
				else
				{
					if (!flag)
					{
						return;
					}
					if (((Character)MoreSkills_Instances._player).IsRunning())
					{
						if (IncHalfnRunning < 0.1f)
						{
							IncHalfnRunning += ((Humanoid)MoreSkills_Instances._player).GetInventory().GetTotalWeight() / 40000f * MoreSkills_StrengthConfig.StrengthSkillIncreaseMultiplier.Value;
							return;
						}
						((Character)MoreSkills_Instances._player).RaiseSkill((SkillType)700, IncHalfnRunning);
						IncHalfnRunning = 0f;
					}
					else if (IncHalfnMoving < 0.1f)
					{
						IncHalfnMoving += ((Humanoid)MoreSkills_Instances._player).GetInventory().GetTotalWeight() / 60000f * MoreSkills_StrengthConfig.StrengthSkillIncreaseMultiplier.Value;
					}
					else
					{
						((Character)MoreSkills_Instances._player).RaiseSkill((SkillType)700, IncHalfnMoving);
						IncHalfnMoving = 0f;
					}
				}
			}
		}
	}
	internal class MoreSkills_SwimMod
	{
		[HarmonyPatch]
		public static class Swim_SwimMod
		{
			public static int count;

			public static MethodBase TargetMethod()
			{
				return AccessTools.DeclaredMethod(typeof(Player), "UpdateStats", new Type[0], (Type[])null);
			}

			public static void Postfix()
			{
				//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
				if (!MoreSkills_OverhaulsConfig.EnableSwimMod.Value || !((Object)(object)MoreSkills_Instances._player != (Object)null))
				{
					return;
				}
				float num = (float)Math.Floor(((Character)MoreSkills_Instances._player).GetSkillFactor((SkillType)103) * 100f + 1E-06f);
				float num2 = (MoreSkills_OverhaulsConfig.BaseMaxSwimSpeed.Value - MoreSkills_OverhaulsConfig.BaseSwimSpeed.Value) / 100f * num;
				float num3 = num / 5000f * MoreSkills_OverhaulsConfig.SwimStaminaMultiplier.Value;
				if (MoreSkills_OverhaulsConfig.EnableSwimSpeedMod.Value)
				{
					((Character)MoreSkills_Instances._player).m_swimSpeed = MoreSkills_OverhaulsConfig.BaseSwimSpeed.Value + num2;
				}
				if (!MoreSkills_OverhaulsConfig.EnableSwimStaminaMod.Value)
				{
					return;
				}
				Character player = (Character)(object)MoreSkills_Instances._player;
				if (((Character)MoreSkills_Instances._player).IsSwimming())
				{
					Vector3 velocity = ((Character)MoreSkills_Instances._player).GetVelocity();
					if (((Vector3)(ref velocity)).magnitude < 0.6f)
					{
						if (count > 200)
						{
							count++;
						}
						((Character)MoreSkills_Instances._player).AddStamina(num3);
						return;
					}
				}
				count = 0;
			}
		}
	}
	internal class MoreSkills_CrouchMod
	{
		[HarmonyPatch]
		public static class Sneak_CrouchSpeedMod
		{
			public static MethodBase TargetMethod()
			{
				return AccessTools.DeclaredMethod(typeof(Player), "UpdateStats", new Type[0], (Type[])null);
			}

			public static void Postfix()
			{
				if (MoreSkills_OverhaulsConfig.EnableCrouchMod.Value && (Object)(object)MoreSkills_Instances._player != (Object)null)
				{
					if (((Character)MoreSkills_Instances._player).IsCrouching())
					{
						float num = (float)Math.Floor(((Character)MoreSkills_Instances._player).GetSkillFactor((SkillType)101) * 100f + 1E-06f);
						float num2 = (MoreSkills_OverhaulsConfig.BaseMaxCrouchSpeed.Value - MoreSkills_OverhaulsConfig.BaseCrouchSpeed.Value) / 100f * num;
						((Character)MoreSkills_Instances._player).m_crouchSpeed = MoreSkills_OverhaulsConfig.BaseCrouchSpeed.Value + num2;
					}
					else
					{
						((Character)MoreSkills_Instances._player).m_crouchSpeed = 2f;
					}
					if (((Character)MoreSkills_Instances._player).IsEncumbered())
					{
						((Character)MoreSkills_Instances._player).SetCrouch(false);
					}
				}
			}
		}
	}
}
namespace MoreSkills.ModSkills.Overhauls
{
	internal class MoreSkills_JumpMod
	{
		[HarmonyPatch]
		public static class TestJump
		{
			public static MethodBase TargetMethod()
			{
				return AccessTools.DeclaredMethod(typeof(Player), "UpdateStats", new Type[0], (Type[])null);
			}

			public static void Postfix(ref Character __instance)
			{
				//IL_0152: Unknown result type (might be due to invalid IL or missing references)
				//IL_004c: Unknown result type (might be due to invalid IL or missing references)
				//IL_01db: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
				//IL_021d: Unknown result type (might be due to invalid IL or missing references)
				//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
				//IL_0201: Unknown result type (might be due to invalid IL or missing references)
				if (!((Object)(object)MoreSkills_Instances._player != (Object)null) || !MoreSkills_OverhaulsConfig.EnableJumpMod.Value)
				{
					return;
				}
				if (MoreSkills_OverhaulsConfig.EnableHigherJump.Value)
				{
					if (MoreSkills_OverhaulsConfig.EnableHaveToShiftToHigherJump.Value)
					{
						if (Input.GetKey(MoreSkills_OverhaulsConfig.HigherJumpKey.Value))
						{
							((Character)MoreSkills_Instances._player).m_jumpForce = MoreSkills_OverhaulsConfig.BaseJumpForce.Value + (MoreSkills_OverhaulsConfig.BaseMaxJumpForce.Value - MoreSkills_OverhaulsConfig.BaseJumpForce.Value) * ((Character)MoreSkills_Instances._player).GetSkillFactor((SkillType)100);
						}
						else
						{
							((Character)MoreSkills_Instances._player).m_jumpForce = MoreSkills_OverhaulsConfig.BaseJumpForce.Value;
						}
					}
					else if (!MoreSkills_OverhaulsConfig.EnableHaveToShiftToHigherJump.Value)
					{
						((Character)MoreSkills_Instances._player).m_jumpForce = MoreSkills_OverhaulsConfig.BaseJumpForce.Value + (MoreSkills_OverhaulsConfig.BaseMaxJumpForce.Value - MoreSkills_OverhaulsConfig.BaseJumpForce.Value) * ((Character)MoreSkills_Instances._player).GetSkillFactor((SkillType)100);
					}
				}
				if (!MoreSkills_OverhaulsConfig.EnableRollOnFall.Value)
				{
					return;
				}
				float num = MoreSkills_OverhaulsConfig.BaseRollAltitude.Value + (MoreSkills_OverhaulsConfig.BaseMaxRollAltitude.Value - MoreSkills_OverhaulsConfig.BaseRollAltitude.Value) * ((Character)MoreSkills_Instances._player).GetSkillFactor((SkillType)100);
				float num2 = Mathf.Max(0f, __instance.m_maxAirAltitude - ((Component)MoreSkills_Instances._player).transform.position.y);
				if (num2 > MoreSkills_OverhaulsConfig.BaseRollAltitude.Value && num2 < num)
				{
					inAir = true;
					onGround = false;
				}
				else if (num2 > 8f)
				{
					inAir = false;
				}
				if (!inAir || num2 != 0f)
				{
					return;
				}
				onGround = true;
				if (onGround)
				{
					Vector3 val = ((Character)MoreSkills_Instances._player).m_moveDir;
					if (((Vector3)(ref val)).magnitude < 0.1f)
					{
						val = ((Character)MoreSkills_Instances._player).m_lookDir;
						val.y = 0f;
						((Vector3)(ref val)).Normalize();
					}
					MoreSkills_Instances._player.Dodge(val);
					inAir = false;
				}
			}
		}

		[HarmonyPatch(typeof(Character), "Damage")]
		public static class TestDamage
		{
			public static void Prefix(ref Character __instance, ref HitData hit)
			{
				//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
				if (!((Object)(object)MoreSkills_Instances._player != (Object)null) || !MoreSkills_OverhaulsConfig.EnableJumpMod.Value || !MoreSkills_OverhaulsConfig.EnableDecreaseFallDamageMod.Value)
				{
					return;
				}
				float value = MoreSkills_OverhaulsConfig.FallDamageDecrease.Value;
				float skillFactor = ((Character)MoreSkills_Instances._player).GetSkillFactor((SkillType)100);
				float value2 = MoreSkills_OverhaulsConfig.BaseMaxFallAltitude.Value;
				float value3 = MoreSkills_OverhaulsConfig.BaseRollAltitude.Value;
				float num = MoreSkills_OverhaulsConfig.BaseRollAltitude.Value + (MoreSkills_OverhaulsConfig.BaseMaxRollAltitude.Value - MoreSkills_OverhaulsConfig.BaseRollAltitude.Value) * ((Character)MoreSkills_Instances._player).GetSkillFactor((SkillType)100);
				float num2 = Mathf.Max(0f, __instance.m_maxAirAltitude - ((Component)MoreSkills_Instances._player).transform.position.y);
				float num3 = ((!(MoreSkills_OverhaulsConfig.MaxFallDamageIncrease.Value <= 0f)) ? MoreSkills_OverhaulsConfig.MaxFallDamageIncrease.Value : 1f);
				if (MoreSkills_OverhaulsConfig.EnableRollOnFall.Value)
				{
					if (num2 > value3 && num2 < num)
					{
						if (((ZDOID)(ref hit.m_attacker)).UserID == 0)
						{
							hit.m_damage.m_damage = 0f;
						}
					}
					else
					{
						if (!(num2 > num))
						{
							return;
						}
						if (MoreSkills_OverhaulsConfig.EnableMaxFallAltitude.Value)
						{
							if (num2 > num && num2 < value2)
							{
								if (((ZDOID)(ref hit.m_attacker)).UserID == 0)
								{
									hit.m_damage.m_damage = 100f / (value2 - num) * (num2 - num) / (value * skillFactor);
								}
							}
							else if (num2 > value2)
							{
								hit.m_damage.m_damage = 100f / (value2 - num) * (num2 - num) / (value * skillFactor) + (num2 - value2) * num3;
							}
						}
						else
						{
							if (!(num2 > num))
							{
								return;
							}
							if (num2 > 20f)
							{
								if (((ZDOID)(ref hit.m_attacker)).UserID == 0)
								{
									hit.m_damage.m_damage = 100f / (value * skillFactor);
								}
							}
							else if (num2 > num && num2 < 20f && ((ZDOID)(ref hit.m_attacker)).UserID == 0)
							{
								hit.m_damage.m_damage = 100f / (20f - num) * (num2 - num) / (value * skillFactor);
							}
						}
					}
				}
				else if (MoreSkills_OverhaulsConfig.EnableMaxFallAltitude.Value)
				{
					if (num2 > 4f && num2 < value2)
					{
						if (((ZDOID)(ref hit.m_attacker)).UserID == 0)
						{
							hit.m_damage.m_damage = 100f / (value2 - 4f) * (num2 - 4f) / (value * skillFactor);
						}
					}
					else if (num2 > value2 && ((ZDOID)(ref hit.m_attacker)).UserID == 0)
					{
						hit.m_damage.m_damage = 100f / (value2 - 4f) * (num2 - 4f) / (value * skillFactor) + (num2 - value2) * num3;
					}
				}
				else if (num2 > 4f && ((ZDOID)(ref hit.m_attacker)).UserID == 0)
				{
					hit.m_damage.m_damage /= value * skillFactor;
				}
			}
		}

		public static bool inAir;

		public static bool onGround;
	}
}
namespace MoreSkills.ModSkills.NewSkills
{
	internal class MoreSkills_Fishing
	{
		[HarmonyPatch(typeof(FishingFloat), "Nibble")]
		public static class FishFloat_Nibble_Patch
		{
			public static float mathAutoHook;

			public static void Postfix(ref FishingFloat __instance)
			{
				if (!((Object)(object)MoreSkills_Instances._player != (Object)null) || !MoreSkills_FishingConfig.EnableFishingSkill.Value)
				{
					return;
				}
				float skillFactor = ((Character)MoreSkills_Instances._player).GetSkillFactor((SkillType)706);
				float num = MoreSkills_FishingConfig.AutoHookLevel.Value;
				float num2 = MoreSkills_FishingConfig.AutoHookPercentage.Value;
				if (MoreSkills_FishingConfig.EnableFishingStaminaMod.Value)
				{
					if ((double)skillFactor <= 0.5)
					{
						__instance.m_hookedStaminaPerSec = 1f - 2f * (skillFactor * 2f);
					}
					else
					{
						__instance.m_hookedStaminaPerSec = -1f * ((skillFactor - 1f) * 2f);
					}
					__instance.m_pullStaminaUse = 10f - 8f * skillFactor;
				}
				__instance.m_moveForce = 5f + 15f * skillFactor;
				if (MoreSkills_FishingConfig.EnableFishingAutoHook.Value)
				{
					if (skillFactor <= num / 100f)
					{
						mathAutoHook = 1f - num2 / 100f * (100f / num * skillFactor);
					}
					else
					{
						mathAutoHook = 1f - num2 / 100f * 1f;
					}
					if (Random.value > mathAutoHook && (Object)(object)__instance.m_nibbler != (Object)null && Time.time - __instance.m_nibbleTime < 5f && (Object)(object)__instance.GetCatch() == (Object)null)
					{
						Fish nibbler = __instance.m_nibbler;
						__instance.Message("$msg_fishing_hooked", true);
						__instance.SetCatch(nibbler);
					}
				}
			}
		}

		[HarmonyPatch(typeof(Fish), "CustomFixedUpdate")]
		public static class Fish_SpeedNHeight_Patch
		{
			public static bool Prefix(ref float ___m_speed, ref float ___m_height, ref Fish __instance)
			{
				if ((Object)(object)MoreSkills_Instances._player != (Object)null && MoreSkills_FishingConfig.EnableFishingSkill.Value && MoreSkills_FishingConfig.EnableFishVariety.Value)
				{
					if (__instance.m_nview.GetZDO().GetFloat("fishspeed", -1f) != -1f)
					{
						___m_speed = __instance.m_nview.GetZDO().GetFloat("fishspeed", 0f);
						__instance.m_nview.GetZDO().Set("fishspeed", -1f);
					}
					if (__instance.m_nview.GetZDO().GetFloat("fishheight", -1f) != -1f)
					{
						___m_height = __instance.m_nview.GetZDO().GetFloat("fishheight", 0f);
						__instance.m_nview.GetZDO().Set("fishheight", -1f);
					}
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(Fish), "CustomFixedUpdate")]
		public static class Fish_VarietyNMods_Patch
		{
			public static void Postfix(ref Fish __instance, ref float ___m_speed, ref float ___m_height)
			{
				//IL_0056: Unknown result type (might be due to invalid IL or missing references)
				//IL_005b: Unknown result type (might be due to invalid IL or missing references)
				//IL_015c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0183: Unknown result type (might be due to invalid IL or missing references)
				//IL_0199: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
				//IL_0203: Unknown result type (might be due to invalid IL or missing references)
				//IL_0302: Unknown result type (might be due to invalid IL or missing references)
				//IL_030e: Unknown result type (might be due to invalid IL or missing references)
				//IL_031b: Unknown result type (might be due to invalid IL or missing references)
				//IL_036a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0376: Unknown result type (might be due to invalid IL or missing references)
				//IL_0383: Unknown result type (might be due to invalid IL or missing references)
				//IL_03a4: Unknown result type (might be due to invalid IL or missing references)
				//IL_03b0: Unknown result type (might be due to invalid IL or missing references)
				//IL_03bd: Unknown result type (might be due to invalid IL or missing references)
				if (!((Object)(object)MoreSkills_Instances._player != (Object)null) || !MoreSkills_FishingConfig.EnableFishingSkill.Value)
				{
					return;
				}
				string FishName = ((Object)__instance).name.Replace("(Clone)", "");
				string text = FishName;
				ZDOID zDOID = __instance.GetZDOID();
				string FNZDOID = text + ":" + ((object)(ZDOID)(ref zDOID)).ToString();
				Helper.FishStats fishStats = fStats.Find((Helper.FishStats fstat) => fstat.FishName == FishName);
				Helper.FishSizes fishSizes = fSizes.Find((Helper.FishSizes fsize) => fsize.FishNameZDOID == FNZDOID);
				float skillFactor = ((Character)MoreSkills_Instances._player).GetSkillFactor((SkillType)706);
				if (MoreSkills_FishingConfig.EnableFishVariety.Value && fishSizes.FishNameZDOID != FNZDOID)
				{
					float num = Random.Range(0.25f, 2f);
					float num2 = Random.Range(-1f * (num * 0.5f), num * 0.5f);
					float num3 = Random.Range(-1f * (num * 0.5f), num * 0.5f);
					Vector3 val = default(Vector3);
					val.x = num + num2;
					val.y = num;
					val.z = num + num3;
					((Component)__instance.m_body).transform.localScale = val;
					__instance.m_nview.GetZDO().Set("fishspeed", ___m_speed / ((((Component)__instance.m_body).transform.localScale.x + ((Component)__instance.m_body).transform.localScale.y + ((Component)__instance.m_body).transform.localScale.z) / 3f));
					__instance.m_nview.GetZDO().Set("fishheight", ___m_height * ((Component)__instance.m_body).transform.localScale.y);
					fSizes.Add(new Helper.FishSizes(FNZDOID, val, __instance.m_height, __instance.m_speed));
				}
				if (!MoreSkills_FishingConfig.EnableFishingStaminaMod.Value && !MoreSkills_FishingConfig.EnableFishStackMod.Value && !MoreSkills_FishingConfig.EnableFishBaseHookMod.Value)
				{
					return;
				}
				if (fishStats.FishName != FishName)
				{
					fStats.Add(new Helper.FishStats(FishName, __instance.m_baseHookChance, __instance.m_pickupItemStackSize, __instance.m_staminaUse));
				}
				if (fishStats.FishName == FishName)
				{
					if (MoreSkills_FishingConfig.EnableFishBaseHookMod.Value)
					{
						__instance.m_baseHookChance = fishStats.BHookChance + (1f - fishStats.BHookChance) * skillFactor;
					}
					if (MoreSkills_FishingConfig.EnableFishStackMod.Value)
					{
						__instance.m_pickupItemStackSize = fishStats.ItemStackSize + Mathf.RoundToInt((float)fishStats.ItemStackSize * ((fishSizes.FishSize.x + fishSizes.FishSize.y + fishSizes.FishSize.z) / 3f) * (MoreSkills_FishingConfig.FishDropMultiplier.Value - 1f) * skillFactor);
					}
					if (MoreSkills_FishingConfig.EnableFishingStaminaMod.Value)
					{
						__instance.m_staminaUse = fishStats.StaminaUse * ((fishSizes.FishSize.x + fishSizes.FishSize.y + fishSizes.FishSize.z) / 3f / 2f) - fishStats.StaminaUse * ((fishSizes.FishSize.x + fishSizes.FishSize.y + fishSizes.FishSize.z) / 3f / 2f) / 4f * 3f * skillFactor;
					}
				}
			}
		}

		[HarmonyPatch(typeof(FishingFloat), "FixedUpdate")]
		public class FishingSkill_RaiseSkill
		{
			public static float FishingSkillIncrease;

			public static float oldLength;

			public static bool sOldLength;

			public static void Postfix(ref FishingFloat __instance)
			{
				//IL_0069: Unknown result type (might be due to invalid IL or missing references)
				//IL_006e: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
				//IL_0102: Unknown result type (might be due to invalid IL or missing references)
				//IL_010f: Unknown result type (might be due to invalid IL or missing references)
				if (!((Object)(object)MoreSkills_Instances._player != (Object)null) || !MoreSkills_FishingConfig.EnableFishingSkill.Value)
				{
					return;
				}
				if ((Object)(object)__instance.GetCatch() != (Object)null)
				{
					string text = ((Object)__instance.GetCatch()).name.Replace("(Clone)", "");
					ZDOID zDOID = __instance.GetCatch().GetZDOID();
					string FNZDOID = text + ":" + ((object)(ZDOID)(ref zDOID)).ToString();
					Helper.FishSizes fishSizes = fSizes.Find((Helper.FishSizes fsize) => fsize.FishNameZDOID == FNZDOID);
					if (!sOldLength)
					{
						oldLength = __instance.m_lineLength;
						sOldLength = true;
					}
					if (oldLength - __instance.m_lineLength > 0f)
					{
						FishingSkillIncrease += (oldLength - __instance.m_lineLength) / 2f * ((fishSizes.FishSize.x + fishSizes.FishSize.y + fishSizes.FishSize.z) / 3f);
						oldLength = 0f;
						sOldLength = false;
					}
					if (FishingSkillIncrease > 0.5f)
					{
						((Character)MoreSkills_Instances._player).RaiseSkill((SkillType)706, FishingSkillIncrease);
						FishingSkillIncrease = 0f;
					}
				}
				else
				{
					oldLength = 0f;
					sOldLength = false;
					__instance.m_pullStaminaUse = 0f;
				}
			}
		}

		public static List<Helper.FishStats> fStats = new List<Helper.FishStats>();

		public static List<Helper.FishSizes> fSizes = new List<Helper.FishSizes>();
	}
	internal class MoreSkills_Hunting
	{
		[HarmonyPatch(typeof(CharacterDrop), "Start")]
		public static class Hunting_UpdateDrops
		{
			public static void Postfix(ref CharacterDrop __instance)
			{
				if (!((Object)(object)MoreSkills_Instances._player != (Object)null) || !MoreSkills_HuntingConfig.EnableHuntingSkill.Value)
				{
					return;
				}
				bool value = MoreSkills_HuntingConfig.EnableHuntingMinMaxMod.Value;
				bool value2 = MoreSkills_HuntingConfig.EnableHuntingChanceMod.Value;
				float skillFactor = ((Character)MoreSkills_Instances._player).GetSkillFactor((SkillType)704);
				float num = MoreSkills_HuntingConfig.HuntingDropMultiplier.Value - 1f;
				foreach (Drop drop in __instance.m_drops)
				{
					float num2 = 0f;
					float num3 = 0f;
					float num4 = 0f;
					string nameprefab = string.Concat(((Object)__instance).name + ":" + (object)drop.m_prefab);
					string creaturePrefab = hDrops.Find((Helper.HuntingDrops hDrop) => hDrop.CreaturePrefab == nameprefab).CreaturePrefab;
					if (nameprefab != hDrops.Find((Helper.HuntingDrops hDrop) => hDrop.CreaturePrefab == nameprefab).CreaturePrefab)
					{
						hDrops.Add(new Helper.HuntingDrops(nameprefab, drop.m_amountMax, drop.m_amountMin, drop.m_chance));
						Utilities.Log("Hunting: Added Creature to the Temporal Hunting Database", "Postfix");
					}
					if ((!MoreSkills_HuntingConfig.EnableHuntingNormalMobsMod.Value && (!((Object)drop.m_prefab).name.Contains("Trophy") || !((Object)drop.m_prefab).name.Contains("Blob"))) || (!MoreSkills_HuntingConfig.EnableHuntingTrophyMod.Value && ((Object)drop.m_prefab).name.Contains("Trophy")) || (!MoreSkills_HuntingConfig.EnableHuntingBlobSpawn.Value && ((Object)drop.m_prefab).name.Contains("Blob")))
					{
						break;
					}
					if (!(nameprefab == hDrops.Find((Helper.HuntingDrops hDrop) => hDrop.CreaturePrefab == nameprefab).CreaturePrefab))
					{
						continue;
					}
					num2 = hDrops.Find((Helper.HuntingDrops hDrop) => hDrop.CreaturePrefab == nameprefab).Min;
					num3 = hDrops.Find((Helper.HuntingDrops hDrop) => hDrop.CreaturePrefab == nameprefab).Max;
					num4 = hDrops.Find((Helper.HuntingDrops hDrop) => hDrop.CreaturePrefab == nameprefab).Chance;
					if (MoreSkills_HuntingConfig.EnableTrialsOfOdinCompatibility.Value)
					{
						if (__instance.m_character.GetLevel() >= MoreSkills_HuntingConfig.ToOLowLevelStart.Value && __instance.m_character.GetLevel() < MoreSkills_HuntingConfig.ToOMidLevelStart.Value)
						{
							CLevel = 1;
						}
						else if (__instance.m_character.GetLevel() >= MoreSkills_HuntingConfig.ToOMidLevelStart.Value && __instance.m_character.GetLevel() < MoreSkills_HuntingConfig.ToOHighLevelStart.Value)
						{
							CLevel = 2;
						}
						else if (__instance.m_character.GetLevel() >= MoreSkills_HuntingConfig.ToOHighLevelStart.Value)
						{
							CLevel = 3;
						}
					}
					else
					{
						CLevel = __instance.m_character.GetLevel();
					}
					if (value)
					{
						if ((double)skillFactor > 0.5)
						{
							float num5 = Mathf.Round(num3 * num);
							drop.m_amountMax = (int)((num3 + num5) * (float)CLevel);
							float num6 = skillFactor * num;
							float num7 = Mathf.Round(num2 * num6);
							drop.m_amountMin = (int)((num2 + num7) * (float)CLevel);
						}
						else
						{
							float num8 = skillFactor * 2f * num;
							float num9 = Mathf.Round(num3 * num8);
							drop.m_amountMax = (int)((num3 + num9) * (float)CLevel);
						}
					}
					if (value2)
					{
						drop.m_chance = num4 + (1f - num4) * skillFactor;
					}
				}
			}
		}

		[HarmonyPatch(typeof(CharacterDrop), "OnDeath")]
		public static class Hunting_RaiseSkill
		{
			public static float HuntIncrease;

			public static void Postfix(ref CharacterDrop __instance)
			{
				//IL_0023: Unknown result type (might be due to invalid IL or missing references)
				//IL_002d: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)MoreSkills_Instances._player != (Object)null && MoreSkills_HuntingConfig.EnableHuntingSkill.Value)
				{
					if (MoreSkills_Instances._CDAttacker == ((Character)MoreSkills_Instances._player).GetZDOID())
					{
						HuntIncrease += __instance.m_character.GetMaxHealth() / 20f * (float)CLevel;
					}
					if (HuntIncrease > 0.1f)
					{
						((Character)MoreSkills_Instances._player).RaiseSkill((SkillType)704, HuntIncrease);
						HuntIncrease = 0f;
					}
				}
			}
		}

		public static int CLevel;

		public static List<Helper.HuntingDrops> hDrops = new List<Helper.HuntingDrops>();
	}
	internal class MoreSkills_Taming
	{
		[HarmonyPatch(typeof(Tameable), "OnConsumedItem")]
		public static class SetTamer
		{
			public static void Postfix(ref Tameable __instance)
			{
				//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
				//IL_0101: Unknown result type (might be due to invalid IL or missing references)
				//IL_0106: Unknown result type (might be due to invalid IL or missing references)
				//IL_11b0: Unknown result type (might be due to invalid IL or missing references)
				//IL_11b5: Unknown result type (might be due to invalid IL or missing references)
				//IL_11d3: Unknown result type (might be due to invalid IL or missing references)
				//IL_11d8: Unknown result type (might be due to invalid IL or missing references)
				//IL_1208: Unknown result type (might be due to invalid IL or missing references)
				//IL_128d: Unknown result type (might be due to invalid IL or missing references)
				//IL_1292: Unknown result type (might be due to invalid IL or missing references)
				//IL_0180: Unknown result type (might be due to invalid IL or missing references)
				//IL_0193: Unknown result type (might be due to invalid IL or missing references)
				//IL_0198: Unknown result type (might be due to invalid IL or missing references)
				bool value = MoreSkills_TamingConfig.EnableDetailedLogging.Value;
				if (value)
				{
					Utilities.Log("Running OnConsumedItem...", "Postfix");
				}
				if (!((Object)(object)MoreSkills_Instances._player != (Object)null) || !MoreSkills_TamingConfig.EnableTamingSkill.Value)
				{
					return;
				}
				if (value)
				{
					Utilities.Log("OnConsumedItem: Player is there and taming skill enabled (Tameable=" + ((object)__instance)?.ToString() + ", name='" + ((Object)__instance).name + "', progress=" + __instance.GetTameness() + ", TameTimeLeft=" + __instance.m_tamingTime + ")...", "Postfix");
				}
				if (__instance.GetTameness() >= 100 || __instance.m_character.IsTamed() || __instance.m_character.IsPlayer())
				{
					return;
				}
				Player val = null;
				ZDOID none = ZDOID.None;
				string @string = __instance.m_nview.GetZDO().GetString("TamerID", "");
				if (value)
				{
					Utilities.Log("OnConsumedItem: " + ((@string == "") ? "start taming" : ("continue taming TamerID=" + @string)), "Postfix");
				}
				if (!(@string == ""))
				{
					return;
				}
				try
				{
					val = Player.GetClosestPlayer(((Component)__instance).transform.position, 30f);
					none = ((Character)val).GetZDOID();
				}
				catch (Exception)
				{
					val = null;
					none = ZDOID.None;
				}
				if (none == ((Character)MoreSkills_Instances._player).GetZDOID())
				{
					if (MoreSkills_TamingConfig.EnableAllTamableCompatibility.Value)
					{
						string sCreature2 = ((Object)__instance).name.Replace("(Clone)", "");
						switch (((Object)__instance).name.Replace("(Clone)", ""))
						{
						case "Blob":
							Masterlvl1 = MoreSkills_TamingConfig.BlobLevelMaster.Value;
							Tamerlvl1 = MoreSkills_TamingConfig.BlobLevelTamer.Value;
							Unlocklvl1 = MoreSkills_TamingConfig.BlobLevelTamer.Value;
							break;
						case "BlobElite":
							Masterlvl1 = MoreSkills_TamingConfig.BlobEliteLevelMaster.Value;
							Tamerlvl1 = MoreSkills_TamingConfig.BlobEliteLevelTamer.Value;
							Unlocklvl1 = MoreSkills_TamingConfig.BlobEliteLevelUnlock.Value;
							break;
						case "Boar":
							Masterlvl1 = MoreSkills_TamingConfig.BoarLevelMaster.Value;
							Tamerlvl1 = MoreSkills_TamingConfig.BoarLevelTamer.Value;
							Unlocklvl1 = MoreSkills_TamingConfig.BoarLevelUnlock.Value;
							break;
						case "Deathsquito":
							Masterlvl1 = MoreSkills_TamingConfig.DeathsquitoLevelMaster.Value;
							Tamerlvl1 = MoreSkills_TamingConfig.DeathsquitoLevelTamer.Value;
							Unlocklvl1 = MoreSkills_TamingConfig.DeathsquitoLevelUnlock.Value;
							break;
						case "Hatchling":
							Masterlvl1 = MoreSkills_TamingConfig.DrakeLevelMaster.Value;
							Tamerlvl1 = MoreSkills_TamingConfig.DrakeLevelTamer.Value;
							Unlocklvl1 = MoreSkills_TamingConfig.DrakeLevelUnlock.Value;
							break;
						case "Draugr":
							Masterlvl1 = MoreSkills_TamingConfig.DraugrLevelMaster.Value;
							Tamerlvl1 = MoreSkills_TamingConfig.DraugrLevelTamer.Value;
							Unlocklvl1 = MoreSkills_TamingConfig.DraugrLevelUnlock.Value;
							break;
						case "Draugr_Elite":
							Masterlvl1 = MoreSkills_TamingConfig.DraugrEliteLevelMaster.Value;
							Tamerlvl1 = MoreSkills_TamingConfig.DraugrEliteLevelTamer.Value;
							Unlocklvl1 = MoreSkills_TamingConfig.DraugrEliteLevelUnlock.Value;
							break;
						case "Fenring":
							Masterlvl1 = MoreSkills_TamingConfig.FenringLevelMaster.Value;
							Tamerlvl1 = MoreSkills_TamingConfig.FenringLevelTamer.Value;
							Unlocklvl1 = MoreSkills_TamingConfig.FenringLevelUnlock.Value;
							break;
						case "Goblin":
							Masterlvl1 = MoreSkills_TamingConfig.GoblinLevelMaster.Value;
							Tamerlvl1 = MoreSkills_TamingConfig.GoblinLevelTamer.Value;
							Unlocklvl1 = MoreSkills_TamingConfig.GoblinLevelUnlock.Value;
							break;
						case "GoblinBrute":
							Masterlvl1 = MoreSkills_TamingConfig.GoblinBruteLevelMaster.Value;
							Tamerlvl1 = MoreSkills_TamingConfig.GoblinBruteLevelTamer.Value;
							Unlocklvl1 = MoreSkills_TamingConfig.GoblinBruteLevelUnlock.Value;
							break;
						case "GoblinShaman":
							Masterlvl1 = MoreSkills_TamingConfig.GoblinShamanLevelMaster.Value;
							Tamerlvl1 = MoreSkills_TamingConfig.GoblinShamanLevelTamer.Value;
							Unlocklvl1 = MoreSkills_TamingConfig.GoblinShamanLevelUnlock.Value;
							break;
						case "Greydwarf":
							Masterlvl1 = MoreSkills_TamingConfig.GreydwarfLevelMaster.Value;
							Tamerlvl1 = MoreSkills_TamingConfig.GreydwarfLevelTamer.Value;
							Unlocklvl1 = MoreSkills_TamingConfig.GreydwarfLevelUnlock.Value;
							break;
						case "Greydwarf_Elite":
							Masterlvl1 = MoreSkills_TamingConfig.GoblinBruteLevelMaster.Value;
							Tamerlvl1 = MoreSkills_TamingConfig.GoblinBruteLevelTamer.Value;
							Unlocklvl1 = MoreSkills_TamingConfig.GoblinBruteLevelUnlock.Value;
							break;
						case "Greydwarf_Shaman":
							Masterlvl1 = MoreSkills_TamingConfig.GoblinShamanLevelMaster.Value;
							Tamerlvl1 = MoreSkills_TamingConfig.GoblinShamanLevelTamer.Value;
							Unlocklvl1 = MoreSkills_TamingConfig.GoblinShamanLevelUnlock.Value;
							break;
						case "Greyling":
							Masterlvl1 = MoreSkills_TamingConfig.GreylingLevelMaster.Value;
							Tamerlvl1 = MoreSkills_TamingConfig.GreylingLevelTamer.Value;
							Unlocklvl1 = MoreSkills_TamingConfig.GreylingLevelUnlock.Value;
							break;
						case "Leech":
							Masterlvl1 = MoreSkills_TamingConfig.LeechLevelMaster.Value;
							Tamerlvl1 = MoreSkills_TamingConfig.LeechLevelTamer.Value;
							Unlocklvl1 = MoreSkills_TamingConfig.LeechLevelUnlock.Value;
							break;
						case "Lox":
							Masterlvl1 = MoreSkills_TamingConfig.LoxLevelMaster.Value;
							Tamerlvl1 = MoreSkills_TamingConfig.LoxLevelTamer.Value;
							Unlocklvl1 = MoreSkills_TamingConfig.LoxLevelUnlock.Value;
							break;
						case "Neck":
							Masterlvl1 = MoreSkills_TamingConfig.NeckLevelMaster.Value;
							Tamerlvl1 = MoreSkills_TamingConfig.NeckLevelTamer.Value;
							Unlocklvl1 = MoreSkills_TamingConfig.NeckLevelUnlock.Value;
							break;
						case "Serpent":
							Masterlvl1 = MoreSkills_TamingConfig.SerpentLevelMaster.Value;
							Tamerlvl1 = MoreSkills_TamingConfig.SerpentLevelTamer.Value;
							Unlocklvl1 = MoreSkills_TamingConfig.SerpentLevelUnlock.Value;
							break;
						case "Skeleton":
							Masterlvl1 = MoreSkills_TamingConfig.SkeletonLevelMaster.Value;
							Tamerlvl1 = MoreSkills_TamingConfig.SkeletonLevelTamer.Value;
							Unlocklvl1 = MoreSkills_TamingConfig.SkeletonLevelUnlock.Value;
							break;
						case "Skeleton_Poison":
							Masterlvl1 = MoreSkills_TamingConfig.SkeletonPoisonLevelMaster.Value;
							Tamerlvl1 = MoreSkills_TamingConfig.SkeletonPoisonLevelTamer.Value;
							Unlocklvl1 = MoreSkills_TamingConfig.SkeletonPoisonLevelUnlock.Value;
							break;
						case "StoneGolem":
							Masterlvl1 = MoreSkills_TamingConfig.StoneGolemLevelMaster.Value;
							Tamerlvl1 = MoreSkills_TamingConfig.StoneGolemLevelTamer.Value;
							Unlocklvl1 = MoreSkills_TamingConfig.StoneGolemLevelUnlock.Value;
							break;
						case "Surtling":
							Masterlvl1 = MoreSkills_TamingConfig.SurtlingLevelMaster.Value;
							Tamerlvl1 = MoreSkills_TamingConfig.SurtlingLevelTamer.Value;
							Unlocklvl1 = MoreSkills_TamingConfig.SurtlingLevelUnlock.Value;
							break;
						case "Troll":
							Masterlvl1 = MoreSkills_TamingConfig.TrollLevelMaster.Value;
							Tamerlvl1 = MoreSkills_TamingConfig.TrollLevelTamer.Value;
							Unlocklvl1 = MoreSkills_TamingConfig.TrollLevelUnlock.Value;
							break;
						case "Wolf":
							Masterlvl1 = MoreSkills_TamingConfig.WolfLevelMaster.Value;
							Tamerlvl1 = MoreSkills_TamingConfig.WolfLevelTamer.Value;
							Unlocklvl1 = MoreSkills_TamingConfig.WolfLevelUnlock.Value;
							break;
						case "Wraith":
							Masterlvl1 = MoreSkills_TamingConfig.WraithLevelMaster.Value;
							Tamerlvl1 = MoreSkills_TamingConfig.WraithLevelTamer.Value;
							Unlocklvl1 = MoreSkills_TamingConfig.WraithLevelUnlock.Value;
							break;
						case "Eikthyr":
							Masterlvl1 = MoreSkills_TamingConfig.EikthyrLevelMaster.Value;
							Tamerlvl1 = MoreSkills_TamingConfig.EikthyrLevelTamer.Value;
							Unlocklvl1 = MoreSkills_TamingConfig.EikthyrLevelUnlock.Value;
							break;
						case "gd_king":
							Masterlvl1 = MoreSkills_TamingConfig.ElderLevelMaster.Value;
							Tamerlvl1 = MoreSkills_TamingConfig.ElderLevelTamer.Value;
							Unlocklvl1 = MoreSkills_TamingConfig.ElderLevelUnlock.Value;
							break;
						case "Bonemass":
							Masterlvl1 = MoreSkills_TamingConfig.BonemassLevelMaster.Value;
							Tamerlvl1 = MoreSkills_TamingConfig.BonemassLevelTamer.Value;
							Unlocklvl1 = MoreSkills_TamingConfig.BonemassLevelUnlock.Value;
							break;
						case "Dragon":
							Masterlvl1 = MoreSkills_TamingConfig.DragonLevelMaster.Value;
							Tamerlvl1 = MoreSkills_TamingConfig.DragonLevelTamer.Value;
							Unlocklvl1 = MoreSkills_TamingConfig.DragonLevelUnlock.Value;
							break;
						case "GoblinKing":
							Masterlvl1 = MoreSkills_TamingConfig.GoblinKingLevelMaster.Value;
							Tamerlvl1 = MoreSkills_TamingConfig.GoblinKingLevelTamer.Value;
							Unlocklvl1 = MoreSkills_TamingConfig.GoblinKingLevelUnlock.Value;
							break;
						case "RRR_GDThornweaver":
							Masterlvl1 = MoreSkills_TamingConfig.RRRGDThornweaverLevelMaster.Value;
							Tamerlvl1 = MoreSkills_TamingConfig.RRRGDThornweaverLevelTamer.Value;
							Unlocklvl1 = MoreSkills_TamingConfig.RRRGDThornweaverLevelUnlock.Value;
							break;
						case "RRR_GhostVengeful":
							Masterlvl1 = MoreSkills_TamingConfig.RRRGhostVengefulLevelMaster.Value;
							Tamerlvl1 = MoreSkills_TamingConfig.RRRGhostVengefulLevelTamer.Value;
							Unlocklvl1 = MoreSkills_TamingConfig.RRRGhostVengefulLevelUnlock.Value;
							break;
						case "RRR_TrollTosser":
							Masterlvl1 = MoreSkills_TamingConfig.RRRTrollTosserLevelMaster.Value;
							Tamerlvl1 = MoreSkills_TamingConfig.RRRTrollTosserLevelTamer.Value;
							Unlocklvl1 = MoreSkills_TamingConfig.RRRTrollTosserLevelUnlock.Value;
							break;
						case "Ghost":
							Masterlvl1 = MoreSkills_TamingConfig.GhostLevelMaster.Value;
							Tamerlvl1 = MoreSkills_TamingConfig.GhostLevelTamer.Value;
							Unlocklvl1 = MoreSkills_TamingConfig.GhostLevelUnlock.Value;
							break;
						default:
							Masterlvl1 = 30f;
							Tamerlvl1 = 60f;
							Unlocklvl1 = 90f;
							if (tLevels.Find((Helper.TamingLevels tLevel) => tLevel.CreatureName == sCreature2).CreatureName != sCreature2)
							{
								Utilities.LogWarning("Creature Tame Levels Missing: " + ((Object)__instance).name.Replace("(Clone)", ""), "Postfix");
								Utilities.LogWarning("Adding Creature to Temp with Default Needed Levels. Unlock 30. Tamer 60. Master 90.", "Postfix");
								Utilities.LogWarning("Report it if you want custom numbers to the creature, and the levels. Thanks!", "Postfix");
								tLevels.Add(new Helper.TamingLevels(sCreature2, Masterlvl1, Tamerlvl1, Unlocklvl1, __instance.m_tamingTime));
							}
							break;
						}
						if (tLevels.Find((Helper.TamingLevels tLevel) => tLevel.CreatureName == s