Decompiled source of WackyEpicMMOSystem v1.9.27

EpicMMOSystem.dll

Decompiled 2 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.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyTitle("EpicMMOSystem")]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: CompilationRelaxations(8)]
[assembly: AssemblyFileVersion("1.9.27")]
[assembly: AssemblyConfiguration("")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.9.27.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[<0d2744e1-814e-4199-83d2-1f6ac51d5d9c>Embedded]
	internal sealed class <0d2744e1-814e-4199-83d2-1f6ac51d5d9c>EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[<0d2744e1-814e-4199-83d2-1f6ac51d5d9c>Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class <8c604e0e-3cdb-4bc3-9c46-7379ffe5ba20>NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public <8c604e0e-3cdb-4bc3-9c46-7379ffe5ba20>NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public <8c604e0e-3cdb-4bc3-9c46-7379ffe5ba20>NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[<0d2744e1-814e-4199-83d2-1f6ac51d5d9c>Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class <d55055ef-ad6f-4ee2-b806-68911756ae74>NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public <d55055ef-ad6f-4ee2-b806-68911756ae74>NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
[<8c604e0e-3cdb-4bc3-9c46-7379ffe5ba20>Nullable(0)]
[<d55055ef-ad6f-4ee2-b806-68911756ae74>NullableContext(1)]
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
{
	[<d55055ef-ad6f-4ee2-b806-68911756ae74>NullableContext(1)]
	[<8c604e0e-3cdb-4bc3-9c46-7379ffe5ba20>Nullable(0)]
	public static class EpicMMOSystem_API
	{
		[<d55055ef-ad6f-4ee2-b806-68911756ae74>NullableContext(0)]
		private enum API_State
		{
			NotReady,
			NotInstalled,
			Ready
		}

		[<d55055ef-ad6f-4ee2-b806-68911756ae74>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 eGetAttributeRusty;

		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 int GetAttributeRusty(string attribute)
		{
			int result = 0;
			Init();
			if (eGetAttributeRusty != null)
			{
				result = (int)eGetAttributeRusty.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);
				eGetAttribute = type.GetMethod("GetAttribute", BindingFlags.Static | BindingFlags.Public);
				eGetAttributeRusty = 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);
		}

		[<d55055ef-ad6f-4ee2-b806-68911756ae74>NullableContext(1)]
		public static int GetAttributeRusty(string attribute)
		{
			if (!Enum.TryParse<EpicMMOSystem_API.Attribut>(attribute, ignoreCase: true, out var result))
			{
				return 0;
			}
			int parameter = (int)result;
			return LevelSystem.Instance.getParameter((Parameter)parameter);
		}
	}
	[PublicAPI]
	[<d55055ef-ad6f-4ee2-b806-68911756ae74>NullableContext(1)]
	[<8c604e0e-3cdb-4bc3-9c46-7379ffe5ba20>Nullable(0)]
	public static class Marketplace_API
	{
		[<d55055ef-ad6f-4ee2-b806-68911756ae74>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
		}

		[<d55055ef-ad6f-4ee2-b806-68911756ae74>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]
	public struct Monster
	{
		[<8c604e0e-3cdb-4bc3-9c46-7379ffe5ba20>Nullable(1)]
		public string name;

		public int minExp;

		public int maxExp;

		public int level;
	}
	public struct MonsterOld
	{
		[<8c604e0e-3cdb-4bc3-9c46-7379ffe5ba20>Nullable(1)]
		public string name;

		public int minExp;

		public int maxExp;
	}
	[Serializable]
	public class CustomLevel
	{
		[<8c604e0e-3cdb-4bc3-9c46-7379ffe5ba20>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");
		}

		[<d55055ef-ad6f-4ee2-b806-68911756ae74>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()
		{
		}
	}
	internal static class LevelSystem_noncombat
	{
		[HarmonyPatch(typeof(Destructible), "RPC_Damage")]
		private static class Destructible_dmg_patch
		{
			[<d55055ef-ad6f-4ee2-b806-68911756ae74>NullableContext(1)]
			private static void Postfix(Destructible __instance, HitData hit)
			{
				if (EpicMMOSystem.disableNonCombatObjects.Value || EpicMMOSystem.disableDestructablesXP.Value || !__instance.m_nview.IsOwner())
				{
					return;
				}
				if (EpicMMOSystem.debugNonCombatObjects.Value)
				{
					EpicMMOSystem.MLLogger.LogWarning((object)("Destructible name" + ((Object)((Component)__instance).gameObject).name));
				}
				if (__instance.m_destroyed && DataMonsters.contains(((Object)((Component)__instance).gameObject).name))
				{
					Character attacker = hit.GetAttacker();
					if (!((Object)(object)attacker == (Object)null) && attacker is Player && hit.CheckToolTier(__instance.m_minToolTier, false) && !(hit.GetTotalDamage() < 1f))
					{
						int exp = DataMonsters.getExp(((Object)((Component)__instance).gameObject).name);
						LevelSystem.Instance.AddExp(exp);
					}
				}
			}
		}

		[HarmonyPatch(typeof(Pickable), "RPC_Pick")]
		private static class PickablePickMMOWacky
		{
			[<d55055ef-ad6f-4ee2-b806-68911756ae74>NullableContext(1)]
			private static void Postfix(Pickable __instance)
			{
				if (!EpicMMOSystem.disableNonCombatObjects.Value && !EpicMMOSystem.disableMiningXP.Value)
				{
					if (EpicMMOSystem.debugNonCombatObjects.Value)
					{
						EpicMMOSystem.MLLogger.LogWarning((object)("pickable name" + ((Object)__instance).name));
					}
					if (DataMonsters.contains(((Object)__instance).name))
					{
						int exp = DataMonsters.getExp(((Object)__instance).name);
						LevelSystem.Instance.AddExp(exp);
					}
				}
			}
		}

		[HarmonyPatch(typeof(MineRock), "RPC_Hit")]
		private static class MineRock_dmg_patch
		{
			[<d55055ef-ad6f-4ee2-b806-68911756ae74>NullableContext(1)]
			private static void Postfix(MineRock __instance, HitData hit)
			{
				if (EpicMMOSystem.disableNonCombatObjects.Value || EpicMMOSystem.disableMiningXP.Value)
				{
					return;
				}
				if (EpicMMOSystem.debugNonCombatObjects.Value)
				{
					EpicMMOSystem.MLLogger.LogWarning((object)("MineRock name" + ((Object)((Component)__instance).gameObject).name));
				}
				if (DataMonsters.contains(((Object)((Component)__instance).gameObject).name))
				{
					Character attacker = hit.GetAttacker();
					if (!((Object)(object)attacker == (Object)null) && attacker is Player && hit.CheckToolTier(__instance.m_minToolTier, false) && !(hit.GetTotalDamage() < 1f))
					{
						int exp = DataMonsters.getExp(((Object)((Component)__instance).gameObject).name);
						LevelSystem.Instance.AddExp(exp);
					}
				}
			}
		}

		[HarmonyPatch(typeof(MineRock5), "RPC_Damage")]
		private static class MineRock5_dmg_patch
		{
			[<d55055ef-ad6f-4ee2-b806-68911756ae74>NullableContext(1)]
			private static void Postfix(MineRock5 __instance, HitData hit)
			{
				if (EpicMMOSystem.disableNonCombatObjects.Value || EpicMMOSystem.disableMiningXP.Value)
				{
					return;
				}
				if (EpicMMOSystem.debugNonCombatObjects.Value)
				{
					EpicMMOSystem.MLLogger.LogWarning((object)("MineRock5 name" + ((Object)((Component)__instance).gameObject).name));
				}
				if (DataMonsters.contains(((Object)((Component)__instance).gameObject).name))
				{
					Character attacker = hit.GetAttacker();
					if (!((Object)(object)attacker == (Object)null) && attacker is Player && hit.CheckToolTier(__instance.m_minToolTier, false) && !(hit.GetTotalDamage() < 1f))
					{
						int exp = DataMonsters.getExp(((Object)((Component)__instance).gameObject).name);
						LevelSystem.Instance.AddExp(exp);
					}
				}
			}
		}

		[HarmonyPatch(typeof(Game), "IncrementPlayerStat")]
		private static class CheckPlayerStats
		{
			private static void Postfix(PlayerStatType stat)
			{
				//IL_0005: 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_0010: Invalid comparison between Unknown and I4
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				//IL_0015: Invalid comparison between Unknown and I4
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				//IL_001a: Invalid comparison between Unknown and I4
				if (!SeeifDied.ContainsKey(stat))
				{
					return;
				}
				if ((int)stat != 28)
				{
					if ((int)stat != 35)
					{
						if ((int)stat == 36 && SeeifDied[(PlayerStatType)36] == 1)
						{
							SeeifDied[(PlayerStatType)36] = 2;
						}
					}
					else if (SeeifDied[(PlayerStatType)35] == 1)
					{
						SeeifDied[(PlayerStatType)35] = 2;
					}
				}
				else if (SeeifDied[(PlayerStatType)28] == 1)
				{
					SeeifDied[(PlayerStatType)28] = 2;
				}
			}
		}

		[HarmonyPatch(typeof(TreeBase), "RPC_Damage")]
		private static class TreeBase_dmg_patch
		{
			private static void Prefix()
			{
				SeeifDied[(PlayerStatType)28] = 1;
			}

			[<d55055ef-ad6f-4ee2-b806-68911756ae74>NullableContext(1)]
			private static void Postfix(TreeBase __instance, HitData hit)
			{
				if (EpicMMOSystem.disableNonCombatObjects.Value || EpicMMOSystem.disableTreeXP.Value)
				{
					return;
				}
				if (EpicMMOSystem.debugNonCombatObjects.Value)
				{
					EpicMMOSystem.MLLogger.LogWarning((object)("Treebase name" + ((Object)((Component)__instance).gameObject).name));
				}
				if (SeeifDied[(PlayerStatType)28] == 1)
				{
					SeeifDied[(PlayerStatType)28] = 0;
					return;
				}
				SeeifDied[(PlayerStatType)28] = 0;
				if (DataMonsters.contains(((Object)((Component)__instance).gameObject).name))
				{
					Character attacker = hit.GetAttacker();
					if (!((Object)(object)attacker == (Object)null) && attacker is Player && hit.CheckToolTier(__instance.m_minToolTier, false) && !(hit.GetTotalDamage() < 1f))
					{
						int exp = DataMonsters.getExp(((Object)((Component)__instance).gameObject).name);
						LevelSystem.Instance.AddExp(exp);
					}
				}
			}
		}

		[HarmonyPatch(typeof(TreeLog), "RPC_Damage")]
		private static class TreeLog_dmg_patch
		{
			private static void Prefix()
			{
				SeeifDied[(PlayerStatType)36] = 1;
				SeeifDied[(PlayerStatType)35] = 1;
			}

			[<d55055ef-ad6f-4ee2-b806-68911756ae74>NullableContext(1)]
			private static void Postfix(TreeLog __instance, HitData hit)
			{
				if (EpicMMOSystem.disableNonCombatObjects.Value || EpicMMOSystem.disableTreeXP.Value || !__instance.m_nview.IsOwner())
				{
					return;
				}
				if (EpicMMOSystem.debugNonCombatObjects.Value)
				{
					EpicMMOSystem.MLLogger.LogWarning((object)("TreeLog name" + ((Object)((Component)__instance).gameObject).name));
				}
				if (DataMonsters.contains(((Object)((Component)__instance).gameObject).name))
				{
					Character attacker = hit.GetAttacker();
					if (!((Object)(object)attacker == (Object)null) && attacker is Player && hit.CheckToolTier(__instance.m_minToolTier, false) && !(hit.GetTotalDamage() < 1f))
					{
						int exp = DataMonsters.getExp(((Object)((Component)__instance).gameObject).name);
						LevelSystem.Instance.AddExp(exp);
					}
				}
			}
		}

		[HarmonyPatch(typeof(Tameable), "Tame")]
		private static class Tameable_give_xp_patch
		{
			[<d55055ef-ad6f-4ee2-b806-68911756ae74>NullableContext(1)]
			private static void Postfix(Tameable __instance)
			{
				//IL_0033: Unknown result type (might be due to invalid IL or missing references)
				if (__instance.m_nview.IsOwner() && !EpicMMOSystem.disableTameXP.Value && DataMonsters.contains(((Object)((Component)__instance).gameObject).name) && Object.op_Implicit((Object)(object)Player.GetClosestPlayer(((Component)__instance).transform.position, 30f)))
				{
					int exp = DataMonsters.getExp(((Object)((Component)__instance).gameObject).name);
					LevelSystem.Instance.AddExp(exp * EpicMMOSystem.MultiplierForXPTaming.Value);
				}
			}
		}

		[HarmonyPatch(typeof(Player), "PlacePiece")]
		private static class Player_placepiece_patch_epicmmoA
		{
			[<d55055ef-ad6f-4ee2-b806-68911756ae74>NullableContext(1)]
			private static void Postfix(Player __instance, Piece piece)
			{
				if (EpicMMOSystem.disableNonCombatObjects.Value || EpicMMOSystem.disablePieceXP.Value)
				{
					return;
				}
				if (piece.m_cultivatedGroundOnly)
				{
					if (EpicMMOSystem.debugNonCombatObjects.Value)
					{
						EpicMMOSystem.MLLogger.LogWarning((object)("plant name" + ((Object)piece).name));
					}
					if (DataMonsters.contains(((Object)piece).name + "(Clone)"))
					{
						int exp = DataMonsters.getExp(((Object)piece).name + "(Clone)");
						LevelSystem.Instance.AddExp(exp);
					}
				}
				else if (!(lastpiece == ((Object)piece).name))
				{
					lastpiece = ((Object)piece).name;
					if (EpicMMOSystem.debugNonCombatObjects.Value)
					{
						EpicMMOSystem.MLLogger.LogWarning((object)("piece name" + ((Object)piece).name));
					}
					if (DataMonsters.contains(((Object)piece).name + "(Clone)"))
					{
						int exp2 = DataMonsters.getExp(((Object)piece).name + "(Clone)");
						LevelSystem.Instance.AddExp(exp2);
					}
				}
			}
		}

		[HarmonyPatch(typeof(Fish), "OnHooked")]
		private static class Fish_Hook_patch
		{
			[<d55055ef-ad6f-4ee2-b806-68911756ae74>NullableContext(1)]
			private static void Postfix(Fish __instance)
			{
				if (EpicMMOSystem.disableNonCombatObjects.Value || (Object)(object)__instance.m_fishingFloat == (Object)null)
				{
					return;
				}
				if (EpicMMOSystem.debugNonCombatObjects.Value)
				{
					EpicMMOSystem.MLLogger.LogWarning((object)("fish name" + ((Object)((Component)__instance).gameObject).name));
				}
				if (DataMonsters.contains(((Object)((Component)__instance).gameObject).name))
				{
					Character owner = __instance.m_fishingFloat.GetOwner();
					if (!((Object)(object)owner == (Object)null) && owner is Player)
					{
						int exp = DataMonsters.getExp(((Object)((Component)__instance).gameObject).name);
						int maxExp = DataMonsters.getMaxExp(((Object)((Component)__instance).gameObject).name);
						float value = EpicMMOSystem.expForLvlMonster.Value;
						int level = DataMonsters.getLevel(((Object)((Component)__instance).gameObject).name);
						int exp2 = Convert.ToInt32((float)exp + (float)maxExp * value * (float)(level - 1));
						LevelSystem.Instance.AddExp(exp2);
					}
				}
			}
		}

		[HarmonyPatch(typeof(Fish), "Interact")]
		private static class Fish_Caught_patch_interact
		{
			[<d55055ef-ad6f-4ee2-b806-68911756ae74>NullableContext(1)]
			private static void Postfix(Fish __instance, Humanoid character, bool repeat, bool alt)
			{
				if (!EpicMMOSystem.disableNonCombatObjects.Value && !EpicMMOSystem.disableFishPickupXP.Value && Object.op_Implicit((Object)(object)__instance) && !repeat && !((Object)(object)character == (Object)null) && character is Player)
				{
					if (EpicMMOSystem.debugNonCombatObjects.Value)
					{
						EpicMMOSystem.MLLogger.LogWarning((object)("fish Interact name" + ((Object)__instance).name));
					}
					if (DataMonsters.contains(((Object)__instance).name) && !(((Object)((Component)__instance).gameObject).name == lastfishname))
					{
						lastfishname = ((Object)((Component)__instance).gameObject).name;
						int exp = DataMonsters.getExp(((Object)((Component)__instance).gameObject).name);
						int maxExp = DataMonsters.getMaxExp(((Object)((Component)__instance).gameObject).name);
						float value = EpicMMOSystem.expForLvlMonster.Value;
						int level = DataMonsters.getLevel(((Object)((Component)__instance).gameObject).name);
						int exp2 = Convert.ToInt32((float)exp + (float)maxExp * value * (float)(level - 1));
						LevelSystem.Instance.AddExp(exp2);
					}
				}
			}
		}

		[<8c604e0e-3cdb-4bc3-9c46-7379ffe5ba20>Nullable(1)]
		internal static Dictionary<PlayerStatType, int> SeeifDied = new Dictionary<PlayerStatType, int>();

		[<8c604e0e-3cdb-4bc3-9c46-7379ffe5ba20>Nullable(1)]
		private static string lastpiece = "";

		[<8c604e0e-3cdb-4bc3-9c46-7379ffe5ba20>Nullable(1)]
		private static string lastfishname = "";
	}
	public class LevelSystem
	{
		[HarmonyPatch(typeof(ItemData), "GetDamage", new Type[]
		{
			typeof(int),
			typeof(float)
		})]
		private static class MiningPostfix
		{
			[<d55055ef-ad6f-4ee2-b806-68911756ae74>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
		{
			[<d55055ef-ad6f-4ee2-b806-68911756ae74>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
		{
			[<d55055ef-ad6f-4ee2-b806-68911756ae74>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
		{
			[<d55055ef-ad6f-4ee2-b806-68911756ae74>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
		{
			[<d55055ef-ad6f-4ee2-b806-68911756ae74>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
		{
			[<d55055ef-ad6f-4ee2-b806-68911756ae74>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
		{
			[<d55055ef-ad6f-4ee2-b806-68911756ae74>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
		{
			[<d55055ef-ad6f-4ee2-b806-68911756ae74>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
		{
			[<d55055ef-ad6f-4ee2-b806-68911756ae74>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
		{
			[<d55055ef-ad6f-4ee2-b806-68911756ae74>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 = (float)Math.Round(Instance.getAddWeight() + EpicMMOSystem.addDefaultWeight.Value);
				__result += num;
			}
		}

		[HarmonyPatch(typeof(SEMan), "ModifyBlockStaminaUsage")]
		private static class ModifyBlockStaminaUsage_BlockAttack_Patch
		{
			private static void Postfix(float baseStaminaUse, ref float staminaUse)
			{
				staminaUse -= Instance.getReducedStaminaBlock() / 100f * staminaUse;
			}
		}

		[HarmonyPatch(typeof(Character), "ApplyDamage")]
		public class AddCritDmg
		{
			[<d55055ef-ad6f-4ee2-b806-68911756ae74>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()));
				}
			}
		}

		[<8c604e0e-3cdb-4bc3-9c46-7379ffe5ba20>Nullable(1)]
		private CultureInfo invC = CultureInfo.InvariantCulture;

		[<8c604e0e-3cdb-4bc3-9c46-7379ffe5ba20>Nullable(1)]
		private static LevelSystem instance;

		[<8c604e0e-3cdb-4bc3-9c46-7379ffe5ba20>Nullable(1)]
		private static Dictionary<int, long> levelsExp;

		[<8c604e0e-3cdb-4bc3-9c46-7379ffe5ba20>Nullable(1)]
		private string pluginKey = "EpicMMOSystem";

		[<8c604e0e-3cdb-4bc3-9c46-7379ffe5ba20>Nullable(1)]
		private const string midleKey = "LevelSystem";

		[<8c604e0e-3cdb-4bc3-9c46-7379ffe5ba20>Nullable(1)]
		private int[] depositPoint = new int[6];

		private float singleRate;

		private static int HoldCarryWeightTimes;

		private static float HoldCarryWeight;

		[<8c604e0e-3cdb-4bc3-9c46-7379ffe5ba20>Nullable(1)]
		public static LevelSystem Instance
		{
			[<d55055ef-ad6f-4ee2-b806-68911756ae74>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 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, 
					"Dexterity" => EpicMMOSystem.maxValueDexterity.Value, 
					"Intellect" => EpicMMOSystem.maxValueIntelligence.Value, 
					"Body" => EpicMMOSystem.maxValueEndurance.Value, 
					"Endurance" => EpicMMOSystem.maxValueEndurance.Value, 
					"Vigour" => EpicMMOSystem.maxValueVigour.Value, 
					"Special" => EpicMMOSystem.maxValueSpecializing.Value, 
					"Specializing" => 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, 
				"Dexterity" => EpicMMOSystem.maxValueDexterity.Value, 
				"Intellect" => EpicMMOSystem.maxValueIntelligence.Value, 
				"Body" => EpicMMOSystem.maxValueEndurance.Value, 
				"Endurance" => EpicMMOSystem.maxValueEndurance.Value, 
				"Vigour" => EpicMMOSystem.maxValueVigour.Value, 
				"Special" => EpicMMOSystem.maxValueSpecializing.Value, 
				"Specializing" => 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);
			}
			int totalDepositPoints = getTotalDepositPoints();
			return num2 - num3 - totalDepositPoints;
		}

		public void addPointsParametr(Parameter parameter, int addPoint)
		{
			int freePoints = getFreePoints();
			if (freePoints > 0)
			{
				int num = Mathf.Clamp(addPoint, 1, freePoints);
				depositPoint[(int)parameter] += 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(EpicMMOSystem.noExpPastLVLPopup.Value);
				}
				return;
			}
			float value = EpicMMOSystem.rateExp.Value;
			float num = (float)exp * (value + singleRate);
			if (noxpMulti)
			{
				num = exp;
			}
			if (((Character)Player.m_localPlayer).m_seman.HaveStatusEffect(StringExtensionMethods.GetStableHashCode("Potion_MMO_Greater")))
			{
				num = EpicMMOSystem.XPforGreaterPotion.Value * num;
			}
			else if (((Character)Player.m_localPlayer).m_seman.HaveStatusEffect(StringExtensionMethods.GetStableHashCode("Potion_MMO_Medium")))
			{
				num = EpicMMOSystem.XPforMediumPotion.Value * num;
			}
			else if (((Character)Player.m_localPlayer).m_seman.HaveStatusEffect(StringExtensionMethods.GetStableHashCode("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++)
			{
				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 getDepositPoint(Parameter parameter)
		{
			return depositPoint[(int)parameter];
		}

		public int getTotalDepositPoints()
		{
			int num = 0;
			for (int i = 0; i < depositPoint.Length; i++)
			{
				if (depositPoint[i] != 0)
				{
					num += depositPoint[i];
				}
			}
			return num;
		}

		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)
				{
					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()
		{
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			Player.m_localPlayer.m_customData[EpicMMOSystem.PlayerAliveString] = "0";
			ZDO zDO = ((Character)Player.m_localPlayer).m_nview.GetZDO();
			zDO.Set("EpicMMOSystem" + EpicMMOSystem.PlayerAliveString, 0);
			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();
				ZDOMan.instance.ForceSendZDO(zDO.m_uid);
			}
		}

		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_0079: 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();
			Player.m_localPlayer.m_customData["epicmmolevel"] = num.ToString();
			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;
			}
			float num = 0f;
			if (HoldCarryWeightTimes == 0)
			{
				int parameter = getParameter(Parameter.Strength);
				float value = EpicMMOSystem.addWeight.Value;
				num = (HoldCarryWeight = (float)parameter * value);
			}
			else
			{
				num = HoldCarryWeight;
			}
			HoldCarryWeightTimes++;
			if (HoldCarryWeightTimes == 50)
			{
				HoldCarryWeightTimes = 0;
			}
			return num;
		}

		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.startCritChance.Value;
		}
	}
	[<8c604e0e-3cdb-4bc3-9c46-7379ffe5ba20>Nullable(0)]
	[<d55055ef-ad6f-4ee2-b806-68911756ae74>NullableContext(1)]
	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]
	[<d55055ef-ad6f-4ee2-b806-68911756ae74>NullableContext(1)]
	[<8c604e0e-3cdb-4bc3-9c46-7379ffe5ba20>Nullable(0)]
	public class FriendInfo
	{
		public string name;

		public string host;

		public int level;

		public int moClass;
	}
	[<8c604e0e-3cdb-4bc3-9c46-7379ffe5ba20>Nullable(0)]
	[<d55055ef-ad6f-4ee2-b806-68911756ae74>NullableContext(1)]
	public static class FriendsSystem
	{
		[HarmonyPatch(typeof(ZNetScene), "Awake")]
		[<d55055ef-ad6f-4ee2-b806-68911756ae74>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());
		}
	}
	[<8c604e0e-3cdb-4bc3-9c46-7379ffe5ba20>Nullable(0)]
	[<d55055ef-ad6f-4ee2-b806-68911756ae74>NullableContext(1)]
	public static class MyUI
	{
		[<d55055ef-ad6f-4ee2-b806-68911756ae74>NullableContext(0)]
		[HarmonyPatch(typeof(InventoryGui), "Show")]
		public static class ShowPanel_Path
		{
			public static void Postfix()
			{
				Show();
			}
		}

		[<d55055ef-ad6f-4ee2-b806-68911756ae74>NullableContext(0)]
		[HarmonyPatch(typeof(InventoryGui), "Hide")]
		public static class HidePanel_Path
		{
			public static void Postfix()
			{
				Hide();
			}
		}

		[HarmonyPatch(typeof(Menu), "IsVisible")]
		[<d55055ef-ad6f-4ee2-b806-68911756ae74>NullableContext(0)]
		private static class BufferUIFix
		{
			private static void Postfix(ref bool __result)
			{
				if (textField.isFocused)
				{
					__result = true;
				}
			}
		}

		[<d55055ef-ad6f-4ee2-b806-68911756ae74>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);
					EpicMMOSystemUI.coroutine = ((MonoBehaviour)EpicMMOSystemUI.Instance).StartCoroutine("Positionpanels");
				}
				if (!visible && UIToggle && !EpicMMOSystem.oldExpBar.Value)
				{
					((Component)expPanelRoot).gameObject.SetActive(false);
					UIToggle = false;
				}
			}
		}

		[HarmonyPatch(typeof(Hud), "Awake")]
		[<d55055ef-ad6f-4ee2-b806-68911756ae74>NullableContext(0)]
		public static class InstantiateExpPanel
		{
			[<d55055ef-ad6f-4ee2-b806-68911756ae74>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);
				}
				EpicMMOSystem.MLLogger.LogInfo((object)"Call Awake");
			}
		}

		[HarmonyPatch(typeof(Hud), "UpdateHealth")]
		[<d55055ef-ad6f-4ee2-b806-68911756ae74>NullableContext(0)]
		public static class UpdateHealth
		{
			[<d55055ef-ad6f-4ee2-b806-68911756ae74>NullableContext(1)]
			private static bool Prefix(Player player)
			{
				if (EpicMMOSystem.oldExpBar.Value)
				{
					eLevelText.text = string.Format("{0} {1}", localization["$lvl"], currentLVL);
					return true;
				}
				if (!firstloadHP)
				{
					((Component)((Component)expPanelRoot).GetComponent<Canvas>()).gameObject.SetActive(true);
					firstloadHP = true;
				}
				if (DisableHPBar)
				{
					return 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;
			}
		}

		[<d55055ef-ad6f-4ee2-b806-68911756ae74>NullableContext(0)]
		[HarmonyPatch(typeof(Hud), "UpdateStamina")]
		public static class UpdateStamina
		{
			[<d55055ef-ad6f-4ee2-b806-68911756ae74>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;
			}
		}

		[<d55055ef-ad6f-4ee2-b806-68911756ae74>NullableContext(0)]
		[HarmonyPatch(typeof(Hud), "UpdateEitr")]
		public static class UpdateEitr
		{
			[<d55055ef-ad6f-4ee2-b806-68911756ae74>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;
			}
		}

		[<d55055ef-ad6f-4ee2-b806-68911756ae74>NullableContext(0)]
		[HarmonyPatch(typeof(Game), "SpawnPlayer")]
		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;
				}
			}
		}

		[<8c604e0e-3cdb-4bc3-9c46-7379ffe5ba20>Nullable(0)]
		private class FriendsCell
		{
			[<d55055ef-ad6f-4ee2-b806-68911756ae74>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);
			}
		}

		[<d55055ef-ad6f-4ee2-b806-68911756ae74>NullableContext(0)]
		[HarmonyPatch(typeof(Game), "Logout")]
		public static class DataFriendsClear
		{
			public static void Prefix()
			{
				inviteList.Clear();
				friendsData.ClearFriend();
			}
		}

		[<8c604e0e-3cdb-4bc3-9c46-7379ffe5ba20>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);
				int depositPoint = LevelSystem.Instance.getDepositPoint(parameter);
				num2 += depositPoint;
				text.text = string.Format("{0}: {1}", localization["$parameter_" + parameter.ToString().ToLower()], num2);
				buttons.SetActive(freePoints > 0 && num2 < num);
			}
		}

		[<d55055ef-ad6f-4ee2-b806-68911756ae74>NullableContext(0)]
		[HarmonyPatch(typeof(InventoryGui), "Awake")]
		private static class InventoryGui_Awake_Patch
		{
			[<d55055ef-ad6f-4ee2-b806-68911756ae74>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()
		{
			try
			{
				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;
				}
			}
			catch (Exception ex)
			{
				EpicMMOSystem.MLLogger.LogWarning((object)("ExpBar update failed " + ex));
			}
		}

		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_02f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0302: Expected O, but got Unknown
			//IL_0354: Unknown result type (might be due to invalid IL or missing references)
			//IL_035e: Expected O, but got Unknown
			//IL_03b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ba: 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));
			((UnityEvent)((Component)levelSystemPanel.transform.Find("Close")).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).tran