Decompiled source of Path of Awakening v1.0.1

Path of Awakening.dll

Decompiled 9 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalCompanyInputUtils.Api;
using Microsoft.CodeAnalysis;
using Path_of_Awakening.Skills;
using Unity.Collections;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Path of Awakening")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Path of Awakening")]
[assembly: AssemblyTitle("Path of Awakening")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace Path_of_Awakening
{
	public class AwakeningInputs : LcInputActions
	{
		public static readonly AwakeningInputs Instance = new AwakeningInputs();

		[InputAction("<Keyboard>/3", Name = "触发觉醒技能")]
		public InputAction UseSkillKey { get; set; }

		[InputAction("<Keyboard>/f11", Name = "开关觉醒UI面板")]
		public InputAction ToggleUIPanelKey { get; set; }

		[InputAction("<Keyboard>/y", Name = "接受共生契约")]
		public InputAction AcceptContractKey { get; set; }

		[InputAction("<Keyboard>/n", Name = "拒绝共生契约")]
		public InputAction RejectContractKey { get; set; }
	}
	[HarmonyPatch]
	internal class GamePatches
	{
		public static bool IsSharingDamage;

		[HarmonyPatch(typeof(StartOfRound), "Awake")]
		[HarmonyPrefix]
		private static void OnStartOfRoundAwake()
		{
			SkillManager.CompletelyResetSkills();
			SkillNetworkHandler.Initialize();
		}

		[HarmonyPatch(typeof(GameNetworkManager), "Disconnect")]
		[HarmonyPrefix]
		private static void OnDisconnect()
		{
			SkillManager.CompletelyResetSkills();
		}

		[HarmonyPatch(typeof(StartMatchLever), "PullLever")]
		[HarmonyPostfix]
		private static void OnLeverPulled(StartMatchLever __instance)
		{
			if (__instance.leverHasBeenPulled)
			{
				SkillManager.AutoAssignSkills();
			}
		}

		[HarmonyPatch(typeof(StartOfRound), "ResetShip")]
		[HarmonyPostfix]
		private static void OnShipReset()
		{
			SkillManager.ClearSkills();
		}

		[HarmonyPatch(typeof(StartOfRound), "ReviveDeadPlayers")]
		[HarmonyPostfix]
		private static void OnNewDayStarted()
		{
			SkillManager.ClearSkills();
			if ((Object)(object)SkillUI.Instance != (Object)null)
			{
				SkillUI.Instance.SetPanelState(open: true);
			}
		}

		[HarmonyPatch(typeof(PlayerControllerB), "Update")]
		[HarmonyPostfix]
		private static void OnPlayerUpdate(PlayerControllerB __instance)
		{
			if (!__instance.isPlayerControlled)
			{
				return;
			}
			SoulSymbiosisSkill.GlobalUpdate(__instance);
			if (SkillManager.ActivePlayerSkills.TryGetValue(__instance.playerClientId, out AwakeningSkill value))
			{
				value.OnUpdate(__instance);
				if (((NetworkBehaviour)__instance).IsOwner && AwakeningInputs.Instance.UseSkillKey.triggered && !__instance.isTypingChat && !__instance.inTerminalMenu)
				{
					value.OnActivate(__instance);
				}
			}
		}

		[HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")]
		[HarmonyPostfix]
		private static void OnPlayerConnect()
		{
			SkillNetworkHandler.Initialize();
		}

		[HarmonyPatch(typeof(PlayerControllerB), "DamagePlayer")]
		[HarmonyPrefix]
		private static bool Prefix_DamagePlayer(PlayerControllerB __instance, ref int damageNumber, bool hasDamageSFX, bool callRPC, CauseOfDeath causeOfDeath, int deathAnimation, bool fallDamage, Vector3 force)
		{
			if (__instance.isPlayerDead)
			{
				return true;
			}
			if (((NetworkBehaviour)__instance).IsOwner && SkillManager.ActivePlayerSkills.TryGetValue(__instance.playerClientId, out AwakeningSkill value) && value is IronBonesSkill && IronBonesSkill.State.TryGetValue(__instance.playerClientId, out var value2) && value2 == 1)
			{
				IronBonesSkill.TriggerParry(__instance);
				return false;
			}
			if (SkillManager.ActivePlayerSkills.TryGetValue(__instance.playerClientId, out AwakeningSkill value3) && value3 is BloodlustSkill && BloodlustSkill.IsActive.TryGetValue(__instance.playerClientId, out var value4) && value4)
			{
				damageNumber *= 2;
			}
			if (__instance.health - damageNumber <= 0 && SkillManager.ActivePlayerSkills.TryGetValue(__instance.playerClientId, out AwakeningSkill value5) && value5 is MingDaoSkill mingDaoSkill && mingDaoSkill.HasTriggered.TryGetValue(__instance.playerClientId, out var value6) && !value6)
			{
				mingDaoSkill.HasTriggered[__instance.playerClientId] = true;
				damageNumber = __instance.health - 1;
				if (((NetworkBehaviour)__instance).IsOwner)
				{
					MingDaoSkill.TriggerEffect(__instance);
					if ((Object)(object)HUDManager.Instance != (Object)null)
					{
						HUDManager.Instance.DisplayTip("觉醒触发!", "【" + value5.Name + "】为你抵挡致命一击,移速暴增!", true, false, "LC_Tip1");
					}
				}
			}
			if (!IsSharingDamage && damageNumber > 0 && SoulSymbiosisSkill.ContractPairs.TryGetValue(__instance.playerClientId, out var value7) && ((NetworkBehaviour)__instance).IsOwner)
			{
				PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[value7];
				if (!val.isPlayerDead)
				{
					int num = damageNumber;
					int num2 = __instance.health + val.health;
					if (num2 <= num)
					{
						damageNumber = 999;
						SkillNetworkHandler.SendSoulDamageAction(value7, 999);
					}
					else
					{
						int num3 = num / 2 + num % 2;
						int num4 = num / 2;
						if (__instance.health - num3 <= 0)
						{
							int num5 = num3 - (__instance.health - 1);
							num3 = __instance.health - 1;
							num4 += num5;
						}
						else if (val.health - num4 <= 0)
						{
							int num6 = num4 - (val.health - 1);
							num4 = val.health - 1;
							num3 += num6;
						}
						damageNumber = num3;
						if (num4 > 0)
						{
							SkillNetworkHandler.SendSoulDamageAction(value7, num4);
						}
					}
				}
			}
			return true;
		}

		[HarmonyPatch(typeof(PlayerControllerB), "KillPlayer")]
		[HarmonyPrefix]
		private static bool Prefix_KillPlayer(PlayerControllerB __instance, Vector3 bodyVelocity, bool spawnBody, CauseOfDeath causeOfDeath, int deathAnimation)
		{
			if (__instance.isPlayerDead)
			{
				return true;
			}
			if (((NetworkBehaviour)__instance).IsOwner)
			{
				if (SkillManager.ActivePlayerSkills.TryGetValue(__instance.playerClientId, out AwakeningSkill value) && value is IronBonesSkill && IronBonesSkill.State.TryGetValue(__instance.playerClientId, out var value2) && value2 == 1)
				{
					IronBonesSkill.TriggerParry(__instance);
					return false;
				}
				if (SkillManager.ActivePlayerSkills.TryGetValue(__instance.playerClientId, out AwakeningSkill value3) && value3 is MingDaoSkill mingDaoSkill && mingDaoSkill.HasTriggered.TryGetValue(__instance.playerClientId, out var value4) && !value4)
				{
					mingDaoSkill.HasTriggered[__instance.playerClientId] = true;
					__instance.health = 1;
					if ((Object)(object)HUDManager.Instance != (Object)null)
					{
						HUDManager.Instance.UpdateHealthUI(1, false);
						HUDManager.Instance.DisplayTip("觉醒触发!", "【" + value3.Name + "】为你抵挡必杀一击,移速暴增!", true, false, "LC_Tip1");
					}
					MingDaoSkill.TriggerEffect(__instance);
					return false;
				}
				if (!IsSharingDamage && SoulSymbiosisSkill.ContractPairs.TryGetValue(__instance.playerClientId, out var value5))
				{
					PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[value5];
					if (!val.isPlayerDead)
					{
						SkillNetworkHandler.SendSoulDamageAction(value5, 999);
					}
				}
			}
			return true;
		}

		[HarmonyPatch(typeof(PlayerControllerB), "KillPlayer")]
		[HarmonyPostfix]
		private static void Postfix_KillPlayer(PlayerControllerB __instance)
		{
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			if (((NetworkBehaviour)__instance).IsOwner && __instance.isPlayerDead && SkillManager.ActivePlayerSkills.TryGetValue(__instance.playerClientId, out AwakeningSkill value) && value is DeadResentmentSkill deadResentmentSkill && deadResentmentSkill.HasTriggered.TryGetValue(__instance.playerClientId, out var value2) && !value2)
			{
				deadResentmentSkill.HasTriggered[__instance.playerClientId] = true;
				Vector3 position = ((Component)__instance).transform.position;
				if ((Object)(object)__instance.deadBody != (Object)null)
				{
					position = ((Component)__instance.deadBody).transform.position;
				}
				position += Vector3.up * 1f;
				SkillNetworkHandler.SendExplosionAction(position);
			}
		}

		[HarmonyPatch(typeof(GrabbableObject), "EquipItem")]
		[HarmonyPrefix]
		private static void Prefix_EquipItem(GrabbableObject __instance)
		{
			if ((Object)(object)__instance.playerHeldBy != (Object)null && ((NetworkBehaviour)__instance.playerHeldBy).IsOwner && !__instance.hasBeenHeld && (Object)(object)__instance.itemProperties != (Object)null && __instance.itemProperties.isScrap && !__instance.isInShipRoom && !__instance.isInElevator && SkillManager.ActivePlayerSkills.TryGetValue(__instance.playerHeldBy.playerClientId, out AwakeningSkill value) && value is UnluckyMidasSkill)
			{
				int scrapValue = __instance.scrapValue;
				int num = (int)((float)scrapValue * 1.5f);
				__instance.SetScrapValue(num);
				if ((Object)(object)HUDManager.Instance != (Object)null)
				{
					HUDManager.Instance.DisplayTip("厄运金手指", $"物品价值提升: {scrapValue} -> {num}", false, false, "LC_Tip1");
				}
				SkillNetworkHandler.SendMidasAction(((NetworkBehaviour)__instance).NetworkObjectId, num);
			}
		}

		[HarmonyPatch(typeof(PlayerControllerB), "DiscardHeldObject")]
		[HarmonyPrefix]
		private static bool Prefix_PreventMagicianShovelDrop(PlayerControllerB __instance)
		{
			if ((Object)(object)__instance.currentlyHeldObjectServer != (Object)null && MagicianSkill.PlayerToShovel.TryGetValue(__instance.playerClientId, out var value) && ((NetworkBehaviour)__instance.currentlyHeldObjectServer).NetworkObjectId == value)
			{
				if (__instance.isPlayerDead)
				{
					return true;
				}
				if (((NetworkBehaviour)__instance).IsOwner)
				{
					HUDManager.Instance.DisplayTip("魔术师", "专属武器无法丢弃!(按技能键收回)", true, false, "LC_Tip1");
				}
				return false;
			}
			return true;
		}

		[HarmonyPatch(typeof(PlayerControllerB), "DropAllHeldItems")]
		[HarmonyPrefix]
		private static void Prefix_DespawnShovelOnDeath(PlayerControllerB __instance)
		{
			if (!MagicianSkill.PlayerToShovel.TryGetValue(__instance.playerClientId, out var value))
			{
				return;
			}
			for (int i = 0; i < __instance.ItemSlots.Length; i++)
			{
				GrabbableObject val = __instance.ItemSlots[i];
				if ((Object)(object)val != (Object)null && ((NetworkBehaviour)val).NetworkObjectId == value)
				{
					if (((NetworkBehaviour)__instance).IsOwner)
					{
						SkillNetworkHandler.SendMagicianAction(1, __instance.playerClientId, 0uL);
					}
					__instance.ItemSlots[i] = null;
					if ((Object)(object)__instance.currentlyHeldObjectServer == (Object)(object)val)
					{
						__instance.currentlyHeldObjectServer = null;
						__instance.isHoldingObject = false;
					}
				}
			}
		}

		[HarmonyPatch(typeof(PlayerControllerB), "BeginGrabObject")]
		[HarmonyPrefix]
		private static bool Prefix_PreventGrabbingWeapons(PlayerControllerB __instance)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: 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)
			if (!((NetworkBehaviour)__instance).IsOwner)
			{
				return true;
			}
			Ray val = default(Ray);
			((Ray)(ref val))..ctor(((Component)__instance.gameplayCamera).transform.position, ((Component)__instance.gameplayCamera).transform.forward);
			int mask = LayerMask.GetMask(new string[2] { "Props", "InteractableObject" });
			RaycastHit val2 = default(RaycastHit);
			if (Physics.Raycast(val, ref val2, __instance.grabDistance, mask))
			{
				GrabbableObject componentInParent = ((Component)((RaycastHit)(ref val2)).collider).gameObject.GetComponentInParent<GrabbableObject>();
				if ((Object)(object)componentInParent != (Object)null)
				{
					if (MagicianSkill.PlayerToShovel.ContainsValue(((NetworkBehaviour)componentInParent).NetworkObjectId))
					{
						MagicianSkill.PlayerToShovel.TryGetValue(__instance.playerClientId, out var value);
						if (((NetworkBehaviour)componentInParent).NetworkObjectId != value)
						{
							HUDManager.Instance.DisplayTip("不可触碰", "这是魔术师的专属武器!", true, false, "LC_Tip1");
							return false;
						}
					}
					if (SkillManager.ActivePlayerSkills.TryGetValue(__instance.playerClientId, out AwakeningSkill value2) && value2 is MagicianSkill && componentInParent.itemProperties.isDefensiveWeapon)
					{
						MagicianSkill.PlayerToShovel.TryGetValue(__instance.playerClientId, out var value3);
						if (((NetworkBehaviour)componentInParent).NetworkObjectId != value3)
						{
							HUDManager.Instance.DisplayTip("魔术师的矜持", "你无法拾取其他武器!", true, false, "LC_Tip1");
							return false;
						}
					}
				}
			}
			return true;
		}

		[HarmonyPatch(typeof(GrabbableObject), "ItemActivate")]
		[HarmonyPrefix]
		private static bool Prefix_PreventSwingingOtherWeapons(GrabbableObject __instance)
		{
			PlayerControllerB playerHeldBy = __instance.playerHeldBy;
			if ((Object)(object)playerHeldBy != (Object)null && ((NetworkBehaviour)playerHeldBy).IsOwner && SkillManager.ActivePlayerSkills.TryGetValue(playerHeldBy.playerClientId, out AwakeningSkill value) && value is MagicianSkill && __instance.itemProperties.isDefensiveWeapon)
			{
				if (MagicianSkill.PlayerToShovel.TryGetValue(playerHeldBy.playerClientId, out var value2) && ((NetworkBehaviour)__instance).NetworkObjectId == value2)
				{
					return true;
				}
				HUDManager.Instance.DisplayTip("魔术师的矜持", "你无法挥动不属于你的武器!", true, false, "LC_Tip1");
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch]
	public class HitEnemyPatch
	{
		[HarmonyTargetMethods]
		private static IEnumerable<MethodBase> ReturnTargetMethods()
		{
			IEnumerable<Type> enemyTypes = from t in typeof(EnemyAI).Assembly.GetTypes()
				where t == typeof(EnemyAI) || t.IsSubclassOf(typeof(EnemyAI))
				select t;
			foreach (Type type in enemyTypes)
			{
				MethodInfo method = type.GetMethod("HitEnemy", BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public);
				if (method != null)
				{
					yield return method;
				}
			}
		}

		[HarmonyPrefix]
		private static void Prefix(EnemyAI __instance, ref int __0, PlayerControllerB __1, out bool __state)
		{
			__state = false;
			try
			{
				if ((Object)(object)__instance != (Object)null)
				{
					__state = __instance.isEnemyDead;
				}
				if ((Object)(object)__1 != (Object)null && ((NetworkBehaviour)__1).IsOwner && SkillManager.ActivePlayerSkills.TryGetValue(__1.playerClientId, out AwakeningSkill value) && value is BloodlustSkill && BloodlustSkill.IsActive.TryGetValue(__1.playerClientId, out var value2) && value2)
				{
					__0 *= 2;
				}
			}
			catch (Exception arg)
			{
				Plugin.Log.LogError((object)$"[浴血奋战] Prefix Error: {arg}");
			}
		}

		[HarmonyPostfix]
		private static void Postfix(EnemyAI __instance, PlayerControllerB __1, bool __state)
		{
			try
			{
				if ((Object)(object)__instance != (Object)null && (Object)(object)__1 != (Object)null && !__state && __instance.isEnemyDead && NetworkManager.Singleton.IsServer && SkillManager.ActivePlayerSkills.TryGetValue(__1.playerClientId, out AwakeningSkill value) && value is BloodlustSkill && BloodlustSkill.IsActive.TryGetValue(__1.playerClientId, out var value2) && value2)
				{
					SkillNetworkHandler.SendBloodlustAction(__1.playerClientId, 1);
				}
			}
			catch (Exception arg)
			{
				Plugin.Log.LogError((object)$"[浴血奋战] Postfix Error: {arg}");
			}
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.xibao-love.pathofawakening", "Path of Awakening", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public const string ModGUID = "com.xibao-love.pathofawakening";

		public const string ModName = "Path of Awakening";

		public const string ModVersion = "1.0.0";

		public static ManualLogSource Log;

		private readonly Harmony harmony = new Harmony("com.xibao-love.pathofawakening");

		public static AwakeningInputs Inputs { get; internal set; }

		private void Awake()
		{
			Log = ((BaseUnityPlugin)this).Logger;
			AwakeningInputs instance = AwakeningInputs.Instance;
			((Component)this).gameObject.AddComponent<SkillUI>();
			harmony.PatchAll(typeof(Plugin).Assembly);
			SkillManager.Initialize();
			Log.LogInfo((object)"[Path of Awakening] Awakened and loaded successfully!");
		}
	}
	public static class SkillManager
	{
		public static Dictionary<string, AwakeningSkill> SkillRegistry = new Dictionary<string, AwakeningSkill>();

		public static Dictionary<ulong, AwakeningSkill> ActivePlayerSkills = new Dictionary<ulong, AwakeningSkill>();

		public static void Initialize()
		{
			RegisterSkill(new MingDaoSkill());
			RegisterSkill(new SprintBurstSkill());
			RegisterSkill(new SmoothLandingSkill());
			RegisterSkill(new LifeBurnHealSkill());
			RegisterSkill(new SoulSymbiosisSkill());
			RegisterSkill(new DeadResentmentSkill());
			RegisterSkill(new BloodVitalitySkill());
			RegisterSkill(new UnluckyMidasSkill());
			RegisterSkill(new IronBonesSkill());
			RegisterSkill(new BloodlustSkill());
			RegisterSkill(new MagicianSkill());
		}

		public static void RegisterSkill(AwakeningSkill skill)
		{
			if (!SkillRegistry.ContainsKey(skill.Id))
			{
				SkillRegistry.Add(skill.Id, skill);
				Plugin.Log.LogInfo((object)("Registered skill: " + skill.Name));
			}
		}

		public static void RequestSkill(PlayerControllerB player, string skillId)
		{
			if (!((Object)(object)player == (Object)null) && SkillRegistry.ContainsKey(skillId) && !ActivePlayerSkills.ContainsKey(player.playerClientId))
			{
				SkillNetworkHandler.SendSkillSync(player.playerClientId, skillId);
			}
		}

		public static void ApplySkillLocally(PlayerControllerB player, string skillId)
		{
			if (!((Object)(object)player == (Object)null) && SkillRegistry.TryGetValue(skillId, out AwakeningSkill value))
			{
				ulong playerClientId = player.playerClientId;
				if (ActivePlayerSkills.TryGetValue(playerClientId, out AwakeningSkill value2))
				{
					value2.OnRemove(player);
					ActivePlayerSkills.Remove(playerClientId);
				}
				ActivePlayerSkills.Add(playerClientId, value);
				value.OnApply(player);
				Plugin.Log.LogInfo((object)("[Network Sync] Player " + player.playerUsername + " equipped skill: " + value.Name));
			}
		}

		public static void AutoAssignSkills()
		{
			if ((Object)(object)StartOfRound.Instance == (Object)null || !NetworkManager.Singleton.IsServer)
			{
				return;
			}
			List<AwakeningSkill> list = SkillRegistry.Values.ToList();
			if (list.Count == 0)
			{
				return;
			}
			PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
			foreach (PlayerControllerB val in allPlayerScripts)
			{
				if ((val.isPlayerControlled || val.isPlayerDead) && !ActivePlayerSkills.ContainsKey(val.playerClientId))
				{
					AwakeningSkill awakeningSkill = list[Random.Range(0, list.Count)];
					SkillNetworkHandler.SendSkillSync(val.playerClientId, awakeningSkill.Id);
				}
			}
		}

		public static void ClearSkills()
		{
			if ((Object)(object)StartOfRound.Instance == (Object)null)
			{
				return;
			}
			PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
			foreach (PlayerControllerB val in allPlayerScripts)
			{
				if (ActivePlayerSkills.TryGetValue(val.playerClientId, out AwakeningSkill value))
				{
					value.OnRemove(val);
				}
			}
			ActivePlayerSkills.Clear();
			SoulSymbiosisSkill.ResetAll();
			BloodVitalitySkill.ResetAll();
			UnluckyMidasSkill.ResetAll();
			IronBonesSkill.ResetAll();
			MingDaoSkill.ResetAll();
			BloodlustSkill.ResetAll();
			MagicianSkill.ResetAll();
			LifeBurnHealSkill.State.Clear();
			LifeBurnHealSkill.HasDebuff.Clear();
			LifeBurnHealSkill.InteractingTarget.Clear();
			Plugin.Log.LogInfo((object)"All skills and static states have been cleared.");
		}

		public static void CompletelyResetSkills()
		{
			ActivePlayerSkills.Clear();
			SkillRegistry.Clear();
			Initialize();
			LifeBurnHealSkill.State.Clear();
			LifeBurnHealSkill.HasDebuff.Clear();
			LifeBurnHealSkill.InteractingTarget.Clear();
			SoulSymbiosisSkill.ContractPairs.Clear();
			SoulSymbiosisSkill.HasContractedThisRound.Clear();
			SoulSymbiosisSkill.PendingProposal.Clear();
			BloodVitalitySkill.ResetAll();
			UnluckyMidasSkill.ResetAll();
			IronBonesSkill.ResetAll();
			MingDaoSkill.ResetAll();
			BloodlustSkill.ResetAll();
			MagicianSkill.ResetAll();
			if ((Object)(object)SkillUI.Instance != (Object)null)
			{
				SkillUI.Instance.CrosshairText = "";
				SkillUI.Instance.SetPanelState(open: false);
			}
			Plugin.Log.LogInfo((object)"退出房间:已彻底清空并重置所有跨局技能状态!");
		}
	}
	public static class SkillNetworkHandler
	{
		public const string SyncSkillChannel = "PathOfAwakening_SyncSkill";

		public const string SyncHealChannel = "PathOfAwakening_SyncHeal";

		public const string SyncSoulChannel = "PathOfAwakening_SyncSoul";

		public const string SyncSoulDamageChannel = "PathOfAwakening_SyncSoulDamage";

		public const string SyncExplosionChannel = "PathOfAwakening_SyncExplosion";

		public const string SyncMidasChannel = "PathOfAwakening_SyncMidas";

		public const string SyncBloodlustChannel = "PathOfAwakening_SyncBloodlust";

		public const string SyncMagicianChannel = "PathOfAwakening_SyncMagician";

		public static void Initialize()
		{
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Expected O, but got Unknown
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Expected O, but got Unknown
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Expected O, but got Unknown
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Expected O, but got Unknown
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Expected O, but got Unknown
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Expected O, but got Unknown
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Expected O, but got Unknown
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Expected O, but got Unknown
			if (!((Object)(object)NetworkManager.Singleton == (Object)null) && NetworkManager.Singleton.CustomMessagingManager != null)
			{
				NetworkManager.Singleton.CustomMessagingManager.UnregisterNamedMessageHandler("PathOfAwakening_SyncSkill");
				NetworkManager.Singleton.CustomMessagingManager.UnregisterNamedMessageHandler("PathOfAwakening_SyncHeal");
				NetworkManager.Singleton.CustomMessagingManager.UnregisterNamedMessageHandler("PathOfAwakening_SyncSoul");
				NetworkManager.Singleton.CustomMessagingManager.UnregisterNamedMessageHandler("PathOfAwakening_SyncSoulDamage");
				NetworkManager.Singleton.CustomMessagingManager.UnregisterNamedMessageHandler("PathOfAwakening_SyncExplosion");
				NetworkManager.Singleton.CustomMessagingManager.UnregisterNamedMessageHandler("PathOfAwakening_SyncMidas");
				NetworkManager.Singleton.CustomMessagingManager.UnregisterNamedMessageHandler("PathOfAwakening_SyncBloodlust");
				NetworkManager.Singleton.CustomMessagingManager.UnregisterNamedMessageHandler("PathOfAwakening_SyncMagician");
				NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("PathOfAwakening_SyncSkill", new HandleNamedMessageDelegate(OnReceiveSkillSync));
				NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("PathOfAwakening_SyncHeal", new HandleNamedMessageDelegate(OnReceiveHealSync));
				NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("PathOfAwakening_SyncSoul", new HandleNamedMessageDelegate(OnReceiveSoulSync));
				NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("PathOfAwakening_SyncSoulDamage", new HandleNamedMessageDelegate(OnReceiveSoulDamageSync));
				NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("PathOfAwakening_SyncExplosion", new HandleNamedMessageDelegate(OnReceiveExplosionSync));
				NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("PathOfAwakening_SyncMidas", new HandleNamedMessageDelegate(OnReceiveMidasSync));
				NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("PathOfAwakening_SyncBloodlust", new HandleNamedMessageDelegate(OnReceiveBloodlustSync));
				NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("PathOfAwakening_SyncMagician", new HandleNamedMessageDelegate(OnReceiveMagicianSync));
				Plugin.Log.LogInfo((object)"Skill Network Handlers Successfully Registered!");
			}
		}

		public static void SendSkillSync(ulong playerId, string skillId)
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)NetworkManager.Singleton == (Object)null || !NetworkManager.Singleton.IsListening)
			{
				return;
			}
			FastBufferWriter val = default(FastBufferWriter);
			((FastBufferWriter)(ref val))..ctor(256, (Allocator)2, -1);
			try
			{
				((FastBufferWriter)(ref val)).WriteValueSafe<ulong>(ref playerId, default(ForPrimitives));
				((FastBufferWriter)(ref val)).WriteValueSafe(skillId, false);
				if (NetworkManager.Singleton.IsServer)
				{
					NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("PathOfAwakening_SyncSkill", val, (NetworkDelivery)3);
					PlayerControllerB playerById = GetPlayerById(playerId);
					if ((Object)(object)playerById != (Object)null)
					{
						SkillManager.ApplySkillLocally(playerById, skillId);
					}
				}
				else
				{
					NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("PathOfAwakening_SyncSkill", 0uL, val, (NetworkDelivery)3);
				}
			}
			finally
			{
				((IDisposable)(FastBufferWriter)(ref val)).Dispose();
			}
		}

		private static void OnReceiveSkillSync(ulong senderId, FastBufferReader reader)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			ulong clientId = default(ulong);
			((FastBufferReader)(ref reader)).ReadValueSafe<ulong>(ref clientId, default(ForPrimitives));
			string text = default(string);
			((FastBufferReader)(ref reader)).ReadValueSafe(ref text, false);
			if (NetworkManager.Singleton.IsServer && senderId != 0)
			{
				FastBufferWriter val = default(FastBufferWriter);
				((FastBufferWriter)(ref val))..ctor(256, (Allocator)2, -1);
				try
				{
					((FastBufferWriter)(ref val)).WriteValueSafe<ulong>(ref clientId, default(ForPrimitives));
					((FastBufferWriter)(ref val)).WriteValueSafe(text, false);
					NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("PathOfAwakening_SyncSkill", val, (NetworkDelivery)3);
					PlayerControllerB playerById = GetPlayerById(clientId);
					if ((Object)(object)playerById != (Object)null)
					{
						SkillManager.ApplySkillLocally(playerById, text);
					}
					return;
				}
				finally
				{
					((IDisposable)(FastBufferWriter)(ref val)).Dispose();
				}
			}
			if (!NetworkManager.Singleton.IsServer)
			{
				PlayerControllerB playerById2 = GetPlayerById(clientId);
				if ((Object)(object)playerById2 != (Object)null)
				{
					SkillManager.ApplySkillLocally(playerById2, text);
				}
			}
		}

		public static void SendHealAction(byte action, ulong sender, ulong target)
		{
			//IL_0038: 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_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)NetworkManager.Singleton == (Object)null || !NetworkManager.Singleton.IsListening)
			{
				return;
			}
			FastBufferWriter val = default(FastBufferWriter);
			((FastBufferWriter)(ref val))..ctor(24, (Allocator)2, -1);
			try
			{
				((FastBufferWriter)(ref val)).WriteValueSafe<byte>(ref action, default(ForPrimitives));
				((FastBufferWriter)(ref val)).WriteValueSafe<ulong>(ref sender, default(ForPrimitives));
				((FastBufferWriter)(ref val)).WriteValueSafe<ulong>(ref target, default(ForPrimitives));
				if (NetworkManager.Singleton.IsServer)
				{
					NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("PathOfAwakening_SyncHeal", val, (NetworkDelivery)3);
					LifeBurnHealSkill.HandleNetworkMessage(action, sender, target);
				}
				else
				{
					NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("PathOfAwakening_SyncHeal", 0uL, val, (NetworkDelivery)3);
				}
			}
			finally
			{
				((IDisposable)(FastBufferWriter)(ref val)).Dispose();
			}
		}

		private static void OnReceiveHealSync(ulong senderId, FastBufferReader reader)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			byte action = default(byte);
			((FastBufferReader)(ref reader)).ReadValueSafe<byte>(ref action, default(ForPrimitives));
			ulong sender = default(ulong);
			((FastBufferReader)(ref reader)).ReadValueSafe<ulong>(ref sender, default(ForPrimitives));
			ulong target = default(ulong);
			((FastBufferReader)(ref reader)).ReadValueSafe<ulong>(ref target, default(ForPrimitives));
			if (NetworkManager.Singleton.IsServer && senderId != 0)
			{
				FastBufferWriter val = default(FastBufferWriter);
				((FastBufferWriter)(ref val))..ctor(24, (Allocator)2, -1);
				try
				{
					((FastBufferWriter)(ref val)).WriteValueSafe<byte>(ref action, default(ForPrimitives));
					((FastBufferWriter)(ref val)).WriteValueSafe<ulong>(ref sender, default(ForPrimitives));
					((FastBufferWriter)(ref val)).WriteValueSafe<ulong>(ref target, default(ForPrimitives));
					NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("PathOfAwakening_SyncHeal", val, (NetworkDelivery)3);
					LifeBurnHealSkill.HandleNetworkMessage(action, sender, target);
					return;
				}
				finally
				{
					((IDisposable)(FastBufferWriter)(ref val)).Dispose();
				}
			}
			if (!NetworkManager.Singleton.IsServer)
			{
				LifeBurnHealSkill.HandleNetworkMessage(action, sender, target);
			}
		}

		public static void SendSoulAction(byte action, ulong sender, ulong target)
		{
			//IL_0038: 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_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)NetworkManager.Singleton == (Object)null || !NetworkManager.Singleton.IsListening)
			{
				return;
			}
			FastBufferWriter val = default(FastBufferWriter);
			((FastBufferWriter)(ref val))..ctor(24, (Allocator)2, -1);
			try
			{
				((FastBufferWriter)(ref val)).WriteValueSafe<byte>(ref action, default(ForPrimitives));
				((FastBufferWriter)(ref val)).WriteValueSafe<ulong>(ref sender, default(ForPrimitives));
				((FastBufferWriter)(ref val)).WriteValueSafe<ulong>(ref target, default(ForPrimitives));
				if (NetworkManager.Singleton.IsServer)
				{
					NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("PathOfAwakening_SyncSoul", val, (NetworkDelivery)3);
					SoulSymbiosisSkill.HandleNetworkMessage(action, sender, target);
				}
				else
				{
					NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("PathOfAwakening_SyncSoul", 0uL, val, (NetworkDelivery)3);
				}
			}
			finally
			{
				((IDisposable)(FastBufferWriter)(ref val)).Dispose();
			}
		}

		private static void OnReceiveSoulSync(ulong senderId, FastBufferReader reader)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			byte action = default(byte);
			((FastBufferReader)(ref reader)).ReadValueSafe<byte>(ref action, default(ForPrimitives));
			ulong sender = default(ulong);
			((FastBufferReader)(ref reader)).ReadValueSafe<ulong>(ref sender, default(ForPrimitives));
			ulong target = default(ulong);
			((FastBufferReader)(ref reader)).ReadValueSafe<ulong>(ref target, default(ForPrimitives));
			if (NetworkManager.Singleton.IsServer && senderId != 0)
			{
				FastBufferWriter val = default(FastBufferWriter);
				((FastBufferWriter)(ref val))..ctor(24, (Allocator)2, -1);
				try
				{
					((FastBufferWriter)(ref val)).WriteValueSafe<byte>(ref action, default(ForPrimitives));
					((FastBufferWriter)(ref val)).WriteValueSafe<ulong>(ref sender, default(ForPrimitives));
					((FastBufferWriter)(ref val)).WriteValueSafe<ulong>(ref target, default(ForPrimitives));
					NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("PathOfAwakening_SyncSoul", val, (NetworkDelivery)3);
					SoulSymbiosisSkill.HandleNetworkMessage(action, sender, target);
					return;
				}
				finally
				{
					((IDisposable)(FastBufferWriter)(ref val)).Dispose();
				}
			}
			if (!NetworkManager.Singleton.IsServer)
			{
				SoulSymbiosisSkill.HandleNetworkMessage(action, sender, target);
			}
		}

		public static void SendSoulDamageAction(ulong target, int damage)
		{
			//IL_0038: 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_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)NetworkManager.Singleton == (Object)null || !NetworkManager.Singleton.IsListening)
			{
				return;
			}
			FastBufferWriter val = default(FastBufferWriter);
			((FastBufferWriter)(ref val))..ctor(12, (Allocator)2, -1);
			try
			{
				((FastBufferWriter)(ref val)).WriteValueSafe<ulong>(ref target, default(ForPrimitives));
				((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref damage, default(ForPrimitives));
				if (NetworkManager.Singleton.IsServer)
				{
					NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("PathOfAwakening_SyncSoulDamage", val, (NetworkDelivery)3);
					SoulSymbiosisSkill.HandleDamageMessage(target, damage);
				}
				else
				{
					NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("PathOfAwakening_SyncSoulDamage", 0uL, val, (NetworkDelivery)3);
				}
			}
			finally
			{
				((IDisposable)(FastBufferWriter)(ref val)).Dispose();
			}
		}

		private static void OnReceiveSoulDamageSync(ulong senderId, FastBufferReader reader)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			ulong targetId = default(ulong);
			((FastBufferReader)(ref reader)).ReadValueSafe<ulong>(ref targetId, default(ForPrimitives));
			int damage = default(int);
			((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref damage, default(ForPrimitives));
			if (NetworkManager.Singleton.IsServer && senderId != 0)
			{
				FastBufferWriter val = default(FastBufferWriter);
				((FastBufferWriter)(ref val))..ctor(12, (Allocator)2, -1);
				try
				{
					((FastBufferWriter)(ref val)).WriteValueSafe<ulong>(ref targetId, default(ForPrimitives));
					((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref damage, default(ForPrimitives));
					NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("PathOfAwakening_SyncSoulDamage", val, (NetworkDelivery)3);
					SoulSymbiosisSkill.HandleDamageMessage(targetId, damage);
					return;
				}
				finally
				{
					((IDisposable)(FastBufferWriter)(ref val)).Dispose();
				}
			}
			if (!NetworkManager.Singleton.IsServer)
			{
				SoulSymbiosisSkill.HandleDamageMessage(targetId, damage);
			}
		}

		public static void SendExplosionAction(Vector3 pos)
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: 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_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)NetworkManager.Singleton == (Object)null || !NetworkManager.Singleton.IsListening)
			{
				return;
			}
			FastBufferWriter val = default(FastBufferWriter);
			((FastBufferWriter)(ref val))..ctor(12, (Allocator)2, -1);
			try
			{
				((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref pos.x, default(ForPrimitives));
				((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref pos.y, default(ForPrimitives));
				((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref pos.z, default(ForPrimitives));
				if (NetworkManager.Singleton.IsServer)
				{
					NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("PathOfAwakening_SyncExplosion", val, (NetworkDelivery)3);
					DeadResentmentSkill.HandleExplosion(pos);
				}
				else
				{
					NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("PathOfAwakening_SyncExplosion", 0uL, val, (NetworkDelivery)3);
				}
			}
			finally
			{
				((IDisposable)(FastBufferWriter)(ref val)).Dispose();
			}
		}

		private static void OnReceiveExplosionSync(ulong senderId, FastBufferReader reader)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: 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_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: 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_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			float num = default(float);
			((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref num, default(ForPrimitives));
			float num2 = default(float);
			((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref num2, default(ForPrimitives));
			float num3 = default(float);
			((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref num3, default(ForPrimitives));
			Vector3 pos = default(Vector3);
			((Vector3)(ref pos))..ctor(num, num2, num3);
			if (NetworkManager.Singleton.IsServer && senderId != 0)
			{
				FastBufferWriter val = default(FastBufferWriter);
				((FastBufferWriter)(ref val))..ctor(12, (Allocator)2, -1);
				try
				{
					((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref num, default(ForPrimitives));
					((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref num2, default(ForPrimitives));
					((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref num3, default(ForPrimitives));
					NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("PathOfAwakening_SyncExplosion", val, (NetworkDelivery)3);
					DeadResentmentSkill.HandleExplosion(pos);
					return;
				}
				finally
				{
					((IDisposable)(FastBufferWriter)(ref val)).Dispose();
				}
			}
			if (!NetworkManager.Singleton.IsServer)
			{
				DeadResentmentSkill.HandleExplosion(pos);
			}
		}

		public static void SendMidasAction(ulong networkObjectId, int newVal)
		{
			//IL_0038: 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_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: 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_0076: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)NetworkManager.Singleton == (Object)null || !NetworkManager.Singleton.IsListening)
			{
				return;
			}
			FastBufferWriter val = default(FastBufferWriter);
			((FastBufferWriter)(ref val))..ctor(12, (Allocator)2, -1);
			try
			{
				((FastBufferWriter)(ref val)).WriteValueSafe<ulong>(ref networkObjectId, default(ForPrimitives));
				((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref newVal, default(ForPrimitives));
				if (NetworkManager.Singleton.IsServer)
				{
					NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("PathOfAwakening_SyncMidas", val, (NetworkDelivery)3);
					UnluckyMidasSkill.HandleMidasSync(networkObjectId, newVal);
				}
				else
				{
					NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("PathOfAwakening_SyncMidas", 0uL, val, (NetworkDelivery)3);
				}
			}
			finally
			{
				((IDisposable)(FastBufferWriter)(ref val)).Dispose();
			}
		}

		private static void OnReceiveMidasSync(ulong senderId, FastBufferReader reader)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			ulong networkObjectId = default(ulong);
			((FastBufferReader)(ref reader)).ReadValueSafe<ulong>(ref networkObjectId, default(ForPrimitives));
			int newVal = default(int);
			((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref newVal, default(ForPrimitives));
			if (NetworkManager.Singleton.IsServer && senderId != 0)
			{
				FastBufferWriter val = default(FastBufferWriter);
				((FastBufferWriter)(ref val))..ctor(12, (Allocator)2, -1);
				try
				{
					((FastBufferWriter)(ref val)).WriteValueSafe<ulong>(ref networkObjectId, default(ForPrimitives));
					((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref newVal, default(ForPrimitives));
					NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("PathOfAwakening_SyncMidas", val, (NetworkDelivery)3);
					UnluckyMidasSkill.HandleMidasSync(networkObjectId, newVal);
					return;
				}
				finally
				{
					((IDisposable)(FastBufferWriter)(ref val)).Dispose();
				}
			}
			if (!NetworkManager.Singleton.IsServer)
			{
				UnluckyMidasSkill.HandleMidasSync(networkObjectId, newVal);
			}
		}

		private static PlayerControllerB GetPlayerById(ulong clientId)
		{
			if ((Object)(object)StartOfRound.Instance == (Object)null)
			{
				return null;
			}
			PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
			foreach (PlayerControllerB val in allPlayerScripts)
			{
				if (val.playerClientId == clientId)
				{
					return val;
				}
			}
			return null;
		}

		public static void SendBloodlustAction(ulong targetClient, byte action)
		{
			//IL_0038: 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_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: 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_0076: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)NetworkManager.Singleton == (Object)null || !NetworkManager.Singleton.IsListening)
			{
				return;
			}
			FastBufferWriter val = default(FastBufferWriter);
			((FastBufferWriter)(ref val))..ctor(9, (Allocator)2, -1);
			try
			{
				((FastBufferWriter)(ref val)).WriteValueSafe<ulong>(ref targetClient, default(ForPrimitives));
				((FastBufferWriter)(ref val)).WriteValueSafe<byte>(ref action, default(ForPrimitives));
				if (NetworkManager.Singleton.IsServer)
				{
					NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("PathOfAwakening_SyncBloodlust", val, (NetworkDelivery)3);
					BloodlustSkill.HandleNetworkSync(targetClient, action);
				}
				else
				{
					NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("PathOfAwakening_SyncBloodlust", 0uL, val, (NetworkDelivery)3);
				}
			}
			finally
			{
				((IDisposable)(FastBufferWriter)(ref val)).Dispose();
			}
		}

		private static void OnReceiveBloodlustSync(ulong senderId, FastBufferReader reader)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			ulong clientId = default(ulong);
			((FastBufferReader)(ref reader)).ReadValueSafe<ulong>(ref clientId, default(ForPrimitives));
			byte action = default(byte);
			((FastBufferReader)(ref reader)).ReadValueSafe<byte>(ref action, default(ForPrimitives));
			if (NetworkManager.Singleton.IsServer && senderId != 0)
			{
				FastBufferWriter val = default(FastBufferWriter);
				((FastBufferWriter)(ref val))..ctor(9, (Allocator)2, -1);
				try
				{
					((FastBufferWriter)(ref val)).WriteValueSafe<ulong>(ref clientId, default(ForPrimitives));
					((FastBufferWriter)(ref val)).WriteValueSafe<byte>(ref action, default(ForPrimitives));
					NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("PathOfAwakening_SyncBloodlust", val, (NetworkDelivery)3);
					BloodlustSkill.HandleNetworkSync(clientId, action);
					return;
				}
				finally
				{
					((IDisposable)(FastBufferWriter)(ref val)).Dispose();
				}
			}
			if (!NetworkManager.Singleton.IsServer)
			{
				BloodlustSkill.HandleNetworkSync(clientId, action);
			}
		}

		public static void SendMagicianAction(byte action, ulong playerId, ulong objectId = 0uL)
		{
			//IL_0038: 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_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)NetworkManager.Singleton == (Object)null || !NetworkManager.Singleton.IsListening)
			{
				return;
			}
			FastBufferWriter val = default(FastBufferWriter);
			((FastBufferWriter)(ref val))..ctor(17, (Allocator)2, -1);
			try
			{
				((FastBufferWriter)(ref val)).WriteValueSafe<byte>(ref action, default(ForPrimitives));
				((FastBufferWriter)(ref val)).WriteValueSafe<ulong>(ref playerId, default(ForPrimitives));
				((FastBufferWriter)(ref val)).WriteValueSafe<ulong>(ref objectId, default(ForPrimitives));
				if (NetworkManager.Singleton.IsServer)
				{
					NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("PathOfAwakening_SyncMagician", val, (NetworkDelivery)3);
					if (action == 0 || action == 1)
					{
						MagicianSkill.HandleServerRequest(action, playerId, objectId);
					}
					else
					{
						MagicianSkill.HandleNetworkSync(action, playerId, objectId);
					}
				}
				else
				{
					NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("PathOfAwakening_SyncMagician", 0uL, val, (NetworkDelivery)3);
				}
			}
			finally
			{
				((IDisposable)(FastBufferWriter)(ref val)).Dispose();
			}
		}

		private static void OnReceiveMagicianSync(ulong senderId, FastBufferReader reader)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			byte b = default(byte);
			((FastBufferReader)(ref reader)).ReadValueSafe<byte>(ref b, default(ForPrimitives));
			ulong playerId = default(ulong);
			((FastBufferReader)(ref reader)).ReadValueSafe<ulong>(ref playerId, default(ForPrimitives));
			ulong objectId = default(ulong);
			((FastBufferReader)(ref reader)).ReadValueSafe<ulong>(ref objectId, default(ForPrimitives));
			if (NetworkManager.Singleton.IsServer && senderId != 0)
			{
				if (b == 0 || b == 1)
				{
					MagicianSkill.HandleServerRequest(b, playerId, objectId);
				}
			}
			else if (!NetworkManager.Singleton.IsServer)
			{
				MagicianSkill.HandleNetworkSync(b, playerId, objectId);
			}
		}
	}
	public class SkillUI : MonoBehaviour
	{
		private bool isPanelOpen = false;

		public string CrosshairText = "";

		private Rect windowRect = new Rect(0f, 0f, 560f, 680f);

		private Vector2 scrollPosition;

		private float mainUiScale = 1f;

		private bool showHud = false;

		private Rect hudRect = new Rect(20f, 20f, 250f, 100f);

		private float hudScale = 1f;

		private float nextMainUiScale = 1f;

		private bool nextShowHud = false;

		private float nextHudScale = 1f;

		private Texture2D bgTexture;

		private int currentTab = 0;

		private readonly string[] tabs = new string[3] { "状态与队伍", "觉醒图鉴", "面板设置" };

		public static SkillUI Instance { get; private set; }

		private void Awake()
		{
			Instance = this;
			LoadBackgroundTexture();
		}

		private void LoadBackgroundTexture()
		{
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Expected O, but got Unknown
			string path = Path.Combine(Paths.PluginPath, "PathOfAwakening");
			string text = Path.Combine(path, "background.png");
			if (!File.Exists(text))
			{
				text = Path.Combine(Paths.PluginPath, "background.png");
			}
			if (File.Exists(text))
			{
				byte[] array = File.ReadAllBytes(text);
				bgTexture = new Texture2D(2, 2);
				ImageConversion.LoadImage(bgTexture, array);
				Plugin.Log.LogInfo((object)"成功加载 UI 背景图!");
			}
			else
			{
				Plugin.Log.LogWarning((object)("未找到 UI 背景图: " + text + ",将使用默认纯色背景。"));
			}
		}

		private void Start()
		{
			((Rect)(ref windowRect)).x = ((float)Screen.width - ((Rect)(ref windowRect)).width) / 2f;
			((Rect)(ref windowRect)).y = ((float)Screen.height - ((Rect)(ref windowRect)).height) / 2f;
		}

		private void Update()
		{
			if (AwakeningInputs.Instance.ToggleUIPanelKey.triggered)
			{
				SetPanelState(!isPanelOpen);
			}
			mainUiScale = nextMainUiScale;
			hudScale = nextHudScale;
			showHud = nextShowHud;
		}

		public void SetPanelState(bool open)
		{
			isPanelOpen = open;
			PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController;
			if (isPanelOpen)
			{
				Cursor.visible = true;
				Cursor.lockState = (CursorLockMode)0;
				if ((Object)(object)val != (Object)null)
				{
					val.disableLookInput = true;
				}
			}
			else
			{
				Cursor.visible = false;
				Cursor.lockState = (CursorLockMode)1;
				if ((Object)(object)val != (Object)null)
				{
					val.disableLookInput = false;
				}
			}
		}

		private void OnGUI()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Expected O, but got Unknown
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Expected O, but got Unknown
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Expected O, but got Unknown
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			GUI.backgroundColor = new Color(0.1f, 0.1f, 0.1f, 0.95f);
			if (showHud)
			{
				DrawHUD();
			}
			if (isPanelOpen)
			{
				Rect val = default(Rect);
				((Rect)(ref val))..ctor(((Rect)(ref windowRect)).x, ((Rect)(ref windowRect)).y, 560f * mainUiScale, 680f * mainUiScale);
				string bindingDisplayString = InputActionRebindingExtensions.GetBindingDisplayString(AwakeningInputs.Instance.ToggleUIPanelKey, (DisplayStringOptions)0, (string)null);
				GUIStyle val2 = new GUIStyle(GUI.skin.window);
				val2.padding.top = (int)(25f * mainUiScale);
				windowRect = GUI.Window(0, val, new WindowFunction(DrawSkillWindow), "Path of Awakening - 觉醒面板 (" + bindingDisplayString + " 键关闭)", val2);
			}
			if (!string.IsNullOrEmpty(CrosshairText))
			{
				GUIStyle val3 = new GUIStyle(GUI.skin.label)
				{
					fontSize = 20,
					fontStyle = (FontStyle)1,
					alignment = (TextAnchor)4,
					richText = true
				};
				Rect val4 = default(Rect);
				((Rect)(ref val4))..ctor((float)(Screen.width / 2 - 200), (float)(Screen.height / 2 + 50), 400f, 100f);
				GUI.color = Color.black;
				GUI.Label(new Rect(((Rect)(ref val4)).x + 2f, ((Rect)(ref val4)).y + 2f, ((Rect)(ref val4)).width, ((Rect)(ref val4)).height), CrosshairText, val3);
				GUI.color = Color.white;
				GUI.Label(val4, CrosshairText, val3);
			}
		}

		private void DrawHUD()
		{
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			Rect val = default(Rect);
			((Rect)(ref val))..ctor(((Rect)(ref hudRect)).x, ((Rect)(ref hudRect)).y, 250f * hudScale, 100f * hudScale);
			if (isPanelOpen)
			{
				hudRect = GUI.Window(1, val, new WindowFunction(DrawHUDWindow), "状态 HUD (按住此处拖动)");
				return;
			}
			GUI.Box(val, "");
			GUILayout.BeginArea(val);
			GUILayout.Space(10f * hudScale);
			RenderHudContent();
			GUILayout.EndArea();
		}

		private void DrawHUDWindow(int windowID)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			RenderHudContent();
			GUI.DragWindow(new Rect(0f, 0f, 10000f, 25f * hudScale));
		}

		private void RenderHudContent()
		{
			//IL_000b: 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_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Expected O, but got Unknown
			//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_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Expected O, but got Unknown
			GUIStyle val = new GUIStyle(GUI.skin.label)
			{
				fontSize = (int)(16f * hudScale),
				fontStyle = (FontStyle)1,
				richText = true
			};
			GUIStyle val2 = new GUIStyle(GUI.skin.label)
			{
				fontSize = (int)(14f * hudScale),
				richText = true
			};
			PlayerControllerB val3 = GameNetworkManager.Instance?.localPlayerController;
			if (!((Object)(object)val3 == (Object)null))
			{
				ulong playerClientId = val3.playerClientId;
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				GUILayout.Space(10f * hudScale);
				GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
				GUILayout.Label("当前觉醒状态", val, Array.Empty<GUILayoutOption>());
				if (SkillManager.ActivePlayerSkills.TryGetValue(playerClientId, out AwakeningSkill value))
				{
					GUILayout.Label("技能: <color=#00FFFF>" + value.Name + "</color>", val2, Array.Empty<GUILayoutOption>());
					GUILayout.Label("状态: " + value.GetStatus(playerClientId), val2, Array.Empty<GUILayoutOption>());
				}
				else
				{
					GUILayout.Label("技能: 无", val2, Array.Empty<GUILayoutOption>());
					GUILayout.Label("状态: <color=#888888>尚未觉醒</color>", val2, Array.Empty<GUILayoutOption>());
				}
				GUILayout.EndVertical();
				GUILayout.EndHorizontal();
			}
		}

		private void DrawSkillWindow(int windowID)
		{
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Expected O, but got Unknown
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Expected O, but got Unknown
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Expected O, but got Unknown
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: 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_013f: Expected O, but got Unknown
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Expected O, but got Unknown
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Expected O, but got Unknown
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Expected O, but got Unknown
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: 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_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_026a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0249: Unknown result type (might be due to invalid IL or missing references)
			//IL_0595: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_05bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_05cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_05eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0604: Unknown result type (might be due to invalid IL or missing references)
			//IL_060e: Expected O, but got Unknown
			//IL_0611: Expected O, but got Unknown
			//IL_0360: Unknown result type (might be due to invalid IL or missing references)
			//IL_0365: Unknown result type (might be due to invalid IL or missing references)
			//IL_0379: Unknown result type (might be due to invalid IL or missing references)
			//IL_038b: Expected O, but got Unknown
			//IL_0b5a: Unknown result type (might be due to invalid IL or missing references)
			//IL_069a: Unknown result type (might be due to invalid IL or missing references)
			//IL_069f: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b1: Expected O, but got Unknown
			//IL_0790: Unknown result type (might be due to invalid IL or missing references)
			//IL_0af8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0afd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b11: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b1b: Expected O, but got Unknown
			//IL_07eb: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)bgTexture != (Object)null)
			{
				Color color = GUI.color;
				GUI.color = new Color(0.4f, 0.4f, 0.4f, 0.95f);
				GUI.DrawTexture(new Rect(0f, 0f, 560f * mainUiScale, 680f * mainUiScale), (Texture)(object)bgTexture, (ScaleMode)0);
				GUI.color = color;
			}
			GUIStyle val = new GUIStyle(GUI.skin.label)
			{
				fontSize = (int)(18f * mainUiScale),
				fontStyle = (FontStyle)1,
				richText = true
			};
			GUIStyle val2 = new GUIStyle(GUI.skin.label)
			{
				fontSize = (int)(14f * mainUiScale),
				richText = true,
				wordWrap = true
			};
			GUIStyle val3 = new GUIStyle(GUI.skin.label)
			{
				fontSize = (int)(13f * mainUiScale),
				richText = true,
				wordWrap = true
			};
			GUIStyle val4 = new GUIStyle(GUI.skin.button)
			{
				fontSize = (int)(14f * mainUiScale),
				richText = true
			};
			GUIStyle val5 = new GUIStyle(GUI.skin.button)
			{
				fontSize = (int)(15f * mainUiScale),
				fontStyle = (FontStyle)1
			};
			GUIStyle val6 = new GUIStyle(GUI.skin.box);
			val6.padding = new RectOffset((int)(10f * mainUiScale), (int)(10f * mainUiScale), (int)(10f * mainUiScale), (int)(10f * mainUiScale));
			PlayerControllerB val7 = GameNetworkManager.Instance?.localPlayerController;
			if ((Object)(object)val7 == (Object)null)
			{
				GUILayout.Label("<color=#FF5555>尚未连接至服务器,请在进入游戏房间后使用此面板...</color>", val2, Array.Empty<GUILayoutOption>());
				return;
			}
			ulong playerClientId = val7.playerClientId;
			GUILayout.Space(5f * mainUiScale);
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			for (int i = 0; i < tabs.Length; i++)
			{
				if (currentTab == i)
				{
					GUI.backgroundColor = new Color(0.2f, 0.7f, 0.9f, 1f);
				}
				else
				{
					GUI.backgroundColor = new Color(0.8f, 0.8f, 0.8f, 1f);
				}
				if (GUILayout.Button(tabs[i], val5, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(35f * mainUiScale) }))
				{
					currentTab = i;
				}
			}
			GUI.backgroundColor = Color.white;
			GUILayout.EndHorizontal();
			GUILayout.Space(15f * mainUiScale);
			if (currentTab == 0)
			{
				GUILayout.BeginVertical(val6, Array.Empty<GUILayoutOption>());
				GUILayout.Label("◆ 个人觉醒", val, Array.Empty<GUILayoutOption>());
				GUILayout.Space(8f * mainUiScale);
				if (SkillManager.ActivePlayerSkills.TryGetValue(playerClientId, out AwakeningSkill value))
				{
					GUILayout.Label("<color=#00FFFF>【" + value.Name + "】</color>", new GUIStyle(val2)
					{
						fontSize = (int)(16f * mainUiScale),
						fontStyle = (FontStyle)1
					}, Array.Empty<GUILayoutOption>());
					GUILayout.Label("<color=#DDDDDD>" + value.Description + "</color>", val2, Array.Empty<GUILayoutOption>());
					GUILayout.Space(5f * mainUiScale);
					GUILayout.Label("当前触发状态: " + value.GetStatus(playerClientId), val2, Array.Empty<GUILayoutOption>());
				}
				else
				{
					GUILayout.Label("<color=#FF5555>当前尚未选择觉醒技能 (请前往顶部【觉醒图鉴】页进行绑定)</color>", val2, Array.Empty<GUILayoutOption>());
				}
				GUILayout.EndVertical();
				GUILayout.Space(20f * mainUiScale);
				GUILayout.BeginVertical(val6, Array.Empty<GUILayoutOption>());
				GUILayout.Label("◆ 小队状态监控", val, Array.Empty<GUILayoutOption>());
				GUILayout.Space(8f * mainUiScale);
				if ((Object)(object)StartOfRound.Instance != (Object)null)
				{
					bool flag = false;
					PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
					foreach (PlayerControllerB val8 in allPlayerScripts)
					{
						if (val8.isPlayerControlled && val8.playerClientId != playerClientId)
						{
							flag = true;
							AwakeningSkill value2;
							string text = (SkillManager.ActivePlayerSkills.TryGetValue(val8.playerClientId, out value2) ? ("<color=#00FFFF>" + value2.Name + "</color>") : "<color=#888888>未觉醒</color>");
							string text2 = (val8.isPlayerDead ? " <color=#FF0000>[已阵亡]</color>" : "");
							GUILayout.Label("• " + val8.playerUsername + text2 + " : " + text, val2, Array.Empty<GUILayoutOption>());
						}
					}
					if (!flag)
					{
						GUILayout.Label("<color=#888888>未检测到其他活跃的队友...</color>", val2, Array.Empty<GUILayoutOption>());
					}
				}
				GUILayout.EndVertical();
			}
			else if (currentTab == 1)
			{
				GUILayout.Label("◆ 觉醒图鉴 <size=12><color=#AAAAAA>(点击右侧按钮进行选择)</color></size>", val, Array.Empty<GUILayoutOption>());
				GUILayout.Space(5f * mainUiScale);
				scrollPosition = GUILayout.BeginScrollView(scrollPosition, val6, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(500f * mainUiScale) });
				GUIStyle val9 = new GUIStyle(GUI.skin.label)
				{
					fontSize = (int)(15f * mainUiScale),
					richText = true,
					wordWrap = true,
					padding = new RectOffset((int)(8f * mainUiScale), 0, 0, 0)
				};
				foreach (KeyValuePair<string, AwakeningSkill> item in SkillManager.SkillRegistry)
				{
					AwakeningSkill value3 = item.Value;
					GUILayout.BeginVertical(GUI.skin.box, Array.Empty<GUILayoutOption>());
					GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
					GUILayout.BeginVertical((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(380f * mainUiScale) });
					GUILayout.Label($"<size={(int)(17f * mainUiScale)}><b><color=#00FFFF>{value3.Name}</color></b></size>", new GUIStyle(val2)
					{
						richText = true
					}, Array.Empty<GUILayoutOption>());
					GUILayout.Space(6f * mainUiScale);
					GUILayout.Label("<color=#FFFFFF>" + value3.Description + "</color>", val9, Array.Empty<GUILayoutOption>());
					GUILayout.Space(4f * mainUiScale);
					GUILayout.EndVertical();
					GUILayout.FlexibleSpace();
					GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
					GUILayout.Space(12f * mainUiScale);
					if (SkillManager.ActivePlayerSkills.ContainsKey(playerClientId))
					{
						GUI.enabled = false;
						GUILayout.Button("<color=#888888>已锁定</color>", val4, (GUILayoutOption[])(object)new GUILayoutOption[2]
						{
							GUILayout.Width(90f * mainUiScale),
							GUILayout.Height(35f * mainUiScale)
						});
						GUI.enabled = true;
					}
					else
					{
						GUI.backgroundColor = new Color(0.2f, 0.8f, 0.3f);
						if (GUILayout.Button("选择赋予", val4, (GUILayoutOption[])(object)new GUILayoutOption[2]
						{
							GUILayout.Width(90f * mainUiScale),
							GUILayout.Height(35f * mainUiScale)
						}))
						{
							SkillManager.RequestSkill(val7, value3.Id);
						}
						GUI.backgroundColor = Color.white;
					}
					GUILayout.EndVertical();
					GUILayout.EndHorizontal();
					GUILayout.EndVertical();
					GUILayout.Space(10f * mainUiScale);
				}
				GUILayout.EndScrollView();
			}
			else if (currentTab == 2)
			{
				GUILayout.BeginVertical(val6, Array.Empty<GUILayoutOption>());
				GUILayout.Label("◆ 界面外观缩放", val, Array.Empty<GUILayoutOption>());
				GUILayout.Space(15f * mainUiScale);
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				GUILayout.Label("主面板比例:", val2, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(110f * mainUiScale) });
				if (GUILayout.Button("缩小 (-)", val4, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f * mainUiScale) }))
				{
					nextMainUiScale = Mathf.Max(0.5f, mainUiScale - 0.1f);
				}
				GUILayout.Label($"<color=#00FFFF>{Mathf.RoundToInt(mainUiScale * 100f)}%</color>", val2, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(60f * mainUiScale) });
				if (GUILayout.Button("放大 (+)", val4, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f * mainUiScale) }))
				{
					nextMainUiScale = Mathf.Min(2f, mainUiScale + 0.1f);
				}
				GUILayout.EndHorizontal();
				GUILayout.Space(15f * mainUiScale);
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				GUILayout.Label("HUD小窗比例:", val2, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(110f * mainUiScale) });
				if (GUILayout.Button("缩小 (-)", val4, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f * mainUiScale) }))
				{
					nextHudScale = Mathf.Max(0.5f, hudScale - 0.1f);
				}
				GUILayout.Label($"<color=#00FFFF>{Mathf.RoundToInt(hudScale * 100f)}%</color>", val2, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(60f * mainUiScale) });
				if (GUILayout.Button("放大 (+)", val4, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f * mainUiScale) }))
				{
					nextHudScale = Mathf.Min(2f, hudScale + 0.1f);
				}
				GUILayout.EndHorizontal();
				GUILayout.EndVertical();
				GUILayout.Space(20f * mainUiScale);
				GUILayout.BeginVertical(val6, Array.Empty<GUILayoutOption>());
				GUILayout.Label("◆ 偏好开关", val, Array.Empty<GUILayoutOption>());
				GUILayout.Space(10f * mainUiScale);
				GUIStyle val10 = new GUIStyle(GUI.skin.toggle)
				{
					fontSize = (int)(15f * mainUiScale),
					richText = true
				};
				nextShowHud = GUILayout.Toggle(showHud, " <color=#FFFFFF>开启屏幕常驻状态 HUD (可在屏幕任意拖动)</color>", val10, Array.Empty<GUILayoutOption>());
				GUILayout.EndVertical();
			}
			GUI.DragWindow(new Rect(0f, 0f, 10000f, 30f * mainUiScale));
		}
	}
}
namespace Path_of_Awakening.Skills
{
	public abstract class AwakeningSkill
	{
		public abstract string Id { get; }

