Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of EliteLevels v1.1.0
plugins/EliteLevels.dll
Decompiled a day ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security.Cryptography; using System.Text; using System.Threading; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using EliteLevels.AI; using EliteLevels.Config; using EliteLevels.Leveling; using EliteLevels.Mutations; using EliteLevels.Mutations.Effects; using EliteLevels.Shared; using EliteLevels.Stats; using HarmonyLib; using TMPro; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("EliteLevels")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("EliteLevels")] [assembly: AssemblyTitle("EliteLevels")] [assembly: AssemblyVersion("1.0.0.0")] namespace EliteLevels { [BepInPlugin("MM94.EliteLevels", "EliteLevels", "1.1.0")] public class Plugin : BaseUnityPlugin { public static ManualLogSource Log; public static Plugin Instance { get; private set; } private void Awake() { Instance = this; Log = ((BaseUnityPlugin)this).Logger; LogBuildInfo(); Lang.Init(); EliteLevelsConfig.Bind(((BaseUnityPlugin)this).Config); ApplyHarmonyPatchesIsolated(); CheckCompatibility(); Log.LogInfo((object)"EliteLevels loaded."); } private void CheckCompatibility() { try { EliteCompatibilityCheck.CheckOnce(); } catch (Exception ex) { Log.LogWarning((object)("[EliteLevels:호환성] 확인 실패 — " + ex.Message)); } } private void ApplyHarmonyPatchesIsolated() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown Harmony val = new Harmony("MM94.EliteLevels"); int num = 0; int num2 = 0; IEnumerable<Type> enumerable = from t in AccessTools.GetTypesFromAssembly(Assembly.GetExecutingAssembly()) where t.GetCustomAttributes(typeof(HarmonyPatch), inherit: false).Length != 0 select t; foreach (Type item in enumerable) { try { val.CreateClassProcessor(item).Patch(); num++; } catch (Exception arg) { num2++; Log.LogError((object)$"[EliteLevels:패치실패] '{item.FullName}' 패치 적용 실패 — 이 기능만 비활성화된 채로 나머지는 계속 진행됨. {arg}"); } } Log.LogInfo((object)$"[EliteLevels:패치요약] 성공 {num}개 / 실패 {num2}개"); } private void LogBuildInfo() { try { string location = Assembly.GetExecutingAssembly().Location; DateTime lastWriteTime = File.GetLastWriteTime(location); string arg; using (MD5 mD = MD5.Create()) { using FileStream inputStream = File.OpenRead(location); byte[] array = mD.ComputeHash(inputStream); arg = BitConverter.ToString(array, 0, 4).Replace("-", ""); } ((BaseUnityPlugin)this).Logger.LogInfo((object)$"[EliteLevels:빌드정보] dll 수정시각={lastWriteTime:yyyy-MM-dd HH:mm:ss}, md5앞8자리={arg}"); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("[EliteLevels:빌드정보] 확인 실패 — " + ex.Message)); } } } internal static class BuildInfo { internal const string Timestamp = "2026-11-24 22:03:36"; } } namespace EliteLevels.Stats { internal static class EliteAttackFrequencyApplier { private static readonly Dictionary<string, float> s_originalMinAttackInterval = new Dictionary<string, float>(); internal static void ApplyMinAttackInterval(Character c, int stars) { MonsterAI component = ((Component)c).GetComponent<MonsterAI>(); if (!((Object)(object)component == (Object)null)) { string prefabName = Utils.GetPrefabName(((Component)c).gameObject); if (!s_originalMinAttackInterval.TryGetValue(prefabName, out var value)) { value = component.m_minAttackInterval; s_originalMinAttackInterval[prefabName] = value; } float num = ComputePercent(stars) / 100f; float num2 = (component.m_minAttackInterval = ((num > 0f) ? (value / (1f + num)) : value)); if (EliteLevelsConfig.DebugLogging.Value && num > 0f && MutationActionLog.TryMarkOnce(c, "AttackFreqMinIntervalApplied")) { Plugin.Log.LogInfo((object)($"[EliteLevels:속도] {MutationActionLog.Label(c)} 공격빈도(최소간격) 적용 (별={stars}, " + $"m_minAttackInterval {value:0.##}s → {num2:0.##}s)")); } } } internal static float ComputePercent(int stars) { float num = EliteLevelsConfig.AttackFrequencyBasePercent.Value + EliteLevelsConfig.AttackFrequencyPerStarPercent.Value * (float)stars; return Mathf.Min(num, EliteLevelsConfig.AttackFrequencyMaxPercent.Value); } } [HarmonyPatch(typeof(Attack), "Start")] internal static class EliteAttackIntervalPatch { [HarmonyPostfix] public static void Postfix(bool __result, Humanoid character, ItemData weapon) { try { if (!__result || weapon?.m_shared == null) { return; } if (character == null || ((Character)character).IsPlayer() || !((Character)character).IsOwner() || !EliteEligibility.IsEligible((Character)(object)character) || AttackIntervalCoordinator.WasJustHandled((Character)(object)character)) { return; } ZNetView component = ((Component)character).GetComponent<ZNetView>(); if ((Object)(object)component == (Object)null || !component.IsValid() || !EliteZdo.TryGetStars(component.GetZDO(), out var stars)) { return; } float num = EliteAttackFrequencyApplier.ComputePercent(stars) / 100f; if (!(num <= 0f)) { float aiAttackInterval = weapon.m_shared.m_aiAttackInterval; float num2 = aiAttackInterval * num / (1f + num); weapon.m_lastAttackTime -= num2; if (EliteLevelsConfig.DebugLogging.Value && MutationActionLog.TryMarkOnce((Character)(object)character, "AttackFreqIntervalApplied")) { Plugin.Log.LogInfo((object)($"[EliteLevels:속도] {MutationActionLog.Label((Character)(object)character)} 공격빈도(쿨다운) 적용 (별={stars}, " + $"대기시간 {aiAttackInterval:0.##}s → 약 {aiAttackInterval / (1f + num):0.##}s)")); } } } catch (Exception arg) { Plugin.Log.LogError((object)$"[EliteLevels:공격빈도 실패] {arg}"); } } } [HarmonyPatch(typeof(Attack), "GetLevelDamageFactor")] internal static class EliteDamagePatch { private static readonly FieldInfo s_characterField = AccessTools.Field(typeof(Attack), "m_character"); [HarmonyPrefix] public static bool Prefix(Attack __instance, ref float __result) { try { object? obj = s_characterField?.GetValue(__instance); Character val = (Character)((obj is Character) ? obj : null); if (!EliteEligibility.IsEligible(val)) { return true; } int num = val.GetLevel() - 1; float num2 = EliteLevelsConfig.BaseDamagePercent.Value / 100f; float num3 = num2 * (1f + (float)num * (EliteLevelsConfig.DamagePerStarPercent.Value / 100f)); if (MutationHelper.GetMutation(val) == MutationType.Berserk && val.GetHealthPercentage() <= EliteLevelsConfig.BerserkHpThresholdPercent.Value / 100f) { num3 *= 1f + EliteLevelsConfig.BerserkDamageBonusPercent.Value / 100f; } __result = num3; return false; } catch (Exception arg) { Plugin.Log.LogError((object)$"[EliteLevels:데미지배율 실패] {arg}"); return true; } } } [HarmonyPatch(typeof(Character), "SetupMaxHealth")] internal static class EliteHealthPatch { [HarmonyPrefix] public static bool Prefix(Character __instance) { try { if (!EliteEligibility.IsEligible(__instance)) { return true; } int num = __instance.GetLevel() - 1; float num2 = EliteLevelsConfig.BaseHealthPercent.Value / 100f; float num3 = 1f + (float)num * (EliteLevelsConfig.HealthPerStarPercent.Value / 100f); float num4 = num2 * num3; __instance.SetMaxHealth(__instance.GetMaxHealthBase() * num4); return false; } catch (Exception arg) { Plugin.Log.LogError((object)$"[EliteLevels:체력배율 실패] '{((__instance != null) ? ((Object)__instance).name : null)}' — {arg}"); return true; } } } internal static class EliteMultiplayerScaleLog { private static int s_logged; internal static void LogOnce(int playerCount, float scale, bool isHealthScale) { if (EliteLevelsConfig.DebugLogging.Value && Interlocked.Exchange(ref s_logged, 1) == 0) { string arg = (isHealthScale ? "체력(받는 피해 감소)" : "데미지"); Plugin.Log.LogInfo((object)("[EliteLevels:멀티보정] 바닐라 플레이어수 보정 비활성화, 이 모드 계산으로 대체 — " + $"인원={playerCount} {arg}배율={scale:F3}")); } } } [HarmonyPatch(typeof(Game), "GetDifficultyDamageScalePlayer")] internal static class EliteMultiplayerScaleDamagePatch { [HarmonyPrefix] public static bool Prefix(Vector3 pos, ref float __result) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) try { if (!EliteLevelsConfig.MultiplayerScalingEnabled.Value) { return true; } int num = EliteMultiplayerScaling.ComputePlayerCount(pos); __result = 1f + (float)(num - 1) * (EliteLevelsConfig.DamageIncreasePerPlayerPercent.Value / 100f); EliteMultiplayerScaleLog.LogOnce(num, __result, isHealthScale: false); return false; } catch (Exception arg) { Plugin.Log.LogError((object)$"[EliteLevels:멀티보정 실패] GetDifficultyDamageScalePlayer — {arg}"); return true; } } } [HarmonyPatch(typeof(Game), "GetDifficultyDamageScaleEnemy")] internal static class EliteMultiplayerScaleHealthPatch { [HarmonyPrefix] public static bool Prefix(Vector3 pos, ref float __result) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) try { if (!EliteLevelsConfig.MultiplayerScalingEnabled.Value) { return true; } int num = EliteMultiplayerScaling.ComputePlayerCount(pos); float num2 = 1f + (float)(num - 1) * (EliteLevelsConfig.HealthIncreasePerPlayerPercent.Value / 100f); __result = 1f / num2; EliteMultiplayerScaleLog.LogOnce(num, num2, isHealthScale: true); return false; } catch (Exception arg) { Plugin.Log.LogError((object)$"[EliteLevels:멀티보정 실패] GetDifficultyDamageScaleEnemy — {arg}"); return true; } } } internal static class EliteMultiplayerScaling { private static readonly FieldInfo s_forcePlayersField = AccessTools.Field(typeof(Game), "m_forcePlayers"); internal static int ComputePlayerCount(Vector3 pos) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) int forcedPlayerCount = GetForcedPlayerCount(); if (forcedPlayerCount > 0) { return forcedPlayerCount; } float value = EliteLevelsConfig.PlayerCountRange.Value; int num = ((value <= 0f) ? Player.GetAllPlayers().Count : Player.GetPlayersInRangeXZ(pos, value)); num += EliteLevelsConfig.ExtraPlayerCount.Value; num = Mathf.Max(num, 1); return Mathf.Clamp(num, EliteLevelsConfig.MinPlayerCount.Value, EliteLevelsConfig.MaxPlayerCount.Value); } private static int GetForcedPlayerCount() { if (s_forcePlayersField == null || (Object)(object)Game.instance == (Object)null) { return 0; } return (int)s_forcePlayersField.GetValue(Game.instance); } } internal static class EliteScaleApplier { internal static void Apply(Character c, int stars) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) float num = EliteLevelsConfig.ScalePerStarPercent.Value / 100f; if (!(num <= 0f) && stars > 0) { float num2 = 1f + num * (float)stars; ((Component)c).transform.localScale = Vector3.one * num2; } } } internal static class EliteSpeedApplier { private static readonly Dictionary<string, (float walk, float run, float swim)> s_originals = new Dictionary<string, (float, float, float)>(); internal static void Apply(Character c, int stars) { string prefabName = Utils.GetPrefabName(((Component)c).gameObject); if (!s_originals.TryGetValue(prefabName, out (float, float, float) value)) { value = (c.m_walkSpeed, c.m_runSpeed, c.m_swimSpeed); s_originals[prefabName] = value; } float num = 1f + ComputeStarPercent(stars) / 100f; float num2 = ((MutationHelper.GetMutation(c) == MutationType.Swift) ? (1f + EliteLevelsConfig.SwiftSpeedBonusPercent.Value / 100f) : 1f); float num3 = num * num2; c.m_walkSpeed = value.Item1 * num3; c.m_runSpeed = value.Item2 * num3; c.m_swimSpeed = value.Item3 * num3; if (EliteLevelsConfig.DebugLogging.Value && MutationActionLog.TryMarkOnce(c, "SpeedApplied")) { Plugin.Log.LogInfo((object)($"[EliteLevels:속도] {MutationActionLog.Label(c)} 이동속도 적용 (별={stars}, 별배율={num:0.##}, " + $"신속배율={num2:0.##} — 걷기 {value.Item1:0.##}→{c.m_walkSpeed:0.##}, " + $"달리기 {value.Item2:0.##}→{c.m_runSpeed:0.##}, 수영 {value.Item3:0.##}→{c.m_swimSpeed:0.##})")); } } internal static float ComputeStarPercent(int stars) { float num = EliteLevelsConfig.MoveSpeedBasePercent.Value + EliteLevelsConfig.MoveSpeedPerStarPercent.Value * (float)stars; return Mathf.Min(num, EliteLevelsConfig.MoveSpeedMaxPercent.Value); } } } namespace EliteLevels.Shared { internal sealed class ConfigurationManagerAttributes { public int? Order; } internal static class EliteAnimatorSpeedCombiner { private class State { internal float Berserk = 1f; internal float FastAttack = 1f; } private static readonly FieldInfo s_characterAnimatorField = AccessTools.Field(typeof(Character), "m_animator"); private static readonly Dictionary<Character, State> s_states = new Dictionary<Character, State>(); internal static void SetBerserk(Character c, float mult) { Set(c, delegate(State st) { st.Berserk = mult; }); } internal static void SetFastAttack(Character c, float mult) { Set(c, delegate(State st) { st.FastAttack = mult; }); } private static void Set(Character c, Action<State> apply) { if (!((Object)(object)c == (Object)null) && !(s_characterAnimatorField == null)) { if (!s_states.TryGetValue(c, out var value)) { value = new State(); s_states[c] = value; } apply(value); object? value2 = s_characterAnimatorField.GetValue(c); Animator val = (Animator)((value2 is Animator) ? value2 : null); if (val != null) { val.speed = value.Berserk * value.FastAttack; } } } internal static void Clear(Character c) { if ((Object)(object)c != (Object)null) { s_states.Remove(c); } } } [HarmonyPatch(typeof(Character), "OnDestroy")] internal static class EliteCharacterCleanupPatch { [HarmonyPostfix] public static void Postfix(Character __instance) { try { MutationHelper.ClearCached(__instance); MutationTimers.Clear(__instance); EliteStealthVisual.Clear(__instance); MutationStealthState.Clear(__instance); MutationGoldenVisual.Clear(__instance); MutationGoldenFleeSetup.Clear(__instance); MutationActionLog.Clear(__instance); EliteAnimatorSpeedCombiner.Clear(__instance); BigMonsterAttackPatterns.Clear(__instance); SmallMonsterAiPatch.Clear(__instance); } catch (Exception arg) { Plugin.Log.LogError((object)$"[EliteLevels:정리실패] {arg}"); } } } internal static class EliteCompatibilityCheck { private static readonly (string Guid, string Name)[] ConflictingMods = new(string, string)[4] { ("org.bepinex.plugins.creaturelevelcontrol", "CLLC(CreatureLevelAndLootControl)"), ("gglasgow.elitecreaturesreborn", "EliteCreaturesReborn"), ("gabdao.dangerousenemies.bigedition", "DangerousEnemies BIG Edition"), ("gabdao.dangerousenemies.SMALLedition", "DangerousEnemies SMALL Edition") }; internal static void CheckOnce() { (string, string)[] conflictingMods = ConflictingMods; for (int i = 0; i < conflictingMods.Length; i++) { var (text, text2) = conflictingMods[i]; if (Chainloader.PluginInfos.ContainsKey(text)) { Plugin.Log.LogWarning((object)("[EliteLevels:호환성] '" + text2 + "'(GUID=" + text + ")가 함께 로드되어 있음 — 별/레벨/변이 계열 기능이 EliteLevels와 겹쳐 충돌할 수 있어 함께 사용하지 않는 것을 권장.")); } } } } [HarmonyPatch(typeof(Terminal), "InitTerminal")] internal static class EliteDebugCommandsPatch { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func<Character, bool> <>9__1_1; public static ConsoleEvent <>9__1_0; public static ConsoleEvent <>9__2_0; public static Func<Character, bool> <>9__3_1; public static ConsoleEvent <>9__3_0; internal void <RegisterMutationInfoCommand>b__1_0(ConsoleEventArgs args) { //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) <>c__DisplayClass1_0 CS$<>8__locals3 = new <>c__DisplayClass1_0 { player = Player.m_localPlayer }; if ((Object)(object)CS$<>8__locals3.player == (Object)null) { args.Context.AddString("[elitelevels_mutation] 플레이어를 찾을 수 없음."); return; } Character val = (from c in Character.GetAllCharacters() where (Object)(object)c != (Object)null && !c.IsPlayer() orderby Vector3.Distance(((Component)c).transform.position, ((Component)CS$<>8__locals3.player).transform.position) select c).FirstOrDefault(); if ((Object)(object)val == (Object)null) { args.Context.AddString("[elitelevels_mutation] 주변에 몬스터가 없음."); return; } int num = val.GetLevel() - 1; MutationType mutation = MutationHelper.GetMutation(val); float num2 = Vector3.Distance(((Component)val).transform.position, ((Component)CS$<>8__locals3.player).transform.position); string text = $"[EliteLevels] 대상={Utils.GetPrefabName(((Component)val).gameObject)} 거리={num2:F1}m " + $"별={num} 변이={MutationHelper.GetDisplayName(mutation)}"; args.Context.AddString(text); Plugin.Log.LogInfo((object)text); float num3 = EliteLevelsConfig.BaseHealthPercent.Value / 100f; float num4 = 1f + (float)num * (EliteLevelsConfig.HealthPerStarPercent.Value / 100f); float num5 = EliteLevelsConfig.BaseDamagePercent.Value / 100f; float num6 = 1f + (float)num * (EliteLevelsConfig.DamagePerStarPercent.Value / 100f); string text2 = $"[EliteLevels] 기본체력배율={num3:F2}x 기본데미지배율={num5:F2}x " + $"최종체력배율={num3 * num4:F2}x 최종데미지배율={num5 * num6:F2}x"; args.Context.AddString(text2); Plugin.Log.LogInfo((object)text2); float num7 = EliteSpeedApplier.ComputeStarPercent(num); float num8 = EliteAttackFrequencyApplier.ComputePercent(num); BigGroupRuntime bigGroupRuntime = BigMonsterGroups.FindGroupFor(val); SmallGroupRuntime smallGroupRuntime = SmallMonsterGroups.FindGroupFor(val); string text3 = ((bigGroupRuntime != null) ? $"대형/{bigGroupRuntime.Group}" : ((smallGroupRuntime != null) ? $"소형/{smallGroupRuntime.Group}" : "없음")); string text4 = $"[EliteLevels] 이동속도배율=+{num7:F1}% 공격빈도배율=+{num8:F1}% " + "공격패턴그룹=" + text3; args.Context.AddString(text4); Plugin.Log.LogInfo((object)text4); } internal bool <RegisterMutationInfoCommand>b__1_1(Character c) { return (Object)(object)c != (Object)null && !c.IsPlayer(); } internal void <RegisterSpawnCommand>b__2_0(ConsoleEventArgs args) { //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0157: 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_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { args.Context.AddString("[elitelevels_spawn] 플레이어를 찾을 수 없음."); return; } if (args.Args.Length < 2) { args.Context.AddString("[elitelevels_spawn] 사용법: elitelevels_spawn <프리팹> [별] [변이]"); return; } string text = args.Args[1]; int num = 1; if (args.Args.Length >= 3 && int.TryParse(args.Args[2], out var result)) { num = Mathf.Max(0, result); } MutationType result2 = MutationType.None; if (args.Args.Length >= 4 && !MutationHelper.TryParseName(args.Args[3], out result2)) { args.Context.AddString("[elitelevels_spawn] 알 수 없는 변이 이름: '" + args.Args[3] + "'"); return; } GameObject val = (((Object)(object)ZNetScene.instance != (Object)null) ? ZNetScene.instance.GetPrefab(text) : null); if ((Object)(object)val == (Object)null) { args.Context.AddString("[elitelevels_spawn] 프리팹을 찾을 수 없음: '" + text + "'"); return; } Vector3 val2 = ((Component)localPlayer).transform.position + ((Component)localPlayer).transform.forward * 3f + Vector3.up * 0.5f; GameObject val3 = Object.Instantiate<GameObject>(val, val2, Quaternion.identity); Character component = val3.GetComponent<Character>(); ZNetView component2 = val3.GetComponent<ZNetView>(); if ((Object)(object)component == (Object)null || (Object)(object)component2 == (Object)null || !component2.IsValid()) { args.Context.AddString("[elitelevels_spawn] '" + text + "'은(는) Character/ZNetView가 없어 별·변이를 적용할 수 없음(소환만 됨)."); return; } ZDO zDO = component2.GetZDO(); EliteZdo.SetStars(zDO, num); EliteZdo.SetMutation(zDO, (int)result2); component.SetLevel(num + 1); string text2 = $"[EliteLevels] 소환 완료 — {text}, 별={num}, 변이={MutationHelper.GetDisplayName(result2)}"; args.Context.AddString(text2); Plugin.Log.LogInfo((object)text2); } internal void <RegisterAttacksCommand>b__3_0(ConsoleEventArgs args) { //IL_033e: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Invalid comparison between Unknown and I4 <>c__DisplayClass3_0 CS$<>8__locals2 = new <>c__DisplayClass3_0 { player = Player.m_localPlayer }; if ((Object)(object)CS$<>8__locals2.player == (Object)null) { args.Context.AddString("[elitelevels_attacks] 플레이어를 찾을 수 없음."); return; } Humanoid val2; Character val3; if (args.Args.Length >= 2) { string text = ResolvePrefabName(args.Args[1]); GameObject val = (((Object)(object)ZNetScene.instance != (Object)null) ? ZNetScene.instance.GetPrefab(text) : null); if ((Object)(object)val == (Object)null) { args.Context.AddString("[elitelevels_attacks] 프리팹을 찾을 수 없음: '" + args.Args[1] + "' (해석된 이름: '" + text + "')"); return; } val2 = val.GetComponent<Humanoid>(); val3 = val.GetComponent<Character>(); } else { val3 = (from c in Character.GetAllCharacters() where (Object)(object)c != (Object)null && !c.IsPlayer() orderby Vector3.Distance(((Component)c).transform.position, ((Component)CS$<>8__locals2.player).transform.position) select c).FirstOrDefault(); val2 = (Humanoid)(((object)((val3 is Humanoid) ? val3 : null)) ?? ((object)((val3 != null) ? ((Component)val3).GetComponent<Humanoid>() : null))); } if ((Object)(object)val3 == (Object)null || (Object)(object)val2 == (Object)null) { args.Context.AddString("[elitelevels_attacks] 대상(또는 Humanoid 컴포넌트)을 찾을 수 없음."); return; } string prefabName = Utils.GetPrefabName(((Component)val3).gameObject); BigGroupRuntime bigGroupRuntime = BigMonsterGroups.FindGroupFor(val3); SmallGroupRuntime smallGroupRuntime = SmallMonsterGroups.FindGroupFor(val3); args.Context.AddString("[elitelevels_attacks] 대상=" + prefabName + " 그룹=" + ((bigGroupRuntime != null) ? ("대형/" + bigGroupRuntime.Group) : ((smallGroupRuntime != null) ? ("소형/" + smallGroupRuntime.Group) : "없음"))); List<ItemData> list = new List<ItemData>(); Inventory inventory = val2.GetInventory(); if (inventory != null) { list.AddRange(inventory.GetAllItems()); } if ((Object)(object)val2.m_unarmedWeapon != (Object)null) { list.Add(val2.m_unarmedWeapon.m_itemData); } foreach (ItemData item in list) { Attack val4 = item?.m_shared?.m_attack; if (val4 == null) { continue; } string arg = "매칭안됨"; if (bigGroupRuntime != null) { if ((int)val4.m_attackType == 2 && bigGroupRuntime.ThrowEntry != null) { arg = "Throw(발사체버킷)"; } else if (bigGroupRuntime.ThrowBucketOnly) { arg = "Melee(근접버킷)"; } else if (bigGroupRuntime.Attacks.ContainsKey(val4.m_attackAnimation ?? "")) { arg = val4.m_attackAnimation; } } string text2 = " 아이템=" + item.m_shared.m_name + " 애니메이션=" + val4.m_attackAnimation + " " + $"타입={val4.m_attackType} 간격={item.m_shared.m_aiAttackInterval:0.##}s " + $"사거리={item.m_shared.m_aiAttackRange:0.##}/{item.m_shared.m_aiAttackRangeMin:0.##} 매칭={arg}"; args.Context.AddString(text2); Plugin.Log.LogInfo((object)("[EliteLevels:attacks] " + text2)); } } internal bool <RegisterAttacksCommand>b__3_1(Character c) { return (Object)(object)c != (Object)null && !c.IsPlayer(); } } [CompilerGenerated] private sealed class <>c__DisplayClass1_0 { public Player player; internal float <RegisterMutationInfoCommand>b__2(Character c) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) return Vector3.Distance(((Component)c).transform.position, ((Component)player).transform.position); } } [CompilerGenerated] private sealed class <>c__DisplayClass3_0 { public Player player; internal float <RegisterAttacksCommand>b__2(Character c) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) return Vector3.Distance(((Component)c).transform.position, ((Component)player).transform.position); } } [HarmonyPostfix] public static void Postfix() { try { RegisterMutationInfoCommand(); RegisterSpawnCommand(); RegisterAttacksCommand(); } catch (Exception arg) { Plugin.Log.LogError((object)$"[EliteLevels:디버그명령등록 실패] {arg}"); } } private static void RegisterMutationInfoCommand() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown object obj = <>c.<>9__1_0; if (obj == null) { ConsoleEvent val = delegate(ConsoleEventArgs args) { //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) Player player = Player.m_localPlayer; if ((Object)(object)player == (Object)null) { args.Context.AddString("[elitelevels_mutation] 플레이어를 찾을 수 없음."); } else { Character val2 = (from c in Character.GetAllCharacters() where (Object)(object)c != (Object)null && !c.IsPlayer() orderby Vector3.Distance(((Component)c).transform.position, ((Component)player).transform.position) select c).FirstOrDefault(); if ((Object)(object)val2 == (Object)null) { args.Context.AddString("[elitelevels_mutation] 주변에 몬스터가 없음."); } else { int num = val2.GetLevel() - 1; MutationType mutation = MutationHelper.GetMutation(val2); float num2 = Vector3.Distance(((Component)val2).transform.position, ((Component)player).transform.position); string text = $"[EliteLevels] 대상={Utils.GetPrefabName(((Component)val2).gameObject)} 거리={num2:F1}m " + $"별={num} 변이={MutationHelper.GetDisplayName(mutation)}"; args.Context.AddString(text); Plugin.Log.LogInfo((object)text); float num3 = EliteLevelsConfig.BaseHealthPercent.Value / 100f; float num4 = 1f + (float)num * (EliteLevelsConfig.HealthPerStarPercent.Value / 100f); float num5 = EliteLevelsConfig.BaseDamagePercent.Value / 100f; float num6 = 1f + (float)num * (EliteLevelsConfig.DamagePerStarPercent.Value / 100f); string text2 = $"[EliteLevels] 기본체력배율={num3:F2}x 기본데미지배율={num5:F2}x " + $"최종체력배율={num3 * num4:F2}x 최종데미지배율={num5 * num6:F2}x"; args.Context.AddString(text2); Plugin.Log.LogInfo((object)text2); float num7 = EliteSpeedApplier.ComputeStarPercent(num); float num8 = EliteAttackFrequencyApplier.ComputePercent(num); BigGroupRuntime bigGroupRuntime = BigMonsterGroups.FindGroupFor(val2); SmallGroupRuntime smallGroupRuntime = SmallMonsterGroups.FindGroupFor(val2); string text3 = ((bigGroupRuntime != null) ? $"대형/{bigGroupRuntime.Group}" : ((smallGroupRuntime != null) ? $"소형/{smallGroupRuntime.Group}" : "없음")); string text4 = $"[EliteLevels] 이동속도배율=+{num7:F1}% 공격빈도배율=+{num8:F1}% " + "공격패턴그룹=" + text3; args.Context.AddString(text4); Plugin.Log.LogInfo((object)text4); } } }; <>c.<>9__1_0 = val; obj = (object)val; } new ConsoleCommand("elitelevels_mutation", "elitelevels_mutation — 가장 가까운 몬스터의 별/변이를 출력.", (ConsoleEvent)obj, false, false, false, false, true, false, (ConsoleOptionsFetcher)null, false, false, false); } private static void RegisterSpawnCommand() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown object obj = <>c.<>9__2_0; if (obj == null) { ConsoleEvent val = delegate(ConsoleEventArgs args) { //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0157: 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_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { args.Context.AddString("[elitelevels_spawn] 플레이어를 찾을 수 없음."); } else if (args.Args.Length < 2) { args.Context.AddString("[elitelevels_spawn] 사용법: elitelevels_spawn <프리팹> [별] [변이]"); } else { string text = args.Args[1]; int num = 1; if (args.Args.Length >= 3 && int.TryParse(args.Args[2], out var result)) { num = Mathf.Max(0, result); } MutationType result2 = MutationType.None; if (args.Args.Length >= 4 && !MutationHelper.TryParseName(args.Args[3], out result2)) { args.Context.AddString("[elitelevels_spawn] 알 수 없는 변이 이름: '" + args.Args[3] + "'"); } else { GameObject val2 = (((Object)(object)ZNetScene.instance != (Object)null) ? ZNetScene.instance.GetPrefab(text) : null); if ((Object)(object)val2 == (Object)null) { args.Context.AddString("[elitelevels_spawn] 프리팹을 찾을 수 없음: '" + text + "'"); } else { Vector3 val3 = ((Component)localPlayer).transform.position + ((Component)localPlayer).transform.forward * 3f + Vector3.up * 0.5f; GameObject val4 = Object.Instantiate<GameObject>(val2, val3, Quaternion.identity); Character component = val4.GetComponent<Character>(); ZNetView component2 = val4.GetComponent<ZNetView>(); if ((Object)(object)component == (Object)null || (Object)(object)component2 == (Object)null || !component2.IsValid()) { args.Context.AddString("[elitelevels_spawn] '" + text + "'은(는) Character/ZNetView가 없어 별·변이를 적용할 수 없음(소환만 됨)."); } else { ZDO zDO = component2.GetZDO(); EliteZdo.SetStars(zDO, num); EliteZdo.SetMutation(zDO, (int)result2); component.SetLevel(num + 1); string text2 = $"[EliteLevels] 소환 완료 — {text}, 별={num}, 변이={MutationHelper.GetDisplayName(result2)}"; args.Context.AddString(text2); Plugin.Log.LogInfo((object)text2); } } } } }; <>c.<>9__2_0 = val; obj = (object)val; } new ConsoleCommand("elitelevels_spawn", "elitelevels_spawn [프리팹] [별] [변이] — 지정한 별/변이를 가진 몬스터를 앞에 소환(테스트용).", (ConsoleEvent)obj, true, false, false, false, true, false, (ConsoleOptionsFetcher)null, false, false, false); } private static void RegisterAttacksCommand() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown object obj = <>c.<>9__3_0; if (obj == null) { ConsoleEvent val = delegate(ConsoleEventArgs args) { //IL_033e: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Invalid comparison between Unknown and I4 Player player = Player.m_localPlayer; if ((Object)(object)player == (Object)null) { args.Context.AddString("[elitelevels_attacks] 플레이어를 찾을 수 없음."); } else { Humanoid val3; Character val4; if (args.Args.Length >= 2) { string text = ResolvePrefabName(args.Args[1]); GameObject val2 = (((Object)(object)ZNetScene.instance != (Object)null) ? ZNetScene.instance.GetPrefab(text) : null); if ((Object)(object)val2 == (Object)null) { args.Context.AddString("[elitelevels_attacks] 프리팹을 찾을 수 없음: '" + args.Args[1] + "' (해석된 이름: '" + text + "')"); return; } val3 = val2.GetComponent<Humanoid>(); val4 = val2.GetComponent<Character>(); } else { val4 = (from c in Character.GetAllCharacters() where (Object)(object)c != (Object)null && !c.IsPlayer() orderby Vector3.Distance(((Component)c).transform.position, ((Component)player).transform.position) select c).FirstOrDefault(); val3 = (Humanoid)(((object)((val4 is Humanoid) ? val4 : null)) ?? ((object)((val4 != null) ? ((Component)val4).GetComponent<Humanoid>() : null))); } if (!((Object)(object)val4 == (Object)null) && !((Object)(object)val3 == (Object)null)) { string prefabName = Utils.GetPrefabName(((Component)val4).gameObject); BigGroupRuntime bigGroupRuntime = BigMonsterGroups.FindGroupFor(val4); SmallGroupRuntime smallGroupRuntime = SmallMonsterGroups.FindGroupFor(val4); args.Context.AddString("[elitelevels_attacks] 대상=" + prefabName + " 그룹=" + ((bigGroupRuntime != null) ? ("대형/" + bigGroupRuntime.Group) : ((smallGroupRuntime != null) ? ("소형/" + smallGroupRuntime.Group) : "없음"))); List<ItemData> list = new List<ItemData>(); Inventory inventory = val3.GetInventory(); if (inventory != null) { list.AddRange(inventory.GetAllItems()); } if ((Object)(object)val3.m_unarmedWeapon != (Object)null) { list.Add(val3.m_unarmedWeapon.m_itemData); } { foreach (ItemData item in list) { Attack val5 = item?.m_shared?.m_attack; if (val5 != null) { string arg = "매칭안됨"; if (bigGroupRuntime != null) { if ((int)val5.m_attackType == 2 && bigGroupRuntime.ThrowEntry != null) { arg = "Throw(발사체버킷)"; } else if (bigGroupRuntime.ThrowBucketOnly) { arg = "Melee(근접버킷)"; } else if (bigGroupRuntime.Attacks.ContainsKey(val5.m_attackAnimation ?? "")) { arg = val5.m_attackAnimation; } } string text2 = " 아이템=" + item.m_shared.m_name + " 애니메이션=" + val5.m_attackAnimation + " " + $"타입={val5.m_attackType} 간격={item.m_shared.m_aiAttackInterval:0.##}s " + $"사거리={item.m_shared.m_aiAttackRange:0.##}/{item.m_shared.m_aiAttackRangeMin:0.##} 매칭={arg}"; args.Context.AddString(text2); Plugin.Log.LogInfo((object)("[EliteLevels:attacks] " + text2)); } } return; } } args.Context.AddString("[elitelevels_attacks] 대상(또는 Humanoid 컴포넌트)을 찾을 수 없음."); } }; <>c.<>9__3_0 = val; obj = (object)val; } new ConsoleCommand("elitelevels_attacks", "elitelevels_attacks [프리팹] — 공격 아이템/애니메이션/대기시간/사거리와 매칭된 설정 그룹을 출력.", (ConsoleEvent)obj, false, false, false, false, true, false, (ConsoleOptionsFetcher)null, false, false, false); } private static string ResolvePrefabName(string input) { BigGroupDefault[] defaults = BigMonsterGroups.Defaults; for (int i = 0; i < defaults.Length; i++) { BigGroupDefault bigGroupDefault = defaults[i]; if (string.Equals(input, bigGroupDefault.SectionLabel, StringComparison.OrdinalIgnoreCase) || string.Equals(input, bigGroupDefault.ConfigLabel, StringComparison.OrdinalIgnoreCase)) { return bigGroupDefault.DefaultPrefabs.Split(new char[1] { ',' })[0].Trim(); } } return input; } } internal enum EliteTargetVerdict { Eligible, Disabled, Player, NotWildCreature, BossExcluded, NpcExcluded, ExcludedPrefabList, InvalidZdo, TamedExcluded, SummonExcluded } internal static class EliteEligibility { private static readonly string[] KnownNpcComponentNames = new string[1] { "RoleplayNpc" }; internal static bool IsEligible(Character c) { return Classify(c) == EliteTargetVerdict.Eligible; } internal static EliteTargetVerdict Classify(Character c) { if ((Object)(object)c == (Object)null) { return EliteTargetVerdict.InvalidZdo; } if (!EliteLevelsConfig.Enabled.Value) { return EliteTargetVerdict.Disabled; } if (c.IsPlayer()) { return EliteTargetVerdict.Player; } if ((Object)(object)((Component)c).GetComponent<BaseAI>() == (Object)null) { return EliteTargetVerdict.NotWildCreature; } ZNetView component = ((Component)c).GetComponent<ZNetView>(); if ((Object)(object)component == (Object)null || !component.IsValid()) { return EliteTargetVerdict.InvalidZdo; } if (IsPlayerSummon(c, component)) { return EliteTargetVerdict.SummonExcluded; } if (c.m_boss && !EliteLevelsConfig.IncludeBosses.Value) { return EliteTargetVerdict.BossExcluded; } if (IsNpc(c)) { return EliteTargetVerdict.NpcExcluded; } if (IsExcludedPrefab(c)) { return EliteTargetVerdict.ExcludedPrefabList; } return EliteTargetVerdict.Eligible; } private static bool IsPlayerSummon(Character c, ZNetView nview) { ZDO zDO = nview.GetZDO(); if (EliteZdo.IsMarkedSummon(zDO)) { return true; } bool flag = IsInsideSpawnAbilityCallStack() || HasSummonNameSuffix(c); if (flag && nview.IsOwner()) { EliteZdo.SetSummonMarker(zDO); } return flag; } private static bool IsInsideSpawnAbilityCallStack() { try { StackTrace stackTrace = new StackTrace(fNeedFileInfo: false); StackFrame[] frames = stackTrace.GetFrames(); if (frames == null) { return false; } StackFrame[] array = frames; foreach (StackFrame stackFrame in array) { Type type = stackFrame.GetMethod()?.DeclaringType; if ((object)type != null && type.FullName != null && type.FullName.IndexOf("SpawnAbility", StringComparison.Ordinal) >= 0) { return true; } } } catch { } return false; } private static bool HasSummonNameSuffix(Character c) { return Utils.GetPrefabName(((Component)c).gameObject)?.EndsWith("_Summoned", StringComparison.OrdinalIgnoreCase) ?? false; } internal static bool IsEligibleForFreshRoll(Character c) { if (Classify(c) != EliteTargetVerdict.Eligible) { return false; } Tameable component = ((Component)c).GetComponent<Tameable>(); if ((Object)(object)component == (Object)null) { return true; } if (component.m_startsTamed) { return EliteLevelsConfig.IncludeTamed.Value; } if (c.IsTamed()) { return false; } return true; } private static bool IsNpc(Character c) { if (!EliteLevelsConfig.ExcludeNpcs.Value) { return false; } string[] knownNpcComponentNames = KnownNpcComponentNames; foreach (string text in knownNpcComponentNames) { if ((Object)(object)((Component)c).gameObject.GetComponent(text) != (Object)null) { return true; } } string value = EliteLevelsConfig.NpcPrefabs.Value; if (string.IsNullOrEmpty(value)) { return false; } string prefabName = Utils.GetPrefabName(((Component)c).gameObject); string[] array = value.Split(new char[1] { ',' }); foreach (string text2 in array) { if (string.Equals(text2.Trim(), prefabName, StringComparison.OrdinalIgnoreCase)) { return true; } } return false; } private static bool IsExcludedPrefab(Character c) { string value = EliteLevelsConfig.ExcludedPrefabs.Value; if (string.IsNullOrEmpty(value)) { return false; } string prefabName = Utils.GetPrefabName(((Component)c).gameObject); string[] array = value.Split(new char[1] { ',' }); foreach (string text in array) { if (string.Equals(text.Trim(), prefabName, StringComparison.OrdinalIgnoreCase)) { return true; } } return false; } } [HarmonyPatch(typeof(Terminal), "InitTerminal")] internal static class EliteInfoCommandPatch { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static ConsoleEvent <>9__3_0; internal void <RegisterCommand>b__3_0(ConsoleEventArgs args) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { args.Context.AddString("[elitelevels_info] 플레이어를 찾을 수 없음."); return; } Vector3 position = ((Component)localPlayer).transform.position; List<string> defeatedBossKeys = EliteLevelDecider.GetDefeatedBossKeys(); string text = $"[EliteLevels] 월드레벨모드={EliteLevelsConfig.WorldLevelMode.Value} 처치보스={defeatedBossKeys.Count}"; string text2 = "[EliteLevels] 센 키 목록: " + ((defeatedBossKeys.Count > 0) ? string.Join(", ", defeatedBossKeys) : "(없음)"); args.Context.AddString(text); args.Context.AddString(text2); Plugin.Log.LogInfo((object)text); Plugin.Log.LogInfo((object)text2); Biome[] displayBiomes = DisplayBiomes; foreach (Biome val in displayBiomes) { (int min, int max) biomeRange = EliteLevelsConfig.GetBiomeRange(val); int item = biomeRange.min; int item2 = biomeRange.max; int num = EliteWorldLevel.Compute(val, position); SortedDictionary<int, float> distribution = EliteStarDistribution.Compute(val, position); string text3 = $"[EliteLevels] 바이옴={val} 월드레벨={num} 별범위=[{item}~{item2}] " + "분포: " + EliteStarDistribution.Format(distribution); args.Context.AddString(text3); Plugin.Log.LogInfo((object)text3); } Biome biome = (Biome)((WorldGenerator.instance == null) ? 1 : ((int)WorldGenerator.instance.GetBiome(position))); int item3 = EliteLevelsConfig.GetBiomeRange(biome).min; string text4; if (!EliteLevelsConfig.MutationsEnabled.Value) { text4 = "[EliteLevels] 변이 시스템 꺼짐."; } else { List<string> list = new List<string>(); if (EliteLevelsConfig.GoldenEnabled.Value) { list.Add(MutationHelper.GetDisplayName(MutationType.Golden)); } if (EliteLevelsConfig.BerserkEnabled.Value) { list.Add(MutationHelper.GetDisplayName(MutationType.Berserk)); } if (EliteLevelsConfig.PiercingEnabled.Value) { list.Add(MutationHelper.GetDisplayName(MutationType.Piercing)); } if (EliteLevelsConfig.SmashEnabled.Value) { list.Add(MutationHelper.GetDisplayName(MutationType.Smash)); } if (EliteLevelsConfig.ArmoredEnabled.Value) { list.Add(MutationHelper.GetDisplayName(MutationType.Armored)); } if (EliteLevelsConfig.UndyingEnabled.Value) { list.Add(MutationHelper.GetDisplayName(MutationType.Undying)); } if (EliteLevelsConfig.RegenerationEnabled.Value) { list.Add(MutationHelper.GetDisplayName(MutationType.Regeneration)); } if (EliteLevelsConfig.StealthEnabled.Value) { list.Add(MutationHelper.GetDisplayName(MutationType.Stealth)); } if (EliteLevelsConfig.SwiftEnabled.Value) { list.Add(MutationHelper.GetDisplayName(MutationType.Swift)); } int num2 = Math.Max(item3, 1); float num3 = MutationDecider.ComputeGeneralChance(num2); text4 = $"[EliteLevels] 황금확률={EliteLevelsConfig.GoldenChance.Value:F1}% " + $"일반변이확률(별{num2}개 기준)={num3:F1}% " + "켜진변이=[" + string.Join(", ", list) + "]"; } args.Context.AddString(text4); Plugin.Log.LogInfo((object)text4); } } private const string CommandName = "elitelevels_info"; private static readonly Biome[] DisplayBiomes; [HarmonyPostfix] public static void Postfix() { try { RegisterCommand(); } catch (Exception arg) { Plugin.Log.LogError((object)$"[EliteLevels:명령등록 실패] {arg}"); } } private static void RegisterCommand() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown object obj = <>c.<>9__3_0; if (obj == null) { ConsoleEvent val = delegate(ConsoleEventArgs args) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { args.Context.AddString("[elitelevels_info] 플레이어를 찾을 수 없음."); } else { Vector3 position = ((Component)localPlayer).transform.position; List<string> defeatedBossKeys = EliteLevelDecider.GetDefeatedBossKeys(); string text = $"[EliteLevels] 월드레벨모드={EliteLevelsConfig.WorldLevelMode.Value} 처치보스={defeatedBossKeys.Count}"; string text2 = "[EliteLevels] 센 키 목록: " + ((defeatedBossKeys.Count > 0) ? string.Join(", ", defeatedBossKeys) : "(없음)"); args.Context.AddString(text); args.Context.AddString(text2); Plugin.Log.LogInfo((object)text); Plugin.Log.LogInfo((object)text2); Biome[] displayBiomes = DisplayBiomes; foreach (Biome val2 in displayBiomes) { (int min, int max) biomeRange = EliteLevelsConfig.GetBiomeRange(val2); int item = biomeRange.min; int item2 = biomeRange.max; int num = EliteWorldLevel.Compute(val2, position); SortedDictionary<int, float> distribution = EliteStarDistribution.Compute(val2, position); string text3 = $"[EliteLevels] 바이옴={val2} 월드레벨={num} 별범위=[{item}~{item2}] " + "분포: " + EliteStarDistribution.Format(distribution); args.Context.AddString(text3); Plugin.Log.LogInfo((object)text3); } Biome biome = (Biome)((WorldGenerator.instance == null) ? 1 : ((int)WorldGenerator.instance.GetBiome(position))); int item3 = EliteLevelsConfig.GetBiomeRange(biome).min; string text4; if (!EliteLevelsConfig.MutationsEnabled.Value) { text4 = "[EliteLevels] 변이 시스템 꺼짐."; } else { List<string> list = new List<string>(); if (EliteLevelsConfig.GoldenEnabled.Value) { list.Add(MutationHelper.GetDisplayName(MutationType.Golden)); } if (EliteLevelsConfig.BerserkEnabled.Value) { list.Add(MutationHelper.GetDisplayName(MutationType.Berserk)); } if (EliteLevelsConfig.PiercingEnabled.Value) { list.Add(MutationHelper.GetDisplayName(MutationType.Piercing)); } if (EliteLevelsConfig.SmashEnabled.Value) { list.Add(MutationHelper.GetDisplayName(MutationType.Smash)); } if (EliteLevelsConfig.ArmoredEnabled.Value) { list.Add(MutationHelper.GetDisplayName(MutationType.Armored)); } if (EliteLevelsConfig.UndyingEnabled.Value) { list.Add(MutationHelper.GetDisplayName(MutationType.Undying)); } if (EliteLevelsConfig.RegenerationEnabled.Value) { list.Add(MutationHelper.GetDisplayName(MutationType.Regeneration)); } if (EliteLevelsConfig.StealthEnabled.Value) { list.Add(MutationHelper.GetDisplayName(MutationType.Stealth)); } if (EliteLevelsConfig.SwiftEnabled.Value) { list.Add(MutationHelper.GetDisplayName(MutationType.Swift)); } int num2 = Math.Max(item3, 1); float num3 = MutationDecider.ComputeGeneralChance(num2); text4 = $"[EliteLevels] 황금확률={EliteLevelsConfig.GoldenChance.Value:F1}% " + $"일반변이확률(별{num2}개 기준)={num3:F1}% " + "켜진변이=[" + string.Join(", ", list) + "]"; } args.Context.AddString(text4); Plugin.Log.LogInfo((object)text4); } }; <>c.<>9__3_0 = val; obj = (object)val; } new ConsoleCommand("elitelevels_info", "elitelevels_info — 월드 레벨 모드/바이옴별 월드 레벨/실제 적용 별 확률을 출력.", (ConsoleEvent)obj, false, false, false, false, true, false, (ConsoleOptionsFetcher)null, false, false, false); Plugin.Log.LogInfo((object)"[EliteLevels] 콘솔 명령 등록 — 'elitelevels_info', devcommands 불필요."); } static EliteInfoCommandPatch() { Biome[] array = new Biome[9]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); DisplayBiomes = (Biome[])(object)array; } } internal static class EliteTargetLog { private static readonly HashSet<string> s_logged = new HashSet<string>(); internal static void LogOnce(Character c, EliteTargetVerdict verdict, int? stars = null) { if (!((Object)(object)c == (Object)null) && EliteLevelsConfig.DebugLogging.Value) { string prefabName = Utils.GetPrefabName(((Component)c).gameObject); if (s_logged.Add(prefabName)) { string text = verdict switch { EliteTargetVerdict.Eligible => "적용", EliteTargetVerdict.BossExcluded => "보스 제외", EliteTargetVerdict.NpcExcluded => "NPC 제외", EliteTargetVerdict.TamedExcluded => "길들임 제외", EliteTargetVerdict.SummonExcluded => "소환수 제외", EliteTargetVerdict.ExcludedPrefabList => "제외 목록", EliteTargetVerdict.Player => "플레이어", EliteTargetVerdict.NotWildCreature => "야생 몬스터 아님(BaseAI 없음)", EliteTargetVerdict.InvalidZdo => "ZDO 없음/무효", EliteTargetVerdict.Disabled => "모드 꺼짐", _ => verdict.ToString(), }; string text2 = (stars.HasValue ? $", 받은 별={stars.Value}" : ""); Plugin.Log.LogInfo((object)("[EliteLevels:대상] prefab=" + prefabName + " 판정=" + text + text2)); } } } } internal static class EliteZdo { private const string StarsKey = "EliteLevels_Stars"; private const string MutationKey = "EliteLevels_Mutation"; private const string UndyingUsedKey = "EliteLevels_UndyingUsed"; private const string StealthHiddenKey = "EliteLevels_StealthHidden"; private const string IsSummonKey = "EliteLevels_IsSummon"; internal static bool TryGetStars(ZDO zdo, out int stars) { stars = zdo.GetInt("EliteLevels_Stars", -1); return stars >= 0; } internal static void SetStars(ZDO zdo, int stars) { zdo.Set("EliteLevels_Stars", stars); } internal static int GetStarsOrFallback(ZDO zdo, int fallback) { int num = zdo.GetInt("EliteLevels_Stars", -1); return (num >= 0) ? num : fallback; } internal static bool TryGetMutation(ZDO zdo, out int mutation) { mutation = zdo.GetInt("EliteLevels_Mutation", -1); return mutation >= 0; } internal static void SetMutation(ZDO zdo, int mutation) { zdo.Set("EliteLevels_Mutation", mutation); } internal static int GetMutationOrNone(ZDO zdo) { int num = zdo.GetInt("EliteLevels_Mutation", -1); return (num >= 0) ? num : 0; } internal static bool IsUndyingUsed(ZDO zdo) { return zdo.GetBool("EliteLevels_UndyingUsed", false); } internal static void SetUndyingUsed(ZDO zdo) { zdo.Set("EliteLevels_UndyingUsed", true); } internal static bool IsStealthHidden(ZDO zdo) { return zdo.GetBool("EliteLevels_StealthHidden", false); } internal static void SetStealthHidden(ZDO zdo, bool hidden) { zdo.Set("EliteLevels_StealthHidden", hidden); } internal static bool IsMarkedSummon(ZDO zdo) { return zdo.GetBool("EliteLevels_IsSummon", false); } internal static void SetSummonMarker(ZDO zdo) { zdo.Set("EliteLevels_IsSummon", true); } internal static void ClearStarsAndMutation(ZDO zdo) { zdo.Set("EliteLevels_Stars", -1); zdo.Set("EliteLevels_Mutation", -1); } } internal static class Lang { internal static bool IsKorean { get; private set; } internal static void Init() { string text = PlayerPrefs.GetString("language", "English"); IsKorean = text == "Korean"; } internal static string T(string ko, string en) { return IsKorean ? ko : en; } } internal static class MutationActionLog { private static readonly Dictionary<Character, HashSet<string>> s_logged = new Dictionary<Character, HashSet<string>>(); internal static bool TryMarkOnce(Character c, string key) { if ((Object)(object)c == (Object)null) { return false; } if (!s_logged.TryGetValue(c, out var value)) { value = new HashSet<string>(); s_logged[c] = value; } return value.Add(key); } internal static string Label(Character c) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)c == (Object)null) { return "(null)"; } return $"{Utils.GetPrefabName(((Component)c).gameObject)}({c.GetZDOID()})"; } internal static void Clear(Character c) { if ((Object)(object)c != (Object)null) { s_logged.Remove(c); } } } internal static class MutationHelper { private static readonly Dictionary<Character, MutationType> s_cache = new Dictionary<Character, MutationType>(); internal static MutationType GetMutation(Character c) { if ((Object)(object)c == (Object)null) { return MutationType.None; } if (s_cache.TryGetValue(c, out var value)) { return value; } ZNetView component = ((Component)c).GetComponent<ZNetView>(); MutationType mutationType = (((Object)(object)component != (Object)null && component.IsValid()) ? ((MutationType)EliteZdo.GetMutationOrNone(component.GetZDO())) : MutationType.None); s_cache[c] = mutationType; return mutationType; } internal static void SetCached(Character c, MutationType m) { if ((Object)(object)c != (Object)null) { s_cache[c] = m; } } internal static void ClearCached(Character c) { if ((Object)(object)c != (Object)null) { s_cache.Remove(c); } } internal static MutationCategory GetCategory(MutationType m) { switch (m) { case MutationType.Berserk: case MutationType.Piercing: case MutationType.Smash: return MutationCategory.Offensive; case MutationType.Armored: case MutationType.Undying: case MutationType.Regeneration: return MutationCategory.Defensive; case MutationType.Stealth: case MutationType.Swift: return MutationCategory.Movement; default: return MutationCategory.Special; } } internal static string GetIconKey(MutationType m) { return m switch { MutationType.Berserk => "berserk", MutationType.Piercing => "piercing", MutationType.Smash => "smash", MutationType.Armored => "armored", MutationType.Undying => "undying", MutationType.Regeneration => "regeneration", MutationType.Stealth => "stealth", MutationType.Swift => "swift", MutationType.Golden => "golden", _ => null, }; } internal static string GetDisplayName(MutationType m) { return m switch { MutationType.Berserk => Lang.T("광폭", "Berserk"), MutationType.Piercing => Lang.T("관통", "Piercing"), MutationType.Smash => Lang.T("강타", "Smash"), MutationType.Armored => Lang.T("장갑", "Armored"), MutationType.Undying => Lang.T("불굴", "Undying"), MutationType.Regeneration => Lang.T("재생", "Regeneration"), MutationType.Stealth => Lang.T("은신", "Stealth"), MutationType.Swift => Lang.T("신속", "Swift"), MutationType.Golden => Lang.T("황금", "Golden"), _ => Lang.T("없음", "None"), }; } internal static bool TryParseName(string input, out MutationType result) { result = MutationType.None; if (string.IsNullOrEmpty(input)) { return false; } switch (input.Trim().ToLowerInvariant()) { case "광폭": case "berserk": result = MutationType.Berserk; return true; case "관통": case "piercing": result = MutationType.Piercing; return true; case "강타": case "smash": result = MutationType.Smash; return true; case "장갑": case "armored": result = MutationType.Armored; return true; case "불굴": case "undying": result = MutationType.Undying; return true; case "재생": case "regeneration": case "regen": result = MutationType.Regeneration; return true; case "은신": case "stealth": result = MutationType.Stealth; return true; case "신속": case "swift": result = MutationType.Swift; return true; case "황금": case "golden": result = MutationType.Golden; return true; case "없음": case "none": result = MutationType.None; return true; default: return false; } } } internal static class MutationTimers { private static readonly Dictionary<Character, float> s_lastHit = new Dictionary<Character, float>(); private static readonly Dictionary<Character, float> s_lastActive = new Dictionary<Character, float>(); private static readonly Dictionary<Character, float> s_invincibleUntil = new Dictionary<Character, float>(); internal static void MarkHit(Character c) { if (!((Object)(object)c == (Object)null)) { s_lastHit[c] = Time.time; s_lastActive[c] = Time.time; } } internal static void MarkActive(Character c) { if ((Object)(object)c != (Object)null) { s_lastActive[c] = Time.time; } } internal static float TimeSinceLastHit(Character c) { float value; return s_lastHit.TryGetValue(c, out value) ? (Time.time - value) : float.MaxValue; } internal static float TimeSinceLastActive(Character c) { float value; return s_lastActive.TryGetValue(c, out value) ? (Time.time - value) : float.MaxValue; } internal static float GetLastHitTime(Character c) { float value; return s_lastHit.TryGetValue(c, out value) ? value : float.NegativeInfinity; } internal static float GetLastActiveTime(Character c) { float value; return s_lastActive.TryGetValue(c, out value) ? value : float.NegativeInfinity; } internal static void SetInvincible(Character c, float seconds) { if ((Object)(object)c != (Object)null) { s_invincibleUntil[c] = Time.time + seconds; } } internal static bool IsInvincible(Character c) { float value; return (Object)(object)c != (Object)null && s_invincibleUntil.TryGetValue(c, out value) && Time.time < value; } internal static void Clear(Character c) { if (!((Object)(object)c == (Object)null)) { s_lastHit.Remove(c); s_lastActive.Remove(c); s_invincibleUntil.Remove(c); } } } internal static class PrefabGroupMatcher { internal static bool Matches(Character c, ConfigEntry<string> prefabsConfig) { return prefabsConfig != null && Matches(c, prefabsConfig.Value); } internal static bool Matches(Character c, string commaSeparatedPrefabs) { if ((Object)(object)c == (Object)null || string.IsNullOrWhiteSpace(commaSeparatedPrefabs)) { return false; } string prefabName = Utils.GetPrefabName(((Component)c).gameObject); string[] array = commaSeparatedPrefabs.Split(new char[1] { ',' }); foreach (string text in array) { if (string.Equals(text.Trim(), prefabName, StringComparison.OrdinalIgnoreCase)) { return true; } } return false; } } } namespace EliteLevels.Mutations { internal static class MutationAssigner { internal static void EnsureAssigned(ZDO zdo, Character c, int stars) { if (EliteZdo.TryGetMutation(zdo, out var mutation)) { MutationHelper.SetCached(c, (MutationType)mutation); } else if (c.IsOwner()) { MutationType mutationType = (MutationEligibility.IsEligible(c, stars) ? MutationDecider.Roll(stars) : MutationType.None); EliteZdo.SetMutation(zdo, (int)mutationType); MutationHelper.SetCached(c, mutationType); if (EliteLevelsConfig.DebugLogging.Value) { Plugin.Log.LogInfo((object)($"[EliteLevels:변이결정] prefab={Utils.GetPrefabName(((Component)c).gameObject)} 별={stars} " + $"변이={mutationType}")); } } } } internal static class MutationDecider { internal static MutationType Roll(int stars) { if (EliteLevelsConfig.GoldenEnabled.Value && Random.Range(0f, 100f) < EliteLevelsConfig.GoldenChance.Value) { return MutationType.Golden; } float num = Mathf.Min(EliteLevelsConfig.MutationBaseChance.Value + (float)stars * EliteLevelsConfig.MutationChancePerStar.Value, EliteLevelsConfig.MutationChanceMax.Value); if (Random.Range(0f, 100f) >= num) { return MutationType.None; } List<MutationType> list = new List<MutationType>(); if (EliteLevelsConfig.BerserkEnabled.Value) { list.Add(MutationType.Berserk); } if (EliteLevelsConfig.PiercingEnabled.Value) { list.Add(MutationType.Piercing); } if (EliteLevelsConfig.SmashEnabled.Value) { list.Add(MutationType.Smash); } if (EliteLevelsConfig.ArmoredEnabled.Value) { list.Add(MutationType.Armored); } if (EliteLevelsConfig.UndyingEnabled.Value) { list.Add(MutationType.Undying); } if (EliteLevelsConfig.RegenerationEnabled.Value) { list.Add(MutationType.Regeneration); } if (EliteLevelsConfig.StealthEnabled.Value) { list.Add(MutationType.Stealth); } if (EliteLevelsConfig.SwiftEnabled.Value) { list.Add(MutationType.Swift); } if (list.Count == 0) { return MutationType.None; } return list[Random.Range(0, list.Count)]; } internal static float ComputeGeneralChance(int stars) { return Mathf.Min(EliteLevelsConfig.MutationBaseChance.Value + (float)stars * EliteLevelsConfig.MutationChancePerStar.Value, EliteLevelsConfig.MutationChanceMax.Value); } } internal static class MutationEligibility { internal static bool IsEligible(Character c, int stars) { if (!EliteLevelsConfig.MutationsEnabled.Value) { return false; } if (stars < 1) { return false; } return EliteEligibility.IsEligible(c); } } internal enum MutationType { None, Berserk, Piercing, Smash, Armored, Undying, Regeneration, Stealth, Swift, Golden } internal enum MutationCategory { Offensive, Defensive, Movement, Special } } namespace EliteLevels.Mutations.Effects { internal static class EliteStealthVisual { private static readonly Dictionary<Character, bool> s_visibleState = new Dictionary<Character, bool>(); internal static void SetVisible(Character c, bool visible) { if (!s_visibleState.TryGetValue(c, out var value) || value != visible) { s_visibleState[c] = visible; Renderer[] componentsInChildren = ((Component)c).GetComponentsInChildren<Renderer>(true); Renderer[] array = componentsInChildren; foreach (Renderer val in array) { val.enabled = visible; } } } internal static bool IsHidden(Character c) { bool value; return s_visibleState.TryGetValue(c, out value) && !value; } internal static void Clear(Character c) { s_visibleState.Remove(c); } } [HarmonyPatch(typeof(Character), "ApplyDamage")] internal static class MutationArmoredPatch { [HarmonyPrefix] public static void Prefix(Character __instance, HitData hit) { try { if (MutationHelper.GetMutation(__instance) == MutationType.Armored && hit != null) { float num = hit.m_damage.m_blunt + hit.m_damage.m_slash + hit.m_damage.m_pierce; float num2 = 1f - EliteLevelsConfig.ArmoredPhysicalReductionPercent.Value / 100f; hit.m_damage.m_blunt *= num2; hit.m_damage.m_slash *= num2; hit.m_damage.m_pierce *= num2; if (EliteLevelsConfig.DebugLogging.Value && MutationActionLog.TryMarkOnce(__instance, "ArmoredApplied")) { float num3 = hit.m_damage.m_blunt + hit.m_damage.m_slash + hit.m_damage.m_pierce; Plugin.Log.LogInfo((object)$"[EliteLevels:장갑] {MutationActionLog.Label(__instance)} 물리 피해 감소 {num:0.##} → {num3:0.##}"); } } } catch (Exception arg) { Plugin.Log.LogError((object)$"[EliteLevels:장갑적용 실패] {arg}"); } } } [HarmonyPatch(typeof(Character), "StartAttack")] internal static class MutationGoldenNoAttackPatch { [HarmonyPrefix] public static bool Prefix(Character __instance) { try { bool flag = !__instance.IsTamed() && MutationHelper.GetMutation(__instance) == MutationType.Golden; if (flag && EliteLevelsConfig.DebugLogging.Value && MutationActionLog.TryMarkOnce(__instance, "GoldenAttackBlocked")) { Plugin.Log.LogInfo((object)("[EliteLevels:황금] " + MutationActionLog.Label(__instance) + " 공격 차단 작동")); } return !flag; } catch (Exception arg) { Plugin.Log.LogError((object)$"[EliteLevels:황금공격차단 실패] {arg}"); return true; } } } [HarmonyPatch(typeof(Humanoid), "StartAttack")] internal static class MutationGoldenNoAttackHumanoidPatch { [HarmonyPrefix] public static bool Prefix(Character __instance) { try { bool flag = !__instance.IsTamed() && MutationHelper.GetMutation(__instance) == MutationType.Golden; if (flag && EliteLevelsConfig.DebugLogging.Value && MutationActionLog.TryMarkOnce(__instance, "GoldenAttackBlocked")) { Plugin.Log.LogInfo((object)("[EliteLevels:황금] " + MutationActionLog.Label(__instance) + " 공격 차단 작동")); } return !flag; } catch (Exception arg) { Plugin.Log.LogError((object)$"[EliteLevels:황금공격차단(Humanoid) 실패] {arg}"); return true; } } } internal static class MutationGoldenFleeSetup { private const float AlwaysFleeHealthThreshold = 2f; private const float AlwaysFleeHurtGateSeconds = 1000000f; private static readonly HashSet<Character> s_applied = new HashSet<Character>(); private static readonly Dictionary<Character, (float flee, float hurt)> s_originalFleeFields = new Dictionary<Character, (float, float)>(); private static readonly Dictionary<string, (float walk, float run, float swim)> s_originalSpeeds = new Dictionary<string, (float, float, float)>(); internal static void Apply(Character c) { if (!s_applied.Add(c)) { return; } MonsterAI component = ((Component)c).GetComponent<MonsterAI>(); if ((Object)(object)component != (Object)null) { float fleeIfLowHealth = component.m_fleeIfLowHealth; float fleeTimeSinceHurt = component.m_fleeTimeSinceHurt; s_originalFleeFields[c] = (fleeIfLowHealth, fleeTimeSinceHurt); component.m_fleeIfLowHealth = 2f; component.m_fleeTimeSinceHurt = 1000000f; if (EliteLevelsConfig.DebugLogging.Value) { Plugin.Log.LogInfo((object)("[EliteLevels:황금] " + MutationActionLog.Label(c) + " 도망 설정 적용 (AI=MonsterAI, " + $"m_fleeIfLowHealth {fleeIfLowHealth:0.##} → {2f:0.##})")); } } else { string text = (((Object)(object)((Component)c).GetComponent<AnimalAI>() != (Object)null) ? "AnimalAI(바닐라 기본 도주 사용)" : (((object)((Component)c).GetComponent<BaseAI>())?.GetType().Name ?? "없음")); if (EliteLevelsConfig.DebugLogging.Value) { Plugin.Log.LogInfo((object)("[EliteLevels:황금] " + MutationActionLog.Label(c) + " 도망 설정 적용 (AI=" + text + ", 필드 변경 없음)")); } } float num = 1f + EliteLevelsConfig.GoldenFleeSpeedBonusPercent.Value / 100f; if (!Mathf.Approximately(num, 1f)) { string prefabName = Utils.GetPrefabName(((Component)c).gameObject); if (!s_originalSpeeds.TryGetValue(prefabName, out (float, float, float) value)) { value = (c.m_walkSpeed, c.m_runSpeed, c.m_swimSpeed); s_originalSpeeds[prefabName] = value; } c.m_walkSpeed = value.Item1 * num; c.m_runSpeed = value.Item2 * num; c.m_swimSpeed = value.Item3 * num; } } internal static void RestoreOnTame(Character c) { MonsterAI component = ((Component)c).GetComponent<MonsterAI>(); if (!((Object)(object)component == (Object)null) && s_originalFleeFields.TryGetValue(c, out (float, float) value)) { (component.m_fleeIfLowHealth, component.m_fleeTimeSinceHurt) = value; if (EliteLevelsConfig.DebugLogging.Value) { Plugin.Log.LogInfo((object)("[EliteLevels:황금] " + MutationActionLog.Label(c) + " 길들여져 도망 설정 원복 " + $"(m_fleeIfLowHealth → {value.Item1:0.##})")); } } } internal static void Clear(Character c) { s_applied.Remove(c); s_originalFleeFields.Remove(c); } } internal static class MutationGoldenVisual { private static readonly string[] ColorPropertyNames = new string[3] { "_Color", "_BaseColor", "_TintColor" }; private static readonly Color GoldTint = new Color(1f, 0.85f, 0.25f, 1f); private static readonly HashSet<Character> s_tinted = new HashSet<Character>(); internal static bool ApplyGoldTint(Character c) { //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) if (!s_tinted.Add(c)) { return true; } try { Renderer[] componentsInChildren = ((Component)c).GetComponentsInChildren<Renderer>(true); bool result = false; Renderer[] array = componentsInChildren; foreach (Renderer val in array) { Material[] materials = val.materials; foreach (Material val2 in materials) { string[] colorPropertyNames = ColorPropertyNames; foreach (string text in colorPropertyNames) { if (val2.HasProperty(text)) { Color color = val2.GetColor(text); val2.SetColor(text, Color.Lerp(color, GoldTint, 0.55f)); result = true; break; } } } } return result; } catch (Exception arg) { Plugin.Log.LogError((object)$"[EliteLevels:황금톤 실패] {arg}"); return false; } } internal static void Clear(Character c) { s_tinted.Remove(c); } } [HarmonyPatch(typeof(Character), "RPC_Damage")] internal static class MutationPiercingContextPatch { internal static float ArmorIgnoreMultiplier = 1f; internal static Character CurrentAttacker; [HarmonyPrefix] public static void Prefix(HitData __1) { ArmorIgnoreMultiplier = 1f; CurrentAttacker = null; try { Character val = ((__1 != null) ? __1.GetAttacker() : null); if ((Object)(object)val != (Object)null && MutationHelper.GetMutation(val) == MutationType.Piercing) { ArmorIgnoreMultiplier = 1f - EliteLevelsConfig.PiercingIgnorePercent.Value / 100f; CurrentAttacker = val; } } catch (Exception arg) { Plugin.Log.LogError((object)$"[EliteLevels:관통컨텍스트 실패] {arg}"); } } [HarmonyPostfix] public static void Postfix() { ArmorIgnoreMultiplier = 1f; CurrentAttacker = null; } } [HarmonyPatch(typeof(DamageTypes), "ApplyArmor", new Type[] { typeof(float) })] internal static class MutationPiercingApplyArmorPatch { [HarmonyPrefix] public static void Prefix(ref float __0) { try { if (MutationPiercingContextPatch.ArmorIgnoreMultiplier < 1f) { float num = __0; __0 *= MutationPiercingContextPatch.ArmorIgnoreMultiplier; Character currentAttacker = MutationPiercingContextPatch.CurrentAttacker; if ((Object)(object)currentAttacker != (Object)null && EliteLevelsConfig.DebugLogging.Value && MutationActionLog.TryMarkOnce(currentAttacker, "PiercingApplied")) { Plugin.Log.LogInfo((object)$"[EliteLevels:관통] {MutationActionLog.Label(currentAttacker)} 방어력 적용 {num:0.##} → {__0:0.##}"); } } } catch (Exception arg) { Plugin.Log.LogError((object)$"[EliteLevels:관통적용 실패] {arg}"); } } } [HarmonyPatch(typeof(Character), "Damage")] internal static class MutationSmashPatch { [HarmonyPrefix] public static void Prefix(HitData hit) { try { Character val = ((hit != null) ? hit.GetAttacker() : null); if (!((Object)(object)val == (Object)null) && MutationHelper.GetMutation(val) == MutationType.Smash) { hit.m_pushForce *= EliteLevelsConfig.SmashKnockbackMultiplier.Value; hit.m_staggerMultiplier *= 1f + EliteLevelsConfig.SmashStaggerBonusPercent.Value / 100f; if (EliteLevelsConfig.DebugLogging.Value && MutationActionLog.TryMarkOnce(val, "SmashApplied")) { Plugin.Log.LogInfo((object)($"[EliteLevels:강타] {MutationActionLog.Label(val)} 적용 (넉백×{EliteLevelsConfig.SmashKnockbackMultiplier.Value:0.##}, " + $"경직+{EliteLevelsConfig.SmashStaggerBonusPercent.Value:0}%)")); } } } catch (Exception arg) { Plugin.Log.LogError((object)$"[EliteLevels:강타적용 실패] {arg}"); } } } internal static class MutationStealthState { private enum Phase { WaitingToHide, Hidden } private class State { internal Phase Phase; internal float PhaseStartTime; } private static readonly Dictionary<Character, State> s_states = new Dictionary<Character, State>(); internal static void Tick(Character c) { //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) if (!c.IsOwner() || c.IsDead()) { return; } ZNetView component = ((Component)c).GetComponent<ZNetView>(); if ((Object)(object)component == (Object)null || !component.IsValid()) { return; } ZDO zDO = component.GetZDO(); if (!s_states.TryGetValue(c, out var value)) { value = new State { Phase = Phase.WaitingToHide, PhaseStartTime = Time.time }; s_states[c] = value; EliteZdo.SetStealthHidden(zDO, hidden: false); } if (value.Phase == Phase.WaitingToHide) { float lastHitTime = MutationTimers.GetLastHitTime(c); if (lastHitTime > value.PhaseStartTime) { value.PhaseStartTime = lastHitTime; } if (Time.time - value.PhaseStartTime >= EliteLevelsConfig.StealthDelaySeconds.Value) { value.Phase = Phase.Hidden; value.PhaseStartTime = Time.time; EliteZdo.SetStealthHidden(zDO, hidden: true); if (EliteLevelsConfig.DebugLogging.Value) { Plugin.Log.LogInfo((object)("[EliteLevels:은신] " + MutationActionLog.Label(c) + " 은신 시작")); } } return; } string text = null; if (Time.time - value.PhaseStartTime >= EliteLevelsConfig.StealthDurationSeconds.Value) { text = "시간 종료"; } if (text == null) { Player closestPlayer = Player.GetClosestPlayer(((Component)c).transform.position, 9999f); if ((Object)(object)closestPlayer != (Object)null && Vector3.Distance(((Component)closestPlayer).transform.position, ((Component)c).transform.position) < EliteLevelsConfig.StealthBreakDistance.Value) { text = $"{EliteLevelsConfig.StealthBreakDistance.Value:0}m 접근"; } } if (text == null && MutationTimers.GetLastHitTime(c) > value.PhaseStartTime) { text = "피격"; } if (text == null && MutationTimers.GetLastActiveTime(c) > value.PhaseStartTime) { text = "공격"; } if (text != null) { value.Phase = Phase.WaitingToHide; value.PhaseStartTime = Time.time; EliteZdo.SetStealthHidden(zDO, hidden: false); if (EliteLevelsConfig.DebugLogging.Value) { Plugin.Log.LogInfo((object)("[EliteLevels:은신] " + MutationActionLog.Label(c) + " 해제 — " + text)); } } } internal static void ApplyVisual(Character c) { ZNetView component = ((Component)c).GetComponent<ZNetView>(); if (!((Object)(object)component == (Object)null) && component.IsValid()) { bool flag = EliteZdo.IsStealthHidden(component.GetZDO()); EliteStealthVisual.SetVisible(c, !flag); } } internal static void Clear(Character c) { s_states.Remove(c); } } [HarmonyPatch(typeof(BaseAI), "UpdateAI")] internal static class MutationTickPatch { private static readonly FieldInfo s_baseAiCharacterField = AccessTools.Field(typeof(BaseAI), "m_character"); [HarmonyPostfix] public static void Postfix(BaseAI __instance, float __0) { try { if (s_baseAiCharacterField == null) { return; } object? value = s_baseAiCharacterField.GetValue(__instance); Character val = (Character)((value is Character) ? value : null); if (!((Object)(object)val == (Object)null)) { MutationType mutation = MutationHelper.GetMutation(val); switch (mutation) { case MutationType.Berserk: TickBerserk(val); break; case MutationType.Regeneration: TickRegeneration(val, __0); break; } if (mutation == MutationType.Stealth) { MutationStealthState.Tick(val); MutationStealthState.ApplyVisual(val); } } } catch (Exception arg) { Plugin.Log.LogError((object)$"[EliteLevels:변이틱 실패] {arg}"); } } private static void TickBerserk(Character c) { bool flag = c.GetHealthPercentage() <= EliteLevelsConfig.BerserkHpThresholdPercent.Value / 100f; float mult = (flag ? (1f + EliteLevelsConfig.BerserkAttackSpeedBonusPercent.Value / 100f) : 1f); EliteAnimatorSpeedCombiner.SetBerserk(c, mult); if (flag && EliteLevelsConfig.DebugLogging.Value && MutationActionLog.TryMarkOnce(c, "BerserkActivated")) { Plugin.Log.LogInfo((object)($"[EliteLevels:광폭] {MutationActionLog.Label(c)} 발동 (체력 {c.GetHealthPercentage() * 100f:0}% <= " + $"임계값 {EliteLevelsConfig.BerserkHpThresholdPercent.Value:0}%)")); } } private static void TickRegeneration(Character c, float dt) { if (c.IsOwner() && !c.IsDead() && !(MutationTimers.TimeSinceLastHit(c) < EliteLevelsConfig.RegenPauseAfterHitSeconds.Value) && !(c.GetHealth() >= c.GetMaxHealth())) { if (EliteLevelsConfig.DebugLogging.Value && MutationActionLog.TryMarkOnce(c, "RegenStarted")) { Plugin.Log.LogInfo((object)$"[EliteLevels:재생] {MutationActionLog.Label(c)} 회복 시작 (초당 {EliteLevelsConfig.RegenPercentPerSecond.Value:0.##}% of 최대체력)"); } float num = c.GetMaxHealth() * (EliteLevelsConfig.RegenPercentPerSecond.Value / 100f) * dt; c.Heal(num, false); } } } [HarmonyPatch(typeof(Character), "ApplyDamage")] internal static class MutationHitTrackingPatch { [HarmonyPostfix] public static void Postfix(Character __instance) { try { MutationTimers.MarkHit(__instance); } catch (Exception arg) { Plugin.Log.LogError((object)$"[EliteLevels:피격기록 실패] {arg}"); } } } [HarmonyPatch(typeof(Character), "StartAttack")] internal static class MutationAttackTrackingPatch { [HarmonyPostfix] public static void Postfix(Character __instance, bool __result) { try { if (__result) { MutationTimers.MarkActive(__instance); } } catch (Exception arg) { Plugin.Log.LogError((object)$"[EliteLevels:공격기록 실패] {arg}"); } } } [HarmonyPatch(typeof(Humanoid), "StartAttack")] internal static class MutationAttackTrackingHumanoidPatch { [HarmonyPostfix] public static void Postfix(Character __instance, bool __result) { try { if (__result) { MutationTimers.MarkActive(__instance); } } catch (Exception arg) { Plugin.Log.LogError((object)$"[EliteLevels:공격기록(Humanoid) 실패] {arg}"); } } } [HarmonyPatch(typeof(Character), "ApplyDamage")] internal static class MutationUndyingPatch { [HarmonyPrefix] public static bool Prefix(Character __instance, HitData hit) { try { if (MutationTimers.IsInvincible(__instance)) { return false; } if (MutationHelper.GetMutation(__instance) != MutationType.Undying) { return true; } if (hit == null) { return true; } ZNetView component = ((Component)__instance).GetComponent<ZNetView>(); if ((Object)(object)component == (Object)null || !component.IsValid()) { return true; } ZDO zDO = component.GetZDO(); if (EliteZdo.IsUndyingUsed(zDO)) { return true; } float num = __instance.GetHealth() - hit.GetTotalDamage(); if (num > 0f) { return true; } EliteZdo.SetUndyingUsed(zDO); __instance.SetHealth(1f); MutationTimers.SetInvincible(__instance, EliteLevelsConfig.UndyingInvincibleSeconds.Value); if (EliteLevelsConfig.DebugLogging.Value) { Plugin.Log.LogInfo((object)("[EliteLevels:불굴] " + MutationActionLog.Label(__instance) + " 발동, 체력 1로 버팀, " + $"{EliteLevelsConfig.UndyingInvincibleSeconds.Value}초 무적")); } return false; } catch (Exception arg) { Plugin.Log.LogError((object)$"[EliteLevels:불굴적용 실패] {arg}"); return true; } } } } namespace EliteLevels.Loot { [HarmonyPatch(typeof(CharacterDrop), "GenerateDropList")] internal static class EliteLootPatch { private static readonly FieldInfo s_characterField = AccessTools.Field(typeof(CharacterDrop), "m_character"); [HarmonyPrefix] public static bool Prefix(CharacterDrop __instance, ref List<KeyValuePair<GameObject, int>> __result) { try { object? obj = s_characterField?.GetValue(__instance); Character val = (Character)((obj is Character) ? obj : null); if (!EliteEligibility.IsEligible(val)) { return true; } int num = val.GetLevel() - 1; float num2 = 1f + (float)num * (EliteLevelsConfig.DropAmountPerStarPercent.Value / 100f); if (MutationHelper.GetMutation(val) == MutationType.Golden) { num2 *= EliteLevelsConfig.GoldenLootMultiplier.Value; } List<KeyValuePair<GameObject, int>> list = new List<KeyValuePair<GameObject, int>>(); foreach (Drop drop in __instance.m_drops) { if ((Object)(object)drop.m_prefab == (Object)null) { continue; } float num3 = drop.m_chance; if (drop.m_levelMultiplier || drop.m_levelMultiplierNotAmount) { num3 *= num2; } if (!(Random.value > num3)) { int num4 = (drop.m_dontScale ? Random.Range(drop.m_amountMin, drop.m_amountMax) : Game.instance.ScaleDrops(drop.m_prefab, drop.m_amountMin, drop.m_amountMax)); if (drop.m_levelMultiplier && !drop.m_levelMultiplierNotAmount) { num4 = Mathf.Max(1, Mathf.RoundToInt((float)num4 * num2)); } if (drop.m_onePerPlayer) { num4 = ZNet.instance.GetNrOfPlayers(); } if (num4 > 100) { num4 = 100; } if (num4 > 0) { list.Add(new KeyValuePair<GameObject, int>(drop.m_prefab, num4)); } } } if (EliteLevelsConfig.DebugLogging.Value) { Plugin.Log.LogInfo((object)($"[EliteLevels:드롭] prefab={Utils.GetPrefabName(((Component)val).gameObject)} 별={num} " + $"배율={num2:F2} 드롭종류={list.Count}개")); } __result = list; return false; } catch (Exception arg) { Plugin.Log.LogError((object)$"[EliteLevels:드롭배율 실패] {arg}"); return true; } } } } namespace EliteLevels.Leveling { [HarmonyPatch(typeof(Terminal), "TryRunCommand")] internal static class EliteConsoleSpawnDetectPatch { private static bool s_isSpawnCommand; internal static bool IsActive => s_isSpawnCommand; [HarmonyPrefix] public static void Prefix(string text) { try { string a = ((text != null) ? text.Split(new char[1] { ' ' })[0] : ""); s_isSpawnCommand = string.Equals(a, "spawn", StringComparison.OrdinalIgnoreCase); } catch { s_isSpawnCommand = false; } } [HarmonyPostfix] public static void Postfix() { s_isSpawnCommand = false; } } [HarmonyPatch(typeof(Character), "SetLevel")] internal static class EliteLevelAssignPatch { [HarmonyPrefix] public static void Prefix(Character __instance, ref int level) { try { EliteTargetVerdict eliteTargetVerdict = EliteEligibility.Classify(__instance); if (eliteTargetVerdict != EliteTargetVerdict.Eligible) { EliteTargetLog.LogOnce(__instance, eliteTargetVerdict); return; } ZDO zDO = ((Component)__instance).GetComponent<ZNetView>().GetZDO(); if (EliteZdo.TryGetStars(zDO, out var stars)) { level = stars + 1; } else { if (!__instance.IsOwner()) { return; } if (EliteConsoleSpawnDetectPatch.IsActive) { int val = Math.Max(0, level - 1); stars = Math.Min(val, 10); EliteZdo.SetStars(zDO, stars); level = stars + 1; if (EliteLevelsConfig.DebugLogging.Value) { Plugin.Log.LogInfo((object)("[EliteLevels:콘솔소환] prefab=" + Utils.GetPrefabName(((Component)__instance).gameObject) + " " + $"입력레벨={level} 적용별={stars}")); } } else { if (!EliteEligibility.IsEligibleForFreshRoll(__instance)) { EliteTargetLog.LogOnce(__instance, EliteTargetVerdict.TamedExcluded); return; } stars = EliteLevelDecider.ComputeStars(__instance); EliteZdo.SetStars(zDO, stars); level = stars + 1; } } EliteTargetLog.LogOnce(__instance, EliteTargetVerdict.Eligible, stars); MutationAssigner.EnsureAssigned(zDO, __instance, stars); } catch (Exception arg) { Plugin.Log.LogError((object)$"[EliteLevels:레벨할당 실패] '{((__instance != null) ? ((Object)__instance).name : null)}' — {arg}"); } } [HarmonyPostfix] public static void Postfix(Character __instance) { try { if (!EliteEligibility.IsEligible(__instance)) { return; } ZDO zDO = ((Component)__instance).GetComponent<ZNetView>().GetZDO(); if (!EliteZdo.TryGetStars(zDO, out var stars)) { return; } EliteScaleApplier.Apply(__instance, stars); EliteSpeedApplier.Apply(__instance, stars); EliteAttackFrequencyApplier.ApplyMinAttackInterval(__instance, stars); MutationType mutation = MutationHelper.GetMutation(__instance); if (mutation == MutationType.Golden) { MutationGoldenVisual.ApplyGoldTint(__instance); if (!__instance.IsTamed()) { MutationGoldenFleeSetup.Apply(__instance); } } } catch (Exception arg) { Plugin.Log.LogError((object)$"[EliteLevels:스케일적용 실패] '{((__instance != null) ? ((Object)__instance).name : null)}' — {arg}"); } } } internal static class EliteLevelDecider { internal static int ComputeStars(Character c) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)c).transform.position; Biome val = (Biome)((WorldGenerator.instance == null) ? 1 : ((int)WorldGenerator.instance.GetBiome(position))); (int min, int max) biomeRange = EliteLevelsConfig.GetBiomeRange(val); int item = biomeRange.min; int item2 = biomeRange.max; int value = EliteLevelsConfig.MaxStars.Value; int num = EliteWorldLevel.Compute(val, position); float[] starChanceTable = EliteLevelsConfig.GetStarChanceTable(num); int num2 = EliteStarChanceTable.Roll(starChanceTable); int num3 = Mathf.Clamp(item + num2, 0, item2); num3 = Mathf.Min(num3, value); EliteWorldLevelLogger.LogIfChanged(); if (EliteLevelsConfig.DebugLogging.Value) { Plugin.Log.LogInfo((object)($"[EliteLevels:결정] prefab={Utils.GetPrefabName(((Component)c).gameObject)} biome={val} " + $"월드레벨={num} 굴림={num2} 범위=[{item}~{item2}] 결정별={num3}")); } return num3; } internal static int CountDefeatedBosses() { return GetDefeatedBossKeys().Count; } internal static List<string> GetDefeatedBossKeys() { List<string> list = new List<string>(); if ((Object)(object)ZoneSystem.instance == (Object)null) { return list; } foreach (string globalKey in ZoneSystem.instance.GetGlobalKeys()) { if (globalKey.StartsWith("defeated_", StringComparison.OrdinalIgnoreCase)) { list.Add(globalKey); } } return list; } } internal static class EliteStarChanceTable { private static readonly HashSet<string> s_warnedOnce = new HashSet<string>(); internal static float[] Parse(string raw, string logLabel) { List<float> list = new List<float>(); if (!string.IsNullOrWhiteSpace(raw)) { string[] array = raw.Split(new char[1] { ',' }); foreach (string text in array) { float result; float item = (float.TryParse(text.Trim(), NumberStyles.Float, CultureInfo.InvariantCulture, out result) ? Mathf.Max(0f, result) : 0f); list.Add(item); } } float num = 0f; foreach (float item2 in list) { num += item2; } if (num > 100f) { if (s_warnedOnce.Add(logLabel)) { Plugin.Log.LogWarning((object)$"[EliteLevels:확률표] '{logLabel}' 합계={num:F1}%가 100%를 넘어 비율대로 정규화함."); } float num2 = 100f / num; for (int j = 0; j < list.Count; j++) { list[j] *= num2; } num = 100f; } float[] array2 = new float[list.Count + 1]; array2[0] = Mathf.Max(0f, 100f - num); for (int k = 0; k < list.Count; k++) { array2[k + 1] = list[k]; } return array2; } internal static int Roll(float[] table) { float num = Random.Range(0f, 100f); float num2 = 0f; for (int i = 0; i < table.Length; i++) { num2 += table[i]; if (num < num2) { return i; } } return table.Length - 1; } } internal static class EliteStarDistribution { internal static SortedDictionary<int, float> Compute(Biome biome, Vector3 pos) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) (int min, int max) biomeRange = EliteLevelsConfig.GetBiomeRange(biome); int item = biomeRange.min; int item2 = biomeRange.max; int value = EliteLevelsConfig.MaxStars.Value; int worldLevel = EliteWorldLevel.Compute(biome, pos); float[] starChanceTable = EliteLevelsConfig.GetStarChanceTable(worldLevel); SortedDictionary<int, float> sortedDictionary = new SortedDictionary<int, float>(); for (int i = 0; i < starChanceTable.Length; i++) { int num = Mathf.Clamp(item + i, 0, item2); num = Mathf.Min(num, value); sortedDictionary.TryGetValue(num, out var value2); sortedDictionary[num] = value2 + starChanceTable[i]; } return sortedDictionary; } internal static string Format(SortedDictionary<int, float> distribution) { List<string> list = new List<string>(); foreach (KeyValuePair<int, float> item in distribution) { list.Add($"{item.Key}성={item.Value:F1}%"); } return string.Join(" ", list); } } [HarmonyPatch(typeof(Character), "Awake")] internal static class EliteStatsReapplyOnAwakePatch { [HarmonyPostfix] public static void Postfix(Character __instance) { try { if (!EliteEligibility.IsEligible(__instance)) { return; } ZNetView component = ((Component)__instance).GetComponent<ZNetView>(); if ((Object)(object)component == (Object)null || !component.IsValid()) { return; } ZDO zDO = component.GetZDO(); if (!EliteZdo.TryGetStars(zDO, out var stars)) { return; } EliteScaleApplier.Apply(__instance, stars); EliteSpeedApplier.Apply(__instance, stars); EliteAttackFrequencyApplier.ApplyMinAttackInterval(__instance, stars); MutationType mutation = MutationHelper.GetMutation(__instance); if (mutation == MutationType.Golden) { MutationGoldenVisual.ApplyGoldTint(__instance); if (!__instance.IsTamed()) { MutationGoldenFleeSetup.Apply(__instance); } } } catch (Exception arg) { Plugin.Log.LogError((object)$"[EliteLevels:재로드재적용 실패] '{((__instance != null) ? ((Object)__instance).name : null)}' — {arg}"); } } } [HarmonyPatch(typeof(Character), "Awake")] internal static class EliteSummonCleanupPatch { [HarmonyPostfix] public static void Postfix(Character __instance) { try { if (EliteEligibility.Classify(__instance) != EliteTargetVerdict.SummonExcluded) { return; } ZNetView component = ((Component)__instance).GetComponent<ZNetView>(); if ((Object)(object)component == (Object)null || !component.IsValid() || !component.IsOwner()) { return; } ZDO zDO = component.GetZDO(); int stars; bool flag = EliteZdo.TryGetStars(zDO, out stars); int mutation; bool flag2 = EliteZdo.TryGetMutation(zDO, out mutation); if (flag || flag2) { EliteZdo.ClearStarsAndMutation(zDO); if (EliteLevelsConfig.DebugLogging.Value) { Plugin.Log.LogInfo((object)("[EliteLevels:대상] prefab=" + Utils.GetPrefabName(((Component)__instance).gameObject) + " " + $"소환수 정리 — 저장된 별={stars}/변이={mutation} 제거")); } } } catch (Exception arg) { Plugin.Log.LogError((object)$"[EliteLevels:소환수정리 실패] '{((__instance != null) ? ((Object)__instance).name : null)}' — {arg}"); } } } [HarmonyPatch(typeof(Tameable), "Tame")] internal static class EliteTamePatch { [HarmonyPostfix] public static void Postfix(Tameable __instance) { try { Character component = ((Component)__instance).GetComponent<Character>(); if ((Object)(object)component == (Object)null || !EliteEligibility.IsEligible(component)) { return; } ZNetView component2 = ((Component)component).GetComponent<ZNetView>(); if (!((Object)(object)component2 == (Object)null) && component2.IsValid()) { ZDO zDO = component2.GetZDO(); int starsOrFallback = EliteZdo.GetStarsOrFallback(zDO, 0); MutationType mutation = MutationHelper.GetMutation(component); string arg = ""; if (mutation == MutationType.Golden) { MutationGoldenFleeSetup.RestoreOnTam