Decompiled source of WackyEpicMMOSystem v1.8.99

EpicMMOSystem.dll

Decompiled 3 weeks ago
using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Dynamic;
using System.Globalization;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using System.Xml.Serialization;
using API;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using EpicMMOSystem;
using EpicMMOSystem.Gui;
using EpicMMOSystem.MonoScripts;
using EpicMMOSystem.OtherApi;
using Groups;
using HarmonyLib;
using ItemManager;
using JetBrains.Annotations;
using LocalizationManager;
using Microsoft.CodeAnalysis;
using PieceManager;
using ServerSync;
using StatusEffectManager;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.UI;
using YamlDotNet.Core;
using YamlDotNet.Core.Events;
using YamlDotNet.Core.Tokens;
using YamlDotNet.Helpers;
using YamlDotNet.Serialization;
using YamlDotNet.Serialization.Converters;
using YamlDotNet.Serialization.EventEmitters;
using YamlDotNet.Serialization.NamingConventions;
using YamlDotNet.Serialization.NodeDeserializers;
using YamlDotNet.Serialization.NodeTypeResolvers;
using YamlDotNet.Serialization.ObjectFactories;
using YamlDotNet.Serialization.ObjectGraphTraversalStrategies;
using YamlDotNet.Serialization.ObjectGraphVisitors;
using YamlDotNet.Serialization.Schemas;
using YamlDotNet.Serialization.TypeInspectors;
using YamlDotNet.Serialization.TypeResolvers;
using YamlDotNet.Serialization.Utilities;
using YamlDotNet.Serialization.ValueDeserializers;
using fastJSON;

[assembly: Guid("4358610B-F3F4-4843-B7AF-98B7BC60DCDE")]
[assembly: ComVisible(false)]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCopyright("Copyright ©  2022")]
[assembly: AssemblyProduct("EpicMMOSystem")]
[assembly: AssemblyCompany("WackyMoleWackyMole")]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyTitle("EpicMMOSystem")]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: CompilationRelaxations(8)]
[assembly: AssemblyFileVersion("1.8.99")]
[assembly: AssemblyConfiguration("")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.8.99.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[<b0b42568-76e9-46d9-b361-35adf4862f08>Embedded]
	internal sealed class <b0b42568-76e9-46d9-b361-35adf4862f08>EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	[CompilerGenerated]
	[<b0b42568-76e9-46d9-b361-35adf4862f08>Embedded]
	internal sealed class <acc666de-ccb0-4f25-a857-78f2ab2816dd>NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public <acc666de-ccb0-4f25-a857-78f2ab2816dd>NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public <acc666de-ccb0-4f25-a857-78f2ab2816dd>NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	[<b0b42568-76e9-46d9-b361-35adf4862f08>Embedded]
	[CompilerGenerated]
	internal sealed class <258b29e1-5f67-4899-be27-dce96aac876f>NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public <258b29e1-5f67-4899-be27-dce96aac876f>NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
[<258b29e1-5f67-4899-be27-dce96aac876f>NullableContext(1)]
[<acc666de-ccb0-4f25-a857-78f2ab2816dd>Nullable(0)]
public class ColorUtil
{
	public static Color GetColorFromHex(string hex)
	{
		//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
		hex = hex.TrimStart(new char[1] { '#' });
		Color result = default(Color);
		((Color)(ref result))..ctor(255f, 0f, 0f);
		if (hex.Length >= 6)
		{
			result.r = int.Parse(hex.Substring(0, 2), NumberStyles.HexNumber);
			result.g = int.Parse(hex.Substring(2, 2), NumberStyles.HexNumber);
			result.b = int.Parse(hex.Substring(4, 2), NumberStyles.HexNumber);
			if (hex.Length == 8)
			{
				result.a = int.Parse(hex.Substring(6, 2), NumberStyles.HexNumber);
			}
		}
		return result;
	}

	public static string GetHexFromColor(Color color)
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		return $"#{(int)(color.r * 255f):X2}" + $"{(int)(color.g * 255f):X2}" + $"{(int)(color.b * 255f):X2}" + $"{(int)(color.a * 255f):X2}";
	}
}
namespace API
{
	[<acc666de-ccb0-4f25-a857-78f2ab2816dd>Nullable(0)]
	[<258b29e1-5f67-4899-be27-dce96aac876f>NullableContext(1)]
	public static class EpicMMOSystem_API
	{
		[<258b29e1-5f67-4899-be27-dce96aac876f>NullableContext(0)]
		private enum API_State
		{
			NotReady,
			NotInstalled,
			Ready
		}

		[<258b29e1-5f67-4899-be27-dce96aac876f>NullableContext(0)]
		public enum Attribut
		{
			Strength,
			Agility,
			Intellect,
			Body,
			Vigour,
			Special
		}

		private static API_State state;

		private static MethodInfo eGetLevel;

		private static MethodInfo eAddExp;

		private static MethodInfo eGetAttribute;

		private static MethodInfo eSetSingleRate;

		public static int GetLevel()
		{
			int result = 0;
			Init();
			if (eGetLevel != null)
			{
				result = (int)eGetLevel.Invoke(null, null);
			}
			return result;
		}

		public static int GetAttribute(Attribut attribute)
		{
			int result = 0;
			Init();
			if (eGetAttribute != null)
			{
				result = (int)eGetAttribute.Invoke(null, new object[1] { attribute });
			}
			return result;
		}

		public static void AddExp(int value)
		{
			Init();
			eAddExp?.Invoke(null, new object[1] { value });
		}

		public static void SetSingleRate(float rate)
		{
			Init();
			eSetSingleRate?.Invoke(null, new object[1] { rate });
		}

		private static void Init()
		{
			API_State aPI_State = state;
			if ((uint)(aPI_State - 1) > 1u)
			{
				if (Type.GetType("EpicMMOSystem.EpicMMOSystem, EpicMMOSystem") == null)
				{
					state = API_State.NotInstalled;
					return;
				}
				state = API_State.Ready;
				Type? type = Type.GetType("API.EMMOS_API, EpicMMOSystem");
				eGetLevel = type.GetMethod("GetLevel", BindingFlags.Static | BindingFlags.Public);
				eAddExp = type.GetMethod("AddExp", BindingFlags.Static | BindingFlags.Public);
				eAddExp = type.GetMethod("GetAttribute", BindingFlags.Static | BindingFlags.Public);
				eSetSingleRate = type.GetMethod("SetSingleRate", BindingFlags.Static | BindingFlags.Public);
			}
		}
	}
	public static class EMMOS_API
	{
		public static int GetLevel()
		{
			return LevelSystem.Instance.getLevel();
		}

		public static void AddExp(int exp)
		{
			LevelSystem.Instance.AddExp(exp);
		}

		public static void SetSingleRate(float rate)
		{
			LevelSystem.Instance.SetSingleRate(rate);
		}

		public static int GetAttribute(EpicMMOSystem_API.Attribut attribute)
		{
			return LevelSystem.Instance.getParameter((Parameter)attribute);
		}
	}
	[PublicAPI]
	[<258b29e1-5f67-4899-be27-dce96aac876f>NullableContext(1)]
	[<acc666de-ccb0-4f25-a857-78f2ab2816dd>Nullable(0)]
	public static class Marketplace_API
	{
		[<258b29e1-5f67-4899-be27-dce96aac876f>NullableContext(0)]
		[Flags]
		public enum TerritoryFlags
		{
			None = 0,
			PushAway = 1,
			NoBuild = 2,
			NoPickaxe = 4,
			NoInteract = 8,
			NoAttack = 0x10,
			PvpOnly = 0x20,
			PveOnly = 0x40,
			PeriodicHeal = 0x80,
			PeriodicDamage = 0x100,
			IncreasedPlayerDamage = 0x200,
			IncreasedMonsterDamage = 0x400,
			NoMonsters = 0x800,
			CustomEnvironment = 0x1000,
			MoveSpeedMultiplier = 0x2000,
			NoDeathPenalty = 0x4000,
			NoPortals = 0x8000,
			PeriodicHealALL = 0x10000,
			ForceGroundHeight = 0x20000,
			ForceBiome = 0x40000,
			AddGroundHeight = 0x80000,
			NoBuildDamage = 0x100000,
			MonstersAddStars = 0x200000,
			InfiniteFuel = 0x400000,
			NoInteractItems = 0x800000,
			NoInteractCraftingStation = 0x1000000,
			NoInteractItemStands = 0x2000000,
			NoInteractChests = 0x4000000,
			NoInteractDoors = 0x8000000,
			NoStructureSupport = 0x10000000,
			NoInteractPortals = 0x20000000,
			CustomPaint = 0x40000000,
			LimitZoneHeight = int.MinValue
		}

		[<258b29e1-5f67-4899-be27-dce96aac876f>NullableContext(0)]
		[Flags]
		public enum AdditionalTerritoryFlags
		{
			None = 0,
			NoItemLoss = 1,
			SnowMask = 2,
			NoMist = 4,
			InfiniteEitr = 8,
			InfiniteStamina = 0x10,
			NoCreatureDrops = 0x20
		}

		private static readonly bool _IsInstalled;

		private static readonly MethodInfo MI_IsPlayerInsideTerritory;

		private static readonly MethodInfo MI_IsObjectInsideTerritoryWithFlag;

		private static readonly MethodInfo MI_IsObjectInsideTerritoryWithFlag_Additional;

		private static readonly MethodInfo MI_ResetTraderItems;

		private static readonly MethodInfo MI_AddTraderItem;

		private static readonly MethodInfo MI_OpenQuestJournal;

		public static bool IsInstalled()
		{
			return _IsInstalled;
		}

		public static bool IsPlayerInsideTerritory(out string name, out TerritoryFlags flags, out AdditionalTerritoryFlags additionalFlags)
		{
			flags = TerritoryFlags.None;
			additionalFlags = AdditionalTerritoryFlags.None;
			name = "";
			if (!_IsInstalled || MI_IsPlayerInsideTerritory == null)
			{
				return false;
			}
			object[] array = new object[3] { "", 0, 0 };
			bool result = (bool)MI_IsPlayerInsideTerritory.Invoke(null, array);
			name = (string)array[0];
			flags = (TerritoryFlags)array[1];
			additionalFlags = (AdditionalTerritoryFlags)array[2];
			return result;
		}

		public static bool IsObjectInsideTerritoryWithFlag(GameObject go, TerritoryFlags flag, out string name, out TerritoryFlags flags, out AdditionalTerritoryFlags additionalFlags)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			return IsPointInsideTerritoryWithFlag(go.transform.position, flag, out name, out flags, out additionalFlags);
		}

		public static bool IsObjectInsideTerritoryWithFlag(GameObject go, AdditionalTerritoryFlags flag, out string name, out TerritoryFlags flags, out AdditionalTerritoryFlags additionalFlags)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			return IsPointInsideTerritoryWithFlag(go.transform.position, flag, out name, out flags, out additionalFlags);
		}

		public static bool IsPointInsideTerritoryWithFlag(Vector3 pos, TerritoryFlags flag, out string name, out TerritoryFlags flags, out AdditionalTerritoryFlags additionalFlags)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			name = "";
			flags = TerritoryFlags.None;
			additionalFlags = AdditionalTerritoryFlags.None;
			if (!_IsInstalled || MI_IsObjectInsideTerritoryWithFlag == null)
			{
				return false;
			}
			object[] array = new object[5]
			{
				pos,
				(int)flag,
				"",
				0,
				0
			};
			bool result = (bool)MI_IsObjectInsideTerritoryWithFlag.Invoke(null, array);
			name = (string)array[2];
			flags = (TerritoryFlags)array[3];
			additionalFlags = (AdditionalTerritoryFlags)array[4];
			return result;
		}

		public static bool IsPointInsideTerritoryWithFlag(Vector3 pos, AdditionalTerritoryFlags flag, out string name, out TerritoryFlags flags, out AdditionalTerritoryFlags additionalFlags)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			name = "";
			flags = TerritoryFlags.None;
			additionalFlags = AdditionalTerritoryFlags.None;
			if (!_IsInstalled || MI_IsObjectInsideTerritoryWithFlag_Additional == null)
			{
				return false;
			}
			object[] array = new object[5]
			{
				pos,
				(int)flag,
				"",
				0,
				0
			};
			bool result = (bool)MI_IsObjectInsideTerritoryWithFlag_Additional.Invoke(null, array);
			name = (string)array[2];
			flags = (TerritoryFlags)array[3];
			additionalFlags = (AdditionalTerritoryFlags)array[4];
			return result;
		}

		public static void ResetTraderItems()
		{
			if (_IsInstalled && !(MI_ResetTraderItems == null))
			{
				MI_ResetTraderItems.Invoke(null, null);
			}
		}

		public static void OpenQuestJournal()
		{
			if (_IsInstalled && !(MI_OpenQuestJournal == null))
			{
				MI_OpenQuestJournal.Invoke(null, null);
			}
		}

		static Marketplace_API()
		{
			Type type = Type.GetType("API.ClientSide, kg.Marketplace");
			if ((object)type == null)
			{
				_IsInstalled = false;
				return;
			}
			_IsInstalled = true;
			MI_IsPlayerInsideTerritory = type.GetMethod("IsPlayerInsideTerritory", BindingFlags.Static | BindingFlags.Public);
			MI_IsObjectInsideTerritoryWithFlag = type.GetMethod("IsObjectInsideTerritoryWithFlag", BindingFlags.Static | BindingFlags.Public);
			MI_IsObjectInsideTerritoryWithFlag_Additional = type.GetMethod("IsObjectInsideTerritoryWithFlag_Additional", BindingFlags.Static | BindingFlags.Public);
			MI_ResetTraderItems = type.GetMethod("ResetTraderItems", BindingFlags.Static | BindingFlags.Public);
			MI_OpenQuestJournal = type.GetMethod("OpenQuestJournal", BindingFlags.Static | BindingFlags.Public);
		}
	}
}
namespace EpicMMOSystem
{
	[Serializable]
	[<258b29e1-5f67-4899-be27-dce96aac876f>NullableContext(1)]
	[<acc666de-ccb0-4f25-a857-78f2ab2816dd>Nullable(0)]
	public struct Monster
	{
		public string name;

