Decompiled source of Silver v1.0.0

plugins/com.github.fengsheng404.Silver.dll

Decompiled 2 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
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 ExitGames.Client.Photon;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using Photon.Realtime;
using Silver.Abilities;
using Silver.Components;
using Silver.Data;
using Silver.UI;
using Silver.Utils;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
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.fengsheng404.Silver")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+e6421c113961d5b2a5ac0f4c37ed53bbd8d8462f")]
[assembly: AssemblyProduct("com.github.fengsheng404.Silver")]
[assembly: AssemblyTitle("Silver")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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]
	[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]
	[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 Silver
{
	public static class ClassManager
	{
		public static float LiveCooldown;

		public static int LiveUses;

		public static float? SavedCooldown;

		public static int? SavedUses;

		public static ClassType CurrentClass { get; set; }

		public static ClassType SavedClass { get; set; }

		public static bool IsInitializedAbility { get; set; }

		public static bool HasClass()
		{
			return CurrentClass != ClassType.None;
		}

		public static bool IsExplorer()
		{
			return CurrentClass == ClassType.Explorer;
		}

		public static bool IsLeader()
		{
			return CurrentClass == ClassType.Leader;
		}

		public static bool IsLogistician()
		{
			return CurrentClass == ClassType.Logistician;
		}

		public static bool IsCook()
		{
			return CurrentClass == ClassType.Cook;
		}

		public static bool IsDoctor()
		{
			return CurrentClass == ClassType.Doctor;
		}

		public static bool HasSavedClass()
		{
			return SavedClass != ClassType.None;
		}

		public static ClassType GetClass(Character character)
		{
			if ((Object)(object)character == (Object)null)
			{
				return ClassType.None;
			}
			PhotonView component = ((Component)character).GetComponent<PhotonView>();
			if ((Object)(object)component != (Object)null && component.Owner != null && ((Dictionary<object, object>)(object)component.Owner.CustomProperties).TryGetValue((object)"PlayerClass", out object value))
			{
				return (ClassType)(int)value;
			}
			return ClassType.None;
		}

		public static bool HasLeaderInRoom()
		{
			Player[] playerList = PhotonNetwork.PlayerList;
			foreach (Player val in playerList)
			{
				if (((Dictionary<object, object>)(object)val.CustomProperties).TryGetValue((object)"PlayerClass", out object value))
				{
					Plugin.Log.LogInfo((object)$"检测到玩家: {val.NickName}职业为:{value}");
					if ((int)value == 2)
					{
						Plugin.Log.LogInfo((object)("检测到领袖: " + val.NickName));
						return true;
					}
				}
			}
			Plugin.Log.LogInfo((object)"[ClassManage] 房间内没有领袖职业玩家");
			return false;
		}

		public static void SaveLiveStats()
		{
			if (CurrentClass == ClassType.None)
			{
				Plugin.Log.LogInfo((object)"[ClassManage] 当前没有职业,无需保存");
				return;
			}
			SavedClass = CurrentClass;
			SavedCooldown = LiveCooldown;
			SavedUses = LiveUses;
			Plugin.Log.LogInfo((object)$"[ClassManage] 已保存职业:{CurrentClass}状态");
		}

		public static void ClearCache()
		{
			SavedClass = ClassType.None;
			SavedCooldown = null;
			SavedUses = null;
			IsInitializedAbility = false;
		}

		public static void SetClass(ClassType newClass)
		{
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Expected O, but got Unknown
			Character localCharacter = Character.localCharacter;
			if (!((Object)(object)localCharacter == (Object)null) && !localCharacter.inAirport)
			{
				IAbility component = ((Component)localCharacter).GetComponent<IAbility>();
				MonoBehaviour val = (MonoBehaviour)((component is MonoBehaviour) ? component : null);
				if ((Object)(object)val != (Object)null)
				{
					Object.Destroy((Object)(object)val);
					Plugin.Log.LogInfo((object)$"[ClassManage] 已移除旧职业:{CurrentClass}能力");
				}
				ClearClassComponents(localCharacter);
				CurrentClass = newClass;
				Plugin.Log.LogInfo((object)$"[ClassManage] 已添加职业:{CurrentClass}能力");
				if (ClassRepository.ClassDefinitions.TryGetValue(newClass, out ClassDefinition value))
				{
					((Component)localCharacter).gameObject.AddComponent(value.ActiveAbility);
				}
				AttachClassComponents(localCharacter, newClass);
				((MonoBehaviour)localCharacter).StartCoroutine(UpdateHUDNextFrame());
				Hashtable val2 = new Hashtable();
				val2[(object)"PlayerClass"] = (int)newClass;
				PhotonNetwork.LocalPlayer.SetCustomProperties(val2, (Hashtable)null, (WebFlags)null);
			}
		}

		private static IEnumerator UpdateHUDNextFrame()
		{
			yield return null;
			SkillHUD.Instance.Show();
		}

		public static void ClearClass()
		{
			CurrentClass = ClassType.None;
			SkillHUD.Instance.Hide();
			Character localCharacter = Character.localCharacter;
			if (!((Object)(object)localCharacter == (Object)null))
			{
				IAbility component = ((Component)localCharacter).GetComponent<IAbility>();
				MonoBehaviour val = (MonoBehaviour)((component is MonoBehaviour) ? component : null);
				if ((Object)(object)val != (Object)null)
				{
					Object.Destroy((Object)(object)val);
					Plugin.Log.LogInfo((object)"[ClassManage] 已移除旧职业能力");
				}
				ClearClassComponents(localCharacter);
			}
		}

		private static void AttachClassComponents(Character localCharacter, ClassType newClass)
		{
			if (newClass == ClassType.Doctor && (Object)(object)((Component)localCharacter).GetComponent<DoctorPoisonReduceComponent>() == (Object)null)
			{
				((Component)localCharacter).gameObject.AddComponent<DoctorPoisonReduceComponent>();
				Plugin.Log.LogInfo((object)"[ClassManage] 已挂载医生毒性熟悉组件");
			}
		}

		private static void ClearClassComponents(Character localCharacter)
		{
			DoctorPoisonReduceComponent component = ((Component)localCharacter).GetComponent<DoctorPoisonReduceComponent>();
			if ((Object)(object)component != (Object)null)
			{
				Object.Destroy((Object)(object)component);
				Plugin.Log.LogInfo((object)"[ClassManage] 已销毁医生毒性熟悉组件");
			}
		}
	}
	public static class Config
	{
		public class ExplorerConfig
		{
			public ConfigEntry<float> DamageMultiplier { get; private set; }

			public ConfigEntry<float> HungerMultiplier { get; private set; }

			public ConfigEntry<float> HealChance { get; private set; }

			public ConfigEntry<float> HealAmount { get; private set; }

			public ConfigEntry<float> PitonChance { get; private set; }

			public ConfigEntry<float> MaxCooldown { get; private set; }

			public ConfigEntry<int> MaxUses { get; private set; }

			public void Initialize(ConfigFile config)
			{
				DamageMultiplier = config.Bind<float>("Explorer", "DamageMultiplier", 0.5f, "开路者受伤倍率 (0.5 = 受伤 50%)");
				HungerMultiplier = config.Bind<float>("Explorer", "HungerMultiplier", 1.15f, "开路者饥饿增加倍率 (1.15 = 加快 15%)");
				HealChance = config.Bind<float>("Explorer", "HealChance", 0.5f, "开路者进食回血概率 (0.5 = 50%)");
				HealAmount = config.Bind<float>("Explorer", "HealAmount", 0.05f, "开路者进食回血数值(0.05 = 5滴血)");
				PitonChance = config.Bind<float>("Explorer", "PitonChance", 0.9f, "开路者之钉获取岩钉概率 (0.9 = 90%)");
				MaxCooldown = config.Bind<float>("Explorer", "MaxCooldown", 120f, "开路者技能最大冷却时间(120 = 120秒)");
				MaxUses = config.Bind<int>("Explorer", "MaxUses", 2, "开路者技能最大使用次数(2 = 2次)");
			}
		}

		public class LeaderConfig
		{
			public ConfigEntry<float> InitCurseAmount { get; private set; }

			public ConfigEntry<float> ReduceCurseAmount { get; private set; }

			public ConfigEntry<float> InspireRadius { get; private set; }

			public ConfigEntry<float> InspireHealAmount { get; private set; }

			public ConfigEntry<float> InspireHungerAmount { get; private set; }

			public ConfigEntry<float> InspireExtraStaminaAmount { get; private set; }

			public ConfigEntry<float> MaxCooldown { get; private set; }

			public ConfigEntry<int> MaxUses { get; private set; }

			public void Initialize(ConfigFile config)
			{
				InitCurseAmount = config.Bind<float>("Leader", "InitCurseAmount", 0.15f, "领袖初始受诅咒量倍率(0.15 = 15)");
				ReduceCurseAmount = config.Bind<float>("Leader", "ReduceCurseAmount", 0.025f, "领袖每次减少诅咒量(0.025 = 2.5)");
				InspireRadius = config.Bind<float>("Leader", "InspireRadius", 50f, "领袖鼓舞半径(50 = 50米)");
				InspireHealAmount = config.Bind<float>("Leader", "InspireHealAmount", 0.05f, "领袖鼓舞回血数值(0.05 = 5滴血)");
				InspireHungerAmount = config.Bind<float>("Leader", "InspireHungerAmount", 0.1f, "领袖鼓舞恢复饱食度数值(0.1 = 10)");
				InspireExtraStaminaAmount = config.Bind<float>("Leader", "InspireExtraStaminaAmount", 0.15f, "领袖鼓舞额外体力(0.15 = 15体力)");
				MaxCooldown = config.Bind<float>("Leader", "MaxCooldown", 300f, "领袖技能最大冷却时间(300 = 300秒)");
				MaxUses = config.Bind<int>("Leader", "MaxUses", 3, "领袖技能最大使用次数(3 = 3次)");
			}
		}

		public class LogisticianConfig
		{
			public ConfigEntry<float> WeightReduction { get; private set; }

			public ConfigEntry<float> StaminaMultiplier { get; private set; }

			public ConfigEntry<float> MaxCooldown { get; private set; }

			public ConfigEntry<int> MaxUses { get; private set; }

			public void Initialize(ConfigFile config)
			{
				WeightReduction = config.Bind<float>("Logistician", "WeightReduction", 1f, "后勤物资精简减少的负重值(1.0 = 2.5单位)");
				StaminaMultiplier = config.Bind<float>("Logistician", "StaminaMultiplier", 1.1f, "后勤积损体力消耗增加倍率(1.10 = 增加 10%)");
				MaxCooldown = config.Bind<float>("Logistician", "MaxCooldown", 300f, "后勤技能最大冷却时间(300 = 300秒)");
				MaxUses = config.Bind<int>("Logistician", "MaxUses", 3, "后勤技能最大使用次数(3 = 3次)");
			}
		}

		public class CookConfig
		{
			public ConfigEntry<float> FoodBonus { get; private set; }

			public ConfigEntry<float> CookExtraStaminaAmount { get; private set; }

			public ConfigEntry<float> CookExtraStaminaRadius { get; private set; }

			public ConfigEntry<float> RawFoodPenalty { get; private set; }

			public ConfigEntry<float> MaxCooldown { get; private set; }

			public ConfigEntry<int> MaxUses { get; private set; }

			public void Initialize(ConfigFile config)
			{
				FoodBonus = config.Bind<float>("Cook", "FoodBonus", 1.5f, "厨师精湛厨艺额外恢复饱食度倍率(1.5 = 50%)");
				CookExtraStaminaAmount = config.Bind<float>("Cook", "ExtraStaminaAmount", 0.05f, "厨师诱人香味提供额外体力(0.05 = 5体力)");
				CookExtraStaminaRadius = config.Bind<float>("Cook", "ExtraStaminaRadius", 25f, "厨师诱人香味提供额外体力半径(25 = 25米)");
				RawFoodPenalty = config.Bind<float>("Cook", "RawFoodPenalty", 0.5f, "厨师熟食癖吃生食物恢复饱食度倍率(0.5 = 50%)");
				MaxCooldown = config.Bind<float>("Cook", "MaxCooldown", 60f, "厨师技能最大冷却时间(60 = 60秒)");
				MaxUses = config.Bind<int>("Cook", "MaxUses", 5, "厨师技能最大使用次数(5 = 5次)");
			}
		}

		public class DoctorConfig
		{
			public ConfigEntry<float> PoisonReduceAlly { get; private set; }

			public ConfigEntry<float> PoisonReduceRadius { get; private set; }

			public ConfigEntry<float> BandageMultiplier { get; private set; }

			public ConfigEntry<float> EmpathyDamage { get; private set; }

			public ConfigEntry<float> MaxCooldown { get; private set; }

			public ConfigEntry<int> MaxUses { get; private set; }

			public void Initialize(ConfigFile config)
			{
				PoisonReduceAlly = config.Bind<float>("Doctor", "PoisonReduceAlly", 0.025f, "医生每三秒减少周围友军中毒和孢子值(0.025 = 2.5)");
				PoisonReduceRadius = config.Bind<float>("Doctor", "PoisonReduceRadius", 5f, "医生每三秒减少周围友军中毒和孢子半径(5 = 5米)");
				BandageMultiplier = config.Bind<float>("Doctor", "BandageMultiplier", 2f, "医生医疗精通损伤恢复倍率(2.0 = 恢复量翻倍,即+100%)");
				EmpathyDamage = config.Bind<float>("Doctor", "EmpathyDamage", 0.1f, "医生共情队友死亡时受到损伤(0.1 = 10损伤)");
				MaxCooldown = config.Bind<float>("Doctor", "MaxCooldown", 120f, "医生技能最大冷却时间(120 = 120秒)");
				MaxUses = config.Bind<int>("Doctor", "MaxUses", 3, "医生技能最大使用次数(3 = 3次)");
			}
		}

		public class HotKeyConfig
		{
			public ConfigEntry<KeyCode> AbilityHotkey { get; private set; }

			public ConfigEntry<KeyCode> SkillInfoHotkey { get; private set; }

			public void Initialize(ConfigFile config)
			{
				AbilityHotkey = config.Bind<KeyCode>("Ability", "AbilityHotkey", (KeyCode)102, "释放技能的按键");
				SkillInfoHotkey = config.Bind<KeyCode>("Ability", "SkillInfoHotkey", (KeyCode)120, "显示技能信息界面的按键");
			}
		}

		public class DebugConfig
		{
			public ConfigEntry<bool> CanDebug { get; private set; }

			public void Initialize(ConfigFile config)
			{
				CanDebug = config.Bind<bool>("Debug", "CanDebug", false, "是否可以调试");
			}
		}

		public static ExplorerConfig Explorer { get; private set; } = new ExplorerConfig();

		public static LeaderConfig Leader { get; private set; } = new LeaderConfig();

		public static LogisticianConfig Logistician { get; private set; } = new LogisticianConfig();

		public static CookConfig Cook { get; private set; } = new CookConfig();

		public static DoctorConfig Doctor { get; private set; } = new DoctorConfig();

		public static HotKeyConfig HotKey { get; private set; } = new HotKeyConfig();

		public static DebugConfig Debug { get; private set; } = new DebugConfig();

		public static void Initialize(ConfigFile config)
		{
			Explorer.Initialize(config);
			Leader.Initialize(config);
			Logistician.Initialize(config);
			Cook.Initialize(config);
			Doctor.Initialize(config);
			HotKey.Initialize(config);
			Debug.Initialize(config);
		}
	}
	public static class ClassRepository
	{
		public static readonly Dictionary<ClassType, ClassDefinition> ClassDefinitions = new Dictionary<ClassType, ClassDefinition>
		{
			{
				ClassType.Explorer,
				new ClassDefinition
				{
					ClassType = ClassType.Explorer,
					DisplayName = "开路者",
					Abilities = new List<AbilityInfo>
					{
						new AbilityInfo
						{
							Type = "主动",
							Name = "开路者之钉",
							Description = $"{Config.Explorer.PitonChance.Value * 100f:F0}% 概率获得一个岩钉,{100f - Config.Explorer.PitonChance.Value * 100f:F0}% 概率获得一个反重力炮。每关限用 {Config.Explorer.MaxUses.Value},冷却 {Config.Explorer.MaxCooldown.Value / 60f:F0} 分钟。"
						},
						new AbilityInfo
						{
							Type = "被动",
							Name = "强健体魄",
							Description = $"受到的损伤、炎热、寒冷固定减少 {(1f - Config.Explorer.DamageMultiplier.Value) * 100f:F0}%。"
						},
						new AbilityInfo
						{
							Type = "被动",
							Name = "不屈",
							Description = $"进食食物时,有 {Config.Explorer.HealChance.Value * 100f:F0}% 的概率恢复 {Config.Explorer.HealAmount.Value * 100f:F0} 点损伤值。"
						},
						new AbilityInfo
						{
							Type = "负面",
							Name = "高代谢",
							Description = $"饥饿度的自然消耗速度加快 {(Config.Explorer.HungerMultiplier.Value - 1f) * 100f:F0}%。"
						}
					},
					ActiveAbility = typeof(ExplorerAbility)
				}
			},
			{
				ClassType.Leader,
				new ClassDefinition
				{
					ClassType = ClassType.Leader,
					DisplayName = "领袖",
					Abilities = new List<AbilityInfo>
					{
						new AbilityInfo
						{
							Type = "主动",
							Name = "领袖号召",
							Description = $"释放光环。增加附近 {Config.Leader.InspireRadius.Value} 米内的队友 {Config.Leader.InspireExtraStaminaAmount.Value * 100f:F0} 点额外体力,治疗其 {Config.Leader.InspireHealAmount.Value * 100f:F0} 点损伤,恢复 {Config.Leader.InspireHungerAmount.Value * 100f:F0} 点饱食度。每关 {Config.Leader.MaxUses.Value} 次,冷却 {Config.Leader.MaxCooldown.Value / 60f:F0} 分钟。"
						},
						new AbilityInfo
						{
							Type = "被动",
							Name = "神启",
							Description = "使用复活雕像时,如果全员存活,生成一个额外的神秘物品。"
						},
						new AbilityInfo
						{
							Type = "被动",
							Name = "圣洁",
							Description = $"使用复活雕像时,队伍中每存活一个人,消除 {Config.Leader.ReduceCurseAmount.Value * 100f:F1} 点诅咒。"
						},
						new AbilityInfo
						{
							Type = "负面",
							Name = "宿命",
							Description = $"角色天生携带 {Config.Leader.InitCurseAmount.Value * 100f:F0} 点诅咒值。"
						}
					},
					ActiveAbility = typeof(LeaderAbility)
				}
			},
			{
				ClassType.Logistician,
				new ClassDefinition
				{
					ClassType = ClassType.Logistician,
					DisplayName = "后勤",
					Abilities = new List<AbilityInfo>
					{
						new AbilityInfo
						{
							Type = "主动",
							Name = "紧急空投",
							Description = $"随机获得一件道具。每关 {Config.Logistician.MaxUses.Value} 次,冷却 {Config.Logistician.MaxCooldown.Value / 60f:F0} 分钟。"
						},
						new AbilityInfo
						{
							Type = "被动",
							Name = "物资精简",
							Description = $"个人背包中每件物品的负重值固定减少 {Config.Logistician.WeightReduction.Value:F0} 单位。"
						},
						new AbilityInfo
						{
							Type = "被动",
							Name = "备战充分",
							Description = "游戏开始时,初始物品栏自动拥有一个气球簇和一个背包。"
						},
						new AbilityInfo
						{
							Type = "负面",
							Name = "积损",
							Description = $"体力消耗速度增加 {(Config.Logistician.StaminaMultiplier.Value - 1f) * 100f:F0}%。"
						}
					},
					ActiveAbility = typeof(LogisticianAbility)
				}
			},
			{
				ClassType.Cook,
				new ClassDefinition
				{
					ClassType = ClassType.Cook,
					DisplayName = "厨师",
					Abilities = new List<AbilityInfo>
					{
						new AbilityInfo
						{
							Type = "主动",
							Name = "便携厨房",
							Description = $"获得一个便携火炉。每关 {Config.Cook.MaxUses.Value} 次,冷却 {Config.Cook.MaxCooldown.Value / 60f:F0} 分钟。"
						},
						new AbilityInfo
						{
							Type = "被动",
							Name = "精湛厨艺",
							Description = $"由你烹饪的食物额外恢复 {(Config.Cook.FoodBonus.Value - 1f) * 100f:F0}% 饱食度。"
						},
						new AbilityInfo
						{
							Type = "被动",
							Name = "诱人香味",
							Description = $"烹饪食物时,为附近 {Config.Cook.CookExtraStaminaRadius.Value} 米内的友军提供 {Config.Cook.CookExtraStaminaAmount.Value * 100f:F0} 点额外体力。"
						},
						new AbilityInfo
						{
							Type = "负面",
							Name = "熟食癖",
							Description = $"吃生食物恢复的饱食度降低 {(1f - Config.Cook.RawFoodPenalty.Value) * 100f:F0}%。"
						}
					},
					ActiveAbility = typeof(CookAbility)
				}
			},
			{
				ClassType.Doctor,
				new ClassDefinition
				{
					ClassType = ClassType.Doctor,
					DisplayName = "医生",
					Abilities = new List<AbilityInfo>
					{
						new AbilityInfo
						{
							Type = "主动",
							Name = "随身医疗箱",
							Description = $"获得一个绷带。每关 {Config.Doctor.MaxUses.Value} 次,冷却 {Config.Doctor.MaxCooldown.Value / 60f:F0} 分钟。"
						},
						new AbilityInfo
						{
							Type = "被动",
							Name = "毒性熟悉",
							Description = $"每隔三秒,减少周围 {Config.Doctor.PoisonReduceRadius.Value} 米内的所有友军 {Config.Doctor.PoisonReduceAlly.Value * 100f} 点中毒和孢子。自身双倍。"
						},
						new AbilityInfo
						{
							Type = "被动",
							Name = "医疗精通",
							Description = $"使用治疗物品时,损伤恢复效果提升 {(Config.Doctor.BandageMultiplier.Value - 1f) * 100f:F0}%。"
						},
						new AbilityInfo
						{
							Type = "负面",
							Name = "共情",
							Description = $"队友死亡时,你受到 {Config.Doctor.EmpathyDamage.Value * 100f:F0} 点损伤。"
						}
					},
					ActiveAbility = typeof(DoctorAbility)
				}
			}
		};
	}
	public static class DebugActionRepository
	{
		private static bool _isInfiniteStamina = false;

		public static readonly Dictionary<DebugCategory, List<DebugActionInfo>> DebugActions = new Dictionary<DebugCategory, List<DebugActionInfo>>
		{
			[DebugCategory.Class] = new List<DebugActionInfo>
			{
				new DebugActionInfo
				{
					DisplayName = "开路者",
					Action = delegate
					{
						ClassManager.SetClass(ClassType.Explorer);
					}
				},
				new DebugActionInfo
				{
					DisplayName = "领袖",
					Action = delegate
					{
						ClassManager.SetClass(ClassType.Leader);
					}
				},
				new DebugActionInfo
				{
					DisplayName = "后勤",
					Action = delegate
					{
						ClassManager.SetClass(ClassType.Logistician);
					}
				},
				new DebugActionInfo
				{
					DisplayName = "厨师",
					Action = delegate
					{
						ClassManager.SetClass(ClassType.Cook);
					}
				},
				new DebugActionInfo
				{
					DisplayName = "医生",
					Action = delegate
					{
						ClassManager.SetClass(ClassType.Doctor);
					}
				},
				new DebugActionInfo
				{
					DisplayName = "取消职业",
					Action = delegate
					{
						ClassManager.SetClass(ClassType.None);
					}
				}
			},
			[DebugCategory.Item] = new List<DebugActionInfo>
			{
				new DebugActionInfo
				{
					DisplayName = "随机道具",
					Hotkey = (KeyCode)114,
					Action = delegate
					{
						string randomItemByWeight = ItemUtil.GetRandomItemByWeight();
						ItemUtil.SpawnItemInHand(randomItemByWeight);
						Plugin.Log.LogInfo((object)("[Debug] 基于权重抽取到了道具 " + randomItemByWeight));
					}
				},
				new DebugActionInfo
				{
					DisplayName = "随机新道具",
					Hotkey = (KeyCode)110,
					IsVisible = false,
					Action = delegate
					{
						string randomItemByType = ItemUtil.GetRandomItemByType(ItemType.Gem);
						ItemUtil.SpawnItemInHand(randomItemByType);
						Plugin.Log.LogInfo((object)("[Debug] 抽取到了新道具 " + randomItemByType));
					}
				},
				new DebugActionInfo
				{
					DisplayName = "信号弹",
					Action = delegate
					{
						ItemUtil.SpawnItemInHand("Flare");
					}
				},
				new DebugActionInfo
				{
					DisplayName = "自动降落伞",
					Action = delegate
					{
						ItemUtil.SpawnItemInHand("Parachute");
					}
				},
				new DebugActionInfo
				{
					DisplayName = "滑翔翼",
					Action = delegate
					{
						ItemUtil.SpawnItemInHand("Glider");
					}
				},
				new DebugActionInfo
				{
					DisplayName = "小丑背包",
					Action = delegate
					{
						ItemUtil.SpawnItemInHand("Fannypack");
					}
				},
				new DebugActionInfo
				{
					DisplayName = "火箭背包",
					Action = delegate
					{
						ItemUtil.SpawnItemInHand("Rocketpack");
					}
				},
				new DebugActionInfo
				{
					DisplayName = "喷气背包",
					Action = delegate
					{
						ItemUtil.SpawnItemInHand("Jetpack");
					}
				},
				new DebugActionInfo
				{
					DisplayName = "背包",
					Action = delegate
					{
						ItemUtil.SpawnItemInHand("Backpack");
					}
				},
				new DebugActionInfo
				{
					DisplayName = "骨之书",
					Action = delegate
					{
						ItemUtil.SpawnItemInHand("BookOfBones");
					}
				},
				new DebugActionInfo
				{
					DisplayName = "潘多拉魔盒",
					Action = delegate
					{
						ItemUtil.SpawnItemInHand("PandorasBox");
					}
				},
				new DebugActionInfo
				{
					DisplayName = "仙子提灯",
					Action = delegate
					{
						ItemUtil.SpawnItemInHand("Lantern_Faerie");
					}
				},
				new DebugActionInfo
				{
					DisplayName = "友谊喇叭",
					Action = delegate
					{
						ItemUtil.SpawnItemInHand("Bugle_Magic");
					}
				},
				new DebugActionInfo
				{
					DisplayName = "万灵药",
					Action = delegate
					{
						ItemUtil.SpawnItemInHand("Cure-All");
					}
				},
				new DebugActionInfo
				{
					DisplayName = "童军领队的喇叭",
					Action = delegate
					{
						ItemUtil.SpawnItemInHand("Bugle_Scoutmaster Variant");
					}
				},
				new DebugActionInfo
				{
					DisplayName = "反重力绳索",
					Action = delegate
					{
						ItemUtil.SpawnItemInHand("Anti-Rope Spool");
					}
				},
				new DebugActionInfo
				{
					DisplayName = "反重力绳索炮",
					Action = delegate
					{
						ItemUtil.SpawnItemInHand("RopeShooterAnti");
					}
				},
				new DebugActionInfo
				{
					DisplayName = "仪式匕首",
					Action = delegate
					{
						ItemUtil.SpawnItemInHand("RitualDagger");
					}
				},
				new DebugActionInfo
				{
					DisplayName = "反重力炮",
					Action = delegate
					{
						ItemUtil.SpawnItemInHand("AntiZooka");
					}
				},
				new DebugActionInfo
				{
					DisplayName = "诅咒头骨",
					Action = delegate
					{
						ItemUtil.SpawnItemInHand("Cursed Skull");
					}
				},
				new DebugActionInfo
				{
					DisplayName = "童军雕像",
					Action = delegate
					{
						ItemUtil.SpawnItemInHand("ScoutEffigy");
					}
				},
				new DebugActionInfo
				{
					DisplayName = "古老玩偶",
					Action = delegate
					{
						ItemUtil.SpawnItemInHand("ancientIdol");
					}
				},
				new DebugActionInfo
				{
					DisplayName = "童军的盛情",
					Action = delegate
					{
						ItemUtil.SpawnItemInHand("Amulet_Clone");
					}
				},
				new DebugActionInfo
				{
					DisplayName = "童军的毅力",
					Action = delegate
					{
						ItemUtil.SpawnItemInHand("Amulet_Healing");
					}
				},
				new DebugActionInfo
				{
					DisplayName = "童军的野心",
					Action = delegate
					{
						ItemUtil.SpawnItemInHand("Amulet_InfiniteStamina");
					}
				},
				new DebugActionInfo
				{
					DisplayName = "童军的进取",
					Action = delegate
					{
						ItemUtil.SpawnItemInHand("Amulet_SuperJump");
					}
				},
				new DebugActionInfo
				{
					DisplayName = "童军的荣耀",
					Action = delegate
					{
						ItemUtil.SpawnItemInHand("ScoutsHonor");
					}
				},
				new DebugActionInfo
				{
					DisplayName = "无限抓钩",
					Action = delegate
					{
						ItemUtil.SpawnItemInHand("RescueHook_Infinite");
					}
				},
				new DebugActionInfo
				{
					DisplayName = "曲迁罗盘",
					Action = delegate
					{
						ItemUtil.SpawnItemInHand("Warp Compass");
					}
				},
				new DebugActionInfo
				{
					DisplayName = "作弊罗盘(雾沼)",
					Action = delegate
					{
						ItemUtil.SpawnItemInHand("Cheat Compass");
					}
				},
				new DebugActionInfo
				{
					DisplayName = "作弊罗盘(城堡)",
					Action = delegate
					{
						ItemUtil.SpawnItemInHand("Cheat Compass 1");
					}
				},
				new DebugActionInfo
				{
					DisplayName = "护照",
					Action = delegate
					{
						ItemUtil.SpawnItemInHand("Passport");
					}
				}
			},
			[DebugCategory.Status] = new List<DebugActionInfo>
			{
				new DebugActionInfo
				{
					DisplayName = "增加受伤",
					Action = delegate
					{
						CharacterAfflictions.AddInjury();
					}
				},
				new DebugActionInfo
				{
					DisplayName = "增加饥饿",
					Action = delegate
					{
						CharacterAfflictions.AddHunger();
					}
				},
				new DebugActionInfo
				{
					DisplayName = "增加诅咒",
					Action = delegate
					{
						CharacterAfflictions.AddCurse();
					}
				},
				new DebugActionInfo
				{
					DisplayName = "增加中毒",
					Action = delegate
					{
						CharacterAfflictions.AddPoison();
					}
				},
				new DebugActionInfo
				{
					DisplayName = "增加孢子",
					Action = delegate
					{
						CharacterAfflictions.AddSpores();
					}
				},
				new DebugActionInfo
				{
					DisplayName = "增加困倦",
					Action = delegate
					{
						CharacterAfflictions.AddDrowsy();
					}
				},
				new DebugActionInfo
				{
					DisplayName = "增加寒冷",
					Action = delegate
					{
						CharacterAfflictions.AddCold();
					}
				},
				new DebugActionInfo
				{
					DisplayName = "增加炎热",
					Action = delegate
					{
						CharacterAfflictions.AddHot();
					}
				},
				new DebugActionInfo
				{
					DisplayName = "增加石化",
					Action = delegate
					{
						CharacterAfflictions.AddPetrify();
					}
				},
				new DebugActionInfo
				{
					DisplayName = "增加刺伤",
					Action = delegate
					{
						CharacterAfflictions.GetThorned();
					}
				},
				new DebugActionInfo
				{
					DisplayName = "增加箭伤",
					Action = delegate
					{
						CharacterAfflictions.GetArrowed();
					}
				},
				new DebugActionInfo
				{
					DisplayName = "清除受伤",
					Action = delegate
					{
						CharacterAfflictions.ClearInjury();
					}
				},
				new DebugActionInfo
				{
					DisplayName = "清除饥饿",
					Action = delegate
					{
						CharacterAfflictions.ClearHunger();
					}
				},
				new DebugActionInfo
				{
					DisplayName = "清除诅咒",
					Action = delegate
					{
						CharacterAfflictions.ClearCurse();
					}
				},
				new DebugActionInfo
				{
					DisplayName = "清除中毒",
					Action = delegate
					{
						CharacterAfflictions.ClearPoison();
					}
				},
				new DebugActionInfo
				{
					DisplayName = "清除困倦",
					Action = delegate
					{
						CharacterAfflictions.ClearDrowsy();
					}
				},
				new DebugActionInfo
				{
					DisplayName = "清除寒冷",
					Action = delegate
					{
						CharacterAfflictions.ClearCold();
					}
				},
				new DebugActionInfo
				{
					DisplayName = "清除炎热",
					Action = delegate
					{
						CharacterAfflictions.ClearHot();
					}
				},
				new DebugActionInfo
				{
					DisplayName = "清除孢子",
					Action = delegate
					{
						Character.localCharacter.refs.afflictions.SetStatus((STATUSTYPE)10, 0f, true);
					}
				},
				new DebugActionInfo
				{
					DisplayName = "清除石化",
					Action = delegate
					{
						Character.localCharacter.data.SetPetrify(0);
						Character.localCharacter.refs.afflictions.SetStatus((STATUSTYPE)13, 0f, true);
					}
				},
				new DebugActionInfo
				{
					DisplayName = "清除刺伤",
					Action = delegate
					{
						CharacterAfflictions.GetUnThorned();
					}
				},
				new DebugActionInfo
				{
					DisplayName = "清除箭伤",
					Action = delegate
					{
						Character.localCharacter.refs.afflictions.RemoveAllThorns();
					}
				},
				new DebugActionInfo
				{
					DisplayName = "清除全部 (回满体力)",
					Action = delegate
					{
						CharacterAfflictions.ClearAll();
						Character.GainFullStamina();
						Plugin.Log.LogInfo((object)"[Debug] 状态大洗白:清空异常并回满体力");
					}
				}
			},
			[DebugCategory.Other] = new List<DebugActionInfo>
			{
				new DebugActionInfo
				{
					DisplayName = "切换无限体力",
					Action = delegate
					{
						_isInfiniteStamina = !_isInfiniteStamina;
						Character.InfiniteStamina();
						Plugin.Log.LogInfo((object)("[Debug] 无限体力模式: " + (_isInfiniteStamina ? "开启" : "关闭")));
					}
				},
				new DebugActionInfo
				{
					DisplayName = "瞬间复活",
					Action = delegate
					{
						Character.Revive();
					}
				},
				new DebugActionInfo
				{
					DisplayName = "解锁全成就",
					Action = delegate
					{
						AchievementManager.UnlockAll();
					}
				},
				new DebugActionInfo
				{
					DisplayName = "打印所有道具",
					Action = delegate
					{
						ItemUtil.LogAllItems();
					}
				},
				new DebugActionInfo
				{
					DisplayName = "传回出生点",
					IsVisible = false,
					Action = delegate
					{
						Plugin.Log.LogInfo((object)"[Debug] 瞬间传回出生点");
					}
				},
				new DebugActionInfo
				{
					DisplayName = "瞬间死亡",
					Action = delegate
					{
						Character.Die();
					}
				},
				new DebugActionInfo
				{
					DisplayName = "跳过当前层级",
					IsVisible = false,
					Action = delegate
					{
						MapDebugUI.IncrementLevel();
						Plugin.Log.LogInfo((object)"[Debug] 跳过当前层级...");
					}
				}
			}
		};
	}
	public class AbilityInfo
	{
		public string Name { get; set; } = "";

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

		public string Description { get; set; } = "";
	}
	public class ClassDefinition
	{
		public ClassType ClassType { get; set; }

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

		public List<AbilityInfo> Abilities { get; set; } = new List<AbilityInfo>();

		public Type? ActiveAbility { get; set; }
	}
	public enum DebugCategory
	{
		Class,
		Item,
		Status,
		Other
	}
	public class DebugActionInfo
	{
		public string DisplayName { get; set; } = "";

		public Action Action { get; set; }

		public KeyCode? Hotkey { get; set; }

		public bool IsVisible { get; set; } = true;
	}
	public enum ClassType
	{
		None,
		Explorer,
		Leader,
		Logistician,
		Cook,
		Doctor
	}
	public enum AbilityType
	{
		None,
		Active,
		Passive,
		Negative
	}
	public enum ItemType
	{
		None,
		Survival,
		Medical,
		Food,
		Berry,
		Mushroom,
		Mystical,
		Misc,
		Container,
		Unimplemented,
		Gem
	}
	public enum ItemRarity
	{
		None,
		Common,
		Uncommon,
		Rare,
		Epic,
		Mystical,
		Legendary
	}
	public class ModMessage
	{
		public static readonly ModMessage LeaderInspire = new ModMessage(0.01f, "领袖鼓舞士气恢复损伤");

		public static readonly ModMessage LeaderSubCurse = new ModMessage(0.02f, "领袖圣洁消除诅咒");

		public static readonly ModMessage CookExtraHunger = new ModMessage(1.00001f, "厨师额外恢复饥饿");

		public static readonly ModMessage DoctorPoisonReduce = new ModMessage(0.03f, "医生毒性熟悉减少毒和孢子");

		public float Code { get; }

		public string Name { get; }

		private ModMessage(float code, string name)
		{
			Code = code;
			Name = name;
		}
	}
	public class ItemDefination
	{
		private int? _customWeight;

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

		public ItemType Type { get; set; }

		public ItemRarity Rarity { get; set; }

		public int Weight
		{
			get
			{
				if (_customWeight.HasValue)
				{
					return _customWeight.Value;
				}
				if (RaritySettings.BaseWeights.TryGetValue(Rarity, out var value))
				{
					return value;
				}
				return 0;
			}
			set
			{
				_customWeight = value;
			}
		}
	}
	public static class RaritySettings
	{
		public static readonly Dictionary<ItemRarity, int> BaseWeights = new Dictionary<ItemRarity, int>
		{
			{
				ItemRarity.Common,
				80
			},
			{
				ItemRarity.Uncommon,
				40
			},
			{
				ItemRarity.Rare,
				20
			},
			{
				ItemRarity.Epic,
				10
			},
			{
				ItemRarity.Mystical,
				4
			},
			{
				ItemRarity.Legendary,
				1
			},
			{
				ItemRarity.None,
				0
			}
		};
	}
	[BepInPlugin("com.github.fengsheng404.Silver", "Silver", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private readonly Harmony _harmony = new Harmony("com.github.fengsheng404.Silver");

		public const string Id = "com.github.fengsheng404.Silver";

		public static Plugin Instance { get; private set; }

		internal static ManualLogSource Log { get; private set; }

		public static string Name => "Silver";

		public static string Version => "1.0.0";

		private void Awake()
		{
			Log = ((BaseUnityPlugin)this).Logger;
			Instance = this;
			Config.Initialize(((BaseUnityPlugin)this).Config);
			((Component)this).gameObject.AddComponent<ClassSectionUI>();
			((Component)this).gameObject.AddComponent<SkillInfoUI>();
			((Component)this).gameObject.AddComponent<SkillHUD>();
			((Component)this).gameObject.AddComponent<FloatingTextUI>();
			if (Config.Debug.CanDebug.Value)
			{
				((Component)this).gameObject.AddComponent<DebugMenuUI>();
			}
			_harmony.PatchAll();
			Log.LogInfo((object)("[Plugins] Plugin " + Name + " is loaded!"));
		}

		private void Update()
		{
		}
	}
}
namespace Silver.Utils
{
	public static class CharacterUtil
	{
		public static int GetAlivePlayerCount()
		{
			int num = 0;
			foreach (Character allCharacter in Character.AllCharacters)
			{
				if (allCharacter.IsPlayerControlled && !allCharacter.data.dead)
				{
					num++;
				}
			}
			Plugin.Log.LogInfo((object)$"[CharacterUtil] 存活玩家数量: {num}");
			return num;
		}

		public static int GetTotalPlayerCount()
		{
			int num = 0;
			foreach (Character allCharacter in Character.AllCharacters)
			{
				if (allCharacter.IsPlayerControlled)
				{
					num++;
				}
			}
			Plugin.Log.LogInfo((object)$"[CharacterUtil] 总玩家数量: {num}");
			return num;
		}

		public static int GetDeadPlayerCount()
		{
			int num = 0;
			foreach (Character allCharacter in Character.AllCharacters)
			{
				if (allCharacter.IsPlayerControlled && allCharacter.data.dead)
				{
					num++;
				}
			}
			Plugin.Log.LogInfo((object)$"[CharacterUtil] 死亡玩家数量: {num}");
			return num;
		}

		public static bool IsAnyPlayerAlive()
		{
			return GetAlivePlayerCount() > 0;
		}

		public static bool IsAnyPlayerDead()
		{
			return GetDeadPlayerCount() > 0;
		}
	}
	public static class ItemUtil
	{
		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)
			return PhotonNetwork.Instantiate("0_items/" + itemName, position, rotation, (byte)0, (object[])null);
		}

		public static void SpawnItemInHand(string itemName)
		{
			Character localCharacter = Character.localCharacter;
			if (!((Object)(object)localCharacter == (Object)null))
			{
				CharacterItems items = localCharacter.refs.items;
				if ((Object)(object)items != (Object)null)
				{
					items.SpawnItemInHand(itemName);
				}
			}
		}

		public static void LogAllItems()
		{
			ItemDatabase instance = SingletonAsset<ItemDatabase>.Instance;
			if ((Object)(object)instance == (Object)null || ((DatabaseAsset<ItemDatabase, Item>)(object)instance).Objects == null)
			{
				Plugin.Log.LogError((object)"ItemDatabase 还未加载,无法读取物品!");
				return;
			}
			Plugin.Log.LogInfo((object)"======== 开始打印物品列表 ========");
			foreach (Item @object in ((DatabaseAsset<ItemDatabase, Item>)(object)instance).Objects)
			{
				if (!((Object)(object)@object == (Object)null) && !string.IsNullOrWhiteSpace(((Object)@object).name))
				{
					string text = ((@object.UIData != null) ? @object.UIData.itemName : ((Object)@object).name);
					Plugin.Log.LogInfo((object)("Prefab名:" + ((Object)@object).name + " | 显示名:" + text));
				}
			}
			Plugin.Log.LogInfo((object)"======== 物品列表打印完成 ========");
		}

		public static string GetRandomItemByWeight()
		{
			Dictionary<string, ItemDefination> itemDictionary = ItemWeightRepository.ItemDictionary;
			int num = itemDictionary.Values.Sum((ItemDefination item) => item.Weight);
			int num2 = Random.Range(0, num);
			string result = "";
			int num3 = 0;
			foreach (KeyValuePair<string, ItemDefination> item in itemDictionary)
			{
				num3 += item.Value.Weight;
				if (num2 < num3)
				{
					result = item.Key;
					break;
				}
			}
			return result;
		}

		public static string GetRandomItemByRarity(ItemRarity targetRarity)
		{
			List<KeyValuePair<string, ItemDefination>> list = ItemWeightRepository.ItemDictionary.Where<KeyValuePair<string, ItemDefination>>((KeyValuePair<string, ItemDefination> kvp) => kvp.Value.Rarity == targetRarity).ToList();
			if (list.Count == 0)
			{
				return "";
			}
			int index = Random.Range(0, list.Count);
			return list[index].Key;
		}

		public static string GetRandomItemByType(ItemType targetType)
		{
			List<KeyValuePair<string, ItemDefination>> list = ItemWeightRepository.ItemDictionary.Where<KeyValuePair<string, ItemDefination>>((KeyValuePair<string, ItemDefination> kvp) => kvp.Value.Type == targetType).ToList();
			if (list.Count == 0)
			{
				return "";
			}
			int num = list.Sum((KeyValuePair<string, ItemDefination> kvp) => kvp.Value.Weight);
			int num2 = Random.Range(0, num);
			string result = "";
			int num3 = 0;
			foreach (KeyValuePair<string, ItemDefination> item in list)
			{
				num3 += item.Value.Weight;
				if (num2 < num3)
				{
					result = item.Key;
					break;
				}
			}
			return result;
		}
	}
	public static class UIUtils
	{
		private static Font? _defaultFont;

		public static Font GetDefaultFont()
		{
			if ((Object)(object)_defaultFont == (Object)null)
			{
				_defaultFont = Resources.GetBuiltinResource<Font>("Arial.ttf");
			}
			return _defaultFont;
		}

		public static GameObject CreateUIObject(string name, Transform parent)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			GameObject val = new GameObject(name);
			val.AddComponent<RectTransform>();
			val.transform.SetParent(parent, false);
			return val;
		}

		public static Text CreateText(string name, Transform parent, string content, int fontSize, Color color, TextAnchor anchor = (TextAnchor)4)
		{
			//IL_0029: 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_0058: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = CreateUIObject(name, parent);
			Text val2 = val.AddComponent<Text>();
			val2.font = GetDefaultFont();
			val2.text = content;
			val2.fontSize = fontSize;
			((Graphic)val2).color = color;
			val2.alignment = anchor;
			val2.horizontalOverflow = (HorizontalWrapMode)1;
			val2.verticalOverflow = (VerticalWrapMode)1;
			RectTransform component = val.GetComponent<RectTransform>();
			component.sizeDelta = new Vector2(200f, 50f);
			return val2;
		}

		public static Image CreatePanel(string name, Transform parent, Color color, Vector2 size)
		{
			//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_0038: 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_0056: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = CreateUIObject(name, parent);
			Image val2 = val.AddComponent<Image>();
			val2.sprite = Sprite.Create(Texture2D.whiteTexture, new Rect(0f, 0f, 4f, 4f), Vector2.one * 0.5f);
			((Graphic)val2).color = color;
			RectTransform component = val.GetComponent<RectTransform>();
			component.sizeDelta = size;
			return val2;
		}

		public static void SetColor(GameObject target, Color color)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			Image component = target.GetComponent<Image>();
			if ((Object)(object)component != (Object)null)
			{
				((Graphic)component).color = color;
			}
		}

		public static Button AddButtonComponent(GameObject target, Action onClickAction)
		{
			//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_0031: 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_005c: 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_0079: Expected O, but got Unknown
			Button val = target.AddComponent<Button>();
			ColorBlock colors = ((Selectable)val).colors;
			((ColorBlock)(ref colors)).highlightedColor = new Color(1f, 1f, 1f, 0.2f);
			((ColorBlock)(ref colors)).pressedColor = new Color(0.5f, 0.5f, 0.5f, 0.5f);
			((Selectable)val).colors = colors;
			((UnityEvent)val.onClick).AddListener((UnityAction)delegate
			{
				onClickAction?.Invoke();
			});
			return val;
		}

		public static void AddDoubleClickComponent(GameObject target, Action onDoubleClick)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			EventTrigger val = target.GetComponent<EventTrigger>() ?? target.AddComponent<EventTrigger>();
			Entry val2 = new Entry();
			val2.eventID = (EventTriggerType)4;
			((UnityEvent<BaseEventData>)(object)val2.callback).AddListener((UnityAction<BaseEventData>)delegate(BaseEventData data)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Expected O, but got Unknown
				PointerEventData val3 = (PointerEventData)data;
				if (val3.clickCount == 2)
				{
					onDoubleClick?.Invoke();
				}
			});
			val.triggers.Add(val2);
		}
	}
}
namespace Silver.UI
{
	public class ClassSectionUI : MonoBehaviour
	{
		public bool IsShowing;

