Decompiled source of ClassPicker v2.1.9

plugins/com.github.hu1hu.ClassPicker.dll

Decompiled a week ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using DG.Tweening;
using DG.Tweening.Core;
using DG.Tweening.Plugins.Options;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using Photon.Voice.Unity;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
using Zorro.Core;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("com.github.hu1hu.ClassPicker")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("2.1.9.0")]
[assembly: AssemblyInformationalVersion("2.1.9")]
[assembly: AssemblyProduct("com.github.hu1hu.ClassPicker")]
[assembly: AssemblyTitle("ClassPicker")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.1.9.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
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;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace BepInEx
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class BepInAutoPluginAttribute : Attribute
	{
		public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace BepInEx.Preloader.Core.Patching
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class PatcherAutoPluginAttribute : Attribute
	{
		public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace ClassPicker
{
	[HarmonyPatch(typeof(CharacterInteractible))]
	internal class CharacterInteractiblePatch
	{
		[HarmonyPatch("CanBeCarried")]
		[HarmonyPrefix]
		public static bool CanBeCarriedPrefix(CharacterInteractible __instance, ref bool __result)
		{
			if ((Object)(object)Character.localCharacter.data.carrier != (Object)null)
			{
				__result = false;
			}
			else if ((Object)(object)__instance.character == (Object)(object)Character.localCharacter)
			{
				__result = false;
			}
			else
			{
				__result = true;
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(CharacterCarrying))]
	internal class CharacterCarryingPatch
	{
		private static readonly FieldInfo characterField = AccessTools.Field(typeof(CharacterCarrying), "character");

		private static readonly MethodInfo dropMethod = AccessTools.Method(typeof(CharacterCarrying), "Drop", (Type[])null, (Type[])null);

		private static readonly MethodInfo GetCarriedMethod = AccessTools.Method(typeof(CharacterCarrying), "GetCarried", (Type[])null, (Type[])null);

		[HarmonyPatch("Update")]
		[HarmonyPrefix]
		public static bool UpdatePrefix(CharacterCarrying __instance)
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			if (characterField == null || dropMethod == null)
			{
				return false;
			}
			object value = characterField.GetValue(__instance);
			if (value == null)
			{
				return false;
			}
			Character val = (Character)value;
			if (Object.op_Implicit((Object)(object)val.data.carriedPlayer) && (val.data.fullyPassedOut || val.data.dead) && val.refs.view.IsMine)
			{
				dropMethod.Invoke(__instance, new object[1] { val.data.carriedPlayer });
			}
			return false;
		}

		[HarmonyPatch("FixedUpdate")]
		[HarmonyPrefix]
		public static bool FixedUpdatePrefix(CharacterCarrying __instance)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			Character val = (Character)characterField.GetValue(__instance);
			if (Object.op_Implicit((Object)(object)val.data.carrier))
			{
				GetCarriedMethod.Invoke(__instance, null);
			}
			return false;
		}
	}
	public static class ConfigManager
	{
		public static float StaminaUsageCoefficient = 1f;

		public static float StaminaRecoveryCoefficient = 1f;

		public static float MaxStaminaBarCoefficient = 1f;

		public static float WeightStatusCoefficient = 1f;

		public static float HungerStatusCoefficient = 1f;

		public static float NightColdCoefficient = 1f;

		public static float PoisonRecoveryCoefficient = 1f;

		public static float DrowsyRecoveryCoefficient = 1f;

		public static float HotRecoveryCoefficient = 1f;

		public static bool EnableExtraStamina = true;

		public static float SkillCooldownDuration = 2f;

		public static KeyCode SkillKey = (KeyCode)102;

		public static string SpawnItemName = "";
	}
	public class GlobalAdd : MonoBehaviour
	{
		public PlayerClassSelector playerClassSelector;

		public SkillManager skillManager;

		public static RichPresenceState currentState;

		private void Awake()
		{
			ManualLogSource? log = Plugin.Log;
			if (log != null)
			{
				log.LogInfo((object)"GlobalAdd Awake called");
			}
			playerClassSelector = Plugin.GO.AddComponent<PlayerClassSelector>();
			skillManager = Plugin.GO.AddComponent<SkillManager>();
		}

		private void Update()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected I4, but got Unknown
			RichPresenceState val = currentState;
			switch ((int)val)
			{
			case 1:
				((Behaviour)playerClassSelector).enabled = true;
				((Behaviour)playerClassSelector.classInfoText).enabled = true;
				break;
			case 0:
				((Behaviour)playerClassSelector).enabled = false;
				((Behaviour)playerClassSelector.classInfoText).enabled = false;
				break;
			case 2:
				((Behaviour)playerClassSelector).enabled = false;
				((Behaviour)playerClassSelector.classInfoText).enabled = false;
				break;
			case 3:
				((Behaviour)playerClassSelector).enabled = false;
				((Behaviour)playerClassSelector.classInfoText).enabled = false;
				break;
			case 4:
				((Behaviour)playerClassSelector).enabled = false;
				((Behaviour)playerClassSelector.classInfoText).enabled = false;
				break;
			case 5:
				((Behaviour)playerClassSelector).enabled = false;
				((Behaviour)playerClassSelector.classInfoText).enabled = false;
				break;
			case 6:
				((Behaviour)playerClassSelector).enabled = false;
				((Behaviour)playerClassSelector.classInfoText).enabled = false;
				break;
			case 7:
				((Behaviour)playerClassSelector).enabled = false;
				((Behaviour)playerClassSelector.classInfoText).enabled = false;
				break;
			case 8:
				((Behaviour)playerClassSelector).enabled = false;
				((Behaviour)playerClassSelector.classInfoText).enabled = false;
				break;
			}
		}

		private void OnDestroy()
		{
			ManualLogSource? log = Plugin.Log;
			if (log != null)
			{
				log.LogInfo((object)"GlobalAdd Destory called");
			}
		}
	}
	[HarmonyPatch(typeof(RichPresenceService))]
	public class RichPresenceServicePatch
	{
		[HarmonyPatch("SetState")]
		[HarmonyPostfix]
		private static void SetStatePostfix(RichPresenceService __instance, RichPresenceState state)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			GlobalAdd.currentState = state;
		}
	}
	public class PlayerClassSelector : MonoBehaviour
	{
		public enum PlayerClass
		{
			Normal,
			Scout,
			Medic,
			Cook,
			Challenger,
			Porter,
			Beanman,
			Artilleryman,
			Gambler,
			Bugler,
			Teleporter,
			Trickster,
			Rescuer,
			Revyn
		}

		public class ClassConfig
		{
			public float MaxStaminaBarCoefficient { get; set; } = 1f;


			public float StaminaUsageCoefficient { get; set; } = 1f;


			public float StaminaRecoveryCoefficient { get; set; } = 1f;


			public float WeightStatusCoefficient { get; set; } = 1f;


			public float HungerStatusCoefficient { get; set; } = 1f;


			public float NightColdCoefficient { get; set; } = 1f;


			public float PoisonRecoveryCoefficient { get; set; } = 1f;


			public float DrowsyRecoveryCoefficient { get; set; } = 1f;


			public float HotRecoveryCoefficient { get; set; } = 1f;


			public bool EnableExtraStamina { get; set; } = true;


			public float SkillCooldownDuration { get; set; } = 30f;


			public string SpawnItemName { get; set; } = "";

		}

		public static class ClassConfigs
		{
			public static readonly Dictionary<PlayerClass, ClassConfig> Configs = new Dictionary<PlayerClass, ClassConfig>
			{
				{
					PlayerClass.Scout,
					new ClassConfig
					{
						StaminaUsageCoefficient = 0.7f,
						WeightStatusCoefficient = 2f,
						SkillCooldownDuration = 15f,
						SpawnItemName = "RopeSpool"
					}
				},
				{
					PlayerClass.Medic,
					new ClassConfig
					{
						MaxStaminaBarCoefficient = 0.88f,
						SkillCooldownDuration = 60f,
						SpawnItemName = "Bandages"
					}
				},
				{
					PlayerClass.Cook,
					new ClassConfig
					{
						MaxStaminaBarCoefficient = 0.9f,
						HungerStatusCoefficient = 0.9f,
						SkillCooldownDuration = 20f,
						SpawnItemName = "PortableStovetopItem"
					}
				},
				{
					PlayerClass.Challenger,
					new ClassConfig
					{
						MaxStaminaBarCoefficient = 0.8f,
						StaminaUsageCoefficient = 0.8f,
						StaminaRecoveryCoefficient = 1.2f,
						HungerStatusCoefficient = 1.2f,
						EnableExtraStamina = false,
						SkillCooldownDuration = 60f,
						SpawnItemName = "Warp Compass"
					}
				},
				{
					PlayerClass.Porter,
					new ClassConfig
					{
						WeightStatusCoefficient = 0.2f,
						HungerStatusCoefficient = 1.2f,
						SkillCooldownDuration = 600f,
						SpawnItemName = "Backpack"
					}
				},
				{
					PlayerClass.Beanman,
					new ClassConfig
					{
						MaxStaminaBarCoefficient = 1.1f,
						HungerStatusCoefficient = 1.2f,
						SkillCooldownDuration = 90f,
						SpawnItemName = "MagicBean"
					}
				},
				{
					PlayerClass.Artilleryman,
					new ClassConfig
					{
						MaxStaminaBarCoefficient = 0.8f,
						SkillCooldownDuration = 30f,
						SpawnItemName = "BounceShroom"
					}
				},
				{
					PlayerClass.Gambler,
					new ClassConfig
					{
						MaxStaminaBarCoefficient = Random.Range(0.8f, 1.2f),
						StaminaUsageCoefficient = Random.Range(0.8f, 1.2f),
						StaminaRecoveryCoefficient = Random.Range(0.8f, 1.2f),
						WeightStatusCoefficient = Random.Range(0.8f, 1.2f),
						HungerStatusCoefficient = Random.Range(0.8f, 1.2f),
						SkillCooldownDuration = Random.Range(10f, 15f),
						EnableExtraStamina = (Random.value > 0.3f),
						SpawnItemName = "随机箱子"
					}
				},
				{
					PlayerClass.Bugler,
					new ClassConfig
					{
						MaxStaminaBarCoefficient = 0.9f,
						StaminaUsageCoefficient = 0.9f,
						SkillCooldownDuration = 300f,
						SpawnItemName = "Bugle_Magic"
					}
				},
				{
					PlayerClass.Teleporter,
					new ClassConfig
					{
						MaxStaminaBarCoefficient = 0.9f,
						StaminaRecoveryCoefficient = 0.8f,
						EnableExtraStamina = true,
						SkillCooldownDuration = 20f,
						SpawnItemName = "Teleporter"
					}
				},
				{
					PlayerClass.Trickster,
					new ClassConfig
					{
						SpawnItemName = "",
						MaxStaminaBarCoefficient = 0.9f,
						HungerStatusCoefficient = 1.1f,
						SkillCooldownDuration = 0f
					}
				},
				{
					PlayerClass.Normal,
					new ClassConfig
					{
						SpawnItemName = "",
						SkillCooldownDuration = 0f
					}
				},
				{
					PlayerClass.Rescuer,
					new ClassConfig
					{
						MaxStaminaBarCoefficient = 0.88f,
						SkillCooldownDuration = 180f,
						SpawnItemName = "RescueHook"
					}
				},
				{
					PlayerClass.Revyn,
					new ClassConfig
					{
						SkillCooldownDuration = 0f,
						WeightStatusCoefficient = 1.1f,
						SpawnItemName = ""
					}
				}
			};

			public static ClassConfig GetConfig(PlayerClass playerClass)
			{
				if (Configs.TryGetValue(playerClass, out ClassConfig value))
				{
					if (playerClass == PlayerClass.Gambler)
					{
						value.MaxStaminaBarCoefficient = Random.Range(0.8f, 1.2f);
						value.StaminaUsageCoefficient = Random.Range(0.9f, 1.1f);
						value.StaminaRecoveryCoefficient = Random.Range(0.9f, 1.2f);
						value.WeightStatusCoefficient = Random.Range(0.9f, 1.1f);
						value.HungerStatusCoefficient = Random.Range(0.9f, 1.1f);
						value.SkillCooldownDuration = Random.Range(20f, 30f);
						value.EnableExtraStamina = Random.value > 0.4f;
					}
					return value;
				}
				return new ClassConfig();
			}
		}

		public static PlayerClass[] values = (PlayerClass[])Enum.GetValues(typeof(PlayerClass));

		public static PlayerClass currentClass = PlayerClass.Normal;

		public TextMeshProUGUI? classInfoText;

		private GameObject canvasGO;

		public string GetDisplayName(PlayerClass playerClass)
		{
			return playerClass switch
			{
				PlayerClass.Normal => "普通", 
				PlayerClass.Scout => "侦察兵", 
				PlayerClass.Medic => "医疗兵", 
				PlayerClass.Cook => "厨师", 
				PlayerClass.Challenger => "挑战者", 
				PlayerClass.Porter => "搬运工", 
				PlayerClass.Beanman => "魔豆人", 
				PlayerClass.Artilleryman => "炮手", 
				PlayerClass.Gambler => "赌徒", 
				PlayerClass.Bugler => "号角手", 
				PlayerClass.Teleporter => "传送者", 
				PlayerClass.Trickster => "魔术师", 
				PlayerClass.Rescuer => "救援者", 
				PlayerClass.Revyn => "诅咒不死者", 
				_ => "未知", 
			};
		}

		public PlayerClass Next(PlayerClass current)
		{
			int num = Array.IndexOf(values, current) + 1;
			if (num >= values.Length)
			{
				num = 0;
			}
			return values[num];
		}

		public PlayerClass Previous(PlayerClass current)
		{
			int num = Array.IndexOf(values, current) - 1;
			if (num < 0)
			{
				num = values.Length - 1;
			}
			return values[num];
		}

		private void Awake()
		{
			ManualLogSource? log = Plugin.Log;
			if (log != null)
			{
				log.LogInfo((object)"PlayerClassSelector Awake called");
			}
			try
			{
				CreateClassNameUI();
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)ex);
			}
			SetClass(currentClass);
		}

		private void OnDestroy()
		{
			ManualLogSource? log = Plugin.Log;
			if (log != null)
			{
				log.LogInfo((object)"PlayerClassSelector Destroy called");
			}
			Object.Destroy((Object)(object)canvasGO);
		}

		private void Update()
		{
			//IL_0053: 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_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: 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_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			if (Input.GetKeyDown((KeyCode)276))
			{
				SetClass(Previous(currentClass));
			}
			if (Input.GetKeyDown((KeyCode)275))
			{
				SetClass(Next(currentClass));
			}
			if (Input.GetKeyDown((KeyCode)273))
			{
				ConfigManager.SkillCooldownDuration = 1f;
				Vector3 val = Character.localCharacter.Center + Vector3.up * 0.2f;
				Quaternion rotation = ((Component)Character.localCharacter).transform.rotation;
			}
			UpdateClassNameUI();
		}

		public static void SetClass(PlayerClass newClass)
		{
			currentClass = newClass;
			ManualLogSource? log = Plugin.Log;
			if (log != null)
			{
				log.LogInfo((object)$"当前职业: {currentClass}");
			}
			ClassConfig config = ClassConfigs.GetConfig(currentClass);
			ConfigManager.MaxStaminaBarCoefficient = config.MaxStaminaBarCoefficient;
			ConfigManager.StaminaUsageCoefficient = config.StaminaUsageCoefficient;
			ConfigManager.StaminaRecoveryCoefficient = config.StaminaRecoveryCoefficient;
			ConfigManager.WeightStatusCoefficient = config.WeightStatusCoefficient;
			ConfigManager.HungerStatusCoefficient = config.HungerStatusCoefficient;
			ConfigManager.NightColdCoefficient = config.NightColdCoefficient;
			ConfigManager.PoisonRecoveryCoefficient = config.PoisonRecoveryCoefficient;
			ConfigManager.DrowsyRecoveryCoefficient = config.DrowsyRecoveryCoefficient;
			ConfigManager.HotRecoveryCoefficient = config.HotRecoveryCoefficient;
			ConfigManager.EnableExtraStamina = config.EnableExtraStamina;
			ConfigManager.SkillCooldownDuration = config.SkillCooldownDuration;
			ConfigManager.SpawnItemName = config.SpawnItemName;
		}

		private void CreateClassNameUI()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Expected O, but got Unknown
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = GameObject.Find("GAME/GUIManager");
			GUIManager component = val.GetComponent<GUIManager>();
			TMP_FontAsset font = ((TMP_Text)component.heroDayText).font;
			canvasGO = new GameObject("ClassNameCanvas");
			Object.DontDestroyOnLoad((Object)(object)canvasGO);
			Canvas val2 = canvasGO.AddComponent<Canvas>();
			canvasGO.SetActive(true);
			val2.renderMode = (RenderMode)0;
			CanvasScaler val3 = canvasGO.AddComponent<CanvasScaler>();
			if ((Object)(object)val3 != (Object)null)
			{
				val3.uiScaleMode = (ScaleMode)1;
				val3.referenceResolution = new Vector2(1920f, 1080f);
				val3.matchWidthOrHeight = 0.5f;
			}
			canvasGO.AddComponent<GraphicRaycaster>();
			GameObject val4 = new GameObject("classInfoText");
			val4.transform.SetParent(((Component)val2).transform, false);
			classInfoText = val4.AddComponent<TextMeshProUGUI>();
			((TMP_Text)classInfoText).font = font;
			((TMP_Text)classInfoText).fontSize = 22f;
			((TMP_Text)classInfoText).alignment = (TextAlignmentOptions)257;
			((TMP_Text)classInfoText).enableVertexGradient = true;
			((TMP_Text)classInfoText).colorGradient = new VertexGradient(new Color(1f, 0.6f, 0f), new Color(1f, 0.3f, 0f), new Color(1f, 0.8f, 0.2f), new Color(1f, 0.5f, 0.2f));
			((TMP_Text)classInfoText).text = "体力条系数消耗恢复负重饥饿技能冷却\n物品生成职业状态按← / →切换职业?";
			RectTransform component2 = ((Component)classInfoText).GetComponent<RectTransform>();
			component2.anchorMin = new Vector2(0f, 0.5f);
			component2.anchorMax = new Vector2(0f, 0.5f);
			component2.pivot = new Vector2(0f, 0.5f);
			component2.anchoredPosition = new Vector2(20f, 240f);
			component2.sizeDelta = new Vector2(400f, 200f);
		}

		private void UpdateClassNameUI()
		{
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.AppendFormat("职业: <color=#FF5555>{0}</color>\n", GetDisplayName(currentClass));
			if (currentClass == PlayerClass.Gambler)
			{
				stringBuilder.Append("状态: <color=#BFEC1B>??? ??? ???</color>\n");
			}
			else
			{
				if (ConfigManager.MaxStaminaBarCoefficient != 1f)
				{
					stringBuilder.AppendFormat("体力条系数: <color=#BFEC1B>{0:F2}</color>\n", ConfigManager.MaxStaminaBarCoefficient);
				}
				if (ConfigManager.StaminaUsageCoefficient != 1f)
				{
					stringBuilder.AppendFormat("体力消耗系数: <color=#FFCC66>{0:F2}</color>\n", ConfigManager.StaminaUsageCoefficient);
				}
				if (ConfigManager.StaminaRecoveryCoefficient != 1f)
				{
					stringBuilder.AppendFormat("体力恢复系数: <color=#C80918>{0:F2}</color>\n", ConfigManager.StaminaRecoveryCoefficient);
				}
				if (ConfigManager.WeightStatusCoefficient != 1f)
				{
					stringBuilder.AppendFormat("负重系数: <color=#A65A1C>{0:F2}</color>\n", ConfigManager.WeightStatusCoefficient);
				}
				if (ConfigManager.HungerStatusCoefficient != 1f)
				{
					stringBuilder.AppendFormat("饥饿系数: <color=#FFBD16>{0:F2}</color>\n", ConfigManager.HungerStatusCoefficient);
				}
				if (ConfigManager.SkillCooldownDuration != 2f)
				{
					stringBuilder.AppendFormat("技能冷却: <color=#BFEC1B>{0:F1}s</color>\n", ConfigManager.SkillCooldownDuration);
				}
				if (!string.IsNullOrEmpty(ConfigManager.SpawnItemName))
				{
					stringBuilder.AppendFormat("生成物品: <color=#D48E00>{0}</color>\n", ConfigManager.SpawnItemName);
				}
			}
			stringBuilder.AppendLine("\n← / →  切换职业");
			stringBuilder.AppendLine("↑  取消冷却时间\n");
			((TMP_Text)classInfoText).text = stringBuilder.ToString();
		}
	}
	[HarmonyPatch(typeof(PlayerHandler))]
	public class PlayerHandlerPatches
	{
		[HarmonyPatch("RegisterCharacter")]
		[HarmonyPrefix]
		private static bool RegisterCharacterPrefix(PlayerHandler __instance, Character character)
		{
			PhotonView component = ((Component)character).GetComponent<PhotonView>();
			if (PlayerHandler.Instance.m_playerCharacterLookup.ContainsKey(component.Owner.ActorNumber))
			{
				Debug.Log((object)$"Overwriting character for {component.Owner.ActorNumber}");
				Character val = PlayerHandler.Instance.m_playerCharacterLookup[component.Owner.ActorNumber];
				if ((Object)(object)val != (Object)null)
				{
					Debug.LogError((object)"Disabled Old Player....");
				}
				PlayerHandler.Instance.m_playerCharacterLookup.Remove(component.Owner.ActorNumber);
			}
			PlayerHandler.Instance.m_playerCharacterLookup.Add(component.Owner.ActorNumber, character);
			Debug.Log((object)$"Registering Character object for {component.Owner.NickName} : {component.Owner.ActorNumber}");
			return false;
		}
	}
	[BepInPlugin("com.github.hu1hu.ClassPicker", "ClassPicker", "2.1.9")]
	public class Plugin : BaseUnityPlugin
	{
		private static Harmony? harmony;

		public static ManualLogSource? Log;

		private ConfigEntry<bool>? modEnabled;

		private ConfigEntry<KeyCode>? skillKey;

		private ConfigEntry<PlayerClassSelector.PlayerClass>? playClass;

		private const string PLUGIN_GUID = "com.github.hu1hu.ClassPicker";

		private const string PLUGIN_NAME = "ClassPicker";

		public static GameObject GO = new GameObject("GO");

		public static GlobalAdd globalAdd;

		private void Awake()
		{
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Expected O, but got Unknown
			Log = ((BaseUnityPlugin)this).Logger;
			modEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("通用", "启用模组", true, "是否启用 ClassPicker 模组");
			skillKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("通用", "技能按键", (KeyCode)102, "释放技能的按键");
			playClass = ((BaseUnityPlugin)this).Config.Bind<PlayerClassSelector.PlayerClass>("通用", "职业", PlayerClassSelector.PlayerClass.Normal, "职业");
			ConfigManager.SkillKey = skillKey.Value;
			PlayerClassSelector.currentClass = playClass.Value;
			Object.DontDestroyOnLoad((Object)(object)GO);
			if (!modEnabled.Value)
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)"ClassPicker 模组已禁用,退出加载。");
				return;
			}
			harmony = new Harmony("com.github.hu1hu.ClassPicker");
			harmony.PatchAll();
			Log.LogInfo((object)"插件 ClassPicker 已加载");
		}

		private void OnDestroy()
		{
			ManualLogSource? log = Log;
			if (log != null)
			{
				log.LogInfo((object)"插件 ClassPicker 已卸载");
			}
			playClass.Value = PlayerClassSelector.currentClass;
			Harmony? obj = harmony;
			if (obj != null)
			{
				obj.UnpatchSelf();
			}
		}
	}
	[HarmonyPatch(typeof(Character))]
	public class CharacterPatches
	{
		[HarmonyPatch("UseStamina")]
		[HarmonyPrefix]
		private static void UseStaminaPrefix(Character __instance, ref float usage, bool useBonusStamina)
		{
			if ((Object)(object)__instance != (Object)null && __instance.IsLocal)
			{
				usage *= ConfigManager.StaminaUsageCoefficient;
			}
		}

		[HarmonyPatch("AddStamina")]
		[HarmonyPrefix]
		private static void AddStaminaPrefix(Character __instance, ref float add)
		{
			if ((Object)(object)__instance != (Object)null && __instance.IsLocal)
			{
				add *= ConfigManager.StaminaRecoveryCoefficient;
			}
		}

		[HarmonyPatch("GetMaxStamina")]
		[HarmonyPrefix]
		private static bool GetMaxStaminaPrefix(Character __instance, ref float __result)
		{
			if ((Object)(object)__instance != (Object)null && __instance.IsLocal)
			{
				__result = Mathf.Max(ConfigManager.MaxStaminaBarCoefficient - __instance.refs.afflictions.statusSum, 0f);
				return false;
			}
			return true;
		}

		[HarmonyPatch("HandleLife")]
		[HarmonyPrefix]
		private static bool HandleLifePrefix(Character __instance)
		{
			if (__instance.refs.afflictions.statusSum >= ConfigManager.MaxStaminaBarCoefficient)
			{
				__instance.data.passOutValue = Mathf.MoveTowards(__instance.data.passOutValue, 1f, Time.deltaTime / 5f);
				if (__instance.data.passOutValue > 0.999f)
				{
					Traverse val = Traverse.Create((object)__instance);
					PhotonView value = val.Field("view").GetValue<PhotonView>();
					value.RPC("RPCA_PassOut", (RpcTarget)0, Array.Empty<object>());
				}
			}
			else
			{
				__instance.data.passOutValue = Mathf.MoveTowards(__instance.data.passOutValue, 0f, Time.deltaTime / 5f);
			}
			return false;
		}

		[HarmonyPatch("HandlePassedOut")]
		[HarmonyPrefix]
		private static bool HandlePassedOutPrefix(Character __instance)
		{
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: 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)
			Traverse val = Traverse.Create((object)__instance);
			PhotonView value = val.Field("view").GetValue<PhotonView>();
			bool value2 = val.Field("UnPassOutCalled").GetValue<bool>();
			float value3 = val.Field("passOutFailsafeTick").GetValue<float>();
			if (__instance.refs.afflictions.statusSum < ConfigManager.MaxStaminaBarCoefficient && Time.time - __instance.data.lastPassedOut > 3f)
			{
				if (!value2)
				{
					value.RPC("RPCA_UnPassOut", (RpcTarget)0, Array.Empty<object>());
					value3 = 0f;
				}
				else
				{
					value3 += Time.deltaTime;
					if (value3 > 3f)
					{
						Debug.Log((object)"Passed out failsafe triggered.");
						value2 = false;
					}
				}
			}
			if (__instance.data.deathTimer > 1f)
			{
				__instance.refs.items.EquipSlot(Optionable<byte>.None);
				Debug.Log((object)"DYING");
				value.RPC("RPCA_Die", (RpcTarget)0, new object[1] { __instance.Center + Vector3.up * 0.2f + Vector3.forward * 0.1f });
			}
			return false;
		}

		[HarmonyPatch("AddExtraStamina")]
		[HarmonyPrefix]
		private static bool AddExtraStaminaPrefix(Character __instance, ref float add)
		{
			if (!ConfigManager.EnableExtraStamina)
			{
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(StaminaBar))]
	public class StaminaBarPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPrefix]
		private static void Prefix(StaminaBar __instance)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			RectTransform component = ((Component)__instance).GetComponent<RectTransform>();
			component.sizeDelta = new Vector2(ConfigManager.MaxStaminaBarCoefficient * 600f, component.sizeDelta.y);
			__instance.staminaBarOutline.sizeDelta = new Vector2(ConfigManager.MaxStaminaBarCoefficient * __instance.fullBar.sizeDelta.x, __instance.staminaBarOutline.sizeDelta.y);
		}

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void Postfix(StaminaBar __instance)
		{
			//IL_0031: 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_004d: Unknown result type (might be due to invalid IL or missing references)
			float statusSum = Character.observedCharacter.refs.afflictions.statusSum;
			__instance.staminaBarOutline.sizeDelta = new Vector2(14f + Mathf.Max(ConfigManager.MaxStaminaBarCoefficient, statusSum) * __instance.fullBar.sizeDelta.x, __instance.staminaBarOutline.sizeDelta.y);
		}

		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void StartPostfix(StaminaBar __instance)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			RectTransform component = ((Component)__instance).GetComponent<RectTransform>();
			component.sizeDelta = new Vector2(ConfigManager.MaxStaminaBarCoefficient * 600f, component.sizeDelta.y);
		}
	}
	[HarmonyPatch(typeof(CharacterAfflictions))]
	public class CharacterAfflictionsPatches
	{
		[HarmonyPatch("UpdateWeight")]
		[HarmonyPrefix]
		private static bool UpdateWeightPrefix(CharacterAfflictions __instance)
		{
			int num = 0;
			int num2 = 0;
			float currentStatus = __instance.GetCurrentStatus((STATUSTYPE)9);
			for (int i = 0; i < __instance.character.player.itemSlots.Length; i++)
			{
				ItemSlot val = __instance.character.player.itemSlots[i];
				if ((Object)(object)val.prefab != (Object)null)
				{
					num += val.prefab.CarryWeight;
				}
			}
			BackpackSlot backpackSlot = __instance.character.player.backpackSlot;
			BackpackData val2 = default(BackpackData);
			if (!((ItemSlot)backpackSlot).IsEmpty() && ((ItemSlot)backpackSlot).data.TryGetDataEntry<BackpackData>((DataEntryKey)7, ref val2))
			{
				for (int j = 0; j < val2.itemSlots.Length; j++)
				{
					ItemSlot val3 = val2.itemSlots[j];
					if (!val3.IsEmpty())
					{
						num += val3.prefab.CarryWeight;
					}
				}
			}
			ItemSlot itemSlot = __instance.character.player.GetItemSlot((byte)250);
			if (!itemSlot.IsEmpty())
			{
				num += itemSlot.prefab.CarryWeight;
			}
			if ((Object)(object)__instance.character.data.carriedPlayer != (Object)null)
			{
				num += 8;
			}
			foreach (StickyItemComponent aLL_STUCK_ITEM in StickyItemComponent.ALL_STUCK_ITEMS)
			{
				if ((Object)(object)aLL_STUCK_ITEM.stuckToCharacter == (Object)(object)__instance.character)
				{
					num += aLL_STUCK_ITEM.addWeightToStuckPlayer;
					num2 += aLL_STUCK_ITEM.addThornsToStuckPlayer;
				}
			}
			if (Object.op_Implicit((Object)(object)__instance.character.data.currentStickyItem))
			{
				num2 += __instance.character.data.currentStickyItem.addThornsToStuckPlayer;
			}
			num2 += __instance.GetTotalThornStatusIncrements();
			float num3 = 0.025f * (float)num2;
			if (num3 > currentStatus)
			{
				__instance.StatusSFX((STATUSTYPE)9, num3 - currentStatus);
				if (__instance.character.IsLocal && (Object)(object)__instance.character == (Object)(object)Character.observedCharacter)
				{
					GUIManager.instance.AddStatusFX((STATUSTYPE)9, num3 - currentStatus);
				}
				__instance.PlayParticle((STATUSTYPE)9);
			}
			__instance.SetStatus((STATUSTYPE)7, 0.025f * (float)num * ConfigManager.WeightStatusCoefficient, true);
			__instance.SetStatus((STATUSTYPE)9, 0.025f * (float)num2, true);
			return false;
		}

		[HarmonyPatch("UpdateNormalStatuses")]
		[HarmonyPrefix]
		private static bool UpdateNormalStatusPrefix(CharacterAfflictions __instance)
		{
			Traverse val = Traverse.Create((object)__instance);
			if (__instance.character.IsLocal)
			{
				if (Ascents.isNightCold && Object.op_Implicit((Object)(object)Singleton<MountainProgressHandler>.Instance) && Singleton<MountainProgressHandler>.Instance.maxProgressPointReached < 3 && (Object)(object)DayNightManager.instance != (Object)null && DayNightManager.instance.isDay < 0.5f)
				{
					__instance.AddStatus((STATUSTYPE)2, Time.deltaTime * (1f - DayNightManager.instance.isDay) * Ascents.nightColdRate * ConfigManager.NightColdCoefficient, false, true);
				}
				if (__instance.character.data.fullyConscious)
				{
					__instance.AddStatus((STATUSTYPE)1, Time.deltaTime * __instance.hungerPerSecond * Ascents.hungerRateMultiplier * ConfigManager.HungerStatusCoefficient, false, true);
				}
				if (__instance.GetCurrentStatus((STATUSTYPE)3) > 0f && Time.time - __instance.LastAddedStatus((STATUSTYPE)3) > __instance.poisonReductionCooldown)
				{
					__instance.SubtractStatus((STATUSTYPE)3, __instance.poisonReductionPerSecond * Time.deltaTime * ConfigManager.PoisonRecoveryCoefficient, false, false);
				}
				if (__instance.GetCurrentStatus((STATUSTYPE)6) > 0f && Time.time - __instance.LastAddedStatus((STATUSTYPE)6) > __instance.drowsyReductionCooldown)
				{
					__instance.SubtractStatus((STATUSTYPE)6, __instance.drowsyReductionPerSecond * Time.deltaTime * ConfigManager.DrowsyRecoveryCoefficient, false, false);
				}
				if (__instance.GetCurrentStatus((STATUSTYPE)8) > 0f && Time.time - __instance.LastAddedStatus((STATUSTYPE)8) > __instance.hotReductionCooldown)
				{
					__instance.SubtractStatus((STATUSTYPE)8, __instance.hotReductionPerSecond * Time.deltaTime * ConfigManager.HotRecoveryCoefficient, false, false);
				}
				if ((__instance.character.data.fullyConscious || !__instance.willZombify) && __instance.GetCurrentStatus((STATUSTYPE)10) > 0f && Time.time - __instance.LastAddedStatus((STATUSTYPE)10) > __instance.sporesReductionCooldown)
				{
					__instance.SubtractStatus((STATUSTYPE)10, __instance.sporesReductionPerSecond * Time.deltaTime, false, true);
				}
			}
			return false;
		}

		[HarmonyPatch("AddStatus")]
		[HarmonyPrefix]
		private static bool AddStatusPrefix(CharacterAfflictions __instance, ref bool __result, STATUSTYPE statusType, float amount, bool fromRPC = false)
		{
			FUN_Manger.m_inAirport = __instance.m_inAirport;
			__instance.m_inAirport = FUN_Manger.m_inAirport && !FUN_Manger.isInjured;
			if (!__instance.character.IsLocal && !__instance.character.isZombie)
			{
				__result = false;
				return false;
			}
			return true;
		}

		[HarmonyPatch("AddStatus")]
		[HarmonyPostfix]
		private static void AddStatusPostfix(CharacterAfflictions __instance, STATUSTYPE statusType, float amount, bool fromRPC = false)
		{
			__instance.m_inAirport = FUN_Manger.m_inAirport;
		}
	}
	public class FUN_Manger : MonoBehaviour
	{
		[CompilerGenerated]
		private sealed class <>c__DisplayClass6_0
		{
			public Character currentTarget;

			public Scoutmaster sm;

			public float forcedChaseDuration;
		}

		private PhotonView view;

		public static bool isInjured;

		public static bool m_inAirport;

		private readonly string[] shootItems = new string[8] { "BingBong", "Frisbee", "Dynamite", "Scorpion", "Stone", "NestEgg", "Berrynana Peel Yellow", "LuggageSmall" };

		private int shootItemIndex;

		public static bool shootActive;

		public void Update()
		{
			//IL_0050: 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_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: 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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: 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_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0274: Unknown result type (might be due to invalid IL or missing references)
			//IL_0279: Unknown result type (might be due to invalid IL or missing references)
			//IL_0283: Unknown result type (might be due to invalid IL or missing references)
			//IL_0288: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if (Input.GetKeyDown((KeyCode)256) || Input.GetKeyDown((KeyCode)291))
				{
					ManualLogSource? log = Plugin.Log;
					if (log != null)
					{
						log.LogInfo((object)"小数字键盘0被按下,生成炸弹");
					}
					SpawnDynamite();
				}
				if (Input.GetKeyDown((KeyCode)257) || Input.GetKeyDown((KeyCode)282))
				{
					Vector3 center = Character.localCharacter.Center;
					Vector3 forward = ((Component)Camera.main).transform.forward;
					GameObject val = PhotonNetwork.Instantiate("Tornado", center + forward * 10f, Quaternion.identity, (byte)0, (object[])null);
					view = val.GetComponent<PhotonView>();
					Object.Destroy((Object)(object)val, 10f);
				}
				if ((Input.GetKeyDown((KeyCode)258) || Input.GetKeyDown((KeyCode)283)) && (Object)(object)view != (Object)null)
				{
					view.RPC("RPCA_TornadoDie", (RpcTarget)0, Array.Empty<object>());
				}
				if (Input.GetKeyDown((KeyCode)259) || Input.GetKeyDown((KeyCode)284))
				{
					ManualLogSource? log2 = Plugin.Log;
					if (log2 != null)
					{
						log2.LogInfo((object)"小数字键盘3被按下,生成童子军队长");
					}
					SpawnScoutMaster();
				}
				if (Input.GetKeyDown((KeyCode)260) || Input.GetKeyDown((KeyCode)285))
				{
					shootActive = !shootActive;
				}
				if (shootActive)
				{
					if (Input.GetMouseButtonDown(0))
					{
						ShootItem();
					}
					if (Input.GetMouseButtonDown(1))
					{
						shootItemIndex = (shootItemIndex + 1) % shootItems.Length;
					}
				}
				if (Input.GetKeyDown((KeyCode)270) || Input.GetKeyDown((KeyCode)61))
				{
					Vector3 val2 = Character.localCharacter.Center + Vector3.up * 1f;
					if ((Object)(object)Character.localCharacter.Ghost != (Object)null && (Object)(object)Character.localCharacter.Ghost.m_target != (Object)null)
					{
						val2 = Character.localCharacter.Ghost.m_target.Center + Vector3.up * 1f;
					}
					if ((Object)(object)((MonoBehaviourPun)Character.localCharacter).photonView != (Object)null)
					{
						((MonoBehaviourPun)Character.localCharacter).photonView.RPC("RPCA_ReviveAtPosition", (RpcTarget)0, new object[2] { val2, false });
					}
				}
				if ((Input.GetKeyDown((KeyCode)269) || Input.GetKeyDown((KeyCode)45)) && (Object)(object)((MonoBehaviourPun)Character.localCharacter).photonView != (Object)null)
				{
					((MonoBehaviourPun)Character.localCharacter).photonView.RPC("RPCA_Die", (RpcTarget)0, new object[1] { Character.localCharacter.Center + Vector3.up * 1f });
				}
				if (Input.GetKeyDown((KeyCode)262) || Input.GetKeyDown((KeyCode)287))
				{
					Utils.isdisplay = !Utils.isdisplay;
				}
				if (Input.GetKeyDown((KeyCode)264) || Input.GetKeyDown((KeyCode)289))
				{
					isInjured = !isInjured;
				}
			}
			catch (Exception ex)
			{
				ManualLogSource? log3 = Plugin.Log;
				if (log3 != null)
				{
					log3.LogError((object)("Update 报错: " + ex));
				}
			}
		}

		[PunRPC]
		public void RPCA_SpawnDynamite()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: 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_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			Vector3 center = Character.localCharacter.Center;
			Quaternion rotation = ((Component)Character.localCharacter).transform.rotation;
			Utils.SpawnItem("Dynamite", center + Vector3.up * 1f, rotation);
		}

		public void SpawnDynamite()
		{
			PhotonView component = ((Component)Character.localCharacter).GetComponent<PhotonView>();
			foreach (Character allCharacter in Character.AllCharacters)
			{
				if (!((Object)allCharacter).name.Equals(((Object)Character.localCharacter).name))
				{
					((MonoBehaviourPun)allCharacter).photonView.RPC("RPCA_SpawnDynamite", (RpcTarget)0, Array.Empty<object>());
				}
			}
		}

		public void SpawnScoutMaster()
		{
			//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_001b: 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_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			<>c__DisplayClass6_0 CS$<>8__locals0 = new <>c__DisplayClass6_0();
			Vector3 center = Character.localCharacter.Center;
			Vector3 forward = ((Component)Camera.main).transform.forward;
			Quaternion val = Quaternion.LookRotation(((Component)Camera.main).transform.forward);
			CS$<>8__locals0.sm = PhotonNetwork.Instantiate("Character_Scoutmaster", center + forward * 10f, val, (byte)0, (object[])null).GetComponent<Scoutmaster>();
			CS$<>8__locals0.currentTarget = Character.AllCharacters[Random.Range(0, Character.AllCharacters.Count)];
			CS$<>8__locals0.forcedChaseDuration = 60f;
			((MonoBehaviour)CS$<>8__locals0.sm).StartCoroutine(KeepChasing());
			[IteratorStateMachine(typeof(<>c__DisplayClass6_0.<<SpawnScoutMaster>g__KeepChasing|0>d))]
			IEnumerator KeepChasing()
			{
				//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
				return new <>c__DisplayClass6_0.<<SpawnScoutMaster>g__KeepChasing|0>d(0)
				{
					<>4__this = CS$<>8__locals0
				};
			}
		}

		public void ShootItem()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = Character.localCharacter.Center + ((Component)Camera.main).transform.forward * 2f;
			Quaternion val2 = Quaternion.LookRotation(((Component)Camera.main).transform.forward);
			Vector3 forward = ((Component)Camera.main).transform.forward;
			string text = shootItems[shootItemIndex];
			GameObject val3 = PhotonNetwork.Instantiate("0_items/" + text, val, val2, (byte)0, (object[])null);
			if (text == "LuggageSmall")
			{
				val3.AddComponent<Rigidbody>();
			}
			Rigidbody component = val3.GetComponent<Rigidbody>();
			component.isKinematic = false;
			component.useGravity = true;
			component.AddForce(((Component)Camera.main).transform.forward * 200f, (ForceMode)1);
			Object.Destroy((Object)(object)val3, 10f);
		}
	}
	[HarmonyPatch(typeof(GUIManager))]
	public class GUIManagerPatch
	{
		[HarmonyPatch("Awake")]
		[HarmonyPostfix]
		private static void AwakePostfix(GUIManager __instance)
		{
			if ((Object)(object)Plugin.globalAdd == (Object)null)
			{
				Plugin.globalAdd = Plugin.GO.AddComponent<GlobalAdd>();
			}
			SkillManager.cooldownTimer = 0f;
		}
	}
	public class Temp
	{
		public static Queue<Character> characters = new Queue<Character>();

		public static int autoWalk = 0;

		public static Vector3 targetPos = Vector3.zero;
	}
	public class SkillManager : MonoBehaviour
	{
		public static float cooldownTimer;

		private bool isCooldown;

		private TextMeshProUGUI? cooldownText;

		public TextMeshProUGUI? info;

		private Image? cooldownCircle;

		private float scale = 1f;

		public static PointPinger p;

		private GameObject canvasGO;

		private void Awake()
		{
			ManualLogSource? log = Plugin.Log;
			if (log != null)
			{
				log.LogInfo((object)"SkillManager Awake called");
			}
			try
			{
				CreateCooldownUI();
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)("A" + ex));
			}
		}

		private void OnDestroy()
		{
			ManualLogSource? log = Plugin.Log;
			if (log != null)
			{
				log.LogInfo((object)"SkillManager Destroy called");
			}
			Object.Destroy((Object)(object)canvasGO);
			Object.Destroy((Object)(object)info);
			Object.Destroy((Object)(object)cooldownText);
		}

		private void Update()
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: 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_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0510: Unknown result type (might be due to invalid IL or missing references)
			//IL_0515: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b6: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)Character.localCharacter == (Object)null)
			{
				return;
			}
			if (Input.GetKeyDown(ConfigManager.SkillKey) && !isCooldown)
			{
				TriggerSkill();
			}
			if (PlayerClassSelector.currentClass == PlayerClassSelector.PlayerClass.Trickster && Input.GetKeyDown((KeyCode)102))
			{
				if (Temp.characters.Count >= 1 || Character.localCharacter.data.dead)
				{
					return;
				}
				Character localCharacter = Character.localCharacter;
				if ((Object)(object)localCharacter == (Object)null)
				{
					return;
				}
				Temp.characters.Enqueue(localCharacter);
				Recorder componentInChildren = ((Component)localCharacter).GetComponentInChildren<Recorder>();
				typeof(Recorder).GetMethod("StopRecording", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.Invoke(componentInChildren, null);
				Vector3 val = Character.localCharacter.Center + Vector3.up * 1f;
				Quaternion val2 = Quaternion.LookRotation(((Component)Camera.main).transform.forward);
				Character component = PhotonNetwork.Instantiate("Character", val, val2, (byte)0, (object[])null).GetComponent<Character>();
				localCharacter.input.ResetInput();
				component.data.extraStamina = localCharacter.data.extraStamina;
				Array.Copy(localCharacter.refs.afflictions.currentStatuses, component.refs.afflictions.currentStatuses, localCharacter.refs.afflictions.currentStatuses.Length);
				component.refs.afflictions.SetStatus((STATUSTYPE)4, 0.2f, true);
				((Component)component).GetComponentInChildren<IsLookedAt>().index = ((Component)localCharacter).GetComponentInChildren<IsLookedAt>().index;
			}
			if (PlayerClassSelector.currentClass == PlayerClassSelector.PlayerClass.Trickster && Input.GetKeyDown((KeyCode)122))
			{
				while (Temp.characters.Count != 0)
				{
					Character val3 = Temp.characters.Dequeue();
					PhotonNetwork.Destroy(((Component)val3).gameObject);
				}
				Character.localCharacter.refs.afflictions.SetStatus((STATUSTYPE)4, 0f, true);
				MethodInfo method = typeof(Recorder).GetMethod("StartRecording", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				Recorder componentInChildren2 = ((Component)Character.localCharacter).GetComponentInChildren<Recorder>();
				method?.Invoke(componentInChildren2, null);
				VoiceClientHandler.LocalPlayerAssigned(componentInChildren2);
				((TMP_Text)info).text = "";
			}
			if (PlayerClassSelector.currentClass == PlayerClassSelector.PlayerClass.Trickster && Input.GetKeyDown((KeyCode)118))
			{
				if (Temp.characters.Count == 0)
				{
					return;
				}
				Character localCharacter2 = Character.localCharacter;
				Temp.characters.Enqueue(localCharacter2);
				Character val4 = Temp.characters.Dequeue();
				if ((Object)(object)val4 == (Object)null)
				{
					return;
				}
				Recorder componentInChildren3 = ((Component)localCharacter2).GetComponentInChildren<Recorder>();
				Recorder componentInChildren4 = ((Component)val4).GetComponentInChildren<Recorder>();
				MethodInfo method2 = typeof(Recorder).GetMethod("StopRecording", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				MethodInfo method3 = typeof(Recorder).GetMethod("StartRecording", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				method2?.Invoke(componentInChildren3, null);
				method3?.Invoke(componentInChildren4, null);
				Character.localCharacter = val4;
				VoiceClientHandler.LocalPlayerAssigned(((Component)val4).GetComponentInChildren<Recorder>());
				Temp.targetPos = localCharacter2.Center;
				val4.input.Init();
				val4.refs.afflictions.SetStatus((STATUSTYPE)4, 0.2f, true);
			}
			if (Input.GetKeyDown((KeyCode)107))
			{
				if (PlayerClassSelector.currentClass != PlayerClassSelector.PlayerClass.Trickster)
				{
					Character.localCharacter.refs.afflictions.SetStatus((STATUSTYPE)4, 0f, true);
				}
				Temp.autoWalk++;
				Temp.autoWalk %= 3;
				foreach (Character character in Temp.characters)
				{
					character.input.ResetInput();
				}
			}
			if (Input.GetKeyDown((KeyCode)112))
			{
				foreach (Character allCharacter in Character.AllCharacters)
				{
					Recorder componentInChildren5 = ((Component)allCharacter).GetComponentInChildren<Recorder>();
					if ((Object)(object)componentInChildren5 != (Object)null)
					{
						componentInChildren5.DebugEchoMode = !componentInChildren5.DebugEchoMode;
					}
				}
			}
			if (isCooldown)
			{
				cooldownTimer -= Time.deltaTime;
				if (cooldownTimer <= 0f)
				{
					cooldownTimer = 0f;
					isCooldown = false;
					HideCooldownUI();
				}
				UpdateCooldownVisual();
				if ((Object)(object)cooldownText != (Object)null)
				{
					((TMP_Text)cooldownText).text = cooldownTimer.ToString("F1");
				}
			}
			if (PlayerClassSelector.currentClass != PlayerClassSelector.PlayerClass.Trickster)
			{
				((TMP_Text)info).text = "";
				return;
			}
			switch (Temp.autoWalk)
			{
			case 1:
				((TMP_Text)info).text = "跟随";
				{
					foreach (Character character2 in Temp.characters)
					{
						Temp.targetPos = Character.localCharacter.Head;
						SmartWalkToLocalCharacter(character2);
					}
					break;
				}
			case 2:
				((TMP_Text)info).text = "指挥";
				if (!((Object)(object)p.pingInstance != (Object)null))
				{
					break;
				}
				Temp.targetPos = p.pingInstance.transform.position;
				{
					foreach (Character character3 in Temp.characters)
					{
						SmartWalkToLocalCharacter(character3);
					}
					break;
				}
			default:
				((TMP_Text)info).text = "";
				break;
			}
		}

		private void SmartWalkToLocalCharacter(Character c)
		{
			//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_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: 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_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)c == (Object)null))
			{
				Vector3 center = c.Center;
				float num = Vector3.Distance(center, Temp.targetPos);
				c.data.lookValues = Vector2.op_Implicit(HelperFunctions.DirectionToLook(Temp.targetPos - c.Head));
				RaycastHit val = HelperFunctions.LineCheck(c.Center, Temp.targetPos, (LayerType)1, 0f, (QueryTriggerInteraction)1);
				bool flag = (Object)(object)((RaycastHit)(ref val)).transform != (Object)null;
				float num2 = 2f;
				if (num < 1.8f)
				{
					num2 = 0f;
				}
				c.input.movementInput = new Vector2(0f, num2);
				if (flag)
				{
					c.refs.climbing.TryClimb(1.25f);
				}
				c.input.sprintIsPressed = num > 3f && !flag;
				if (Temp.autoWalk == 1)
				{
					c.data.currentStamina = 0.1f;
				}
			}
		}

		private void TriggerSkill()
		{
			Utils.UseSkill();
			isCooldown = true;
			cooldownTimer = ConfigManager.SkillCooldownDuration;
			ShowCooldownUI();
		}

		private void UpdateCooldownVisual()
		{
			if ((Object)(object)cooldownCircle != (Object)null)
			{
				if (cooldownTimer > ConfigManager.SkillCooldownDuration)
				{
					cooldownTimer = ConfigManager.SkillCooldownDuration;
				}
				cooldownCircle.fillAmount = cooldownTimer / ConfigManager.SkillCooldownDuration;
			}
		}

		private void CreateCooldownUI()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Expected O, but got Unknown
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: 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_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: Expected O, but got Unknown
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Expected O, but got Unknown
			//IL_0268: Unknown result type (might be due to invalid IL or missing references)
			//IL_026f: Unknown result type (might be due to invalid IL or missing references)
			//IL_027c: Unknown result type (might be due to invalid IL or missing references)
			//IL_029c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0318: Unknown result type (might be due to invalid IL or missing references)
			//IL_0324: Unknown result type (might be due to invalid IL or missing references)
			//IL_033a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0350: Unknown result type (might be due to invalid IL or missing references)
			canvasGO = new GameObject("SkillCooldownCanvas");
			Object.DontDestroyOnLoad((Object)(object)canvasGO);
			Canvas val = canvasGO.AddComponent<Canvas>();
			val.renderMode = (RenderMode)0;
			CanvasScaler val2 = canvasGO.AddComponent<CanvasScaler>();
			if ((Object)(object)val2 != (Object)null)
			{
				val2.uiScaleMode = (ScaleMode)1;
				val2.referenceResolution = new Vector2(1920f, 1080f);
				val2.matchWidthOrHeight = 0.5f;
			}
			canvasGO.AddComponent<GraphicRaycaster>();
			GameObject val3 = new GameObject("CooldownCircle");
			val3.transform.SetParent(canvasGO.transform, false);
			cooldownCircle = val3.AddComponent<Image>();
			UI_UseItemProgress val4 = Object.FindFirstObjectByType<UI_UseItemProgress>();
			if ((Object)(object)val4 != (Object)null)
			{
				cooldownCircle.sprite = val4.fill.sprite;
			}
			cooldownCircle.type = (Type)3;
			cooldownCircle.fillMethod = (FillMethod)4;
			cooldownCircle.fillOrigin = 2;
			cooldownCircle.fillClockwise = false;
			cooldownCircle.fillAmount = 0f;
			((Graphic)cooldownCircle).color = new Color(0.2f, 1f, 0.2f, 0.9f);
			((Behaviour)cooldownCircle).enabled = false;
			RectTransform rectTransform = ((Graphic)cooldownCircle).rectTransform;
			rectTransform.anchorMin = new Vector2(0f, 1f);
			rectTransform.anchorMax = new Vector2(0f, 1f);
			rectTransform.pivot = new Vector2(0.5f, 0.5f);
			rectTransform.anchoredPosition = new Vector2(100f, -120f);
			rectTransform.sizeDelta = new Vector2(120f, 120f);
			GameObject val5 = GameObject.Find("GAME/GUIManager");
			GUIManager component = val5.GetComponent<GUIManager>();
			TMP_FontAsset font = ((TMP_Text)component.heroDayText).font;
			GameObject val6 = new GameObject("CooldownText");
			GameObject val7 = new GameObject("info");
			val6.transform.SetParent(((Component)cooldownCircle).transform, false);
			val7.transform.SetParent(((Component)cooldownCircle).transform, false);
			cooldownText = val6.AddComponent<TextMeshProUGUI>();
			info = val7.AddComponent<TextMeshProUGUI>();
			TextMeshProUGUI? obj = cooldownText;
			TMP_FontAsset font2 = (((TMP_Text)info).font = font);
			((TMP_Text)obj).font = font2;
			TextMeshProUGUI? obj2 = cooldownText;
			TextMeshProUGUI? obj3 = info;
			TextAlignmentOptions alignment = (TextAlignmentOptions)514;
			((TMP_Text)obj3).alignment = (TextAlignmentOptions)514;
			((TMP_Text)obj2).alignment = alignment;
			((Graphic)cooldownText).color = Color.white;
			((TMP_Text)cooldownText).text = "0.0";
			((Graphic)info).color = Color.white;
			((TMP_Text)info).text = "";
			RectTransform component2 = ((Component)cooldownText).GetComponent<RectTransform>();
			component2.anchorMin = Vector2.zero;
			component2.anchorMax = Vector2.one;
			component2.pivot = new Vector2(0.5f, 0.5f);
			component2.anchoredPosition = Vector2.zero;
			component2.sizeDelta = Vector2.zero;
			RectTransform component3 = ((Component)info).GetComponent<RectTransform>();
			component3.anchorMin = Vector2.zero;
			component3.anchorMax = Vector2.one;
			component3.pivot = new Vector2(0.5f, 0.5f);
			component3.anchoredPosition = new Vector2(100f, 0f);
			((Behaviour)cooldownText).enabled = false;
		}

		private void ShowCooldownUI()
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)cooldownCircle == (Object)null))
			{
				((Behaviour)cooldownCircle).enabled = true;
				((Behaviour)cooldownText).enabled = true;
				cooldownCircle.fillAmount = 1f;
				((Component)cooldownCircle).transform.localScale = Vector3.zero;
				TweenSettingsExtensions.SetEase<TweenerCore<Vector3, Vector3, VectorOptions>>(ShortcutExtensions.DOScale(((Component)cooldownCircle).transform, 1f, 0.25f), (Ease)27);
			}
		}

		private void HideCooldownUI()
		{
			if (!((Object)(object)cooldownCircle == (Object)null))
			{
				((Behaviour)cooldownCircle).enabled = false;
				((Behaviour)cooldownText).enabled = false;
			}
		}
	}
	[HarmonyPatch(typeof(Character), "Awake")]
	public class Character_Awake_Patch
	{
		[HarmonyPrefix]
		private static void AwakePrefix(Character __instance)
		{
			if ((Object)(object)Character.localCharacter == (Object)null)
			{
				Temp.characters.Clear();
			}
		}

		[HarmonyPostfix]
		private static void AwakePostfix(Character __instance)
		{
			try
			{
				if (__instance.IsLocal)
				{
					SkillManager.p = ((Component)Character.localCharacter).GetComponentInChildren<PointPinger>();
				}
				ConfigManager.SkillCooldownDuration = PlayerClassSelector.ClassConfigs.GetConfig(PlayerClassSelector.currentClass).SkillCooldownDuration;
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)ex);
			}
		}
	}
	public class Utils
	{
		public enum STATUSTYPE
		{
			Cold,
			Hunger,
			Poison,
			Drowsy,
			Hot,
			Thorns,
			Spores
		}

		public static Dictionary<string, int> itemPool = new Dictionary<string, int>
		{
			{ "LuggageBig", 15 },
			{ "LuggageEpic", 15 },
			{ "LuggageCursed", 5 },
			{ "LuggageSmall", 30 },
			{ "BeeSwarm", 3 }
		};

		public static bool isdisplay = false;

		public static GameObject SpawnItem(string itemName, Vector3 position, Quaternion rotation)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				return PhotonNetwork.Instantiate("0_items/" + itemName, position, rotation, (byte)0, (object[])null);
			}
			catch (Exception ex)
			{
				try
				{
					ManualLogSource? log = Plugin.Log;
					if (log != null)
					{
						log.LogError((object)("生成物品时发生错误: " + ex.Message + " " + itemName));
					}
					return PhotonNetwork.Instantiate(itemName, position, rotation, (byte)0, (object[])null);
				}
				catch (Exception ex2)
				{
					ManualLogSource? log2 = Plugin.Log;
					if (log2 != null)
					{
						log2.LogError((object)("捕获到嵌套异常: " + ex2.Message + " " + itemName));
					}
				}
			}
			ManualLogSource? log3 = Plugin.Log;
			if (log3 != null)
			{
				log3.LogError((object)("无法生成物品: " + itemName));
			}
			return null;
		}

		public static void SpawnItemInHand(string itemName)
		{
			if ((Object)(object)Character.localCharacter != (Object)null && Character.localCharacter.IsLocal)
			{
				CharacterItems items = Character.localCharacter.refs.items;
				if ((Object)(object)items != (Object)null)
				{
					items.SpawnItemInHand(itemName);
					return;
				}
				ManualLogSource? log = Plugin.Log;
				if (log != null)
				{
					log.LogError((object)"CharacterItems is null, cannot spawn item in hand.");
				}
			}
			else
			{
				ManualLogSource? log2 = Plugin.Log;
				if (log2 != null)
				{
					log2.LogError((object)"Local character is null or not local, cannot spawn item in hand.");
				}
			}
		}

		public static void AddNegativeEffect(STATUSTYPE statusType, float value)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Character.localCharacter.refs.afflictions.AddStatus(statusType, value, false, true);
			}
			catch (Exception ex)
			{
				ManualLogSource? log = Plugin.Log;
				if (log != null)
				{
					log.LogError((object)("添加负面效果时发生错误: " + ex.Message));
				}
			}
		}

		public static void AddRandomNegativeEffect()
		{
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			int length = Enum.GetValues(typeof(STATUSTYPE)).Length;
			string text = ((STATUSTYPE)Random.Range(0, length)).ToString();
			float value = Random.Range(0.1f, 0.2f);
			if (text == "Hunger")
			{
				value = Random.Range(0.05f, 0.1f);
			}
			AddNegativeEffect((STATUSTYPE)Enum.Parse(typeof(STATUSTYPE), text), value);
		}

		public static string GetRandomItemFromPool(Dictionary<string, int> itemPool)
		{
			int num = 0;
			foreach (KeyValuePair<string, int> item in itemPool)
			{
				num += item.Value;
			}
			int num2 = Random.Range(0, num);
			foreach (KeyValuePair<string, int> item2 in itemPool)
			{
				if (num2 < item2.Value)
				{
					return item2.Key;
				}
				num2 -= item2.Value;
			}
			return "";
		}

		public static void WarpPlayerForward()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: 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_0039: 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_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)Character.localCharacter != (Object)null && Character.localCharacter.IsLocal)
			{
				Vector3 forward = ((Component)Camera.main).transform.forward;
				Vector3 val = Character.localCharacter.Center + forward * 6f;
				Character.localCharacter.WarpPlayer(val, false);
				return;
			}
			ManualLogSource? log = Plugin.Log;
			if (log != null)
			{
				log.LogError((object)"无法跃进,角色无效或不是本地角色。");
			}
		}

		public static void SpawnMoraleBoost(float baselineStamina)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			MoraleBoost.SpawnMoraleBoost(Character.localCharacter.Center, 100f, baselineStamina, 0.05f, true, 1);
			try
			{
				Campfire val = Object.FindFirstObjectByType<Campfire>();
				for (int i = 0; i < val.moraleBoost.Length; i++)
				{
					val.moraleBoost[i].Play(Character.localCharacter.Center);
				}
				val.loop.volume = Mathf.Lerp(val.loop.volume, 0.5f, Time.deltaTime * 5f);
			}
			catch (Exception ex)
			{
				ManualLogSource? log = Plugin.Log;
				if (log != null)
				{
					log.LogError((object)(ex.Message ?? ""));
				}
			}
		}

		public static void UseSkill()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: 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_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//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_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			if (PlayerClassSelector.currentClass == PlayerClassSelector.PlayerClass.Normal)
			{
				return;
			}
			if (PlayerClassSelector.currentClass == PlayerClassSelector.PlayerClass.Gambler)
			{
				string randomItemFromPool = GetRandomItemFromPool(itemPool);
				Vector3 forward = ((Component)Camera.main).transform.forward;
				Quaternion rotation = Quaternion.LookRotation(forward);
				GameObject val = SpawnItem(randomItemFromPool, Character.localCharacter.Center + forward * 1f, rotation);
				AddRandomNegativeEffect();
			}
			else if (PlayerClassSelector.currentClass == PlayerClassSelector.PlayerClass.Teleporter)
			{
				WarpPlayerForward();
				AddNegativeEffect((STATUSTYPE)8, 0.05f);
			}
			else if (PlayerClassSelector.currentClass == PlayerClassSelector.PlayerClass.Revyn)
			{
				if (Character.localCharacter.data.dead)
				{
					return;
				}
				if (Character.localCharacter.data.passedOut)
				{
					Character.localCharacter.refs.afflictions.ClearAllStatus(true);
					AddNegativeEffect((STATUSTYPE)5, 0.05f);
					ConfigManager.MaxStaminaBarCoefficient -= 0.05f;
					return;
				}
				foreach (Character allCharacter in Character.AllCharacters)
				{
					if (allCharacter.data.dead || allCharacter.data.passedOut)
					{
						((MonoBehaviourPun)allCharacter).photonView.RPC("RPCA_ReviveAtPosition", (RpcTarget)0, new object[2]
						{
							Character.localCharacter.Head + Vector3.up * 3f,
							true
						});
					}
				}
				AddNegativeEffect((STATUSTYPE)5, 0.05f);
				ConfigManager.MaxStaminaBarCoefficient -= 0.05f;
			}
			else if (ConfigManager.SpawnItemName != "")
			{
				SpawnItemInHand(ConfigManager.SpawnItemName);
			}
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}