		public int minExp;

		public int maxExp;

		public int level;

		public Monster(string name, int minExp, int maxExp, int level)
		{
			this.name = name;
			this.minExp = minExp;
			this.maxExp = maxExp;
			this.level = level;
		}
	}
	public struct MonsterOld
	{
		[<acc666de-ccb0-4f25-a857-78f2ab2816dd>Nullable(1)]
		public string name;

		public int minExp;

		public int maxExp;
	}
	[Serializable]
	public class CustomLevel
	{
		[<acc666de-ccb0-4f25-a857-78f2ab2816dd>Nullable(1)]
		private Dictionary<int, int> level;
	}
	public class CustomLevels
	{
		private void generateXPCustomFile()
		{
			new Dictionary<int, int>
			{
				{ 1, 500 },
				{ 2, 1020 },
				{ 3, 1561 },
				{ 4, 2123 },
				{ 5, 2708 },
				{ 6, 3316 },
				{ 7, 3949 },
				{ 8, 4607 },
				{ 9, 5291 },
				{ 10, 6003 },
				{ 11, 6743 },
				{ 12, 7513 },
				{ 13, 8313 },
				{ 14, 9146 },
				{ 15, 10012 },
				{ 16, 10912 },
				{ 17, 11849 },
				{ 18, 12823 },
				{ 19, 13836 },
				{ 20, 14889 },
				{ 21, 15985 },
				{ 22, 17124 },
				{ 23, 18309 },
				{ 24, 19541 },
				{ 25, 20823 },
				{ 26, 22156 },
				{ 27, 23542 },
				{ 28, 24984 },
				{ 29, 26483 },
				{ 30, 28042 },
				{ 31, 29664 },
				{ 32, 31351 },
				{ 33, 33105 },
				{ 34, 34929 },
				{ 35, 36826 },
				{ 36, 38799 },
				{ 37, 40851 },
				{ 38, 42985 },
				{ 39, 45205 },
				{ 40, 47513 },
				{ 41, 49913 },
				{ 42, 52410 },
				{ 43, 55006 },
				{ 44, 57706 },
				{ 45, 60515 },
				{ 46, 63435 },
				{ 47, 66473 },
				{ 48, 69632 },
				{ 49, 72917 },
				{ 50, 76334 },
				{ 51, 79887 },
				{ 52, 83582 },
				{ 53, 87426 },
				{ 54, 91423 },
				{ 55, 95580 },
				{ 56, 99903 },
				{ 57, 104399 },
				{ 58, 109075 },
				{ 59, 113938 },
				{ 60, 118995 },
				{ 61, 124255 },
				{ 62, 129725 },
				{ 63, 135414 },
				{ 64, 141331 },
				{ 65, 147484 },
				{ 66, 153884 },
				{ 67, 160539 },
				{ 68, 167460 },
				{ 69, 174659 },
				{ 70, 182145 },
				{ 71, 189931 },
				{ 72, 198028 },
				{ 73, 206449 },
				{ 74, 215207 },
				{ 75, 224316 },
				{ 76, 233788 },
				{ 77, 243640 },
				{ 78, 253885 },
				{ 79, 264541 },
				{ 80, 275622 },
				{ 81, 287147 },
				{ 82, 299133 },
				{ 83, 311599 },
				{ 84, 324563 },
				{ 85, 338045 },
				{ 86, 352067 },
				{ 87, 366650 },
				{ 88, 381816 },
				{ 89, 397588 },
				{ 90, 413992 },
				{ 91, 431051 },
				{ 92, 448793 },
				{ 93, 467245 },
				{ 94, 486435 },
				{ 95, 506392 },
				{ 96, 527148 },
				{ 97, 548734 },
				{ 98, 571183 },
				{ 99, 594531 },
				{ 100, 618812 }
			};
			Path.Combine(Paths.ConfigPath, "EpicMMOSystem", "If you want to stop from updating.txt");
		}

		[<258b29e1-5f67-4899-be27-dce96aac876f>NullableContext(1)]
		private string GenerateXPTableString(Dictionary<string, int> xpTable)
		{
			int num = 0;
			string text = "";
			foreach (KeyValuePair<string, int> item in xpTable)
			{
				text += ((num != 0) ? ", " : "");
				text = text + item.Key + ":" + item.Value;
				num++;
			}
			return text;
		}

		private void readXPCustomFile()
		{
		}
	}
	public class LevelSystem
	{
		[HarmonyPatch(typeof(ItemData), "GetDamage", new Type[]
		{
			typeof(int),
			typeof(float)
		})]
		private static class MiningPostfix
		{
			[<258b29e1-5f67-4899-be27-dce96aac876f>NullableContext(1)]
			private static void Postfix(ItemData __instance, ref DamageTypes __result)
			{
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				//IL_0010: Invalid comparison between Unknown and I4
				if (__instance != null && (int)__instance.m_shared.m_skillType == 12)
				{
					float num = 1f + Instance.getaddMiningDmg() / 100f;
					__result.m_pickaxe *= num;
				}
			}
		}

		[HarmonyPatch(typeof(WearNTear), "OnPlaced")]
		internal static class Player_HealthChange
		{
			[<258b29e1-5f67-4899-be27-dce96aac876f>NullableContext(1)]
			internal static void Prefix(ref WearNTear __instance)
			{
				__instance.m_health = Instance.getAddPieceHealth() + __instance.m_health;
			}
		}

		[HarmonyPatch(typeof(ItemData), "GetDamage", new Type[]
		{
			typeof(int),
			typeof(float)
		})]
		private static class TreeCuttingPostfix
		{
			[<258b29e1-5f67-4899-be27-dce96aac876f>NullableContext(1)]
			private static void Postfix(ItemData __instance, ref DamageTypes __result)
			{
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				//IL_000f: Invalid comparison between Unknown and I4
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				//IL_001e: Invalid comparison between Unknown and I4
				if (__instance != null && ((int)__instance.m_shared.m_skillType == 7 || (int)__instance.m_shared.m_skillType == 13))
				{
					float num = 1f + Instance.getAddTreeCuttingDmg() / 100f;
					__result.m_chop *= num;
				}
			}
		}

		[HarmonyPatch(typeof(Player), "GetTotalFoodValue")]
		public static class AddHp_Path
		{
			public static void Postfix(ref float hp)
			{
				float num = Instance.getAddHp() + EpicMMOSystem.addDefaultHealth.Value;
				hp += num;
			}
		}

		[HarmonyPatch(typeof(SEMan), "ModifyHealthRegen")]
		public static class RegenHp_Patch
		{
			[<258b29e1-5f67-4899-be27-dce96aac876f>NullableContext(1)]
			public static void Postfix(SEMan __instance, ref float regenMultiplier)
			{
				if (__instance.m_character.IsPlayer())
				{
					float addRegenHp = Instance.getAddRegenHp();
					regenMultiplier += addRegenHp / 100f;
				}
			}
		}

		[HarmonyPatch(typeof(Character), "RPC_Damage")]
		public static class RPC_Damage
		{
			[<258b29e1-5f67-4899-be27-dce96aac876f>NullableContext(1)]
			public static void Prefix(Character __instance, HitData hit)
			{
				if (__instance.IsPlayer() && !((Object)(object)hit.GetAttacker() == (Object)(object)__instance))
				{
					float addMagicArmor = Instance.getAddMagicArmor();
					float num = 1f - addMagicArmor / 100f;
					hit.m_damage.m_fire *= num;
					hit.m_damage.m_frost *= num;
					hit.m_damage.m_lightning *= num;
					hit.m_damage.m_poison *= num;
					hit.m_damage.m_spirit *= num;
				}
			}
		}

		[HarmonyPatch(typeof(Attack), "GetAttackStamina")]
		public static class StaminaAttack_Patch
		{
			public static void Postfix(ref float __result)
			{
				float num = 1f - Instance.getAttackStamina() / 100f;
				__result *= num;
			}
		}

		[HarmonyPatch(typeof(SEMan), "ModifyRunStaminaDrain")]
		public static class ModifyRun_Patch
		{
			public static void Postfix(ref float drain)
			{
				float num = 1f - Instance.getStaminaReduction() / 100f;
				drain *= num;
			}
		}

		[HarmonyPatch(typeof(SEMan), "ModifyJumpStaminaUsage")]
		public static class ModifyJump_Patch
		{
			public static void Postfix(ref float staminaUse)
			{
				float num = 1f - Instance.getStaminaReduction() / 100f;
				staminaUse *= num;
			}
		}

		[HarmonyPatch(typeof(SEMan), "ModifyStaminaRegen")]
		public static class RegenStamina_Patch
		{
			[<258b29e1-5f67-4899-be27-dce96aac876f>NullableContext(1)]
			public static void Postfix(SEMan __instance, ref float staminaMultiplier)
			{
				if (__instance.m_character.IsPlayer())
				{
					float staminaRegen = Instance.getStaminaRegen();
					staminaMultiplier += staminaRegen / 100f;
				}
			}
		}

		[HarmonyPatch(typeof(Player), "GetTotalFoodValue")]
		public static class AddStamina_Path
		{
			public static void Postfix(ref float stamina)
			{
				stamina += Instance.getAddStamina();
			}
		}

		[HarmonyPatch(typeof(Character), "RPC_Damage")]
		public static class PhysicArmor_Path
		{
			[<258b29e1-5f67-4899-be27-dce96aac876f>NullableContext(1)]
			public static void Prefix(Character __instance, HitData hit)
			{
				if (__instance.IsPlayer() && !((Object)(object)hit.GetAttacker() == (Object)(object)__instance))
				{
					float addPhysicArmor = Instance.getAddPhysicArmor();
					float num = 1f - addPhysicArmor / 100f;
					hit.m_damage.m_blunt *= num;
					hit.m_damage.m_slash *= num;
					hit.m_damage.m_pierce *= num;
					hit.m_damage.m_chop *= num;
					hit.m_damage.m_pickaxe *= num;
				}
			}
		}

		[HarmonyPatch(typeof(Player), "GetTotalFoodValue")]
		public static class AddEitrFood_Path
		{
			public static void Postfix(ref float eitr)
			{
				if (eitr > 2f || EpicMMOSystem.addDefaultEitr.Value > 0f)
				{
					float addEitr = Instance.getAddEitr();
					eitr += addEitr + EpicMMOSystem.addDefaultEitr.Value;
				}
			}
		}

		[HarmonyPatch(typeof(ItemData), "GetDamage", new Type[]
		{
			typeof(int),
			typeof(float)
		})]
		public class AddDamageIntellect_Path
		{
			[<258b29e1-5f67-4899-be27-dce96aac876f>NullableContext(1)]
			public static void Postfix(ref ItemData __instance, ref DamageTypes __result)
			{
				if (!((Object)(object)Player.m_localPlayer == (Object)null) && ((Humanoid)Player.m_localPlayer).m_inventory.ContainsItem(__instance))
				{
					float num = Instance.getAddMagicDamage() / 100f + 1f;
					__result.m_fire *= num;
					__result.m_frost *= num;
					__result.m_lightning *= num;
					__result.m_poison *= num;
					__result.m_spirit *= num;
				}
			}
		}

		[HarmonyPatch(typeof(SEMan), "ModifyEitrRegen")]
		public static class RegenEitr_Patch
		{
			[<258b29e1-5f67-4899-be27-dce96aac876f>NullableContext(1)]
			public static void Postfix(SEMan __instance, ref float eitrMultiplier)
			{
				if (__instance.m_character.IsPlayer())
				{
					float eitrRegen = Instance.getEitrRegen();
					eitrMultiplier += eitrRegen / 100f;
				}
			}
		}

		[HarmonyPatch(typeof(ItemData), "GetDamage", new Type[]
		{
			typeof(int),
			typeof(float)
		})]
		public class AddDamageStrength_Path
		{
			[<258b29e1-5f67-4899-be27-dce96aac876f>NullableContext(1)]
			public static void Postfix(ref ItemData __instance, ref DamageTypes __result)
			{
				if (!((Object)(object)Player.m_localPlayer == (Object)null) && ((Humanoid)Player.m_localPlayer).m_inventory.ContainsItem(__instance))
				{
					float num = Instance.getAddPhysicDamage() / 100f + 1f;
					__result.m_blunt *= num;
					__result.m_slash *= num;
					__result.m_pierce *= num;
					__result.m_chop *= num;
					__result.m_pickaxe *= num;
				}
			}
		}

		[HarmonyPatch(typeof(Player), "GetMaxCarryWeight")]
		public class AddWeight_Path
		{
			private static void Postfix(ref float __result)
			{
				float num = Instance.getAddWeight() + EpicMMOSystem.addDefaultWeight.Value;
				__result += (float)Math.Round(num);
			}
		}

