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: AssemblyFileVersion("1.9.60")]
[assembly: Guid("4358610B-F3F4-4843-B7AF-98B7BC60DCDE")]
[assembly: ComVisible(false)]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCopyright("Copyright © 2022")]
[assembly: AssemblyProduct("EpicMMOSystem")]
[assembly: AssemblyCompany("WackyMoleWackyMole")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyTitle("EpicMMOSystem")]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: CompilationRelaxations(8)]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.9.60.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[<8c1690b5-b1ae-44eb-a821-6cdcb4c5b120>Embedded]
internal sealed class <8c1690b5-b1ae-44eb-a821-6cdcb4c5b120>EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[<8c1690b5-b1ae-44eb-a821-6cdcb4c5b120>Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class <3b2bd33d-f87e-4f02-816f-4bef815516a7>NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public <3b2bd33d-f87e-4f02-816f-4bef815516a7>NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public <3b2bd33d-f87e-4f02-816f-4bef815516a7>NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[<8c1690b5-b1ae-44eb-a821-6cdcb4c5b120>Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
[CompilerGenerated]
internal sealed class <2507ed2f-d1a8-45b5-b44c-6d44143fc8d0>NullableContextAttribute : Attribute
{
public readonly byte Flag;
public <2507ed2f-d1a8-45b5-b44c-6d44143fc8d0>NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
}
[<2507ed2f-d1a8-45b5-b44c-6d44143fc8d0>NullableContext(1)]
[<3b2bd33d-f87e-4f02-816f-4bef815516a7>Nullable(0)]
public class ColorUtil
{
public static Color GetColorFromHex(string hex)
{
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
hex = hex.TrimStart(new char[1] { '#' });
Color result = default(Color);
((Color)(ref result))..ctor(255f, 0f, 0f);
if (hex.Length >= 6)
{
result.r = int.Parse(hex.Substring(0, 2), NumberStyles.HexNumber);
result.g = int.Parse(hex.Substring(2, 2), NumberStyles.HexNumber);
result.b = int.Parse(hex.Substring(4, 2), NumberStyles.HexNumber);
if (hex.Length == 8)
{
result.a = int.Parse(hex.Substring(6, 2), NumberStyles.HexNumber);
}
}
return result;
}
public static string GetHexFromColor(Color color)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
return $"#{(int)(color.r * 255f):X2}" + $"{(int)(color.g * 255f):X2}" + $"{(int)(color.b * 255f):X2}" + $"{(int)(color.a * 255f):X2}";
}
}
namespace API
{
[<2507ed2f-d1a8-45b5-b44c-6d44143fc8d0>NullableContext(1)]
[<3b2bd33d-f87e-4f02-816f-4bef815516a7>Nullable(0)]
public static class EpicMMOSystem_API
{
[<2507ed2f-d1a8-45b5-b44c-6d44143fc8d0>NullableContext(0)]
private enum API_State
{
NotReady,
NotInstalled,
Ready
}
[<2507ed2f-d1a8-45b5-b44c-6d44143fc8d0>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);
}
[<2507ed2f-d1a8-45b5-b44c-6d44143fc8d0>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);
}
}
[<2507ed2f-d1a8-45b5-b44c-6d44143fc8d0>NullableContext(1)]
[<3b2bd33d-f87e-4f02-816f-4bef815516a7>Nullable(0)]
[PublicAPI]
public static class Marketplace_API
{
[Flags]
[<2507ed2f-d1a8-45b5-b44c-6d44143fc8d0>NullableContext(0)]
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
}
[Flags]
[<2507ed2f-d1a8-45b5-b44c-6d44143fc8d0>NullableContext(0)]
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
{
[<3b2bd33d-f87e-4f02-816f-4bef815516a7>Nullable(1)]
public string name;
public int minExp;
public int maxExp;
public int level;
}
public struct MonsterOld
{
[<3b2bd33d-f87e-4f02-816f-4bef815516a7>Nullable(1)]
public string name;
public int minExp;
public int maxExp;
}
[Serializable]
public class CustomLevel
{
[<3b2bd33d-f87e-4f02-816f-4bef815516a7>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");
}
[<2507ed2f-d1a8-45b5-b44c-6d44143fc8d0>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 class LevelSystem_noncombat
{
[HarmonyPatch(typeof(Destructible), "RPC_Damage")]
private static class Destructible_dmg_patch
{
[<2507ed2f-d1a8-45b5-b44c-6d44143fc8d0>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
{
[<2507ed2f-d1a8-45b5-b44c-6d44143fc8d0>NullableContext(1)]
private static void Postfix(Pickable __instance)
{
if (!EpicMMOSystem.disableNonCombatObjects.Value && !EpicMMOSystem.disableMiningXP.Value && readytopick)
{
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);
readytopick = false;
((MonoBehaviour)EpicMMOSystem.Instance).StartCoroutine(PickWaitme());
}
}
}
}
[HarmonyPatch(typeof(MineRock), "RPC_Hit")]
private static class MineRock_dmg_patch
{
[<2507ed2f-d1a8-45b5-b44c-6d44143fc8d0>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
{
[<2507ed2f-d1a8-45b5-b44c-6d44143fc8d0>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;
}
[<2507ed2f-d1a8-45b5-b44c-6d44143fc8d0>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;
}
[<2507ed2f-d1a8-45b5-b44c-6d44143fc8d0>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
{
[<2507ed2f-d1a8-45b5-b44c-6d44143fc8d0>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
{
[<2507ed2f-d1a8-45b5-b44c-6d44143fc8d0>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
{
[<2507ed2f-d1a8-45b5-b44c-6d44143fc8d0>NullableContext(1)]
private static void Postfix(Fish __instance)
{
if ((Object)(object)__instance.m_fishingFloat == (Object)null)
{
return;
}
Character owner = __instance.m_fishingFloat.GetOwner();
if (!((Object)(object)owner == (Object)null))
{
Player val = (Player)(object)((owner is Player) ? owner : null);
if (val != null)
{
TryGiveFishExp(__instance, val, pickupOnly: false);
}
}
}
}
[HarmonyPatch(typeof(Fish), "Interact")]
private static class Fish_Caught_patch_interact
{
[<2507ed2f-d1a8-45b5-b44c-6d44143fc8d0>NullableContext(1)]
private static void Postfix(Fish __instance, Humanoid character, bool repeat, bool alt)
{
if (Object.op_Implicit((Object)(object)__instance) && !(repeat || alt) && !((Object)(object)character == (Object)null))
{
Player val = (Player)(object)((character is Player) ? character : null);
if (val != null)
{
TryGiveFishExp(__instance, val, pickupOnly: true);
}
}
}
}
[CompilerGenerated]
private sealed class <PickWaitme>d__7 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <PickWaitme>d__7(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(3f);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
readytopick = true;
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[<3b2bd33d-f87e-4f02-816f-4bef815516a7>Nullable(1)]
private const string FishXpAwardedKey = "EpicMMOSystem_FishXpAwarded";
[<3b2bd33d-f87e-4f02-816f-4bef815516a7>Nullable(1)]
private static readonly HashSet<int> FishXpAwardedFallback = new HashSet<int>();
internal static bool readytopick = true;
[<3b2bd33d-f87e-4f02-816f-4bef815516a7>Nullable(1)]
internal static Dictionary<PlayerStatType, int> SeeifDied = new Dictionary<PlayerStatType, int>();
[<3b2bd33d-f87e-4f02-816f-4bef815516a7>Nullable(1)]
private static string lastpiece = "";
[<2507ed2f-d1a8-45b5-b44c-6d44143fc8d0>NullableContext(1)]
private static bool HasFishXpBeenAwarded(Fish fish)
{
if ((Object)(object)fish == (Object)null)
{
return true;
}
ZNetView nview = fish.m_nview;
if ((Object)(object)nview != (Object)null && nview.IsValid())
{
return nview.GetZDO().GetBool("EpicMMOSystem_FishXpAwarded", false);
}
return FishXpAwardedFallback.Contains(((Object)fish).GetInstanceID());
}
[<2507ed2f-d1a8-45b5-b44c-6d44143fc8d0>NullableContext(1)]
private static void MarkFishXpAwarded(Fish fish)
{
if (!((Object)(object)fish == (Object)null))
{
ZNetView nview = fish.m_nview;
if ((Object)(object)nview != (Object)null && nview.IsValid())
{
nview.GetZDO().Set("EpicMMOSystem_FishXpAwarded", true);
}
else
{
FishXpAwardedFallback.Add(((Object)fish).GetInstanceID());
}
}
}
[<2507ed2f-d1a8-45b5-b44c-6d44143fc8d0>NullableContext(1)]
private static void TryGiveFishExp(Fish fish, Player player, bool pickupOnly)
{
if (!EpicMMOSystem.disableNonCombatObjects.Value && (!pickupOnly || !EpicMMOSystem.disableFishPickupXP.Value) && !((Object)(object)fish == (Object)null) && !((Object)(object)player == (Object)null) && !((Object)(object)player != (Object)(object)Player.m_localPlayer) && DataMonsters.contains(((Object)((Component)fish).gameObject).name) && !HasFishXpBeenAwarded(fish))
{
if (EpicMMOSystem.debugNonCombatObjects.Value)
{
EpicMMOSystem.MLLogger.LogWarning((object)((pickupOnly ? "fish Interact name" : "fish name") + ((Object)((Component)fish).gameObject).name));
}
MarkFishXpAwarded(fish);
int exp = DataMonsters.getExp(((Object)((Component)fish).gameObject).name);
int maxExp = DataMonsters.getMaxExp(((Object)((Component)fish).gameObject).name);
float value = EpicMMOSystem.expForLvlMonster.Value;
int level = DataMonsters.getLevel(((Object)((Component)fish).gameObject).name);
float value2 = (float)exp + (float)maxExp * value * (float)(level - 1);
LevelSystem.Instance.AddExp(Convert.ToInt32(value2));
}
}
[IteratorStateMachine(typeof(<PickWaitme>d__7))]
[<2507ed2f-d1a8-45b5-b44c-6d44143fc8d0>NullableContext(1)]
public static IEnumerator PickWaitme()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <PickWaitme>d__7(0);
}
}
public class LevelSystem
{
[HarmonyPatch(typeof(ItemData), "GetDamage", new Type[]
{
typeof(int),
typeof(float)
})]
private static class MiningPostfix
{
[<2507ed2f-d1a8-45b5-b44c-6d44143fc8d0>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;
}
}
}
[HarmonyPriority(600)]
[HarmonyPatch(typeof(WearNTear), "OnPlaced")]
internal static class Player_HealthChangeMMO
{
[<2507ed2f-d1a8-45b5-b44c-6d44143fc8d0>NullableContext(1)]
internal static void Prefix(ref WearNTear __instance)
{
float addPieceHealth = Instance.getAddPieceHealth();
if (addPieceHealth > 0f)
{
WearNTear obj = __instance;
obj.m_health += addPieceHealth;
ZNetView component = ((Component)__instance).GetComponent<ZNetView>();
if (Object.op_Implicit((Object)(object)component) && component.IsValid())
{
component.GetZDO().Set("MMO_ExtraHealth", addPieceHealth);
}
}
}
}
[HarmonyPriority(600)]
[HarmonyPatch(typeof(WearNTear), "Awake")]
internal static class WearNTear_Awake_HealthChangeMMO
{
[<2507ed2f-d1a8-45b5-b44c-6d44143fc8d0>NullableContext(1)]
internal static void Prefix(ref WearNTear __instance)
{
ZNetView component = ((Component)__instance).GetComponent<ZNetView>();
if (Object.op_Implicit((Object)(object)component) && component.IsValid())
{
float @float = component.GetZDO().GetFloat("MMO_ExtraHealth", 0f);
if (@float > 0f)
{
WearNTear obj = __instance;
obj.m_health += @float;
}
}
}
}
[HarmonyPatch(typeof(ItemData), "GetDamage", new Type[]
{
typeof(int),
typeof(float)
})]
private static class TreeCuttingPostfix
{
[<2507ed2f-d1a8-45b5-b44c-6d44143fc8d0>NullableContext(1)]
private static void Postfix(ItemData __instance, ref DamageTypes __result)
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Invalid comparison between Unknown and I4
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Invalid comparison between Unknown and I4
if (__instance == null)
{
return;
}
SkillType skillType = __instance.m_shared.m_skillType;
if ((int)skillType == 7 || (int)skillType == 13)
{
float addTreeCuttingDmg = Instance.getAddTreeCuttingDmg();
if (!(addTreeCuttingDmg <= 0f))
{
float num = 1f + addTreeCuttingDmg / 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
{
[<2507ed2f-d1a8-45b5-b44c-6d44143fc8d0>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
{
[<2507ed2f-d1a8-45b5-b44c-6d44143fc8d0>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
{
[<2507ed2f-d1a8-45b5-b44c-6d44143fc8d0>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
{
[<2507ed2f-d1a8-45b5-b44c-6d44143fc8d0>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
{
[<2507ed2f-d1a8-45b5-b44c-6d44143fc8d0>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
{
[<2507ed2f-d1a8-45b5-b44c-6d44143fc8d0>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(Game), "Start")]
public static class RegisterRpcStrength
{
public static void Postfix()
{
ZRoutedRpc.instance.Register<ZPackage>("EpicMMOSystem GiveCritToPlayer", (Action<long, ZPackage>)RPC_GiveCritToPlayer);
}
}
[HarmonyPatch(typeof(ItemData), "GetDamage", new Type[]
{
typeof(int),
typeof(float)
})]
public class AddDamageStrength_Path
{
[<2507ed2f-d1a8-45b5-b44c-6d44143fc8d0>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
{
[<2507ed2f-d1a8-45b5-b44c-6d44143fc8d0>NullableContext(1)]
private static void Prefix(Character __instance, ref bool showDamageText, ref HitData hit)
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: 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_017f: Unknown result type (might be due to invalid IL or missing references)
//IL_0186: Expected O, but got Unknown
//IL_018a: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)__instance == (Object)null || !hit.HaveAttacker())
{
return;
}
Character attacker = hit.GetAttacker();
if ((Object)(object)attacker == (Object)null || (int)__instance.m_faction == 0 || (int)attacker.m_faction != 0 || Random.Range(0f, 100f) >= Instance.getAddCriticalChance())
{
return;
}
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;
if (Object.op_Implicit((Object)(object)Player.m_localPlayer) && (Object)(object)attacker == (Object)(object)Player.m_localPlayer)
{
new CritDmgVFX().CriticalVFX(hit.m_point, hit.GetTotalDamage());
showDamageText = false;
EpicMMOSystem.MLLogger.LogInfo((object)$"You got a Critical Hit: {hit.GetTotalDamage():0}");
return;
}
Player val = (Player)(object)((attacker is Player) ? attacker : null);
if (val != null && TryGetPeerId(val, out var peerId))
{
ZPackage val2 = new ZPackage();
val2.Write(hit.m_point);
val2.Write(hit.GetTotalDamage());
ZRoutedRpc.instance.InvokeRoutedRPC(peerId, "EpicMMOSystem GiveCritToPlayer", new object[1] { val2 });
EpicMMOSystem.MLLogger.LogInfo((object)$"Sent crit VFX to {((Character)val).GetHoverName()} for {hit.GetTotalDamage():0}");
}
}
}
[<3b2bd33d-f87e-4f02-816f-4bef815516a7>Nullable(1)]
private CultureInfo invC = CultureInfo.InvariantCulture;
[<3b2bd33d-f87e-4f02-816f-4bef815516a7>Nullable(1)]
private static LevelSystem instance;
[<3b2bd33d-f87e-4f02-816f-4bef815516a7>Nullable(1)]
private static Dictionary<int, long> levelsExp;
[<3b2bd33d-f87e-4f02-816f-4bef815516a7>Nullable(1)]
private string pluginKey = "EpicMMOSystem";
[<3b2bd33d-f87e-4f02-816f-4bef815516a7>Nullable(1)]
private const string midleKey = "LevelSystem";
[<3b2bd33d-f87e-4f02-816f-4bef815516a7>Nullable(1)]
private int[] depositPoint = new int[6];
private float singleRate;
private static int HoldCarryWeightTimes;
private static float HoldCarryWeight;
[<3b2bd33d-f87e-4f02-816f-4bef815516a7>Nullable(1)]
public static LevelSystem Instance
{
[<2507ed2f-d1a8-45b5-b44c-6d44143fc8d0>NullableContext(1)]
get
{
if (instance == null)
{
instance = new LevelSystem();
return instance;
}
return instance;
}
}
public float getaddMiningDmg(int pointpending = 0)
{
int num = getParameter(Parameter.Special) + pointpending;
float value = EpicMMOSystem.miningSpeed.Value;
return (float)num * value;
}
public float getAddPieceHealth(int pointpending = 0)
{
int num = getParameter(Parameter.Special) + pointpending;
float value = EpicMMOSystem.constructionPieceHealth.Value;
return (float)num * value;
}
public float getAddTreeCuttingDmg(int pointpending = 0)
{
int num = getParameter(Parameter.Special) + pointpending;
float value = EpicMMOSystem.treeCuttingSpeed.Value;
return (float)num * value;
}
public float getAddHp(int pointpending = 0)
{
int num = getParameter(Parameter.Vigour) + pointpending;
float value = EpicMMOSystem.addHp.Value;
return (float)num * value;
}
public float getAddRegenHp(int pointpending = 0)
{
int num = getParameter(Parameter.Vigour) + pointpending;
float value = EpicMMOSystem.regenHp.Value;
return (float)num * value;
}
public float getAddMagicArmor(int pointpending = 0)
{
int num = getParameter(Parameter.Vigour) + pointpending;
float value = EpicMMOSystem.magicArmor.Value;
return (float)num * 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"] = "2";
num = 2L;
EpicMMOSystem.MLLogger.LogWarning((object)"Error in getting current exp, setting exp to 2.");
}
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 ResetTotalPoints()
{
if (Object.op_Implicit((Object)(object)Player.m_localPlayer))
{
Player.m_localPlayer.m_knownTexts[pluginKey + "_LevelSystem_CurrentExp"] = "1";
Player.m_localPlayer.m_knownTexts[pluginKey + "_LevelSystem_TotalExp"] = "1";
Player.m_localPlayer.m_knownTexts[pluginKey + "_LevelSystem_Level"] = "1";
MyUI.UpdateParameterPanel();
MyUI.updateExpBar();
}
}
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(1L);
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 pointpending = 0)
{
int num = getParameter(Parameter.Agility) + pointpending;
float value = EpicMMOSystem.attackSpeed.Value;
return (float)num * value;
}
public float getAttackStamina(int pointpending = 0)
{
int num = getParameter(Parameter.Agility) + pointpending;
float value = EpicMMOSystem.attackStamina.Value;
return (float)num * value;
}
public float getStaminaReduction(int pointpending = 0)
{
int num = getParameter(Parameter.Agility) + pointpending;
float value = EpicMMOSystem.staminaReduction.Value;
return (float)num * value;
}
public float getStaminaRegen(int pointpending = 0)
{
int num = getParameter(Parameter.Body) + pointpending;
float value = EpicMMOSystem.staminaRegen.Value;
return (float)num * value;
}
public float getAddStamina(int pointpending = 0)
{
int num = getParameter(Parameter.Body) + pointpending;
float value = EpicMMOSystem.addStamina.Value;
return (float)num * value;
}
public float getAddPhysicArmor(int pointpending = 0)
{
int num = getParameter(Parameter.Body) + pointpending;
float value = EpicMMOSystem.physicArmor.Value;
return (float)num * value;
}
public float getAddMagicDamage(int pointpending = 0)
{
int num = getParameter(Parameter.Intellect) + pointpending;
float value = EpicMMOSystem.magicDamage.Value;
return (float)num * value;
}
public float getEitrRegen(int pointpending = 0)
{
int num = getParameter(Parameter.Intellect) + pointpending;
float value = EpicMMOSystem.magicEitrRegen.Value;
return (float)num * value;
}
public float getAddEitr(int pointpending = 0)
{
int num = getParameter(Parameter.Intellect) + pointpending;
float value = EpicMMOSystem.addEitr.Value;
return (float)num * value;
}
[<2507ed2f-d1a8-45b5-b44c-6d44143fc8d0>NullableContext(1)]
private static void RPC_GiveCritToPlayer(long sender, ZPackage pkg)
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: 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)
try
{
if (Object.op_Implicit((Object)(object)Player.m_localPlayer))
{
Vector3 position = pkg.ReadVector3();
float damage = pkg.ReadSingle();
new CritDmgVFX().CriticalVFX(position, damage);
EpicMMOSystem.MLLogger.LogInfo((object)"You recieved a Critical Hit from the combat owner: ");
}
}
catch (Exception arg)
{
EpicMMOSystem.MLLogger.LogWarning((object)$"Bug catch RPC_GiveCritToPlayer: {arg}");
}
}
[<2507ed2f-d1a8-45b5-b44c-6d44143fc8d0>NullableContext(1)]
private static bool TryGetPeerId(Player p, out long peerId)
{
peerId = 0L;
if (!Object.op_Implicit((Object)(object)p))
{
return false;
}
ZDO val = (Object.op_Implicit((Object)(object)((Character)p).m_nview) ? ((Character)p).m_nview.GetZDO() : null);
if (val == null)
{
return false;
}
peerId = ((ZDOID)(ref val.m_uid)).UserID;
return peerId != 0;
}
public float getAddPhysicDamage(int pointpending = 0)
{
int num = getParameter(Parameter.Strength) + pointpending;
float value = EpicMMOSystem.physicDamage.Value;
return (float)num * value;
}
public float getAddWeight(int pointpending = 0)
{
if (!Object.op_Implicit((Object)(object)Player.m_localPlayer))
{
return 0f;
}
float num = 0f;
if (HoldCarryWeightTimes == 0)
{
int num2 = getParameter(Parameter.Strength) + pointpending;
float value = EpicMMOSystem.addWeight.Value;
num = (HoldCarryWeight = (float)num2 * value);
}
else
{
num = HoldCarryWeight;
}
HoldCarryWeightTimes++;
if (HoldCarryWeightTimes == 50)
{
HoldCarryWeightTimes = 0;
}
return num;
}
public float getReducedStaminaBlock(int pointpending = 0)
{
int num = getParameter(Parameter.Strength) + pointpending;
float value = EpicMMOSystem.staminaBlock.Value;
return (float)num * value;
}
public float getAddCriticalDmg(int pointpending = 0)
{
int num = getParameter(Parameter.Strength) + pointpending;
float value = EpicMMOSystem.critDmg.Value;
return (float)num * value + EpicMMOSystem.CriticalDefaultDamage.Value;
}
public float getAddCriticalChance(int pointpending = 0)
{
int num = getParameter(Parameter.Special) + pointpending;
float value = EpicMMOSystem.critChance.Value;
return (float)num * value + EpicMMOSystem.startCritChance.Value;
}
}
[<3b2bd33d-f87e-4f02-816f-4bef815516a7>Nullable(0)]
[<2507ed2f-d1a8-45b5-b44c-6d44143fc8d0>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]
[<2507ed2f-d1a8-45b5-b44c-6d44143fc8d0>NullableContext(1)]
[<3b2bd33d-f87e-4f02-816f-4bef815516a7>Nullable(0)]
public class FriendInfo
{
public string name;
public string host;
public int level;
public int moClass;
}
[<2507ed2f-d1a8-45b5-b44c-6d44143fc8d0>NullableContext(1)]
[<3b2bd33d-f87e-4f02-816f-4bef815516a7>Nullable(0)]
public static class FriendsSystem
{
[<2507ed2f-d1a8-45b5-b44c-6d44143fc8d0>NullableContext(0)]
[HarmonyPatch(typeof(ZNetScene), "Awake")]
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_00ea: 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));
return;
}
}
Chat.instance.RPC_ChatMessage(200L, Vector3.zero, 0, UserInfo.GetLocalUser(), string.Format(local["$not_found"], name));
}
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_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: 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);
if (((ZDOID)(ref val.m_characterID)).UserID != sender)
{
EpicMMOSystem.MLLogger.LogWarning((object)"Friend invite sender was not found in player list.");
return;
}
FriendInfo friendInfo = new FriendInfo();
friendInfo.name = val.m_name;
friendInfo.level = level;
friendInfo.moClass = moClass;
Chat.instance.RPC_ChatMessage(200L, Vector3.zero, 0, UserInfo.GetLocalUser(), string.Format(local["$get_invite"], friendInfo.name));
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_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
PlayerInfo val = ZNet.instance.GetPlayerList().Find((PlayerInfo f) => ((ZDOID)(ref f.m_characterID)).UserID == sender);
if (((ZDOID)(ref val.m_characterID)).UserID != sender)
{
EpicMMOSystem.MLLogger.LogWarning((object)"Accepted friend sender was not found in player list.");
return;
}
FriendInfo friendInfo = new FriendInfo();
friendInfo.name = val.m_name;
friendInfo.level = level;
friendInfo.moClass = moClass;
Chat.instance.RPC_ChatMessage(200L, Vector3.zero, 0, UserInfo.GetLocalUser(), string.Format(local["$accept_invite"], friendInfo.name));
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"]));
}
}
[<2507ed2f-d1a8-45b5-b44c-6d44143fc8d0>NullableContext(1)]
[<3b2bd33d-f87e-4f02-816f-4bef815516a7>Nullable(0)]
public static class MyUI
{
[<2507ed2f-d1a8-45b5-b44c-6d44143fc8d0>NullableContext(0)]
[HarmonyPatch(typeof(InventoryGui), "Show")]
public static class ShowPanel_Path
{
public static void Postfix()
{
Show();
}
}
[<2507ed2f-d1a8-45b5-b44c-6d44143fc8d0>NullableContext(0)]
[HarmonyPatch(typeof(InventoryGui), "Hide")]
public static class HidePanel_Path
{
public static void Postfix()
{
Hide();
}
}
[<2507ed2f-d1a8-45b5-b44c-6d44143fc8d0>NullableContext(0)]
[HarmonyPatch(typeof(Menu), "IsVisible")]
private static class BufferUIFix
{
private static void Postfix(ref bool __result)
{
if (textField.isFocused)
{
__result = true;
}
}
}
[<2507ed2f-d1a8-45b5-b44c-6d44143fc8d0>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;
}
}
}
[<2507ed2f-d1a8-45b5-b44c-6d44143fc8d0>NullableContext(0)]
[HarmonyPatch(typeof(Hud), "Awake")]
public static class InstantiateExpPanel
{
[<2507ed2f-d1a8-45b5-b44c-6d44143fc8d0>NullableContext(1)]
private static void Postfix(Hud __instance)
{
//IL_018f: Unknown result type (might be due to invalid IL or missing references)
//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: 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>();
eOldBarImage = eBarImage;
Color val = default(Color);
if (ColorUtility.TryParseHtmlString(EpicMMOSystem.ExpColor.Value, ref val))
{
if (EpicMMOSystem.ExpColor.Value == "#FFFFFF")
{
((Graphic)eBarImage).color = val;
}
else
{
((Graphic)eBarImage).color = val * 2f;
}
}
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 val2 = __instance.m_buildHud.transform.Find("SelectedInfo");
if (Object.op_Implicit((Object)(object)val2))
{
val2.localPosition += new Vector3(0f, 45f, 0f);
}
EpicMMOSystem.MLLogger.LogInfo((object)"Call Awake");
}
}
[HarmonyPatch(typeof(Hud), "UpdateHealth")]
[<2507ed2f-d1a8-45b5-b44c-6d44143fc8d0>NullableContext(0)]
public static class UpdateHealth
{
[<2507ed2f-d1a8-45b5-b44c-6d44143fc8d0>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;
}
}
[HarmonyPatch(typeof(Hud), "UpdateStamina")]
[<2507ed2f-d1a8-45b5-b44c-6d44143fc8d0>NullableContext(0)]
public static class UpdateStamina
{
[<2507ed2f-d1a8-45b5-b44c-6d44143fc8d0>NullableContext(1)]
private static bool Prefix(Player player)
{
if (EpicMMOSystem.oldExpBar.Value)
{
return true;
}
if (DisableStaminaBar)
{
return true;
}
float stamina = player.GetStamina();
float maxStamina = ((Character)player).GetMaxStamina();
staminaImage.fillAmount = stamina / maxStamina;
string text = "";
text = ((!EpicMMOSystem.showMaxHp.Value) ? Mathf.CeilToInt(stamina).ToString() : (Mathf.CeilToInt(stamina) + " / " + Mathf.CeilToInt(maxStamina)));
staminaText.text = text;
return false;
}
}
[HarmonyPatch(typeof(Hud), "UpdateEitr")]
[<2507ed2f-d1a8-45b5-b44c-6d44143fc8d0>NullableContext(0)]
public static class UpdateEitr
{
[<2507ed2f-d1a8-45b5-b44c-6d44143fc8d0>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;
}
}
[<2507ed2f-d1a8-45b5-b44c-6d44143fc8d0>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;
}
}
}
[<3b2bd33d-f87e-4f02-816f-4bef815516a7>Nullable(0)]
private class FriendsCell
{
[<2507ed2f-d1a8-45b5-b44c-6d44143fc8d0>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);
}
}
[<2507ed2f-d1a8-45b5-b44c-6d44143fc8d0>NullableContext(0)]
[HarmonyPatch(typeof(Game), "Logout")]
public static class DataFriendsClear
{
public static void Prefix()
{
inviteList.Clear();
friendsData.ClearFriend();
}
}
[<3b2bd33d-f87e-4f02-816f-4bef815516a7>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);
}
}
[<2507ed2f-d1a8-45b5-b44c-6d44143fc8d0>NullableContext(0)]
[HarmonyPatch(typeof(InventoryGui), "Awake")]
private static class InventoryGui_Awake_Patch
{
[<2507ed2f-d1a8-45b5-b44c-6d44143fc8d0>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 Image eOldBarImage = null;
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 ButtonGuildsPanel;
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();
UI.GetComponentInChildren<Canvas>().sortingOrder = 1510;
}
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();
}
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_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_0145: Unknown result type (might be due to invalid IL or missing references)
//IL_014a: Unknown result type (might be due to invalid IL or missing references)
//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
//IL_0230: Unknown result type (might be due to invalid IL or missing references)
//IL_0235: Unknown result type (might be due to invalid IL or missing references)
expPanel = expPanelRoot.Find("EpicHudPanel");
((Component)expPanelRoot).GetComponentInChildren<Canvas>().sortingOrder = 1511;
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