		private GameObject? _canvasObj;

		private Text? _detailText;

		private Text? _titleText;

		private Dictionary<ClassType, GameObject> _buttonObjects = new Dictionary<ClassType, GameObject>();

		private ClassType _lastPreviewedClass;

		private readonly Color _normalColor = new Color(0.25f, 0.25f, 0.25f, 1f);

		private readonly Color _selectedColor = new Color(0.4f, 0.4f, 0.2f, 1f);

		public static ClassSectionUI Instance { get; private set; }

		private void Awake()
		{
			if ((Object)(object)Instance != (Object)null && (Object)(object)Instance != (Object)(object)this)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
				return;
			}
			Instance = this;
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			Plugin.Log.LogInfo((object)"[ClassSectionUI] 职业选择界面开始初始化");
			InitUI();
		}

		private void InitUI()
		{
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: 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_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Expected O, but got Unknown
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: 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_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0218: Unknown result type (might be due to invalid IL or missing references)
			//IL_022e: Unknown result type (might be due to invalid IL or missing references)
			_canvasObj = UIUtils.CreateUIObject("ClassSelectionCanvas", ((Component)this).transform);
			Canvas val = _canvasObj.AddComponent<Canvas>();
			val.renderMode = (RenderMode)0;
			val.sortingOrder = 999;
			_canvasObj.AddComponent<CanvasScaler>().uiScaleMode = (ScaleMode)1;
			_canvasObj.AddComponent<GraphicRaycaster>();
			Image val2 = UIUtils.CreatePanel("MainPanel", _canvasObj.transform, new Color(0f, 0f, 0f, 0.9f), new Vector2(600f, 450f));
			GameObject val3 = UIUtils.CreateUIObject("LeftButtons", ((Component)val2).transform);
			RectTransform component = val3.GetComponent<RectTransform>();
			component.anchorMin = new Vector2(0f, 0f);
			component.anchorMax = new Vector2(0.4f, 1f);
			Vector2 offsetMin = (component.offsetMax = Vector2.zero);
			component.offsetMin = offsetMin;
			VerticalLayoutGroup val4 = val3.AddComponent<VerticalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)val4).spacing = 15f;
			((LayoutGroup)val4).childAlignment = (TextAnchor)4;
			((HorizontalOrVerticalLayoutGroup)val4).childControlHeight = false;
			((LayoutGroup)val4).padding = new RectOffset(10, 10, 20, 20);
			GameObject val5 = UIUtils.CreateUIObject("RightDetail", ((Component)val2).transform);
			RectTransform component2 = val5.GetComponent<RectTransform>();
			component2.anchorMin = new Vector2(0.45f, 0.1f);
			component2.anchorMax = new Vector2(0.95f, 0.9f);
			offsetMin = (component2.offsetMax = Vector2.zero);
			component2.offsetMin = offsetMin;
			_titleText = UIUtils.CreateText("DetailTitle", val5.transform, "请选择职业", 24, Color.yellow, (TextAnchor)0);
			_detailText = UIUtils.CreateText("DetailContent", val5.transform, "点击左侧查看技能详情", 16, Color.white, (TextAnchor)0);
			RectTransform component3 = ((Component)_titleText).GetComponent<RectTransform>();
			component3.anchoredPosition = new Vector2(0f, 40f);
			component3.sizeDelta = new Vector2(300f, 40f);
			RectTransform component4 = ((Component)_detailText).GetComponent<RectTransform>();
			component4.anchoredPosition = new Vector2(0f, 0f);
			component4.sizeDelta = new Vector2(320f, 400f);
			_detailText.horizontalOverflow = (HorizontalWrapMode)0;
			_detailText.verticalOverflow = (VerticalWrapMode)0;
			_detailText.supportRichText = true;
			_detailText.alignment = (TextAnchor)0;
			_buttonObjects.Clear();
			foreach (ClassDefinition value in ClassRepository.ClassDefinitions.Values)
			{
				AddClassButton(val3.transform, value);
			}
			Plugin.Log.LogInfo((object)"[ClassSectionUI] 职业选择界面初始化完成");
			_canvasObj.SetActive(false);
		}

		private void AddClassButton(Transform parent, ClassDefinition def)
		{
			//IL_0030: 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_0062: Unknown result type (might be due to invalid IL or missing references)
			Image val = UIUtils.CreatePanel($"{def.ClassType}Btn", parent, _normalColor, new Vector2(200f, 50f));
			UIUtils.CreateText("Label", ((Component)val).transform, def.DisplayName, 18, Color.white, (TextAnchor)4);
			_buttonObjects[def.ClassType] = ((Component)val).gameObject;
			UIUtils.AddButtonComponent(((Component)val).gameObject, delegate
			{
				UpdateDetailUI(def);
				Plugin.Log.LogInfo((object)("[ClassSectionUI] 预览职业: " + def.DisplayName));
			});
			UIUtils.AddDoubleClickComponent(((Component)val).gameObject, delegate
			{
				ConfirmSelectClass(def.ClassType);
			});
		}

		private void UpdateDetailUI(ClassDefinition def)
		{
			//IL_0066: 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)
			if ((Object)(object)_titleText == (Object)null || (Object)(object)_detailText == (Object)null)
			{
				return;
			}
			if (_lastPreviewedClass != ClassType.None && _buttonObjects.ContainsKey(_lastPreviewedClass))
			{
				UIUtils.SetColor(_buttonObjects[_lastPreviewedClass], _normalColor);
			}
			UIUtils.SetColor(_buttonObjects[def.ClassType], _selectedColor);
			_lastPreviewedClass = def.ClassType;
			_titleText.text = "";
			StringBuilder stringBuilder = new StringBuilder();
			foreach (AbilityInfo ability in def.Abilities)
			{
				string text = ((ability.Type == "主动") ? "green" : ((ability.Type == "负面") ? "red" : "cyan"));
				stringBuilder.AppendLine("<color=" + text + ">[" + ability.Type + "]</color> <b>" + ability.Name + "</b>");
				stringBuilder.AppendLine(ability.Description ?? "");
				stringBuilder.AppendLine();
			}
			_detailText.text = stringBuilder.ToString();
		}

		private void ConfirmSelectClass(ClassType classType)
		{
			ClassManager.SetClass(classType);
			GameObject? canvasObj = _canvasObj;
			if (canvasObj != null)
			{
				canvasObj.SetActive(false);
			}
			IsShowing = false;
			Cursor.lockState = (CursorLockMode)1;
			Cursor.visible = false;
			Plugin.Log.LogInfo((object)$"[ClassSectionUI] 已确认选择职业: {classType}");
		}

		public void Show()
		{
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)_canvasObj == (Object)null))
			{
				_titleText.text = "请选择职业";
				_detailText.text = "点击左侧查看技能详情";
				if (_lastPreviewedClass != ClassType.None && _buttonObjects.ContainsKey(_lastPreviewedClass))
				{
					UIUtils.SetColor(_buttonObjects[_lastPreviewedClass], _normalColor);
				}
				_lastPreviewedClass = ClassType.None;
				_canvasObj.SetActive(true);
				IsShowing = true;
				Cursor.lockState = (CursorLockMode)0;
				Cursor.visible = true;
				Plugin.Log.LogInfo((object)"[ClassSectionUI] 职业选择UI界面已显示,鼠标已强制解锁");
			}
		}
	}
	public class DebugMenuUI : MonoBehaviour
	{
		public bool IsShowing;

		private GameObject? _canvasObj;

		private GameObject? _contentPanel;

		private DebugCategory _currentCategory;

		private int _currentPage;

		private const int ItemsPerPage = 7;

		private readonly Dictionary<DebugCategory, GameObject> _categoryButtons = new Dictionary<DebugCategory, GameObject>();

		private readonly List<GameObject> _actionButtons = new List<GameObject>();

		private GameObject? _prevPageBtn;

		private GameObject? _nextPageBtn;

		private readonly Color _tabNormalColor = new Color(0.2f, 0.2f, 0.3f, 1f);

		private readonly Color _tabSelectedColor = new Color(0.4f, 0.3f, 0.1f, 1f);

		private readonly Color _actionNormalColor = new Color(0.25f, 0.25f, 0.25f, 1f);

		private readonly Color _disabledColor = new Color(0.15f, 0.15f, 0.15f, 1f);

		private static readonly Dictionary<DebugCategory, string> CategoryNames = new Dictionary<DebugCategory, string>
		{
			{
				DebugCategory.Class,
				"职业"
			},
			{
				DebugCategory.Item,
				"道具"
			},
			{
				DebugCategory.Status,
				"状态"
			},
			{
				DebugCategory.Other,
				"其他"
			}
		};

		public static DebugMenuUI Instance { get; private set; } = null;

		private void Awake()
		{
			if ((Object)(object)Instance != (Object)null && (Object)(object)Instance != (Object)(object)this)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
				return;
			}
			Instance = this;
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			Plugin.Log.LogInfo((object)"[DebugMenuUI] 调试菜单界面开始初始化");
			InitUI();
		}

		private void Update()
		{
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			if (Input.GetKeyDown((KeyCode)118) && !Input.GetKey((KeyCode)9))
			{
				if (IsShowing)
				{
					Hide();
				}
				else
				{
					Show();
				}
			}
			else
			{
				if (!Input.GetKey((KeyCode)9) || IsShowing)
				{
					return;
				}
				foreach (List<DebugActionInfo> value in DebugActionRepository.DebugActions.Values)
				{
					foreach (DebugActionInfo item in value)
					{
						if (item.IsVisible && item.Hotkey.HasValue && Input.GetKeyDown(item.Hotkey.Value))
						{
							item.Action();
							Plugin.Log.LogInfo((object)("[DebugMenuUI] 快捷键执行: " + item.DisplayName));
							return;
						}
					}
				}
			}
		}

		private void InitUI()
		{
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: 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_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: 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_025c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0272: 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)
			//IL_029e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_030f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0325: Unknown result type (might be due to invalid IL or missing references)
			//IL_033b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0347: Unknown result type (might be due to invalid IL or missing references)
			//IL_0353: Unknown result type (might be due to invalid IL or missing references)
			//IL_0398: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a2: Expected O, but got Unknown
			//IL_03d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0412: Unknown result type (might be due to invalid IL or missing references)
			//IL_0428: Unknown result type (might be due to invalid IL or missing references)
			//IL_043e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0454: Unknown result type (might be due to invalid IL or missing references)
			//IL_0475: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0514: Unknown result type (might be due to invalid IL or missing references)
			//IL_052a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0547: Unknown result type (might be due to invalid IL or missing references)
			//IL_0579: Unknown result type (might be due to invalid IL or missing references)
			//IL_0588: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_05cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0618: Unknown result type (might be due to invalid IL or missing references)
			_canvasObj = UIUtils.CreateUIObject("DebugMenuCanvas", ((Component)this).transform);
			Canvas val = _canvasObj.AddComponent<Canvas>();
			val.renderMode = (RenderMode)0;
			val.sortingOrder = 1500;
			_canvasObj.AddComponent<CanvasScaler>().uiScaleMode = (ScaleMode)1;
			_canvasObj.AddComponent<GraphicRaycaster>();
			Image val2 = UIUtils.CreatePanel("MainPanel", _canvasObj.transform, new Color(0f, 0f, 0f, 0.9f), new Vector2(700f, 500f));
			RectTransform component = ((Component)val2).GetComponent<RectTransform>();
			component.anchoredPosition = Vector2.zero;
			GameObject val3 = UIUtils.CreateUIObject("TabContainer", ((Component)val2).transform);
			RectTransform component2 = val3.GetComponent<RectTransform>();
			component2.anchorMin = new Vector2(0f, 1f);
			component2.anchorMax = new Vector2(1f, 1f);
			component2.pivot = new Vector2(0.5f, 1f);
			component2.offsetMin = new Vector2(10f, -65f);
			component2.offsetMax = new Vector2(-10f, -25f);
			HorizontalLayoutGroup val4 = val3.AddComponent<HorizontalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)val4).spacing = 5f;
			((LayoutGroup)val4).childAlignment = (TextAnchor)4;
			((HorizontalOrVerticalLayoutGroup)val4).childControlWidth = true;
			((HorizontalOrVerticalLayoutGroup)val4).childControlHeight = false;
			_categoryButtons.Clear();
			DebugCategory[] array = new DebugCategory[4]
			{
				DebugCategory.Class,
				DebugCategory.Item,
				DebugCategory.Status,
				DebugCategory.Other
			};
			DebugCategory[] array2 = array;
			foreach (DebugCategory debugCategory in array2)
			{
				DebugCategory cat = debugCategory;
				Image val5 = UIUtils.CreatePanel($"{debugCategory}Tab", val3.transform, _tabNormalColor, new Vector2(160f, 40f));
				UIUtils.CreateText("Label", ((Component)val5).transform, CategoryNames[debugCategory], 18, Color.white, (TextAnchor)4);
				_categoryButtons[debugCategory] = ((Component)val5).gameObject;
				UIUtils.AddButtonComponent(((Component)val5).gameObject, delegate
				{
					SwitchCategory(cat);
				});
			}
			GameObject val6 = UIUtils.CreateUIObject("ContentScroll", ((Component)val2).transform);
			RectTransform component3 = val6.GetComponent<RectTransform>();
			component3.anchorMin = new Vector2(0f, 0f);
			component3.anchorMax = new Vector2(1f, 1f);
			component3.pivot = new Vector2(0.5f, 0.5f);
			component3.offsetMin = new Vector2(10f, 60f);
			component3.offsetMax = new Vector2(-10f, -75f);
			ScrollRect val7 = val6.AddComponent<ScrollRect>();
			val7.horizontal = false;
			val7.vertical = true;
			val6.AddComponent<RectMask2D>();
			_contentPanel = UIUtils.CreateUIObject("ContentPanel", val6.transform);
			RectTransform component4 = _contentPanel.GetComponent<RectTransform>();
			component4.anchorMin = new Vector2(0f, 1f);
			component4.anchorMax = new Vector2(1f, 1f);
			component4.pivot = new Vector2(0.5f, 1f);
			component4.offsetMin = Vector2.zero;
			component4.offsetMax = Vector2.zero;
			VerticalLayoutGroup val8 = _contentPanel.AddComponent<VerticalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)val8).spacing = 8f;
			((LayoutGroup)val8).childAlignment = (TextAnchor)1;
			((HorizontalOrVerticalLayoutGroup)val8).childControlWidth = true;
			((HorizontalOrVerticalLayoutGroup)val8).childControlHeight = false;
			((LayoutGroup)val8).padding = new RectOffset(10, 10, 10, 10);
			ContentSizeFitter val9 = _contentPanel.AddComponent<ContentSizeFitter>();
			val9.verticalFit = (FitMode)2;
			val7.content = _contentPanel.GetComponent<RectTransform>();
			_prevPageBtn = ((Component)UIUtils.CreatePanel("PrevPageBtn", ((Component)val2).transform, _actionNormalColor, new Vector2(120f, 40f))).gameObject;
			RectTransform component5 = _prevPageBtn.GetComponent<RectTransform>();
			component5.anchorMin = new Vector2(0f, 0f);
			component5.anchorMax = new Vector2(0f, 0f);
			component5.pivot = new Vector2(0f, 0f);
			component5.anchoredPosition = new Vector2(20f, 25f);
			UIUtils.CreateText("Label", _prevPageBtn.transform, "◀ 上一页", 16, Color.white, (TextAnchor)4);
			UIUtils.AddButtonComponent(_prevPageBtn, delegate
			{
				ChangePage(-1);
			});
			Image val10 = UIUtils.CreatePanel("CloseBtn", ((Component)val2).transform, new Color(0.5f, 0.15f, 0.15f, 1f), new Vector2(120f, 40f));
			RectTransform component6 = ((Component)val10).GetComponent<RectTransform>();
			component6.anchorMin = new Vector2(0.5f, 0f);
			component6.anchorMax = new Vector2(0.5f, 0f);
			component6.pivot = new Vector2(0.5f, 0f);
			component6.anchoredPosition = new Vector2(0f, 25f);
			UIUtils.CreateText("Label", ((Component)val10).transform, "关闭", 18, Color.white, (TextAnchor)4);
			UIUtils.AddButtonComponent(((Component)val10).gameObject, Hide);
			_nextPageBtn = ((Component)UIUtils.CreatePanel("NextPageBtn", ((Component)val2).transform, _actionNormalColor, new Vector2(120f, 40f))).gameObject;
			RectTransform component7 = _nextPageBtn.GetComponent<RectTransform>();
			component7.anchorMin = new Vector2(1f, 0f);
			component7.anchorMax = new Vector2(1f, 0f);
			component7.pivot = new Vector2(1f, 0f);
			component7.anchoredPosition = new Vector2(-20f, 25f);
			UIUtils.CreateText("Label", _nextPageBtn.transform, "下一页 ▶", 16, Color.white, (TextAnchor)4);
			UIUtils.AddButtonComponent(_nextPageBtn, delegate
			{
				ChangePage(1);
			});
			RefreshContent();
			Plugin.Log.LogInfo((object)"[DebugMenuUI] 调试菜单界面初始化完成");
			_canvasObj.SetActive(false);
		}

		private void SwitchCategory(DebugCategory category)
		{
			if (_currentCategory != category)
			{
				_currentCategory = category;
				_currentPage = 0;
				RefreshContent();
			}
		}

		private void ChangePage(int delta)
		{
			_currentPage += delta;
			RefreshContent();
		}

		private void RefreshContent()
		{
			//IL_0037: 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_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: 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)
			foreach (KeyValuePair<DebugCategory, GameObject> categoryButton in _categoryButtons)
			{
				UIUtils.SetColor(categoryButton.Value, (categoryButton.Key == _currentCategory) ? _tabSelectedColor : _tabNormalColor);
			}
			foreach (GameObject actionButton in _actionButtons)
			{
				Object.Destroy((Object)(object)actionButton);
			}
			_actionButtons.Clear();
			if (!DebugActionRepository.DebugActions.TryGetValue(_currentCategory, out List<DebugActionInfo> value))
			{
				return;
			}
			List<DebugActionInfo> list = new List<DebugActionInfo>();
			foreach (DebugActionInfo item in value)
			{
				if (item.IsVisible)
				{
					list.Add(item);
				}
			}
			int num = Mathf.Max(1, Mathf.CeilToInt((float)list.Count / 7f));
			if (_currentPage < 0)
			{
				_currentPage = 0;
			}
			if (_currentPage >= num)
			{
				_currentPage = num - 1;
			}
			UpdatePageButtonState(_prevPageBtn, _currentPage > 0);
			UpdatePageButtonState(_nextPageBtn, _currentPage < num - 1);
			int num2 = _currentPage * 7;
			int num3 = Mathf.Min(num2 + 7, list.Count);
			for (int i = num2; i < num3; i++)
			{
				DebugActionInfo a = list[i];
				Image val = UIUtils.CreatePanel("ActionBtn_" + a.DisplayName, _contentPanel.transform, _actionNormalColor, new Vector2(600f, 40f));
				UIUtils.CreateText("Label", ((Component)val).transform, a.DisplayName, 16, Color.white, (TextAnchor)4);
				UIUtils.AddButtonComponent(((Component)val).gameObject, delegate
				{
					a.Action();
					Plugin.Log.LogInfo((object)("[DebugMenuUI] 执行: " + a.DisplayName));
				});
				_actionButtons.Add(((Component)val).gameObject);
			}
		}

		private void UpdatePageButtonState(GameObject? btn, bool enabled)
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)btn == (Object)null))
			{
				Button component = btn.GetComponent<Button>();
				if ((Object)(object)component != (Object)null)
				{
					((Selectable)component).interactable = enabled;
				}
				UIUtils.SetColor(btn, enabled ? _actionNormalColor : _disabledColor);
			}
		}

		public void Show()
		{
			if (!((Object)(object)_canvasObj == (Object)null))
			{
				_canvasObj.SetActive(true);
				IsShowing = true;
				Cursor.lockState = (CursorLockMode)0;
				Cursor.visible = true;
				Plugin.Log.LogInfo((object)"[DebugMenuUI] 调试菜单已显示");
			}
		}

		public void Hide()
		{
			if (!((Object)(object)_canvasObj == (Object)null))
			{
				_canvasObj.SetActive(false);
				IsShowing = false;
				Cursor.lockState = (CursorLockMode)1;
				Cursor.visible = false;
			}
		}
	}
	public class FloatingTextUI : MonoBehaviour
	{
		private GameObject? _canvasObj;

		private Transform? _textContainer;

		private const float MoveSpeed = 65f;

		private const float FadeDuration = 1.8f;

		private const int FontSize = 30;

		public static FloatingTextUI Instance { get; private set; }

		private void Awake()
		{
			if ((Object)(object)Instance != (Object)null && (Object)(object)Instance != (Object)(object)this)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
				return;
			}
			Instance = this;
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			Plugin.Log.LogInfo((object)"[FloatingTextUI] 浮动文字模块开始初始化");
			InitUI();
		}

		private void InitUI()
		{
			_canvasObj = UIUtils.CreateUIObject("FloatingTextCanvas", ((Component)this).transform);
			Canvas val = _canvasObj.AddComponent<Canvas>();
			val.renderMode = (RenderMode)0;
			val.sortingOrder = 2000;
			_canvasObj.AddComponent<CanvasScaler>().uiScaleMode = (ScaleMode)1;
			_textContainer = _canvasObj.transform;
			Plugin.Log.LogInfo((object)"[FloatingTextUI] 浮动文字模块初始化完成");
		}

		public void Show(string message, Color color)
		{
			//IL_001d: 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)
			if (!((Object)(object)_textContainer == (Object)null))
			{
				Text val = UIUtils.CreateText("FloatingTextItem", _textContainer, message, 30, color, (TextAnchor)4);
				RectTransform component = ((Component)val).GetComponent<RectTransform>();
				component.anchoredPosition = Vector2.zero;
				((MonoBehaviour)this).StartCoroutine(AnimateTextRoutine(val, component));
			}
		}

		private IEnumerator AnimateTextRoutine(Text textElement, RectTransform rect)
		{
			float elapsed = 0f;
			Vector2 startPos = rect.anchoredPosition;
			Color startColor = ((Graphic)textElement).color;
			while (elapsed < 1.8f)
			{
				elapsed += Time.deltaTime;
				float num = elapsed / 1.8f;
				rect.anchoredPosition = startPos + new Vector2(0f, num * 65f);
				((Graphic)textElement).color = new Color(startColor.r, startColor.g, startColor.b, 1f - num);
				yield return null;
			}
			Object.Destroy((Object)(object)((Component)textElement).gameObject);
		}
	}
	public class SkillHUD : MonoBehaviour
	{
		private GameObject? _canvasObj;

		private Text? _skillNameText;

		private Text? _cooldownText;

		private Text? _usesText;

		private Image? _cooldownBar;

		private IAbility? _currentAbility;

		private readonly Color _coolingColor = new Color(0.1f, 0.4f, 0.8f, 0.6f);

		private readonly Color _readyColor = new Color(0.2f, 1f, 0.2f, 0.9f);

		private readonly Color _usedColor = new Color(0.2f, 0.2f, 0.2f, 0.8f);

		public static SkillHUD Instance { get; private set; }

		private void Awake()
		{
			if ((Object)(object)Instance != (Object)null && (Object)(object)Instance != (Object)(object)this)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
				return;
			}
			Instance = this;
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			Plugin.Log.LogInfo((object)"[SkillHUD] 技能HUD界面开始初始化");
			InitUI();
		}

		private void InitUI()
		{
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: 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_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: 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_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0221: Unknown result type (might be due to invalid IL or missing references)
			//IL_0222: Unknown result type (might be due to invalid IL or missing references)
			//IL_0229: Unknown result type (might be due to invalid IL or missing references)
			//IL_0244: Unknown result type (might be due to invalid IL or missing references)
			//IL_026d: 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_02a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02df: Unknown result type (might be due to invalid IL or missing references)
			_canvasObj = UIUtils.CreateUIObject("SkillHUDCanvas", ((Component)this).transform);
			Canvas val = _canvasObj.AddComponent<Canvas>();
			val.renderMode = (RenderMode)0;
			val.sortingOrder = 1001;
			_canvasObj.AddComponent<CanvasScaler>().uiScaleMode = (ScaleMode)1;
			_canvasObj.AddComponent<GraphicRaycaster>();
			Image val2 = UIUtils.CreatePanel("SkillHUDPanel", _canvasObj.transform, new Color(0f, 0f, 0f, 0f), new Vector2(250f, 80f));
			RectTransform component = ((Component)val2).GetComponent<RectTransform>();
			component.anchoredPosition = new Vector2(120f, -20f);
			component.anchorMin = new Vector2(0f, 1f);
			component.anchorMax = new Vector2(0f, 1f);
			_skillNameText = UIUtils.CreateText("SkillName", ((Component)val2).transform, "无技能", 18, Color.white, (TextAnchor)0);
			RectTransform component2 = ((Component)_skillNameText).GetComponent<RectTransform>();
			component2.anchoredPosition = new Vector2(10f, -10f);
			component2.sizeDelta = new Vector2(230f, 20f);
			Image val3 = UIUtils.CreatePanel("CooldownPanel", ((Component)val2).transform, _usedColor, new Vector2(230f, 15f));
			RectTransform component3 = ((Component)val3).GetComponent<RectTransform>();
			component3.anchoredPosition = new Vector2(0f, -35f);
			component3.sizeDelta = new Vector2(230f, 15f);
			_cooldownBar = ((Component)UIUtils.CreatePanel("CooldownBar", ((Component)val3).transform, _coolingColor, new Vector2(230f, 15f))).GetComponent<Image>();
			_cooldownBar.type = (Type)3;
			_cooldownBar.fillMethod = (FillMethod)0;
			_cooldownBar.fillOrigin = 0;
			RectTransform component4 = ((Component)_cooldownBar).GetComponent<RectTransform>();
			component4.anchorMin = new Vector2(0f, 0f);
			component4.anchorMax = new Vector2(1f, 1f);
			Vector2 offsetMin = (component4.offsetMax = Vector2.zero);
			component4.offsetMin = offsetMin;
			_cooldownText = UIUtils.CreateText("CooldownText", ((Component)val3).transform, "CD: 0s", 12, Color.white, (TextAnchor)4);
			RectTransform component5 = ((Component)_cooldownText).GetComponent<RectTransform>();
			component5.anchoredPosition = new Vector2(0f, 0f);
			component5.sizeDelta = new Vector2(230f, 15f);
			_usesText = UIUtils.CreateText("UsesText", ((Component)val2).transform, "剩余: 0/0", 12, Color.yellow, (TextAnchor)2);
			RectTransform component6 = ((Component)_usesText).GetComponent<RectTransform>();
			component6.anchoredPosition = new Vector2(-5f, -15f);
			component6.sizeDelta = new Vector2(80f, 20f);
			Plugin.Log.LogInfo((object)"[SkillHUD] 技能HUD界面初始化完成");
			_canvasObj.SetActive(false);
		}

		private void Update()
		{
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_skillNameText == (Object)null || (Object)(object)_cooldownText == (Object)null || (Object)(object)_usesText == (Object)null || (Object)(object)_cooldownBar == (Object)null)
			{
				return;
			}
			if (_currentAbility == null)
			{
				_skillNameText.text = "无技能";
				_cooldownText.text = "CD: --";
				_usesText.text = "剩余: --/--";
				_cooldownBar.fillAmount = 0f;
				return;
			}
			_skillNameText.text = _currentAbility.AbilityName;
			float liveCooldown = ClassManager.LiveCooldown;
			float maxCooldown = _currentAbility.MaxCooldown;
			if (ClassManager.LiveUses == 0)
			{
				_cooldownText.text = "无次数";
				((Graphic)_cooldownBar).color = _usedColor;
			}
			else if (liveCooldown > 0f)
			{
				_cooldownText.text = $"CD: {liveCooldown:F1}s";
				_cooldownBar.fillAmount = 1f - liveCooldown / maxCooldown;
				((Graphic)_cooldownBar).color = _coolingColor;
			}
			else
			{
				_cooldownText.text = "CD: 就绪";
				_cooldownBar.fillAmount = 1f;
				((Graphic)_cooldownBar).color = _readyColor;
			}
			_usesText.text = $"剩余: {ClassManager.LiveUses}/{_currentAbility.MaxUses}";
		}

		public void Show()
		{
			if (!((Object)(object)_canvasObj == (Object)null))
			{
				Character localCharacter = Character.localCharacter;
				if ((Object)(object)localCharacter == (Object)null)
				{
					_currentAbility = null;
					return;
				}
				_currentAbility = ((Component)localCharacter).GetComponent<IAbility>();
				Plugin.Log.LogInfo((object)("[SkillHUD] 当前玩家技能: " + (_currentAbility?.AbilityName ?? "无技能")));
				_canvasObj.SetActive(true);
			}
		}

		public void Hide()
		{
			if (!((Object)(object)_canvasObj == (Object)null))
			{
				_canvasObj.SetActive(false);
			}
		}
	}
	public class SkillInfoUI : MonoBehaviour
	{
		public bool IsShowing;

		private GameObject? _canvasObj;

		private Text? _detailText;

		private Text? _titleText;

		public static SkillInfoUI Instance { get; private set; }

		private void Awake()
		{
			if ((Object)(object)Instance != (Object)null && (Object)(object)Instance != (Object)(object)this)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
				return;
			}
			Instance = this;
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			Plugin.Log.LogInfo((object)"[SkillInfoUI] 技能信息界面开始初始化");
			InitUI();
		}

		private void Update()
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			if (Input.GetKeyDown(Config.HotKey.SkillInfoHotkey.Value))
			{
				Toggle();
			}
		}

		private void InitUI()
		{
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: 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_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: 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_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			_canvasObj = UIUtils.CreateUIObject("SkillInfoCanvas", ((Component)this).transform);
			Canvas val = _canvasObj.AddComponent<Canvas>();
			val.renderMode = (RenderMode)0;
			val.sortingOrder = 1000;
			_canvasObj.AddComponent<CanvasScaler>().uiScaleMode = (ScaleMode)1;
			_canvasObj.AddComponent<GraphicRaycaster>();
			Image val2 = UIUtils.CreatePanel("MainPanel", _canvasObj.transform, new Color(0f, 0f, 0f, 0.9f), new Vector2(600f, 450f));
			_titleText = UIUtils.CreateText("SkillTitle", ((Component)val2).transform, "当前角色技能", 24, Color.yellow, (TextAnchor)1);
			RectTransform component = ((Component)_titleText).GetComponent<RectTransform>();
			component.anchoredPosition = new Vector2(0f, 200f);
			component.sizeDelta = new Vector2(500f, 40f);
			_detailText = UIUtils.CreateText("SkillContent", ((Component)val2).transform, "暂无职业技能", 16, Color.white, (TextAnchor)0);
			RectTransform component2 = ((Component)_detailText).GetComponent<RectTransform>();
			component2.anchoredPosition = new Vector2(0f, -20f);
			component2.sizeDelta = new Vector2(550f, 350f);
			_detailText.horizontalOverflow = (HorizontalWrapMode)0;
			_detailText.verticalOverflow = (VerticalWrapMode)0;
			_detailText.supportRichText = true;
			_detailText.alignment = (TextAnchor)0;
			Image val3 = UIUtils.CreatePanel("CloseButton", ((Component)val2).transform, new Color(0.4f, 0.1f, 0.1f, 1f), new Vector2(80f, 30f));
			RectTransform component3 = ((Component)val3).GetComponent<RectTransform>();
			component3.anchoredPosition = new Vector2(0f, -200f);
			component3.sizeDelta = new Vector2(80f, 30f);
			UIUtils.CreateText("CloseLabel", ((Component)val3).transform, "关闭", 16, Color.white, (TextAnchor)4);
			UIUtils.AddButtonComponent(((Component)val3).gameObject, delegate
			{
				Hide();
				Plugin.Log.LogInfo((object)"[SkillInfoUI] 技能信息界面已关闭");
			});
			Plugin.Log.LogInfo((object)"[SkillInfoUI] 技能信息界面初始化完成");
			_canvasObj.SetActive(false);
		}

		private void UpdateSkillDetail()
		{
			if ((Object)(object)_titleText == (Object)null || (Object)(object)_detailText == (Object)null)
			{
				return;
			}
			Plugin.Log.LogInfo((object)$"[SkillInfoUI] 当前职业: {ClassManager.CurrentClass}");
			if (ClassManager.CurrentClass == ClassType.None)
			{
				_titleText.text = "当前角色技能";
				_detailText.text = "<color=red>你还没有选择任何职业,请先选择职业</color>";
			}
			else
			{
				if (!ClassRepository.ClassDefinitions.TryGetValue(ClassManager.CurrentClass, out ClassDefinition value))
				{
					return;
				}
				_titleText.text = value.DisplayName + " 技能";
				StringBuilder stringBuilder = new StringBuilder();
				foreach (AbilityInfo ability in value.Abilities)
				{
					string text = ((ability.Type == "主动") ? "green" : ((ability.Type == "负面") ? "red" : "cyan"));
					stringBuilder.AppendLine("<color=" + text + ">[" + ability.Type + "]</color> <b>" + ability.Name + "</b>");
					stringBuilder.AppendLine(ability.Description ?? "");
					stringBuilder.AppendLine();
				}
				_detailText.text = stringBuilder.ToString();
				Plugin.Log.LogInfo((object)("[SkillInfoUI] 已更新" + value.DisplayName + "的技能信息"));
			}
		}

		private void Show()
		{
			if (!((Object)(object)_canvasObj == (Object)null))
			{
				UpdateSkillDetail();
				_canvasObj.SetActive(true);
				IsShowing = true;
				Cursor.lockState = (CursorLockMode)0;
				Cursor.visible = true;
				Plugin.Log.LogInfo((object)"[SkillInfoUI] 技能信息UI界面已显示,鼠标已解锁");
			}
		}

		private void Hide()
		{
			if (!((Object)(object)_canvasObj == (Object)null))
			{
				_canvasObj.SetActive(false);
				IsShowing = false;
				Cursor.lockState = (CursorLockMode)1;
				Cursor.visible = false;
			}
		}

		private void Toggle()
		{
			if (IsShowing)
			{
				Hide();
			}
			else
			{
				Show();
			}
		}
	}
}
namespace Silver.Patches
{
	[HarmonyPatch(typeof(CursorHandler), "Update")]
	public static class CursorHandlerPatch
	{
		[HarmonyPrefix]
		public static bool Prefix()
		{
			if (((Object)(object)ClassSectionUI.Instance != (Object)null && ClassSectionUI.Instance.IsShowing) || ((Object)(object)SkillInfoUI.Instance != (Object)null && SkillInfoUI.Instance.IsShowing) || ((Object)(object)DebugMenuUI.Instance != (Object)null && DebugMenuUI.Instance.IsShowing))
			{
				Cursor.lockState = (CursorLockMode)0;
				Cursor.visible = true;
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(Character), "RPCA_Die")]
	public static class DiePatch
	{
		[HarmonyPostfix]
		public static void Postfix()
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			Character localCharacter = Character.localCharacter;
			if (!((Object)(object)localCharacter == (Object)null) && ClassManager.IsDoctor())
			{
				localCharacter.refs.afflictions.AddStatus((STATUSTYPE)0, Config.Doctor.EmpathyDamage.Value, false, false, true, false);
				FloatingTextUI.Instance.Show("共情", Color.red);
			}
		}
	}
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	public static class LoadingUIPatch
	{
		[HarmonyPostfix]
		public static void Postfix(ref float __result)
		{
			Character localCharacter = Character.localCharacter;
			if (!((Object)(object)localCharacter == (Object)null))
			{
				IAbility component = ((Component)localCharacter).GetComponent<IAbility>();
				if (component != null && component.CastProgress > 0f)
				{
					__result = component.CastProgress;
				}
			}
		}
	}
	[HarmonyPatch(typeof(Character), "MoraleBoost")]
	public static class MoraleBoostPatch
	{
		[HarmonyPrefix]
		public static bool Prefix(Character __instance, float staminaAdd, int scoutCount)
		{
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)__instance == (Object)null || (Object)(object)__instance.refs.afflictions == (Object)null)
			{
				return false;
			}
			if (staminaAdd == ModMessage.LeaderInspire.Code)
			{
				__instance.refs.afflictions.SubtractStatus((STATUSTYPE)0, Config.Leader.InspireHealAmount.Value, false, false);
				__instance.refs.afflictions.SubtractStatus((STATUSTYPE)1, Config.Leader.InspireHungerAmount.Value, false, false);
				return false;
			}
			if (staminaAdd == ModMessage.LeaderSubCurse.Code)
			{
				if (ClassManager.IsLeader())
				{
					int alivePlayerCount = CharacterUtil.GetAlivePlayerCount();
					float num = Config.Leader.ReduceCurseAmount.Value * (float)alivePlayerCount;
					if (num > 0f)
					{
						__instance.refs.afflictions.SubtractStatus((STATUSTYPE)5, num, false, false);
						Plugin.Log.LogInfo((object)$"[Leader] 使用雕像,净化了{num}点诅咒");
						FloatingTextUI.Instance.Show("圣洁", Color.cyan);
					}
				}
				return false;
			}
			if (staminaAdd == ModMessage.DoctorPoisonReduce.Code)
			{
				float value = Config.Doctor.PoisonReduceAlly.Value;
				__instance.refs.afflictions.SubtractStatus((STATUSTYPE)3, value, false, false);
				__instance.refs.afflictions.SubtractStatus((STATUSTYPE)10, value, false, false);
				Plugin.Log.LogInfo((object)$"[Doctor] 为友军 {((Object)__instance).name} 减少 {value} 点毒和孢子");
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(Campfire), "Light_Rpc")]
	public static class NextMapPatch
	{
		[HarmonyPostfix]
		public static void Postfix(bool updateSegment)
		{
			if (updateSegment)
			{
				Plugin.Log.LogInfo((object)"[ClassManager]加载新地图,重置技能");
				Character localCharacter = Character.localCharacter;
				if (!((Object)(object)localCharacter == (Object)null))
				{
					((Component)localCharacter).GetComponent<IAbility>()?.Reset();
				}
			}
		}
	}
	[HarmonyPatch(typeof(RespawnChest), "SpawnItems")]
	public static class RespawnChestPatch
	{
		[HarmonyPrefix]
		public static void Prefix(RespawnChest __instance, ref List<Transform> spawnSpots)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Expected O, but got Unknown
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			Character localCharacter = Character.localCharacter;
			if (!((Object)(object)localCharacter == (Object)null))
			{
				if (ClassManager.HasLeaderInRoom())
				{
					Vector3 center = localCharacter.Center;
					MoraleBoost.SpawnMoraleBoost(center, -1f, ModMessage.LeaderSubCurse.Code, 0f, true, 1);
				}
				if (ClassManager.HasLeaderInRoom() && !Character.PlayerIsDeadOrDown())
				{
					Transform val = spawnSpots[0];
					GameObject val2 = new GameObject("LeaderExtraSpot");
					val2.transform.position = val.position + new Vector3(0.5f, 0f, 0.5f);
					val2.transform.rotation = val.rotation;
					spawnSpots.Add(val2.transform);
					Plugin.Log.LogInfo((object)$"[Leader] 坑位已刷新,当前总坑位: {spawnSpots.Count}");
				}
			}
		}
	}
}
namespace Silver.Patches.StatusPatches
{
	[HarmonyPatch(typeof(CharacterAfflictions), "AddStatus")]
	public static class AddStatusPatch
	{
		[HarmonyPrefix]
		public static void Prefix(CharacterAfflictions __instance, ref float amount, STATUSTYPE statusType)
		{
			//IL_0037: 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_0088: Invalid comparison between Unknown and I4
			//IL_007c: 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_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Invalid comparison between Unknown and I4
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Invalid comparison between Unknown and I4
			Character value = Traverse.Create((object)__instance).Field("character").GetValue<Character>();
			if ((Object)(object)value != (Object)null && value.IsLocal && ClassManager.IsExplorer())
			{
				if ((int)statusType == 0)
				{
					float num = amount;
					amount *= Config.Explorer.DamageMultiplier.Value;
					Plugin.Log.LogInfo((object)$"[Explorer] 伤害减免触发!原始:{num} 修正后:{amount}");
					FloatingTextUI.Instance.Show("强健体魄", Color.cyan);
				}
				if ((int)statusType == 8 || (int)statusType == 2)
				{
					float num2 = amount;
					amount *= Config.Explorer.DamageMultiplier.Value;
					Plugin.Log.LogInfo((object)$"[Explorer] {statusType}减免触发!原始:{num2} 修正后:{amount}");
				}
				if ((int)statusType == 1)
				{
					float num3 = amount;
					amount *= Config.Explorer.HungerMultiplier.Value;
				}
			}
		}
	}
	[HarmonyPatch(typeof(CharacterAfflictions), "ClearHunger")]
	public static class ClearHungerPatch
	{
		[HarmonyPrefix]
		public static void Prefix()
		{
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			Character localCharacter = Character.localCharacter;
			if (!((Object)(object)localCharacter == (Object)null) && ClassManager.IsExplorer() && Random.Range(0f, 1f) < Config.Explorer.HealChance.Value)
			{
				localCharacter.refs.afflictions.SubtractStatus((STATUSTYPE)0, Config.Explorer.HealAmount.Value, false, false);
				FloatingTextUI.Instance.Show("不屈", Color.cyan);
			}
		}
	}
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	public static class StaminaPatch
	{
		[HarmonyPostfix]
		public static void Postfix(ref float __result)
		{
			Character localCharacter = Character.localCharacter;
			if (!((Object)(object)localCharacter == (Object)null) && ClassManager.IsLogistician())
			{
				__result *= Config.Logistician.StaminaMultiplier.Value;
			}
		}
	}
	[HarmonyPatch(typeof(CharacterAfflictions), "SubtractStatus")]
	public static class SubtractStatusPatch
	{
		[HarmonyPrefix]
		public static void Prefix(CharacterAfflictions __instance, ref float amount, STATUSTYPE statusType)
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Invalid comparison between Unknown and I4
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			Character value = Traverse.Create((object)__instance).Field("character").GetValue<Character>();
			if ((Object)(object)value != (Object)null && value.IsLocal && ClassManager.IsExplorer() && (int)statusType == 1 && Random.Range(0f, 1f) < Config.Explorer.HealChance.Value)
			{
				value.refs.afflictions.SubtractStatus((STATUSTYPE)0, Config.Explorer.HealAmount.Value, false, false);
				FloatingTextUI.Instance.Show("不屈", Color.cyan);
			}
		}
	}
}
namespace Silver.Patches.ItemPatches
{
	[HarmonyPatch(typeof(ItemCooking))]
	public static class ItemCookingPatch
	{
		[HarmonyPatch(typeof(ItemCooking), "FinishCooking")]
		[HarmonyPrefix]
		public static void Prefix(ItemCooking __instance)
		{
			//IL_007a: 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_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: 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)
			Item item = ((ItemComponent)__instance).item;
			Character holderCharacter = item.holderCharacter;
			if ((Object)(object)holderCharacter == (Object)null || !holderCharacter.IsLocal || !ClassManager.IsCook())
			{
				return;
			}
			Action_RestoreHunger component = ((Component)__instance).GetComponent<Action_RestoreHunger>();
			if (!((Object)(object)component == (Object)null) && ClassManager.IsCook() && item.GetData<IntItemData>((DataEntryKey)1).Value == 0)
			{
				FloatItemData data = item.GetData<FloatItemData>((DataEntryKey)14);
				data.Value = ModMessage.CookExtraHunger.Code;
				FloatingTextUI.Instance.Show("精湛厨艺", Color.cyan);
				if (((MonoBehaviourPun)__instance).photonView.IsMine)
				{
					((ItemComponent)__instance).ForceSync();
				}
				Vector3 center = holderCharacter.Center;
				MoraleBoost.SpawnMoraleBoost(center, Config.Cook.CookExtraStaminaRadius.Value, Config.Cook.CookExtraStaminaAmount.Value, 0f, true, 1);
				FloatingTextUI.Instance.Show("诱人香味", Color.cyan);
			}
		}