		[HarmonyPatch(typeof(Humanoid), "BlockAttack")]
		private static class Humanoid_BlockAttack_Patch
		{
			private static float ReturnMyValue()
			{
				return 1f - Instance.getReducedStaminaBlock() / 100f;
			}

			[HarmonyTranspiler]
			[<258b29e1-5f67-4899-be27-dce96aac876f>NullableContext(1)]
			private static IEnumerable<CodeInstruction> StaminaBlock(IEnumerable<CodeInstruction> code)
			{
				MethodInfo method = AccessTools.DeclaredMethod(typeof(Character), "UseStamina", (Type[])null, (Type[])null);
				MethodInfo MyMethod = AccessTools.DeclaredMethod(typeof(Humanoid_BlockAttack_Patch), "ReturnMyValue", (Type[])null, (Type[])null);
				List<CodeInstruction> instructions = new List<CodeInstruction>(code);
				for (int i = 0; i < instructions.Count; i++)
				{
					if (i < instructions.Count - 1)
					{
						CodeInstruction val = instructions[i + 1];
						if (val.opcode == OpCodes.Callvirt && val.operand == method)
						{
							yield return new CodeInstruction(OpCodes.Call, (object)MyMethod);
							yield return new CodeInstruction(OpCodes.Mul, (object)null);
						}
					}
					yield return instructions[i];
				}
			}
		}

		[HarmonyPatch(typeof(Character), "ApplyDamage")]
		public class AddCritDmg
		{
			[<258b29e1-5f67-4899-be27-dce96aac876f>NullableContext(1)]
			private static void Prefix(Character __instance, ref bool showDamageText, ref HitData hit)
			{
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_002a: Unknown result type (might be due to invalid IL or missing references)
				//IL_011a: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)__instance != (Object)null && hit.HaveAttacker() && (int)__instance.m_faction != 0 && (int)hit.GetAttacker().m_faction == 0 && Random.Range(0f, 100f) < Instance.getAddCriticalChance())
				{
					float num = 1f + Instance.getAddCriticalDmg() / 100f;
					hit.m_damage.m_blunt *= num;
					hit.m_damage.m_slash *= num;
					hit.m_damage.m_pierce *= num;
					hit.m_damage.m_chop *= num;
					hit.m_damage.m_pickaxe *= num;
					hit.m_damage.m_fire *= num;
					hit.m_damage.m_frost *= num;
					hit.m_damage.m_lightning *= num;
					hit.m_damage.m_poison *= num;
					hit.m_damage.m_spirit *= num;
					new CritDmgVFX().CriticalVFX(hit.m_point, hit.GetTotalDamage());
					showDamageText = false;
					EpicMMOSystem.MLLogger.LogInfo((object)("You got a Critical Hit with damage of " + hit.GetTotalDamage()));
				}
			}
		}

		[<acc666de-ccb0-4f25-a857-78f2ab2816dd>Nullable(1)]
		private CultureInfo invC = CultureInfo.InvariantCulture;

		[<acc666de-ccb0-4f25-a857-78f2ab2816dd>Nullable(1)]
		private static LevelSystem instance;

		[<acc666de-ccb0-4f25-a857-78f2ab2816dd>Nullable(1)]
		private Dictionary<int, long> levelsExp;

		[<acc666de-ccb0-4f25-a857-78f2ab2816dd>Nullable(1)]
		private string pluginKey = "EpicMMOSystem";

		[<acc666de-ccb0-4f25-a857-78f2ab2816dd>Nullable(1)]
		private const string midleKey = "LevelSystem";

		[<acc666de-ccb0-4f25-a857-78f2ab2816dd>Nullable(1)]
		private int[] depositPoint = new int[6];

		private float singleRate;

		[<acc666de-ccb0-4f25-a857-78f2ab2816dd>Nullable(1)]
		public static LevelSystem Instance
		{
			[<258b29e1-5f67-4899-be27-dce96aac876f>NullableContext(1)]
			get
			{
				if (instance == null)
				{
					instance = new LevelSystem();
					return instance;
				}
				return instance;
			}
		}

		public float getaddMiningDmg()
		{
			int parameter = getParameter(Parameter.Special);
			float value = EpicMMOSystem.miningSpeed.Value;
			return (float)parameter * value;
		}

		public float getAddPieceHealth()
		{
			int parameter = getParameter(Parameter.Special);
			float value = EpicMMOSystem.constructionPieceHealth.Value;
			return (float)parameter * value;
		}

		public float getAddTreeCuttingDmg()
		{
			int parameter = getParameter(Parameter.Special);
			float value = EpicMMOSystem.treeCuttingSpeed.Value;
			return (float)parameter * value;
		}

		public float getAddHp()
		{
			int parameter = getParameter(Parameter.Vigour);
			float value = EpicMMOSystem.addHp.Value;
			return (float)parameter * value;
		}

		public float getAddRegenHp()
		{
			int parameter = getParameter(Parameter.Vigour);
			float value = EpicMMOSystem.regenHp.Value;
			return (float)parameter * value;
		}

		public float getAddMagicArmor()
		{
			int parameter = getParameter(Parameter.Vigour);
			float value = EpicMMOSystem.magicArmor.Value;
			return (float)parameter * value;
		}

		public LevelSystem()
		{
			FillLevelsExp();
		}

		public int getLevel()
		{
			if (!Object.op_Implicit((Object)(object)Player.m_localPlayer))
			{
				return 1;
			}
			if (!Player.m_localPlayer.m_knownTexts.ContainsKey(pluginKey + "_LevelSystem_Level"))
			{
				return 1;
			}
			return int.Parse(Player.m_localPlayer.m_knownTexts[pluginKey + "_LevelSystem_Level"]);
		}

		private void setLevel(int value)
		{
			if (Object.op_Implicit((Object)(object)Player.m_localPlayer))
			{
				Player.m_localPlayer.m_knownTexts[pluginKey + "_LevelSystem_Level"] = value.ToString();
			}
		}

		public void recalcLevel()
		{
			long num = getTotalExp();
			setLevel(1);
			FillLevelsExp();
			long needExp = getNeedExp();
			int num2 = 0;
			while (num > needExp)
			{
				num -= needExp;
				num2++;
				needExp = getNeedExp(num2);
			}
			setCurrentExp(num);
			setLevel(num2 + 1);
			MyUI.updateExpBar();
		}

		public long getCurrentExp()
		{
			if (!Object.op_Implicit((Object)(object)Player.m_localPlayer))
			{
				return 0L;
			}
			if (!Player.m_localPlayer.m_knownTexts.ContainsKey(pluginKey + "_LevelSystem_CurrentExp"))
			{
				return 0L;
			}
			long num = 0L;
			try
			{
				num = int.Parse(Player.m_localPlayer.m_knownTexts[pluginKey + "_LevelSystem_CurrentExp"]);
			}
			catch
			{
				Player.m_localPlayer.m_knownTexts[pluginKey + "_LevelSystem_CurrentExp"] = "1";
				num = 1L;
				EpicMMOSystem.MLLogger.LogWarning((object)"Error in getting current exp, setting exp to 1");
			}
			if (num == 1)
			{
				try
				{
					num = getTotalExp();
					Player.m_localPlayer.m_knownTexts[pluginKey + "_LevelSystem_CurrentExp"] = num.ToString(invC);
				}
				catch
				{
				}
			}
			return num;
		}

		private void setCurrentExp(long value)
		{
			if (Object.op_Implicit((Object)(object)Player.m_localPlayer))
			{
				Player.m_localPlayer.m_knownTexts[pluginKey + "_LevelSystem_CurrentExp"] = value.ToString(invC);
			}
		}

		public long getTotalExp()
		{
			if (!Object.op_Implicit((Object)(object)Player.m_localPlayer))
			{
				return 0L;
			}
			if (!Player.m_localPlayer.m_knownTexts.ContainsKey(pluginKey + "_LevelSystem_TotalExp"))
			{
				return 0L;
			}
			if (long.TryParse(Player.m_localPlayer.m_knownTexts[pluginKey + "_LevelSystem_TotalExp"], out var result))
			{
				return result;
			}
			EpicMMOSystem.MLLogger.LogWarning((object)"error on TotalExp, returned 0");
			return 0L;
		}

		private void setTotalExp(long value)
		{
			if (Object.op_Implicit((Object)(object)Player.m_localPlayer))
			{
				Player.m_localPlayer.m_knownTexts[pluginKey + "_LevelSystem_TotalExp"] = value.ToString(invC);
			}
		}

		public void addTotalExp(long value)
		{
			if (Object.op_Implicit((Object)(object)Player.m_localPlayer))
			{
				if (!Player.m_localPlayer.m_knownTexts.ContainsKey(pluginKey + "_LevelSystem_TotalExp"))
				{
					Player.m_localPlayer.m_knownTexts[pluginKey + "_LevelSystem_TotalExp"] = "1";
				}
				long num = 1L;
				num = ((!long.TryParse(Player.m_localPlayer.m_knownTexts[pluginKey + "_LevelSystem_TotalExp"], out var result)) ? value : (result + value));
				Player.m_localPlayer.m_knownTexts[pluginKey + "_LevelSystem_TotalExp"] = num.ToString(invC);
			}
		}

		private void setParameter(Parameter parameter, int value)
		{
			if (Object.op_Implicit((Object)(object)Player.m_localPlayer))
			{
				int num;
				int num2 = Mathf.Clamp(value, 0, parameter.ToString() switch
				{
					"Strength" => EpicMMOSystem.maxValueStrength.Value, 
					"Agility" => EpicMMOSystem.maxValueDexterity.Value, 
					"Intellect" => EpicMMOSystem.maxValueIntelligence.Value, 
					"Body" => EpicMMOSystem.maxValueEndurance.Value, 
					"Vigour" => EpicMMOSystem.maxValueVigour.Value, 
					"Special" => EpicMMOSystem.maxValueSpecializing.Value, 
					_ => num = 205, 
				});
				Player.m_localPlayer.m_knownTexts[pluginKey + "_LevelSystem_" + parameter] = num2.ToString();
			}
		}

		public int getParameter(Parameter parameter)
		{
			if (!Object.op_Implicit((Object)(object)Player.m_localPlayer))
			{
				return 0;
			}
			if (!Player.m_localPlayer.m_knownTexts.ContainsKey(pluginKey + "_LevelSystem_" + parameter))
			{
				return 0;
			}
			int num = int.Parse(Player.m_localPlayer.m_knownTexts[pluginKey + "_LevelSystem_" + parameter]);
			int num2;
			return Mathf.Clamp(num, 0, parameter.ToString() switch
			{
				"Strength" => EpicMMOSystem.maxValueStrength.Value, 
				"Agility" => EpicMMOSystem.maxValueDexterity.Value, 
				"Intellect" => EpicMMOSystem.maxValueIntelligence.Value, 
				"Body" => EpicMMOSystem.maxValueEndurance.Value, 
				"Vigour" => EpicMMOSystem.maxValueVigour.Value, 
				"Special" => EpicMMOSystem.maxValueSpecializing.Value, 
				_ => num2 = 205, 
			});
		}

		public int getFreePoints()
		{
			int value = EpicMMOSystem.freePointForLevel.Value;
			int value2 = EpicMMOSystem.startFreePoint.Value;
			int level = getLevel();
			int num = 0;
			try
			{
				string value3 = EpicMMOSystem.levelsForBinusFreePoint.Value;
				if (!Utility.IsNullOrWhiteSpace(value3))
				{
					string[] array = value3.Split(new char[1] { ',' });
					for (int i = 0; i < array.Length; i++)
					{
						string[] array2 = array[i].Split(new char[1] { ':' });
						if (int.Parse(array2[0]) <= level)
						{
							num += int.Parse(array2[1]);
							continue;
						}
						break;
					}
				}
			}
			catch (Exception ex)
			{
				MonoBehaviour.print((object)("Free point, bonus error: " + ex.Message));
			}
			int num2 = level * value + value2 + num;
			int num3 = 0;
			for (int j = 0; j < EpicMMOSystem.numofCats; j++)
			{
				num3 += getParameter((Parameter)j);
			}
			return num2 - num3;
		}

		public void addPointsParametr(Parameter parameter, int addPoint)
		{
			int freePoints = getFreePoints();
			if (freePoints > 0)
			{
				int num = Mathf.Clamp(addPoint, 1, freePoints);
				depositPoint[(int)parameter] += num;
				int parameter2 = getParameter(parameter);
				setParameter(parameter, parameter2 + num);
			}
		}

		public long getNeedExp(int addLvl = 0)
		{
			int key = Mathf.Clamp(getLevel() + 1 + addLvl, 1, EpicMMOSystem.maxLevel.Value);
			return levelsExp[key];
		}

		public void ResetAllParameter()
		{
			for (int i = 0; i < EpicMMOSystem.numofCats; i++)
			{
				setParameter((Parameter)i, 0);
			}
			MyUI.UpdateParameterPanel();
		}

		public void ResetAllParameterPayment()
		{
			string value = EpicMMOSystem.prefabNameCoins.Value;
			string name = ZNetScene.instance.GetPrefab(value).GetComponent<ItemDrop>().m_itemData.m_shared.m_name;
			int priceResetPoints = getPriceResetPoints();
			if (((Humanoid)Player.m_localPlayer).m_inventory.CountItems(name, -1, true) < priceResetPoints)
			{
				string name2 = ZNetScene.instance.GetPrefab("ResetTrophy").GetComponent<ItemDrop>().m_itemData.m_shared.m_name;
				if (((Humanoid)Player.m_localPlayer).m_inventory.CountItems(name2, -1, true) > 0)
				{
					((Humanoid)Player.m_localPlayer).m_inventory.RemoveItem(name2, 1, -1, true);
					ResetAllParameter();
				}
			}
			else
			{
				((Humanoid)Player.m_localPlayer).m_inventory.RemoveItem(name, priceResetPoints, -1, true);
				ResetAllParameter();
			}
		}