		public abstract string Name { get; }

		public abstract string Description { get; }

		public virtual void OnApply(PlayerControllerB player)
		{
		}

		public virtual void OnRemove(PlayerControllerB player)
		{
		}

		public virtual void OnUpdate(PlayerControllerB player)
		{
		}

		public virtual string GetStatus(ulong clientId)
		{
			return "觉醒生效中";
		}

		public virtual void OnActivate(PlayerControllerB player)
		{
		}
	}
	public class BloodlustSkill : AwakeningSkill
	{
		public static Dictionary<ulong, bool> IsActive = new Dictionary<ulong, bool>();

		public static Dictionary<ulong, float> RemainingTime = new Dictionary<ulong, float>();

		public override string Id => "skill_bloodlust";

		public override string Name => "【主动】浴血奋战";

		public override string Description => "按下 [" + InputActionRebindingExtensions.GetBindingDisplayString(AwakeningInputs.Instance.UseSkillKey, (DisplayStringOptions)0, (string)null) + "]开启/暂停。开启时造伤与承伤均翻倍。初始40秒,开启期间每击杀一怪延长5秒(上限80秒)。";

		public override void OnApply(PlayerControllerB player)
		{
			ulong playerClientId = player.playerClientId;
			IsActive[playerClientId] = false;
			RemainingTime[playerClientId] = 40f;
		}