		[HarmonyPatch(typeof(ItemCooking), "ChangeStatsCooked")]
		[HarmonyPostfix]
		public static void Postfix(ItemCooking __instance, int totalCooked)
		{
			Character localCharacter = Character.localCharacter;
			if ((Object)(object)localCharacter == (Object)null)
			{
				return;
			}
			Action_RestoreHunger component = ((Component)__instance).GetComponent<Action_RestoreHunger>();
			if ((Object)(object)component == (Object)null)
			{
				return;
			}
			Item item = ((ItemComponent)__instance).item;
			if (!((Object)(object)item == (Object)null))
			{
				FloatItemData data = item.GetData<FloatItemData>((DataEntryKey)14);
				if (Mathf.Approximately(data.Value, ModMessage.CookExtraHunger.Code) && totalCooked == 1)
				{
					component.restorationAmount *= Config.Cook.FoodBonus.Value;
					Plugin.Log.LogInfo((object)$"[Cook] 食物 {((Object)item).name} 加成生效,最终恢复量: {component.restorationAmount}");
				}
			}
		}
	}
	[HarmonyPatch(typeof(Action_ModifyStatus), "RunAction")]
	public static class Action_ModifyStatusPatch
	{
		[HarmonyPrefix]
		public static void Prefix(Action_ModifyStatus __instance)
		{
			//IL_0001: 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)
			if ((int)__instance.statusType != 0 || __instance.changeAmount >= 0f)
			{
				return;
			}
			Item item = ((ItemActionBase)__instance).item;
			if (!((Object)(object)item == (Object)null))
			{
				Character character = default(Character);
				if (!item.TryGetFeeder(ref character))
				{
					character = ((ItemActionBase)__instance).character;
				}
				if (ClassManager.GetClass(character) == ClassType.Doctor)
				{
					__instance.changeAmount *= Config.Doctor.BandageMultiplier.Value;
					FloatingTextUI.Instance.Show("医疗精通", Color.cyan);
				}
			}
		}
	}
	[HarmonyPatch(typeof(Action_RestoreHunger), "RunAction")]
	public static class Action_RestoreHungerPatch
	{
		[HarmonyPrefix]
		public static void Prefix(Action_RestoreHunger __instance)
		{
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			Item item = ((ItemActionBase)__instance).item;
			if ((Object)(object)item == (Object)null)
			{
				return;
			}
			Character localCharacter = Character.localCharacter;
			if (!((Object)(object)localCharacter == (Object)null) && ClassManager.IsCook())
			{
				int value = item.GetData<IntItemData>((DataEntryKey)1).Value;
				if (__instance.restorationAmount != 0f && value == 0)
				{
					__instance.restorationAmount *= Config.Cook.RawFoodPenalty.Value;
					FloatingTextUI.Instance.Show("熟食癖", Color.red);
				}
			}
		}
	}
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	public static class ItemWeightPatch
	{
		[HarmonyPostfix]
		public static void Postfix(ref int __result)
		{
			Character localCharacter = Character.localCharacter;
			if (!((Object)(object)localCharacter == (Object)null) && ClassManager.IsLogistician())
			{
				__result -= (int)Config.Logistician.WeightReduction.Value;
			}
		}
	}
}
namespace Silver.Patches.EnterAndLeavePatches
{
	[HarmonyPatch(typeof(Character), "Start")]
	public static class CharacterStartPatch
	{
		[HarmonyPostfix]
		public static void Postfix(Character __instance)
		{
			if ((Object)(object)((MonoBehaviourPun)__instance).photonView == (Object)null || !((MonoBehaviourPun)__instance).photonView.IsMine)
			{
				return;
			}
			if (__instance.inAirport)
			{
				Plugin.Log.LogInfo((object)"[Silver] 检测到本地角色在机场,不进行职业选择。");
				ClassManager.ClearCache();
				return;
			}
			if (ClassManager.HasClass())
			{
				Plugin.Log.LogInfo((object)"[