		public void SetSingleRate(float rate)
		{
			singleRate = rate;
		}

		public void AddExp(int exp, bool noxpMulti = false)
		{
			if (exp < 1)
			{
				if (exp == -2)
				{
					Util.FloatingText("No XP for red/blue creatures :( ");
				}
				return;
			}
			float value = EpicMMOSystem.rateExp.Value;
			float num = (float)exp * (value + singleRate);
			if (noxpMulti)
			{
				num = exp;
			}
			if (((Character)Player.m_localPlayer).m_seman.HaveStatusEffect("Potion_MMO_Greater"))
			{
				num = EpicMMOSystem.XPforGreaterPotion.Value * num;
			}
			else if (((Character)Player.m_localPlayer).m_seman.HaveStatusEffect("Potion_MMO_Medium"))
			{
				num = EpicMMOSystem.XPforMediumPotion.Value * num;
			}
			else if (((Character)Player.m_localPlayer).m_seman.HaveStatusEffect("Potion_MMO_Minor"))
			{
				num = EpicMMOSystem.XPforMinorPotion.Value * num;
			}
			long currentExp = getCurrentExp();
			long needExp = getNeedExp();
			currentExp += (int)num;
			int num2 = 0;
			while (currentExp > needExp)
			{
				currentExp -= needExp;
				num2++;
				needExp = getNeedExp(num2);
			}
			if (num2 > 0)
			{
				AddLevel(num2);
			}
			addTotalExp((int)num);
			setCurrentExp(currentExp);
			MyUI.updateExpBar();
			if (EpicMMOSystem.leftMessageXP.Value)
			{
				((Character)Player.m_localPlayer).Message((MessageType)1, string.Format("{0}: {1}", EpicMMOSystem.localizationold["$get_exp"], (int)num), 0, (Sprite)null);
			}
			num = (float)Math.Round(num);
			Util.FloatingText(EpicMMOSystem.XPstring.Value.Replace("@", num.ToString()) ?? "");
		}

		public void AddLevel(int count)
		{
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			if (count > 0)
			{
				int level = getLevel();
				level += count;
				setLevel(Mathf.Clamp(level, 1, EpicMMOSystem.maxLevel.Value));
				PlayerFVX.levelUp();
				ZDO zDO = ((Character)Player.m_localPlayer).m_nview.GetZDO();
				zDO.Set(pluginKey + "_level", level);
				ZDOMan.instance.ForceSendZDO(zDO.m_uid);
			}
		}

		public bool hasDepositPoints()
		{
			bool result = false;
			int[] array = depositPoint;
			for (int i = 0; i < array.Length; i++)
			{
				if (array[i] > 0)
				{
					result = true;
					break;
				}
			}
			return result;
		}

		public void applyDepositPoints()
		{
			for (int i = 0; i < depositPoint.Length; i++)
			{
				depositPoint[i] = 0;
			}
			MyUI.UpdateParameterPanel();
		}

		public void cancelDepositPoints()
		{
			if (!Object.op_Implicit((Object)(object)Player.m_localPlayer))
			{
				return;
			}
			for (int i = 0; i < depositPoint.Length; i++)
			{
				if (depositPoint[i] != 0)
				{
					Parameter parameter = (Parameter)i;
					int num = depositPoint[i];
					int parameter2 = getParameter(parameter);
					setParameter(parameter, parameter2 - num);
					depositPoint[i] = 0;
				}
			}
			MyUI.UpdateParameterPanel();
		}

		public int getPriceResetPoints()
		{
			int num = 0;
			for (int i = 0; i < EpicMMOSystem.numofCats; i++)
			{
				num += getParameter((Parameter)i);
			}
			return num * EpicMMOSystem.priceResetPoints.Value;
		}

		public void DeathPlayer()
		{
			if (EpicMMOSystem.lossExp.Value && Player.m_localPlayer.HardDeath())
			{
				float value = EpicMMOSystem.minLossExp.Value;
				float value2 = EpicMMOSystem.maxLossExp.Value;
				float num = 1f - Random.Range(value, value2);
				long totalExp = getTotalExp();
				long currentExp = getCurrentExp();
				long currentExp2 = (long)((float)currentExp * num);
				setCurrentExp(currentExp2);
				setTotalExp(totalExp - (long)((float)currentExp * num));
				MyUI.updateExpBar();
			}
		}

		public void FillLevelsExp()
		{
			int value = EpicMMOSystem.levelExp.Value;
			float value2 = EpicMMOSystem.multiNextLevel.Value;
			int value3 = EpicMMOSystem.maxLevel.Value;
			levelsExp = new Dictionary<int, long>();
			if (EpicMMOSystem.levelexpforeachlevel.Value)
			{
				long num = 0L;
				for (int i = 1; i <= value3; i++)
				{
					num = (long)Math.Round((float)num * value2 + (float)value);
					levelsExp[i + 1] = num;
				}
			}
			else
			{
				long num2 = value;
				for (int j = 1; j <= value3; j++)
				{
					num2 = (long)Math.Round((float)num2 * value2);
					levelsExp[j + 1] = num2;
				}
			}
		}

		public void terminalSetLevel(int value)
		{
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			int num = Mathf.Clamp(value, 1, EpicMMOSystem.maxLevel.Value);
			setLevel(num);
			setCurrentExp(0L);
			ResetAllParameter();
			PlayerFVX.levelUp();
			MyUI.updateExpBar();
			ZDO zDO = ((Character)Player.m_localPlayer).m_nview.GetZDO();
			zDO.Set(pluginKey + "_level", num);
			ZDOMan.instance.ForceSendZDO(zDO.m_uid);
		}

		public float getAddAttackSpeed()
		{
			int parameter = getParameter(Parameter.Agility);
			float value = EpicMMOSystem.attackSpeed.Value;
			return (float)parameter * value;
		}

		public float getAttackStamina()
		{
			int parameter = getParameter(Parameter.Agility);
			float value = EpicMMOSystem.attackStamina.Value;
			return (float)parameter * value;
		}

		public float getStaminaReduction()
		{
			int parameter = getParameter(Parameter.Agility);
			float value = EpicMMOSystem.staminaReduction.Value;
			return (float)parameter * value;
		}

		public float getStaminaRegen()
		{
			int parameter = getParameter(Parameter.Body);
			float value = EpicMMOSystem.staminaRegen.Value;
			return (float)parameter * value;
		}

		public float getAddStamina()
		{
			int parameter = getParameter(Parameter.Body);
			float value = EpicMMOSystem.addStamina.Value;
			return (float)parameter * value;
		}

		public float getAddPhysicArmor()
		{
			int parameter = getParameter(Parameter.Body);
			float value = EpicMMOSystem.physicArmor.Value;
			return (float)parameter * value;
		}

		public float getAddMagicDamage()
		{
			int parameter = getParameter(Parameter.Intellect);
			float value = EpicMMOSystem.magicDamage.Value;
			return (float)parameter * value;
		}

		public float getEitrRegen()
		{
			int parameter = getParameter(Parameter.Intellect);
			float value = EpicMMOSystem.magicEitrRegen.Value;
			return (float)parameter * value;
		}

		public float getAddEitr()
		{
			int parameter = getParameter(Parameter.Intellect);
			float value = EpicMMOSystem.addEitr.Value;
			return (float)parameter * value;
		}

		public float getAddPhysicDamage()
		{
			int parameter = getParameter(Parameter.Strength);
			float value = EpicMMOSystem.physicDamage.Value;
			return (float)parameter * value;
		}

		public float getAddWeight()
		{
			if (!Object.op_Implicit((Object)(object)Player.m_localPlayer))
			{
				return 0f;
			}
			int parameter = getParameter(Parameter.Strength);
			float value = EpicMMOSystem.addWeight.Value;
			return (float)parameter * value;
		}

		public float getReducedStaminaBlock()
		{
			int parameter = getParameter(Parameter.Strength);
			float value = EpicMMOSystem.staminaBlock.Value;
			return (float)parameter * value;
		}

		public float getAddCriticalDmg()
		{
			int parameter = getParameter(Parameter.Strength);
			float value = EpicMMOSystem.critDmg.Value;
			return (float)parameter * value + EpicMMOSystem.CriticalDefaultDamage.Value;
		}

		public float getAddCriticalChance()
		{
			int parameter = getParameter(Parameter.Special);
			float value = EpicMMOSystem.critChance.Value;
			return (float)parameter * value + EpicMMOSystem.CriticalStartChance.Value;
		}
	}
	[<258b29e1-5f67-4899-be27-dce96aac876f>NullableContext(1)]
	[<acc666de-ccb0-4f25-a857-78f2ab2816dd>Nullable(0)]
	public class FriendsData
	{
		private Dictionary<string, FriendInfo> friends = new Dictionary<string, FriendInfo>();

		public Dictionary<string, FriendInfo> getFriends()
		{
			if (friends.Count == 0)
			{
				LoadFriends();
			}
			return friends;
		}

		public void addFriends(FriendInfo friend)
		{
			if (!friends.ContainsKey(friend.name))
			{
				friends.Add(friend.name, friend);
				SaveFriends();
			}
		}

		public void updateFriends(FriendInfo friend)
		{
			friends[friend.name] = friend;
			SaveFriends();
		}

		public void deleteFriend(FriendInfo friend)
		{
			friends.Remove(friend.name);
			SaveFriends();
		}

		private void SaveFriends()
		{
			if (Object.op_Implicit((Object)(object)Player.m_localPlayer))
			{
				string text = JSON.ToJSON(friends.Values.ToArray());
				Player.m_localPlayer.m_knownTexts["EpicMMOSystem_friend_list"] = text ?? "";
			}
		}

		private void LoadFriends()
		{
			if (!Object.op_Implicit((Object)(object)Player.m_localPlayer) || !Player.m_localPlayer.m_knownTexts.ContainsKey("EpicMMOSystem_friend_list"))
			{
				return;
			}
			friends.Clear();
			FriendInfo[] array = JSON.ToObject<FriendInfo[]>(Player.m_localPlayer.m_knownTexts["EpicMMOSystem_friend_list"] ?? "");
			if (array != null)
			{
				FriendInfo[] array2 = array;
				foreach (FriendInfo friendInfo in array2)
				{
					friends.Add(friendInfo.name, friendInfo);
				}
			}
		}

		public void ClearFriend()
		{
			friends.Clear();
		}
	}
	[Serializable]
	[<acc666de-ccb0-4f25-a857-78f2ab2816dd>Nullable(0)]
	[<258b29e1-5f67-4899-be27-dce96aac876f>NullableContext(1)]
	public class FriendInfo
	{
		public string name;

		public string host;

		public int level;

		public int moClass;
	}
	[<acc666de-ccb0-4f25-a857-78f2ab2816dd>Nullable(0)]
	[<258b29e1-5f67-4899-be27-dce96aac876f>NullableContext(1)]
	public static class FriendsSystem
	{
		[HarmonyPatch(typeof(ZNetScene), "Awake")]
		[<258b29e1-5f67-4899-be27-dce96aac876f>NullableContext(0)]
		private static class ZrouteMethodsServerFeedback
		{
			private static void Postfix()
			{
				if (!isServer)
				{
					ZRoutedRpc.instance.Register<int, int>(modName + " InviteFriend", (Action<long, int, int>)RPC_InviteFriend);
					ZRoutedRpc.instance.Register<int, int>(modName + " AcceptInviteFriend", (Action<long, int, int>)RPC_AcceptFriend);
					ZRoutedRpc.instance.Register<string>(modName + " RejectInviteFriend", (Action<long, string>)RPC_RejectFriend);
				}
			}
		}

		private static bool isServer => (int)SystemInfo.graphicsDeviceType == 4;

		private static string modName => "EpicMMOSystem";

		private static Localizationold local => EpicMMOSystem.localizationold;

		public static void Init()
		{
		}

		public static void inviteFriend(string name)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			foreach (PlayerInfo player in ZNet.instance.GetPlayerList())
			{
				if (player.m_name == name)
				{
					int level = LevelSystem.Instance.getLevel();
					ZRoutedRpc instance = ZRoutedRpc.instance;
					ZDOID characterID = player.m_characterID;
					instance.InvokeRoutedRPC(((ZDOID)(ref characterID)).UserID, modName + " InviteFriend", new object[2]
					{
						level,
						((Character)Player.m_localPlayer).m_nview.GetZDO().GetInt("MagicOverhaulClass", 0)
					});
					Chat.instance.RPC_ChatMessage(200L, Vector3.zero, 0, UserInfo.GetLocalUser(), string.Format(local["$send_invite"], name), PrivilegeManager.GetNetworkUserId());
					return;
				}
			}
			Chat.instance.RPC_ChatMessage(200L, Vector3.zero, 0, UserInfo.GetLocalUser(), string.Format(local["$not_found"], name), PrivilegeManager.GetNetworkUserId());
		}

		public static void acceptInvite(FriendInfo info, PlayerInfo player)
		{
			ZRoutedRpc.instance.InvokeRoutedRPC(((ZDOID)(ref player.m_characterID)).UserID, modName + " AcceptInviteFriend", new object[2]
			{
				info.level,
				((Character)Player.m_localPlayer).m_nview.GetZDO().GetInt("MagicOverhaulClass", 0)
			});
		}