		public override void OnRemove(PlayerControllerB player)
		{
			ulong playerClientId = player.playerClientId;
			IsActive.Remove(playerClientId);
			RemainingTime.Remove(playerClientId);
		}

		public override void OnActivate(PlayerControllerB player)
		{
			ulong playerClientId = player.playerClientId;
			if (IsActive.ContainsKey(playerClientId))
			{
				if (RemainingTime[playerClientId] > 0f)
				{
					SkillNetworkHandler.SendBloodlustAction(playerClientId, 0);
				}
				else if (((NetworkBehaviour)player).IsOwner)
				{
					HUDManager.Instance.DisplayTip("浴血奋战", "时间已耗尽,无法开启!", true, false, "LC_Tip1");
				}
			}
		}

		public static void HandleNetworkSync(ulong clientId, byte action)
		{
			switch (action)
			{
			case 0:
			{
				if (!IsActive.ContainsKey(clientId))
				{
					break;
				}
				IsActive[clientId] = !IsActive[clientId];
				PlayerControllerB val2 = StartOfRound.Instance.allPlayerScripts[(uint)clientId];
				if ((Object)(object)val2 != (Object)null && ((NetworkBehaviour)val2).IsOwner)
				{
					if (IsActive[clientId])
					{
						HUDManager.Instance.DisplayTip("浴血奋战", "已开启!造成伤害与承受伤害翻倍!", true, false, "LC_Tip1");
					}
					else
					{
						HUDManager.Instance.DisplayTip("浴血奋战", "已暂停。", false, false, "LC_Tip1");
					}
				}
				break;
			}
			case 1:
			{
				if (RemainingTime.TryGetValue(clientId, out var value))
				{
					RemainingTime[clientId] = Mathf.Clamp(value + 5f, 0f, 80f);
					PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[(uint)clientId];
					if ((Object)(object)val != (Object)null && ((NetworkBehaviour)val).IsOwner)
					{
						HUDManager.Instance.DisplayTip("浴血奋战", "击杀怪物,持续时间 +5 秒!", false, false, "LC_Tip1");
					}
				}
				break;
			}
			}
		}