		public static void rejectInvite(FriendInfo info, PlayerInfo player)
		{
			ZRoutedRpc.instance.InvokeRoutedRPC(((ZDOID)(ref player.m_characterID)).UserID, modName + " RejectInviteFriend", new object[1] { info.name });
		}

		private static void RPC_InviteFriend(long sender, int level, int moClass)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			PlayerInfo val = ZNet.instance.GetPlayerList().Find((PlayerInfo f) => ((ZDOID)(ref f.m_characterID)).UserID == sender);
			FriendInfo friendInfo = new FriendInfo();
			friendInfo.name = val.m_name;
			friendInfo.host = val.m_host;
			friendInfo.level = level;
			friendInfo.moClass = moClass;
			Chat.instance.RPC_ChatMessage(200L, Vector3.zero, 0, UserInfo.GetLocalUser(), string.Format(local["$get_invite"], friendInfo.name), PrivilegeManager.GetNetworkUserId());
			MyUI.addInviteFriend(friendInfo, val);
		}

		private static void RPC_AcceptFriend(long sender, int level, int moClass)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			PlayerInfo val = ZNet.instance.GetPlayerList().Find((PlayerInfo f) => ((ZDOID)(ref f.m_characterID)).UserID == sender);
			FriendInfo friendInfo = new FriendInfo();
			friendInfo.name = val.m_name;
			friendInfo.host = val.m_host;
			friendInfo.level = level;
			friendInfo.moClass = moClass;
			Chat.instance.RPC_ChatMessage(200L, Vector3.zero, 0, UserInfo.GetLocalUser(), string.Format(local["$accept_invite"], friendInfo.name), PrivilegeManager.GetNetworkUserId());
			MyUI.acceptInvited(friendInfo);
		}

		private static void RPC_RejectFriend(long sender, string name)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			Chat.instance.RPC_ChatMessage(200L, Vector3.zero, 0, UserInfo.GetLocalUser(), string.Format(local["$cancel_invite"], name), PrivilegeManager.GetNetworkUserId());
		}
	}
	[<acc666de-ccb0-4f25-a857-78f2ab2816dd>Nullable(0)]
	[<258b29e1-5f67-4899-be27-dce96aac876f>NullableContext(1)]
	public static class MyUI
	{
		[HarmonyPatch(typeof(InventoryGui), "Show")]
		[<258b29e1-5f67-4899-be27-dce96aac876f>NullableContext(0)]
		public static class ShowPanel_Path
		{
			public static void Postfix()
			{
				Show();
			}
		}

		[HarmonyPatch(typeof(InventoryGui), "Hide")]
		[<258b29e1-5f67-4899-be27-dce96aac876f>NullableContext(0)]
		public static class HidePanel_Path
		{
			public static void Postfix()
			{
				Hide();
			}
		}

		[HarmonyPatch(typeof(Menu), "IsVisible")]
		[<258b29e1-5f67-4899-be27-dce96aac876f>NullableContext(0)]
		private static class BufferUIFix
		{
			private static void Postfix(ref bool __result)
			{
				if (textField.isFocused)
				{
					__result = true;
				}
			}
		}

		[<258b29e1-5f67-4899-be27-dce96aac876f>NullableContext(0)]
		[HarmonyPatch(typeof(Hud), "SetVisible")]
		public static class Vis
		{
			private static void Postfix(bool visible)
			{
				if (visible && !UIToggle && !EpicMMOSystem.oldExpBar.Value)
				{
					((Component)expPanelRoot).gameObject.SetActive(true);
					UIToggle = true;
					DragControl.SaveWindowPositions(((Component)expPanel).gameObject, initialLoad: true);
					DragControl.SaveWindowPositions(((Component)hp).gameObject, initialLoad: true);
					DragControl.SaveWindowPositions(((Component)stamina).gameObject, initialLoad: true);
				}
				if (!visible && UIToggle && !EpicMMOSystem.oldExpBar.Value)
				{
					((Component)expPanelRoot).gameObject.SetActive(false);
					UIToggle = false;
				}
			}
		}

		[<258b29e1-5f67-4899-be27-dce96aac876f>NullableContext(0)]
		[HarmonyPatch(typeof(Hud), "Awake")]
		public static class InstantiateExpPanel
		{
			[<258b29e1-5f67-4899-be27-dce96aac876f>NullableContext(1)]
			private static void Postfix(Hud __instance)
			{
				//IL_0138: Unknown result type (might be due to invalid IL or missing references)
				//IL_014c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0151: Unknown result type (might be due to invalid IL or missing references)
				if (EpicMMOSystem.oldExpBar.Value)
				{
					Transform transform = Object.Instantiate<GameObject>(EpicMMOSystem._asset.LoadAsset<GameObject>("ExpPanel"), __instance.m_rootObject.transform).transform;
					eLevelText = ((Component)transform.Find("Lvl")).GetComponent<Text>();
					eExpText = ((Component)transform.Find("Exp")).GetComponent<Text>();
					eBarImage = ((Component)transform.Find("Bar/Fill")).GetComponent<Image>();
					return;
				}
				expPanelRoot = Object.Instantiate<GameObject>(EpicMMOSystem._asset.LoadAsset<GameObject>("EpicHudPanelCanvas")).transform;
				((Component)expPanelRoot).gameObject.SetActive(false);
				InitHudPanel();
				DHpBar = ((Component)((Transform)__instance.m_healthPanel).Find("Health")).gameObject;
				IconHpBar = ((Component)((Transform)__instance.m_healthPanel).Find("healthicon")).gameObject;
				if (!EpicMMOSystem.oldExpBar.Value)
				{
					((Component)((Transform)__instance.m_healthPanel).Find("Health")).gameObject.SetActive(false);
					((Component)((Transform)__instance.m_healthPanel).Find("healthicon")).gameObject.SetActive(false);
				}
				Transform val = __instance.m_buildHud.transform.Find("SelectedInfo");
				if (Object.op_Implicit((Object)(object)val))
				{
					val.localPosition += new Vector3(0f, 45f, 0f);
				}
			}
		}

		[HarmonyPatch(typeof(Hud), "UpdateHealth")]
		[<258b29e1-5f67-4899-be27-dce96aac876f>NullableContext(0)]
		public static class UpdateHealth
		{
			[<258b29e1-5f67-4899-be27-dce96aac876f>NullableContext(1)]
			private static bool Prefix(Player player)
			{
				if (EpicMMOSystem.oldExpBar.Value)
				{
					eLevelText.text = string.Format("{0} {1}", localization["$lvl"], currentLVL);
					return true;
				}
				if (DisableHPBar)
				{
					return true;
				}
				if (!firstloadHP)
				{
					((Component)((Component)expPanelRoot).GetComponent<Canvas>()).gameObject.SetActive(true);
					firstloadHP = true;
				}
				float health = ((Character)player).GetHealth();
				float maxHealth = ((Character)player).GetMaxHealth();
				hpImage.fillAmount = health / maxHealth;
				string text = "";
				text = ((!EpicMMOSystem.showMaxHp.Value) ? Mathf.CeilToInt(health).ToString() : (Mathf.CeilToInt(health) + " / " + Mathf.CeilToInt(maxHealth)));
				hpText.text = text;
				return false;
			}
		}

		[HarmonyPatch(typeof(Hud), "UpdateStamina")]
		[<258b29e1-5f67-4899-be27-dce96aac876f>NullableContext(0)]
		public static class UpdateStamina
		{
			[<258b29e1-5f67-4899-be27-dce96aac876f>NullableContext(1)]
			private static bool Prefix(Player player)
			{
				if (EpicMMOSystem.oldExpBar.Value)
				{
					return true;
				}
				if (DisableStaminaBar)
				{
					return true;
				}
				float stamina = player.GetStamina();
				float maxStamina = ((Character)player).GetMaxStamina();
				staminaImage.fillAmount = stamina / maxStamina;
				string text = "";
				text = ((!EpicMMOSystem.showMaxHp.Value) ? Mathf.CeilToInt(stamina).ToString() : (Mathf.CeilToInt(stamina) + " / " + Mathf.CeilToInt(maxStamina)));
				staminaText.text = text;
				return false;
			}
		}

		[HarmonyPatch(typeof(Hud), "UpdateEitr")]
		[<258b29e1-5f67-4899-be27-dce96aac876f>NullableContext(0)]
		public static class UpdateEitr
		{
			[<258b29e1-5f67-4899-be27-dce96aac876f>NullableContext(1)]
			private static bool Prefix(Player player)
			{
				if (EpicMMOSystem.oldExpBar.Value)
				{
					return true;
				}
				if (DisableEitrBar)
				{
					EitrGameObj.SetActive(false);
				}
				if (DisableEitrBar)
				{
					return true;
				}
				float eitr = player.GetEitr();
				float maxEitr = ((Character)player).GetMaxEitr();
				if (flagforMove > 0)
				{
					DragControl.RestoreWindow(((Component)hp).gameObject);
					DragControl.RestoreWindow(((Component)Exp).gameObject);
					DragControl.RestoreWindow(((Component)stamina).gameObject);
					if (flagforMove == 2)
					{
						DragControl.RestoreWindow(EitrGameObj);
					}
					flagforMove = 0;
				}
				if (maxEitr < 2f && EitrGameObj.activeSelf && !EpicMMOSystem.forceMagicBar.Value)
				{
					EitrGameObj.SetActive(false);
					((Component)expPanel).GetComponent<RectTransform>().SetSizeWithCurrentAnchors((Axis)0, 1050f);
					flagforMove = 1;
				}
				if ((maxEitr > 2f || EpicMMOSystem.forceMagicBar.Value) && !EitrGameObj.activeSelf)
				{
					EitrGameObj.SetActive(true);
					((Component)expPanel).GetComponent<RectTransform>().SetSizeWithCurrentAnchors((Axis)0, 1475f);
					flagforMove = 2;
				}
				EitrImage.fillAmount = eitr / maxEitr;
				string text = "";
				text = ((!EpicMMOSystem.showMaxHp.Value) ? Mathf.CeilToInt(eitr).ToString() : (Mathf.CeilToInt(eitr) + " / " + Mathf.CeilToInt(maxEitr)));
				Eitr.text = text;
				firstload = true;
				return false;
			}
		}

		[HarmonyPatch(typeof(Game), "SpawnPlayer")]
		[<258b29e1-5f67-4899-be27-dce96aac876f>NullableContext(0)]
		public static class UpdateExpPanelForStart
		{
			private static void Postfix()
			{
				try
				{
					updateExpBar();
					if (!EpicMMOSystem.oldExpBar.Value)
					{
						((Component)expPanelRoot).gameObject.SetActive(true);
					}
				}
				catch (Exception ex)
				{
					MonoBehaviour.print((object)("Error set expbar: " + ex.Message));
					throw;
				}
			}
		}

		[<acc666de-ccb0-4f25-a857-78f2ab2816dd>Nullable(0)]
		private class FriendsCell
		{
			[<258b29e1-5f67-4899-be27-dce96aac876f>NullableContext(0)]
			public enum StatusFriend
			{
				online,
				offline,
				invite
			}

			private GameObject cell;

			private FriendInfo friend;

			private Text nameText;

			private Text levelText;

			private Image icon;

			private PlayerInfo player;

			private StatusFriend status;

			public FriendsCell(GameObject cell, FriendInfo friend, PlayerInfo info, StatusFriend status)
			{
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_0258: Unknown result type (might be due to invalid IL or missing references)
				//IL_012d: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b2: 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_030c: Expected O, but got Unknown
				//IL_032d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0337: Expected O, but got Unknown
				//IL_0358: Unknown result type (might be due to invalid IL or missing references)
				//IL_0362: Expected O, but got Unknown
				this.cell = cell;
				this.friend = friend;
				player = info;
				nameText = ((Component)cell.transform.Find("Name")).GetComponent<Text>();
				levelText = ((Component)cell.transform.Find("Level")).GetComponent<Text>();
				icon = ((Component)cell.transform.Find("IconClass")).GetComponent<Image>();
				nameText.text = friend.name;
				this.status = status;
				int num = friend.level;
				int num2 = friend.moClass;
				switch (status)
				{
				case StatusFriend.online:
					try
					{
						ZDO zDO = ZDOMan.instance.GetZDO(info.m_characterID);
						num = zDO.GetInt("EpicMMOSystem_level", 1);
						num2 = zDO.GetInt("MagicOverhaulClass", 0);
					}
					catch (Exception ex)
					{
						MonoBehaviour.print((object)("Ошибка в получении значений из здо: " + ex.Message));
					}
					((Component)cell.transform.Find("Status")).GetComponent<Text>().text = localization["$online"];
					((Graphic)((Component)cell.transform.Find("Status")).GetComponent<Text>()).color = Color.green;
					((Component)cell.transform.Find("Buttons/Accept")).gameObject.SetActive(false);
					if (!Groups.API.IsLoaded())
					{
						((Component)cell.transform.Find("Buttons/AddGroup")).gameObject.SetActive(false);
					}
					else if (Groups.API.GroupPlayers().Count > 0 && (Groups.API.GetLeader()?.name ?? "") != Player.m_localPlayer.GetPlayerName())
					{
						((Component)cell.transform.Find("Buttons/AddGroup")).gameObject.SetActive(false);
					}
					break;
				case StatusFriend.offline:
					((Component)cell.transform.Find("Buttons/AddGroup")).gameObject.SetActive(false);
					((Component)cell.transform.Find("Buttons/Accept")).gameObject.SetActive(false);
					((Component)cell.transform.Find("Status")).GetComponent<Text>().text = localization["$offline"];
					((Graphic)((Component)cell.transform.Find("Status")).GetComponent<Text>()).color = Color.red;
					break;
				case StatusFriend.invite:
					((Component)cell.transform.Find("Buttons/AddGroup")).gameObject.SetActive(false);
					((Component)cell.transform.Find("Status")).GetComponent<Text>().text = "";
					break;
				}
				levelText.text = string.Format("{0}: {1}", localization["$level"], num);
				if (num2 != 0)
				{
					icon.sprite = sprites[num2];
				}
				((UnityEvent)((Component)cell.transform.Find("Buttons/AddGroup")).GetComponent<Button>().onClick).AddListener(new UnityAction(inviteGroup));
				((UnityEvent)((Component)cell.transform.Find("Buttons/Accept")).GetComponent<Button>().onClick).AddListener(new UnityAction(acceptInvite));
				((UnityEvent)((Component)cell.transform.Find("Buttons/Delete")).GetComponent<Button>().onClick).AddListener(new UnityAction(deleteFriend));
				if (num > friend.level || num2 != friend.moClass)
				{
					friend.level = num;
					friend.moClass = num2;
					friendsData.updateFriends(friend);
				}
			}

			private void inviteGroup()
			{
				if (Groups.API.GroupPlayers().Count > 0)
				{
					foreach (PlayerReference item in Groups.API.GroupPlayers())
					{
						if (item.name == friend.name)
						{
							return;
						}
					}
					string playerName = Player.m_localPlayer.GetPlayerName();
					if ((Groups.API.GetLeader()?.name ?? "") == playerName)
					{
						ZRoutedRpc.instance.InvokeRoutedRPC(((ZDOID)(ref player.m_characterID)).UserID, "Groups InvitePlayer", new object[1] { playerName });
					}
				}
				else
				{
					Groups.API.CreateNewGroup();
					ZRoutedRpc.instance.InvokeRoutedRPC(((ZDOID)(ref player.m_characterID)).UserID, "Groups InvitePlayer", new object[1] { Player.m_localPlayer.GetPlayerName() });
				}
			}

			private void acceptInvite()
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				FriendsSystem.acceptInvite(friend, player);
				inviteList.Remove(friend);
				acceptInvited(friend);
				Destroy();
			}

			private void deleteFriend()
			{
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				if (status == StatusFriend.invite)
				{
					inviteList.Remove(friend);
					FriendsSystem.rejectInvite(friend, player);
					updateInviteList();
				}
				else
				{
					friendsData.deleteFriend(friend);
					updateFriendsList();
				}
			}

			public void Destroy()
			{
				Object.Destroy((Object)(object)cell);
			}
		}

		[HarmonyPatch(typeof(Game), "Logout")]
		[<258b29e1-5f67-4899-be27-dce96aac876f>NullableContext(0)]
		public static class DataFriendsClear
		{
			public static void Prefix()
			{
				inviteList.Clear();
				friendsData.ClearFriend();
			}
		}

		[<acc666de-ccb0-4f25-a857-78f2ab2816dd>Nullable(0)]
		private class ParameterButton
		{
			private Parameter parameter;

			private Transform head;

			private GameObject buttons;

			private Text text;

			public ParameterButton(Transform head, Parameter parameter)
			{
				//IL_0066: Unknown result type (might be due to invalid IL or missing references)
				//IL_0070: Expected O, but got Unknown
				//IL_0096: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a0: Expected O, but got Unknown
				this.head = head;
				this.parameter = parameter;
				text = ((Component)head.Find("Text")).GetComponent<Text>();
				buttons = ((Component)head.Find("Buttons")).gameObject;
				((UnityEvent)((Component)buttons.transform.Find("Plus1")).GetComponent<Button>().onClick).AddListener(new UnityAction(ClickButton1));
				((UnityEvent)((Component)buttons.transform.Find("Plus5")).GetComponent<Button>().onClick).AddListener(new UnityAction(ClickButton5));
			}

			private void ClickButton1()
			{
				LevelSystem.Instance.addPointsParametr(parameter, 1);
				UpdateParameterPanel();
			}

			private void ClickButton5()
			{
				LevelSystem.Instance.addPointsParametr(parameter, 5);
				UpdateParameterPanel();
			}

			public void UpdateParameters(int freePoints)
			{
				int num = parameter.ToString() switch
				{
					"Strength" => EpicMMOSystem.maxValueStrength.Value, 
					"Agility" => EpicMMOSystem.maxValueDexterity.Value, 
					"Intellect" => EpicMMOSystem.maxValueIntelligence.Value, 
					"Body" => EpicMMOSystem.maxValueEndurance.Value, 
					"Vigour" => EpicMMOSystem.maxValueVigour.Value, 
					"Special" => EpicMMOSystem.maxValueSpecializing.Value, 
					_ => num = 205, 
				};
				int num2 = LevelSystem.Instance.getParameter(parameter);
				text.text = string.Format("{0}: {1}", localization["$parameter_" + parameter.ToString().ToLower()], num2);
				buttons.SetActive(freePoints > 0 && num2 < num);
			}
		}

		[<258b29e1-5f67-4899-be27-dce96aac876f>NullableContext(0)]
		[HarmonyPatch(typeof(InventoryGui), "Awake")]
		private static class InventoryGui_Awake_Patch
		{
			[<258b29e1-5f67-4899-be27-dce96aac876f>NullableContext(1)]
			private static void Postfix(InventoryGui __instance)
			{
				UITooltip[] componentsInChildren = levelSystemPanel.GetComponentsInChildren<UITooltip>(true);
				foreach (UITooltip val in componentsInChildren)
				{
					val.m_tooltipPrefab = __instance.m_playerGrid.m_elementPrefab.GetComponent<UITooltip>().m_tooltipPrefab;
					switch (val.m_topic)
					{
					case "Strength":
						val.m_text = localization["$strength_tooltip"];
						val.m_topic = localization["$parameter_strength"];
						break;
					case "Dexterity":
						val.m_text = localization["$dexterity_tooltip"];
						val.m_topic = localization["$parameter_agility"];
						break;
					case "Intelect":
						val.m_text = localization["$intelect_tooltip"];
						val.m_topic = localization["$parameter_intellect"];
						break;
					case "Endurance":
						val.m_text = localization["$endurance_tooltip"];
						val.m_topic = localization["$parameter_body"];
						break;
					case "Vigour":
						val.m_text = localization["$vigour_tooltip"];
						val.m_topic = localization["$parameter_vigour"];
						break;
					case "Special":
						val.m_text = localization["$special_tooltip"];
						val.m_topic = localization["$parameter_special"];
						break;
					}
				}
			}
		}

		private static GameObject UI;

		internal static Text eLevelText;

		internal static Text eExpText;

		internal static Image eBarImage;

		internal static Transform Exp;

		internal static bool DisableExpBar = false;

		internal static Text hpText;

		internal static Image hpImage;

		internal static Transform hp;

		internal static Transform hpFill;

		internal static Color hpFillColor;

		internal static bool DisableHPBar = false;

		internal static GameObject DHpBar;

		internal static GameObject IconHpBar;

		internal static Text staminaText;

		internal static Image staminaImage;

		internal static Transform stamina;

		internal static Transform staminaBarFill;

		internal static Color staminaBarColor;

		internal static bool DisableStaminaBar = false;

		internal static Text Eitr;

		internal static Image EitrImage;

		internal static GameObject EitrGameObj;

		internal static Transform EitrTran;

		internal static Transform EitrFill;

		internal static Color EitrBarColor;

		internal static bool DisableEitrBar = false;

		internal static Transform expPanel;

		internal static Transform expPanelRoot;

		internal static Color expPanelBackgroundColor;

		internal static GameObject expPanelBackground;

		internal static int flagforMove = 0;

		internal static bool firstload = false;

		internal static bool firstloadHP = false;

		internal static int frameCount = 0;

		internal static int currentLVL = 1;

		internal static bool UIToggle = false;

		private static List<Sprite> sprites = new List<Sprite>();

		private static FriendsData friendsData = new FriendsData();

		private static GameObject friendsListPanel;

		private static GameObject friendsCell;

		private static GameObject headerInvited;

		private static GameObject contentInvited;

		private static GameObject headerFriends;

		private static GameObject contentFriends;

		private static GameObject addFriendAlert;

		private static InputField textField;

		private static List<FriendsCell> friendsCells = new List<FriendsCell>();

		private static List<FriendsCell> inviteCells = new List<FriendsCell>();

		private static Dictionary<FriendInfo, PlayerInfo> inviteList = new Dictionary<FriendInfo, PlayerInfo>();

		internal static GameObject levelSystemPanel;

		internal static GameObject levelSystemPanelRoot;

		private static GameObject alertResetPointPanel;

		private static Text alertResetPointText;

		private static List<ParameterButton> parameterButtons = new List<ParameterButton>();

		private static GameObject freePointsPanel;

		private static Text freePointsText;

		private static Text currentLevelText;

		private static Text expText;

		private static Text physicDamageText;

		private static Text addWeightText;

		private static Text criticalDmgMultText;

		private static Text attackSpeedMultiText;

		private static Text reducedStaminaText;

		private static Text attackStamina;

		private static Text magicDamageText;

		private static Text magicEitrRegText;

		private static Text eitrIncreaseText;

		private static Text addStaminaText;

		private static Text staminaRegen;

		private static Text reducedStaminaBlockText;

		private static Text physicArmorText;

		private static Text addHpText;

		private static Text regenHpText;

		private static Text magicArmorText;

		private static Text criticalChanceText;

		private static Text miningSpeedText;

		private static Text addpieceHealthText;

		private static Text treeCuttingSpeedText;

		internal static GameObject navigationPanel;

		private static Transform buttonLevelSystem;

		private static Transform buttonFriendsList;

		private static Transform buttonQuestPanel;

		private static Transform buttonProfessionsPanel;

		private static Transform buttonShopPanel;

		private static Localizationold localization => EpicMMOSystem.localizationold;

		public static bool IsPanelVisible()
		{
			if (Object.op_Implicit((Object)(object)UI))
			{
				return UI.activeSelf;
			}
			return false;
		}

		public static void Init()
		{
			UI = Object.Instantiate<GameObject>(EpicMMOSystem._asset.LoadAsset<GameObject>("LevelHud"));
			Object.DontDestroyOnLoad((Object)(object)UI);
			UI.SetActive(false);
			InitNavigationPanel();
			InitLevelSystem();
			InitFriendsList();
		}

		public static void Hide()
		{
			navigationPanel.SetActive(false);
			levelSystemPanel.SetActive(false);
			levelSystemPanel.GetComponent<CanvasGroup>().interactable = true;
			alertResetPointPanel.SetActive(false);
			friendsListPanel.SetActive(false);
			friendsListPanel.GetComponent<CanvasGroup>().interactable = true;
			alertResetPointPanel.SetActive(false);
			addFriendAlert.SetActive(false);
			UI.SetActive(false);
			LevelSystem.Instance.cancelDepositPoints();
			DonatShop_API.HidePanel();
		}

		public static void Show()
		{
			ShowNavigationPanel();
			navigationPanel.SetActive(true);
			UI.SetActive(true);
		}

		public static void updateExpBar()
		{
			if (DisableExpBar)
			{
				((Component)Exp).gameObject.SetActive(false);
			}
			int level = LevelSystem.Instance.getLevel();
			long currentExp = LevelSystem.Instance.getCurrentExp();
			long needExp = LevelSystem.Instance.getNeedExp();
			if (!DisableExpBar || EpicMMOSystem.oldExpBar.Value)
			{
				string text = ((float)currentExp / (float)needExp * 100f).ToString("0.00");
				eLevelText.text = string.Format("{0} {1}", localization["$lvl"], level);
				eExpText.text = text.Replace(',', '.') + " %";
				eBarImage.fillAmount = (float)currentExp / (float)needExp;
				currentLVL = level;
			}
		}

		internal static void InitHudPanel()
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0221: Unknown result type (might be due to invalid IL or missing references)
			expPanel = expPanelRoot.Find("EpicHudPanel");
			expPanelBackground = ((Component)expPanel.Find("Background")).gameObject;
			expPanelBackgroundColor = ((Graphic)expPanelBackground.GetComponent<Image>()).color;
			((Component)expPanelRoot).GetComponent<CanvasScaler>().scaleFactor = EpicMMOSystem.HudBarScale.Value;
			if (EpicMMOSystem.HudExpBackgroundCol.Value == "none")
			{
				expPanelBackground.SetActive(false);
			}
			else
			{
				expPanelBackgroundColor = ColorUtil.GetColorFromHex(EpicMMOSystem.HudExpBackgroundCol.Value);
			}
			eLevelText = ((Component)expPanel.Find("Container/Exp/Lvl")).GetComponent<Text>();
			eExpText = ((Component)expPanel.Find("Container/Exp/Exp")).GetComponent<Text>();
			Exp = expPanel.Find("Container/Exp");
			eBarImage = ((Component)expPanel.Find("Container/Exp/Bar/Fill")).GetComponent<Image>();
			hpText = ((Component)expPanel.Find("Container/Hp/Text")).GetComponent<Text>();
			hpFill = expPanel.Find("Container/Hp/Bar/Fill");
			hpImage = ((Component)hpFill).GetComponent<Image>();
			hpFillColor = ((Graphic)hpImage).color;
			hp = expPanel.Find("Container/Hp");
			staminaText = ((Component)expPanel.Find("Container/Stamina/Text")).GetComponent<Text>();
			staminaBarFill = expPanel.Find("Container/Stamina/Bar/Fill");
			staminaImage = ((Component)staminaBarFill).GetComponent<Image>();
			staminaBarColor = ((Graphic)staminaImage).color;
			stamina = expPanel.Find("Container/Stamina");
			EitrTran = expPanel.Find("Container/Eitr");
			EitrGameObj = ((Component)expPanel.Find("Container/Eitr")).gameObject;
			Eitr = ((Component)expPanel.Find("Container/Eitr/Text")).GetComponent<Text>();
			EitrFill = expPanel.Find("Container/Eitr/Bar/Fill");
			EitrImage = ((Component)EitrFill).GetComponent<Image>();
			EitrBarColor = ((Graphic)EitrImage).color;
		}

		private static void InitFriendsList()
		{
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Expected O, but got Unknown
			//IL_0268: Unknown result type (might be due to invalid IL or missing references)
			//IL_0272: Expected O, but got Unknown
			//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ce: Expected O, but got Unknown
			friendsListPanel = ((Component)UI.transform.Find("Canvas/FriendList")).gameObject;
			((Component)friendsListPanel.transform.Find("Background")).gameObject.AddComponent<DragMenu>().menu = friendsListPanel.transform;
			((Component)friendsListPanel.transform.Find("Header")).gameObject.AddComponent<DragMenu>().menu = friendsListPanel.transform;
			((Component)friendsListPanel.transform.Find("Header/Text")).GetComponent<Text>().text = localization["$friends_list"];
			friendsCell = EpicMMOSystem._asset.LoadAsset<GameObject>("FriendCell");
			((Graphic)((Component)friendsListPanel.transform.Find("Border")).GetComponent<Image>()).raycastTarget = false;
			((UnityEvent)((Component)friendsListPanel.transform.Find("Add")).GetComponent<Button>().onClick).AddListener(new UnityAction(clickButtonAdd));
			headerInvited = ((Component)friendsListPanel.transform.Find("Scroll View/Viewport/Content/HeaderInvited")).gameObject;
			headerInvited.SetActive(false);
			contentInvited = ((Component)friendsListPanel.transform.Find("Scroll View/Viewport/Content/Invited")).gameObject;
			headerFriends = ((Component)friendsListPanel.transform.Find("Scroll View/Viewport/Content/HeaderFriends")).gameObject;
			contentFriends = ((Component)friendsListPanel.transform.Find("Scroll View/Viewport/Content/Friends")).gameObject;
			((Component)headerInvited.transform.Find("Text")).GetComponent<Text>().text = localization["$invited"];
			((Component)headerFriends.transform.Find("Text")).GetComponent<Text>().text = localization["$friends"];
			addFriendAlert = ((Component)UI.transform.Find("Canvas/SendInvite")).gameObject;
			textField = ((Component)addFriendAlert.transform.Find("InputField")).GetComponent<InputField>();
			((Component)((Component)textField).transform.Find("Placeholder")).GetComponent<Text>().text = "";
			((UnityEvent)((Component)addFriendAlert.transform.Find("Buttons/Send")).GetComponent<Button>().onClick).AddListener(new UnityAction(clickButtonSend));
			((Component)addFriendAlert.transform.Find("Buttons/Send/Text")).GetComponent<Text>().text = localization["$send"];
			((UnityEvent)((Component)addFriendAlert.transform.Find("Buttons/Cancel")).GetComponent<Button>().onClick).AddListener(new UnityAction(clickButtonCancel));
			((Component)addFriendAlert.transform.Find("Buttons/Cancel/Text")).GetComponent<Text>().text = localization["$cancel"];
			sprites.Add(EpicMMOSystem._asset.LoadAsset<Sprite>("manIcon"));
			for (int i = 1; i < 15; i++)
			{
				sprites.Add(EpicMMOSystem._asset.LoadAsset<Sprite>($"Class{i}"));
			}
		}

		private static void updateList()
		{
			updateFriendsList();
			updateInviteList();
		}

		private static void updateFriendsList()
		{
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			if (friendsCells.Count > 0)
			{
				friendsCells.ForEach(delegate(FriendsCell f)
				{
					f.Destroy();
				});
				friendsCells.Clear();
			}
			Dictionary<string, PlayerInfo> dictionary = new Dictionary<string, PlayerInfo>();
			foreach (PlayerInfo player in ZNet.instance.GetPlayerList())
			{
				dictionary.Add(player.m_name, player);
			}
			Dictionary<string, FriendInfo> dictionary2 = new Dictionary<string, FriendInfo>(friendsData.getFriends());
			headerFriends.SetActive(dictionary2.Count > 0);
			List<FriendInfo> list = new List<FriendInfo>();
			foreach (KeyValuePair<string, FriendInfo> item3 in dictionary2)
			{
				if (dictionary.ContainsKey(item3.Key))
				{
					PlayerInfo info = dictionary[item3.Key];
					GameObject val = Object.Instantiate<GameObject>(friendsCell, contentFriends.transform);
					if (Object.op_Implicit((Object)(object)val))
					{
						FriendsCell item = new FriendsCell(val, item3.Value, info, FriendsCell.StatusFriend.online);
						friendsCells.Add(item);
					}
				}
				else
				{
					list.Add(item3.Value);
				}
			}
			foreach (FriendInfo item4 in list)
			{
				GameObject val2 = Object.Instantiate<GameObject>(friendsCell, contentFriends.transform);
				if (Object.op_Implicit((Object)(object)val2))
				{
					FriendsCell item2 = new FriendsCell(val2, item4, default(PlayerInfo), FriendsCell.StatusFriend.offline);
					friendsCells.Add(item2);
				}
			}
		}

		private static void updateInviteList()
		{
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			if (inviteCells.Count > 0)
			{
				inviteCells.ForEach(delegate(FriendsCell f)
				{
					f.Destroy();
				});
				inviteCells.Clear();
			}
			headerInvited.SetActive(inviteList.Count > 0);
			foreach (KeyValuePair<FriendInfo, PlayerInfo> invite in inviteList)
			{
				GameObject val = Object.Instantiate<GameObject>(friendsCell, contentInvited.transform);
				if (Object.op_Implicit((Object)(object)val))
				{
					FriendsCell item = new FriendsCell(val, invite.Key, invite.Value, FriendsCell.StatusFriend.invite);
					inviteCells.Add(item);
				}
			}
		}

		public static void addInviteFriend(FriendInfo info, PlayerInfo playerInfo)
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			foreach (KeyValuePair<FriendInfo, PlayerInfo> invite in inviteList)
			{
				if (invite.Key.name == info.name)
				{
					return;
				}
			}
			inviteList.Add(info, playerInfo);
			updateInviteList();
		}

		private static bool hasInvite()
		{
			return inviteList.Count > 0;
		}

		public static void acceptInvited(FriendInfo friendInfo)
		{
			friendsData.addFriends(friendInfo);
			if (friendsListPanel.activeSelf)
			{
				updateList();
			}
		}

		private static void clickButtonAdd()
		{
			friendsListPanel.GetComponent<CanvasGroup>().interactable = false;
			textField.SetTextWithoutNotify("");
			addFriendAlert.SetActive(true);
		}

		private static void clickButtonSend()
		{
			string text = textField.text ?? "";
			foreach (KeyValuePair<FriendInfo, PlayerInfo> invite in inviteList)
			{
				if (invite.Key.name == text)
				{
					return;
				}
			}
			if (!(text == Player.m_localPlayer.GetPlayerName()) && !friendsData.getFriends().ContainsKey(text))
			{
				FriendsSystem.inviteFriend(text);
				friendsListPanel.GetComponent<CanvasGroup>().interactable = true;
				addFriendAlert.SetActive(false);
			}
		}

		private static void clickButtonCancel()
		{
			friendsListPanel.GetComponent<CanvasGroup>().interactable = true;
			addFriendAlert.SetActive(false);
		}

		private static void InitLevelSystem()
		{
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Expected O, but got Unknown
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Expected O, but got Unknown
			//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d3: Expected O, but got Unknown
			//IL_0325: Unknown result type (might be due to invalid IL or missing references)
			//IL_032f: Expected O, but got Unknown
			//IL_0381: Unknown result type (might be due to invalid IL or missing references)
			//IL_038b: Expected O, but got Unknown
			levelSystemPanel = ((Component)UI.transform.Find("Canvas/PointPanel")).gameObject;
			levelSystemPanelRoot = ((Component)UI.transform.Find("Canvas")).gameObject;
			levelSystemPanelRoot.GetComponent<CanvasScaler>().scaleFactor = EpicMMOSystem.LevelHudGroupScale.Value;
			((Component)levelSystemPanel.transform.Find("Header/Text")).GetComponent<Text>().text = localization["$attributes"];
			DragWindowCntrl.ApplyDragWindowCntrl(levelSystemPanel);
			alertResetPointPanel = ((Component)UI.transform.Find("Canvas/ApplyReset")).gameObject;
			alertResetPointText = ((Component)alertResetPointPanel.transform.Find("Text")).GetComponent<Text>();
			((UnityEvent)((Component)alertResetPointPanel.transform.Find("Buttons/Yes")).GetComponent<Button>().onClick).AddListener(new UnityAction(ResetYes));
			((Component)alertResetPointPanel.transform.Find("Buttons/Yes/Text")).GetComponent<Text>().text = localization["$yes"];
			((UnityEvent)((Component)alertResetPointPanel.transform.Find("Buttons/No")).GetComponent<Button>().onClick).AddListener(new UnityAction(ResetNo));
			((Component)alertResetPointPanel.transform.Find("Buttons/No/Text")).GetComponent<Text>().text = localization["$no"];
			Transform head = levelSystemPanel.transform.Find("Points/ListStat/Strength");
			parameterButtons.Add(new ParameterButton(head, Parameter.Strength));
			Transform head2 = levelSystemPanel.transform.Find("Points/ListStat/Dexterity");
			parameterButtons.Add(new ParameterButton(head2, Parameter.Agility));
			Transform head3 = levelSystemPanel.transform.Find("Points/ListStat/Intelect");
			parameterButtons.Add(new ParameterButton(head3, Parameter.Intellect));
			Transform head4 = levelSystemPanel.transform.Find("Points/ListStat/Endurance");
			parameterButtons.Add(new ParameterButton(head4, Parameter.Body));
			Transform head5 = levelSystemPanel.transform.Find("Points/ListStat/Vigour");
			parameterButtons.Add(new ParameterButton(head5, Parameter.Vigour));
			Transform head6 = levelSystemPanel.transform.Find("Points/ListStat/Specializing");
			parameterButtons.Add(new ParameterButton(head6, Parameter.Special));
			freePointsPanel = ((Component)levelSystemPanel.transform.Find("Points/FreePoints")).gameObject;
			freePointsText = ((Component)levelSystemPanel.transform.Find("Points/FreePoints/Text")).GetComponent<Text>();
			((UnityEvent)((Component)freePointsPanel.transform.Find("Cancel")).GetComponent<Button>().onClick).AddListener(new UnityAction(ClickCancel));
			((Component)freePointsPanel.transform.Find("Cancel/Text")).GetComponent<Text>().text = localization["$cancel"];
			((UnityEvent)((Component)freePointsPanel.transform.Find("Apply")).GetComponent<Button>().onClick).AddListener(new UnityAction(ClickApply));
			((Component)freePointsPanel.transform.Find("Apply/Text")).GetComponent<Text>().text = localization["$apply"];
			((UnityEvent)((Component)levelSystemPanel.transform.Find("Points/ResetButton/Button")).GetComponent<Button>().onClick).AddListener(new UnityAction(ResetParameters));
			((Component)levelSystemPanel.transform.Find("Points/ResetButton/Button/Text")).GetComponent<Text>().text = localization["$reset_parameters"];
			currentLevelText = ((Component)levelSystemPanel.transform.Find("CurrentLevel/Content/Lvl")).GetComponent<Text>();
			expText = ((Component)levelSystemPanel.transform.Find("CurrentLevel/Content/Exp")).GetComponent<Text>();
			Transform obj = levelSystemPanel.transform.Find("DescriptionStats/Scroll View/Viewport/Content");
			((Component)((Component)obj).transform.Find("HeaderDamage/Text")).GetComponent<Text>().text = localization["$damage"];
			((Component)((Component)obj).transform.Find("HeaderDefence/Text")).GetComponent<Text>().text = localization["$armor"];
			((Component)((Component)obj).transform.Find("HeaderSurv/Text")).GetComponent<Text>().text = localization["$survival"];
			((Component)((Component)obj).transform.Find("HeaderOther/Text")).GetComponent<Text>().text = localization["$specialother"];
			physicDamageText = ((Component)((Component)obj).transform.Find("PhysicDamage")).GetComponent<Text>();
			addWeightText = ((Component)((Component)obj).transform.Find("Weight")).GetComponent<Text>();
			reducedStaminaBlockText = ((Component)((Component)obj).transform.Find("StaminaBlock")).GetComponent<Text>();
			criticalDmgMultText = ((Component)((Component)obj).transform.Find("CriticalDmg")).GetComponent<Text>();
			attackSpeedMultiText = ((Component)((Component)obj).transform.Find("SpeedAttack")).GetComponent<Text>();
			attackStamina = ((Component)((Component)obj).transform.Find("AttackStamina")).GetComponent<Text>();
			reducedStaminaText = ((Component)((Component)obj).transform.Find("StaminaReduction")).GetComponent<Text>();
			magicDamageText = ((Component)((Component)obj).transform.Find("MagicDamage")).GetComponent<Text>();
			magicEitrRegText = ((Component)((Component)obj).transform.Find("EitrReg")).GetComponent<Text>();
			eitrIncreaseText = ((Component)((Component)obj).transform.Find("EitrIncr")).GetComponent<Text>();
			physicArmorText = ((Component)((Component)obj).transform.Find("DamageReduction")).GetComponent<Text>();
			staminaRegen = ((Component)((Component)obj).transform.Find("StaminaRegeneration")).GetComponent<Text>();
			addStaminaText = ((Component)((Component)obj).transform.Find("Stamina")).GetComponent<Text>();
			addHpText = ((Component)((Component)obj).transform.Find("Hp")).GetComponent<Text>();
			regenHpText = ((Component)((Component)obj).transform.Find("HpRegeneration")).GetComponent<Text>();
			magicArmorText = ((Component)((Component)obj).transform.Find("MagicDamageReduction")).GetComponent<Text>();
			criticalChanceText = ((Component)((Component)obj).transform.Find("CriticalChance")).GetComponent<Text>();
			miningSpeedText = ((Component)((Component)obj).transform.Find("MiningSpeed")).GetComponent<Text>();
			addpieceHealthText = ((Component)((Component)obj).transform.Find("ConstructionPieceHealth")).GetComponent<Text>();
			treeCuttingSpeedText = ((Component)((Component)obj).transform.Find("TreeCutting")).GetComponent<Text>();
		}

		private static void ClickCancel()
		{
			LevelSystem.Instance.cancelDepositPoints();
			levelSystemPanel.SetActive(false);
		}

		private static void ClickApply()
		{
			LevelSystem.Instance.applyDepositPoints();
			levelSystemPanel.SetActive(false);
		}

		private static void ResetParameters()
		{
			string value = EpicMMOSystem.viewTextCoins.Value;
			int priceResetPoints = LevelSystem.Instance.getPriceResetPoints();
			string format = localization["$reset_point_text"];
			alertResetPointText.text = string.Format(format, priceResetPoints, value);
			levelSystemPanel.GetComponent<CanvasGroup>().interactable = false;
			alertResetPointPanel.SetActive(true);
		}

		private static void ResetYes()
		{
			ResetNo();
			LevelSystem.Instance.ResetAllParameterPayment();
		}

		private static void ResetNo()
		{
			alertResetPointPanel.SetActive(false);
			levelSystemPanel.GetComponent<CanvasGroup>().interactable = true;
		}

		public static void UpdateParameterPanel()
		{
			int points = LevelSystem.Instance.getFreePoints();
			bool flag = LevelSystem.Instance.hasDepositPoints();
			parameterButtons.ForEach(delegate(ParameterButton p)
			{
				p.UpdateParameters(points);
			});
			freePointsPanel.SetActive(points > 0 || flag);
			freePointsText.text = string.Format("{0}: {1}", localization["$free_points"], points);
			currentLevelText.text = string.Format("{0}: {1}", localization["$level"], LevelSystem.Instance.getLevel());
			long currentExp = LevelSystem.Instance.getCurrentExp();
			long needExp = LevelSystem.Instance.getNeedExp();
			string arg = localization["$exp"];
			expText.text = $"{arg}: {currentExp} / {needExp}";
			physicDamageText.text = string.Format("{0}: +{1}%", localization["$physic_damage"], LevelSystem.Instance.getAddPhysicDamage());
			addWeightText.text = string.Format("{0}: +{1}", localization["$add_weight"], LevelSystem.Instance.getAddWeight());
			reducedStaminaBlockText.text = string.Format("{0}: -{1}%", localization["$reduced_stamina_block"], LevelSystem.Instance.getReducedStaminaBlock());
			criticalDmgMultText.text = string.Format("{0}: +{1}%", localization["$crtcDmgMulti"], LevelSystem.Instance.getAddCriticalDmg());
			attackSpeedMultiText.text = string.Format("{0}: +{1}%", localization["$attack_speed"], LevelSystem.Instance.getAddAttackSpeed());
			attackStamina.text = string.Format("{0}: -{1}%", localization["$attack_stamina"], LevelSystem.Instance.getAttackStamina());
			reducedStaminaText.text = string.Format("{0}: -{1}%", localization["$reduced_stamina"], LevelSystem.Instance.getStaminaReduction());
			magicDamageText.text = string.Format("{0}: +{1}%", localization["$magic_damage"], LevelSystem.Instance.getAddMagicDamage());
			eitrIncreaseText.text = string.Format("{0}: +{1}", localization["$add_eitr"], LevelSystem.Instance.getAddEitr());
			magicEitrRegText.text = string.Format("{0}: +{1}%", localization["$regen_eitr"], LevelSystem.Instance.getEitrRegen());
			physicArmorText.text = string.Format("{0}: +{1}%", localization["$physic_armor"], LevelSystem.Instance.getAddPhysicArmor());
			staminaRegen.text = string.Format("{0}: +{1}%", localization["$stamina_reg"], LevelSystem.Instance.getStaminaRegen());
			addStaminaText.text = string.Format("{0}: +{1}", localization["$add_stamina"], LevelSystem.Instance.getAddStamina());
			addHpText.text = string.Format("{0}: +{1}", localization["$add_hp"], LevelSystem.Instance.getAddHp());
			regenHpText.text = string.Format("{0}: +{1}%", localization["$regen_hp"], LevelSystem.Instance.getAddRegenHp());
			magicArmorText.text = string.Format("{0}: +{1}%", localization["$magic_armor"], LevelSystem.Instance.getAddMagicArmor());
			criticalChanceText.text = string.Format("{0}: +{1}%", localization["$crit_chance"], LevelSystem.Instance.getAddCriticalChance());
			miningSpeedText.text = string.Format("{0}: +{1}%", localization["$mining_speed"], LevelSystem.Instance.getaddMiningDmg());
			addpieceHealthText.text = string.Format("{0}: +{1}", localization["$piece_health"], LevelSystem.Instance.getAddPieceHealth());
			treeCuttingSpeedText.text = string.Format("{0}: +{1}%", localization["$tree_cutting"], LevelSystem.Instance.getAddTreeCuttingDmg());
		}

		private static void InitNavigationPanel()
		{
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Expected O, but got Unknown
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Expected O, but got Unknown
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Expected O, but got Unknown
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Expected O, but got Unknown
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Expected O, but got Unknown
			navigationPanel = ((Component)UI.transform.Find("Canvas/NavigatePanel")).gameObject;
			buttonLevelSystem = navigationPanel.transform.Find("Buttons/ButtonLevelSystem");
			((UnityEvent)((Component)buttonLevelSystem).GetComponent<Button>().onClick).AddListener(new UnityAction(ClickButtonLevelSystem));
			DragWindowCntrl.ApplyDragWindowCntrl(navigationPanel);
			buttonFriendsList = navigationPanel.transform.Find("Buttons/ButtonFriends");
			((UnityEvent)((Component)buttonFriendsList).GetComponent<Button>().onClick).AddListener(new UnityAction(ClickButtonFriendsList));
			if (Marketplace_API.IsInstalled())
			{
				buttonQuestPanel = navigationPanel.transform.Find("Buttons/ButtonQuests");
				((UnityEvent)((Component)buttonQuestPanel).GetComponent<Button>().onClick).AddListener(new UnityAction(ClickQuestPanel));
				((Component)buttonQuestPanel).gameObject.SetActive(true);
			}
			if (Professions_API.IsInstalled())
			{
				buttonProfessionsPanel = navigationPanel.transform.Find("Buttons/ButtonProffesions");
				((UnityEvent)((Component)buttonProfessionsPanel).GetComponent<Button>().onClick).AddListener(new UnityAction(ClickProfessionsPanel));
				((Component)buttonProfessionsPanel).gameObject.SetActive(true);
			}
			if (DonatShop_API.IsInstalled())
			{
				buttonShopPanel = navigationPanel.transform.Find("Buttons/ButtonShop");
				((UnityEvent)((Component)buttonShopPanel).GetComponent<Button>().onClick).AddListener(new UnityAction(ClickButtonDonatShop));
				((Component)buttonShopPanel).gameObject.SetActive(true);
			}
		}

		private static void ClickButtonLevelSystem()
		{
			if (!levelSystemPanel.activeSelf)
			{
				UpdateParameterPanel();
			}
			levelSystemPanel.SetActive(!levelSystemPanel.activeSelf);
		}

		private static void ClickButtonFriendsList()
		{
			if (!friendsListPanel.activeSelf)
			{
				updateList();
			}
			friendsListPanel.SetActive(!friendsListPanel.activeSelf);
		}

		private static void ClickButtonDonatShop()
		{
			DonatShop_API.OpenShop();
		}

		private static void ClickQuestPanel()
		{
			Marketplace_API.OpenQuestJournal();
		}

		private static void ClickProfessionsPanel()
		{
			Professions_API.showProfessions();
		}

		private static void ShowNavigationPanel()
		{
			int freePoints = LevelSystem.Instance.getFreePoints();
			((Component)buttonLevelSystem.GetChild(0)).gameObject.SetActive(freePoints > 0);
			((Component)buttonFriendsList.GetChild(0)).gameObject.SetActive(hasInvite());
		}
	}
	public class DragMenu : MonoBehaviour, IDragHandler, IEventSystemHandler
	{
		[<acc666de-ccb0-4f25-a857-78f2ab2816dd>Nullable(1)]
		public Transform menu;

		[<258b29e1-5f67-4899-be27-dce96aac876f>NullableContext(1)]
		public void OnDrag(PointerEventData eventData)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			Transform obj = menu;
			obj.position += Vector2.op_Implicit(eventData.delta);
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[<acc666de-ccb0-4f25-a857-78f2ab2816dd>Nullable(0)]
	[<258b29e1-5f67-4899-be27-dce96aac876f>NullableContext(1)]
	[BepInPlugin("WackyMole.EpicMMOSystem", "EpicMMOSystem", "1.8.99")]
	public class EpicMMOSystem : BaseUnityPlugin
	{
		[<258b29e1-5f67-4899-be27-dce96aac876f>NullableContext(0)]
		[HarmonyPatch(typeof(ZNetScene), "Awake")]
		private static class InitCustomItemsClass
		{
			[<258b29e1-5f67-4899-be27-dce96aac876f>NullableContext(1)]
			private static void Postfix(ZNetScene __instance)
			{
				GameObject val = _asset.LoadAsset<GameObject>("LevelUpVFX");
				__instance.m_prefabs.Add(val);
				__instance.m_namedPrefabs.Add(StringExtensionMethods.GetStableHashCode(((Object)val).name), val);
				GameObject val2 = _asset.LoadAsset<GameObject>("LevelUpVFX2");
				__instance.m_prefabs.Add(val2);
				__instance.m_namedPrefabs.Add(StringExtensionMethods.GetStableHashCode(((Object)val2).name), val2);
			}
		}

		[<258b29e1-5f67-4899-be27-dce96aac876f>NullableContext(0)]
		[HarmonyPatch(typeof(Player), "GetKnownTexts")]
		private static class FixCompendium
		{
			private static void Postfix([<acc666de-ccb0-4f25-a857-78f2ab2816dd>Nullable(new byte[] { 1, 0, 1, 1 })] ref List<KeyValuePair<string, string>> __result)
			{
				__result = __result.Where((KeyValuePair<string, string> p) => !p.Key.StartsWith("EpicMMOSystem")).ToList();
			}
		}

		[<258b29e1-5f67-4899-be27-dce96aac876f>NullableContext(0)]
		[HarmonyPatch(typeof(ObjectDB), "Awake")]
		internal static class DBPatMMO
		{
			internal static void Postfix()
			{
				//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fe: Expected O, but got Unknown
				//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
				//IL_0103: Unknown result type (might be due to invalid IL or missing references)
				//IL_010a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0111: Unknown result type (might be due to invalid IL or missing references)
				//IL_0129: Expected O, but got Unknown
				//IL_016e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0173: Unknown result type (might be due to invalid IL or missing references)
				//IL_017a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0181: Unknown result type (might be due to invalid IL or missing references)
				//IL_0199: Expected O, but got Unknown
				//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
				//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
				//IL_020c: Expected O, but got Unknown
				ObjectDB instance = ObjectDB.m_instance;
				if ((Object)(object)instance.GetItemPrefab("Wood") == (Object)null)
				{
					return;
				}
				Mead1Alt = ScriptableObject.CreateInstance<Recipe>();
				Mead2Alt = ScriptableObject.CreateInstance<Recipe>();
				Mead3Alt = ScriptableObject.CreateInstance<Recipe>();
				((Object)Mead1Alt).name = "MMO_Recipe_Mead1Alt";
				((Object)Mead2Alt).name = "MMO_Recipe_Mead2Alt";
				((Object)Mead3Alt).name = "MMO_Recipe_Mead3Alt";
				CraftingStation[] array = Resources.FindObjectsOfTypeAll<CraftingStation>();
				CraftingStation craftingStation = null;
				CraftingStation[] array2 = array;
				foreach (CraftingStation val in array2)
				{
					if (((Object)val).name == "piece_cauldron")
					{
						craftingStation = va