		public override void OnUpdate(PlayerControllerB player)
		{
			if (!((NetworkBehaviour)player).IsOwner)
			{
				return;
			}
			ulong playerClientId = player.playerClientId;
			if (IsActive.ContainsKey(playerClientId) && IsActive[playerClientId])
			{
				RemainingTime[playerClientId] -= Time.deltaTime;
				if (RemainingTime[playerClientId] <= 0f)
				{
					RemainingTime[playerClientId] = 0f;
					IsActive[playerClientId] = false;
					HUDManager.Instance.DisplayTip("浴血奋战", "时间耗尽,状态已解除!", true, false, "LC_Tip1");
				}
			}
		}

		public override string GetStatus(ulong clientId)
		{
			if (!IsActive.TryGetValue(clientId, out var value) || !RemainingTime.TryGetValue(clientId, out var value2))
			{
				return "";
			}
			if (value2 <= 0f)
			{
				return "<color=#444444>已耗尽 (本局失效)</color>";
			}
			if (value)
			{
				return $"<color=#FF0000>浴血爆发中 ({value2:F1}s)</color>";
			}
			return $"<color=#00FF00>就绪/已暂停 (剩余 {value2:F1}s)</color>";
		}

		public static void ResetAll()
		{
			IsActive.Clear();
			RemainingTime.Clear();
		}
	}
	public class BloodVitalitySkill : AwakeningSkill
	{
		public static Dictionary<ulong, bool> HasWarned = new Dictionary<ulong, bool>();

		public static Dictionary<ulong, int> LastHealth = new Dictionary<ulong, int>();

		public static Dictionary<ulong, float> SprintTimer = new Dictionary<ulong, float>();

		public static Dictionary<ulong, int> ConsumedHealth = new Dictionary<ulong, int>();

		public static Dictionary<ulong, int> NourishmentLevel = new Dictionary<ulong, int>();

		public override string Id => "skill_bloodvitality";

		public override string Name => "【被动可进阶】血之活力";

		public override string Description => "体力濒竭时继续奔跑抽取生命。累计耗血30/60/90点将获得【滋养Ⅰ/Ⅱ/Ⅲ】,永久提升移速与体力恢复。重伤自愈上限降为10%。";

		public override void OnApply(PlayerControllerB player)
		{
			ulong playerClientId = player.playerClientId;
			HasWarned[playerClientId] = false;
			LastHealth[playerClientId] = player.health;
			SprintTimer[playerClientId] = 0f;
			ConsumedHealth[playerClientId] = 0;
			NourishmentLevel[playerClientId] = 0;
		}

		public override void OnRemove(PlayerControllerB player)
		{
			ulong playerClientId = player.playerClientId;
			if (NourishmentLevel.TryGetValue(playerClientId, out var value) && ((NetworkBehaviour)player).IsOwner)
			{
				switch (value)
				{
				case 1:
					player.movementSpeed /= 1.1f;
					break;
				case 2:
					player.movementSpeed /= 1.2f;
					break;
				case 3:
					player.movementSpeed /= 1.3f;
					break;
				}
			}
			HasWarned.Remove(playerClientId);
			LastHealth.Remove(playerClientId);
			SprintTimer.Remove(playerClientId);
			ConsumedHealth.Remove(playerClientId);
			NourishmentLevel.Remove(playerClientId);
		}

		public override void OnUpdate(PlayerControllerB player)
		{
			//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
			if (!((NetworkBehaviour)player).IsOwner)
			{
				return;
			}
			ulong playerClientId = player.playerClientId;
			if (!HasWarned.ContainsKey(playerClientId))
			{
				HasWarned[playerClientId] = false;
			}
			if (!LastHealth.ContainsKey(playerClientId))
			{
				LastHealth[playerClientId] = player.health;
			}
			if (!SprintTimer.ContainsKey(playerClientId))
			{
				SprintTimer[playerClientId] = 0f;
			}
			if (!ConsumedHealth.ContainsKey(playerClientId))
			{
				ConsumedHealth[playerClientId] = 0;
			}
			if (!NourishmentLevel.ContainsKey(playerClientId))
			{
				NourishmentLevel[playerClientId] = 0;
			}
			int num = player.health;
			if (num > LastHealth[playerClientId])
			{
				int num2 = num - LastHealth[playerClientId];
				if (num2 == 1 && num > 10 && num <= 20)
				{
					player.health = LastHealth[playerClientId];
					num = LastHealth[playerClientId];
					HUDManager.Instance.UpdateHealthUI(player.health, false);
				}
			}
			LastHealth[playerClientId] = num;
			if (num >= 10 && player.criticallyInjured)
			{
				player.MakeCriticallyInjured(false);
			}
			if (NourishmentLevel[playerClientId] >= 3 && !player.isSprinting && player.sprintMeter < 1f)
			{
				player.sprintMeter = Mathf.Clamp(player.sprintMeter + Time.deltaTime * 0.01f, 0f, 1f);
			}
			if (player.isSprinting)
			{
				if (player.sprintMeter <= 0.3f && !HasWarned[playerClientId])
				{
					HasWarned[playerClientId] = true;
					HUDManager.Instance.DisplayTip("血之活力", "体力即将耗尽!继续奔跑将抽取生命!", true, false, "LC_Tip1");
				}
				if (player.sprintMeter <= 0.15f && player.health > 10)
				{
					SprintTimer[playerClientId] += Time.deltaTime;
					if (SprintTimer[playerClientId] >= 0.25f)
					{
						SprintTimer[playerClientId] = 0f;
						int num3 = 2;
						if (player.health - num3 < 10)
						{
							num3 = player.health - 10;
						}
						if (num3 > 0)
						{
							player.DamagePlayer(num3, false, true, (CauseOfDeath)0, 0, false, Vector3.zero);
							player.sprintMeter += (float)num3 * 0.02f;
							ConsumedHealth[playerClientId] += num3;
							CheckNourishment(player, playerClientId);
						}
					}
				}
				else if (player.sprintMeter > 0.15f)
				{
					SprintTimer[playerClientId] = 0f;
				}
			}
			else
			{
				SprintTimer[playerClientId] = 0f;
				if (player.sprintMeter > 0.4f)
				{
					HasWarned[playerClientId] = false;
				}
			}
		}

		private void CheckNourishment(PlayerControllerB player, ulong id)
		{
			int num = ConsumedHealth[id];
			int num2 = NourishmentLevel[id];
			if (num >= 90 && num2 < 3)
			{
				switch (num2)
				{
				case 1:
					player.movementSpeed /= 1.1f;
					break;
				case 2:
					player.movementSpeed /= 1.2f;
					break;
				}
				player.movementSpeed *= 1.3f;
				NourishmentLevel[id] = 3;
				HUDManager.Instance.DisplayTip("血之活力", "觉醒【滋养Ⅲ】:永久增加30%移速及10%体力恢复!", false, false, "LC_Tip1");
			}
			else if (num >= 60 && num < 90 && num2 < 2)
			{
				if (num2 == 1)
				{
					player.movementSpeed /= 1.1f;
				}
				player.movementSpeed *= 1.2f;
				NourishmentLevel[id] = 2;
				HUDManager.Instance.DisplayTip("血之活力", "觉醒【滋养Ⅱ】:永久增加20%移速!", false, false, "LC_Tip1");
			}
			else if (num >= 30 && num < 60 && num2 < 1)
			{
				player.movementSpeed *= 1.1f;
				NourishmentLevel[id] = 1;
				HUDManager.Instance.DisplayTip("血之活力", "觉醒【滋养Ⅰ】:永久增加10%移速!", false, false, "LC_Tip1");
			}
		}

		public override string GetStatus(ulong clientId)
		{
			if (NourishmentLevel.TryGetValue(clientId, out var value) && value > 0)
			{
				return "<color=#FF0000>被动生效中 (滋养 " + value switch
				{
					2 => "Ⅱ", 
					1 => "Ⅰ", 
					_ => "Ⅲ", 
				} + " 阶)</color>";
			}
			return "<color=#FF0000>被动生效中 (燃血狂奔)</color>";
		}

		public static void ResetAll()
		{
			if ((Object)(object)StartOfRound.Instance != (Object)null)
			{
				PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
				foreach (PlayerControllerB val in allPlayerScripts)
				{
					ulong playerClientId = val.playerClientId;
					if (NourishmentLevel.TryGetValue(playerClientId, out var value) && ((NetworkBehaviour)val).IsOwner)
					{
						switch (value)
						{
						case 1:
							val.movementSpeed /= 1.1f;
							break;
						case 2:
							val.movementSpeed /= 1.2f;
							break;
						case 3:
							val.movementSpeed /= 1.3f;
							break;
						}
					}
				}
			}
			HasWarned.Clear();
			LastHealth.Clear();
			SprintTimer.Clear();
			ConsumedHealth.Clear();
			NourishmentLevel.Clear();
		}
	}
	public class DeadResentmentSkill : AwakeningSkill
	{
		public Dictionary<ulong, bool> HasTriggered = new Dictionary<ulong, bool>();

		public override string Id => "skill_deadresentment";

		public override string Name => "【被动】亡者遗怨";

		public override string Description => "死亡后产生10m爆炸。5m内队友100点伤害/怪物8点;5-10m内队友60点伤害/怪物4点。";

		public override void OnApply(PlayerControllerB player)
		{
			HasTriggered[player.playerClientId] = false;
		}

		public override void OnRemove(PlayerControllerB player)
		{
			HasTriggered.Remove(player.playerClientId);
		}

		public static void HandleExplosion(Vector3 pos)
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)StartOfRound.Instance == (Object)null)
			{
				return;
			}
			if ((Object)(object)StartOfRound.Instance.explosionPrefab != (Object)null)
			{
				GameObject val = Object.Instantiate<GameObject>(StartOfRound.Instance.explosionPrefab, pos, Quaternion.Euler(-90f, 0f, 0f));
				val.SetActive(true);
				AudioSource component = val.GetComponent<AudioSource>();
				if ((Object)(object)component != (Object)null)
				{
					component.Play();
				}
				ParticleSystem[] componentsInChildren = val.GetComponentsInChildren<ParticleSystem>();
				ParticleSystem[] array = componentsInChildren;
				foreach (ParticleSystem val2 in array)
				{
					val2.Play(true);
				}
				Object.Destroy((Object)(object)val, 5f);
			}
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			if ((Object)(object)localPlayerController != (Object)null && !localPlayerController.isPlayerDead && localPlayerController.isPlayerControlled)
			{
				float num = Vector3.Distance(pos, ((Component)localPlayerController).transform.position);
				if (num <= 15f && (Object)(object)HUDManager.Instance != (Object)null)
				{
					HUDManager.Instance.ShakeCamera((ScreenShakeType)1);
				}
				if (num <= 5f)
				{
					localPlayerController.DamagePlayer(100, true, true, (CauseOfDeath)3, 0, false, Vector3.zero);
				}
				else if (num <= 10f)
				{
					localPlayerController.DamagePlayer(60, true, true, (CauseOfDeath)3, 0, false, Vector3.zero);
				}
			}
			if (!NetworkManager.Singleton.IsServer)
			{
				return;
			}
			EnemyAI[] array2 = Object.FindObjectsOfType<EnemyAI>();
			EnemyAI[] array3 = array2;
			foreach (EnemyAI val3 in array3)
			{
				if ((Object)(object)val3 != (Object)null && !val3.isEnemyDead)
				{
					float num2 = Vector3.Distance(pos, ((Component)val3).transform.position);
					if (num2 <= 5f)
					{
						val3.HitEnemy(8, (PlayerControllerB)null, true, -1);
					}
					else if (num2 <= 10f)
					{
						val3.HitEnemy(4, (PlayerControllerB)null, true, -1);
					}
				}
			}
		}

		public override string GetStatus(ulong clientId)
		{
			if (HasTriggered.TryGetValue(clientId, out var value) && value)
			{
				return "<color=#FF0000>已触发 (尸骨无存)</color>";
			}
			return "<color=#00FF00>就绪 (引信已上膛)</color>";
		}
	}
	public class IronBonesSkill : AwakeningSkill
	{
		public static Dictionary<ulong, int> State = new Dictionary<ulong, int>();

		public static Dictionary<ulong, float> Timers = new Dictionary<ulong, float>();

		public override string Id => "skill_ironbones";

		public override string Name => "【主动】钢筋铁骨";

		public override string Description => "按下 [" + InputActionRebindingExtensions.GetBindingDisplayString(AwakeningInputs.Instance.UseSkillKey, (DisplayStringOptions)0, (string)null) + "]在0.5秒内无敌。成功抵挡伤害获10秒130%移速且无视体力,随后疲劳5秒,此后失效。";

		public override void OnApply(PlayerControllerB player)
		{
			ulong playerClientId = player.playerClientId;
			State[playerClientId] = 0;
			Timers[playerClientId] = 0f;
		}

		public override void OnRemove(PlayerControllerB player)
		{
			ulong playerClientId = player.playerClientId;
			if (State.TryGetValue(playerClientId, out var value) && value == 2)
			{
				player.movementSpeed /= 1.3f;
			}
			State.Remove(playerClientId);
			Timers.Remove(playerClientId);
		}

		public override void OnActivate(PlayerControllerB player)
		{
			ulong playerClientId = player.playerClientId;
			if (State.TryGetValue(playerClientId, out var value) && value == 0)
			{
				State[playerClientId] = 1;
				Timers[playerClientId] = 0.5f;
				if (((NetworkBehaviour)player).IsOwner)
				{
					HUDManager.Instance.DisplayTip("钢筋铁骨", "进入无敌判定!(0.5秒)", false, false, "LC_Tip1");
				}
			}
		}

		public override void OnUpdate(PlayerControllerB player)
		{
			if (!((NetworkBehaviour)player).IsOwner)
			{
				return;
			}
			ulong playerClientId = player.playerClientId;
			if (!State.ContainsKey(playerClientId))
			{
				return;
			}
			switch (State[playerClientId])
			{
			case 1:
				Timers[playerClientId] -= Time.deltaTime;
				if (Timers[playerClientId] <= 0f)
				{
					State[playerClientId] = 5;
					Timers[playerClientId] = 60f;
				}
				break;
			case 2:
				player.sprintMeter = 1f;
				player.isExhausted = false;
				Timers[playerClientId] -= Time.deltaTime;
				if (Timers[playerClientId] <= 0f)
				{
					State[playerClientId] = 3;
					Timers[playerClientId] = 5f;
					player.movementSpeed /= 1.3f;
					HUDManager.Instance.DisplayTip("钢筋铁骨", "爆发结束,进入力竭疲劳状态!", true, false, "LC_Tip1");
				}
				break;
			case 3:
				player.sprintMeter = 0f;
				player.isExhausted = true;
				Timers[playerClientId] -= Time.deltaTime;
				if (Timers[playerClientId] <= 0f)
				{
					State[playerClientId] = 4;
					HUDManager.Instance.DisplayTip("钢筋铁骨", "体力恢复,但装备已损坏(本局失效)。", false, false, "LC_Tip1");
				}
				break;
			case 5:
				Timers[playerClientId] -= Time.deltaTime;
				if (Timers[playerClientId] <= 0f)
				{
					State[playerClientId] = 0;
				}
				break;
			}
		}

		public static void TriggerParry(PlayerControllerB player)
		{
			ulong playerClientId = player.playerClientId;
			if (State.TryGetValue(playerClientId, out var value) && value == 1)
			{
				State[playerClientId] = 2;
				Timers[playerClientId] = 10f;
				player.movementSpeed *= 1.3f;
				if (((NetworkBehaviour)player).IsOwner)
				{
					HUDManager.Instance.DisplayTip("招架成功!", "完美抵挡伤害!移速暴增,无限体力!", false, false, "LC_Tip1");
				}
			}
		}

		public override string GetStatus(ulong clientId)
		{
			string bindingDisplayString = InputActionRebindingExtensions.GetBindingDisplayString(AwakeningInputs.Instance.UseSkillKey, (DisplayStringOptions)0, (string)null);
			if (!State.TryGetValue(clientId, out var value))
			{
				return "";
			}
			return value switch
			{
				0 => "<color=#00FF00>就绪,按" + bindingDisplayString + "</color>", 
				1 => "<color=#FFFF00>无敌判定中...</color>", 
				2 => $"<color=#FF0000>钢筋铁骨爆发中 ({Timers[clientId]:F1}s)</color>", 
				3 => $"<color=#888888>极度疲劳中 ({Timers[clientId]:F1}s)</color>", 
				4 => "<color=#444444>已毁坏 (本局失效)</color>", 
				5 => $"<color=#FFFF00>冷却中 ({Timers[clientId]:F1}s)</color>", 
				_ => "", 
			};
		}

		public static void ResetAll()
		{
			if ((Object)(object)StartOfRound.Instance != (Object)null)
			{
				PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
				foreach (PlayerControllerB val in allPlayerScripts)
				{
					ulong playerClientId = val.playerClientId;
					if (State.TryGetValue(playerClientId, out var value) && value == 2 && ((NetworkBehaviour)val).IsOwner)
					{
						val.movementSpeed /= 1.3f;
					}
				}
			}
			State.Clear();
			Timers.Clear();
		}
	}
	public class LifeBurnHealSkill : AwakeningSkill
	{
		public static Dictionary<ulong, int> State = new Dictionary<ulong, int>();

		public static Dictionary<ulong, bool> HasDebuff = new Dictionary<ulong, bool>();

		public static Dictionary<ulong, PlayerControllerB> InteractingTarget = new Dictionary<ulong, PlayerControllerB>();

		private Dictionary<ulong, float> healTimer = new Dictionary<ulong, float>();

		public override string Id => "skill_lifeburnheal";

		public override string Name => "【主动】燃命愈伤";

		public override string Description => "按下 [" + InputActionRebindingExtensions.GetBindingDisplayString(AwakeningInputs.Instance.UseSkillKey, (DisplayStringOptions)0, (string)null) + "],每秒耗自身1%血转为队友2%血(低于20%不可用)。双方无法移动。使用后获永久虚弱:-10%移速及体力恢复。自身禁疗。";

		public override void OnApply(PlayerControllerB player)
		{
			ulong playerClientId = player.playerClientId;
			State[playerClientId] = 0;
			HasDebuff[playerClientId] = false;
			healTimer[playerClientId] = 0f;
		}

		public override void OnRemove(PlayerControllerB player)
		{
			ulong playerClientId = player.playerClientId;
			if (State.TryGetValue(playerClientId, out var value) && value != 0)
			{
				BreakHeal(playerClientId);
			}
			if (HasDebuff.TryGetValue(playerClientId, out var value2) && value2)
			{
				player.movementSpeed /= 0.9f;
			}
			State.Remove(playerClientId);
			HasDebuff.Remove(playerClientId);
			InteractingTarget.Remove(playerClientId);
		}

		public override void OnUpdate(PlayerControllerB player)
		{
			//IL_02e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
			ulong playerClientId = GameNetworkManager.Instance.localPlayerController.playerClientId;
			ulong playerClientId2 = player.playerClientId;
			if (!State.ContainsKey(playerClientId2))
			{
				return;
			}
			if (HasDebuff.TryGetValue(playerClientId2, out var value) && value && !player.isSprinting && player.sprintMeter < 1f)
			{
				player.sprintMeter = Mathf.Clamp(player.sprintMeter - Time.deltaTime * 0.02f, 0f, 1f);
			}
			if (!((NetworkBehaviour)player).IsOwner)
			{
				return;
			}
			int num = State[playerClientId2];
			if (num == 0)
			{
				PlayerControllerB targetInCrosshair = GetTargetInCrosshair(player);
				if