using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using JetBrains.Annotations; using Jotunn.Entities; using Jotunn.Managers; using Jotunn.Utils; using Microsoft.CodeAnalysis; using NazhikaCore.Bosses; using NazhikaCore.Features.Classes; using NazhikaCore.Features.DeathMessages; using NazhikaCore.Patches; using NazhikaCore.RPC; using NazhikaCore.StatusEffects; using NazhikaCore.UI; using NazhikaCore.Utils; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("NazhikaCore")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("NazhikaCore")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("11D23B88-B6B8-482B-9F58-4694D6AD10FC")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace NazhikaCore { [BepInPlugin("com.dreams.nazhikacore", "Nazhika Core", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class MainPlugin : BaseUnityPlugin { private Harmony _harmony; internal static ConfigEntry ClassSkillKey; public static string ModPath { get; private set; } private void Awake() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) _harmony = new Harmony("com.dreams.nazhikacore"); Log.Init(((BaseUnityPlugin)this).Logger); ModPath = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[NazhikaCore] ModPath = " + ModPath)); ClassSkillKey = ((BaseUnityPlugin)this).Config.Bind("Keybinds", "ClassSkillKey", new KeyboardShortcut((KeyCode)57, Array.Empty()), "Tecla para activar la habilidad de clase."); SkillsUI.Init(_harmony); AdrenalinePatch.Init(_harmony); LoginClasses.Init(_harmony); OrbsUI.Init(_harmony); TankAi.Init(_harmony); FistBjornClawRecipePatch.Init(_harmony); SE_BleedingSetup.Init(); SE_FatigueSetup.Init(); SE_CurseSetup.Init(); SE_BlindnessSetup.Init(); SE_OrbGaugeSetup.Init(); SE_ParryRegenSetup.Init(); SE_PassiveAtkSpeedSetup.Init(); SE_WarcrySetup.Init(); SE_TankPassiveSetup.Init(); SE_SwordLightningSetup.Init(); SE_SwordPoisonSetup.Init(); SE_SwordWitherSetup.Init(); SE_SpearStacksSetup.Init(); SE_BloodBurstSetup.Init(); SE_BerserkfurySetup.Init(); SE_BerserkBurstSetup.Init(); SE_BerserkerGodSetup.Init(); SE_BerserkerGodCooldownSetup.Init(); SE_FocusShotSetup.Init(); SE_LightningStormSetup.Init(); SE_MagicRootsSetup.Init(); SE_ToxicCloudSetup.Init(); SE_LavaRocksSetup.Init(); BerserkerPatches.Init(_harmony); BalanceConfig.Init(((BaseUnityPlugin)this).Config); ClassSkillsPatches.Init(_harmony); LightningStorm_BlockAttackPatch.Init(_harmony); Monk_KiPatches.Init(_harmony); FatiguePatch.Init(_harmony); ArcherCritPatches.Init(_harmony); SwordLightningRPC.Init(_harmony); SwordPoisonRPC.Init(_harmony); SwordWitherRPC.Init(_harmony); WarcryRPC.Init(_harmony); BerserkBurstRPC.Init(_harmony); MonkLeapSkill.Init(_harmony); MonkChiReleaseSkill.Init(_harmony); MonkLeapPatches.Init(_harmony); BleedingPopupRPC.Init(_harmony); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[NazhikaCore] ANTES de BloodBurstNet.Init"); BloodBurstNet.Init(_harmony); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[NazhikaCore] DESPUES de BloodBurstNet.Init"); ClearStatusEffectsRPC.Init(_harmony); Player_CheerEmoteRPC.Init(_harmony); Player_ToxicCloudRPC.Init(_harmony); EikthyrBoss.Init(_harmony, ((BaseUnityPlugin)this).Config, ((BaseUnityPlugin)this).Logger); SelectorClass.Init(); ClearEffects.Init(); ShoutDeath.Init(((BaseUnityPlugin)this).Config, _harmony, ((BaseUnityPlugin)this).Logger); ClassSpriteLoader.ImageFolder = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "Images"); GUIManager.OnCustomGUIAvailable += ClassSelectionUI.Instance.OnGUIAvailable; PrefabManager.OnVanillaPrefabsAvailable += delegate { GameObject prefab = PrefabManager.Instance.GetPrefab("Custom_Magetable_Ext_1"); if ((Object)(object)prefab != (Object)null && (Object)(object)prefab.GetComponent() == (Object)null) { prefab.AddComponent(); } }; ((BaseUnityPlugin)this).Logger.LogInfo((object)"✅ NazhikaCore inicializado correctamente."); } private void Update() { ClassManager.Update(); MonkLeapSkill.EnsureRpcRegistered(); } private void OnDestroy() { Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } ((BaseUnityPlugin)this).Logger.LogInfo((object)"\ud83d\uded1 NazhikaCore descargado y parches removidos."); } } } namespace NazhikaCore.Utils { public static class EmotesNet { public static void PlayCheer(Player player) { if (!((Object)(object)((Character)(player?)).m_nview == (Object)null) && ((Character)player).m_nview.IsValid()) { ((Character)player).m_nview.InvokeRPC(ZNetView.Everybody, "RPC_Nazhika_PlayCheer", Array.Empty()); } } } public static class IconHelper { public static Sprite Load(string fileName) { string text = Path.Combine(MainPlugin.ModPath, "NazhikaCore", "Assets", "Icons"); string text2 = Path.Combine(text, fileName); Debug.Log((object)("[NazhikaCore.IconHelper] Buscando ícono en: " + text)); if (!File.Exists(text2)) { return null; } Sprite val = AssetUtils.LoadSpriteFromFile(text2); if ((Object)(object)val != (Object)null) { Debug.Log((object)("[NazhikaCore.IconHelper] ✅ Ícono cargado: " + fileName)); } else { Debug.LogWarning((object)("[NazhikaCore.IconHelper] ⚠\ufe0f Error al cargar sprite desde: " + text2)); } return val; } } public static class Log { private static ManualLogSource _logger; public static void Init(ManualLogSource logger) { _logger = logger; } public static void Info(string message) { _logger.LogInfo((object)message); } public static void Warning(string message) { _logger.LogWarning((object)message); } public static void Error(string message) { _logger.LogError((object)message); } } } namespace NazhikaCore.StatusEffects { public class SE_BerserkBurst : StatusEffect { [CompilerGenerated] private sealed class d__22 : IEnumerable, IEnumerable, IEnumerator, IDisposable, IEnumerator { private int <>1__state; private ItemData <>2__current; private int <>l__initialThreadId; private Player p; public Player <>3__p; ItemData IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__22(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = ((Humanoid)p).GetCurrentWeapon(); <>1__state = 1; return true; case 1: <>1__state = -1; <>2__current = ((Humanoid)p).GetRightItem(); <>1__state = 2; return true; case 2: <>1__state = -1; <>2__current = ((Humanoid)p).GetLeftItem(); <>1__state = 3; return true; case 3: <>1__state = -1; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { d__22 d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; d__ = this; } else { d__ = new d__22(0); } d__.p = <>3__p; return d__; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)this).GetEnumerator(); } } public static readonly int NameHash = StringExtensionMethods.GetStableHashCode("SE_BerserkBurst"); public static float BurstDuration = 20f; private Character m_char; private const string FuryKey = "naz_fury"; private const string BurstCooldownUntilKey = "naz_berserkburst_cd_until"; private bool _fxApplied; private bool _fxTried; private float _waitTimeout = 3f; private readonly List _spawnedRight = new List(); private readonly List _spawnedLeft = new List(); private const string RightHandPath = "Visual/Armature/Hips/Spine/Spine1/Spine2/RightShoulder/RightArm/RightForeArm/RightHand/RightHand_Attach/attach(Clone)"; private const string LeftHandPath = "Visual/Armature/Hips/Spine/Spine1/Spine2/LeftShoulder/LeftArm/LeftForeArm/LeftHand/LeftHand_Attach/attach(Clone)"; public static float DamageMult => BalanceConfig.BerserkDamageMult; public SE_BerserkBurst() { ((Object)this).name = "SE_BerserkBurst"; base.m_name = "Berserker Burst"; base.m_icon = IconHelper.Load("BerserkerBurst.png"); base.m_tooltip = $"Aumento de daño temporal (x{DamageMult:0.00})."; base.m_ttl = BurstDuration; } public override void Setup(Character character) { ((StatusEffect)this).Setup(character); m_char = character; _fxApplied = false; _fxTried = false; _waitTimeout = 3f; _spawnedRight.Clear(); _spawnedLeft.Clear(); Player val = (Player)(object)((character is Player) ? character : null); if (val != null && (Object)(object)((Character)val).m_nview != (Object)null && ((Character)val).m_nview.IsValid()) { ZDO zDO = ((Character)val).m_nview.GetZDO(); if (zDO != null) { zDO.Set("naz_fury", 0f); } } Player val2 = (Player)(object)((character is Player) ? character : null); if (val2 != null) { BerserkBurstRPC.ApplyFromStatus(val2, active: true); BerserkBurstRPC.BroadcastActivated(val2); } } public override void UpdateStatusEffect(float dt) { ((StatusEffect)this).UpdateStatusEffect(dt); Character @char = m_char; Player val = (Player)(object)((@char is Player) ? @char : null); if ((Object)(object)val != (Object)null && (Object)(object)((Character)val).m_nview != (Object)null && ((Character)val).m_nview.IsValid()) { ZDO zDO = ((Character)val).m_nview.GetZDO(); if (zDO != null && zDO.GetFloat("naz_fury", 0f) > 0f) { zDO.Set("naz_fury", 0f); } } Character char2 = m_char; Player val2 = (Player)(object)((char2 is Player) ? char2 : null); if ((Object)(object)val2 == (Object)null || (Object)(object)Player.m_localPlayer != (Object)(object)val2 || _fxApplied || (_fxTried && _waitTimeout <= 0f)) { return; } if ((Object)(object)ObjectDB.instance == (Object)null) { _waitTimeout -= dt; } else if (!TryApplyAxeFX(val2)) { _waitTimeout -= dt; if (_waitTimeout <= 0f) { _fxTried = true; } } } public override void Stop() { ((StatusEffect)this).Stop(); Character @char = m_char; Player val = (Player)(object)((@char is Player) ? @char : null); if ((Object)(object)val != (Object)null) { BerserkBurstRPC.ApplyFromStatus(val, active: false); } CleanupAxeFX(); if ((Object)(object)val != (Object)null && (Object)(object)((Character)val).m_nview != (Object)null && ((Character)val).m_nview.IsValid() && ((Character)val).m_nview.GetZDO() != null && (Object)(object)ZNet.instance != (Object)null) { ZDO zDO = ((Character)val).m_nview.GetZDO(); zDO.Set("naz_fury", 0f); float num = (float)ZNet.instance.GetTimeSeconds(); zDO.Set("naz_berserkburst_cd_until", num + 20f); } if ((Object)(object)val != (Object)null && !((Character)val).IsDead()) { SEMan sEMan = ((Character)val).GetSEMan(); if (sEMan != null && (Object)(object)sEMan.GetStatusEffect(SE_Berserkfury.NameHash) == (Object)null) { sEMan.AddStatusEffect(SE_Berserkfury.NameHash, false, 0, 0f); } if ((Object)(object)Player.m_localPlayer == (Object)(object)val) { SkillsUI.StartCooldown(20f); } } } private bool TryApplyAxeFX(Player player) { //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) string itemName; bool flag = TryFindOneHandedAxe(player, out itemName); string itemName2; bool flag2 = !flag && TryFindTwoHandedAxe(player, out itemName2); if (!flag && !flag2) { _fxTried = true; return false; } HashSet hashSet = new HashSet(StringComparer.OrdinalIgnoreCase) { "nihoggrAxe", "Viking_Axe", "collider" }; string text; bool flag3; bool flag4; if (flag) { text = "teq_nihoggr_axe"; flag3 = true; flag4 = true; } else { text = "teq_skoll_battleaxe"; flag3 = true; flag4 = false; hashSet.Add("LeviathanAxe"); } GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(text); if ((Object)(object)itemPrefab == (Object)null) { return false; } Transform val = itemPrefab.transform.Find("attach"); if ((Object)(object)val == (Object)null) { return false; } Transform val2 = (flag3 ? ((Component)player).transform.Find("Visual/Armature/Hips/Spine/Spine1/Spine2/RightShoulder/RightArm/RightForeArm/RightHand/RightHand_Attach/attach(Clone)") : null); Transform val3 = (flag4 ? ((Component)player).transform.Find("Visual/Armature/Hips/Spine/Spine1/Spine2/LeftShoulder/LeftArm/LeftForeArm/LeftHand/LeftHand_Attach/attach(Clone)") : null); if (flag3 && (Object)(object)val2 == (Object)null) { return false; } if (flag4 && (Object)(object)val3 == (Object)null) { return false; } int num = 0; int num2 = 0; for (int i = 0; i < val.childCount; i++) { Transform child = val.GetChild(i); if (!hashSet.Contains(((Object)child).name)) { if ((Object)(object)val2 != (Object)null) { GameObject val4 = Object.Instantiate(((Component)child).gameObject, val2); ((Object)val4).name = ((Object)child).name; val4.transform.localPosition = child.localPosition; val4.transform.localRotation = child.localRotation; val4.transform.localScale = child.localScale; ForceActivateHierarchy(val4); _spawnedRight.Add(val4); num++; } if ((Object)(object)val3 != (Object)null) { GameObject val5 = Object.Instantiate(((Component)child).gameObject, val3); ((Object)val5).name = ((Object)child).name; val5.transform.localPosition = child.localPosition; val5.transform.localRotation = child.localRotation; val5.transform.localScale = child.localScale; ForceActivateHierarchy(val5); _spawnedLeft.Add(val5); num2++; } } } _fxApplied = num + num2 > 0; _fxTried = true; return _fxApplied; } private void CleanupAxeFX() { _fxApplied = false; SafeCleanup(_spawnedRight); SafeCleanup(_spawnedLeft); _spawnedRight.Clear(); _spawnedLeft.Clear(); } private static bool TryFindOneHandedAxe(Player p, out string itemName) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Invalid comparison between Unknown and I4 //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Invalid comparison between Unknown and I4 itemName = null; foreach (ItemData candidateItem in GetCandidateItems(p)) { if (candidateItem?.m_shared != null && (int)candidateItem.m_shared.m_skillType == 7 && (int)candidateItem.m_shared.m_itemType == 3) { itemName = candidateItem.m_shared.m_name; return true; } } return false; } private static bool TryFindTwoHandedAxe(Player p, out string itemName) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Invalid comparison between Unknown and I4 //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Invalid comparison between Unknown and I4 itemName = null; foreach (ItemData candidateItem in GetCandidateItems(p)) { if (candidateItem?.m_shared != null && (int)candidateItem.m_shared.m_skillType == 7 && (int)candidateItem.m_shared.m_itemType == 14) { itemName = candidateItem.m_shared.m_name; return true; } } return false; } [IteratorStateMachine(typeof(d__22))] private static IEnumerable GetCandidateItems(Player p) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__22(-2) { <>3__p = p }; } private static void ForceActivateHierarchy(GameObject root) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)root == (Object)null)) { SetActiveRecursive(root.transform, active: true); ParticleSystem[] componentsInChildren = root.GetComponentsInChildren(true); foreach (ParticleSystem val in componentsInChildren) { EmissionModule emission = val.emission; ((EmissionModule)(ref emission)).enabled = true; val.Clear(true); val.Play(true); } TrailRenderer[] componentsInChildren2 = root.GetComponentsInChildren(true); for (int j = 0; j < componentsInChildren2.Length; j++) { ((Renderer)componentsInChildren2[j]).enabled = true; componentsInChildren2[j].Clear(); } LineRenderer[] componentsInChildren3 = root.GetComponentsInChildren(true); for (int k = 0; k < componentsInChildren3.Length; k++) { ((Renderer)componentsInChildren3[k]).enabled = true; } Light[] componentsInChildren4 = root.GetComponentsInChildren(true); for (int l = 0; l < componentsInChildren4.Length; l++) { ((Behaviour)componentsInChildren4[l]).enabled = true; } } } private static void SetActiveRecursive(Transform t, bool active) { ((Component)t).gameObject.SetActive(active); for (int i = 0; i < t.childCount; i++) { SetActiveRecursive(t.GetChild(i), active); } } private static int SafeCleanup(List list) { int num = 0; for (int i = 0; i < list.Count; i++) { if ((Object)(object)list[i] != (Object)null) { Object.Destroy((Object)(object)list[i]); num++; } } list.Clear(); return num; } } public static class SE_BerserkBurstSetup { private static bool _asmRegistered; public static void Init() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown SE_BerserkBurst sE_BerserkBurst = ScriptableObject.CreateInstance(); CustomStatusEffect val = new CustomStatusEffect((StatusEffect)(object)sE_BerserkBurst, true); ItemManager.Instance.AddStatusEffect(val); Log.Info("[NazhikaCore] ✅ SE_BerserkBurst registrado (usa BerserkBurstRPC para FX+SFX+Roar)."); if (_asmRegistered) { return; } _asmRegistered = true; AnimationSpeedManager.Add(delegate(Character character, double speed) { Player val2 = (Player)(object)((character is Player) ? character : null); if ((Object)(object)val2 == (Object)null) { return speed; } if (!ClassApi.HasClass(val2, "Berserker")) { return speed; } if (!((Character)val2).InAttack() || ((Humanoid)val2).m_currentAttack == null) { return speed; } SEMan sEMan = ((Character)val2).GetSEMan(); return (sEMan == null || (Object)(object)sEMan.GetStatusEffect(SE_BerserkBurst.NameHash) == (Object)null) ? speed : (speed * (double)BalanceConfig.BerserkAtkSpeedMult); }); } } public class SE_BerserkerGod : StatusEffect { public static readonly int NameHash = StringExtensionMethods.GetStableHashCode("SE_BerserkerGod"); public const string FuryBlockZdoKey = "naz_fury_block"; public const string GodCdZdoKey = "naz_bg_cd_until"; private const float CooldownSeconds = 60f; public SE_BerserkerGod() { //IL_005a: Unknown result type (might be due to invalid IL or missing references) ((Object)this).name = "SE_BerserkerGod"; base.m_name = "Berserker God"; base.m_icon = IconHelper.Load("BerserkerGod.png"); base.m_tooltip = "Invulnerable por 8s"; base.m_ttl = 8f; base.m_cooldown = 60f; base.m_startMessage = "† Berserker God activado †"; base.m_startMessageType = (MessageType)2; } public override void Setup(Character character) { ((StatusEffect)this).Setup(character); try { ZDO val = (((Object)(object)base.m_character != (Object)null && (Object)(object)base.m_character.m_nview != (Object)null) ? base.m_character.m_nview.GetZDO() : null); if (val != null) { val.Set("naz_fury_block", true); } } catch { } } public override void Stop() { try { ZDO val = (((Object)(object)base.m_character != (Object)null && (Object)(object)base.m_character.m_nview != (Object)null) ? base.m_character.m_nview.GetZDO() : null); if (val != null) { val.Set("naz_fury_block", false); } Character character = base.m_character; SEMan val2 = ((character != null) ? character.GetSEMan() : null); if (val2 != null && (Object)(object)val2.GetStatusEffect(SE_BerserkerGodCooldown.NameHash) == (Object)null) { SE_BerserkerGodCooldown sE_BerserkerGodCooldown = val2.AddStatusEffect(SE_BerserkerGodCooldown.NameHash, false, 0, 0f) as SE_BerserkerGodCooldown; if ((Object)(object)sE_BerserkerGodCooldown != (Object)null) { sE_BerserkerGodCooldown.SetDuration(60f); } } float num = (((Object)(object)EnvMan.instance != (Object)null) ? ((float)EnvMan.instance.m_totalSeconds) : Time.time); if (val != null) { val.Set("naz_bg_cd_until", num + 60f); } } catch { } ((StatusEffect)this).Stop(); } } public static class SE_BerserkerGodSetup { public static void Init() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown SE_BerserkerGod sE_BerserkerGod = ScriptableObject.CreateInstance(); CustomStatusEffect val = new CustomStatusEffect((StatusEffect)(object)sE_BerserkerGod, true); ItemManager.Instance.AddStatusEffect(val); Debug.Log((object)"[NazhikaCore] ✅ SE_BerserkerGod registrado."); } } public class SE_BerserkerGodCooldown : StatusEffect { public const string InternalName = "SE_BerserkerGodCooldown"; public static readonly int NameHash = StringExtensionMethods.GetStableHashCode("SE_BerserkerGodCooldown"); public SE_BerserkerGodCooldown() { ((Object)this).name = "SE_BerserkerGodCooldown"; base.m_name = "God"; base.m_tooltip = "En recarga..."; base.m_ttl = 60f; base.m_cooldownIcon = true; base.m_icon = IconHelper.Load("BerserkerGod.png"); } public void SetDuration(float seconds) { base.m_ttl = Mathf.Max(0.1f, seconds); } public override void UpdateStatusEffect(float dt) { ((StatusEffect)this).UpdateStatusEffect(dt); float num = Mathf.Max(0f, base.m_ttl - base.m_time); base.m_tooltip = $"En recarga ({num:0}s)"; } } public static class SE_BerserkerGodCooldownSetup { public static void Init() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown SE_BerserkerGodCooldown sE_BerserkerGodCooldown = ScriptableObject.CreateInstance(); CustomStatusEffect val = new CustomStatusEffect((StatusEffect)(object)sE_BerserkerGodCooldown, true); ItemManager.Instance.AddStatusEffect(val); Debug.Log((object)"[NazhikaCore] ✅ SE_BerserkerGodCooldown registrado."); } } public class SE_Berserkfury : StatusEffect { public static readonly int NameHash = StringExtensionMethods.GetStableHashCode("SE_Berserkfury"); private const string FuryKey = "naz_fury"; public SE_Berserkfury() { ((Object)this).name = "SE_Berserkfury"; base.m_name = "Berserker Fury"; base.m_icon = IconHelper.Load("BerserkerFury.png"); base.m_tooltip = "La furia se carga al golpear."; base.m_ttl = 999999f; } public override string GetIconText() { Character character = base.m_character; object obj; if (character == null) { obj = null; } else { ZNetView nview = character.m_nview; obj = ((nview != null) ? nview.GetZDO() : null); } ZDO val = (ZDO)obj; if (val == null) { return ""; } float @float = val.GetFloat("naz_fury", 0f); if (!(@float > 0f)) { return ""; } return ((int)@float).ToString(); } } public static class SE_BerserkfurySetup { public static void Init() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown SE_Berserkfury sE_Berserkfury = ScriptableObject.CreateInstance(); CustomStatusEffect val = new CustomStatusEffect((StatusEffect)(object)sE_Berserkfury, true); ItemManager.Instance.AddStatusEffect(val); Log.Info("[NazhikaCore] ✅ SE_Berserkfury registrado (marcador)."); } } public class SE_Bleeding : StatusEffect { public static readonly int NameHash = StringExtensionMethods.GetStableHashCode("SE_Bleeding"); private float tickTimer; private float fxTimer; private const float BaseHpCap = 10000f; private const float MoveSpeedMultiplier = 0.95f; internal const string ZdoBleedStacksKey = "nz_bleed_stacks"; private int _stacks = 1; public int Stacks => _stacks; public SE_Bleeding() { ((Object)this).name = "SE_Bleeding"; base.m_name = "Bleeding"; base.m_tooltip = "Estás sangrando: pierdes vida cada segundo."; base.m_icon = IconHelper.Load("bleed.png"); base.m_ttl = 5f; } public override void Setup(Character c) { ((StatusEffect)this).Setup(c); if (_stacks <= 0) { _stacks = 1; } _stacks = Mathf.Clamp(_stacks, 1, BalanceConfig.BleedMaxStacks); tickTimer = 0f; fxTimer = 0f; WriteStacksToZdo(_stacks); ApplyBleedTick(); } public override void ModifySpeed(float baseSpeed, ref float speed, Character character, Vector3 dir) { speed *= 0.95f; } public override void UpdateStatusEffect(float dt) { ((StatusEffect)this).UpdateStatusEffect(dt); tickTimer += dt; fxTimer += dt; if (tickTimer >= BalanceConfig.BleedTickInterval) { tickTimer = 0f; ApplyBleedTick(); } if (fxTimer >= 1f) { fxTimer = 0f; SpawnBloodFXSafe(); } base.m_tooltip = $"Estás sangrando ({_stacks} stack(s)): el daño por tick se duplica a {BalanceConfig.BleedMaxStacks} stacks. " + "Movimiento -5% (no afecta ataque)."; } public void AddBleedStack() { _stacks = Mathf.Clamp(_stacks + 1, 1, BalanceConfig.BleedMaxStacks); base.m_time = 0f; if (base.m_ttl < 4f) { base.m_ttl = 4f; } WriteStacksToZdo(_stacks); } private void ApplyBleedTick() { //IL_00b9: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)base.m_character == (Object)null || !base.m_character.IsOwner()) { return; } float maxHealthSafe = GetMaxHealthSafe(base.m_character); if (!(maxHealthSafe <= 0f)) { int tier = GetTier(maxHealthSafe); float num = maxHealthSafe * 0.1f; if (tier >= 7 && num > 10000f) { num = 10000f; } float fixedBaseByTier = GetFixedBaseByTier(tier); float num2 = num * BalanceConfig.BleedFractionPerStack; float num3 = fixedBaseByTier + num2; float stackMultiplier = GetStackMultiplier(_stacks); float num4 = Mathf.Max(0f, num3 * stackMultiplier); float health = base.m_character.GetHealth(); float health2 = Mathf.Max(0f, health - num4); base.m_character.SetHealth(health2); BleedingPopupRPC.SendBleedPopup(base.m_character.GetCenterPoint(), num4, _stacks); Debug.Log((object)($"[NazhikaCore/Bleeding] {((Object)base.m_character).name} maxHP={maxHealthSafe:0} tier={tier} stacks={_stacks} " + $"hpBase={num:0.#} fixed={fixedBaseByTier:0.#} scaled1={num2:0.##} base1={num3:0.##} mult={stackMultiplier:0.###} dmg={num4:0.##}")); } } private float GetStackMultiplier(int stacks) { int bleedMaxStacks = BalanceConfig.BleedMaxStacks; stacks = Mathf.Clamp(stacks, 1, bleedMaxStacks); if (bleedMaxStacks <= 1) { return 1f; } return 1f + ((float)stacks - 1f) / ((float)bleedMaxStacks - 1f); } private static int GetTier(float hp) { if (hp < 60f) { return 0; } if (hp < 180f) { return 1; } if (hp < 450f) { return 2; } if (hp < 1500f) { return 3; } if (hp < 3000f) { return 4; } if (hp < 5000f) { return 5; } if (hp < 10000f) { return 6; } if (hp < 50000f) { return 7; } return 8; } private static float GetFixedBaseByTier(int tier) { return tier switch { 0 => BalanceConfig.BleedFixedT0, 1 => BalanceConfig.BleedFixedT1, 2 => BalanceConfig.BleedFixedT2, 3 => BalanceConfig.BleedFixedT3, 4 => BalanceConfig.BleedFixedT4, 5 => BalanceConfig.BleedFixedT5, 6 => BalanceConfig.BleedFixedT6, 7 => BalanceConfig.BleedFixedT7, 8 => BalanceConfig.BleedFixedT8, _ => 10f, }; } private static float GetMaxHealthSafe(Character ch) { try { return ch.GetMaxHealth(); } catch { return Mathf.Max(1f, ch.GetHealth()); } } private void SpawnBloodFXSafe() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)base.m_character == (Object)null) && !((Object)(object)ZNetScene.instance == (Object)null)) { GameObject prefab = ZNetScene.instance.GetPrefab("vfx_BloodHit"); if (Object.op_Implicit((Object)(object)prefab)) { Object.Instantiate(prefab, base.m_character.GetCenterPoint(), Quaternion.identity); } } } public override void Stop() { WriteStacksToZdo(0); ((StatusEffect)this).Stop(); } private void WriteStacksToZdo(int stacks) { try { if (!((Object)(object)base.m_character == (Object)null) && !((Object)(object)base.m_character.m_nview == (Object)null) && base.m_character.m_nview.IsValid()) { ZDO zDO = base.m_character.m_nview.GetZDO(); if (zDO != null) { zDO.Set("nz_bleed_stacks", stacks); } } } catch { } } } public static class SE_BleedingSetup { public static void Init() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown SE_Bleeding sE_Bleeding = ScriptableObject.CreateInstance(); CustomStatusEffect val = new CustomStatusEffect((StatusEffect)(object)sE_Bleeding, true); ItemManager.Instance.AddStatusEffect(val); Debug.Log((object)"[NazhikaCore] SE_Bleeding registrado (ZDO stacks sync)."); } } public class SE_Blindness : StatusEffect { private GameObject blackoutCanvas; private Image blackoutImage; private float fadeSpeed = 2f; private float targetAlpha = 0.95f; public SE_Blindness() { ((Object)this).name = "SE_Blindness"; base.m_name = "Blindness"; base.m_tooltip = "Estás cegado. Tu visión se oscurece."; base.m_icon = IconHelper.Load("Blindness.png"); base.m_cooldownIcon = true; base.m_ttl = 6f; } public override void Setup(Character character) { ((StatusEffect)this).Setup(character); Player val = (Player)(object)((character is Player) ? character : null); if (val != null && (Object)(object)val == (Object)(object)Player.m_localPlayer) { CreateBlackout(); } } public override void UpdateStatusEffect(float dt) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) ((StatusEffect)this).UpdateStatusEffect(dt); if ((Object)(object)blackoutImage != (Object)null) { Color color = ((Graphic)blackoutImage).color; color.a = Mathf.MoveTowards(color.a, targetAlpha, fadeSpeed * dt); ((Graphic)blackoutImage).color = color; } } public override void Stop() { RemoveBlackout(); } private void CreateBlackout() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown //IL_009f: 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_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)blackoutCanvas != (Object)null)) { blackoutCanvas = new GameObject("Naz_BlindnessCanvas"); Canvas val = blackoutCanvas.AddComponent(); val.renderMode = (RenderMode)0; val.sortingOrder = 9999; CanvasGroup val2 = blackoutCanvas.AddComponent(); val2.blocksRaycasts = false; val2.interactable = false; GameObject val3 = new GameObject("Naz_BlindnessImage"); val3.transform.SetParent(blackoutCanvas.transform, false); blackoutImage = val3.AddComponent(); ((Graphic)blackoutImage).color = new Color(0f, 0f, 0f, 0f); RectTransform rectTransform = ((Graphic)blackoutImage).rectTransform; rectTransform.anchorMin = Vector2.zero; rectTransform.anchorMax = Vector2.one; rectTransform.offsetMin = Vector2.zero; rectTransform.offsetMax = Vector2.zero; Object.DontDestroyOnLoad((Object)(object)blackoutCanvas); } } private void RemoveBlackout() { if ((Object)(object)blackoutCanvas != (Object)null) { Object.Destroy((Object)(object)blackoutCanvas); blackoutCanvas = null; blackoutImage = null; } } } public static class SE_BlindnessSetup { public static void Init() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown SE_Blindness sE_Blindness = ScriptableObject.CreateInstance(); CustomStatusEffect val = new CustomStatusEffect((StatusEffect)(object)sE_Blindness, true); ItemManager.Instance.AddStatusEffect(val); Debug.Log((object)"[NazhikaCore] SE_Blindness registrado correctamente."); } } public class SE_BloodBurst : StatusEffect { public static readonly int NameHash = StringExtensionMethods.GetStableHashCode("SE_BloodBurst"); private const float RadiusMeters = 60f; private const float InsaneDamage = 100f; private const bool DebugLogs = true; public SE_BloodBurst() { ((Object)this).name = "SE_BloodBurst"; base.m_name = "BloodBurst"; base.m_icon = IconHelper.Load("bloodburst.png"); base.m_tooltip = "Detona sangrados cercanos."; base.m_ttl = 1f; } public override void Setup(Character character) { ((StatusEffect)this).Setup(character); BloodBurstNet.EnsureRegisteredRobust(); if ((Object)(object)ZNet.instance != (Object)null && ZNet.instance.IsServer()) { ExecuteServer(character); } else { BloodBurstNet.RequestServerExecute(character); } base.m_time = base.m_ttl; } internal static void ExecuteServer(Character caster) { //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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_0036: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)caster == (Object)null || (Object)(object)ZNet.instance == (Object)null || !ZNet.instance.IsServer()) { return; } Vector3 position = ((Component)caster).transform.position; List list = new List(); Character.GetCharactersInRange(position, 60f, list); int num = 0; Debug.Log((object)$"[NazhikaCore/BloodBurst][SERVER][START] caster={((Object)caster).name} found={list.Count}"); foreach (Character item in list) { if ((Object)(object)item == (Object)null || (Object)(object)item == (Object)(object)caster || item.IsDead() || (Object)(object)item.m_nview == (Object)null || !item.m_nview.IsValid()) { continue; } int num2 = 0; try { ZDO zDO = item.m_nview.GetZDO(); if (zDO != null) { num2 = zDO.GetInt("nz_bleed_stacks", 0); } } catch { } if (num2 <= 0) { Debug.Log((object)("[NazhikaCore/BloodBurst][SERVER][SKIP] " + ((Object)item).name + " sin nz_bleed_stacks")); continue; } SEMan sEMan = item.GetSEMan(); if (sEMan == null) { continue; } float num3 = 100f; float health = item.GetHealth(); float num4 = Mathf.Max(0f, health - num3); item.SetHealth(num4); try { ZDO zDO2 = item.m_nview.GetZDO(); if (zDO2 != null) { zDO2.Set("nz_bleed_stacks", 0); } } catch { } BleedApplyRPC.RequestCancelBleed(item); Vector3 centerPoint = item.GetCenterPoint(); BloodBurstNet.TryBroadcastFx(centerPoint); num++; Debug.Log((object)$"[NazhikaCore/BloodBurst][SERVER][HIT] {((Object)item).name} zdoStacks={num2} dmg={num3} hpBefore={health} hpAfter={num4}"); } Debug.Log((object)$"[NazhikaCore/BloodBurst][SERVER][END] afectados={num}"); } internal static void ExecuteServerAtPosition(Vector3 center) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: 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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)ZNet.instance == (Object)null || !ZNet.instance.IsServer() || ZDOMan.instance == null) { return; } int num = 0; List list = new List(); Vector2i zone = ZoneSystem.GetZone(center); ZDOMan.instance.FindSectorObjects(zone, 2, 0, list, (List)null); Debug.Log((object)$"[BloodBurst][SERVER][START] pos={center} zdos={list.Count}"); foreach (ZDO item in list) { if (item == null) { continue; } float num2 = Vector3.Distance(item.GetPosition(), center); if (num2 > 60f) { continue; } int num3 = 0; try { num3 = item.GetInt("nz_bleed_stacks", 0); } catch { } if (num3 <= 0) { continue; } float num4 = 0f; try { num4 = item.GetFloat(ZDOVars.s_health, 0f); } catch { } if (!(num4 <= 0f)) { float num5 = Mathf.Max(0f, num4 - 90000f); try { item.Set(ZDOVars.s_health, num5); item.Set("nz_bleed_stacks", 0); } catch { continue; } BleedApplyRPC.RequestCancelBleedByZDO(item.m_uid); BloodBurstNet.TryBroadcastFx(item.GetPosition()); num++; Debug.Log((object)$"[BloodBurst][SERVER][HIT] zdo={item.m_uid} stacks={num3} hpBefore={num4} hpAfter={num5}"); } } Debug.Log((object)$"[BloodBurst][SERVER][END] afectados={num}"); } } internal static class BloodBurstNet { private class RegRunner : MonoBehaviour { [CompilerGenerated] private sealed class d__2 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public RegRunner <>4__this; private float 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__2(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown int num = <>1__state; RegRunner regRunner = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; 5__2 = 0f; break; case 1: <>1__state = -1; break; } if (5__2 < 2f && !_registered) { if (ZRoutedRpc.instance == null) { 5__2 += 0.1f; <>2__current = (object)new WaitForSeconds(0.1f); <>1__state = 1; return true; } EnsureRegisteredNow(); } regRunner._running = false; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private bool _running; public void Kick() { if (!_running) { _running = true; ((MonoBehaviour)this).StartCoroutine(Loop()); } } [IteratorStateMachine(typeof(d__2))] private IEnumerator Loop() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__2(0) { <>4__this = this }; } } internal const string RpcFxName = "NazhikaCore_BloodBurstFx"; internal const string RpcRequestName = "NazhikaCore_BloodBurst_Request"; private const bool DebugLogs = true; private static bool _registered; private static GameObject _regRunnerGo; private static RegRunner _regRunner; public static void Init(Harmony harmony) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown MethodInfo methodInfo = AccessTools.Method(typeof(ZNet), "Start", (Type[])null, (Type[])null); HarmonyMethod val = new HarmonyMethod(typeof(BloodBurstNet), "ZNet_Start_Postfix", (Type[])null); harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Debug.Log((object)"[NazhikaCore/BloodBurstNet] Init OK"); } private static void ZNet_Start_Postfix() { EnsureRegisteredRobust(); } public static void EnsureRegisteredRobust() { if (!_registered) { if (ZRoutedRpc.instance != null) { EnsureRegisteredNow(); return; } EnsureRegRunner(); _regRunner.Kick(); } } private static void EnsureRegRunner() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown if (!((Object)(object)_regRunner != (Object)null)) { _regRunnerGo = GameObject.Find("NazhikaCore_BloodBurst_RegRunner"); if ((Object)(object)_regRunnerGo == (Object)null) { _regRunnerGo = new GameObject("NazhikaCore_BloodBurst_RegRunner"); Object.DontDestroyOnLoad((Object)(object)_regRunnerGo); } _regRunner = _regRunnerGo.GetComponent(); if ((Object)(object)_regRunner == (Object)null) { _regRunner = _regRunnerGo.AddComponent(); } } } private static void EnsureRegisteredNow() { if (!_registered && ZRoutedRpc.instance != null) { ZRoutedRpc.instance.Register("NazhikaCore_BloodBurstFx", (Action)RPC_SpawnFx); ZRoutedRpc.instance.Register("NazhikaCore_BloodBurst_Request", (Action)RPC_RequestBurst); _registered = true; Debug.Log((object)"[NazhikaCore/BloodBurstNet] RPCs registrados: FX=NazhikaCore_BloodBurstFx, REQ=NazhikaCore_BloodBurst_Request"); } } public static void RequestServerExecute(Character caster) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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_0088: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) EnsureRegisteredRobust(); if (ZRoutedRpc.instance == null || (Object)(object)ZNet.instance == (Object)null) { return; } ZDOID val = ZDOID.None; try { if ((Object)(object)caster != (Object)null && (Object)(object)caster.m_nview != (Object)null && caster.m_nview.IsValid()) { ZDO zDO = caster.m_nview.GetZDO(); if (zDO != null) { val = zDO.m_uid; } } } catch { } if (val == ZDOID.None) { Debug.LogWarning((object)"[NazhikaCore/BloodBurstNet] Request abort: caster ZDOID None"); return; } long serverPeerID = ZRoutedRpc.instance.GetServerPeerID(); ZRoutedRpc.instance.InvokeRoutedRPC(serverPeerID, ZDOID.None, "NazhikaCore_BloodBurst_Request", new object[1] { val }); } public static bool TryBroadcastFx(Vector3 pos) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) EnsureRegisteredRobust(); if (ZRoutedRpc.instance == null) { return false; } try { ZRoutedRpc.instance.InvokeRoutedRPC(ZRoutedRpc.Everybody, "NazhikaCore_BloodBurstFx", new object[1] { pos }); return true; } catch (Exception arg) { Debug.LogWarning((object)$"[NazhikaCore/BloodBurstNet] BroadcastFx ex: {arg}"); return false; } } private static void RPC_RequestBurst(long sender, ZDOID casterZdo) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)ZNet.instance == (Object)null) && ZNet.instance.IsServer()) { Debug.Log((object)$"[NazhikaCore/BloodBurstNet] Server request sender={sender} casterZdo={casterZdo}"); ZNetPeer peer = ZNet.instance.GetPeer(sender); if (peer == null) { Debug.LogWarning((object)$"[NazhikaCore/BloodBurstNet] Peer {sender} no encontrado"); return; } Vector3 refPos = peer.m_refPos; Debug.Log((object)$"[NazhikaCore/BloodBurstNet] Ejecutando desde pos={refPos}"); SE_BloodBurst.ExecuteServerAtPosition(refPos); } } private static void RPC_SpawnFx(long sender, Vector3 pos) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)ZNet.instance != (Object)null) || !ZNet.instance.IsDedicated()) { BloodBurstFxFactory.SpawnAtRobust(pos); } } } internal static class BloodBurstFxFactory { private class FxRunner : MonoBehaviour { [CompilerGenerated] private sealed class d__3 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public FxRunner <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__3(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; FxRunner fxRunner = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; break; case 1: <>1__state = -1; break; } if (fxRunner._queue.Count > 0) { Vector3 pos = fxRunner._queue.Dequeue(); <>2__current = fxRunner.SpawnWithRetry(pos); <>1__state = 1; return true; } fxRunner._running = false; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__4 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Vector3 pos; private float 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__4(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(0.05f); <>1__state = 1; return true; case 1: <>1__state = -1; 5__2 = 0f; break; case 2: <>1__state = -1; break; } if (5__2 < 3f) { if ((Object)(object)ZNetScene.instance != (Object)null) { GameObject vanillaPrefab = GetVanillaPrefab(); if ((Object)(object)vanillaPrefab != (Object)null) { GameObject val = Object.Instantiate(vanillaPrefab, pos, Quaternion.identity); if ((Object)(object)val != (Object)null) { PruneAndScaleInstance(val); ForceActivate(val); val.SetActive(true); return false; } } } 5__2 += 0.1f; <>2__current = (object)new WaitForSeconds(0.1f); <>1__state = 2; return true; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private readonly Queue _queue = new Queue(); private bool _running; public void Enqueue(Vector3 pos) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) _queue.Enqueue(pos); if (!_running) { _running = true; ((MonoBehaviour)this).StartCoroutine(Loop()); } } [IteratorStateMachine(typeof(d__3))] private IEnumerator Loop() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__3(0) { <>4__this = this }; } [IteratorStateMachine(typeof(d__4))] private IEnumerator SpawnWithRetry(Vector3 pos) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__4(0) { pos = pos }; } } private const string VanillaFxName = "fx_CharredStone_Destruction"; private static GameObject _vanillaPrefab; private static readonly string[] KeepKeywords = new string[3] { "skull", "smoke", "glow" }; private static GameObject _runnerGo; private static FxRunner _runner; public static void SpawnAtRobust(Vector3 pos) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) EnsureRunner(); _runner.Enqueue(pos); } private static void EnsureRunner() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown if (!((Object)(object)_runner != (Object)null)) { _runnerGo = GameObject.Find("NazhikaCore_BloodBurst_FxRunner"); if ((Object)(object)_runnerGo == (Object)null) { _runnerGo = new GameObject("NazhikaCore_BloodBurst_FxRunner"); Object.DontDestroyOnLoad((Object)(object)_runnerGo); } _runner = _runnerGo.GetComponent(); if ((Object)(object)_runner == (Object)null) { _runner = _runnerGo.AddComponent(); } } } private static GameObject GetVanillaPrefab() { if ((Object)(object)_vanillaPrefab != (Object)null) { return _vanillaPrefab; } if ((Object)(object)ZNetScene.instance == (Object)null) { return null; } _vanillaPrefab = ZNetScene.instance.GetPrefab("fx_CharredStone_Destruction"); return _vanillaPrefab; } private static void PruneAndScaleInstance(GameObject fxInstance) { //IL_0080: 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) if ((Object)(object)fxInstance == (Object)null) { return; } int num = 0; Transform[] componentsInChildren = fxInstance.GetComponentsInChildren(true); foreach (Transform val in componentsInChildren) { if ((Object)(object)val != (Object)null && IsKeepName(((Object)val).name)) { num++; } } if (num <= 0) { return; } DisableNonKeepBranches(fxInstance.transform); Transform[] componentsInChildren2 = fxInstance.GetComponentsInChildren(true); foreach (Transform val2 in componentsInChildren2) { if ((Object)(object)val2 != (Object)null && IsKeepName(((Object)val2).name)) { val2.localScale *= 0.5f; } } } private static void DisableNonKeepBranches(Transform root) { for (int i = 0; i < root.childCount; i++) { Transform child = root.GetChild(i); if (!((Object)(object)child == (Object)null) && !BranchHasKeep(child)) { ((Component)child).gameObject.SetActive(false); } } } private static bool BranchHasKeep(Transform t) { if ((Object)(object)t == (Object)null) { return false; } if (IsKeepName(((Object)t).name)) { return true; } for (int i = 0; i < t.childCount; i++) { if (BranchHasKeep(t.GetChild(i))) { return true; } } return false; } private static bool IsKeepName(string name) { if (string.IsNullOrEmpty(name)) { return false; } string text = name.ToLowerInvariant(); for (int i = 0; i < KeepKeywords.Length; i++) { if (text.Contains(KeepKeywords[i])) { return true; } } return false; } private static void ForceActivate(GameObject root) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)root)) { Transform[] componentsInChildren = root.GetComponentsInChildren(true); foreach (Transform val in componentsInChildren) { ((Component)val).gameObject.SetActive(true); } ParticleSystem[] componentsInChildren2 = root.GetComponentsInChildren(true); foreach (ParticleSystem val2 in componentsInChildren2) { EmissionModule emission = val2.emission; ((EmissionModule)(ref emission)).enabled = true; val2.Clear(true); val2.Play(true); } } } } public static class SE_BloodBurstSetup { public static void Init() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown SE_BloodBurst sE_BloodBurst = ScriptableObject.CreateInstance(); CustomStatusEffect val = new CustomStatusEffect((StatusEffect)(object)sE_BloodBurst, true); ItemManager.Instance.AddStatusEffect(val); BloodBurstNet.EnsureRegisteredRobust(); Debug.Log((object)"[NazhikaCore] SE_BloodBurst registrado (ZDO detect bleeding; client->server request; FX Everybody)."); } } public class SE_Curse : StatusEffect { private float tickTimer; private float fxTimer; private float damagePerTick = 5f; private float tickInterval = 2f; public SE_Curse() { ((Object)this).name = "SE_Curse"; base.m_name = "Curse"; base.m_tooltip = "Estas maldito, el daño que haga se te devolvera."; base.m_icon = IconHelper.Load("curse.png"); base.m_ttl = 5f; } public override void UpdateStatusEffect(float dt) { } } public static class SE_CurseSetup { public static void Init() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown SE_Curse sE_Curse = ScriptableObject.CreateInstance(); CustomStatusEffect val = new CustomStatusEffect((StatusEffect)(object)sE_Curse, true); ItemManager.Instance.AddStatusEffect(val); Debug.Log((object)"[NazhikaCore] SE_Curse registrado correctamente."); } } public class SE_FocusShot : StatusEffect { public const string InternalName = "SE_FocusShot"; public static readonly int NameHash = StringExtensionMethods.GetStableHashCode("SE_FocusShot"); public const string ZdoKeyActive = "focusshot_active"; private Character _ch; public SE_FocusShot() { ((Object)this).name = "SE_FocusShot"; base.m_name = "Focus Shot"; base.m_icon = IconHelper.Load("focusshot.png"); base.m_ttl = 15f; base.m_tooltip = "Concentración del arquero: más daño al próximo disparo de arco."; } public override void Setup(Character character) { ((StatusEffect)this).Setup(character); _ch = character; Player val = (Player)(object)((character is Player) ? character : null); if ((Object)(object)val != (Object)null) { ZNetView component = ((Component)val).GetComponent(); if ((Object)(object)component != (Object)null && component.IsValid() && component.GetZDO() != null && component.IsOwner()) { component.GetZDO().Set("focusshot_active", 1); Debug.Log((object)("[SE_FocusShot] ZDO flag set → focusshot_active=1 para " + val.GetPlayerName())); } } } public override void UpdateStatusEffect(float dt) { ((StatusEffect)this).UpdateStatusEffect(dt); base.m_tooltip = "Focus Shot activo (" + Mathf.CeilToInt(GetRemainingTTL()) + "s)"; } public override void Stop() { Character ch = _ch; Player val = (Player)(object)((ch is Player) ? ch : null); if ((Object)(object)val != (Object)null) { ZNetView component = ((Component)val).GetComponent(); if ((Object)(object)component != (Object)null && component.IsValid() && component.GetZDO() != null && component.IsOwner()) { component.GetZDO().Set("focusshot_active", 0); Debug.Log((object)("[SE_FocusShot] ZDO flag cleared → focusshot_active=0 para " + val.GetPlayerName())); } long playerID = val.GetPlayerID(); FocusShotRuntime.RaiseFocusRemoved(playerID); PlayerClassBase @class = ClassManager.GetClass(val); if (@class != null) { @class.TryBeginCooldown(val); SkillsUI.StartCooldown(@class.CooldownSeconds); Log.Info($"[SE_FocusShot] Buff terminado → cooldown de {@class.CooldownSeconds}s iniciado para {val.GetPlayerName()}"); } } ((StatusEffect)this).Stop(); } private float GetRemainingTTL() { return Mathf.Max(0f, base.m_ttl - base.m_time); } } public static class SE_FocusShotSetup { public static void Init() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown SE_FocusShot sE_FocusShot = ScriptableObject.CreateInstance(); CustomStatusEffect val = new CustomStatusEffect((StatusEffect)(object)sE_FocusShot, true); ItemManager.Instance.AddStatusEffect(val); Debug.Log((object)"[NazhikaCore] ✅ SE_FocusShot registrado en Jotunn"); } } public static class FocusShotRuntime { public static event Action FocusRemoved; public static void RaiseFocusRemoved(long playerId) { try { if (FocusShotRuntime.FocusRemoved != null) { FocusShotRuntime.FocusRemoved(playerId); } } catch (Exception ex) { Debug.LogWarning((object)("[FocusShot] FocusRemoved event error: " + ex)); } } } public class SE_LavaRocks : StatusEffect { private class NoDamageCleaner : MonoBehaviour { private GameObject _root; private int _frames; public void Run(GameObject r, int frames) { _root = r; _frames = frames; } private void LateUpdate() { if ((Object)(object)_root == (Object)null) { Object.Destroy((Object)(object)this); return; } CleanOnce(_root); if (--_frames <= 0) { Object.Destroy((Object)(object)this); } } } public const string InternalName = "SE_LavaRocks"; public static readonly int NameHash = StringExtensionMethods.GetStableHashCode("SE_LavaRocks"); private const KeyCode ToggleKey = 57; private const string LavaRockPrefabName = "LavaRock"; private const int RocksCount = 4; private const float CircleYOffset = 0.06f; private const float SymbolWorldSize = 6f; private static readonly Vector3 MarkerScale = Vector3.one; private const string MarkerTextureFile = "sealSymbol3.png"; private const float SpawnRadius = 6f; private const float SpawnYOffset = 0.15f; private const float MinCenterDistance = 0.9f; private Character _ch; private GameObject _marker; private GameObject _symbol; private bool _spawnReadyShown; public SE_LavaRocks() { ((Object)this).name = "SE_LavaRocks"; base.m_name = "Lava Rocks"; base.m_icon = IconHelper.Load("LavaRocks.png"); base.m_tooltip = "Apunta y haz clic derecho para invocar rocas de lava. Esc: cancelar."; base.m_ttl = 8f; } public override void Setup(Character character) { ((StatusEffect)this).Setup(character); _ch = character; Character ch = _ch; Player val = (Player)(object)((ch is Player) ? ch : null); if (val != null && (Object)(object)Player.m_localPlayer == (Object)(object)val) { EnsureMarker(val); _marker.SetActive(true); SnapMarkerToMouse(); _spawnReadyShown = true; } } public override void UpdateStatusEffect(float dt) { //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) ((StatusEffect)this).UpdateStatusEffect(dt); base.m_tooltip = $"Lava Rocks ({Mathf.CeilToInt(Mathf.Max(0f, base.m_ttl - base.m_time))}s) — RMB: rocas, LMB/Esc: cancelar"; Character ch = _ch; Player val = (Player)(object)((ch is Player) ? ch : null); if (val == null || (Object)(object)Player.m_localPlayer != (Object)(object)val) { return; } if (Input.GetKeyDown((KeyCode)57)) { EnsureMarker(val); _marker.SetActive(!_marker.activeSelf); } if ((Object)(object)_marker == (Object)null) { return; } if (_marker.activeSelf) { if (Input.GetMouseButtonDown(0) || Input.GetKeyDown((KeyCode)27)) { _marker.SetActive(false); return; } SnapMarkerToMouse(); if (Input.GetMouseButtonDown(1)) { if ((Object)(object)((Character)val).m_nview != (Object)null && ((Character)val).m_nview.IsValid()) { ((Character)val).m_nview.InvokeRPC(ZNetView.Everybody, "RPC_Nazhika_PlayCheer", Array.Empty()); } Vector3 position = _marker.transform.position; SpawnLavaRocks(position, 6f, 4); _marker.SetActive(false); base.m_time = base.m_ttl; } } else if (!_spawnReadyShown) { EnsureMarker(val); _marker.SetActive(true); SnapMarkerToMouse(); _spawnReadyShown = true; } } public override void Stop() { ((StatusEffect)this).Stop(); Character character = base.m_character; Player val = (Player)(object)((character is Player) ? character : null); if (val != null) { PlayerClassBase @class = ClassManager.GetClass(val); if (@class != null) { @class.TryBeginCooldown(val); SkillsUI.StartCooldown(@class.CooldownSeconds); } } try { if ((Object)(object)_marker != (Object)null) { Object.Destroy((Object)(object)_marker); } _marker = null; _symbol = null; } catch { } } private void EnsureMarker(Player owner) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: 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_0153: Expected O, but got Unknown if ((Object)(object)_marker != (Object)null) { return; } _marker = new GameObject("LavaRocksMarker_SE"); _marker.transform.position = ((Component)owner).transform.position; _marker.transform.localScale = MarkerScale; _marker.SetActive(false); _symbol = GameObject.CreatePrimitive((PrimitiveType)5); ((Object)_symbol).name = "SealSymbol3"; _symbol.transform.SetParent(_marker.transform, false); _symbol.transform.localPosition = new Vector3(0f, 0.06f, 0f); _symbol.transform.localRotation = Quaternion.Euler(-90f, 0f, 0f); _symbol.transform.localScale = Vector3.one * 6f; Renderer component = _symbol.GetComponent(); Shader val = TryFindShader("Unlit/Transparent", "Sprites/Default", "Legacy Shaders/Transparent/Diffuse", "Particles/Standard Unlit", "Standard"); if ((Object)(object)component != (Object)null && (Object)(object)val != (Object)null) { Material val2 = new Material(val); val2.mainTexture = (Texture)(object)LoadTexture_NoRef("sealSymbol3.png"); val2.renderQueue = 3000; try { if (val2.HasProperty("_Cull")) { val2.SetInt("_Cull", 0); } } catch { } component.material = val2; } Collider component2 = _symbol.GetComponent(); if ((Object)(object)component2 != (Object)null) { Object.Destroy((Object)(object)component2); } } private void SnapMarkerToMouse() { //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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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_005e: Unknown result type (might be due to invalid IL or missing references) Camera gameCamera = GetGameCamera(); if (!((Object)(object)gameCamera == (Object)null) && !((Object)(object)_marker == (Object)null)) { Ray val = gameCamera.ScreenPointToRay(Input.mousePosition); RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(val, ref val2, 500f, -1, (QueryTriggerInteraction)1)) { Vector3 point = ((RaycastHit)(ref val2)).point; point.y += 0.06f; _marker.transform.position = point; } } } private static void SpawnLavaRocks(Vector3 center, float radius, int count) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: 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_00ca: 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_0096: 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) if ((Object)(object)ZNetScene.instance == (Object)null) { return; } GameObject prefab = ZNetScene.instance.GetPrefab("LavaRock"); if ((Object)(object)prefab == (Object)null) { Debug.LogWarning((object)"[SE_LavaRocks] Prefab no encontrado: \"LavaRock\""); return; } Vector3 val2 = default(Vector3); for (int i = 0; i < count; i++) { Vector2 val = Random.insideUnitCircle * radius; if (((Vector2)(ref val)).magnitude < 0.9f) { val = ((Vector2)(ref val)).normalized * 0.9f; } ((Vector3)(ref val2))..ctor(center.x + val.x, center.y, center.z + val.y); if (TrySnapToGround(val2, out var snapped)) { val2 = snapped; } val2.y += 0.15f; Quaternion val3 = Quaternion.Euler(0f, Random.Range(0f, 360f), 0f); GameObject root = Object.Instantiate(prefab, val2, val3); NukeDamageComponents(root); } } private static bool TrySnapToGround(Vector3 near, out Vector3 snapped) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: 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_003b: Unknown result type (might be due to invalid IL or missing references) snapped = near; Vector3 val = near + Vector3.up * 25f; RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(val, Vector3.down, ref val2, 80f, -1, (QueryTriggerInteraction)1)) { snapped = ((RaycastHit)(ref val2)).point; return true; } return false; } private static void NukeDamageComponents(GameObject root) { if (Object.op_Implicit((Object)(object)root)) { CleanOnce(root); NoDamageCleaner noDamageCleaner = root.AddComponent(); noDamageCleaner.Run(root, 6); } } private static void CleanOnce(GameObject root) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) try { Aoe[] componentsInChildren = root.GetComponentsInChildren(true); foreach (Aoe val in componentsInChildren) { if (!((Object)(object)val == (Object)null)) { val.m_damage = default(DamageTypes); ((Behaviour)val).enabled = false; } } Projectile[] componentsInChildren2 = root.GetComponentsInChildren(true); foreach (Projectile val2 in componentsInChildren2) { if (!((Object)(object)val2 == (Object)null)) { val2.m_damage = default(DamageTypes); ((Behaviour)val2).enabled = false; } } } catch (Exception ex) { Debug.LogWarning((object)("[SE_LavaRocks] CleanOnce error: " + ex.Message)); } } private static Camera GetGameCamera() { if ((Object)(object)GameCamera.instance?.m_camera != (Object)null) { return GameCamera.instance.m_camera; } return Camera.main; } private static Shader TryFindShader(params string[] names) { foreach (string text in names) { Shader val = Shader.Find(text); if ((Object)(object)val != (Object)null) { return val; } } return null; } private static Texture2D LoadTexture_NoRef(string fileName) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown string text = Path.Combine(Paths.PluginPath, "NazhikaCore", "Assets", "Images", fileName); if (!File.Exists(text)) { Debug.LogWarning((object)("[SE_LavaRocks] PNG no encontrado: " + text)); return Texture2D.whiteTexture; } byte[] array = File.ReadAllBytes(text); Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false); try { MethodInfo methodInfo = Type.GetType("UnityEngine.ImageConversion, UnityEngine.ImageConversionModule")?.GetMethod("LoadImage", new Type[3] { typeof(Texture2D), typeof(byte[]), typeof(bool) }); if (methodInfo != null && (bool)methodInfo.Invoke(null, new object[3] { val, array, false })) { return val; } } catch { } return Texture2D.whiteTexture; } } public static class SE_LavaRocksSetup { public static void Init() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown SE_LavaRocks sE_LavaRocks = ScriptableObject.CreateInstance(); ItemManager.Instance.AddStatusEffect(new CustomStatusEffect((StatusEffect)(object)sE_LavaRocks, true)); Debug.Log((object)"[NazhikaCore] ✅ SE_LavaRocks registrado en Jotunn"); } } public class SE_LightningStorm : StatusEffect { private class NoDamageCleaner : MonoBehaviour { private GameObject _root; private int _frames; public void Run(GameObject r, int frames) { _root = r; _frames = frames; } private void LateUpdate() { if ((Object)(object)_root == (Object)null) { Object.Destroy((Object)(object)this); return; } CleanOnce(_root); _frames--; if (_frames <= 0) { Object.Destroy((Object)(object)this); } } } public const string InternalName = "SE_LightningStorm"; public static readonly int NameHash = StringExtensionMethods.GetStableHashCode("SE_LightningStorm"); private const KeyCode ToggleKey = 57; private const string LightningPrefabName = "lightningAOE"; private const float CircleYOffset = 0.06f; private const float SymbolWorldSize = 3.5f; private static readonly Vector3 MarkerScale = Vector3.one; private const float ImmobilizeRadius = 5f; private const float ImmobilizeCenterBonus = 0f; private const string ImmobilizedName = "ImmobilizedLong"; private static readonly int ImmobilizedHash = StringExtensionMethods.GetStableHashCode("ImmobilizedLong"); private Character _ch; private GameObject _marker; private GameObject _symbol; private bool _spawnReadyShown; public SE_LightningStorm() { ((Object)this).name = "SE_LightningStorm"; base.m_name = "Lightning Storm"; base.m_icon = IconHelper.Load("LightningStorm.png"); base.m_tooltip = "Apunta y haz clic derecho para invocar rayos. Esc: cancelar."; base.m_ttl = 20f; } public override void Setup(Character character) { ((StatusEffect)this).Setup(character); _ch = character; Character ch = _ch; Player val = (Player)(object)((ch is Player) ? ch : null); if (val != null && (Object)(object)Player.m_localPlayer == (Object)(object)val) { EnsureMarker(val); _marker.SetActive(true); SnapMarkerToMouse(); _spawnReadyShown = true; } } public override void UpdateStatusEffect(float dt) { //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: 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) ((StatusEffect)this).UpdateStatusEffect(dt); base.m_tooltip = $"Lightning Storm ({Mathf.CeilToInt(Mathf.Max(0f, base.m_ttl - base.m_time))}s) — RMB: rayos, LMB/Esc: cancelar"; Character ch = _ch; Player val = (Player)(object)((ch is Player) ? ch : null); if (val == null || (Object)(object)Player.m_localPlayer != (Object)(object)val) { return; } if (Input.GetKeyDown((KeyCode)57)) { EnsureMarker(val); _marker.SetActive(!_marker.activeSelf); } if ((Object)(object)_marker == (Object)null) { return; } if (_marker.activeSelf) { if (Input.GetMouseButtonDown(0) || Input.GetKeyDown((KeyCode)27)) { _marker.SetActive(false); return; } SnapMarkerToMouse(); if (Input.GetMouseButtonDown(1)) { if ((Object)(object)((Character)val).m_nview != (Object)null && ((Character)val).m_nview.IsValid()) { ((Character)val).m_nview.InvokeRPC(ZNetView.Everybody, "RPC_Nazhika_PlayCheer", Array.Empty()); } Vector3 position = _marker.transform.position; SpawnLightningBurst(position); _marker.SetActive(false); base.m_time = base.m_ttl; } } else if (!_spawnReadyShown) { EnsureMarker(val); _marker.SetActive(true); SnapMarkerToMouse(); _spawnReadyShown = true; } } public override void Stop() { ((StatusEffect)this).Stop(); Character character = base.m_character; Player val = (Player)(object)((character is Player) ? character : null); if (val != null) { PlayerClassBase @class = ClassManager.GetClass(val); if (@class != null) { @class.TryBeginCooldown(val); SkillsUI.StartCooldown(@class.CooldownSeconds); } } try { if ((Object)(object)_marker != (Object)null) { Object.Destroy((Object)(object)_marker); } _marker = null; _symbol = null; } catch { } } private void EnsureMarker(Player owner) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: 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_0170: Expected O, but got Unknown if ((Object)(object)_marker != (Object)null) { return; } _marker = new GameObject("LightningMarker_SE"); _marker.transform.position = ((Component)owner).transform.position; _marker.transform.localScale = MarkerScale; _marker.SetActive(false); _symbol = GameObject.CreatePrimitive((PrimitiveType)5); ((Object)_symbol).name = "SealSymbol"; _symbol.transform.SetParent(_marker.transform, false); _symbol.transform.localPosition = new Vector3(0f, 0.06f, 0f); _symbol.transform.localRotation = Quaternion.Euler(-90f, 0f, 0f); _symbol.transform.localScale = Vector3.one * 3.5f; Renderer component = _symbol.GetComponent(); Shader val = TryFindShader("Unlit/Transparent", "Sprites/Default", "Legacy Shaders/Transparent/Diffuse", "Legacy Shaders/Particles/Alpha Blended", "Particles/Standard Unlit", "Standard"); Material val2 = (Material)((!((Object)(object)val != (Object)null)) ? ((object)(((Object)(object)component != (Object)null) ? (component.material ?? component.sharedMaterial) : null)) : ((object)new Material(val))); if ((Object)(object)val2 != (Object)null) { try { if (val2.HasProperty("_Cull")) { val2.SetInt("_Cull", 0); } } catch { } try { val2.renderQueue = 3000; } catch { } val2.mainTexture = (Texture)(object)LoadTexture_NoRef("sealSymbol2.png"); component.material = val2; } Collider component2 = _symbol.GetComponent(); if ((Object)(object)component2 != (Object)null) { Object.Destroy((Object)(object)component2); } } private void SnapMarkerToMouse() { //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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) Camera gameCamera = GetGameCamera(); if (!((Object)(object)gameCamera == (Object)null) && !((Object)(object)_marker == (Object)null)) { Ray val = gameCamera.ScreenPointToRay(Input.mousePosition); RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(val, ref val2, 500f, -1, (QueryTriggerInteraction)1)) { Vector3 point = ((RaycastHit)(ref val2)).point; point.y = ((RaycastHit)(ref val2)).point.y + 0.06f; _marker.transform.position = point; } } } private void SpawnLightningBurst(Vector3 center) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)ZNetScene.instance == (Object)null) { return; } GameObject prefab = ZNetScene.instance.GetPrefab("lightningAOE"); if ((Object)(object)prefab == (Object)null) { Debug.LogWarning((object)"[SE_LightningStorm] Prefab no encontrado: \"lightningAOE\""); return; } for (int i = 0; i < 4; i++) { Vector3 val = center + Random.insideUnitSphere * 4f; val.y = center.y; GameObject root = Object.Instantiate(prefab, val, Quaternion.identity); NukeDamageComponents(root); ApplyImmobilizedInRadius(val, 5f); } } private static void TryApplyImmobilized(Character ch) { if (!((Object)(object)ch == (Object)null) && !ch.IsDead() && !ch.IsPlayer()) { SEMan sEMan = ch.GetSEMan(); if (sEMan != null && !sEMan.HaveStatusEffect(ImmobilizedHash)) { sEMan.AddStatusEffect(ImmobilizedHash, false, 0, 0f); } } } private static void ApplyImmobilizedInRadius(Vector3 center, float radius) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) Collider[] array = Physics.OverlapSphere(center, radius, -1, (QueryTriggerInteraction)1); if (array == null || array.Length == 0) { return; } Vector3 val2 = default(Vector3); foreach (Collider val in array) { if (!Object.op_Implicit((Object)(object)val)) { continue; } Character componentInParent = ((Component)val).GetComponentInParent(); if (!((Object)(object)componentInParent == (Object)null)) { Vector3 position = ((Component)componentInParent).transform.position; ((Vector3)(ref val2))..ctor(center.x, position.y, center.z); if (!(Vector3.Distance(position, val2) > radius + 0.15f)) { TryApplyImmobilized(componentInParent); } } } } private static void NukeDamageComponents(GameObject root) { if (Object.op_Implicit((Object)(object)root)) { CleanOnce(root); NoDamageCleaner noDamageCleaner = root.AddComponent(); noDamageCleaner.Run(root, 6); } } private static void CleanOnce(GameObject root) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) try { Aoe[] componentsInChildren = root.GetComponentsInChildren(true); foreach (Aoe val in componentsInChildren) { if (!((Object)(object)val == (Object)null)) { val.m_damage = default(DamageTypes); ((Behaviour)val).enabled = false; } } Projectile[] componentsInChildren2 = root.GetComponentsInChildren(true); foreach (Projectile val2 in componentsInChildren2) { if (!((Object)(object)val2 == (Object)null)) { val2.m_damage = default(DamageTypes); ((Behaviour)val2).enabled = false; } } } catch (Exception ex) { Debug.LogWarning((object)("[SE_LightningStorm] CleanOnce error: " + ex.Message)); } } private static Camera GetGameCamera() { if ((Object)(object)GameCamera.instance?.m_camera != (Object)null) { return GameCamera.instance.m_camera; } return Camera.main; } private static Shader TryFindShader(params string[] names) { foreach (string text in names) { Shader val = Shader.Find(text); if ((Object)(object)val != (Object)null) { return val; } } return null; } private static Texture2D LoadTexture_NoRef(string fileName) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown string text = Path.Combine(Paths.PluginPath, "NazhikaCore", "Assets", "Images", fileName); if (!File.Exists(text)) { Debug.LogWarning((object)("[SE_LightningStorm] PNG no encontrado: " + text)); return Texture2D.whiteTexture; } byte[] array = File.ReadAllBytes(text); Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false); try { MethodInfo methodInfo = Type.GetType("UnityEngine.ImageConversion, UnityEngine.ImageConversionModule")?.GetMethod("LoadImage", new Type[3] { typeof(Texture2D), typeof(byte[]), typeof(bool) }); if (methodInfo != null && (bool)methodInfo.Invoke(null, new object[3] { val, array, false })) { return val; } } catch { } return Texture2D.whiteTexture; } } public static class SE_LightningStormSetup { public static void Init() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown SE_LightningStorm sE_LightningStorm = ScriptableObject.CreateInstance(); CustomStatusEffect val = new CustomStatusEffect((StatusEffect)(object)sE_LightningStorm, true); ItemManager.Instance.AddStatusEffect(val); Debug.Log((object)"[NazhikaCore] ✅ SE_LightningStorm registrado en Jotunn"); } } public class SE_MagicRoots : StatusEffect { private class NoDamageCleaner : MonoBehaviour { private GameObject _root; private int _frames; public void Run(GameObject r, int frames) { _root = r; _frames = frames; } private void LateUpdate() { if ((Object)(object)_root == (Object)null) { Object.Destroy((Object)(object)this); return; } CleanOnce(_root); if (--_frames <= 0) { Object.Destroy((Object)(object)this); } } } public const string InternalName = "SE_MagicRoots"; public static readonly int NameHash = StringExtensionMethods.GetStableHashCode("SE_MagicRoots"); private const KeyCode ToggleKey = 57; private const string RootFxPrefab = "fx_RootAshlands"; private const float CircleYOffset = 0.06f; private const float SymbolWorldSize = 12f; private static readonly Vector3 MarkerScale = Vector3.one; private const float ImmobilizeRadius = 8f; private const float ImmobilizeDuration = 10f; private const string ImmobilizedName = "ImmobilizedLong"; private static readonly int ImmobilizedHash = StringExtensionMethods.GetStableHashCode("ImmobilizedLong"); private static readonly int MagicRootsFxHash = SE_MagicRootsFX_Target.NameHash; private Character _ch; private GameObject _marker; private GameObject _symbol; private bool _spawnReadyShown; public SE_MagicRoots() { ((Object)this).name = "SE_MagicRoots"; base.m_name = "Magic Roots"; base.m_icon = IconHelper.Load("MagicRoots.png"); base.m_tooltip = "Apunta y haz clic derecho para invocar raíces. Esc: cancelar."; base.m_ttl = 5f; } public override void Setup(Character character) { ((StatusEffect)this).Setup(character); _ch = character; Character ch = _ch; Player val = (Player)(object)((ch is Player) ? ch : null); if (val != null && (Object)(object)Player.m_localPlayer == (Object)(object)val) { EnsureMarker(val); _marker.SetActive(true); SnapMarkerToMouse(); _spawnReadyShown = true; } } public override void UpdateStatusEffect(float dt) { //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: 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) ((StatusEffect)this).UpdateStatusEffect(dt); base.m_tooltip = $"Magic Roots ({Mathf.CeilToInt(Mathf.Max(0f, base.m_ttl - base.m_time))}s) — RMB: raíces, LMB/Esc: cancelar"; Character ch = _ch; Player val = (Player)(object)((ch is Player) ? ch : null); if (val == null || (Object)(object)Player.m_localPlayer != (Object)(object)val) { return; } if (Input.GetKeyDown((KeyCode)57)) { EnsureMarker(val); _marker.SetActive(!_marker.activeSelf); } if ((Object)(object)_marker == (Object)null) { return; } if (_marker.activeSelf) { if (Input.GetMouseButtonDown(0) || Input.GetKeyDown((KeyCode)27)) { _marker.SetActive(false); return; } SnapMarkerToMouse(); if (Input.GetMouseButtonDown(1)) { if ((Object)(object)((Character)val).m_nview != (Object)null && ((Character)val).m_nview.IsValid()) { ((Character)val).m_nview.InvokeRPC(ZNetView.Everybody, "RPC_Nazhika_PlayCheer", Array.Empty()); } Vector3 position = _marker.transform.position; SpawnRoots(position); _marker.SetActive(false); base.m_time = base.m_ttl; } } else if (!_spawnReadyShown) { EnsureMarker(val); _marker.SetActive(true); SnapMarkerToMouse(); _spawnReadyShown = true; } } public override void Stop() { ((StatusEffect)this).Stop(); Character character = base.m_character; Player val = (Player)(object)((character is Player) ? character : null); if (val != null) { PlayerClassBase @class = ClassManager.GetClass(val); if (@class != null) { @class.TryBeginCooldown(val); SkillsUI.StartCooldown(@class.CooldownSeconds); } } try { if ((Object)(object)_marker != (Object)null) { Object.Destroy((Object)(object)_marker); } _marker = null; _symbol = null; } catch { } } private void EnsureMarker(Player owner) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: 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_0153: Expected O, but got Unknown if (!((Object)(object)_marker != (Object)null)) { _marker = new GameObject("MagicRootsMarker_SE"); _marker.transform.position = ((Component)owner).transform.position; _marker.transform.localScale = MarkerScale; _marker.SetActive(false); _symbol = GameObject.CreatePrimitive((PrimitiveType)5); ((Object)_symbol).name = "RootSymbol"; _symbol.transform.SetParent(_marker.transform, false); _symbol.transform.localPosition = new Vector3(0f, 0.06f, 0f); _symbol.transform.localRotation = Quaternion.Euler(-90f, 0f, 0f); _symbol.transform.localScale = Vector3.one * 12f; Renderer component = _symbol.GetComponent(); Shader val = TryFindShader("Unlit/Transparent", "Sprites/Default", "Legacy Shaders/Transparent/Diffuse", "Particles/Standard Unlit", "Standard"); if ((Object)(object)component != (Object)null && (Object)(object)val != (Object)null) { Material val2 = new Material(val); val2.mainTexture = (Texture)(object)LoadTexture_NoRef("sealSymbol2.png"); val2.renderQueue = 3000; component.material = val2; } Collider component2 = _symbol.GetComponent(); if ((Object)(object)component2 != (Object)null) { Object.Destroy((Object)(object)component2); } } } private void SnapMarkerToMouse() { //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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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_005e: Unknown result type (might be due to invalid IL or missing references) Camera gameCamera = GetGameCamera(); if (!((Object)(object)gameCamera == (Object)null) && !((Object)(object)_marker == (Object)null)) { Ray val = gameCamera.ScreenPointToRay(Input.mousePosition); RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(val, ref val2, 500f, -1, (QueryTriggerInteraction)1)) { Vector3 point = ((RaycastHit)(ref val2)).point; point.y += 0.06f; _marker.transform.position = point; } } } private void SpawnRoots(Vector3 center) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)ZNetScene.instance == (Object)null)) { GameObject prefab = ZNetScene.instance.GetPrefab("fx_RootAshlands"); if ((Object)(object)prefab == (Object)null) { Debug.LogWarning((object)"[SE_MagicRoots] Prefab no encontrado: fx_RootAshlands"); return; } GameObject root = Object.Instantiate(prefab, center, Quaternion.identity); NukeDamageComponents(root); ApplyImmobilizedInRadius(center, 8f); } } private static void TryApplyImmobilized(Character ch) { if ((Object)(object)ch == (Object)null || ch.IsDead() || ch.IsPlayer()) { return; } SEMan sEMan = ch.GetSEMan(); if (sEMan != null) { StatusEffect val = sEMan.AddStatusEffect(ImmobilizedHash, false, 0, 0f); if ((Object)(object)val != (Object)null) { val.m_ttl = 10f; } StatusEffect val2 = sEMan.AddStatusEffect(MagicRootsFxHash, false, 0, 0f); if ((Object)(object)val2 != (Object)null) { val2.m_ttl = 10f; } } } private static void ApplyImmobilizedInRadius(Vector3 center, float radius) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) Collider[] array = Physics.OverlapSphere(center, radius, -1, (QueryTriggerInteraction)1); if (array == null || array.Length == 0) { return; } Collider[] array2 = array; Vector3 val2 = default(Vector3); foreach (Collider val in array2) { if (!Object.op_Implicit((Object)(object)val)) { continue; } Character componentInParent = ((Component)val).GetComponentInParent(); if (!((Object)(object)componentInParent == (Object)null)) { Vector3 position = ((Component)componentInParent).transform.position; ((Vector3)(ref val2))..ctor(center.x, position.y, center.z); if (!(Vector3.Distance(position, val2) > radius + 0.15f)) { TryApplyImmobilized(componentInParent); } } } } private static void NukeDamageComponents(GameObject root) { if (Object.op_Implicit((Object)(object)root)) { CleanOnce(root); NoDamageCleaner noDamageCleaner = root.AddComponent(); noDamageCleaner.Run(root, 6); } } private static void CleanOnce(GameObject root) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) try { Aoe[] componentsInChildren = root.GetComponentsInChildren(true); foreach (Aoe val in componentsInChildren) { if (!((Object)(object)val == (Object)null)) { val.m_damage = default(DamageTypes); ((Behaviour)val).enabled = false; } } Projectile[] componentsInChildren2 = root.GetComponentsInChildren(true); foreach (Projectile val2 in componentsInChildren2) { if (!((Object)(object)val2 == (Object)null)) { val2.m_damage = default(DamageTypes); ((Behaviour)val2).enabled = false; } } } catch (Exception ex) { Debug.LogWarning((object)("[SE_MagicRoots] CleanOnce error: " + ex.Message)); } } private static Camera GetGameCamera() { if ((Object)(object)GameCamera.instance?.m_camera != (Object)null) { return GameCamera.instance.m_camera; } return Camera.main; } private static Shader TryFindShader(params string[] names) { foreach (string text in names) { Shader val = Shader.Find(text); if ((Object)(object)val != (Object)null) { return val; } } return null; } private static Texture2D LoadTexture_NoRef(string fileName) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown string text = Path.Combine(Paths.PluginPath, "NazhikaCore", "Assets", "Images", fileName); if (!File.Exists(text)) { Debug.LogWarning((object)("[SE_MagicRoots] PNG no encontrado: " + text)); return Texture2D.whiteTexture; } byte[] array = File.ReadAllBytes(text); Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false); try { MethodInfo methodInfo = Type.GetType("UnityEngine.ImageConversion, UnityEngine.ImageConversionModule")?.GetMethod("LoadImage", new Type[3] { typeof(Texture2D), typeof(byte[]), typeof(bool) }); if (methodInfo != null && (bool)methodInfo.Invoke(null, new object[3] { val, array, false })) { return val; } } catch { } return Texture2D.whiteTexture; } } public static class SE_MagicRootsSetup { public static void Init() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown SE_MagicRoots sE_MagicRoots = ScriptableObject.CreateInstance(); ItemManager.Instance.AddStatusEffect(new CustomStatusEffect((StatusEffect)(object)sE_MagicRoots, true)); SE_MagicRootsFX_Target.Init(); Debug.Log((object)"[NazhikaCore] ✅ SE_MagicRoots + SE_MagicRootsFX_Target registrados en Jotunn"); } } public class SE_MagicRootsFX_Target : StatusEffect { public const string InternalName = "SE_MagicRootsFX_Target"; public static readonly int NameHash = StringExtensionMethods.GetStableHashCode("SE_MagicRootsFX_Target"); private const string RootFxPrefab = "fx_RootAshlands"; private Character _character; private GameObject _fxInstance; public SE_MagicRootsFX_Target() { ((Object)this).name = "SE_MagicRootsFX_Target"; base.m_name = "Magic Roots (FX)"; base.m_ttl = 5f; } public override void Setup(Character character) { ((StatusEffect)this).Setup(character); _character = character; SpawnFx(); } public override void UpdateStatusEffect(float dt) { ((StatusEffect)this).UpdateStatusEffect(dt); if ((Object)(object)_fxInstance == (Object)null) { SpawnFx(); } } public override void Stop() { ((StatusEffect)this).Stop(); if ((Object)(object)_fxInstance != (Object)null) { Object.Destroy((Object)(object)_fxInstance); } _fxInstance = null; _character = null; } private void SpawnFx() { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: 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) if ((Object)(object)_character == (Object)null || (Object)(object)_fxInstance != (Object)null || (Object)(object)ZNetScene.instance == (Object)null) { return; } GameObject prefab = ZNetScene.instance.GetPrefab("fx_RootAshlands"); if ((Object)(object)prefab == (Object)null) { return; } _fxInstance = Object.Instantiate(prefab, ((Component)_character).transform.position, Quaternion.identity); if (!((Object)(object)_fxInstance == (Object)null)) { _fxInstance.transform.SetParent(((Component)_character).transform, true); ((Object)_fxInstance).name = "MagicRootsFX_Target"; Aoe[] componentsInChildren = _fxInstance.GetComponentsInChildren(true); foreach (Aoe val in componentsInChildren) { val.m_damage = default(DamageTypes); ((Behaviour)val).enabled = false; } Projectile[] componentsInChildren2 = _fxInstance.GetComponentsInChildren(true); foreach (Projectile val2 in componentsInChildren2) { val2.m_damage = default(DamageTypes); ((Behaviour)val2).enabled = false; } } } public static void Init() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown SE_MagicRootsFX_Target sE_MagicRootsFX_Target = ScriptableObject.CreateInstance(); ItemManager.Instance.AddStatusEffect(new CustomStatusEffect((StatusEffect)(object)sE_MagicRootsFX_Target, true)); } } public class SE_OrbGauge : StatusEffect { public static readonly string Name = "SE_OrbGauge"; public static readonly int NameHash = StringExtensionMethods.GetStableHashCode(Name); private const int HitsPerOrb = 4; private const int MaxOrbs = 4; private const float DecayDelay = 5f; private const float DecayRate = 2f; private static readonly Color PhaseColor = new Color(0f, 1f, 0.8f); public int Orbs; private int _kiHits; private float _timeSinceLastHit; private float _decayAccumulator; private int _totalHitsForFx; private int _lastPhase = -1; private GameObject _phaseFxInstance; private TrailRenderer[] _cachedTrails; private Material[] _cachedTrailMats; public int KiHits => _kiHits; public bool PauseAtkSpeedBonus { get; set; } public float CurrentAtkSpeedBonus { get { if (!PauseAtkSpeedBonus) { return Mathf.Max(0f, (float)_kiHits * BalanceConfig.OrbAtkSpeedPerKi); } return 0f; } } public override void Setup(Character character) { ((StatusEffect)this).Setup(character); ((Object)this).name = Name; _timeSinceLastHit = 0f; _decayAccumulator = 0f; _lastPhase = -1; Player val = (Player)(object)((character is Player) ? character : null); if (val != null && (Object)(object)val == (Object)(object)Player.m_localPlayer) { OrbsUI.ShowOrbs(Orbs); OrbsUI.SetKiHits(_kiHits); OrbsUI.SetAtkSpeedBonus(CurrentAtkSpeedBonus); } ApplyStanceBenefits((Player)(object)((character is Player) ? character : null), Orbs); } public override void UpdateStatusEffect(float dt) { ((StatusEffect)this).UpdateStatusEffect(dt); Character character = base.m_character; Player val = (Player)(object)((character is Player) ? character : null); if (val == null) { return; } _timeSinceLastHit += dt; if (_timeSinceLastHit >= 5f && _kiHits > 0) { _decayAccumulator += 2f * dt; int num = Mathf.FloorToInt(_decayAccumulator); if (num > 0) { _decayAccumulator -= num; _kiHits = Mathf.Max(0, _kiHits - num); int orbs = Orbs; Orbs = Mathf.Clamp(_kiHits / 4, 0, 4); if (Orbs != orbs) { ApplyStanceBenefits(val, Orbs); } if (_kiHits == 0) { _decayAccumulator = 0f; } } } else if (_timeSinceLastHit < 5f) { _decayAccumulator = 0f; } if ((Object)(object)val == (Object)(object)Player.m_localPlayer) { OrbsUI.SetCurrentOrbs(Orbs); OrbsUI.SetKiHits(_kiHits); OrbsUI.SetAtkSpeedBonus(CurrentAtkSpeedBonus); } } public override void Stop() { Character character = base.m_character; Player val = (Player)(object)((character is Player) ? character : null); if (val != null && (Object)(object)val == (Object)(object)Player.m_localPlayer) { OrbsUI.HideOrbs(); } ClearPhaseFx(); ((StatusEffect)this).Stop(); } public void RegisterHit(Player player) { if (SE_OrbGaugeSetup.IsUnarmedOrFists(player)) { int num = 16; _kiHits = Mathf.Clamp(_kiHits + 1, 0, num); _totalHitsForFx++; if (_totalHitsForFx % 2 == 0) { TriggerHitSparksFx(player); } int orbs = Orbs; Orbs = Mathf.Clamp(_kiHits / 4, 0, 4); if ((Object)(object)player == (Object)(object)Player.m_localPlayer) { OrbsUI.SetCurrentOrbs(Orbs); OrbsUI.SetKiHits(_kiHits); OrbsUI.SetAtkSpeedBonus(CurrentAtkSpeedBonus); } if (Orbs != orbs) { ApplyStanceBenefits(player, Orbs); } _timeSinceLastHit = 0f; _decayAccumulator = 0f; } } public void ConsumeAllOrbs(Player player) { _kiHits = 0; Orbs = 0; _decayAccumulator = 0f; _timeSinceLastHit = 0f; int lastPhase = _lastPhase; ApplyStanceBenefits(player, 0); if ((Object)(object)player == (Object)(object)Player.m_localPlayer) { OrbsUI.SetCurrentOrbs(0); OrbsUI.SetKiHits(0); OrbsUI.SetAtkSpeedBonus(0f); } Debug.Log((object)("[SE_OrbGauge] ConsumeAllOrbs → orbs y ki reseteados para " + ((player != null) ? player.GetPlayerName() : null))); } public void SetKiOrbsSilent(int kiHits, int orbs) { _kiHits = Mathf.Max(0, kiHits); Orbs = Mathf.Clamp(orbs, 0, 4); } public static void ConsumeAllOrbsFor(Player player) { if (!((Object)(object)player == (Object)null)) { SEMan sEMan = ((Character)player).GetSEMan(); if (((sEMan != null) ? sEMan.GetStatusEffect(NameHash) : null) is SE_OrbGauge sE_OrbGauge) { sE_OrbGauge.ConsumeAllOrbs(player); } } } private void TriggerHitSparksFx(Player player) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)player)) { return; } ZNetScene instance = ZNetScene.instance; if (!((Object)(object)instance == (Object)null)) { GameObject prefab = instance.GetPrefab("fx_crit"); if (!Object.op_Implicit((Object)(object)prefab)) { Debug.LogWarning((object)"[SE_OrbGauge] No se encontró prefab fx_crit"); return; } Vector3 val = ((Component)player).transform.position + Vector3.up * 1f; Object.Instantiate(prefab, val, Quaternion.identity); } } private void ApplyStanceBenefits(Player player, int phase) { if ((Object)(object)player == (Object)null || phase == _lastPhase) { return; } _lastPhase = phase; if (!((Object)(object)player != (Object)(object)Player.m_localPlayer)) { if (phase == 0) { ClearPhaseFx(); } else if ((Object)(object)_phaseFxInstance == (Object)null) { SpawnPhaseFxForPhase(player, phase); } else { RecolorTrailsOnly(_phaseFxInstance); } } } private string GetPhaseFxPrefabName(int phase) { return "vfx_BugRepellent"; } private void ClearPhaseFx() { if ((Object)(object)_phaseFxInstance != (Object)null) { Object.Destroy((Object)(object)_phaseFxInstance); _phaseFxInstance = null; } _cachedTrails = null; _cachedTrailMats = null; } private void SpawnPhaseFxForPhase(Player player, int phase) { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)player)) { return; } ZNetScene instance = ZNetScene.instance; if ((Object)(object)instance == (Object)null) { return; } string phaseFxPrefabName = GetPhaseFxPrefabName(phase); GameObject prefab = instance.GetPrefab(phaseFxPrefabName); if (!Object.op_Implicit((Object)(object)prefab)) { Debug.LogWarning((object)("[SE_OrbGauge] No se encontró prefab '" + phaseFxPrefabName + "'")); return; } Transform val = (Object.op_Implicit((Object)(object)((Character)player).m_visual) ? ((Character)player).m_visual.transform : ((Component)player).transform); GameObject val2 = new GameObject("OrbGauge_BugRepellent_TrailsFX"); val2.transform.SetParent(val, false); val2.transform.localPosition = new Vector3(0f, 1f, 0f); bool flag = false; Transform[] componentsInChildren = prefab.GetComponentsInChildren(true); Transform[] array = componentsInChildren; foreach (Transform val3 in array) { if ((Object)(object)val3 == (Object)null) { continue; } string text = ((Object)val3).name.ToLowerInvariant(); if (!text.Contains("trails")) { continue; } GameObject val4 = Object.Instantiate(((Component)val3).gameObject); val4.transform.SetParent(val2.transform, false); val4.transform.localPosition = val3.localPosition; val4.transform.localRotation = val3.localRotation; val4.transform.localScale = val3.localScale; Transform[] componentsInChildren2 = val4.GetComponentsInChildren(true); foreach (Transform val5 in componentsInChildren2) { if (!((Object)(object)val5 == (Object)null)) { ((Component)val5).gameObject.SetActive(true); } } flag = true; } if (!flag) { Debug.LogWarning((object)"[SE_OrbGauge] No se encontraron hijos con 'trails' en vfx_BugRepellent. Eliminando root vacío."); Object.Destroy((Object)(object)val2); return; } MakeFxPersistent_PSOnly(val2); CacheTrails(val2); RecolorTrailsOnly(val2); _phaseFxInstance = val2; } private void CacheTrails(GameObject root) { if (!Object.op_Implicit((Object)(object)root)) { return; } _cachedTrails = root.GetComponentsInChildren(true); if (_cachedTrails == null || _cachedTrails.Length == 0) { _cachedTrailMats = null; return; } List list = new List(16); for (int i = 0; i < _cachedTrails.Length; i++) { TrailRenderer val = _cachedTrails[i]; if (!Object.op_Implicit((Object)(object)val)) { continue; } Material[] materials = ((Renderer)val).materials; if (materials == null) { continue; } foreach (Material val2 in materials) { if (Object.op_Implicit((Object)(object)val2) && !list.Contains(val2)) { list.Add(val2); } } } _cachedTrailMats = list.ToArray(); } private void RecolorTrailsOnly(GameObject root) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: 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_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)root)) { return; } if (_cachedTrails == null || _cachedTrailMats == null) { CacheTrails(root); } if (_cachedTrails != null) { for (int i = 0; i < _cachedTrails.Length; i++) { TrailRenderer val = _cachedTrails[i]; if (Object.op_Implicit((Object)(object)val)) { val.startColor = PhaseColor; val.endColor = new Color(PhaseColor.r, PhaseColor.g, PhaseColor.b, 0f); } } } if (_cachedTrailMats == null) { return; } for (int j = 0; j < _cachedTrailMats.Length; j++) { Material val2 = _cachedTrailMats[j]; if (Object.op_Implicit((Object)(object)val2)) { if (val2.HasProperty("_Color")) { val2.SetColor("_Color", PhaseColor); } if (val2.HasProperty("_BaseColor")) { val2.SetColor("_BaseColor", PhaseColor); } if (val2.HasProperty("_TintColor")) { val2.SetColor("_TintColor", PhaseColor); } if (val2.HasProperty("_EmissionColor")) { val2.SetColor("_EmissionColor", PhaseColor); } } } } private static void MakeFxPersistent_PSOnly(GameObject root) { //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)root)) { return; } TimedDestruction[] componentsInChildren = root.GetComponentsInChildren(true); foreach (TimedDestruction val in componentsInChildren) { if (!((Object)(object)val == (Object)null)) { Object.Destroy((Object)(object)val); } } MonoBehaviour[] componentsInChildren2 = root.GetComponentsInChildren(true); foreach (MonoBehaviour val2 in componentsInChildren2) { if (!((Object)(object)val2 == (Object)null)) { Object.Destroy((Object)(object)val2); } } Light[] componentsInChildren3 = root.GetComponentsInChildren(true); foreach (Light val3 in componentsInChildren3) { if (!((Object)(object)val3 == (Object)null)) { ((Behaviour)val3).enabled = true; val3.intensity = Mathf.Max(val3.intensity, 1f); val3.range = Mathf.Max(val3.range, 2f); } } ParticleSystem[] componentsInChildren4 = root.GetComponentsInChildren(true); foreach (ParticleSystem val4 in componentsInChildren4) { MainModule main = val4.main; ((MainModule)(ref main)).loop = true; ((MainModule)(ref main)).stopAction = (ParticleSystemStopAction)0; if (!val4.isPlaying) { val4.Play(true); } } } public static void AddKiOnHit(Player player) { if ((Object)(object)player == (Object)null || !SE_OrbGaugeSetup.IsUnarmedOrFists(player)) { return; } SEMan sEMan = ((Character)player).GetSEMan(); if (sEMan != null) { SE_OrbGauge sE_OrbGauge = sEMan.GetStatusEffect(NameHash) as SE_OrbGauge; if ((Object)(object)sE_OrbGauge == (Object)null) { sE_OrbGauge = sEMan.AddStatusEffect(NameHash, false, 0, 0f) as SE_OrbGauge; } sE_OrbGauge?.RegisterHit(player); } } } public static class SE_OrbGaugeSetup { private static bool _asmRegistered; public static void Init() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown SE_OrbGauge sE_OrbGauge = ScriptableObject.CreateInstance(); ((Object)sE_OrbGauge).name = SE_OrbGauge.Name; ((StatusEffect)sE_OrbGauge).m_name = "Orb Gauge (Ki)"; ((StatusEffect)sE_OrbGauge).m_ttl = 0f; CustomStatusEffect val = new CustomStatusEffect((StatusEffect)(object)sE_OrbGauge, true); ItemManager.Instance.AddStatusEffect(val); if (_asmRegistered) { return; } _asmRegistered = true; AnimationSpeedManager.Add(delegate(Character character, double speed) { Player val2 = (Player)(object)((character is Player) ? character : null); if ((Object)(object)val2 == (Object)null) { return speed; } if (!((Character)val2).InAttack() || ((Humanoid)val2).m_currentAttack == null) { return speed; } if (!IsUnarmedOrFists(val2)) { return speed; } SEMan sEMan = ((Character)val2).GetSEMan(); SE_OrbGauge sE_OrbGauge2 = ((sEMan != null) ? (sEMan.GetStatusEffect(SE_OrbGauge.NameHash) as SE_OrbGauge) : null); if ((Object)(object)sE_OrbGauge2 == (Object)null) { return speed; } int kiHits = sE_OrbGauge2.KiHits; if (kiHits <= 0) { return speed; } float num = (float)kiHits * BalanceConfig.OrbAtkSpeedPerKi; return speed * (double)(1f + num); }); } public static bool IsUnarmedOrFists(Player p) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Invalid comparison between Unknown and I4 if ((Object)(object)p == (Object)null) { return false; } ItemData rightItem = ((Humanoid)p).m_rightItem; if (rightItem == null || rightItem.m_shared == null) { return true; } return (int)rightItem.m_shared.m_skillType == 11; } } public class SE_ParryRegen : StatusEffect { public static readonly int NameHash = StringExtensionMethods.GetStableHashCode("SE_ParryRegen"); private const float Duration = 5f; private const float RegenMult = 3f; private const float TickInterval = 1f; private const float TickHealPct = 0.025f; private float _tickTimer; public SE_ParryRegen() { ((Object)this).name = "SE_ParryRegen"; base.m_name = "Parry Regen"; base.m_tooltip = "Regeneración de vida +200% tras parry perfecto. Además cura 10% de vida máx por tick."; base.m_ttl = 5f; base.m_icon = IconHelper.Load("ParryRegen.png"); } public override void Setup(Character character) { ((StatusEffect)this).Setup(character); _tickTimer = 0f; } public override void UpdateStatusEffect(float dt) { ((StatusEffect)this).UpdateStatusEffect(dt); if (!((Object)(object)base.m_character == (Object)null)) { _tickTimer += dt; if (!(_tickTimer < 1f)) { _tickTimer = 0f; float maxHealth = base.m_character.GetMaxHealth(); float num = maxHealth * 0.025f; base.m_character.Heal(num, true); Debug.Log((object)$"[NazhikaCore] SE_ParryRegen TickHeal: +{num:0.#} HP (10% de {maxHealth:0.#})."); } } } } public static class SE_ParryRegenSetup { private static bool _inited; public static void Init() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown if (!_inited) { _inited = true; SE_ParryRegen sE_ParryRegen = ScriptableObject.CreateInstance(); ItemManager.Instance.AddStatusEffect(new CustomStatusEffect((StatusEffect)(object)sE_ParryRegen, false)); Debug.Log((object)"[NazhikaCore] SE_ParryRegen registrado (sin FX, con tick heal 10%)."); } } } public class SE_PassiveAtkSpeed : StatusEffect { public static readonly int NameHash = StringExtensionMethods.GetStableHashCode("SE_PassiveAtkSpeed"); public SE_PassiveAtkSpeed() { ((Object)this).name = "SE_PassiveAtkSpeed"; base.m_name = "Velocidad de Ataque Pasiva"; base.m_tooltip = $"+{(BalanceConfig.PassiveAtkSpeedBonus - 1f) * 100f:0}% velocidad de ataque."; base.m_ttl = 0f; } } public static class SE_PassiveAtkSpeedSetup { private static bool _registered; public static void Init() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown if (_registered) { return; } _registered = true; SE_PassiveAtkSpeed sE_PassiveAtkSpeed = ScriptableObject.CreateInstance(); CustomStatusEffect val = new CustomStatusEffect((StatusEffect)(object)sE_PassiveAtkSpeed, true); ItemManager.Instance.AddStatusEffect(val); AnimationSpeedManager.Add(delegate(Character character, double speed) { Player val2 = (Player)(object)((character is Player) ? character : null); if ((Object)(object)val2 == (Object)null) { return speed; } if (!((Character)val2).InAttack() || ((Humanoid)val2).m_currentAttack == null) { return speed; } SEMan sEMan = ((Character)val2).GetSEMan(); if (sEMan == null) { return speed; } return ((Object)(object)sEMan.GetStatusEffect(SE_PassiveAtkSpeed.NameHash) == (Object)null) ? speed : (speed * (double)BalanceConfig.PassiveAtkSpeedBonus); }); Log.Info("[NazhikaCore] ✅ SE_PassiveAtkSpeed registrado."); } } public class SE_SwordPoison : StatusEffect { private static ManualLogSource _logger; public SE_SwordPoison() { ((Object)this).name = "SE_SwordPoison"; base.m_name = "Elemento Veneno"; base.m_tooltip = "Tus espadas se cargan de elemento veneno por un tiempo limitado."; base.m_icon = IconHelper.Load("SwordPoison.png"); base.m_ttl = 20f; if (_logger == null) { _logger = Logger.CreateLogSource("SE_SwordPoison"); } } public override void Setup(Character character) { ((StatusEffect)this).Setup(character); Player val = (Player)(object)((character is Player) ? character : null); if (val != null) { ManualLogSource logger = _logger; if (logger != null) { logger.LogInfo((object)("[" + base.m_name + "] Setup → activando FX (vía RPC) en " + val.GetPlayerName())); } SwordPoisonRPC.ApplyFromStatus(val, active: true); } } public override void Stop() { Character character = base.m_character; Player val = (Player)(object)((character is Player) ? character : null); if (val != null) { ManualLogSource logger = _logger; if (logger != null) { logger.LogInfo((object)("[" + base.m_name + "] Stop → desactivando FX (vía RPC) en " + val.GetPlayerName())); } SwordPoisonRPC.ApplyFromStatus(val, active: false); PlayerClassBase @class = ClassManager.GetClass(val); if (@class != null) { @class.TryBeginCooldown(val); SkillsUI.StartCooldown(@class.CooldownSeconds); Log.Info($"[SE_SwordPoison] Buff terminado → cooldown de {@class.CooldownSeconds}s iniciado para {val.GetPlayerName()}"); } } ((StatusEffect)this).RemoveStartEffects(); ((StatusEffect)this).Stop(); } } public static class SE_SwordPoisonSetup { public static void Init() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown SE_SwordPoison sE_SwordPoison = ScriptableObject.CreateInstance(); CustomStatusEffect val = new CustomStatusEffect((StatusEffect)(object)sE_SwordPoison, true); ItemManager.Instance.AddStatusEffect(val); Debug.Log((object)"[NazhikaCore] SE_SwordPoison registrado correctamente."); } } public class SE_Fatigue : StatusEffect { public const float MaxLevel = 5f; public const float RegenPenaltyPerLevel = 0.1f; public const float SpeedPenaltyPerLevel = 0.02f; private const float CheckInterval = 300f; private static readonly int RestedHash = StringExtensionMethods.GetStableHashCode("Rested"); [SerializeField] public float Level; private Biome _lastBiome; private float _sameBiomeElapsed; private float _debugTicker; private float _soundTicker; private Sprite _fatigueIcon; public static int NameHash => StringExtensionMethods.GetStableHashCode("SE_Fatigue"); public SE_Fatigue() { ((Object)this).name = "SE_Fatigue"; base.m_name = "Fatiga"; base.m_tooltip = "Estás fatigado."; base.m_ttl = 0f; } public override void Setup(Character character) { //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) ((StatusEffect)this).Setup(character); _fatigueIcon = IconHelper.Load("fatigue.png"); Player val = (Player)(object)((character is Player) ? character : null); if ((Object)(object)val != (Object)null) { _lastBiome = val.GetCurrentBiome(); _sameBiomeElapsed = 0f; _debugTicker = 0f; _soundTicker = 0f; Level = 0f; base.m_icon = null; } } private float GetRegenMult() { return Mathf.Clamp01(1f - Level * 0.1f); } private float GetSpeedMult() { return Mathf.Clamp(1f - Level * 0.02f, 0.1f, 1f); } public override void ModifyStaminaRegen(ref float staminaRegen) { staminaRegen *= GetRegenMult(); } public override void ModifySpeed(float baseSpeed, ref float speed, Character character, Vector3 dir) { speed *= GetSpeedMult(); } private void PlayFatigueSound(Player p) { //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) string text = null; if (Level >= 5f) { text = "sfx_goblin_idle"; } else if (Level >= 4f) { text = "sfx_charred_idle"; } else if (Level >= 3f) { text = "sfx_evilspirit_attack"; } else if (Level >= 2f) { text = "sfx_evilspirit_attack"; } else if (Level >= 1f) { text = "sfx_wraith_idle"; } if (text != null) { GameObject prefab = ZNetScene.instance.GetPrefab(text); if ((Object)(object)prefab != (Object)null) { Object.Instantiate(prefab, ((Component)p).transform.position, Quaternion.identity); } else { Debug.LogWarning((object)("[NazhikaCore-Fatigue] SFX no encontrado: " + text)); } } } public override void UpdateStatusEffect(float dt) { //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_0097: 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) ((StatusEffect)this).UpdateStatusEffect(dt); Character character = base.m_character; Player val = (Player)(object)((character is Player) ? character : null); if ((Object)(object)val == (Object)null || !((Character)val).IsOwner()) { return; } SEMan sEMan = ((Character)val).GetSEMan(); if (sEMan == null) { return; } base.m_icon = ((Level >= 0.5f) ? _fatigueIcon : null); if (sEMan.HaveStatusEffect(RestedHash)) { if (Level > 0f) { Level = 0f; ((Character)val).Message((MessageType)1, "\ud83d\udecf\ufe0f Descansas y eliminas la fatiga", 0, (Sprite)null); } _sameBiomeElapsed = 0f; _soundTicker = 0f; _lastBiome = val.GetCurrentBiome(); return; } Biome currentBiome = val.GetCurrentBiome(); if (currentBiome != _lastBiome) { _sameBiomeElapsed = 0f; _lastBiome = currentBiome; return; } _sameBiomeElapsed += dt; _debugTicker += dt; if (_debugTicker >= 5f) { _debugTicker = 0f; } _soundTicker += dt; float num = Mathf.Lerp(300f, 90f, Level / 5f); if (_soundTicker >= num && Level >= 1f) { _soundTicker = 0f; PlayFatigueSound(val); } if (_sameBiomeElapsed >= 300f) { _sameBiomeElapsed = 0f; float level = Level; Level = Mathf.Clamp(Level + 0.5f, 0f, 5f); if (Level > level) { string text = LevelToShortText(Level); ((Character)val).Message((MessageType)1, "⛰\ufe0f Fatiga " + text + " por permanecer en el mismo bioma", 0, (Sprite)null); } } string text2 = LevelToText(Level); int num2 = Mathf.RoundToInt(Level * 0.1f * 100f); int num3 = Mathf.RoundToInt(Level * 0.02f * 100f); base.m_tooltip = "Fatiga: " + text2 + "\n-" + num2 + "% regeneración de Stamina\n-" + num3 + "% velocidad de movimiento"; } public override string GetIconText() { if (Level <= 0f) { return ""; } return LevelToShortText(Level); } public static string LevelToText(float lvl) { if (lvl < 1f) { return "Leve \ud83d\ude13"; } if (lvl < 2f) { return "Media \ud83d\ude30"; } if (lvl < 3f) { return "Moderada \ud83d\ude2b"; } if (lvl < 4f) { return "Severa \ud83d\ude16"; } return "Grave ☠\ufe0f"; } public static string LevelToShortText(float lvl) { if (lvl < 1f) { return "Leve"; } if (lvl < 2f) { return "Media"; } if (lvl < 3f) { return "Mod."; } if (lvl < 4f) { return "Sev."; } return "Grave"; } } public static class SE_FatigueSetup { public static void Init() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown SE_Fatigue sE_Fatigue = ScriptableObject.CreateInstance(); CustomStatusEffect val = new CustomStatusEffect((StatusEffect)(object)sE_Fatigue, true); ItemManager.Instance.AddStatusEffect(val); } } public class SE_SpearStacks : StatusEffect { public static readonly int NameHash = StringExtensionMethods.GetStableHashCode("SE_SpearStacks"); public int CurrentStacks; public int MaxStacks = 5; private const float specialSpinExtra = 0.4f; private Character m_character; private float _timeSinceLastHit; private const float IdleThreshold = 5f; private float _decayTimer; private const float DecayInterval = 1f; public SE_SpearStacks() { ((Object)this).name = "SE_SpearStacks"; base.m_name = "SpearStacks"; base.m_icon = IconHelper.Load("SpearStacks.png"); base.m_tooltip = "Aumenta velocidad de ataque y daño perforante con lanza/atgeir."; base.m_time = 9999f; } public override void Setup(Character character) { ((StatusEffect)this).Setup(character); m_character = character; CurrentStacks = Mathf.Clamp(CurrentStacks, 0, MaxStacks); _timeSinceLastHit = 0f; _decayTimer = 0f; } public override void UpdateStatusEffect(float dt) { ((StatusEffect)this).UpdateStatusEffect(dt); float spearPiercePerStack = BalanceConfig.SpearPiercePerStack; float spearAtkSpeedPerStack = BalanceConfig.SpearAtkSpeedPerStack; base.m_tooltip = $"Stacks: {CurrentStacks}/{MaxStacks}\n" + $"+{Mathf.RoundToInt((float)CurrentStacks * spearAtkSpeedPerStack * 100f)}% Velocidad de ataque (Spears/Polearms)\n" + $"+{Mathf.RoundToInt((float)CurrentStacks * spearPiercePerStack * 100f)}% Daño perforante\n" + $"Especial Atgeir: +{Mathf.RoundToInt(40f)}% fijo"; _timeSinceLastHit += dt; if (_timeSinceLastHit >= 5f && CurrentStacks > 0) { _decayTimer += dt; if (_decayTimer >= 1f) { _decayTimer = 0f; CurrentStacks = Mathf.Max(0, CurrentStacks - 1); } } } public override void Stop() { ((StatusEffect)this).Stop(); } public void AddStack() { if (CurrentStacks < MaxStacks) { CurrentStacks++; } _timeSinceLastHit = 0f; _decayTimer = 0f; base.m_time = 9999f; } public override void ModifyAttack(SkillType skill, ref HitData hitData) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Invalid comparison between Unknown and I4 //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Invalid comparison between Unknown and I4 //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Invalid comparison between Unknown and I4 if ((int)skill == 5 || (int)skill == 4) { _timeSinceLastHit = 0f; _decayTimer = 0f; } if (hitData.m_damage.m_pierce > 0f && ((int)skill == 5 || (int)skill == 4)) { hitData.m_damage.m_pierce *= 1f + BalanceConfig.SpearPiercePerStack * (float)CurrentStacks; } } public override string GetIconText() { return CurrentStacks.ToString(); } } public static class SE_SpearStacksSetup { private static bool _asmRegistered; public static void Init() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown SE_SpearStacks sE_SpearStacks = ScriptableObject.CreateInstance(); CustomStatusEffect val = new CustomStatusEffect((StatusEffect)(object)sE_SpearStacks, true); ItemManager.Instance.AddStatusEffect(val); Debug.Log((object)"[NazhikaCore] ✅ SE_SpearStacks registrado correctamente en Jotunn"); if (_asmRegistered) { return; } _asmRegistered = true; AnimationSpeedManager.Add(delegate(Character character, double speed) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Invalid comparison between Unknown and I4 //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Invalid comparison between Unknown and I4 //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Invalid comparison between Unknown and I4 Player val2 = (Player)(object)((character is Player) ? character : null); if ((Object)(object)val2 == (Object)null) { return speed; } if (!((Character)val2).InAttack() || ((Humanoid)val2).m_currentAttack == null) { return speed; } ItemData weapon = ((Humanoid)val2).m_currentAttack.m_weapon; SkillType val3 = (SkillType)((weapon != null && weapon.m_shared != null) ? ((int)weapon.m_shared.m_skillType) : 0); if ((int)val3 != 5 && (int)val3 != 4) { return speed; } SEMan sEMan = ((Character)val2).GetSEMan(); SE_SpearStacks sE_SpearStacks2 = ((sEMan != null) ? (sEMan.GetStatusEffect(SE_SpearStacks.NameHash) as SE_SpearStacks) : null); if ((Object)(object)sE_SpearStacks2 == (Object)null || sE_SpearStacks2.CurrentStacks <= 0) { return speed; } if ((int)val3 == 4 && ((Humanoid)val2).m_currentAttackIsSecondary) { return speed; } float num = 1f + (float)sE_SpearStacks2.CurrentStacks * BalanceConfig.SpearAtkSpeedPerStack; return speed * (double)num; }); } } public class SE_SwordLightning : StatusEffect { private static ManualLogSource _logger; public SE_SwordLightning() { ((Object)this).name = "SE_SwordLightning"; base.m_name = "Elemento Rayo"; base.m_tooltip = "Tus espadas se cargan de elemento rayo por un tiempo limitado."; base.m_icon = IconHelper.Load("SwordLightning.png"); base.m_ttl = 20f; } public override void Setup(Character character) { ((StatusEffect)this).Setup(character); Player val = (Player)(object)((character is Player) ? character : null); if (val != null) { SwordLightningRPC.ApplyFromStatus(val, active: true); ManualLogSource logger = _logger; if (logger != null) { logger.LogInfo((object)("[" + base.m_name + "] Setup en " + val.GetPlayerName() + " → activar (ZDO+RPC).")); } } } public override void Stop() { Character character = base.m_character; Player val = (Player)(object)((character is Player) ? character : null); if (val != null) { SwordLightningRPC.ApplyFromStatus(val, active: false); ManualLogSource logger = _logger; if (logger != null) { logger.LogInfo((object)("[" + base.m_name + "] Stop en " + val.GetPlayerName() + " → desactivar (ZDO+RPC).")); } PlayerClassBase @class = ClassManager.GetClass(val); if (@class != null) { @class.TryBeginCooldown(val); SkillsUI.StartCooldown(@class.CooldownSeconds); Log.Info($"[SE_SwordLightning] Buff terminado → cooldown de {@class.CooldownSeconds}s iniciado para {val.GetPlayerName()}"); } } ((StatusEffect)this).RemoveStartEffects(); ((StatusEffect)this).Stop(); } } public static class SE_SwordLightningSetup { public static void Init() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown SE_SwordLightning sE_SwordLightning = ScriptableObject.CreateInstance(); CustomStatusEffect val = new CustomStatusEffect((StatusEffect)(object)sE_SwordLightning, true); ItemManager.Instance.AddStatusEffect(val); Debug.Log((object)"[NazhikaCore] SE_SwordLightning registrado correctamente."); } } public class SE_SwordWither : StatusEffect { private static ManualLogSource _logger; public SE_SwordWither() { ((Object)this).name = "SE_SwordWither"; base.m_name = "Elemento Marchitar"; base.m_tooltip = "Tus espadas se cargan de elemento marchitar por un tiempo limitado."; base.m_icon = IconHelper.Load("SwordWither.png"); base.m_ttl = 15f; } public override void Setup(Character character) { ((StatusEffect)this).Setup(character); Player val = (Player)(object)((character is Player) ? character : null); if (val != null) { SwordWitherRPC.ApplyFromStatus(val, active: true); ManualLogSource logger = _logger; if (logger != null) { logger.LogInfo((object)("[" + base.m_name + "] Setup en " + val.GetPlayerName() + " → activar (ZDO+RPC).")); } } } public override void Stop() { Character character = base.m_character; Player val = (Player)(object)((character is Player) ? character : null); if (val != null) { SwordWitherRPC.ApplyFromStatus(val, active: false); ManualLogSource logger = _logger; if (logger != null) { logger.LogInfo((object)("[" + base.m_name + "] Stop en " + val.GetPlayerName() + " → desactivar (ZDO+RPC).")); } PlayerClassBase @class = ClassManager.GetClass(val); if (@class != null) { @class.TryBeginCooldown(val); SkillsUI.StartCooldown(@class.CooldownSeconds); Log.Info($"[SE_SwordWither] Buff terminado → cooldown de {@class.CooldownSeconds}s iniciado para {val.GetPlayerName()}"); } } ((StatusEffect)this).RemoveStartEffects(); ((StatusEffect)this).Stop(); } } public static class SE_SwordWitherSetup { public static void Init() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown SE_SwordWither sE_SwordWither = ScriptableObject.CreateInstance(); CustomStatusEffect val = new CustomStatusEffect((StatusEffect)(object)sE_SwordWither, true); ItemManager.Instance.AddStatusEffect(val); Debug.Log((object)"[NazhikaCore] SE_SwordWither registrado correctamente."); } } public class SE_TankPassive : StatusEffect { public const string InternalName = "SE_TankPassive"; public static readonly int NameHash = StringExtensionMethods.GetStableHashCode("SE_TankPassive"); public SE_TankPassive() { ((Object)this).name = "SE_TankPassive"; base.m_name = "Tank Passive"; base.m_tooltip = "Recibes menos daño gracias a tu entrenamiento de Tank."; base.m_icon = null; base.m_ttl = 0f; } } public static class SE_TankPassiveSetup { public static void Init() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown SE_TankPassive sE_TankPassive = ScriptableObject.CreateInstance(); CustomStatusEffect val = new CustomStatusEffect((StatusEffect)(object)sE_TankPassive, true); ItemManager.Instance.AddStatusEffect(val); Debug.Log((object)"[NazhikaCore] ✅ SE_TankPassive registrado."); } } public class SE_ToxicCloud : StatusEffect { public const string InternalName = "SE_ToxicCloud"; public static readonly int NameHash = StringExtensionMethods.GetStableHashCode("SE_ToxicCloud"); private const KeyCode ToggleKey = 57; private const float CircleYOffset = 0.06f; private const float SymbolWorldSize = 6f; private static readonly Vector3 MarkerScale = Vector3.one; private const float ToxicRadius = 6f; private const float ToxicDuration = 10f; private Character _ch; private GameObject _marker; private GameObject _symbol; private bool _spawnReadyShown; public SE_ToxicCloud() { ((Object)this).name = "SE_ToxicCloud"; base.m_name = "Toxic Cloud"; base.m_icon = IconHelper.Load("ToxicCloud.png"); base.m_tooltip = "Apunta y haz clic derecho para invocar una nube tóxica. Esc: cancelar."; base.m_ttl = 8f; } public override void Setup(Character character) { ((StatusEffect)this).Setup(character); _ch = character; Character ch = _ch; Player val = (Player)(object)((ch is Player) ? ch : null); if (val != null && (Object)(object)Player.m_localPlayer == (Object)(object)val) { EnsureMarker(val); _marker.SetActive(true); SnapMarkerToMouse(); _spawnReadyShown = true; } } public override void UpdateStatusEffect(float dt) { //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Expected O, but got Unknown //IL_0114: Unknown result type (might be due to invalid IL or missing references) ((StatusEffect)this).UpdateStatusEffect(dt); base.m_tooltip = $"Toxic Cloud ({Mathf.CeilToInt(Mathf.Max(0f, base.m_ttl - base.m_time))}s) — RMB: nube, LMB/Esc: cancelar"; Character ch = _ch; Player val = (Player)(object)((ch is Player) ? ch : null); if (val == null || (Object)(object)Player.m_localPlayer != (Object)(object)val) { return; } if (Input.GetKeyDown((KeyCode)57)) { EnsureMarker(val); _marker.SetActive(!_marker.activeSelf); } if ((Object)(object)_marker == (Object)null) { return; } if (_marker.activeSelf) { if (Input.GetMouseButtonDown(0) || Input.GetKeyDown((KeyCode)27)) { _marker.SetActive(false); return; } SnapMarkerToMouse(); if (Input.GetMouseButtonDown(1)) { if ((Object)(object)((Character)val).m_nview != (Object)null && ((Character)val).m_nview.IsValid()) { ((Character)val).m_nview.InvokeRPC(ZNetView.Everybody, "RPC_Nazhika_PlayCheer", Array.Empty()); ZPackage val2 = new ZPackage(); val2.Write(_marker.transform.position); ((Character)val).m_nview.InvokeRPC(ZNetView.Everybody, "RPC_NC_SpawnToxicCloud", new object[1] { val2 }); } _marker.SetActive(false); base.m_time = base.m_ttl; } } else if (!_spawnReadyShown) { EnsureMarker(val); _marker.SetActive(true); SnapMarkerToMouse(); _spawnReadyShown = true; } } public override void Stop() { ((StatusEffect)this).Stop(); Character character = base.m_character; Player val = (Player)(object)((character is Player) ? character : null); if (val != null) { PlayerClassBase @class = ClassManager.GetClass(val); if (@class != null) { @class.TryBeginCooldown(val); SkillsUI.StartCooldown(@class.CooldownSeconds); } } try { if ((Object)(object)_marker != (Object)null) { Object.Destroy((Object)(object)_marker); } _marker = null; _symbol = null; } catch { } } private void EnsureMarker(Player owner) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: 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_0153: Expected O, but got Unknown if (!((Object)(object)_marker != (Object)null)) { _marker = new GameObject("ToxicCloudMarker_SE"); _marker.transform.position = ((Component)owner).transform.position; _marker.transform.localScale = MarkerScale; _marker.SetActive(false); _symbol = GameObject.CreatePrimitive((PrimitiveType)5); ((Object)_symbol).name = "ToxicSymbol"; _symbol.transform.SetParent(_marker.transform, false); _symbol.transform.localPosition = new Vector3(0f, 0.06f, 0f); _symbol.transform.localRotation = Quaternion.Euler(-90f, 0f, 0f); _symbol.transform.localScale = Vector3.one * 6f; Renderer component = _symbol.GetComponent(); Shader val = TryFindShader("Unlit/Transparent", "Sprites/Default", "Legacy Shaders/Transparent/Diffuse", "Particles/Standard Unlit", "Standard"); if ((Object)(object)component != (Object)null && (Object)(object)val != (Object)null) { Material val2 = new Material(val); val2.mainTexture = (Texture)(object)LoadTexture_NoRef("sealSymbol1.png"); val2.renderQueue = 3000; component.material = val2; } Collider component2 = _symbol.GetComponent(); if ((Object)(object)component2 != (Object)null) { Object.Destroy((Object)(object)component2); } } } private void SnapMarkerToMouse() { //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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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_005e: Unknown result type (might be due to invalid IL or missing references) Camera gameCamera = GetGameCamera(); if (!((Object)(object)gameCamera == (Object)null) && !((Object)(object)_marker == (Object)null)) { Ray val = gameCamera.ScreenPointToRay(Input.mousePosition); RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(val, ref val2, 500f, -1, (QueryTriggerInteraction)1)) { Vector3 point = ((RaycastHit)(ref val2)).point; point.y += 0.06f; _marker.transform.position = point; } } } private static Camera GetGameCamera() { if ((Object)(object)GameCamera.instance?.m_camera != (Object)null) { return GameCamera.instance.m_camera; } return Camera.main; } private static Shader TryFindShader(params string[] names) { foreach (string text in names) { Shader val = Shader.Find(text); if ((Object)(object)val != (Object)null) { return val; } } return null; } private static Texture2D LoadTexture_NoRef(string fileName) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown string text = Path.Combine(Paths.PluginPath, "NazhikaCore", "Assets", "Images", fileName); if (!File.Exists(text)) { Debug.LogWarning((object)("[SE_ToxicCloud] PNG no encontrado: " + text)); return Texture2D.whiteTexture; } byte[] array = File.ReadAllBytes(text); Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false); try { MethodInfo methodInfo = Type.GetType("UnityEngine.ImageConversion, UnityEngine.ImageConversionModule")?.GetMethod("LoadImage", new Type[3] { typeof(Texture2D), typeof(byte[]), typeof(bool) }); if (methodInfo != null && (bool)methodInfo.Invoke(null, new object[3] { val, array, false })) { return val; } } catch { } return Texture2D.whiteTexture; } } public static class SE_ToxicCloudSetup { public static void Init() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown SE_ToxicCloud sE_ToxicCloud = ScriptableObject.CreateInstance(); ItemManager.Instance.AddStatusEffect(new CustomStatusEffect((StatusEffect)(object)sE_ToxicCloud, true)); Debug.Log((object)"[NazhikaCore] ✅ SE_ToxicCloud registrado en Jotunn"); } } public class SE_Warcry : StatusEffect { public SE_Warcry() { //IL_004f: Unknown result type (might be due to invalid IL or missing references) ((Object)this).name = "SE_Warcry"; base.m_name = "Warcry"; base.m_tooltip = "Gritas con furia, atrayendo a los enemigos y resistiendo el daño."; base.m_icon = IconHelper.Load("Warcry.png"); base.m_ttl = 20f; base.m_startMessage = "† Warcry activado †"; base.m_startMessageType = (MessageType)2; } public override void Setup(Character character) { ((StatusEffect)this).Setup(character); Character character2 = base.m_character; Player val = (Player)(object)((character2 is Player) ? character2 : null); if (val != null) { WarcryRPC.ApplyFromStatus(val, active: true); } } public override void Stop() { ((StatusEffect)this).Stop(); Character character = base.m_character; Player val = (Player)(object)((character is Player) ? character : null); if (val != null) { WarcryRPC.ApplyFromStatus(val, active: false); PlayerClassBase @class = ClassManager.GetClass(val); if (@class != null) { @class.TryBeginCooldown(val); SkillsUI.StartCooldown(@class.CooldownSeconds); Log.Info($"[SE_Warcry] Buff terminado → cooldown de {@class.CooldownSeconds}s iniciado para {val.GetPlayerName()}"); } } } } public static class SE_WarcrySetup { public static void Init() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown SE_Warcry sE_Warcry = ScriptableObject.CreateInstance(); CustomStatusEffect val = new CustomStatusEffect((StatusEffect)(object)sE_Warcry, true); ItemManager.Instance.AddStatusEffect(val); Log.Info("[NazhikaCore] SE_Warcry registrado correctamente."); } } } namespace NazhikaCore.RPC { public static class BerserkBurstRPC { public class BerserkBurstFXHolder : MonoBehaviour { [CompilerGenerated] private sealed class d__17 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public BerserkBurstFXHolder <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__17(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Expected O, but got Unknown //IL_0051: 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) int num = <>1__state; BerserkBurstFXHolder berserkBurstFXHolder = <>4__this; switch (num) { default: return false; case 0: { <>1__state = -1; GameObject val = (Object.op_Implicit((Object)(object)ZNetScene.instance) ? ZNetScene.instance.GetPrefab("sfx_gdking_alert") : null); if (Object.op_Implicit((Object)(object)val)) { GameObject val2 = Object.Instantiate(val, ((Component)berserkBurstFXHolder._player).transform.position, Quaternion.identity); Object.Destroy((Object)(object)val2, 6f); } <>2__current = (object)new WaitForSeconds(0.2f); <>1__state = 1; return true; } case 1: <>1__state = -1; if ((Object)(object)berserkBurstFXHolder._player != (Object)null && Object.op_Implicit((Object)(object)((Character)berserkBurstFXHolder._player).m_animator)) { ((Character)berserkBurstFXHolder._player).m_animator.SetTrigger("emote_roar"); } return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__16 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public BerserkBurstFXHolder <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__16(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown //IL_00b4: 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_00ef: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; BerserkBurstFXHolder berserkBurstFXHolder = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(0.05f); <>1__state = 1; return true; case 1: { <>1__state = -1; GameObject val = (Object.op_Implicit((Object)(object)ZNetScene.instance) ? ZNetScene.instance.GetPrefab("fx_shieldgenerator_attack") : null); if (!Object.op_Implicit((Object)(object)val)) { Debug.LogWarning((object)"[BerserkBurstFX] No se encontró prefab fx_shieldgenerator_attack"); return false; } if ((Object)(object)berserkBurstFXHolder._fxRoot != (Object)null) { return false; } berserkBurstFXHolder._fxRoot = Object.Instantiate(val, ((Component)berserkBurstFXHolder._player).transform, false); ((Object)berserkBurstFXHolder._fxRoot).name = "BerserkBurst_FX"; berserkBurstFXHolder._fxRoot.transform.localPosition = Vector3.zero; berserkBurstFXHolder._fxRoot.transform.localRotation = Quaternion.identity; ApplyExclusions(berserkBurstFXHolder._fxRoot); RemovePointLight2(berserkBurstFXHolder._fxRoot); TintHierarchy(berserkBurstFXHolder._fxRoot, BurstColor); ForceActivateHierarchy(berserkBurstFXHolder._fxRoot); berserkBurstFXHolder.SpawnMeadStrengthAura(berserkBurstFXHolder._player); return false; } } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private static readonly Color BurstColor = Color.red; private const string ExcludeGoName_Shockwave = "shockwave"; private const string KeepGoName_ShockwavePlane = "shockwave_plane"; private const string ExcludeLightName_Point1 = "Point light (1)"; private const string ExcludeLightName_Point2 = "Point light (2)"; private const string MeadPrefabName = "vfx_MeadStrength"; private GameObject _meadAuraRoot; private Player _player; private bool _active; private GameObject _fxRoot; private void Awake() { _player = ((Component)this).GetComponent(); } private void OnDisable() { Cleanup(); _active = false; } private void OnDestroy() { Cleanup(); _active = false; } public static void ApplyFxNow(Player player, bool active) { if (Object.op_Implicit((Object)(object)player)) { BerserkBurstFXHolder berserkBurstFXHolder = ((Component)player).GetComponent() ?? ((Component)player).gameObject.AddComponent(); berserkBurstFXHolder.SetActive(active); } } public static void PlayActivatedNow(Player player) { if (Object.op_Implicit((Object)(object)player)) { BerserkBurstFXHolder berserkBurstFXHolder = ((Component)player).GetComponent() ?? ((Component)player).gameObject.AddComponent(); ((MonoBehaviour)berserkBurstFXHolder).StartCoroutine(berserkBurstFXHolder.ActivatedCoroutine()); } } public void SetActive(bool active) { if (_active != active) { _active = active; if (!_active) { Cleanup(); } else { ((MonoBehaviour)this).StartCoroutine(FxCoroutine()); } } } [IteratorStateMachine(typeof(d__16))] private IEnumerator FxCoroutine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__16(0) { <>4__this = this }; } [IteratorStateMachine(typeof(d__17))] private IEnumerator ActivatedCoroutine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__17(0) { <>4__this = this }; } private void Cleanup() { if ((Object)(object)_fxRoot != (Object)null) { Object.Destroy((Object)(object)_fxRoot); _fxRoot = null; } if ((Object)(object)_meadAuraRoot != (Object)null) { Object.Destroy((Object)(object)_meadAuraRoot); _meadAuraRoot = null; } } private static void ApplyExclusions(GameObject root) { if (!Object.op_Implicit((Object)(object)root)) { return; } Transform[] componentsInChildren = root.GetComponentsInChildren(true); foreach (Transform val in componentsInChildren) { if (!((Object)(object)val == (Object)null) && ((Object)((Component)val).gameObject).name == "shockwave") { ((Component)val).gameObject.SetActive(false); } } Light[] componentsInChildren2 = root.GetComponentsInChildren(true); foreach (Light val2 in componentsInChildren2) { if (!((Object)(object)val2 == (Object)null) && ((Object)((Component)val2).gameObject).name == "Point light (1)") { ((Behaviour)val2).enabled = false; ((Component)val2).gameObject.SetActive(false); } } } private static void RemovePointLight2(GameObject root) { if (!Object.op_Implicit((Object)(object)root)) { return; } Light[] componentsInChildren = root.GetComponentsInChildren(true); foreach (Light val in componentsInChildren) { if (!((Object)(object)val == (Object)null) && ((Object)((Component)val).gameObject).name == "Point light (2)") { ((Behaviour)val).enabled = false; ((Component)val).gameObject.SetActive(false); } } } private static bool IsExcluded(GameObject go) { if (!Object.op_Implicit((Object)(object)go)) { return false; } if (((Object)go).name == "shockwave") { return true; } if (((Object)go).name == "Point light (1)") { return true; } if (((Object)go).name == "Point light (2)") { return true; } return false; } private static void ForceActivateHierarchy(GameObject root) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)root)) { return; } Transform[] componentsInChildren = root.GetComponentsInChildren(true); foreach (Transform val in componentsInChildren) { if (!IsExcluded(((Component)val).gameObject)) { ((Component)val).gameObject.SetActive(true); } } ParticleSystem[] componentsInChildren2 = root.GetComponentsInChildren(true); foreach (ParticleSystem val2 in componentsInChildren2) { if (!IsExcluded(((Component)val2).gameObject)) { EmissionModule emission = val2.emission; ((EmissionModule)(ref emission)).enabled = true; val2.Clear(true); val2.Play(true); } } TrailRenderer[] componentsInChildren3 = root.GetComponentsInChildren(true); foreach (TrailRenderer val3 in componentsInChildren3) { if (!IsExcluded(((Component)val3).gameObject)) { ((Renderer)val3).enabled = true; val3.Clear(); } } LineRenderer[] componentsInChildren4 = root.GetComponentsInChildren(true); foreach (LineRenderer val4 in componentsInChildren4) { if (!IsExcluded(((Component)val4).gameObject)) { ((Renderer)val4).enabled = true; } } Light[] componentsInChildren5 = root.GetComponentsInChildren(true); foreach (Light val5 in componentsInChildren5) { if ((Object)(object)val5 != (Object)null && (Object)(object)((Component)val5).gameObject != (Object)null && ((Object)((Component)val5).gameObject).name == "Point light (1)") { ((Behaviour)val5).enabled = false; } else if ((Object)(object)val5 != (Object)null && (Object)(object)((Component)val5).gameObject != (Object)null && ((Object)((Component)val5).gameObject).name == "Point light (2)") { ((Behaviour)val5).enabled = false; } else if (!IsExcluded(((Component)val5).gameObject)) { ((Behaviour)val5).enabled = true; } } } private static void TintHierarchy(GameObject root, Color c) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: 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) if (Object.op_Implicit((Object)(object)root)) { ParticleSystem[] componentsInChildren = root.GetComponentsInChildren(true); foreach (ParticleSystem val in componentsInChildren) { val.Stop(true, (ParticleSystemStopBehavior)0); MainModule main = val.main; ((MainModule)(ref main)).startColor = new MinMaxGradient(c); val.Play(true); } TrailRenderer[] componentsInChildren2 = root.GetComponentsInChildren(true); foreach (TrailRenderer val2 in componentsInChildren2) { val2.startColor = c; val2.endColor = new Color(c.r, c.g, c.b, 0f); } LineRenderer[] componentsInChildren3 = root.GetComponentsInChildren(true); foreach (LineRenderer val3 in componentsInChildren3) { val3.startColor = c; val3.endColor = c; } Light[] componentsInChildren4 = root.GetComponentsInChildren(true); foreach (Light val4 in componentsInChildren4) { val4.color = c; } } } private void SpawnMeadStrengthAura(Player player) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)player) || (Object)(object)_meadAuraRoot != (Object)null) { return; } GameObject val = (Object.op_Implicit((Object)(object)ZNetScene.instance) ? ZNetScene.instance.GetPrefab("vfx_MeadStrength") : null); if (!Object.op_Implicit((Object)(object)val)) { Debug.LogWarning((object)"[BerserkBurstFX] No se encontró el prefab vfx_MeadStrength"); return; } GameObject val2 = new GameObject("BerserkBurst_MeadAuraRoot"); val2.transform.SetParent(((Component)player).transform, false); val2.transform.localPosition = new Vector3(0f, 1f, 0f); val2.transform.localRotation = Quaternion.identity; bool flag = false; Transform[] componentsInChildren = val.GetComponentsInChildren(true); Transform[] array = componentsInChildren; foreach (Transform val3 in array) { if ((Object)(object)val3 == (Object)null) { continue; } string text = ((Object)val3).name.ToLower(); bool flag2 = text.Contains("cloud"); bool flag3 = text.Contains("point light") || text.Contains("pointlight"); if (!flag2 && !flag3) { continue; } GameObject val4 = Object.Instantiate(((Component)val3).gameObject); val4.transform.SetParent(val2.transform, false); val4.transform.localPosition = val3.localPosition; val4.transform.localRotation = val3.localRotation; val4.transform.localScale = val3.localScale; Transform[] componentsInChildren2 = val4.GetComponentsInChildren(true); foreach (Transform val5 in componentsInChildren2) { if (!((Object)(object)val5 == (Object)null)) { ((Component)val5).gameObject.SetActive(true); } } ParticleSystem[] componentsInChildren3 = val4.GetComponentsInChildren(true); foreach (ParticleSystem val6 in componentsInChildren3) { MainModule main = val6.main; if ((Object)(object)((Component)val6).gameObject != (Object)null && ((Object)((Component)val6).gameObject).name != null && ((Object)((Component)val6).gameObject).name.ToLower().Contains("cloud")) { ((MainModule)(ref main)).maxParticles = 10; } } flag = true; } if (!flag) { Debug.LogWarning((object)"[BerserkBurstFX] No se encontraron 'cloud' o 'point light' en vfx_MeadStrength, destruyendo root."); Object.Destroy((Object)(object)val2); } else { MakeFxPersistent_PSOnly(val2); TintHierarchy(val2, BurstColor); _meadAuraRoot = val2; } } private static void MakeFxPersistent_PSOnly(GameObject root) { //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)root)) { return; } TimedDestruction[] componentsInChildren = root.GetComponentsInChildren(true); foreach (TimedDestruction val in componentsInChildren) { if (!((Object)(object)val == (Object)null)) { Object.Destroy((Object)(object)val); } } MonoBehaviour[] componentsInChildren2 = root.GetComponentsInChildren(true); foreach (MonoBehaviour val2 in componentsInChildren2) { if (!((Object)(object)val2 == (Object)null)) { Object.Destroy((Object)(object)val2); } } Light[] componentsInChildren3 = root.GetComponentsInChildren(true); foreach (Light val3 in componentsInChildren3) { if (!((Object)(object)val3 == (Object)null)) { ((Behaviour)val3).enabled = true; val3.intensity = Mathf.Max(val3.intensity, 1f); val3.range = Mathf.Max(val3.range, 2f); } } ParticleSystem[] componentsInChildren4 = root.GetComponentsInChildren(true); foreach (ParticleSystem val4 in componentsInChildren4) { MainModule main = val4.main; ((MainModule)(ref main)).loop = true; ((MainModule)(ref main)).stopAction = (ParticleSystemStopAction)0; if (!val4.isPlaying) { val4.Play(true); } } } } private const string ZdoKeyActive = "naz_berserkburst_fx_active"; private const string RpcFx = "RPC_BerserkBurstFx"; private const string RpcActivated = "RPC_BerserkBurstActivated"; private const string FxPrefabName = "fx_shieldgenerator_attack"; private const string SfxPrefabName = "sfx_gdking_alert"; public static void Init(Harmony harmony) { Patch_Player_Awake_RegisterRpc_AndEnsureHolder(harmony); Patch_Player_OnSpawned_ReadZdoAndApply(harmony); Debug.Log((object)"[NazhikaCore] BerserkBurstRPC.Init -> RPC Player + Sync + Holder listos"); } public static void ApplyFromStatus(Player player, bool active) { if (Object.op_Implicit((Object)(object)player)) { ZNetView component = ((Component)player).GetComponent(); if ((Object)(object)component != (Object)null && component.IsValid() && component.GetZDO() != null && component.IsOwner()) { component.GetZDO().Set("naz_berserkburst_fx_active", active); Debug.Log((object)string.Format("[BerserkBurstRPC] ApplyFromStatus → ZDO {0}={1} en {2} (owner). Enviando RPC...", "naz_berserkburst_fx_active", active, player.GetPlayerName())); component.InvokeRPC(ZNetView.Everybody, "RPC_BerserkBurstFx", new object[1] { active }); } else { Debug.Log((object)("[BerserkBurstRPC] ApplyFromStatus → sin autoridad ZDO para " + ((player != null) ? player.GetPlayerName() : null) + " (no owner). Solo efecto local.")); } BerserkBurstFXHolder.ApplyFxNow(player, active); } } public static void BroadcastActivated(Player player) { if (Object.op_Implicit((Object)(object)player)) { ZNetView component = ((Component)player).GetComponent(); if ((Object)(object)component != (Object)null && component.IsValid() && component.GetZDO() != null && component.IsOwner()) { Debug.Log((object)("[BerserkBurstRPC] BroadcastActivated → Enviando RPC one-shot a Everybody para " + player.GetPlayerName())); component.InvokeRPC(ZNetView.Everybody, "RPC_BerserkBurstActivated", Array.Empty()); } else { Debug.Log((object)("[BerserkBurstRPC] BroadcastActivated → sin autoridad RPC para " + ((player != null) ? player.GetPlayerName() : null) + " (no owner). Solo local.")); } BerserkBurstFXHolder.PlayActivatedNow(player); } } private static void Patch_Player_Awake_RegisterRpc_AndEnsureHolder(Harmony harmony) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown MethodInfo methodInfo = AccessTools.Method(typeof(Player), "Awake", (Type[])null, (Type[])null); HarmonyMethod val = new HarmonyMethod(typeof(BerserkBurstRPC), "Player_Awake_Postfix", (Type[])null); harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } private static void Player_Awake_Postfix(Player __instance) { ZNetView component = ((Component)__instance).GetComponent(); if (!((Object)(object)component == (Object)null) && component.IsValid() && (!((Object)(object)ZNet.instance != (Object)null) || !ZNet.instance.IsDedicated())) { if ((Object)(object)((Component)__instance).GetComponent() == (Object)null) { ((Component)__instance).gameObject.AddComponent(); } component.Register("RPC_BerserkBurstFx", (Action)delegate(long sender, bool active) { Debug.Log((object)string.Format("[BerserkBurstRPC] {0} recibido → active={1} para {2}", "RPC_BerserkBurstFx", active, __instance.GetPlayerName())); BerserkBurstFXHolder.ApplyFxNow(__instance, active); }); component.Register("RPC_BerserkBurstActivated", (Action)delegate { Debug.Log((object)("[BerserkBurstRPC] RPC_BerserkBurstActivated recibido → one-shot para " + __instance.GetPlayerName())); BerserkBurstFXHolder.PlayActivatedNow(__instance); }); } } private static void Patch_Player_OnSpawned_ReadZdoAndApply(Harmony harmony) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown MethodInfo methodInfo = AccessTools.Method(typeof(Player), "OnSpawned", (Type[])null, (Type[])null); HarmonyMethod val = new HarmonyMethod(typeof(BerserkBurstRPC), "Player_OnSpawned_Postfix", (Type[])null); harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } private static void Player_OnSpawned_Postfix(Player __instance) { if (!((Object)(object)ZNet.instance != (Object)null) || !ZNet.instance.IsDedicated()) { ZNetView component = ((Component)__instance).GetComponent(); ZDO val = (((Object)(object)component != (Object)null && component.IsValid()) ? component.GetZDO() : null); if (val != null) { bool @bool = val.GetBool("naz_berserkburst_fx_active", false); Debug.Log((object)string.Format("[BerserkBurstRPC] OnSpawned → estado ZDO({0})={1} en {2}", "naz_berserkburst_fx_active", @bool, __instance.GetPlayerName())); BerserkBurstFXHolder.ApplyFxNow(__instance, @bool); } } } } public class BleedingPopupRPC { public static void Init(Harmony harmony) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown harmony.Patch((MethodBase)AccessTools.Method(typeof(ZNet), "Start", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(BleedingPopupRPC), "Patch_ZNet_Start", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Debug.Log((object)"[NazhikaCore/BleedRPC] Init OK."); } private static void Patch_ZNet_Start(ZNet __instance) { if (ZRoutedRpc.instance != null) { ZRoutedRpc.instance.Register("NZK_BleedPopup", (Action)Handle_BleedPopup); Debug.Log((object)"[NazhikaCore/BleedRPC] Handler registrado en ZNet.Start."); } } public static void SendBleedPopup(Vector3 worldPos, float amount, int stacks) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown //IL_000f: Unknown result type (might be due to invalid IL or missing references) if (ZRoutedRpc.instance != null) { ZPackage val = new ZPackage(); val.Write(worldPos); val.Write(amount); val.Write(stacks); ZRoutedRpc.instance.InvokeRoutedRPC(ZRoutedRpc.Everybody, "NZK_BleedPopup", new object[1] { val }); } } private static void Handle_BleedPopup(long sender, ZPackage pkg) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) if (pkg != null) { Vector3 val = pkg.ReadVector3(); float num = pkg.ReadSingle(); int num2 = pkg.ReadInt(); if (!((Object)(object)DamageText.instance == (Object)null)) { string text = $"\ud83e\ude78x{num2} {num:0.#}"; DamageText.instance.AddInworldText((TextType)0, val, 0f, text, true); } } } } public class ClearStatusEffectsRPC { private const string RpcName = "RPC_ClearSE_Target"; private static bool _patched; public static void Init(Harmony harmony) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown if (!_patched) { _patched = true; harmony.Patch((MethodBase)AccessTools.Method(typeof(Player), "Awake", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(ClearStatusEffectsRPC), "Player_Awake_Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Log.Info("[ClearStatusEffectsRPC] ✅ Init() aplicado (Player.Awake patched)"); BleedApplyRPC.Init(harmony); } } private static void Player_Awake_Postfix(Player __instance) { ZNetView val = ((Character)(__instance?)).m_nview; if (!((Object)(object)val == (Object)null)) { val.Register("RPC_ClearSE_Target", (Action)RPC_ClearSE_Target); Log.Info("[ClearStatusEffectsRPC] RPC registrado en ZNetView (" + __instance.GetPlayerName() + ")"); } } private static void RPC_ClearSE_Target(long sender, string targetName) { if ((Object)(object)ZNet.instance == (Object)null || !ZNet.instance.IsServer() || string.IsNullOrEmpty(targetName)) { return; } Player val = FindPlayerByName(targetName); if (!Object.op_Implicit((Object)(object)val)) { Log.Info("[ClearStatusEffectsRPC] ❌ Jugador no encontrado: '" + targetName + "'"); return; } SEMan sEMan = ((Character)val).GetSEMan(); if (sEMan == null) { Log.Info("[ClearStatusEffectsRPC] ❌ SEMan null en " + val.GetPlayerName()); return; } sEMan.RemoveAllStatusEffects(false); Log.Info("[ClearStatusEffectsRPC] ✅ RemoveAllStatusEffects → " + val.GetPlayerName()); ((Character)val).Message((MessageType)2, "⚠\ufe0f Tus efectos fueron limpiados.", 0, (Sprite)null); } private static Player FindPlayerByName(string name) { foreach (Player allPlayer in Player.GetAllPlayers()) { if (Object.op_Implicit((Object)(object)allPlayer) && allPlayer.GetPlayerName().Equals(name, StringComparison.OrdinalIgnoreCase)) { return allPlayer; } } return null; } } public static class BleedApplyRPC { private const string RPC_NAME = "NZ_ApplyBleed"; private const string RPC_CANCEL_NAME = "NZ_CancelBleed"; private static bool _patched; public static void Init(Harmony harmony) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown if (!_patched) { _patched = true; harmony.Patch((MethodBase)AccessTools.Method(typeof(Character), "Awake", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(BleedApplyRPC), "Character_Awake_Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Log.Info("[NazhikaCore/BleedRPC] ✅ Init() aplicado (Character.Awake patched)"); } } private static void Character_Awake_Postfix(Character __instance) { ZNetView val = __instance?.m_nview; if (!((Object)(object)val == (Object)null)) { val.Register("NZ_ApplyBleed", (Action)delegate(long sender) { OnRPC_ApplyBleed(__instance, sender); }); val.Register("NZ_CancelBleed", (Action)delegate(long sender) { OnRPC_CancelBleed(__instance, sender); }); } } public static void RequestBleed(Character victim, long attackerPID = 0L) { if (!((Object)(object)victim == (Object)null)) { ZNetView nview = victim.m_nview; if ((Object)(object)nview == (Object)null || !nview.IsValid()) { Log.Info("[NazhikaCore/BleedRPC] RequestBleed: nview inválido, aplicando local."); ApplyBleedLocal(victim); } else { Log.Info(string.Format("[NazhikaCore/BleedRPC] InvokeRPC {0} → víctima={1} | atacante={2}", "NZ_ApplyBleed", ((Object)victim).name, attackerPID)); nview.InvokeRPC("NZ_ApplyBleed", Array.Empty()); } } } public static void RequestCancelBleed(Character victim) { if (!((Object)(object)victim == (Object)null)) { ZNetView nview = victim.m_nview; if (!((Object)(object)nview == (Object)null) && nview.IsValid()) { Log.Info("[NazhikaCore/BleedRPC] InvokeRPC NZ_CancelBleed → víctima=" + ((Object)victim).name); nview.InvokeRPC("NZ_CancelBleed", Array.Empty()); } } } public static void RequestCancelBleedByZDO(ZDOID victimId) { //IL_0015: 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_0046: Unknown result type (might be due to invalid IL or missing references) if (ZRoutedRpc.instance == null || ZDOMan.instance == null) { return; } ZDO zDO = ZDOMan.instance.GetZDO(victimId); if (zDO != null) { long owner = zDO.GetOwner(); if (owner != 0L) { ZRoutedRpc.instance.InvokeRoutedRPC(owner, victimId, "NZ_CancelBleed", Array.Empty()); Log.Info($"[NazhikaCore/BleedRPC] RequestCancelBleedByZDO → zdoid={victimId} owner={owner}"); } } } private static void OnRPC_ApplyBleed(Character victim, long senderPeerID) { try { if (!((Object)(object)victim == (Object)null)) { if (!victim.IsOwner()) { Log.Info("[NazhikaCore/BleedRPC] OnRPC: no somos owner. Ignorando."); return; } Log.Info($"[NazhikaCore/BleedRPC] Aplicando bleed a '{((Object)victim).name}' | sender={senderPeerID}"); ApplyBleedLocal(victim); } } catch (Exception arg) { Log.Info($"[NazhikaCore/BleedRPC] OnRPC excepción: {arg}"); } } private static void OnRPC_CancelBleed(Character victim, long senderPeerID) { try { if (!((Object)(object)victim == (Object)null) && victim.IsOwner()) { SEMan sEMan = victim.GetSEMan(); if (sEMan != null) { sEMan.RemoveStatusEffect(SE_Bleeding.NameHash, false); Log.Info("[NazhikaCore/BleedRPC] ✅ CancelBleed en '" + ((Object)victim).name + "'"); } } } catch (Exception arg) { Log.Info($"[NazhikaCore/BleedRPC] CancelBleed excepción: {arg}"); } } private static void ApplyBleedLocal(Character victim) { if ((Object)(object)victim == (Object)null) { return; } SEMan sEMan = victim.GetSEMan(); if (sEMan == null) { return; } int nameHash = SE_Bleeding.NameHash; SE_Bleeding sE_Bleeding = sEMan.GetStatusEffect(nameHash) as SE_Bleeding; if ((Object)(object)sE_Bleeding == (Object)null) { sE_Bleeding = sEMan.AddStatusEffect(nameHash, false, 0, 0f) as SE_Bleeding; if ((Object)(object)sE_Bleeding == (Object)null) { Log.Info("[NazhikaCore/BleedRPC] ❌ No se pudo agregar SE_Bleeding."); } else { Log.Info("[NazhikaCore/BleedRPC] ✅ SE_Bleeding añadido (stack 1)."); } } else { sE_Bleeding.AddBleedStack(); Log.Info($"[NazhikaCore/BleedRPC] ✅ AddBleedStack → stacks={sE_Bleeding.Stacks}"); } } } public static class MonkChiReleaseSkill { private class CoroutineRunner : MonoBehaviour { public void Run(IEnumerator routine) { ((MonoBehaviour)this).StartCoroutine(routine); } } [CompilerGenerated] private sealed class d__26 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Player player; public CoroutineRunner runner; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__26(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(1.2f); <>1__state = 1; return true; case 1: { <>1__state = -1; if (Object.op_Implicit((Object)(object)player) && !((Character)player).IsDead()) { ApplyAoEStagger(player); if ((Object)(object)((Character)player).m_animator != (Object)null) { ((Character)player).m_animator.ResetTrigger("axe_secondary"); } BroadcastImpact(player); } float num = 0f; if (num > 0f) { <>2__current = (object)new WaitForSeconds(num); <>1__state = 2; return true; } break; } case 2: <>1__state = -1; break; } SetImmune(value: false); if ((Object)(object)runner != (Object)null) { Object.Destroy((Object)(object)((Component)runner).gameObject); } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private const string CastAnimTrigger = "axe_secondary"; private const string CastVfxPrefab = "vfx_lightning_attack_hit"; private const string ImpactVfxPrefab = "vfx_sledge_iron_hit"; private const float CastDelay = 1.2f; private const float ImmunityDuration = 1.2f; public const float StaminaCost = 30f; private const int RequiredOrbs = 4; private const float StaggerRadius = 5f; private const string RpcChiCast = "NC_MonkChiCast"; private const string RpcChiImpact = "NC_MonkChiImpact"; private static bool s_rpcRegistered; private static bool s_initialized; private static readonly FieldInfo PlayerZAnimField = typeof(Player).GetField("m_zanim", BindingFlags.Instance | BindingFlags.NonPublic); public static bool IsImmune { get; private set; } private static ZSyncAnimation GetZAnim(Player p) { object? obj = PlayerZAnimField?.GetValue(p); return (ZSyncAnimation)((obj is ZSyncAnimation) ? obj : null); } public static void Init(Harmony harmony) { if (!s_initialized) { s_initialized = true; harmony.PatchAll(typeof(MonkChiReleaseSkill)); Debug.Log((object)"[NazhikaCore] MonkChiReleaseSkill initialized."); } } public static void EnsureRpcRegistered() { if (!s_rpcRegistered && ZRoutedRpc.instance != null) { s_rpcRegistered = true; ZRoutedRpc.instance.Register("NC_MonkChiCast", (Action)RPC_ChiCast); ZRoutedRpc.instance.Register("NC_MonkChiImpact", (Action)RPC_ChiImpact); Debug.Log((object)"[NazhikaCore] RPC registered (one-time): NC_MonkChiCast, NC_MonkChiImpact"); } } public static bool TryActivate(Player player) { if (!Object.op_Implicit((Object)(object)player)) { return false; } if ((Object)(object)player != (Object)(object)Player.m_localPlayer) { return false; } if (((Character)player).IsDead() || ((Character)player).InCutscene()) { return false; } if (((Character)player).IsBlocking()) { return false; } SEMan sEMan = ((Character)player).GetSEMan(); int num = ((((sEMan != null) ? sEMan.GetStatusEffect(SE_OrbGauge.NameHash) : null) is SE_OrbGauge sE_OrbGauge) ? sE_OrbGauge.Orbs : 0); if (num < 4) { ((Character)player).Message((MessageType)2, $"⚪ Necesitas {4} orbes de Ki ({num}/{4})", 0, (Sprite)null); return false; } if (player.GetStamina() < 30f) { ((Character)player).Message((MessageType)2, "⚪ Falta stamina", 0, (Sprite)null); return false; } SE_OrbGauge.ConsumeAllOrbsFor(player); ((Character)player).UseStamina(30f); SetImmune(value: true); BroadcastCast(player); PlayCastLocal(player); ScheduleImpact(player); return true; } private static void SetImmune(bool value) { IsImmune = value; Debug.Log((object)(value ? "[MonkChiRelease] Inmunidad ACTIVADA" : "[MonkChiRelease] Inmunidad DESACTIVADA")); } private static void PlayCastLocal(Player player) { ZSyncAnimation zAnim = GetZAnim(player); if ((Object)(object)zAnim != (Object)null) { zAnim.SetTrigger("axe_secondary"); } } private static void BroadcastCast(Player player) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) EnsureRpcRegistered(); if (ZRoutedRpc.instance != null) { ZRoutedRpc.instance.InvokeRoutedRPC(ZRoutedRpc.Everybody, "NC_MonkChiCast", new object[1] { ((Character)player).GetZDOID() }); } } private static void RPC_ChiCast(long sender, ZDOID playerId) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)ZNetScene.instance == (Object)null) { return; } GameObject val = ZNetScene.instance.FindInstance(playerId); if (!Object.op_Implicit((Object)(object)val)) { return; } Player component = val.GetComponent(); if (Object.op_Implicit((Object)(object)component) && !((Object)(object)component == (Object)(object)Player.m_localPlayer)) { ZSyncAnimation zAnim = GetZAnim(component); if ((Object)(object)zAnim != (Object)null) { zAnim.SetTrigger("axe_secondary"); } SpawnFx("vfx_lightning_attack_hit", ((Component)component).transform.position); } } private static void ScheduleImpact(Player player) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) CoroutineRunner coroutineRunner = new GameObject("_ChiReleaseRunner").AddComponent(); coroutineRunner.Run(ImpactCoroutine(player, coroutineRunner)); } [IteratorStateMachine(typeof(d__26))] private static IEnumerator ImpactCoroutine(Player player, CoroutineRunner runner) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__26(0) { player = player, runner = runner }; } private static void BroadcastImpact(Player player) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) EnsureRpcRegistered(); if (ZRoutedRpc.instance != null) { ZRoutedRpc.instance.InvokeRoutedRPC(ZRoutedRpc.Everybody, "NC_MonkChiImpact", new object[1] { ((Character)player).GetZDOID() }); } } private static void RPC_ChiImpact(long sender, ZDOID playerId) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)ZNetScene.instance == (Object)null) { return; } GameObject val = ZNetScene.instance.FindInstance(playerId); if (Object.op_Implicit((Object)(object)val)) { Player component = val.GetComponent(); if (Object.op_Implicit((Object)(object)component)) { SpawnFx("vfx_lightning_attack_hit", ((Component)component).transform.position); SpawnFx("vfx_sledge_iron_hit", ((Component)component).transform.position); } } } private static void ApplyAoEStagger(Player player) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) SpawnFx("vfx_sledge_iron_hit", ((Component)player).transform.position); Collider[] array = Physics.OverlapSphere(((Component)player).transform.position, 5f); Collider[] array2 = array; foreach (Collider val in array2) { if (!((Object)(object)((Component)val).gameObject == (Object)(object)((Component)player).gameObject)) { Character componentInParent = ((Component)val).GetComponentInParent(); if (Object.op_Implicit((Object)(object)componentInParent) && !componentInParent.IsDead() && BaseAI.IsEnemy((Character)(object)player, componentInParent)) { Vector3 val2 = ((Component)componentInParent).transform.position - ((Component)player).transform.position; Vector3 normalized = ((Vector3)(ref val2)).normalized; componentInParent.m_staggerDamage = componentInParent.GetStaggerTreshold(); componentInParent.Stagger(normalized); } } } Debug.Log((object)("[MonkChiRelease] AoE Stagger aplicado desde " + player.GetPlayerName())); } [HarmonyPatch(typeof(Character), "RPC_Damage")] [HarmonyPrefix] private static bool Patch_RPC_Damage(Character __instance, HitData hit) { if ((Object)(object)__instance != (Object)(object)Player.m_localPlayer) { return true; } if (IsImmune) { Debug.Log((object)"[MonkChiRelease] Daño bloqueado por inmunidad."); return false; } return true; } [HarmonyPatch(typeof(Character), "RPC_Stagger")] [HarmonyPrefix] private static bool Patch_RPC_Stagger(Character __instance, Vector3 forceDirection) { if ((Object)(object)__instance != (Object)(object)Player.m_localPlayer) { return true; } if (IsImmune) { Debug.Log((object)"[MonkChiRelease] Stagger bloqueado por inmunidad."); return false; } return true; } private static void SpawnFx(string prefabName, Vector3 pos) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) if (!string.IsNullOrEmpty(prefabName)) { GameObject prefab = GetPrefab(prefabName); if (Object.op_Implicit((Object)(object)prefab)) { Object.Instantiate(prefab, pos, Quaternion.identity); } } } private static GameObject GetPrefab(string name) { if (Object.op_Implicit((Object)(object)ZNetScene.instance)) { GameObject prefab = ZNetScene.instance.GetPrefab(name); if (Object.op_Implicit((Object)(object)prefab)) { return prefab; } } if (Object.op_Implicit((Object)(object)ObjectDB.instance)) { GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(name); if (Object.op_Implicit((Object)(object)itemPrefab)) { return itemPrefab; } } return null; } } public static class MonkLeapSkill { private const string CastTrigger = "knife_secondary"; private const float CastAnimSpeed = 0.3f; private const string CastVfxPrefab = "vfx_perfectblock"; private const string CastSfxPrefab = "sfx_perfectblock"; private const float VelocityMultiplier = 0.5f; private const float UpBoost = 7.5f; private const float HorizontalBoostMultiplier = 3f; public const float StaminaCost = 20f; private const float ImpactRadius = 6f; private const float ImpactBaseDamage = 5f; private const float ImpactDamagePerAltitude = 3f; private const float ImpactPushForce = 20f; private const string ImpactVfxPrefab = "vfx_gdking_stomp"; private const bool RequireLOS = true; private const int ChainMaxBounces = 5; private const float ChainBounceRange = 7f; private const float ChainDamage = 35f; private const float ChainDamageFalloff = 0.85f; private const string RpcLeapCast = "NC_MonkLeapCast"; private static bool s_rpcRegistered; private static int _savedKiHits = 0; private static int _savedOrbs = 0; private static bool s_inFlight; private static float s_takeoffY; private static float s_maxY; private static bool s_initialized; private static readonly FieldInfo PlayerZAnimField = typeof(Player).GetField("m_zanim", BindingFlags.Instance | BindingFlags.NonPublic); private static readonly FieldInfo CharacterBodyField = typeof(Character).GetField("m_body", BindingFlags.Instance | BindingFlags.NonPublic); private static readonly int ScriptChar_Layermask = LayerMask.GetMask(new string[14] { "Default", "static_solid", "Default_small", "piece_nonsolid", "piece", "terrain", "vehicle", "viewblock", "character", "character_noenv", "character_trigger", "character_net", "character_ghost", "Water" }); private static ZSyncAnimation GetZAnim(Player p) { object? obj = PlayerZAnimField?.GetValue(p); return (ZSyncAnimation)((obj is ZSyncAnimation) ? obj : null); } private static Rigidbody GetBody(Character c) { object? obj = CharacterBodyField?.GetValue(c); return (Rigidbody)((obj is Rigidbody) ? obj : null); } public static void Init(Harmony harmony) { if (!s_initialized) { s_initialized = true; harmony.PatchAll(typeof(MonkLeapSkill)); Debug.Log((object)"[NazhikaCore] MonkLeapSkill initialized."); } } public static void EnsureRpcRegistered() { if (!s_rpcRegistered && ZRoutedRpc.instance != null) { s_rpcRegistered = true; ZRoutedRpc.instance.Register("NC_MonkLeapCast", (Action)RPC_LeapCast); Debug.Log((object)"[NazhikaCore] RPC registered (one-time): NC_MonkLeapCast"); } } public static bool TryActivate(Player player) { if (!Object.op_Implicit((Object)(object)player)) { return false; } if ((Object)(object)player != (Object)(object)Player.m_localPlayer) { return false; } if (((Character)player).IsDead() || ((Character)player).InCutscene()) { return false; } if (((Character)player).IsBlocking()) { return false; } if (player.GetStamina() < 20f) { ((Character)player).Message((MessageType)2, "⚪ Falta stamina", 0, (Sprite)null); return false; } ((Character)player).UseStamina(20f); SEMan sEMan = ((Character)player).GetSEMan(); SE_OrbGauge sE_OrbGauge = ((sEMan != null) ? sEMan.GetStatusEffect(SE_OrbGauge.NameHash) : null) as SE_OrbGauge; if ((Object)(object)sE_OrbGauge != (Object)null) { _savedKiHits = sE_OrbGauge.KiHits; _savedOrbs = sE_OrbGauge.Orbs; sE_OrbGauge.PauseAtkSpeedBonus = true; sE_OrbGauge.SetKiOrbsSilent(0, 0); } PlayCastLocal(player); BroadcastCast(player); Launch(player); return true; } private static void PlayCastLocal(Player player) { //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) ZSyncAnimation zAnim = GetZAnim(player); if ((Object)(object)zAnim != (Object)null) { zAnim.SetTrigger("knife_secondary"); SEMan sEMan = ((Character)player).GetSEMan(); SE_OrbGauge sE_OrbGauge = ((sEMan != null) ? sEMan.GetStatusEffect(SE_OrbGauge.NameHash) : null) as SE_OrbGauge; float speed = (((Object)(object)sE_OrbGauge != (Object)null && sE_OrbGauge.Orbs >= 4) ? 0.1f : 1f); zAnim.SetSpeed(speed); } SpawnFx("vfx_perfectblock", ((Component)player).transform.position); SpawnFx("sfx_perfectblock", ((Component)player).transform.position); } private static void BroadcastCast(Player player) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) if (ZRoutedRpc.instance != null) { EnsureRpcRegistered(); ZRoutedRpc.instance.InvokeRoutedRPC(ZRoutedRpc.Everybody, "NC_MonkLeapCast", new object[1] { ((Character)player).GetZDOID() }); } } private static void RPC_LeapCast(long sender, ZDOID playerId) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)ZNetScene.instance == (Object)null) { return; } GameObject val = ZNetScene.instance.FindInstance(playerId); if (!Object.op_Implicit((Object)(object)val)) { return; } Player component = val.GetComponent(); if (Object.op_Implicit((Object)(object)component)) { ZSyncAnimation zAnim = GetZAnim(component); if ((Object)(object)zAnim != (Object)null) { zAnim.SetTrigger("knife_secondary"); zAnim.SetSpeed(0.3f); } SpawnFx("vfx_perfectblock", ((Component)component).transform.position); } } private static void Launch(Player player) { //IL_003d: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: 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) Rigidbody body = GetBody((Character)(object)player); if (!Object.op_Implicit((Object)(object)body)) { ((Character)player).Jump(false); s_inFlight = true; s_takeoffY = ((Component)player).transform.position.y; s_maxY = s_takeoffY; } else { Vector3 velocity = ((Character)player).GetVelocity(); Vector3 velocity2 = body.velocity; Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(velocity2.x, 0f, velocity2.z); body.velocity = velocity * 0.5f + Vector3.up * 7.5f + val * 3f; s_inFlight = true; s_takeoffY = ((Component)player).transform.position.y; s_maxY = s_takeoffY; } } [HarmonyPatch(typeof(Player), "Update")] [HarmonyPostfix] private static void Player_Update_TrackFlight(Player __instance) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)__instance != (Object)(object)Player.m_localPlayer) && s_inFlight) { float y = ((Component)__instance).transform.position.y; if (y > s_maxY) { s_maxY = y; } if (((Character)__instance).IsOnGround()) { float altitude = Mathf.Max(0f, s_maxY - s_takeoffY); Impact(__instance, altitude); } } } private static void Impact(Player player, float altitude) { //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: 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_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Expected O, but got Unknown //IL_010f: 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) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0132: 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_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) s_inFlight = false; SEMan sEMan = ((Character)player).GetSEMan(); SE_OrbGauge sE_OrbGauge = ((sEMan != null) ? sEMan.GetStatusEffect(SE_OrbGauge.NameHash) : null) as SE_OrbGauge; if ((Object)(object)sE_OrbGauge != (Object)null) { sE_OrbGauge.SetKiOrbsSilent(_savedKiHits, _savedOrbs); sE_OrbGauge.PauseAtkSpeedBonus = false; } _savedKiHits = 0; _savedOrbs = 0; List list = new List(); foreach (Character allCharacter in Character.GetAllCharacters()) { if (!Object.op_Implicit((Object)(object)allCharacter) || allCharacter.IsDead() || !BaseAI.IsEnemy((Character)(object)player, allCharacter)) { continue; } float num = Vector3.Distance(((Component)allCharacter).transform.position, ((Component)player).transform.position); if (!(num > 6f)) { list.Add(allCharacter); if (HasLOS(allCharacter, ((Component)player).transform.position, ((Character)player).GetCenterPoint())) { HitData val = new HitData(); val.m_damage.m_blunt = 5f + 3f * altitude; val.m_pushForce = 20f; val.m_point = allCharacter.GetEyePoint(); Vector3 val2 = ((Component)allCharacter).transform.position - ((Component)player).transform.position; val.m_dir = ((Vector3)(ref val2)).normalized; val.SetAttacker((Character)(object)player); allCharacter.Damage(val); } } } ZSyncAnimation zAnim = GetZAnim(player); if ((Object)(object)zAnim != (Object)null) { zAnim.SetSpeed(1f); } SpawnFx("vfx_gdking_stomp", ((Component)player).transform.position); if (list.Count > 0) { DoChain(player, list); } } private static void DoChain(Player player, List initial) { //IL_0021: 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) Character val = null; float num = float.MaxValue; foreach (Character item in initial) { float num2 = Vector3.Distance(((Component)player).transform.position, ((Component)item).transform.position); if (num2 < num) { num = num2; val = item; } } if (!Object.op_Implicit((Object)(object)val)) { return; } HashSet hashSet = new HashSet { val }; float num3 = 35f; for (int i = 0; i < 5; i++) { if (!Object.op_Implicit((Object)(object)val)) { break; } if (val.IsDead()) { break; } ApplyLightning(player, val, num3); Character val2 = FindNext(player, val, hashSet); if (Object.op_Implicit((Object)(object)val2)) { hashSet.Add(val2); val = val2; num3 *= 0.85f; continue; } break; } } private static Character FindNext(Player player, Character from, HashSet visited) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) Character result = null; float num = float.MaxValue; foreach (Character allCharacter in Character.GetAllCharacters()) { if (Object.op_Implicit((Object)(object)allCharacter) && !allCharacter.IsDead() && !visited.Contains(allCharacter) && BaseAI.IsEnemy((Character)(object)player, allCharacter)) { float num2 = Vector3.Distance(((Component)from).transform.position, ((Component)allCharacter).transform.position); if (!(num2 > 7f) && num2 < num) { num = num2; result = allCharacter; } } } return result; } private static void ApplyLightning(Player player, Character target, float damage) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) HitData val = new HitData(); val.m_damage.m_lightning = Mathf.Max(0f, damage); val.m_point = target.GetEyePoint(); Vector3 val2 = ((Component)target).transform.position - ((Component)player).transform.position; val.m_dir = ((Vector3)(ref val2)).normalized; val.SetAttacker((Character)(object)player); target.Damage(val); } private static bool HasLOS(Character target, Vector3 from, Vector3 to) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: 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_001d: Unknown result type (might be due to invalid IL or missing references) Vector3 val = to - from; float magnitude = ((Vector3)(ref val)).magnitude; if (magnitude <= 0.01f) { return true; } RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(from, ((Vector3)(ref val)).normalized, ref val2, magnitude, ScriptChar_Layermask, (QueryTriggerInteraction)1) && Object.op_Implicit((Object)(object)((RaycastHit)(ref val2)).collider) && !((Component)((RaycastHit)(ref val2)).collider).transform.IsChildOf(((Component)target).transform)) { return false; } return true; } private static void SpawnFx(string prefabName, Vector3 pos) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) if (!string.IsNullOrEmpty(prefabName)) { GameObject prefab = GetPrefab(prefabName); if (Object.op_Implicit((Object)(object)prefab)) { Object.Instantiate(prefab, pos, Quaternion.identity); } } } private static GameObject GetPrefab(string name) { if (Object.op_Implicit((Object)(object)ZNetScene.instance)) { GameObject prefab = ZNetScene.instance.GetPrefab(name); if (Object.op_Implicit((Object)(object)prefab)) { return prefab; } } if (Object.op_Implicit((Object)(object)ObjectDB.instance)) { GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(name); if (Object.op_Implicit((Object)(object)itemPrefab)) { return itemPrefab; } } return null; } } public static class SwordLightningRPC { public class SwordLightningFXHolder : MonoBehaviour { [CompilerGenerated] private sealed class d__17 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public SwordLightningFXHolder <>4__this; private int 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__17(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown int num = <>1__state; SwordLightningFXHolder swordLightningFXHolder = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; 5__2 = 0; break; case 1: <>1__state = -1; break; } if (5__2++ < 120) { if (swordLightningFXHolder.TryApplyFX()) { swordLightningFXHolder._applyRoutine = null; return false; } <>2__current = (object)new WaitForSeconds(0.1f); <>1__state = 1; return true; } swordLightningFXHolder._applyRoutine = null; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private const string OneHandSourcePrefab = "SwordNiedhoggLightning"; private const string TwoHandSourcePrefab = "THSwordSlayerLightning"; private const string RightAttachPath = "Visual/Armature/Hips/Spine/Spine1/Spine2/RightShoulder/RightArm/RightForeArm/RightHand/RightHand_Attach/attach(Clone)"; private const string LeftAttachPath = "Visual/Armature/Hips/Spine/Spine1/Spine2/LeftShoulder/LeftArm/LeftForeArm/LeftHand/LeftHand_Attach/attach(Clone)"; private Player _player; private Coroutine _applyRoutine; private readonly List _spawnedRight = new List(); private readonly List _spawnedLeft = new List(); private bool _active; private GameObject _lastRightInstance; private GameObject _lastLeftInstance; private void Awake() { _player = ((Component)this).GetComponent(); } private void OnDisable() { StopApplyRoutine(); Cleanup(); _active = false; } private void OnDestroy() { StopApplyRoutine(); Cleanup(); _active = false; } public static void ApplyNow(Player player, bool active) { if (Object.op_Implicit((Object)(object)player)) { SwordLightningFXHolder swordLightningFXHolder = ((Component)player).GetComponent() ?? ((Component)player).gameObject.AddComponent(); swordLightningFXHolder.SetActive(active); } } public void SetActive(bool active) { _active = active; if (!active) { StopApplyRoutine(); Cleanup(); } else if (_spawnedRight.Count + _spawnedLeft.Count <= 0 && _applyRoutine == null) { _applyRoutine = ((MonoBehaviour)this).StartCoroutine(ApplyWithRetries()); } } private void Update() { if (!_active || (Object)(object)_player == (Object)null) { return; } VisEquipment visEquipment = ((Humanoid)_player).m_visEquipment; if (!((Object)(object)visEquipment == (Object)null)) { FieldInfo fieldInfo = AccessTools.Field(typeof(VisEquipment), "m_rightItemInstance"); FieldInfo fieldInfo2 = AccessTools.Field(typeof(VisEquipment), "m_leftItemInstance"); object? obj = fieldInfo?.GetValue(visEquipment); GameObject val = (GameObject)((obj is GameObject) ? obj : null); object? obj2 = fieldInfo2?.GetValue(visEquipment); GameObject val2 = (GameObject)((obj2 is GameObject) ? obj2 : null); bool flag = (Object)(object)val != (Object)(object)_lastRightInstance || (Object)(object)val2 != (Object)(object)_lastLeftInstance; _lastRightInstance = val; _lastLeftInstance = val2; if (flag && _spawnedRight.Count + _spawnedLeft.Count == 0 && _applyRoutine == null) { _applyRoutine = ((MonoBehaviour)this).StartCoroutine(ApplyWithRetries()); } } } [IteratorStateMachine(typeof(d__17))] private IEnumerator ApplyWithRetries() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__17(0) { <>4__this = this }; } private void StopApplyRoutine() { if (_applyRoutine != null) { ((MonoBehaviour)this).StopCoroutine(_applyRoutine); _applyRoutine = null; } } private bool TryApplyFX() { //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_player == (Object)null || (Object)(object)ObjectDB.instance == (Object)null) { return false; } if (_spawnedRight.Count + _spawnedLeft.Count > 0) { return true; } Transform val = ((Component)_player).transform.Find("Visual/Armature/Hips/Spine/Spine1/Spine2/RightShoulder/RightArm/RightForeArm/RightHand/RightHand_Attach/attach(Clone)"); Transform val2 = ((Component)_player).transform.Find("Visual/Armature/Hips/Spine/Spine1/Spine2/LeftShoulder/LeftArm/LeftForeArm/LeftHand/LeftHand_Attach/attach(Clone)"); if ((Object)(object)val == (Object)null && (Object)(object)val2 == (Object)null) { return false; } Transform val3 = (Object.op_Implicit((Object)(object)val) ? FindChildDeepExact(val, "Viking_Sword (1)") : null); Transform val4 = (Object.op_Implicit((Object)(object)val2) ? FindChildDeepExact(val2, "Viking_Sword (1)") : null); bool flag = (Object)(object)val3 != (Object)null || (Object)(object)val4 != (Object)null; GameObject itemPrefab = ObjectDB.instance.GetItemPrefab("SwordNiedhoggLightning"); GameObject itemPrefab2 = ObjectDB.instance.GetItemPrefab("THSwordSlayerLightning"); if (flag && (Object)(object)itemPrefab != (Object)null) { Transform val5 = itemPrefab.transform.Find("attach"); Transform val6 = (Object.op_Implicit((Object)(object)val5) ? FindChildDeepCI(val5, "glow") : null); if ((Object)(object)val6 != (Object)null) { int num = 0; if ((Object)(object)val3 != (Object)null) { GameObject val7 = InstantiateUnder(((Component)val6).gameObject, val3, ((Object)val6).name); ForceActivateHierarchy(val7); _spawnedRight.Add(val7); num++; } if ((Object)(object)val4 != (Object)null) { GameObject val8 = InstantiateUnder(((Component)val6).gameObject, val4, ((Object)val6).name); ForceActivateHierarchy(val8); _spawnedLeft.Add(val8); num++; } bool flag2 = num > 0; Debug.Log((object)$"[SwordLightningFX] 1H -> placed={num}, ok={flag2} para {_player.GetPlayerName()}"); if (flag2) { return true; } } } if ((Object)(object)val != (Object)null && (Object)(object)itemPrefab2 != (Object)null) { Transform val9 = itemPrefab2.transform.Find("attach"); Transform val10 = (Object.op_Implicit((Object)(object)val9) ? FindChildDeepCI(val9, "Vfx") : null); if ((Object)(object)val10 == (Object)null) { return false; } Transform val11 = FindChildDeepCI(val, "equipped") ?? FindChildDeepCI(val, "equiped"); if ((Object)(object)val11 == (Object)null) { val11 = GetOrCreateDirectChild(val, "equipped"); } int num2 = 0; for (int i = 0; i < val10.childCount; i++) { Transform child = val10.GetChild(i); string name = ((Object)child).name; if (!name.Equals("collider", StringComparison.OrdinalIgnoreCase) && !name.Equals("Clouds", StringComparison.OrdinalIgnoreCase)) { GameObject val12 = InstantiateUnder(((Component)child).gameObject, val11, name); val12.transform.position = val11.position; val12.transform.eulerAngles = val11.eulerAngles; val12.transform.localScale = child.localScale; ForceActivateHierarchy(val12); _spawnedRight.Add(val12); num2++; } } bool flag3 = num2 > 0; Debug.Log((object)$"[SwordLightningFX] 2H -> placed={num2}, ok={flag3} para {_player.GetPlayerName()}"); if (flag3) { return true; } } return false; } private void Cleanup() { int num = DestroyList(_spawnedRight); int num2 = DestroyList(_spawnedLeft); if (num + num2 > 0) { Debug.Log((object)$"[SwordLightningFX] Cleanup: {num} (der), {num2} (izq)."); } } private static int DestroyList(List list) { int num = 0; for (int i = 0; i < list.Count; i++) { if (Object.op_Implicit((Object)(object)list[i])) { Object.Destroy((Object)(object)list[i]); num++; } } list.Clear(); return num; } private static Transform FindChildDeepCI(Transform root, string targetName) { if (!Object.op_Implicit((Object)(object)root)) { return null; } string text = targetName.ToLowerInvariant(); Stack stack = new Stack(); stack.Push(root); while (stack.Count > 0) { Transform val = stack.Pop(); for (int i = 0; i < val.childCount; i++) { Transform child = val.GetChild(i); if (((Object)child).name.ToLowerInvariant() == text) { return child; } stack.Push(child); } } return null; } private static Transform FindChildDeepExact(Transform root, string exactName) { if (!Object.op_Implicit((Object)(object)root)) { return null; } Stack stack = new Stack(); stack.Push(root); while (stack.Count > 0) { Transform val = stack.Pop(); for (int i = 0; i < val.childCount; i++) { Transform child = val.GetChild(i); if (((Object)child).name == exactName) { return child; } stack.Push(child); } } return null; } private static Transform GetOrCreateDirectChild(Transform parent, string exactName) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)parent)) { return null; } for (int i = 0; i < parent.childCount; i++) { Transform child = parent.GetChild(i); if (((Object)child).name == exactName) { return child; } } GameObject val = new GameObject(exactName); val.transform.SetParent(parent, false); return val.transform; } private static GameObject InstantiateUnder(GameObject donor, Transform parent, string forcedName = null) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate(donor, parent); if (!string.IsNullOrEmpty(forcedName)) { ((Object)val).name = forcedName; } val.transform.localPosition = donor.transform.localPosition; val.transform.localRotation = donor.transform.localRotation; val.transform.localScale = donor.transform.localScale; return val; } private static void ForceActivateHierarchy(GameObject root) { //IL_002a: 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) if (Object.op_Implicit((Object)(object)root)) { SetActiveRecursive(root.transform, active: true); ParticleSystem[] componentsInChildren = root.GetComponentsInChildren(true); foreach (ParticleSystem val in componentsInChildren) { EmissionModule emission = val.emission; ((EmissionModule)(ref emission)).enabled = true; val.Clear(true); val.Play(true); } TrailRenderer[] componentsInChildren2 = root.GetComponentsInChildren(true); for (int j = 0; j < componentsInChildren2.Length; j++) { ((Renderer)componentsInChildren2[j]).enabled = true; componentsInChildren2[j].Clear(); } LineRenderer[] componentsInChildren3 = root.GetComponentsInChildren(true); for (int k = 0; k < componentsInChildren3.Length; k++) { ((Renderer)componentsInChildren3[k]).enabled = true; } Light[] componentsInChildren4 = root.GetComponentsInChildren(true); for (int l = 0; l < componentsInChildren4.Length; l++) { ((Behaviour)componentsInChildren4[l]).enabled = true; } } } private static void SetActiveRecursive(Transform t, bool active) { ((Component)t).gameObject.SetActive(active); for (int i = 0; i < t.childCount; i++) { SetActiveRecursive(t.GetChild(i), active); } } } private const string ZdoKeyActive = "swordlight_active"; private const string RpcName = "RPC_SwordLightning"; public static void Init(Harmony harmony) { Patch_Player_Awake_RegisterRpc_AndEnsureHolder(harmony); Patch_Player_OnSpawned_ReadZdoAndApply(harmony); Debug.Log((object)"[NazhikaCore] SwordLightningRPC.Init -> RPC Player + Sync + Holder listos"); } public static void ApplyFromStatus(Player player, bool active) { if (Object.op_Implicit((Object)(object)player)) { ZNetView component = ((Component)player).GetComponent(); if ((Object)(object)component != (Object)null && component.IsValid() && component.GetZDO() != null && component.IsOwner()) { component.GetZDO().Set("swordlight_active", active ? 1 : 0); Debug.Log((object)string.Format("[SwordLightningRPC] ApplyFromStatus → ZDO {0}={1} en {2} (owner). Enviando RPC...", "swordlight_active", active ? 1 : 0, player.GetPlayerName())); component.InvokeRPC(ZNetView.Everybody, "RPC_SwordLightning", new object[1] { active }); } else { Debug.Log((object)("[SwordLightningRPC] ApplyFromStatus → sin autoridad ZDO para " + ((player != null) ? player.GetPlayerName() : null) + " (no owner). Solo efecto local.")); } SwordLightningFXHolder.ApplyNow(player, active); } } private static void Patch_Player_Awake_RegisterRpc_AndEnsureHolder(Harmony harmony) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown MethodInfo methodInfo = AccessTools.Method(typeof(Player), "Awake", (Type[])null, (Type[])null); HarmonyMethod val = new HarmonyMethod(typeof(SwordLightningRPC), "Player_Awake_Postfix", (Type[])null); harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } private static void Player_Awake_Postfix(Player __instance) { ZNetView component = ((Component)__instance).GetComponent(); if ((Object)(object)component != (Object)null && component.IsValid()) { if ((Object)(object)((Component)__instance).GetComponent() == (Object)null) { ((Component)__instance).gameObject.AddComponent(); } component.Register("RPC_SwordLightning", (Action)delegate(long sender, bool active) { Debug.Log((object)$"[SwordLightningRPC] RPC_SwordLightning recibido → active={active} para {__instance.GetPlayerName()}"); SwordLightningFXHolder.ApplyNow(__instance, active); }); } } private static void Patch_Player_OnSpawned_ReadZdoAndApply(Harmony harmony) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown MethodInfo methodInfo = AccessTools.Method(typeof(Player), "OnSpawned", (Type[])null, (Type[])null); HarmonyMethod val = new HarmonyMethod(typeof(SwordLightningRPC), "Player_OnSpawned_Postfix", (Type[])null); harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } private static void Player_OnSpawned_Postfix(Player __instance) { ZNetView component = ((Component)__instance).GetComponent(); if ((Object)(object)component != (Object)null && component.IsValid() && component.GetZDO() != null) { bool flag = component.GetZDO().GetInt("swordlight_active", 0) == 1; Debug.Log((object)string.Format("[SwordLightningRPC] OnSpawned → estado ZDO({0})={1} en {2}", "swordlight_active", flag, __instance.GetPlayerName())); SwordLightningFXHolder.ApplyNow(__instance, flag); } } } public static class SwordPoisonRPC { public class SwordPoisonFXHolder : MonoBehaviour { [CompilerGenerated] private sealed class d__17 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public SwordPoisonFXHolder <>4__this; private int 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__17(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown int num = <>1__state; SwordPoisonFXHolder swordPoisonFXHolder = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; 5__2 = 0; break; case 1: <>1__state = -1; break; } if (5__2++ < 120) { if (swordPoisonFXHolder.TryApplyFX()) { swordPoisonFXHolder._applyRoutine = null; return false; } <>2__current = (object)new WaitForSeconds(0.1f); <>1__state = 1; return true; } swordPoisonFXHolder._applyRoutine = null; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private const string OneHandSourcePrefab = "SwordNiedhoggNature"; private const string TwoHandSourcePrefab = "THSwordSlayerNature"; private const string RightAttachPath = "Visual/Armature/Hips/Spine/Spine1/Spine2/RightShoulder/RightArm/RightForeArm/RightHand/RightHand_Attach/attach(Clone)"; private const string LeftAttachPath = "Visual/Armature/Hips/Spine/Spine1/Spine2/LeftShoulder/LeftArm/LeftForeArm/LeftHand/LeftHand_Attach/attach(Clone)"; private Player _player; private Coroutine _applyRoutine; private readonly List _spawnedRight = new List(); private readonly List _spawnedLeft = new List(); private bool _active; private GameObject _lastRightInstance; private GameObject _lastLeftInstance; private void Awake() { _player = ((Component)this).GetComponent(); } private void OnDisable() { StopApplyRoutine(); Cleanup(); _active = false; } private void OnDestroy() { StopApplyRoutine(); Cleanup(); _active = false; } public static void ApplyNow(Player player, bool active) { if (Object.op_Implicit((Object)(object)player)) { SwordPoisonFXHolder swordPoisonFXHolder = ((Component)player).GetComponent() ?? ((Component)player).gameObject.AddComponent(); swordPoisonFXHolder.SetActive(active); } } public void SetActive(bool active) { _active = active; if (!active) { StopApplyRoutine(); Cleanup(); } else if (_spawnedRight.Count + _spawnedLeft.Count <= 0 && _applyRoutine == null) { _applyRoutine = ((MonoBehaviour)this).StartCoroutine(ApplyWithRetries()); } } private void Update() { if (!_active || (Object)(object)_player == (Object)null) { return; } VisEquipment visEquipment = ((Humanoid)_player).m_visEquipment; if (!((Object)(object)visEquipment == (Object)null)) { FieldInfo fieldInfo = AccessTools.Field(typeof(VisEquipment), "m_rightItemInstance"); FieldInfo fieldInfo2 = AccessTools.Field(typeof(VisEquipment), "m_leftItemInstance"); object? obj = fieldInfo?.GetValue(visEquipment); GameObject val = (GameObject)((obj is GameObject) ? obj : null); object? obj2 = fieldInfo2?.GetValue(visEquipment); GameObject val2 = (GameObject)((obj2 is GameObject) ? obj2 : null); bool flag = (Object)(object)val != (Object)(object)_lastRightInstance || (Object)(object)val2 != (Object)(object)_lastLeftInstance; _lastRightInstance = val; _lastLeftInstance = val2; if (flag && _spawnedRight.Count + _spawnedLeft.Count == 0 && _applyRoutine == null) { _applyRoutine = ((MonoBehaviour)this).StartCoroutine(ApplyWithRetries()); } } } [IteratorStateMachine(typeof(d__17))] private IEnumerator ApplyWithRetries() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__17(0) { <>4__this = this }; } private void StopApplyRoutine() { if (_applyRoutine != null) { ((MonoBehaviour)this).StopCoroutine(_applyRoutine); _applyRoutine = null; } } private bool TryApplyFX() { //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_player == (Object)null || (Object)(object)ObjectDB.instance == (Object)null) { return false; } if (_spawnedRight.Count + _spawnedLeft.Count > 0) { return true; } Transform val = ((Component)_player).transform.Find("Visual/Armature/Hips/Spine/Spine1/Spine2/RightShoulder/RightArm/RightForeArm/RightHand/RightHand_Attach/attach(Clone)"); Transform val2 = ((Component)_player).transform.Find("Visual/Armature/Hips/Spine/Spine1/Spine2/LeftShoulder/LeftArm/LeftForeArm/LeftHand/LeftHand_Attach/attach(Clone)"); if ((Object)(object)val == (Object)null && (Object)(object)val2 == (Object)null) { return false; } Transform val3 = (Object.op_Implicit((Object)(object)val) ? FindChildDeepExact(val, "Viking_Sword (1)") : null); Transform val4 = (Object.op_Implicit((Object)(object)val2) ? FindChildDeepExact(val2, "Viking_Sword (1)") : null); bool flag = (Object)(object)val3 != (Object)null || (Object)(object)val4 != (Object)null; GameObject itemPrefab = ObjectDB.instance.GetItemPrefab("SwordNiedhoggNature"); GameObject itemPrefab2 = ObjectDB.instance.GetItemPrefab("THSwordSlayerNature"); if (flag && (Object)(object)itemPrefab != (Object)null) { Transform val5 = itemPrefab.transform.Find("attach/default/glow"); if ((Object)(object)val5 != (Object)null) { Transform val6 = val5.Find("Spores"); Transform val7 = val5.Find("Spores_World"); Transform val8 = val5.Find("Point light"); if (Object.op_Implicit((Object)(object)val6) && Object.op_Implicit((Object)(object)val7) && Object.op_Implicit((Object)(object)val8)) { int num = 0; if ((Object)(object)val3 != (Object)null) { num += CloneTriplet(val6, val7, val8, val3, _spawnedRight); } if ((Object)(object)val4 != (Object)null) { num += CloneTriplet(val6, val7, val8, val4, _spawnedLeft); } bool flag2 = num > 0; Debug.Log((object)$"[SwordPoisonFX] 1H -> placed={num}, ok={flag2} para {_player.GetPlayerName()}"); if (flag2) { return true; } } } } if ((Object)(object)val != (Object)null && (Object)(object)itemPrefab2 != (Object)null) { Transform val9 = itemPrefab2.transform.Find("attach"); Transform val10 = (Object.op_Implicit((Object)(object)val9) ? FindChildDeepCI(val9, "Vfx") : null); if ((Object)(object)val10 == (Object)null) { return false; } Transform val11 = FindChildDeepCI(val, "equipped") ?? FindChildDeepCI(val, "equiped"); if ((Object)(object)val11 == (Object)null) { val11 = GetOrCreateDirectChild(val, "equipped"); } int num2 = 0; for (int i = 0; i < val10.childCount; i++) { Transform child = val10.GetChild(i); string name = ((Object)child).name; if (!name.Equals("collider", StringComparison.OrdinalIgnoreCase) && !name.Equals("Clouds", StringComparison.OrdinalIgnoreCase)) { GameObject val12 = InstantiateUnder(((Component)child).gameObject, val11, name); val12.transform.position = val11.position; val12.transform.eulerAngles = val11.eulerAngles; val12.transform.localScale = child.localScale; ForceActivateHierarchy(val12); _spawnedRight.Add(val12); num2++; } } bool flag3 = num2 > 0; Debug.Log((object)$"[SwordPoisonFX] 2H -> placed={num2}, ok={flag3} para {_player.GetPlayerName()}"); if (flag3) { return true; } } return false; } private static int CloneTriplet(Transform tSpores, Transform tSporesWorld, Transform tPointLight, Transform dst, List bucket) { int num = 0; GameObject val = InstantiateUnder(((Component)tSpores).gameObject, dst, "Spores"); ForceActivateHierarchy(val); bucket.Add(val); num++; GameObject val2 = InstantiateUnder(((Component)tSporesWorld).gameObject, dst, "Spores_World"); ForceActivateHierarchy(val2); bucket.Add(val2); num++; GameObject val3 = InstantiateUnder(((Component)tPointLight).gameObject, dst, "Point light"); ForceActivateHierarchy(val3); bucket.Add(val3); return num + 1; } private void Cleanup() { int num = DestroyList(_spawnedRight); int num2 = DestroyList(_spawnedLeft); if (num + num2 > 0) { Debug.Log((object)$"[SwordPoisonFX] Cleanup: {num} (der), {num2} (izq)."); } } private static int DestroyList(List list) { int num = 0; for (int i = 0; i < list.Count; i++) { if (Object.op_Implicit((Object)(object)list[i])) { Object.Destroy((Object)(object)list[i]); num++; } } list.Clear(); return num; } private static Transform FindChildDeepCI(Transform root, string targetName) { if (!Object.op_Implicit((Object)(object)root)) { return null; } string text = targetName.ToLowerInvariant(); Stack stack = new Stack(); stack.Push(root); while (stack.Count > 0) { Transform val = stack.Pop(); for (int i = 0; i < val.childCount; i++) { Transform child = val.GetChild(i); if (((Object)child).name.ToLowerInvariant() == text) { return child; } stack.Push(child); } } return null; } private static Transform FindChildDeepExact(Transform root, string exactName) { if (!Object.op_Implicit((Object)(object)root)) { return null; } Stack stack = new Stack(); stack.Push(root); while (stack.Count > 0) { Transform val = stack.Pop(); for (int i = 0; i < val.childCount; i++) { Transform child = val.GetChild(i); if (((Object)child).name == exactName) { return child; } stack.Push(child); } } return null; } private static Transform GetOrCreateDirectChild(Transform parent, string exactName) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)parent)) { return null; } for (int i = 0; i < parent.childCount; i++) { Transform child = parent.GetChild(i); if (((Object)child).name == exactName) { return child; } } GameObject val = new GameObject(exactName); val.transform.SetParent(parent, false); return val.transform; } private static GameObject InstantiateUnder(GameObject donor, Transform parent, string forcedName = null) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate(donor, parent); if (!string.IsNullOrEmpty(forcedName)) { ((Object)val).name = forcedName; } val.transform.localPosition = donor.transform.localPosition; val.transform.localRotation = donor.transform.localRotation; val.transform.localScale = donor.transform.localScale; return val; } private static void ForceActivateHierarchy(GameObject root) { //IL_002a: 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) if (Object.op_Implicit((Object)(object)root)) { SetActiveRecursive(root.transform, active: true); ParticleSystem[] componentsInChildren = root.GetComponentsInChildren(true); foreach (ParticleSystem val in componentsInChildren) { EmissionModule emission = val.emission; ((EmissionModule)(ref emission)).enabled = true; val.Clear(true); val.Play(true); } TrailRenderer[] componentsInChildren2 = root.GetComponentsInChildren(true); for (int j = 0; j < componentsInChildren2.Length; j++) { ((Renderer)componentsInChildren2[j]).enabled = true; componentsInChildren2[j].Clear(); } LineRenderer[] componentsInChildren3 = root.GetComponentsInChildren(true); for (int k = 0; k < componentsInChildren3.Length; k++) { ((Renderer)componentsInChildren3[k]).enabled = true; } Light[] componentsInChildren4 = root.GetComponentsInChildren(true); for (int l = 0; l < componentsInChildren4.Length; l++) { ((Behaviour)componentsInChildren4[l]).enabled = true; } } } private static void SetActiveRecursive(Transform t, bool active) { ((Component)t).gameObject.SetActive(active); for (int i = 0; i < t.childCount; i++) { SetActiveRecursive(t.GetChild(i), active); } } } private const string ZdoKeyActive = "swordpoison_active"; private const string RpcName = "RPC_SwordPoison"; public static void Init(Harmony harmony) { Patch_Player_Awake_RegisterRpc_AndEnsureHolder(harmony); Patch_Player_OnSpawned_ReadZdoAndApply(harmony); Debug.Log((object)"[NazhikaCore] SwordPoisonRPC.Init -> RPC Player + Sync + Holder listos"); } public static void ApplyFromStatus(Player player, bool active) { if (Object.op_Implicit((Object)(object)player)) { ZNetView component = ((Component)player).GetComponent(); if ((Object)(object)component != (Object)null && component.IsValid() && component.GetZDO() != null && component.IsOwner()) { component.GetZDO().Set("swordpoison_active", active ? 1 : 0); Debug.Log((object)string.Format("[SwordPoisonRPC] ApplyFromStatus → ZDO {0}={1} en {2} (owner). Enviando RPC...", "swordpoison_active", active ? 1 : 0, player.GetPlayerName())); component.InvokeRPC(ZNetView.Everybody, "RPC_SwordPoison", new object[1] { active }); } else { Debug.Log((object)("[SwordPoisonRPC] ApplyFromStatus → sin autoridad ZDO para " + ((player != null) ? player.GetPlayerName() : null) + " (no owner). Solo efecto local.")); } SwordPoisonFXHolder.ApplyNow(player, active); } } private static void Patch_Player_Awake_RegisterRpc_AndEnsureHolder(Harmony harmony) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown MethodInfo methodInfo = AccessTools.Method(typeof(Player), "Awake", (Type[])null, (Type[])null); HarmonyMethod val = new HarmonyMethod(typeof(SwordPoisonRPC), "Player_Awake_Postfix", (Type[])null); harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } private static void Player_Awake_Postfix(Player __instance) { ZNetView component = ((Component)__instance).GetComponent(); if ((Object)(object)component != (Object)null && component.IsValid()) { if ((Object)(object)((Component)__instance).GetComponent() == (Object)null) { ((Component)__instance).gameObject.AddComponent(); } component.Register("RPC_SwordPoison", (Action)delegate(long sender, bool active) { Debug.Log((object)$"[SwordPoisonRPC] RPC_SwordPoison recibido → active={active} para {__instance.GetPlayerName()}"); SwordPoisonFXHolder.ApplyNow(__instance, active); }); } } private static void Patch_Player_OnSpawned_ReadZdoAndApply(Harmony harmony) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown MethodInfo methodInfo = AccessTools.Method(typeof(Player), "OnSpawned", (Type[])null, (Type[])null); HarmonyMethod val = new HarmonyMethod(typeof(SwordPoisonRPC), "Player_OnSpawned_Postfix", (Type[])null); harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } private static void Player_OnSpawned_Postfix(Player __instance) { ZNetView component = ((Component)__instance).GetComponent(); if ((Object)(object)component != (Object)null && component.IsValid() && component.GetZDO() != null) { bool flag = component.GetZDO().GetInt("swordpoison_active", 0) == 1; Debug.Log((object)string.Format("[SwordPoisonRPC] OnSpawned → estado ZDO({0})={1} en {2}", "swordpoison_active", flag, __instance.GetPlayerName())); SwordPoisonFXHolder.ApplyNow(__instance, flag); } } } public static class SwordWitherRPC { public class SwordWitherFXHolder : MonoBehaviour { [CompilerGenerated] private sealed class d__26 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public SwordWitherFXHolder <>4__this; private int 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__26(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown int num = <>1__state; SwordWitherFXHolder swordWitherFXHolder = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; 5__2 = 0; break; case 1: <>1__state = -1; break; } if (5__2++ < 120) { if (swordWitherFXHolder.TryApplyFX()) { swordWitherFXHolder._applyRoutine = null; return false; } <>2__current = (object)new WaitForSeconds(0.1f); <>1__state = 1; return true; } swordWitherFXHolder._applyRoutine = null; Debug.LogWarning((object)"[SwordWitherFX] ApplyWithRetries agotado -> no se pudo aplicar FX."); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private const string SourcePrefab_OneHand = "base_bastard_poison_bal"; private const string SourcePrefab_TwoHand = "THSwordSlayerBlood"; private static readonly Vector3 OneHandLocalPos = new Vector3(0f, 0.7f, 0f); private static readonly Vector3 OneHandLocalScale = new Vector3(1.1111f, 3.9f, 1.1111f); private const float OneHandEmissionRate = 1000f; private const float OneHandPlaybackSpeed = 2f; private const int OneHandMaxParticles = 2000; private static readonly Color OneHandColor = new Color(1f, 0f, 0f, 1f); private const float TwoHandEmissionRate = 5f; private const int TwoHandMaxParticles = 1000; private const float TwoHandScaleZ = 1.15f; private const string RightAttachPath = "Visual/Armature/Hips/Spine/Spine1/Spine2/RightShoulder/RightArm/RightForeArm/RightHand/RightHand_Attach/attach(Clone)"; private const string LeftAttachPath = "Visual/Armature/Hips/Spine/Spine1/Spine2/LeftShoulder/LeftArm/LeftForeArm/LeftHand/LeftHand_Attach/attach(Clone)"; private Player _player; private Coroutine _applyRoutine; private readonly List _spawnedRight = new List(); private readonly List _spawnedLeft = new List(); private bool _active; private GameObject _lastRightInstance; private GameObject _lastLeftInstance; private void Awake() { _player = ((Component)this).GetComponent(); } private void OnDisable() { StopApplyRoutine(); Cleanup(); _active = false; } private void OnDestroy() { StopApplyRoutine(); Cleanup(); _active = false; } public static void ApplyNow(Player player, bool active) { if (Object.op_Implicit((Object)(object)player)) { SwordWitherFXHolder swordWitherFXHolder = ((Component)player).GetComponent() ?? ((Component)player).gameObject.AddComponent(); swordWitherFXHolder.SetActive(active); } } public void SetActive(bool active) { _active = active; if (!active) { StopApplyRoutine(); Cleanup(); } else if (_spawnedRight.Count + _spawnedLeft.Count <= 0 && _applyRoutine == null) { _applyRoutine = ((MonoBehaviour)this).StartCoroutine(ApplyWithRetries()); } } private void Update() { if (!_active || (Object)(object)_player == (Object)null) { return; } VisEquipment visEquipment = ((Humanoid)_player).m_visEquipment; if (!((Object)(object)visEquipment == (Object)null)) { FieldInfo fieldInfo = AccessTools.Field(typeof(VisEquipment), "m_rightItemInstance"); FieldInfo fieldInfo2 = AccessTools.Field(typeof(VisEquipment), "m_leftItemInstance"); object? obj = fieldInfo?.GetValue(visEquipment); GameObject val = (GameObject)((obj is GameObject) ? obj : null); object? obj2 = fieldInfo2?.GetValue(visEquipment); GameObject val2 = (GameObject)((obj2 is GameObject) ? obj2 : null); bool flag = (Object)(object)val != (Object)(object)_lastRightInstance || (Object)(object)val2 != (Object)(object)_lastLeftInstance; _lastRightInstance = val; _lastLeftInstance = val2; if (flag && _spawnedRight.Count + _spawnedLeft.Count == 0 && _applyRoutine == null) { _applyRoutine = ((MonoBehaviour)this).StartCoroutine(ApplyWithRetries()); } } } [IteratorStateMachine(typeof(d__26))] private IEnumerator ApplyWithRetries() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__26(0) { <>4__this = this }; } private void StopApplyRoutine() { if (_applyRoutine != null) { ((MonoBehaviour)this).StopCoroutine(_applyRoutine); _applyRoutine = null; } } private bool TryApplyFX() { if ((Object)(object)_player == (Object)null) { return false; } if (_spawnedRight.Count + _spawnedLeft.Count > 0) { return true; } Transform val = ((Component)_player).transform.Find("Visual/Armature/Hips/Spine/Spine1/Spine2/RightShoulder/RightArm/RightForeArm/RightHand/RightHand_Attach/attach(Clone)"); Transform val2 = ((Component)_player).transform.Find("Visual/Armature/Hips/Spine/Spine1/Spine2/LeftShoulder/LeftArm/LeftForeArm/LeftHand/LeftHand_Attach/attach(Clone)"); if ((Object)(object)val == (Object)null && (Object)(object)val2 == (Object)null) { return false; } Transform val3 = (Object.op_Implicit((Object)(object)val) ? FindChildDeepExact(val, "Viking_Sword (1)") : null); Transform val4 = (Object.op_Implicit((Object)(object)val2) ? FindChildDeepExact(val2, "Viking_Sword (1)") : null); if ((Object)(object)val3 != (Object)null || (Object)(object)val4 != (Object)null) { GameObject prefab = GetPrefab("base_bastard_poison_bal"); if ((Object)(object)prefab == (Object)null) { return false; } Transform val5 = FindChildDeepCI(prefab.transform, "BastardSilver"); if ((Object)(object)val5 == (Object)null) { val5 = FindChildDeepCI(prefab.transform, "attach_RightHand_Attach") ?? prefab.transform; } int num = 0; if ((Object)(object)val3 != (Object)null) { num += CloneAllChildren_OneHandSettings(val5, val3, val3, _spawnedRight); } if ((Object)(object)val4 != (Object)null) { num += CloneAllChildren_OneHandSettings(val5, val4, val4, _spawnedLeft); } bool flag = num > 0; Debug.Log((object)$"[SwordWitherFX] 1H TryApplyFX -> placed={num}, ok={flag} para {_player.GetPlayerName()}"); return flag; } if ((Object)(object)val != (Object)null) { Transform val6 = FindChildDeepCI(val, "equipped") ?? FindChildDeepCI(val, "equiped"); if ((Object)(object)val6 == (Object)null) { return false; } GameObject prefab2 = GetPrefab("THSwordSlayerBlood"); if ((Object)(object)prefab2 == (Object)null) { return false; } Transform val7 = prefab2.transform.Find("attach/Vfx"); if ((Object)(object)val7 == (Object)null) { Transform val8 = prefab2.transform.Find("attach"); val7 = (Object.op_Implicit((Object)(object)val8) ? FindChildDeepCI(val8, "Vfx") : FindChildDeepCI(prefab2.transform, "Vfx")); } if ((Object)(object)val7 == (Object)null) { val7 = prefab2.transform; } int num2 = CloneAllChildren_TwoHandSettings(val7, val6, val6, _spawnedRight); bool flag2 = num2 > 0; Debug.Log((object)$"[SwordWitherFX] 2H TryApplyFX -> placed={num2}, ok={flag2} para {_player.GetPlayerName()}"); return flag2; } return false; } private int CloneAllChildren_OneHandSettings(Transform donor, Transform dstParent, Transform anchor, List bucket) { //IL_005e: 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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)donor == (Object)null || (Object)(object)dstParent == (Object)null || (Object)(object)anchor == (Object)null) { return 0; } int num = 0; for (int i = 0; i < donor.childCount; i++) { Transform child = donor.GetChild(i); if (!((Object)child).name.Equals("vfx_BloodHit 1", StringComparison.OrdinalIgnoreCase)) { GameObject val = InstantiateUnder(((Component)child).gameObject, dstParent, ((Object)child).name); val.transform.position = anchor.position; val.transform.eulerAngles = anchor.eulerAngles; val.transform.localPosition = OneHandLocalPos; val.transform.localScale = OneHandLocalScale; ForceActivateHierarchy(val); ApplyParticleSettings(val, 1000f, 2000, 2f); RecolorAll(val, OneHandColor); bucket.Add(val); num++; } } return num; } private static int CloneAllChildren_TwoHandSettings(Transform donor, Transform dstParent, Transform anchor, List bucket) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)donor == (Object)null || (Object)(object)dstParent == (Object)null || (Object)(object)anchor == (Object)null) { return 0; } int num = 0; for (int i = 0; i < donor.childCount; i++) { Transform child = donor.GetChild(i); GameObject val = InstantiateUnder(((Component)child).gameObject, dstParent, ((Object)child).name); val.transform.position = anchor.position; val.transform.eulerAngles = anchor.eulerAngles; Vector3 localScale = val.transform.localScale; localScale.z = 1.15f; val.transform.localScale = localScale; ForceActivateHierarchy(val); ApplyParticleSettings(val, 5f, 1000); bucket.Add(val); num++; } return num; } private void Cleanup() { int num = DestroyList(_spawnedRight); int num2 = DestroyList(_spawnedLeft); if (num + num2 > 0) { Debug.Log((object)$"[SwordWitherFX] Cleanup: {num} (der), {num2} (izq)."); } } private static int DestroyList(List list) { int num = 0; for (int i = 0; i < list.Count; i++) { if (Object.op_Implicit((Object)(object)list[i])) { Object.Destroy((Object)(object)list[i]); num++; } } list.Clear(); return num; } private static void ApplyParticleSettings(GameObject root, float emissionRateOverTime, int maxParticles, float playbackSpeed = 1f) { //IL_001a: 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_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_0043: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)root)) { return; } ParticleSystem[] componentsInChildren = root.GetComponentsInChildren(true); foreach (ParticleSystem val in componentsInChildren) { try { MainModule main = val.main; ((MainModule)(ref main)).maxParticles = maxParticles; ((MainModule)(ref main)).simulationSpeed = playbackSpeed; EmissionModule emission = val.emission; ((EmissionModule)(ref emission)).enabled = true; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(emissionRateOverTime); val.Clear(true); val.Play(true); } catch (Exception) { } } } private static void RecolorAll(GameObject root, Color c) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)root)) { return; } ParticleSystem[] componentsInChildren = root.GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { try { MainModule main = componentsInChildren[i].main; ((MainModule)(ref main)).startColor = new MinMaxGradient(c); } catch (Exception) { } } TrailRenderer[] componentsInChildren2 = root.GetComponentsInChildren(true); for (int j = 0; j < componentsInChildren2.Length; j++) { try { componentsInChildren2[j].startColor = c; componentsInChildren2[j].endColor = c; } catch (Exception) { } } LineRenderer[] componentsInChildren3 = root.GetComponentsInChildren(true); for (int k = 0; k < componentsInChildren3.Length; k++) { try { componentsInChildren3[k].startColor = c; componentsInChildren3[k].endColor = c; } catch (Exception) { } } Light[] componentsInChildren4 = root.GetComponentsInChildren(true); for (int l = 0; l < componentsInChildren4.Length; l++) { try { componentsInChildren4[l].color = c; } catch (Exception) { } } } private static GameObject GetPrefab(string prefabName) { if ((Object)(object)ObjectDB.instance != (Object)null) { GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(prefabName); if ((Object)(object)itemPrefab != (Object)null) { return itemPrefab; } } if ((Object)(object)ZNetScene.instance != (Object)null) { GameObject prefab = ZNetScene.instance.GetPrefab(prefabName); if ((Object)(object)prefab != (Object)null) { return prefab; } } return null; } private static Transform FindChildDeepCI(Transform root, string targetName) { if (!Object.op_Implicit((Object)(object)root)) { return null; } string text = targetName.ToLowerInvariant(); Stack stack = new Stack(); stack.Push(root); while (stack.Count > 0) { Transform val = stack.Pop(); for (int i = 0; i < val.childCount; i++) { Transform child = val.GetChild(i); if (((Object)child).name.ToLowerInvariant() == text) { return child; } stack.Push(child); } } return null; } private static Transform FindChildDeepExact(Transform root, string exactName) { if (!Object.op_Implicit((Object)(object)root)) { return null; } Stack stack = new Stack(); stack.Push(root); while (stack.Count > 0) { Transform val = stack.Pop(); for (int i = 0; i < val.childCount; i++) { Transform child = val.GetChild(i); if (((Object)child).name == exactName) { return child; } stack.Push(child); } } return null; } private static GameObject InstantiateUnder(GameObject donor, Transform parent, string forcedName = null) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate(donor, parent); if (!string.IsNullOrEmpty(forcedName)) { ((Object)val).name = forcedName; } val.transform.localPosition = donor.transform.localPosition; val.transform.localRotation = donor.transform.localRotation; val.transform.localScale = donor.transform.localScale; return val; } private static void ForceActivateHierarchy(GameObject root) { //IL_002a: 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) if (Object.op_Implicit((Object)(object)root)) { SetActiveRecursive(root.transform, active: true); ParticleSystem[] componentsInChildren = root.GetComponentsInChildren(true); foreach (ParticleSystem val in componentsInChildren) { EmissionModule emission = val.emission; ((EmissionModule)(ref emission)).enabled = true; val.Clear(true); val.Play(true); } TrailRenderer[] componentsInChildren2 = root.GetComponentsInChildren(true); for (int j = 0; j < componentsInChildren2.Length; j++) { ((Renderer)componentsInChildren2[j]).enabled = true; componentsInChildren2[j].Clear(); } LineRenderer[] componentsInChildren3 = root.GetComponentsInChildren(true); for (int k = 0; k < componentsInChildren3.Length; k++) { ((Renderer)componentsInChildren3[k]).enabled = true; } Light[] componentsInChildren4 = root.GetComponentsInChildren(true); for (int l = 0; l < componentsInChildren4.Length; l++) { ((Behaviour)componentsInChildren4[l]).enabled = true; } } } private static void SetActiveRecursive(Transform t, bool active) { ((Component)t).gameObject.SetActive(active); for (int i = 0; i < t.childCount; i++) { SetActiveRecursive(t.GetChild(i), active); } } } private const string ZdoKeyActive = "swordwither_active"; private const string RpcName = "RPC_SwordWither"; public static void Init(Harmony harmony) { Patch_Player_Awake_RegisterRpc_AndEnsureHolder(harmony); Patch_Player_OnSpawned_ReadZdoAndApply(harmony); Debug.Log((object)"[NazhikaCore] SwordWitherRPC.Init -> RPC Player + Sync + Holder listos"); } public static void ApplyFromStatus(Player player, bool active) { if (Object.op_Implicit((Object)(object)player)) { ZNetView component = ((Component)player).GetComponent(); if ((Object)(object)component != (Object)null && component.IsValid() && component.GetZDO() != null && component.IsOwner()) { component.GetZDO().Set("swordwither_active", active ? 1 : 0); Debug.Log((object)string.Format("[SwordWitherRPC] ApplyFromStatus -> ZDO {0}={1} en {2} (owner). Enviando RPC...", "swordwither_active", active ? 1 : 0, player.GetPlayerName())); component.InvokeRPC(ZNetView.Everybody, "RPC_SwordWither", new object[1] { active }); } else { Debug.Log((object)("[SwordWitherRPC] ApplyFromStatus -> sin autoridad ZDO para " + ((player != null) ? player.GetPlayerName() : null) + " (no owner). Solo efecto local.")); } SwordWitherFXHolder.ApplyNow(player, active); } } private static void Patch_Player_Awake_RegisterRpc_AndEnsureHolder(Harmony harmony) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown MethodInfo methodInfo = AccessTools.Method(typeof(Player), "Awake", (Type[])null, (Type[])null); HarmonyMethod val = new HarmonyMethod(typeof(SwordWitherRPC), "Player_Awake_Postfix", (Type[])null); harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } private static void Player_Awake_Postfix(Player __instance) { ZNetView component = ((Component)__instance).GetComponent(); if ((Object)(object)component != (Object)null && component.IsValid()) { if ((Object)(object)((Component)__instance).GetComponent() == (Object)null) { ((Component)__instance).gameObject.AddComponent(); } component.Register("RPC_SwordWither", (Action)delegate(long sender, bool active) { Debug.Log((object)$"[SwordWitherRPC] RPC_SwordWither recibido -> active={active} para {__instance.GetPlayerName()}"); SwordWitherFXHolder.ApplyNow(__instance, active); }); } } private static void Patch_Player_OnSpawned_ReadZdoAndApply(Harmony harmony) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown MethodInfo methodInfo = AccessTools.Method(typeof(Player), "OnSpawned", (Type[])null, (Type[])null); HarmonyMethod val = new HarmonyMethod(typeof(SwordWitherRPC), "Player_OnSpawned_Postfix", (Type[])null); harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } private static void Player_OnSpawned_Postfix(Player __instance) { ZNetView component = ((Component)__instance).GetComponent(); if ((Object)(object)component != (Object)null && component.IsValid() && component.GetZDO() != null) { bool flag = component.GetZDO().GetInt("swordwither_active", 0) == 1; Debug.Log((object)string.Format("[SwordWitherRPC] OnSpawned -> estado ZDO({0})={1} en {2}", "swordwither_active", flag, __instance.GetPlayerName())); SwordWitherFXHolder.ApplyNow(__instance, flag); } } } public static class WarcryRPC { public class WarcryFXHolder : MonoBehaviour { [CompilerGenerated] private sealed class d__14 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Player player; public WarcryFXHolder <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__14(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown //IL_00ed: 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_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Expected O, but got Unknown //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; WarcryFXHolder warcryFXHolder = <>4__this; switch (num) { default: return false; case 0: { <>1__state = -1; string deviceName = SystemInfo.deviceName; string playerName = player.GetPlayerName(); ZNetView nview = ((Character)player).m_nview; Debug.Log((object)$"[WarcryFX] FxCoroutine inicio en {deviceName} para {playerName}, owner={((nview != null) ? new bool?(nview.IsOwner()) : null)}"); <>2__current = (object)new WaitForSeconds(0.2f); <>1__state = 1; return true; } case 1: { <>1__state = -1; if (Object.op_Implicit((Object)(object)((Character)player).m_animator)) { ((Character)player).m_animator.SetTrigger("emote_roar"); } warcryFXHolder.SpawnMeadStrengthCloudsAndLight(player); GameObject val = (Object.op_Implicit((Object)(object)ZNetScene.instance) ? ZNetScene.instance.GetPrefab("sfx_fader_fissure") : null); if (Object.op_Implicit((Object)(object)val)) { GameObject val2 = Object.Instantiate(val, ((Component)player).transform.position, Quaternion.identity); val2.transform.SetParent(((Component)player).transform, false); val2.transform.localPosition = new Vector3(0f, 1f, 0f); TintHierarchy(val2, WarcryColor); warcryFXHolder._spawnedFX.Add(val2); } GameObject val3 = (Object.op_Implicit((Object)(object)ZNetScene.instance) ? ZNetScene.instance.GetPrefab("fx_goblinking_nova") : null); if (Object.op_Implicit((Object)(object)val3)) { GameObject val4 = new GameObject("Warcry_Nova_Custom"); val4.transform.SetParent(((Component)player).transform, false); val4.transform.localPosition = Vector3.zero; Transform[] componentsInChildren = val3.GetComponentsInChildren(true); int num2 = 0; Transform[] array = componentsInChildren; foreach (Transform val5 in array) { if (!((Object)(object)val5 == (Object)null)) { string text = ((Object)val5).name.ToLowerInvariant(); if (text.Contains("poff_ring") || text.Contains("pebbles")) { GameObject val6 = Object.Instantiate(((Component)val5).gameObject); val6.transform.SetParent(val4.transform, false); val6.transform.localPosition = val5.localPosition; val6.transform.localRotation = val5.localRotation; val6.transform.localScale = val5.localScale; TintHierarchy(val6, WarcryColor); num2++; } } } Debug.Log((object)$"[WarcryFX] Nova CUSTOM → instanciados {num2} nodos (solo poff_ring & pebbles) para {player.GetPlayerName()}"); warcryFXHolder._spawnedFX.Add(val4); } Debug.Log((object)("[WarcryFX] FxCoroutine fin en " + SystemInfo.deviceName + " para " + player.GetPlayerName())); return false; } } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private static readonly Color WarcryColor = new Color(1f, 0.75f, 0.35f, 1f); private const string MeadPrefabName = "vfx_MeadStrength"; private const string FissurePrefab = "sfx_fader_fissure"; private const string NovaPrefabName = "fx_goblinking_nova"; private Player _player; private bool _active; private GameObject _auraFX; private readonly List _spawnedFX = new List(); public static void ApplyNow(Player player, bool active) { if (Object.op_Implicit((Object)(object)player)) { WarcryFXHolder warcryFXHolder = ((Component)player).GetComponent() ?? ((Component)player).gameObject.AddComponent(); warcryFXHolder.SetActive(active); } } private void Awake() { _player = ((Component)this).GetComponent(); } private void OnDisable() { Cleanup(); _active = false; } private void OnDestroy() { Cleanup(); _active = false; } private void Update() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_auraFX != (Object)null && _active) { _auraFX.transform.Rotate(Vector3.up, 50f * Time.deltaTime); } } public void SetActive(bool active) { if (_active != active) { _active = active; if (!_active) { Cleanup(); } else if ((Object)(object)_player != (Object)null) { ((MonoBehaviour)this).StartCoroutine(FxCoroutine(_player)); } } } [IteratorStateMachine(typeof(d__14))] private IEnumerator FxCoroutine(Player player) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__14(0) { <>4__this = this, player = player }; } private void SpawnMeadStrengthCloudsAndLight(Player player) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) GameObject val = (Object.op_Implicit((Object)(object)ZNetScene.instance) ? ZNetScene.instance.GetPrefab("vfx_MeadStrength") : null); if (!Object.op_Implicit((Object)(object)val)) { Debug.LogWarning((object)"[WarcryFX] No se encontró el prefab vfx_MeadStrength"); return; } GameObject val2 = new GameObject("Warcry_MeadCloudsRoot"); val2.transform.SetParent(((Component)player).transform, false); val2.transform.localPosition = new Vector3(0f, 1f, 0f); bool flag = false; Transform[] componentsInChildren = val.GetComponentsInChildren(true); Transform[] array = componentsInChildren; foreach (Transform val3 in array) { if ((Object)(object)val3 == (Object)null) { continue; } string text = ((Object)val3).name.ToLower(); bool flag2 = text.Contains("cloud"); bool flag3 = text.Contains("point light") || text.Contains("pointlight"); if (!flag2 && !flag3) { continue; } GameObject val4 = Object.Instantiate(((Component)val3).gameObject); val4.transform.SetParent(val2.transform, false); val4.transform.localPosition = val3.localPosition; val4.transform.localRotation = val3.localRotation; val4.transform.localScale = val3.localScale; Transform[] componentsInChildren2 = val4.GetComponentsInChildren(true); foreach (Transform val5 in componentsInChildren2) { if (!((Object)(object)val5 == (Object)null)) { ((Component)val5).gameObject.SetActive(true); } } flag = true; } if (!flag) { Debug.LogWarning((object)"[WarcryFX] No se encontraron 'cloud' o 'point light' en vfx_MeadStrength, destruyendo root."); Object.Destroy((Object)(object)val2); } else { MakeFxPersistent_PSOnly(val2); _spawnedFX.Add(val2); _auraFX = val2; } } private void Cleanup() { if ((Object)(object)_auraFX != (Object)null) { Object.Destroy((Object)(object)_auraFX); _auraFX = null; } foreach (GameObject item in _spawnedFX) { if ((Object)(object)item != (Object)null) { Object.Destroy((Object)(object)item); } } _spawnedFX.Clear(); } private static void MakeFxPersistent_PSOnly(GameObject root) { //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)root)) { return; } TimedDestruction[] componentsInChildren = root.GetComponentsInChildren(true); foreach (TimedDestruction val in componentsInChildren) { if (!((Object)(object)val == (Object)null)) { Object.Destroy((Object)(object)val); } } MonoBehaviour[] componentsInChildren2 = root.GetComponentsInChildren(true); foreach (MonoBehaviour val2 in componentsInChildren2) { if (!((Object)(object)val2 == (Object)null)) { Object.Destroy((Object)(object)val2); } } Light[] componentsInChildren3 = root.GetComponentsInChildren(true); foreach (Light val3 in componentsInChildren3) { if (!((Object)(object)val3 == (Object)null)) { ((Behaviour)val3).enabled = true; val3.intensity = Mathf.Max(val3.intensity, 1f); val3.range = Mathf.Max(val3.range, 2f); } } ParticleSystem[] componentsInChildren4 = root.GetComponentsInChildren(true); foreach (ParticleSystem val4 in componentsInChildren4) { MainModule main = val4.main; ((MainModule)(ref main)).loop = true; ((MainModule)(ref main)).stopAction = (ParticleSystemStopAction)0; if (!val4.isPlaying) { val4.Play(true); } } } private static void TintHierarchy(GameObject root, Color c) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002d: 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_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: 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_0204: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)root)) { return; } ParticleSystem[] componentsInChildren = root.GetComponentsInChildren(true); foreach (ParticleSystem val in componentsInChildren) { val.Stop(true, (ParticleSystemStopBehavior)0); MainModule main = val.main; ((MainModule)(ref main)).startColor = new MinMaxGradient(c); ColorOverLifetimeModule colorOverLifetime = val.colorOverLifetime; if (((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled) { Gradient val2 = new Gradient(); val2.SetKeys((GradientColorKey[])(object)new GradientColorKey[2] { new GradientColorKey(c, 0f), new GradientColorKey(c, 1f) }, (GradientAlphaKey[])(object)new GradientAlphaKey[2] { new GradientAlphaKey(c.a, 0f), new GradientAlphaKey(c.a, 1f) }); ((ColorOverLifetimeModule)(ref colorOverLifetime)).color = new MinMaxGradient(val2); } val.Play(true); } ParticleSystemRenderer[] componentsInChildren2 = root.GetComponentsInChildren(true); foreach (ParticleSystemRenderer val3 in componentsInChildren2) { Material[] materials = ((Renderer)val3).materials; Material[] array = materials; foreach (Material val4 in array) { if (!((Object)(object)val4 == (Object)null)) { SetCommonColorProps(val4, c); } } } TrailRenderer[] componentsInChildren3 = root.GetComponentsInChildren(true); foreach (TrailRenderer val5 in componentsInChildren3) { val5.startColor = c; val5.endColor = new Color(c.r, c.g, c.b, 0f); Material[] materials2 = ((Renderer)val5).materials; Material[] array2 = materials2; foreach (Material val6 in array2) { if (!((Object)(object)val6 == (Object)null)) { SetCommonColorProps(val6, c); } } } LineRenderer[] componentsInChildren4 = root.GetComponentsInChildren(true); foreach (LineRenderer val7 in componentsInChildren4) { val7.startColor = c; val7.endColor = c; Material[] materials3 = ((Renderer)val7).materials; Material[] array3 = materials3; foreach (Material val8 in array3) { if (!((Object)(object)val8 == (Object)null)) { SetCommonColorProps(val8, c); } } } } private static void SetCommonColorProps(Material m, Color c) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) if (m.HasProperty("_BaseColor")) { m.SetColor("_BaseColor", c); } if (m.HasProperty("_Color")) { m.SetColor("_Color", c); } if (m.HasProperty("_TintColor")) { m.SetColor("_TintColor", c); } if (m.HasProperty("_EmissionColor")) { m.SetColor("_EmissionColor", c); } } } private const string ZdoKeyActive = "naz_tank_agro"; private const string RpcName = "RPC_Warcry"; public static void Init(Harmony harmony) { Patch_Player_Awake_RegisterRpc_AndEnsureHolder(harmony); Patch_Player_OnSpawned_ReadZdoAndApply(harmony); Debug.Log((object)"[NazhikaCore] WarcryRPC.Init -> RPC Player + Sync + Holder listos"); } public static void ApplyFromStatus(Player player, bool active) { if (Object.op_Implicit((Object)(object)player)) { ZNetView component = ((Component)player).GetComponent(); if ((Object)(object)component != (Object)null && component.IsValid() && component.GetZDO() != null && component.IsOwner()) { component.GetZDO().Set("naz_tank_agro", active); Debug.Log((object)string.Format("[WarcryRPC] ApplyFromStatus → ZDO {0}={1} en {2} (owner). Enviando RPC...", "naz_tank_agro", active, player.GetPlayerName())); component.InvokeRPC(ZNetView.Everybody, "RPC_Warcry", new object[1] { active }); } else { Debug.Log((object)("[WarcryRPC] ApplyFromStatus → sin autoridad ZDO para " + ((player != null) ? player.GetPlayerName() : null) + " (no owner). Solo efecto local.")); } WarcryFXHolder.ApplyNow(player, active); } } private static void Patch_Player_Awake_RegisterRpc_AndEnsureHolder(Harmony harmony) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown MethodInfo methodInfo = AccessTools.Method(typeof(Player), "Awake", (Type[])null, (Type[])null); HarmonyMethod val = new HarmonyMethod(typeof(WarcryRPC), "Player_Awake_Postfix", (Type[])null); harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } private static void Player_Awake_Postfix(Player __instance) { ZNetView component = ((Component)__instance).GetComponent(); if (!((Object)(object)component != (Object)null) || !component.IsValid()) { return; } if ((Object)(object)((Component)__instance).GetComponent() == (Object)null) { ((Component)__instance).gameObject.AddComponent(); } component.Register("RPC_Warcry", (Action)delegate(long sender, bool active) { if (!((Object)(object)ZNet.instance != (Object)null) || !ZNet.instance.IsDedicated()) { Debug.Log((object)string.Format("[WarcryRPC] {0} recibido → active={1} para {2}", "RPC_Warcry", active, __instance.GetPlayerName())); WarcryFXHolder.ApplyNow(__instance, active); } }); } private static void Patch_Player_OnSpawned_ReadZdoAndApply(Harmony harmony) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown MethodInfo methodInfo = AccessTools.Method(typeof(Player), "OnSpawned", (Type[])null, (Type[])null); HarmonyMethod val = new HarmonyMethod(typeof(WarcryRPC), "Player_OnSpawned_Postfix", (Type[])null); harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } private static void Player_OnSpawned_Postfix(Player __instance) { ZNetView component = ((Component)__instance).GetComponent(); if ((Object)(object)component != (Object)null && component.IsValid() && component.GetZDO() != null) { bool @bool = component.GetZDO().GetBool("naz_tank_agro", false); Debug.Log((object)string.Format("[WarcryRPC] OnSpawned → estado ZDO({0})={1} en {2}", "naz_tank_agro", @bool, __instance.GetPlayerName())); WarcryFXHolder.ApplyNow(__instance, @bool); } } } } namespace NazhikaCore.UI { [HarmonyPatch] public static class OrbsUI { private static RectTransform _root; private static TextMeshProUGUI _kiText; private static TextMeshProUGUI[] _orbsText; private static bool _visible; private static int _currentOrbs = 0; private static int _maxOrbs = 4; private static int _currentKiHits = 0; private static float _atkSpeedBonus = 0f; public static void Init(Harmony harmony) { harmony.PatchAll(typeof(OrbsUI)); } public static void ShowOrbs(int current, int max = 4) { if (!((Object)(object)Player.m_localPlayer == (Object)null)) { _maxOrbs = Mathf.Max(1, max); _currentOrbs = Mathf.Clamp(current, 0, _maxOrbs); EnsureHudCreated(); _visible = true; if ((Object)(object)_root != (Object)null) { ((Component)_root).gameObject.SetActive(true); } RefreshOrbs(); } } public static void SetCurrentOrbs(int current) { _currentOrbs = Mathf.Clamp(current, 0, _maxOrbs); if ((Object)(object)_root != (Object)null && !((Component)_root).gameObject.activeSelf) { ((Component)_root).gameObject.SetActive(true); } _visible = true; RefreshOrbs(); } public static void SetKiHits(int hits) { _currentKiHits = Mathf.Max(0, hits); if ((Object)(object)_root != (Object)null && ((Component)_root).gameObject.activeSelf) { RefreshOrbs(); } } public static void SetAtkSpeedBonus(float bonus) { _atkSpeedBonus = Mathf.Max(0f, bonus); if ((Object)(object)_root != (Object)null && ((Component)_root).gameObject.activeSelf) { RefreshOrbs(); } } public static void HideOrbs() { _visible = false; _currentOrbs = 0; _currentKiHits = 0; _atkSpeedBonus = 0f; if ((Object)(object)_root != (Object)null) { ((Component)_root).gameObject.SetActive(false); } } [HarmonyPostfix] [HarmonyPatch(typeof(Hud), "Update")] private static void Hud_Update_Postfix(Hud __instance) { if (_visible && !((Object)(object)Player.m_localPlayer == (Object)null) && ((Behaviour)__instance).isActiveAndEnabled) { EnsureHudCreated(__instance); } } private static void EnsureHudCreated(Hud hudInstance = null) { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: 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_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Expected O, but got Unknown //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_024a: 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_02a7: Expected O, but got Unknown //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02fa: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_0339: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_root != (Object)null) { return; } if ((Object)(object)hudInstance == (Object)null) { hudInstance = Hud.instance; } if ((Object)(object)hudInstance == (Object)null) { return; } Transform val = ((Component)hudInstance).transform.Find("hudroot"); if (!Object.op_Implicit((Object)(object)val)) { Debug.LogError((object)"[OrbsUI] No se encontró hudroot"); return; } GameObject val2 = new GameObject("OrbsPanel", new Type[1] { typeof(RectTransform) }); val2.transform.SetParent(val, false); _root = val2.GetComponent(); _root.anchorMin = new Vector2(0.5f, 0.18f); _root.anchorMax = new Vector2(0.5f, 0.18f); _root.pivot = new Vector2(0.5f, 0.5f); _root.anchoredPosition = new Vector2(0f, 0f); _root.sizeDelta = new Vector2(260f, 90f); TMP_FontAsset val3 = ((IEnumerable)Resources.FindObjectsOfTypeAll()).FirstOrDefault((Func)((TMP_FontAsset f) => ((Object)f).name.Equals("Valheim-AveriaSansLibre", StringComparison.OrdinalIgnoreCase))); if ((Object)(object)_kiText == (Object)null) { GameObject val4 = new GameObject("KiText", new Type[1] { typeof(RectTransform) }); val4.transform.SetParent((Transform)(object)_root, false); _kiText = val4.AddComponent(); if ((Object)(object)val3 != (Object)null) { ((TMP_Text)_kiText).font = val3; } ((TMP_Text)_kiText).fontSize = 26f; ((TMP_Text)_kiText).alignment = (TextAlignmentOptions)514; ((Graphic)_kiText).color = new Color(1f, 0.9f, 0.5f, 1f); ((TMP_Text)_kiText).outlineWidth = 0f; RectTransform rectTransform = ((TMP_Text)_kiText).rectTransform; rectTransform.sizeDelta = new Vector2(260f, 40f); rectTransform.anchorMin = new Vector2(0.5f, 1f); rectTransform.anchorMax = new Vector2(0.5f, 1f); rectTransform.pivot = new Vector2(0.5f, 0f); rectTransform.anchoredPosition = new Vector2(0f, 30f); ((TMP_Text)_kiText).text = "Ki: x0\nVel ATK: +0%"; } int maxOrbs = _maxOrbs; _orbsText = (TextMeshProUGUI[])(object)new TextMeshProUGUI[maxOrbs]; for (int i = 0; i < maxOrbs; i++) { GameObject val5 = new GameObject("OrbText_" + i, new Type[1] { typeof(RectTransform) }); val5.transform.SetParent((Transform)(object)_root, false); RectTransform component = val5.GetComponent(); component.sizeDelta = new Vector2(45f, 45f); component.anchorMin = new Vector2(0.5f, 0.5f); component.anchorMax = new Vector2(0.5f, 0.5f); component.pivot = new Vector2(0.5f, 0.5f); float num = ((float)i - (float)(maxOrbs - 1) * 0.5f) * 46f; component.anchoredPosition = new Vector2(num, 0f); TextMeshProUGUI val6 = val5.AddComponent(); if ((Object)(object)val3 != (Object)null) { ((TMP_Text)val6).font = val3; } ((TMP_Text)val6).fontSize = 38f; ((TMP_Text)val6).alignment = (TextAlignmentOptions)514; ((TMP_Text)val6).outlineWidth = 0f; _orbsText[i] = val6; } ((Component)_root).gameObject.SetActive(false); RefreshOrbs(); } private static void RefreshOrbs() { //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) if (_orbsText == null) { return; } for (int i = 0; i < _orbsText.Length; i++) { TextMeshProUGUI val = _orbsText[i]; if (!((Object)(object)val == (Object)null)) { if (i < _currentOrbs) { ((TMP_Text)val).text = "\ud83c\udff5\ufe0f"; ((Graphic)val).color = new Color(1f, 0.98f, 0.5f, 1f); ((TMP_Text)val).outlineWidth = 0f; } else { ((TMP_Text)val).text = "⚪"; ((Graphic)val).color = new Color(1f, 1f, 1f, 0.25f); ((TMP_Text)val).outlineWidth = 0f; } } } if ((Object)(object)_kiText != (Object)null) { int num = Mathf.RoundToInt(_atkSpeedBonus * 100f); ((TMP_Text)_kiText).text = "Ki: x" + _currentKiHits + "\nVel ATK: +" + num + "%"; } } } public class PowerShotHUD : MonoBehaviour { private bool _visible; private float _hideAt = -1f; private float _firedStamina; private const float HIDE_DELAY = 2f; private const float PANEL_W = 400f; private const float PANEL_H = 36f; private const float MARGIN_BOTTOM = 80f; private const float DAMAGE_PCT = 0.8f; private GUIStyle _bgStyle; private GUIStyle _labelStyle; private bool _stylesReady; public static PowerShotHUD Instance { get; private set; } public static PowerShotHUD GetOrCreate() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown if ((Object)(object)Instance != (Object)null) { return Instance; } GameObject val = new GameObject("PowerShotHUD"); val.AddComponent(); return Instance; } 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); } private void OnDestroy() { if ((Object)(object)Instance == (Object)(object)this) { Instance = null; } } private void Update() { if (_visible && _hideAt > 0f && Time.time >= _hideAt) { Hide(); } } private void OnGUI() { //IL_0092: 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_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: 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_0113: Unknown result type (might be due to invalid IL or missing references) if (!_visible) { return; } EnsureStyles(); float num = ((_hideAt < 0f) ? ClassSkillsPatches.BowDrawTracker.StaminaDrained : _firedStamina); float num2 = num * 0.8f; float num3 = ((float)Screen.width - 400f) * 0.5f; float num4 = (float)Screen.height - 36f - 80f; float num5 = 1f; if (_hideAt > 0f) { float num6 = _hideAt - Time.time; if (num6 < 0.5f) { num5 = Mathf.Clamp01(num6 / 0.5f); } } Color color = GUI.color; GUI.color = new Color(1f, 1f, 1f, num5); GUI.Box(new Rect(num3, num4, 400f, 36f), GUIContent.none, _bgStyle); GUI.Label(new Rect(num3 + 8f, num4 + 8f, 384f, 20f), $"FOCUS SHOT | Stamina: {num:F1} | Daño extra: +{num2:F1}", _labelStyle); GUI.color = color; } public void UpdateDraw(float staminaDrained, float bonusDamage) { _visible = true; _hideAt = -1f; } public void OnFired(float staminaDrained, float bonusDamage) { _firedStamina = staminaDrained; _visible = true; _hideAt = Time.time + 2f; } public void Hide() { _visible = false; _hideAt = -1f; } private void EnsureStyles() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006f: 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_0093: Expected O, but got Unknown if (!_stylesReady) { GUIStyle val = new GUIStyle(GUI.skin.box); val.normal.background = MakeTex(2, 2, new Color(0.05f, 0.05f, 0.1f, 0.78f)); _bgStyle = val; GUIStyle val2 = new GUIStyle(GUI.skin.label) { fontSize = 13, fontStyle = (FontStyle)1, richText = true }; val2.normal.textColor = new Color(1f, 0.85f, 0.2f); _labelStyle = val2; _stylesReady = true; } } private static Texture2D MakeTex(int w, int h, Color col) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(w, h); Color[] array = (Color[])(object)new Color[w * h]; for (int i = 0; i < array.Length; i++) { array[i] = col; } val.SetPixels(array); val.Apply(); return val; } } [HarmonyPatch] public static class SkillsUI { private static RectTransform _slotRoot; private static Image _classIcon; private static Image _cooldownOverlay; private static TextMeshProUGUI _cooldownText; private static TextMeshProUGUI _skillNameText; private static float _cooldownEndTime; private static float _cooldownDuration; private static Sprite _lastIconSprite; public static bool IsOnCooldown => Time.time < _cooldownEndTime; public static void Init(Harmony harmony) { harmony.PatchAll(typeof(SkillsUI)); } public static void StartCooldown(float seconds) { //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Expected O, but got Unknown //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Expected O, but got Unknown //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_classIcon == (Object)null || (Object)(object)_classIcon.sprite == (Object)null || (Object)(object)_slotRoot == (Object)null || !((Component)_slotRoot).gameObject.activeSelf) { return; } if ((Object)(object)_cooldownOverlay == (Object)null) { GameObject val = new GameObject("CooldownOverlay", new Type[3] { typeof(RectTransform), typeof(CanvasRenderer), typeof(Image) }); val.transform.SetParent((Transform)(object)_slotRoot, false); _cooldownOverlay = val.GetComponent(); ((Graphic)_cooldownOverlay).rectTransform.sizeDelta = ((Graphic)_classIcon).rectTransform.sizeDelta; ((Graphic)_cooldownOverlay).rectTransform.anchoredPosition = Vector2.zero; _cooldownOverlay.sprite = _classIcon.sprite; _cooldownOverlay.preserveAspect = true; ((Graphic)_cooldownOverlay).raycastTarget = false; ((Graphic)_cooldownOverlay).color = new Color(0f, 0f, 0f, 0.6f); _cooldownOverlay.type = (Type)3; _cooldownOverlay.fillMethod = (FillMethod)4; _cooldownOverlay.fillOrigin = 2; _cooldownOverlay.fillClockwise = false; _cooldownOverlay.fillAmount = 0f; } ((Behaviour)_cooldownOverlay).enabled = true; _cooldownOverlay.sprite = _classIcon.sprite; ((Graphic)_cooldownOverlay).rectTransform.sizeDelta = ((Graphic)_classIcon).rectTransform.sizeDelta; if ((Object)(object)_cooldownText == (Object)null) { GameObject val2 = new GameObject("CooldownText", new Type[1] { typeof(RectTransform) }); val2.transform.SetParent((Transform)(object)_slotRoot, false); _cooldownText = val2.AddComponent(); TMP_FontAsset val3 = ((IEnumerable)Resources.FindObjectsOfTypeAll()).FirstOrDefault((Func)((TMP_FontAsset f) => ((Object)f).name.Equals("Valheim-AveriaSansLibre", StringComparison.OrdinalIgnoreCase))); if ((Object)(object)val3 != (Object)null) { ((TMP_Text)_cooldownText).font = val3; } ((TMP_Text)_cooldownText).fontSize = 16f; ((TMP_Text)_cooldownText).alignment = (TextAlignmentOptions)514; ((Graphic)_cooldownText).color = new Color(1f, 0.7176f, 0.3603f, 1f); ((TMP_Text)_cooldownText).text = ""; RectTransform rectTransform = ((TMP_Text)_cooldownText).rectTransform; rectTransform.sizeDelta = new Vector2(70f, 25.49f); rectTransform.anchorMin = new Vector2(0.5f, 1f); rectTransform.anchorMax = new Vector2(0.5f, 1f); rectTransform.pivot = new Vector2(0.5f, 0.5f); rectTransform.anchoredPosition = new Vector2(0f, -59.5f); } ((Behaviour)_cooldownText).enabled = true; _cooldownDuration = seconds; _cooldownEndTime = Time.time + seconds; } public static void ForceClearAndHide() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) _cooldownEndTime = 0f; _cooldownDuration = 0f; _lastIconSprite = null; if ((Object)(object)_classIcon != (Object)null) { _classIcon.sprite = null; ((Graphic)_classIcon).color = Color.white; } if ((Object)(object)_cooldownOverlay != (Object)null) { _cooldownOverlay.fillAmount = 0f; ((Behaviour)_cooldownOverlay).enabled = false; } if ((Object)(object)_cooldownText != (Object)null) { ((TMP_Text)_cooldownText).text = ""; ((Behaviour)_cooldownText).enabled = false; } if ((Object)(object)_skillNameText != (Object)null) { ((TMP_Text)_skillNameText).text = ""; ((Behaviour)_skillNameText).enabled = false; } if ((Object)(object)_slotRoot != (Object)null) { ((Component)_slotRoot).gameObject.SetActive(false); } } [HarmonyPostfix] [HarmonyPatch(typeof(Hud), "Update")] private static void Hud_Update_Postfix(Hud __instance) { //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Expected O, but got Unknown //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_018d: 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_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_04b4: Unknown result type (might be due to invalid IL or missing references) //IL_0400: Unknown result type (might be due to invalid IL or missing references) //IL_03b9: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Player.m_localPlayer == (Object)null || !((Behaviour)__instance).isActiveAndEnabled) { return; } Transform val = ((Component)__instance).transform.Find("hudroot/GuardianPower/Bkg"); if ((Object)(object)val == (Object)null) { Debug.LogError((object)"[SkillsUI] No se encontró hudroot/GuardianPower/Bkg"); return; } Image component = ((Component)val).GetComponent(); Sprite bkgSprite = ((component != null) ? component.sprite : null); if ((Object)(object)_slotRoot == (Object)null) { GameObject val2 = new GameObject("CustomSkillSlot", new Type[1] { typeof(RectTransform) }); val2.transform.SetParent(val.parent, false); _slotRoot = val2.GetComponent(); RectTransform component2 = ((Component)val).GetComponent(); _slotRoot.anchorMin = component2.anchorMin; _slotRoot.anchorMax = component2.anchorMax; _slotRoot.pivot = component2.pivot; _slotRoot.anchoredPosition = component2.anchoredPosition + new Vector2(60f, 0f); _slotRoot.sizeDelta = component2.sizeDelta; GameObject val3 = new GameObject("ClassIcon", new Type[3] { typeof(RectTransform), typeof(CanvasRenderer), typeof(Image) }); val3.transform.SetParent((Transform)(object)_slotRoot, false); _classIcon = val3.GetComponent(); ((Graphic)_classIcon).rectTransform.sizeDelta = new Vector2(72f, 72f); ((Graphic)_classIcon).rectTransform.anchoredPosition = Vector2.zero; _classIcon.type = (Type)0; ((Graphic)_classIcon).color = Color.white; CreateSkillNameText(); ScrubFrames(bkgSprite); Debug.Log((object)"[SkillsUI] Slot sin marco creado."); } Player localPlayer = Player.m_localPlayer; PlayerClassBase @class = ClassManager.GetClass(localPlayer); string savedKey = ClassManager.GetSavedKey(localPlayer); Sprite val4 = @class?.ClassIcon; if ((Object)(object)val4 == (Object)null || string.IsNullOrEmpty(savedKey)) { ForceClearAndHide(); ScrubFrames(bkgSprite); return; } if ((Object)(object)_slotRoot != (Object)null && !((Component)_slotRoot).gameObject.activeSelf) { ((Component)_slotRoot).gameObject.SetActive(true); } if ((Object)(object)_classIcon != (Object)null && (Object)(object)val4 != (Object)(object)_lastIconSprite) { _classIcon.sprite = val4; _lastIconSprite = val4; if ((Object)(object)_cooldownOverlay != (Object)null) { _cooldownOverlay.sprite = val4; _cooldownOverlay.preserveAspect = true; ((Graphic)_cooldownOverlay).rectTransform.sizeDelta = ((Graphic)_classIcon).rectTransform.sizeDelta; } } if (!IsOnCooldown && (Object)(object)_classIcon != (Object)null) { ((Graphic)_classIcon).color = Color.white; } if ((Object)(object)_skillNameText != (Object)null) { string skillNameForKey = GetSkillNameForKey(savedKey); ((TMP_Text)_skillNameText).text = skillNameForKey; ((Behaviour)_skillNameText).enabled = !string.IsNullOrEmpty(skillNameForKey); } ScrubFrames(bkgSprite); if (!((Object)(object)_slotRoot != (Object)null) || !((Component)_slotRoot).gameObject.activeSelf) { return; } float num = _cooldownEndTime - Time.time; if (num > 0f && _cooldownDuration > 0f) { if ((Object)(object)_cooldownOverlay != (Object)null) { ((Behaviour)_cooldownOverlay).enabled = true; if ((Object)(object)_classIcon != (Object)null) { if ((Object)(object)_cooldownOverlay.sprite != (Object)(object)_classIcon.sprite) { _cooldownOverlay.sprite = _classIcon.sprite; } ((Graphic)_cooldownOverlay).rectTransform.sizeDelta = ((Graphic)_classIcon).rectTransform.sizeDelta; } _cooldownOverlay.fillAmount = Mathf.Clamp01(num / _cooldownDuration); } if ((Object)(object)_classIcon != (Object)null) { ((Graphic)_classIcon).color = new Color(1f, 1f, 1f, 0.4f); } if ((Object)(object)_cooldownText != (Object)null) { ((Behaviour)_cooldownText).enabled = true; ((TMP_Text)_cooldownText).text = Mathf.CeilToInt(num).ToString(); } } else { _cooldownEndTime = 0f; _cooldownDuration = 0f; if ((Object)(object)_cooldownOverlay != (Object)null) { _cooldownOverlay.fillAmount = 0f; ((Behaviour)_cooldownOverlay).enabled = false; } if ((Object)(object)_cooldownText != (Object)null) { ((TMP_Text)_cooldownText).text = ""; ((Behaviour)_cooldownText).enabled = false; } if ((Object)(object)_classIcon != (Object)null) { ((Graphic)_classIcon).color = Color.white; } ScrubFrames(bkgSprite); } } private static void ScrubFrames(Sprite bkgSprite) { //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_slotRoot == (Object)null) { return; } Image[] componentsInChildren = ((Component)_slotRoot).GetComponentsInChildren(true); Image[] array = componentsInChildren; foreach (Image val in array) { if ((Object)(object)val == (Object)(object)_classIcon || (Object)(object)val == (Object)(object)_cooldownOverlay) { continue; } bool flag = ((Object)((Component)val).gameObject).name.Equals("Bkg"); bool flag2 = (Object)(object)bkgSprite != (Object)null && (Object)(object)val.sprite == (Object)(object)bkgSprite; if (flag || flag2) { Object.Destroy((Object)(object)((Component)val).gameObject); continue; } if (((Behaviour)val).enabled) { ((Behaviour)val).enabled = false; } Color color = ((Graphic)val).color; ((Graphic)val).color = new Color(color.r, color.g, color.b, 0f); } Image component = ((Component)_slotRoot).GetComponent(); if (Object.op_Implicit((Object)(object)component) && ((Behaviour)component).enabled) { if ((Object)(object)bkgSprite != (Object)null && (Object)(object)component.sprite == (Object)(object)bkgSprite) { Object.Destroy((Object)(object)component); } else { ((Behaviour)component).enabled = false; } } } private static void CreateSkillNameText() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: 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) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_slotRoot == (Object)null) && !((Object)(object)_skillNameText != (Object)null)) { GameObject val = new GameObject("SkillNameText", new Type[1] { typeof(RectTransform) }); val.transform.SetParent((Transform)(object)_slotRoot, false); _skillNameText = val.AddComponent(); TMP_FontAsset val2 = ((IEnumerable)Resources.FindObjectsOfTypeAll()).FirstOrDefault((Func)((TMP_FontAsset f) => ((Object)f).name.Equals("Valheim-AveriaSansLibre", StringComparison.OrdinalIgnoreCase))); if ((Object)(object)val2 != (Object)null) { ((TMP_Text)_skillNameText).font = val2; } ((TMP_Text)_skillNameText).fontSize = 16f; ((TMP_Text)_skillNameText).alignment = (TextAlignmentOptions)514; ((Graphic)_skillNameText).color = new Color(1f, 0.85f, 0.6f, 1f); RectTransform rectTransform = ((TMP_Text)_skillNameText).rectTransform; rectTransform.sizeDelta = new Vector2(120f, 24f); rectTransform.anchorMin = new Vector2(0.5f, 0.5f); rectTransform.anchorMax = new Vector2(0.5f, 0.5f); rectTransform.pivot = new Vector2(0.5f, 0.5f); rectTransform.anchoredPosition = new Vector2(0f, 50f); ((TMP_Text)_skillNameText).text = ""; ((Behaviour)_skillNameText).enabled = false; } } private static string GetSkillNameForKey(string key) { if (string.IsNullOrEmpty(key)) { return string.Empty; } return key switch { "Tank" => "Skjöld", "Berserker" => "Aeternum", "Sword" => "Seiðr", "Lancer" => "Cruentum", "Arquero" => "Skot", "Monk" => "Chi-Release", _ => string.Empty, }; } } } namespace NazhikaCore.Patches { public static class AdrenalinePatch { public static void Init(Harmony harmony) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown MethodInfo methodInfo = AccessTools.Method(typeof(Player), "AddAdrenaline", new Type[1] { typeof(float) }, (Type[])null); HarmonyMethod val = new HarmonyMethod(typeof(AdrenalinePatch), "AddAdrenaline_Prefix", (Type[])null); if (methodInfo == null) { Debug.LogError((object)"[NazhikaCore] AdrenalinePatch: NO se encontró Player.AddAdrenaline(float). Patch NO aplicado."); return; } harmony.Patch((MethodBase)methodInfo, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Debug.Log((object)"[NazhikaCore] AdrenalinePatch: parche aplicado correctamente (ganancia x2)."); } private static void AddAdrenaline_Prefix(ref float v) { float num = v; v *= 1.5f; float num2 = v; } } public class ArcherCritPatches { private const float CritChancePerBowLevel = 0.008f; private const float CritDamageMultiplier = 1.5f; private static bool s_initialized; public static void Init(Harmony harmony) { if (!s_initialized) { s_initialized = true; harmony.PatchAll(typeof(ArcherCritPatches)); Debug.Log((object)"[NazhikaCore] ArcherCritPatches initialized."); } } [HarmonyPatch(typeof(Projectile), "OnHit")] [HarmonyPrefix] private static void Prefix_OnHit(Projectile __instance, Collider collider, Vector3 hitPoint, bool water, Vector3 normal) { if ((Object)(object)__instance == (Object)null || !__instance.m_nview.IsOwner()) { return; } Character owner = __instance.m_owner; Player val = (Player)(object)((owner is Player) ? owner : null); if ((Object)(object)val == (Object)null || !val.IsClass()) { return; } ItemData weapon = __instance.m_weapon; if (weapon == null || !weapon.m_shared.m_attack.m_bowDraw || __instance.m_didHit) { return; } float skillLevel = ((Character)val).GetSkillLevel((SkillType)8); float num = skillLevel * 0.008f; if (!(Random.value > num)) { float pierce = __instance.m_damage.m_pierce; ((DamageTypes)(ref __instance.m_damage)).Modify(1.5f); float pierce2 = __instance.m_damage.m_pierce; float num2 = pierce2 - pierce; if ((Object)(object)val == (Object)(object)Player.m_localPlayer) { int num3 = Mathf.RoundToInt(num * 100f); ((Character)val).Message((MessageType)2, $"⚡ CRÍTICO! ({num3}% chance)", 0, (Sprite)null); } Debug.Log((object)"[ArcherCrit] ===== CRÍTICO ====="); Debug.Log((object)("[ArcherCrit] Jugador : " + val.GetPlayerName())); Debug.Log((object)$"[ArcherCrit] Bow Lv : {skillLevel}"); Debug.Log((object)$"[ArcherCrit] Chance : {num * 100f:F1}%"); Debug.Log((object)$"[ArcherCrit] Daño PreCrit : {pierce:F2}"); Debug.Log((object)$"[ArcherCrit] Mult Crítico : x{1.5f}"); Debug.Log((object)$"[ArcherCrit] Bonus Crit : +{num2:F2}"); Debug.Log((object)$"[ArcherCrit] Daño Final : {pierce2:F2}"); Debug.Log((object)"[ArcherCrit] =================="); } } } public static class BalanceConfig { private const string LOG = "[NazhikaCore/BalanceConfig]"; private const string SEC_SWORD = "1 - Espadas"; private const string SEC_BOW = "2 - Arco (Power Shot)"; private const string SEC_WARCRY = "3 - War Cry"; private const string SEC_TANK = "4 - Tank Pasiva"; private const string SEC_SPEAR = "5 - Lanza (SpearStacks)"; private const string SEC_BLEED = "6 - Bleeding"; private const string SEC_BURST = "7 - BloodBurst"; private const string SEC_BERSERK = "8 - Berserker Burst"; private const string SEC_PASSIVE = "9 - Pasiva Velocidad de Ataque"; private const string SEC_ORB = "10 - Orb Gauge (Ki)"; private static ConfigEntry _swordPoison; private static ConfigEntry _swordLightning; private static ConfigEntry _powerShotStaminaToDmg; private static ConfigEntry _warCryPhysReduce; private static ConfigEntry _warCryElemReduce; private static ConfigEntry _tankPassiveMaxReduce; private static ConfigEntry _spearPiercePerStack; private static ConfigEntry _spearAtkSpeedPerStack; private static ConfigEntry _bleedFractionPerStack; private static ConfigEntry _bleedTickInterval; private static ConfigEntry _bleedMaxStacks; private static ConfigEntry _bleedFixedT0; private static ConfigEntry _bleedFixedT1; private static ConfigEntry _bleedFixedT2; private static ConfigEntry _bleedFixedT3; private static ConfigEntry _bleedFixedT4; private static ConfigEntry _bleedFixedT5; private static ConfigEntry _bleedFixedT6; private static ConfigEntry _bleedFixedT7; private static ConfigEntry _bleedFixedT8; private static ConfigEntry _burstMaxPercent; private static ConfigEntry _burstBaseHpCap; private static ConfigEntry _burstMaxStacks; private static ConfigEntry _berserkDamageMult; private static ConfigEntry _berserkAtkSpeedMult; private static ConfigEntry _passiveAtkSpeedBonus; private static ConfigEntry _orbAtkSpeedPerKi; public static float SwordPoisonBonusPct => _swordPoison?.Value ?? 0.5f; public static float SwordLightningBonusPct => _swordLightning?.Value ?? 0.5f; public static float PowerShotStaminaToDmgPct => _powerShotStaminaToDmg?.Value ?? 0.8f; public static float WarCryPhysReducePct => _warCryPhysReduce?.Value ?? 0.7f; public static float WarCryElemReducePct => _warCryElemReduce?.Value ?? 0.7f; public static float TankPassiveMaxReducePct => _tankPassiveMaxReduce?.Value ?? 0.2f; public static float SpearPiercePerStack => _spearPiercePerStack?.Value ?? 0.7f; public static float SpearAtkSpeedPerStack => _spearAtkSpeedPerStack?.Value ?? 0.2f; public static float BleedFractionPerStack => _bleedFractionPerStack?.Value ?? 0.005f; public static float BleedTickInterval => _bleedTickInterval?.Value ?? 1f; public static int BleedMaxStacks => _bleedMaxStacks?.Value ?? 7; public static float BleedFixedT0 => _bleedFixedT0?.Value ?? 2f; public static float BleedFixedT1 => _bleedFixedT1?.Value ?? 4f; public static float BleedFixedT2 => _bleedFixedT2?.Value ?? 7f; public static float BleedFixedT3 => _bleedFixedT3?.Value ?? 12f; public static float BleedFixedT4 => _bleedFixedT4?.Value ?? 20f; public static float BleedFixedT5 => _bleedFixedT5?.Value ?? 30f; public static float BleedFixedT6 => _bleedFixedT6?.Value ?? 70f; public static float BleedFixedT7 => _bleedFixedT7?.Value ?? 90f; public static float BleedFixedT8 => _bleedFixedT8?.Value ?? 150f; public static float BurstMaxPercent => _burstMaxPercent?.Value ?? 0.1f; public static float BurstBaseHpCap => _burstBaseHpCap?.Value ?? 10000f; public static int BurstMaxStacks => _burstMaxStacks?.Value ?? 7; public static float BerserkDamageMult => _berserkDamageMult?.Value ?? 1.9f; public static float BerserkAtkSpeedMult => _berserkAtkSpeedMult?.Value ?? 1.6f; public static float PassiveAtkSpeedBonus => _passiveAtkSpeedBonus?.Value ?? 1.2f; public static float OrbAtkSpeedPerKi => _orbAtkSpeedPerKi?.Value ?? 0.035f; public static void Init(ConfigFile cfg) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Expected O, but got Unknown //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Expected O, but got Unknown //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Expected O, but got Unknown //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Expected O, but got Unknown //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Expected O, but got Unknown //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Expected O, but got Unknown //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Expected O, but got Unknown //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Expected O, but got Unknown //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Expected O, but got Unknown //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Expected O, but got Unknown //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Expected O, but got Unknown //IL_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Expected O, but got Unknown //IL_032e: Unknown result type (might be due to invalid IL or missing references) //IL_0338: Expected O, but got Unknown //IL_0366: Unknown result type (might be due to invalid IL or missing references) //IL_0370: Expected O, but got Unknown //IL_039e: Unknown result type (might be due to invalid IL or missing references) //IL_03a8: Expected O, but got Unknown //IL_03d6: Unknown result type (might be due to invalid IL or missing references) //IL_03e0: Expected O, but got Unknown //IL_040e: Unknown result type (might be due to invalid IL or missing references) //IL_0418: Expected O, but got Unknown //IL_0446: Unknown result type (might be due to invalid IL or missing references) //IL_0450: Expected O, but got Unknown //IL_047e: Unknown result type (might be due to invalid IL or missing references) //IL_0488: Expected O, but got Unknown //IL_04b6: Unknown result type (might be due to invalid IL or missing references) //IL_04c0: Expected O, but got Unknown //IL_04e3: Unknown result type (might be due to invalid IL or missing references) //IL_04ed: Expected O, but got Unknown //IL_051b: Unknown result type (might be due to invalid IL or missing references) //IL_0525: Expected O, but got Unknown //IL_0553: Unknown result type (might be due to invalid IL or missing references) //IL_055d: Expected O, but got Unknown //IL_058b: Unknown result type (might be due to invalid IL or missing references) //IL_0595: Expected O, but got Unknown //IL_05c3: Unknown result type (might be due to invalid IL or missing references) //IL_05cd: Expected O, but got Unknown _swordPoison = cfg.Bind("1 - Espadas", "Poison Bonus %", 0.5f, new ConfigDescription("Porcentaje del daño físico base añadido como veneno (SE_SwordPoison).\n0.50 = +50% del daño físico como veneno.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 5f), Array.Empty())); _swordLightning = cfg.Bind("1 - Espadas", "Lightning Bonus %", 0.5f, new ConfigDescription("Porcentaje del daño físico base añadido como rayo (SE_SwordLightning).\n0.50 = +50% del daño físico como rayo.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 5f), Array.Empty())); _powerShotStaminaToDmg = cfg.Bind("2 - Arco (Power Shot)", "Stamina to Damage %", 0.8f, new ConfigDescription("Fracción de la stamina gastada que se convierte en daño pierce extra (Power Shot).", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 5f), Array.Empty())); _warCryPhysReduce = cfg.Bind("3 - War Cry", "Physical Reduction %", 0.7f, new ConfigDescription("Reducción del daño físico recibido con SE_Warcry activo.\n0.70 = recibe solo el 30%.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); _warCryElemReduce = cfg.Bind("3 - War Cry", "Elemental Reduction %", 0.7f, new ConfigDescription("Reducción del daño elemental recibido con SE_Warcry activo.\n0.70 = recibe solo el 30%.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); _tankPassiveMaxReduce = cfg.Bind("4 - Tank Pasiva", "Max Reduction % at Block 100", 0.2f, new ConfigDescription("Reducción máxima de daño al tener Blocking nivel 100.\nReduccion = MaxReduce * (BlockSkill / 100).", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); _spearPiercePerStack = cfg.Bind("5 - Lanza (SpearStacks)", "Pierce Damage Per Stack", 0.7f, new ConfigDescription("Multiplicador de daño perforante por stack de SE_SpearStacks.\n0.70 = +70% de daño pierce por stack.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 5f), Array.Empty())); _spearAtkSpeedPerStack = cfg.Bind("5 - Lanza (SpearStacks)", "Attack Speed Per Stack", 0.2f, new ConfigDescription("Bonus de velocidad de ataque por stack de SE_SpearStacks.\n0.20 = +20% de velocidad por stack.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 2f), Array.Empty())); _bleedFractionPerStack = cfg.Bind("6 - Bleeding", "Fraction Per Stack On Base", 0.005f, new ConfigDescription("Fraccion del HP base que se suma al daño por tick por stack.\n0.005 = 0.5% del HP base por stack.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 0.1f), Array.Empty())); _bleedTickInterval = cfg.Bind("6 - Bleeding", "Tick Interval", 1f, new ConfigDescription("Segundos entre cada tick de daño de bleeding.", (AcceptableValueBase)(object)new AcceptableValueRange(0.1f, 10f), Array.Empty())); _bleedMaxStacks = cfg.Bind("6 - Bleeding", "Max Stacks", 7, new ConfigDescription("Maximo de stacks de bleeding aplicables.", (AcceptableValueBase)(object)new AcceptableValueRange(1, 20), Array.Empty())); _bleedFixedT0 = cfg.Bind("6 - Bleeding", "Fixed Base Tier 0 Fodder", 2f, new ConfigDescription("Daño fijo base para tier 0 (Fodder, HP < 60).", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1000f), Array.Empty())); _bleedFixedT1 = cfg.Bind("6 - Bleeding", "Fixed Base Tier 1 Trash", 4f, new ConfigDescription("Daño fijo base para tier 1 (Trash, HP < 180).", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1000f), Array.Empty())); _bleedFixedT2 = cfg.Bind("6 - Bleeding", "Fixed Base Tier 2 Elite", 7f, new ConfigDescription("Daño fijo base para tier 2 (Elite, HP < 450).", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1000f), Array.Empty())); _bleedFixedT3 = cfg.Bind("6 - Bleeding", "Fixed Base Tier 3 Brute", 12f, new ConfigDescription("Daño fijo base para tier 3 (Brute, HP < 1500).", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1000f), Array.Empty())); _bleedFixedT4 = cfg.Bind("6 - Bleeding", "Fixed Base Tier 4 Strong", 20f, new ConfigDescription("Daño fijo base para tier 4 (Strong, HP < 3000).", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 5000f), Array.Empty())); _bleedFixedT5 = cfg.Bind("6 - Bleeding", "Fixed Base Tier 5 Colossal", 30f, new ConfigDescription("Daño fijo base para tier 5 (Colossal, HP < 5000).", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 5000f), Array.Empty())); _bleedFixedT6 = cfg.Bind("6 - Bleeding", "Fixed Base Tier 6 Titan", 70f, new ConfigDescription("Daño fijo base para tier 6 (Titan, HP < 10000).", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 5000f), Array.Empty())); _bleedFixedT7 = cfg.Bind("6 - Bleeding", "Fixed Base Tier 7 Mythic", 90f, new ConfigDescription("Daño fijo base para tier 7 (Mythic, HP < 50000).", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 5000f), Array.Empty())); _bleedFixedT8 = cfg.Bind("6 - Bleeding", "Fixed Base Tier 8 God", 150f, new ConfigDescription("Daño fijo base para tier 8 (God, HP >= 50000).", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 5000f), Array.Empty())); _burstMaxPercent = cfg.Bind("7 - BloodBurst", "Max Burst Percent", 0.1f, new ConfigDescription("Porcentaje maximo del HP base que hace el burst a stacks maximos.\n0.10 = 10% del HP base a 7 stacks.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); _burstBaseHpCap = cfg.Bind("7 - BloodBurst", "Base HP Cap", 10000f, new ConfigDescription("Cap del HP base para bosses Mythic y God.\nEvita que el burst escale infinito con bosses enormes.", (AcceptableValueBase)(object)new AcceptableValueRange(1000f, 100000f), Array.Empty())); _burstMaxStacks = cfg.Bind("7 - BloodBurst", "Max Bleed Stacks", 7, new ConfigDescription("Maximo de stacks de bleeding que considera el burst para escalar el daño.", (AcceptableValueBase)(object)new AcceptableValueRange(1, 20), Array.Empty())); _berserkDamageMult = cfg.Bind("8 - Berserker Burst", "Damage Multiplier", 1.9f, new ConfigDescription("Multiplicador de daño mientras SE_BerserkBurst esta activo.\n1.90 = +90% de daño.", (AcceptableValueBase)(object)new AcceptableValueRange(1f, 10f), Array.Empty())); _berserkAtkSpeedMult = cfg.Bind("8 - Berserker Burst", "Attack Speed Multiplier", 1.8f, new ConfigDescription("Multiplicador de velocidad de ataque durante SE_BerserkBurst.\n1.60 = +60% de velocidad de ataque.", (AcceptableValueBase)(object)new AcceptableValueRange(1f, 5f), Array.Empty())); _passiveAtkSpeedBonus = cfg.Bind("9 - Pasiva Velocidad de Ataque", "Attack Speed Multiplier", 1.2f, new ConfigDescription("Multiplicador de velocidad de animación aplicado por SE_PassiveAtkSpeed durante un ataque.\n1.20 = +20% de velocidad de ataque.\nRango válido: 1.0 (sin bonus) – 5.0 (x5 velocidad).", (AcceptableValueBase)(object)new AcceptableValueRange(1f, 5f), Array.Empty())); _orbAtkSpeedPerKi = cfg.Bind("10 - Orb Gauge (Ki)", "Attack Speed Per Ki Hit", 0.035f, new ConfigDescription("Bonus de velocidad de ataque por cada Ki acumulado (SE_OrbGauge).\n0.035 = +3.5% por hit. Con 16 Ki maximo: +56% total.\nRango válido: 0.0 – 0.2.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 0.2f), Array.Empty())); Debug.Log((object)("[NazhikaCore/BalanceConfig] Registrado en ConfigurationManager. Archivo: " + cfg.ConfigFilePath)); } } [HarmonyPatch] public static class BerserkerPatches { private class UI { public GameObject root; public Image darken; public GuiBar fast; public GuiBar slow; public TMP_Text valueText; public float lastHitTime; } [HarmonyPatch(typeof(Character), "Damage")] public static class Berserker_FuryDamagePatch { private const float DamagePerFuryPercent = 0.0065f; private static float _nextMsg; private static void Prefix(Character __instance, ref HitData hit) { if (hit == null) { return; } Character attacker = hit.GetAttacker(); Player val = (Player)(object)((attacker is Player) ? attacker : null); if ((Object)(object)val == (Object)null || !ClassApi.HasClass(val, "Berserker")) { return; } SEMan sEMan = ((Character)val).GetSEMan(); if (sEMan == null) { return; } bool flag = (Object)(object)sEMan.GetStatusEffect(SE_BerserkBurst.NameHash) != (Object)null; float num = 1f; if (flag) { num *= SE_BerserkBurst.DamageMult; } else { ZNetView nview = ((Character)val).m_nview; float? obj; if (nview == null) { obj = null; } else { ZDO zDO = nview.GetZDO(); obj = ((zDO != null) ? new float?(zDO.GetFloat("naz_fury", 0f)) : null); } float? num2 = obj; float valueOrDefault = num2.GetValueOrDefault(); if (valueOrDefault <= 0f) { return; } num *= 1f + valueOrDefault * 0.0065f; } if (Mathf.Abs(num - 1f) < 0.0001f) { return; } ((DamageTypes)(ref hit.m_damage)).Modify(num); if ((Object)(object)val == (Object)(object)Player.m_localPlayer && Time.time >= _nextMsg) { _nextMsg = Time.time + 0.5f; if (flag) { ((Character)val).Message((MessageType)1, $"\ud83d\udd25 Burst: x{num:0.00} daño", 0, (Sprite)null); } else { ((Character)val).Message((MessageType)1, $"\ud83d\udd25 Fury: +{(num - 1f) * 100f:0.#}% daño", 0, (Sprite)null); } } } } private const float MaxFury = 100f; private const float FuryPerHit = 10f; private const float DecayDelay = 6f; private const float DecayPerSecond = 10f; private const float GodCooldownSeconds = 80f; private const string GodCdZdoKey = "naz_bg_cd_until"; private const float UiCooldownSeconds = 80f; private const string FuryKey = "naz_fury"; private const float BarWidth = 250f; private static readonly Vector3 BarLocalPos = new Vector3(-130f, -430f, 0f); private const float BarHeight = 28f; private static readonly Color FastColor = new Color(0.74f, 0f, 0f, 1f); private static readonly Color SlowColor = new Color(0.35f, 0.35f, 0.35f, 1f); private const bool LogDebugGod = true; private static readonly Dictionary Bars = new Dictionary(); public static void Init(Harmony h) { Patch_Warcry_HudUpdate(h); Patch_FuryGain_OnDamage(h); Patch_BerserkerGod_Damage(h); Patch_BurstDamage(h); Log.Info("[NazhikaCore] BerserkerPatches (Fury + God) activo."); } private static void Patch_Warcry_HudUpdate(Harmony h) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown h.Patch((MethodBase)AccessTools.Method(typeof(Hud), "Update", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(BerserkerPatches), "Hud_Update_Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } private static void Patch_FuryGain_OnDamage(Harmony h) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown h.Patch((MethodBase)AccessTools.Method(typeof(Character), "Damage", (Type[])null, (Type[])null), new HarmonyMethod(typeof(BerserkerPatches), "Character_Damage_Prefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } private static void Patch_BerserkerGod_Damage(Harmony h) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown h.Patch((MethodBase)AccessTools.Method(typeof(Character), "Damage", (Type[])null, (Type[])null), new HarmonyMethod(typeof(BerserkerPatches), "Damage_Prefix_God", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } private static void Patch_BurstDamage(Harmony h) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown h.Patch((MethodBase)AccessTools.Method(typeof(Character), "Damage", (Type[])null, (Type[])null), new HarmonyMethod(typeof(Berserker_FuryDamagePatch).GetMethod("Prefix", BindingFlags.Static | BindingFlags.NonPublic)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } private static void Hud_Update_Postfix() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if (!Object.op_Implicit((Object)(object)localPlayer) || !ClassApi.HasClass(localPlayer, "Berserker") || !TryId((Character)(object)localPlayer, out var id) || !Bars.TryGetValue(id, out var value) || value == null) { return; } if (HasStatus((Character)(object)localPlayer, SE_BerserkBurst.NameHash)) { if ((Object)(object)value.fast != (Object)null) { value.fast.m_value = 0f; } if ((Object)(object)value.valueText != (Object)null) { value.valueText.text = string.Empty; } if ((Object)(object)value.slow != (Object)null) { value.slow.m_value = 100f; } if (Object.op_Implicit((Object)(object)value.root)) { value.root.SetActive(false); } return; } float deltaTime = Time.deltaTime; if ((Object)(object)value.fast != (Object)null && value.fast.m_value > 0f && Time.time - value.lastHitTime > 6f) { float value2 = value.fast.m_value; float num = value2 - 10f * deltaTime; if (num < 0f) { num = 0f; } value.fast.m_value = num; SetFury((Character)(object)localPlayer, num); if ((Object)(object)value.valueText != (Object)null) { value.valueText.text = ((num > 0f) ? Mathf.CeilToInt(num).ToString() : string.Empty); } if (num <= 0f && Object.op_Implicit((Object)(object)value.root)) { value.root.SetActive(false); } } } private static void Character_Damage_Prefix(Character __instance, ref HitData hit) { if (hit == null) { return; } Character val = SafeGetAttacker(hit); Player localPlayer = Player.m_localPlayer; if (!((Object)(object)localPlayer == (Object)null) && !((Object)(object)val == (Object)null) && ClassApi.HasClass(localPlayer, "Berserker") && Same(val, (Character)(object)localPlayer) && HasStatus((Character)(object)localPlayer, SE_Berserkfury.NameHash) && !HasStatus((Character)(object)localPlayer, SE_BerserkBurst.NameHash) && !HasStatus((Character)(object)localPlayer, SE_BerserkerGod.NameHash)) { ZDO val2 = (((Object)(object)((Character)localPlayer).m_nview != (Object)null) ? ((Character)localPlayer).m_nview.GetZDO() : null); if (val2 == null || !val2.GetBool("naz_fury_block", false)) { AddFury(val, GetName(val), 10f); } } } private static void Damage_Prefix_God(Character __instance, ref HitData hit) { Player val = (Player)(object)((__instance is Player) ? __instance : null); if ((Object)(object)val == (Object)null || hit == null || !ClassApi.HasClass(val, "Berserker")) { return; } SEMan sEMan = ((Character)val).GetSEMan(); if (sEMan == null) { return; } if (HasStatus((Character)(object)val, SE_BerserkerGod.NameHash)) { ZeroDamage(ref hit.m_damage); return; } float num = hit.m_damage.m_blunt + hit.m_damage.m_pierce + hit.m_damage.m_slash; float num2 = hit.m_damage.m_fire + hit.m_damage.m_frost + hit.m_damage.m_poison + hit.m_damage.m_lightning + hit.m_damage.m_spirit; float num3 = hit.GetTotalDamage(); if (hit.m_backstabBonus > 1f) { num3 /= hit.m_backstabBonus; } if (hit.m_staggerMultiplier > 1f) { num3 /= hit.m_staggerMultiplier; } float bodyArmor = ((Character)val).GetBodyArmor(); float num4 = Mathf.Max(1f, num - bodyArmor * 0.5f); float num5 = Mathf.Min(num4 + num2, num3); if (num5 <= 0f) { return; } float health = ((Character)val).GetHealth(); if (!(health - num5 <= 0f)) { return; } ZNetView nview = ((Character)val).m_nview; ZDO val2 = ((nview != null) ? nview.GetZDO() : null); if (val2 == null) { return; } float num6 = (((Object)(object)EnvMan.instance != (Object)null) ? ((float)EnvMan.instance.m_totalSeconds) : Time.time); float @float = val2.GetFloat("naz_bg_cd_until", 0f); if (!(num6 < @float)) { sEMan.AddStatusEffect(SE_BerserkerGod.NameHash, false, 0, 0f); val2.Set("naz_bg_cd_until", num6 + 80f); if (Same((Character)(object)val, (Character)(object)Player.m_localPlayer)) { SkillsUI.StartCooldown(80f); } ZeroDamage(ref hit.m_damage); Debug.Log((object)$"[NazhikaCore][BerserkerGod] {val.GetPlayerName()} salvado (HP={health:0.##}) → GOD + CD"); } } private static void AddFury(Character attacker, string attackerName, float amount) { //IL_0020: 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) Hud instance = Hud.instance; if ((Object)(object)instance == (Object)null || !TryId(attacker, out var id)) { return; } if (!Bars.TryGetValue(id, out var value) || value == null || (Object)(object)value.root == (Object)null) { value = CreateFuryUI(instance, attackerName); Bars[id] = value; } Player val = (Player)(object)((attacker is Player) ? attacker : null); if ((Object)(object)val != (Object)null) { SEMan sEMan = ((Character)val).GetSEMan(); if (sEMan != null && (Object)(object)sEMan.GetStatusEffect(SE_BerserkBurst.NameHash) != (Object)null) { return; } } float value2 = value.fast.m_value; float num = Mathf.Min(value2 + amount, 100f); value.fast.m_value = num; value.slow.m_value = 100f; value.root.SetActive(true); SetFury(attacker, num); value.lastHitTime = Time.time; if ((Object)(object)value.valueText != (Object)null) { value.valueText.text = Mathf.CeilToInt(num).ToString(); ((Component)value.valueText).gameObject.SetActive(true); } } private static UI CreateFuryUI(Hud hud, string attackerName) { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: 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_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0141: 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_0172: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_0343: Unknown result type (might be due to invalid IL or missing references) //IL_03af: Unknown result type (might be due to invalid IL or missing references) //IL_03cc: Unknown result type (might be due to invalid IL or missing references) //IL_03d8: Unknown result type (might be due to invalid IL or missing references) //IL_03e4: Unknown result type (might be due to invalid IL or missing references) //IL_03f0: Unknown result type (might be due to invalid IL or missing references) //IL_03fc: Unknown result type (might be due to invalid IL or missing references) //IL_0417: Unknown result type (might be due to invalid IL or missing references) GuiBar val = (Object.op_Implicit((Object)(object)hud.m_eitrBarFast) ? hud.m_eitrBarFast : hud.m_staminaBar2Fast); GuiBar val2 = (Object.op_Implicit((Object)(object)hud.m_eitrBarSlow) ? hud.m_eitrBarSlow : hud.m_staminaBar2Slow); if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)val2)) { return null; } GameObject val3 = new GameObject("Fury_" + attackerName + "_BG"); val3.transform.SetParent(hud.m_rootObject.transform, false); RectTransform val4 = val3.AddComponent(); val4.anchorMin = new Vector2(0.5f, 0.5f); val4.anchorMax = new Vector2(0.5f, 0.5f); val4.pivot = new Vector2(0.5f, 0.5f); val4.anchoredPosition = new Vector2(0f, BarLocalPos.y); ((Transform)val4).localScale = Vector3.one; val4.sizeDelta = new Vector2(250f, 28f); Image val5 = CreateStretchImage(val3.transform, "Darken", new Color(0f, 0f, 0f, 0.55f)); if ((Object)(object)val5 != (Object)null) { RectTransform rectTransform = ((Graphic)val5).rectTransform; rectTransform.offsetMin = new Vector2(-12f, 0f); rectTransform.offsetMax = new Vector2(12f, 0f); ((Transform)rectTransform).localScale = new Vector3(0.94f, 0.7f, 1f); ((Transform)rectTransform).localPosition = new Vector3(1.5f, 0f, 0f); } GuiBar val6 = Object.Instantiate(val2, val3.transform, false); GuiBar val7 = Object.Instantiate(val, val3.transform, false); ((Object)val6).name = "Fury_" + attackerName + "_Slow"; ((Object)val7).name = "Fury_" + attackerName + "_Fast"; val6.SetMaxValue(100f); val7.SetMaxValue(100f); val6.SetWidth(250f); val7.SetWidth(250f); Transform transform = ((Component)val6).transform; RectTransform val8 = (RectTransform)(object)((transform is RectTransform) ? transform : null); if (val8 != null) { val8.anchorMin = Vector2.zero; val8.anchorMax = Vector2.one; val8.offsetMin = new Vector2(2f, 2f); val8.offsetMax = new Vector2(-2f, -2f); ((Transform)val8).localPosition = Vector3.zero; ((Transform)val8).localScale = new Vector3(1f, 0.7f, 1f); } Transform transform2 = ((Component)val7).transform; RectTransform val9 = (RectTransform)(object)((transform2 is RectTransform) ? transform2 : null); if (val9 != null) { val9.anchorMin = Vector2.zero; val9.anchorMax = Vector2.one; val9.offsetMin = new Vector2(2f, 2f); val9.offsetMax = new Vector2(-2f, -2f); ((Transform)val9).localPosition = Vector3.zero; ((Transform)val9).localScale = new Vector3(1f, 0.7f, 1f); } Image componentInChildren = ((Component)val6).GetComponentInChildren(true); if ((Object)(object)componentInChildren != (Object)null) { ((Graphic)componentInChildren).color = SlowColor; } Image componentInChildren2 = ((Component)val7).GetComponentInChildren(true); if ((Object)(object)componentInChildren2 != (Object)null) { ((Graphic)componentInChildren2).color = FastColor; } val6.m_value = 100f; val7.m_value = 0f; TMP_Text val10 = null; if ((Object)(object)hud.m_staminaText != (Object)null) { val10 = Object.Instantiate(hud.m_staminaText, val3.transform, false); ((Object)val10).name = "Fury_ValueText"; val10.alignment = (TextAlignmentOptions)514; val10.fontStyle = (FontStyles)1; ((Graphic)val10).color = Color.white; ((Graphic)val10).raycastTarget = false; RectTransform rectTransform2 = val10.rectTransform; rectTransform2.anchorMin = Vector2.zero; rectTransform2.anchorMax = Vector2.one; rectTransform2.offsetMin = Vector2.zero; rectTransform2.offsetMax = Vector2.zero; ((Transform)rectTransform2).localPosition = Vector3.zero; ((Transform)rectTransform2).localScale = new Vector3(0.7f, 0.7f, 1f); val10.text = ""; ((Component)val10).gameObject.SetActive(true); } if (Object.op_Implicit((Object)(object)val5)) { ((Component)val5).transform.SetAsFirstSibling(); } if (Object.op_Implicit((Object)(object)val6)) { ((Component)val6).transform.SetSiblingIndex(1); } if (Object.op_Implicit((Object)(object)val7)) { ((Component)val7).transform.SetSiblingIndex(2); } if (Object.op_Implicit((Object)(object)val10)) { val10.transform.SetAsLastSibling(); } val3.SetActive(false); return new UI { root = val3, darken = val5, fast = val7, slow = val6, valueText = val10, lastHitTime = Time.time }; } private static Image CreateStretchImage(Transform parent, string name, Color color) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_001c: 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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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) GameObject val = new GameObject(name); val.transform.SetParent(parent, false); Image val2 = val.AddComponent(); ((Graphic)val2).color = color; ((Graphic)val2).raycastTarget = false; RectTransform rectTransform = ((Graphic)val2).rectTransform; rectTransform.anchorMin = Vector2.zero; rectTransform.anchorMax = Vector2.one; rectTransform.offsetMin = Vector2.zero; rectTransform.offsetMax = Vector2.zero; ((Transform)rectTransform).localPosition = Vector3.zero; ((Transform)rectTransform).localScale = Vector3.one; return val2; } private static void ZeroDamage(ref DamageTypes d) { d.m_blunt = (d.m_slash = (d.m_pierce = 0f)); d.m_fire = (d.m_frost = (d.m_lightning = (d.m_poison = (d.m_spirit = 0f)))); d.m_damage = 0f; } private static Character SafeGetAttacker(HitData h) { try { return h.GetAttacker(); } catch { return null; } } private static bool TryId(Character c, out ZDOID id) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: 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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) id = ZDOID.None; try { ZDOID? obj; if (c == null) { obj = null; } else { ZNetView nview = c.m_nview; obj = ((nview == null) ? null : nview.GetZDO()?.m_uid); } id = (ZDOID)(((??)obj) ?? ZDOID.None); } catch { } return id != ZDOID.None; } private static bool Same(Character a, Character b) { //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) if (a == b) { return true; } if (!TryId(a, out var id) || !TryId(b, out var id2)) { return false; } return id == id2; } private static string GetName(Character c) { try { return c.GetHoverName(); } catch { return "unknown"; } } private static float GetFury(Character c) { try { float? obj; if (c == null) { obj = null; } else { ZNetView nview = c.m_nview; if (nview == null) { obj = null; } else { ZDO zDO = nview.GetZDO(); obj = ((zDO != null) ? new float?(zDO.GetFloat("naz_fury", 0f)) : null); } } float? num = obj; return num.GetValueOrDefault(); } catch { return 0f; } } private static void SetFury(Character c, float v) { try { if (c == null) { return; } ZNetView nview = c.m_nview; if (nview != null) { ZDO zDO = nview.GetZDO(); if (zDO != null) { zDO.Set("naz_fury", Mathf.Clamp(v, 0f, 100f)); } } } catch { } } private static bool HasStatus(Character c, int nameHash) { try { object obj; if (c == null) { obj = null; } else { SEMan sEMan = c.GetSEMan(); obj = ((sEMan != null) ? sEMan.GetStatusEffect(nameHash) : null); } return (Object)obj != (Object)null; } catch { return false; } } } public static class ClassSkillsPatches { internal static class BowDrawTracker { public static bool IsDrawing = false; public static float StaminaAtDrawStart = 0f; public static float StaminaDrained = 0f; public static float DrawStartTime = 0f; public static string WeaponName = ""; public static bool PendingFire = false; public static void Reset() { IsDrawing = false; StaminaAtDrawStart = 0f; StaminaDrained = 0f; DrawStartTime = 0f; WeaponName = ""; PendingFire = false; } } private static class Patch_UpdateAttackBowDraw { public static void Prefix(Player __instance, ItemData weapon, float dt) { if (__instance != Player.m_localPlayer) { return; } float attackDrawTime = ((Humanoid)__instance).m_attackDrawTime; if (!BowDrawTracker.IsDrawing && !BowDrawTracker.PendingFire && attackDrawTime == 0f && ((Character)__instance).m_attackHold) { BowDrawTracker.Reset(); BowDrawTracker.IsDrawing = true; BowDrawTracker.DrawStartTime = Time.time; BowDrawTracker.StaminaAtDrawStart = __instance.GetStamina(); BowDrawTracker.WeaponName = weapon?.m_shared?.m_name ?? "?"; Debug.Log((object)("[NazhikaCore/PowerShot] [START] Arma=" + BowDrawTracker.WeaponName + $" | StaminaInicio={BowDrawTracker.StaminaAtDrawStart:F1}")); } if (BowDrawTracker.IsDrawing && HasFocusShot(__instance)) { float bonusDamage = BowDrawTracker.StaminaDrained * PowerShotStaminaToDmgPct; PowerShotHUD.GetOrCreate()?.UpdateDraw(BowDrawTracker.StaminaDrained, bonusDamage); } if (BowDrawTracker.IsDrawing && attackDrawTime > 0f && !((Character)__instance).m_attackHold) { BowDrawTracker.IsDrawing = false; BowDrawTracker.PendingFire = true; float stamina = __instance.GetStamina(); float num = BowDrawTracker.StaminaAtDrawStart - stamina; if (num > BowDrawTracker.StaminaDrained) { Debug.Log((object)("[NazhikaCore/PowerShot] [RELEASE] Corrigiendo StaminaDrained via snapshot:" + $" {BowDrawTracker.StaminaDrained:F2} → {num:F2}")); BowDrawTracker.StaminaDrained = num; } if (HasFocusShot(__instance)) { float bonusDamage2 = BowDrawTracker.StaminaDrained * PowerShotStaminaToDmgPct; PowerShotHUD.GetOrCreate()?.OnFired(BowDrawTracker.StaminaDrained, bonusDamage2); } else { PowerShotHUD.Instance?.Hide(); } Debug.Log((object)(string.Format("{0} [RELEASE] drawPct={1:F2}", "[NazhikaCore/PowerShot]", ((Humanoid)__instance).GetAttackDrawPercentage()) + $" | StaminaDrenada={BowDrawTracker.StaminaDrained:F2}" + $" | Duracion={Time.time - BowDrawTracker.DrawStartTime:F2}s")); } } } private static class Patch_RPC_UseStamina { public static void Prefix(Player __instance, long sender, float v) { if (__instance == Player.m_localPlayer && BowDrawTracker.IsDrawing && !(v <= 0f)) { BowDrawTracker.StaminaDrained += v; } } } private static class Outgoing_SwordElementals { public static void Prefix(HitData hit) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Invalid comparison between Unknown and I4 //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Invalid comparison between Unknown and I4 Character attacker = hit.GetAttacker(); Player val = (Player)(object)((attacker is Player) ? attacker : null); if ((Object)(object)val == (Object)null) { return; } bool flag = (int)hit.m_skill == 1 && !hit.m_ranged; if (!flag) { ItemData currentWeapon = ((Humanoid)val).GetCurrentWeapon(); if (currentWeapon == null || currentWeapon.m_shared == null || hit.m_ranged) { return; } flag = (int)currentWeapon.m_shared.m_skillType == 1; } if (!flag) { return; } float num = hit.m_damage.m_blunt + hit.m_damage.m_pierce + hit.m_damage.m_slash; if (num <= 0f) { return; } SEMan sEMan = ((Character)val).GetSEMan(); if (sEMan != null) { if (sEMan.HaveStatusEffect(H_SE_SWORD_POISON)) { hit.m_damage.m_poison += num * SwordPoisonBonusPct; } if (sEMan.HaveStatusEffect(H_SE_SWORD_LIGHTNING)) { hit.m_damage.m_lightning += num * SwordLightningBonusPct; } } } } private static class SpearStacks_Add_Postfix { public static void Postfix(Character __instance, HitData hit) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Invalid comparison between Unknown and I4 //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Invalid comparison between Unknown and I4 if (hit == null) { return; } Character attacker = hit.GetAttacker(); Player val = (Player)(object)((attacker is Player) ? attacker : null); if ((Object)(object)val == (Object)null || !val.HasClass("Lancer", ignoreCase: true)) { return; } SEMan sEMan = ((Character)val).GetSEMan(); if (sEMan == null) { return; } SkillType effectiveSkill = GetEffectiveSkill((Humanoid)(object)val, hit); if ((int)effectiveSkill == 5 || (int)effectiveSkill == 4) { StatusEffect val2 = sEMan.GetStatusEffect(H_SE_SPEAR_STACKS) ?? sEMan.AddStatusEffect(H_SE_SPEAR_STACKS, false, 0, 0f); if (!((Object)(object)val2 == (Object)null)) { ((object)val2).GetType().GetMethod("AddStack", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.Invoke(val2, null); } } } } private static class BloodySpear_ApplyBleed_Postfix { public static void Postfix(Character __instance, HitData hit) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Invalid comparison between Unknown and I4 //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Invalid comparison between Unknown and I4 if ((Object)(object)__instance == (Object)null || hit == null) { return; } Character attacker = hit.GetAttacker(); Player val = (Player)(object)((attacker is Player) ? attacker : null); if (!((Object)(object)val == (Object)null) && val.HasClass("Lancer", ignoreCase: true)) { SkillType effectiveSkill = GetEffectiveSkill((Humanoid)(object)val, hit); if ((int)effectiveSkill == 5 || (int)effectiveSkill == 4) { BleedApplyRPC.RequestBleed(__instance, val.GetPlayerID()); } } } } private static class Incoming_TankAndWarCryReductions { public static void Prefix(Character __instance, HitData hit) { Player val = (Player)(object)((__instance is Player) ? __instance : null); if ((Object)(object)val == (Object)null || hit == null) { return; } SEMan sEMan = ((Character)val).GetSEMan(); if (sEMan == null) { return; } if (sEMan.HaveStatusEffect(H_SE_TANK_PASSIVE)) { float num = 0f; Skills skills = ((Character)val).GetSkills(); if ((Object)(object)skills != (Object)null) { num = Mathf.Clamp(skills.GetSkillLevel((SkillType)6), 0f, 100f); } float tankPassiveMaxReducePct = TankPassiveMaxReducePct; float num2 = Mathf.Clamp(tankPassiveMaxReducePct * (num / 100f), 0f, tankPassiveMaxReducePct); ((DamageTypes)(ref hit.m_damage)).Modify(1f - num2); long playerID = val.GetPlayerID(); float time = Time.time; if (!_tankMsgCooldown.TryGetValue(playerID, out var value) || time - value >= 1f) { ((Character)val).Message((MessageType)1, $"\ud83d\udee1 Tank: Daño reducido {num2 * 100f:0.#}%", 0, (Sprite)null); _tankMsgCooldown[playerID] = time; } } if (sEMan.HaveStatusEffect(H_SE_WAR_CRY)) { float num3 = 1f - WarCryPhysReducePct; float num4 = 1f - WarCryElemReducePct; hit.m_damage.m_blunt *= num3; hit.m_damage.m_pierce *= num3; hit.m_damage.m_slash *= num3; hit.m_damage.m_fire *= num4; hit.m_damage.m_frost *= num4; hit.m_damage.m_poison *= num4; hit.m_damage.m_lightning *= num4; } } } private static class Projectile_Setup_FocusFlat_Postfix { public static void Postfix(Projectile __instance) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Invalid comparison between Unknown and I4 //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Invalid comparison between Unknown and I4 try { if ((Object)(object)__instance == (Object)null) { return; } Character owner = __instance.m_owner; Player val = (Player)(object)((owner is Player) ? owner : null); Debug.Log((object)$"El valor de owner es:{val}"); if ((Object)(object)val == (Object)null) { return; } SEMan sEMan = ((Character)val).GetSEMan(); if (sEMan == null || ((int)__instance.m_skill != 8 && (int)__instance.m_skill != 14)) { return; } bool flag = !sEMan.HaveStatusEffect(H_SE_FOCUS_CD) && sEMan.HaveStatusEffect(H_SE_FOCUS_SHOT) && IsBowProjectile(__instance); float num = 0f; if (flag) { FocusShotMarker focusShotMarker = default(FocusShotMarker); if (!((Component)__instance).gameObject.TryGetComponent(ref focusShotMarker)) { ((Component)__instance).gameObject.AddComponent(); } ((MonoBehaviour)val).StartCoroutine(RemoveFocusAndApplyCooldown_EndOfFrame(val, 15f)); } bool pendingFire = BowDrawTracker.PendingFire; float staminaDrained = BowDrawTracker.StaminaDrained; Debug.Log((object)string.Format("{0} [Projectile.Setup] PendingFire={1} | StaminaDrained={2:F2}", "[NazhikaCore/PowerShot]", pendingFire, staminaDrained)); if (pendingFire && staminaDrained > 0f) { float num2 = staminaDrained * PowerShotStaminaToDmgPct; float num3 = __instance.m_damage.m_pierce - num; float num4 = num3 + num + num2; __instance.m_damage.m_pierce += num2; Debug.Log((object)"[NazhikaCore/PowerShot] ===== POWER SHOT ====="); Debug.Log((object)string.Format("{0} Daño Normal : {1:F2}", "[NazhikaCore/PowerShot]", num3)); Debug.Log((object)string.Format("{0} Stamina Gastada : {1:F2}", "[NazhikaCore/PowerShot]", staminaDrained)); Debug.Log((object)string.Format("{0} % Stamina→Daño : {1:F0}%", "[NazhikaCore/PowerShot]", PowerShotStaminaToDmgPct * 100f)); Debug.Log((object)string.Format("{0} Daño Extra : {1:F2}", "[NazhikaCore/PowerShot]", num2)); Debug.Log((object)string.Format("{0} Daño Total : {1:F2}", "[NazhikaCore/PowerShot]", num4)); if (flag) { Debug.Log((object)string.Format("{0} (incluye Focus : +{1:F2})", "[NazhikaCore/PowerShot]", num)); } Debug.Log((object)"[NazhikaCore/PowerShot] ======================"); } else { Debug.Log((object)("[NazhikaCore/PowerShot] [Projectile.Setup] Power Shot NO aplicado." + $" PendingFire={pendingFire} StaminaDrained={staminaDrained:F2}")); } BowDrawTracker.Reset(); } catch (Exception arg) { Debug.LogWarning((object)$"[NazhikaCore] Projectile.Setup (Focus + PowerShot) EX: {arg}"); } } } private static class Projectile_FocusStagger_OnHit_Postfix { public static void Postfix(Projectile __instance, Collider collider, Vector3 hitPoint, bool water, Vector3 normal) { //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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) FocusShotMarker focusShotMarker = default(FocusShotMarker); if ((Object)(object)__instance == (Object)null || (Object)(object)collider == (Object)null || !((Component)__instance).gameObject.TryGetComponent(ref focusShotMarker)) { return; } Character componentInParent = ((Component)collider).GetComponentInParent(); if (!((Object)(object)componentInParent == (Object)null)) { Character owner = __instance.m_owner; Vector3 val; if (!((Object)(object)owner != (Object)null)) { val = Vector3.up; } else { Vector3 val2 = ((Component)componentInParent).transform.position - ((Component)owner).transform.position; val = ((Vector3)(ref val2)).normalized; } Vector3 val3 = val; componentInParent.Stagger(val3); } } } [CompilerGenerated] private sealed class d__51 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Player p; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__51(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForEndOfFrame(); <>1__state = 1; return true; case 1: { <>1__state = -1; if ((Object)(object)p == (Object)null) { return false; } SEMan sEMan = ((Character)p).GetSEMan(); if (sEMan == null) { return false; } sEMan.RemoveStatusEffect(H_SE_FOCUS_SHOT, false); sEMan.AddStatusEffect(H_SE_FOCUS_CD, false, 0, 0f); return false; } } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private const float FocusShotCooldownSeconds = 15f; public const string SE_SWORD_LIGHTNING = "SE_SwordLightning"; public const string SE_SWORD_POISON = "SE_SwordPoison"; public const string SE_FOCUS_SHOT = "SE_FocusShot"; public const string SE_FOCUS_CD = "SE_FocusShot_Cooldown"; public const string SE_WAR_CRY = "SE_Warcry"; public const string SE_SPEAR_STACKS = "SE_SpearStacks"; public const string SE_BLEEDING = "SE_Bleeding"; public const string SE_TANK_PASSIVE = "SE_TankPassive"; public static readonly int H_SE_SWORD_LIGHTNING = StringExtensionMethods.GetStableHashCode("SE_SwordLightning"); public static readonly int H_SE_SWORD_POISON = StringExtensionMethods.GetStableHashCode("SE_SwordPoison"); public static readonly int H_SE_FOCUS_SHOT = StringExtensionMethods.GetStableHashCode("SE_FocusShot"); public static readonly int H_SE_FOCUS_CD = StringExtensionMethods.GetStableHashCode("SE_FocusShot_Cooldown"); public static readonly int H_SE_WAR_CRY = StringExtensionMethods.GetStableHashCode("SE_Warcry"); public static readonly int H_SE_SPEAR_STACKS = StringExtensionMethods.GetStableHashCode("SE_SpearStacks"); public static readonly int H_SE_BLEEDING = StringExtensionMethods.GetStableHashCode("SE_Bleeding"); public static readonly int H_SE_TANK_PASSIVE = StringExtensionMethods.GetStableHashCode("SE_TankPassive"); private const string LOG = "[NazhikaCore/BowFX]"; private const string LOGPS = "[NazhikaCore/PowerShot]"; private static readonly Dictionary _tankMsgCooldown = new Dictionary(); private const float TankMsgCooldownSeconds = 1f; private static float SwordPoisonBonusPct => BalanceConfig.SwordPoisonBonusPct; private static float SwordLightningBonusPct => BalanceConfig.SwordLightningBonusPct; private static float WarCryPhysReducePct => BalanceConfig.WarCryPhysReducePct; private static float WarCryElemReducePct => BalanceConfig.WarCryElemReducePct; private static float PowerShotStaminaToDmgPct => BalanceConfig.PowerShotStaminaToDmgPct; private static float TankPassiveMaxReducePct => BalanceConfig.TankPassiveMaxReducePct; public static void Init(Harmony harmony) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected O, but got Unknown //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Expected O, but got Unknown //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Expected O, but got Unknown //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Expected O, but got Unknown //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Expected O, but got Unknown //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Expected O, but got Unknown //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Expected O, but got Unknown //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Expected O, but got Unknown MethodInfo methodInfo = AccessTools.Method(typeof(Character), "Damage", (Type[])null, (Type[])null); MethodInfo methodInfo2 = AccessTools.Method(typeof(Character), "RPC_Damage", (Type[])null, (Type[])null); harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(Outgoing_SwordElementals), "Prefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(typeof(SpearStacks_Add_Postfix), "Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(typeof(BloodySpear_ApplyBleed_Postfix), "Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)methodInfo2, new HarmonyMethod(typeof(Incoming_TankAndWarCryReductions), "Prefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); TryPatchPostfix(harmony, typeof(Attack), "Start", typeof(ClassSkillsPatches), "OnStartDraw"); TryPatchPostfix(harmony, typeof(Attack), "StartDraw", typeof(ClassSkillsPatches), "OnStartDraw"); TryPatchPostfix(harmony, typeof(Attack), "OnAttackTrigger", typeof(ClassSkillsPatches), "OnAttackTrigger"); TryPatchPostfix(harmony, typeof(Attack), "Stop", typeof(ClassSkillsPatches), "OnStop"); MethodInfo methodInfo3 = AccessTools.Method(typeof(Attack), "UseAmmo", (Type[])null, (Type[])null); if (methodInfo3 != null) { harmony.Patch((MethodBase)methodInfo3, (HarmonyMethod)null, new HarmonyMethod(typeof(ClassSkillsPatches), "OnUseAmmo", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Debug.Log((object)"[NazhikaCore/BowFX] Patch OK -> Attack.UseAmmo (Postfix)"); } else { Debug.LogWarning((object)"[NazhikaCore/BowFX] Attack.UseAmmo no encontrado (según build)."); } MethodInfo methodInfo4 = AccessTools.Method(typeof(Projectile), "Setup", (Type[])null, (Type[])null); if (methodInfo4 != null) { harmony.Patch((MethodBase)methodInfo4, (HarmonyMethod)null, new HarmonyMethod(typeof(Projectile_Setup_FocusFlat_Postfix), "Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Debug.Log((object)"[NazhikaCore/BowFX] Patch OK -> Projectile.Setup (Focus + PowerShot Postfix)"); } else { Debug.LogWarning((object)"[NazhikaCore/BowFX] Projectile.Setup no encontrado."); } MethodInfo methodInfo5 = AccessTools.Method(typeof(Projectile), "OnHit", (Type[])null, (Type[])null); if (methodInfo5 != null) { harmony.Patch((MethodBase)methodInfo5, (HarmonyMethod)null, new HarmonyMethod(typeof(Projectile_FocusStagger_OnHit_Postfix), "Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Debug.Log((object)"[NazhikaCore/BowFX] Patch OK -> Projectile.OnHit (Focus stagger Postfix)"); } else { Debug.LogWarning((object)"[NazhikaCore/BowFX] Projectile.OnHit no encontrado."); } MethodInfo methodInfo6 = AccessTools.Method(typeof(Player), "UpdateAttackBowDraw", (Type[])null, (Type[])null); if (methodInfo6 != null) { harmony.Patch((MethodBase)methodInfo6, new HarmonyMethod(typeof(Patch_UpdateAttackBowDraw), "Prefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Debug.Log((object)"[NazhikaCore/BowFX] Patch OK -> Player.UpdateAttackBowDraw (PowerShot Tracker)"); } else { Debug.LogWarning((object)"[NazhikaCore/BowFX] Player.UpdateAttackBowDraw no encontrado."); } MethodInfo methodInfo7 = AccessTools.Method(typeof(Player), "RPC_UseStamina", (Type[])null, (Type[])null); if (methodInfo7 != null) { harmony.Patch((MethodBase)methodInfo7, new HarmonyMethod(typeof(Patch_RPC_UseStamina), "Prefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Debug.Log((object)"[NazhikaCore/BowFX] Patch OK -> Player.RPC_UseStamina (PowerShot Tracker)"); } else { Debug.LogWarning((object)"[NazhikaCore/BowFX] Player.RPC_UseStamina no encontrado."); } Debug.Log((object)string.Format("{0} Init OK. Hash FocusShot={1}", "[NazhikaCore/BowFX]", H_SE_FOCUS_SHOT)); } private static void TryPatchPostfix(Harmony h, Type targetType, string methodName, Type patchType, string patchMethod) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown MethodInfo methodInfo = AccessTools.Method(targetType, methodName, (Type[])null, (Type[])null); if (methodInfo == null) { Debug.LogWarning((object)("[NazhikaCore/BowFX] No se encontró " + targetType.Name + "." + methodName + " para parchear.")); } else { h.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(patchType, patchMethod, (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Debug.Log((object)("[NazhikaCore/BowFX] Patch OK -> " + targetType.Name + "." + methodName + " (Postfix)")); } } private static bool HasFocusShot(Player p) { if ((Object)(object)p == (Object)null) { return false; } SEMan sEMan = ((Character)p).GetSEMan(); if (sEMan != null && sEMan.HaveStatusEffect(H_SE_FOCUS_SHOT)) { return !sEMan.HaveStatusEffect(H_SE_FOCUS_CD); } return false; } private static void OnStartDraw(Attack __instance) { Player localPlayer = Player.m_localPlayer; if (!((Object)(object)localPlayer == (Object)null)) { SEMan sEMan = ((Character)localPlayer).GetSEMan(); bool flag = sEMan != null && sEMan.HaveStatusEffect(H_SE_FOCUS_CD); bool flag2 = sEMan != null && sEMan.HaveStatusEffect(H_SE_FOCUS_SHOT); if (flag) { FocusFX.ClearDrawFX(localPlayer); } else if (flag2) { FocusFX.StartDrawFX(localPlayer); } else { FocusFX.ClearDrawFX(localPlayer); } } } private static void OnUseAmmo(Attack __instance) { Player localPlayer = Player.m_localPlayer; if (!((Object)(object)localPlayer == (Object)null)) { SEMan sEMan = ((Character)localPlayer).GetSEMan(); bool flag = sEMan != null && sEMan.HaveStatusEffect(H_SE_FOCUS_SHOT); if (sEMan != null && sEMan.HaveStatusEffect(H_SE_FOCUS_CD)) { FocusFX.ClearDrawFX(localPlayer); } else if (flag) { FocusFX.ShotFX(localPlayer); FocusFX.ClearDrawFX(localPlayer); } else { FocusFX.ClearDrawFX(localPlayer); } } } private static void OnStop(Attack __instance) { Player localPlayer = Player.m_localPlayer; if (!((Object)(object)localPlayer == (Object)null)) { FocusFX.ClearDrawFX(localPlayer); if (!BowDrawTracker.PendingFire) { PowerShotHUD.Instance?.Hide(); BowDrawTracker.Reset(); } else { Debug.Log((object)"[NazhikaCore/PowerShot] [OnStop] PendingFire activo, delegando reset a Projectile.Setup."); } } } private static void OnAttackTrigger(Attack __instance) { Player localPlayer = Player.m_localPlayer; if (!((Object)(object)localPlayer == (Object)null)) { FocusFX.ClearDrawFX(localPlayer); } } private static SkillType GetEffectiveSkill(Humanoid h, HitData hit) { //IL_0035: 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) ItemData val = (((Object)(object)h != (Object)null) ? (h.GetCurrentWeapon() ?? h.GetRightItem()) : null); if (val != null && val.m_shared != null) { return val.m_shared.m_skillType; } return hit.m_skill; } private static bool IsBowProjectile(Projectile prj) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Invalid comparison between Unknown and I4 if ((Object)(object)prj == (Object)null) { return false; } if ((int)prj.m_skill == 8) { return true; } object obj = ((Object)prj).name?.ToLower(); if (obj == null) { GameObject gameObject = ((Component)prj).gameObject; obj = ((gameObject == null) ? null : ((Object)gameObject).name?.ToLower()) ?? string.Empty; } string text = (string)obj; if (!text.Contains("arrow")) { return text.Contains("bow"); } return true; } [IteratorStateMachine(typeof(d__51))] private static IEnumerator RemoveFocusAndApplyCooldown_EndOfFrame(Player p, float cdSeconds) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__51(0) { p = p }; } } public class FocusFXHolder : MonoBehaviour { private const string FxSupportPrefab = "fx_DvergerMage_Support_start"; private const string FxBugPrefab = "vfx_BugRepellent"; private const string FxShotAoePrefab = "bca_vfx_Place_cauldron"; private const string FxShotSfxPrefab = "sfx_troll_rock_destroyed"; private Player _player; private GameObject _fxSupport; private GameObject _fxBug; private readonly List _fxShots = new List(); public bool HasFX { get { if (!((Object)(object)_fxSupport != (Object)null)) { return (Object)(object)_fxBug != (Object)null; } return true; } } private void Awake() { _player = ((Component)this).GetComponent(); } private void OnDisable() { Cleanup(); } private void OnDestroy() { Cleanup(); } public static FocusFXHolder GetOrAdd(Player p) { return ((Component)p).GetComponent() ?? ((Component)p).gameObject.AddComponent(); } public void StartDraw() { if (!HasFX && (!((Object)(object)_player != (Object)null) || !((Character)_player).IsTeleporting())) { GameObject val = SpawnOnPlayer("fx_DvergerMage_Support_start", parentToPlayer: true); if ((Object)(object)val != (Object)null) { _fxSupport = val; } GameObject val2 = SpawnOnPlayer("vfx_BugRepellent", parentToPlayer: true); if ((Object)(object)val2 != (Object)null) { DisableNamedParticleSystems(val2, new string[3] { "flare", "soft cloud", "softcloud" }); _fxBug = val2; } } } public void Shot() { if (!((Object)(object)_player != (Object)null) || !((Character)_player).IsTeleporting()) { GameObject val = SpawnShotFX("bca_vfx_Place_cauldron"); if ((Object)(object)val != (Object)null) { _fxShots.Add(val); } GameObject val2 = SpawnShotFX("sfx_troll_rock_destroyed"); if ((Object)(object)val2 != (Object)null) { _fxShots.Add(val2); } } } public void Clear() { if ((Object)(object)_fxSupport != (Object)null) { Object.Destroy((Object)(object)_fxSupport); _fxSupport = null; } if ((Object)(object)_fxBug != (Object)null) { Object.Destroy((Object)(object)_fxBug); _fxBug = null; } } private void Cleanup() { Clear(); foreach (GameObject fxShot in _fxShots) { if ((Object)(object)fxShot != (Object)null) { Object.Destroy((Object)(object)fxShot); } } _fxShots.Clear(); } private GameObject SpawnOnPlayer(string prefabName, bool parentToPlayer) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_009c: 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_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_0075: 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_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Expected O, but got Unknown //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_player == (Object)null || (Object)(object)ZNetScene.instance == (Object)null) { return null; } GameObject prefab = ZNetScene.instance.GetPrefab(prefabName); if ((Object)(object)prefab == (Object)null) { Debug.LogWarning((object)("[FocusFX] Prefab no encontrado: " + prefabName)); return null; } GameObject val = new GameObject(prefabName + "_FX"); if (parentToPlayer) { val.transform.SetParent(((Component)_player).transform, false); val.transform.localPosition = Vector3.up * 1.2f; } else { val.transform.position = ((Component)_player).transform.position + Vector3.up * 1.2f; } foreach (Transform item in prefab.transform) { Transform val2 = item; GameObject val3 = Object.Instantiate(((Component)val2).gameObject); val3.transform.SetParent(val.transform, false); val3.transform.localPosition = val2.localPosition; val3.transform.localRotation = val2.localRotation; val3.transform.localScale = val2.localScale; TimedDestruction[] componentsInChildren = val3.GetComponentsInChildren(true); foreach (TimedDestruction val4 in componentsInChildren) { Object.Destroy((Object)(object)val4); } ZNetView[] componentsInChildren2 = val3.GetComponentsInChildren(true); foreach (ZNetView val5 in componentsInChildren2) { Object.Destroy((Object)(object)val5); } ZSyncTransform[] componentsInChildren3 = val3.GetComponentsInChildren(true); foreach (ZSyncTransform val6 in componentsInChildren3) { Object.Destroy((Object)(object)val6); } ParticleSystem[] componentsInChildren4 = val3.GetComponentsInChildren(true); foreach (ParticleSystem val7 in componentsInChildren4) { EmissionModule emission = val7.emission; ((EmissionModule)(ref emission)).enabled = true; val7.Play(true); } } return val; } private GameObject SpawnShotFX(string prefabName) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_player == (Object)null || (Object)(object)ZNetScene.instance == (Object)null) { return null; } GameObject prefab = ZNetScene.instance.GetPrefab(prefabName); if ((Object)(object)prefab == (Object)null) { Debug.LogWarning((object)("[FocusFX] Prefab no encontrado: " + prefabName)); return null; } Vector3 val = ((Component)_player).transform.position + Vector3.up * 1f; GameObject val2 = Object.Instantiate(prefab, val, Quaternion.identity); Object.Destroy((Object)(object)val2, 4f); Debug.Log((object)$"[FocusFX] SpawnShotFX → {prefabName} | pos={val}"); return val2; } private static void DisableNamedParticleSystems(GameObject root, string[] names) { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)root) || names == null) { return; } ParticleSystem[] componentsInChildren = root.GetComponentsInChildren(true); foreach (ParticleSystem val in componentsInChildren) { if (!Object.op_Implicit((Object)(object)val)) { continue; } string text = (((Object)((Component)val).gameObject).name ?? string.Empty).ToLowerInvariant(); foreach (string text2 in names) { if (!string.IsNullOrEmpty(text2) && text.Contains(text2.ToLowerInvariant())) { EmissionModule emission = val.emission; ((EmissionModule)(ref emission)).enabled = false; val.Stop(true, (ParticleSystemStopBehavior)0); break; } } } } } public static class FocusFX { public static bool HasDrawFX(Player p) { if ((Object)(object)p == (Object)null) { return false; } FocusFXHolder component = ((Component)p).GetComponent(); if ((Object)(object)component != (Object)null) { return component.HasFX; } return false; } public static void StartDrawFX(Player p) { if (!((Object)(object)p == (Object)null) && !((Object)(object)ZNetScene.instance == (Object)null) && !((Character)p).IsTeleporting()) { FocusFXHolder.GetOrAdd(p).StartDraw(); } } public static void ShotFX(Player p) { if (!((Object)(object)p == (Object)null) && !((Object)(object)ZNetScene.instance == (Object)null) && !((Character)p).IsTeleporting()) { FocusFXHolder.GetOrAdd(p).Shot(); } } public static void ClearDrawFX(Player p) { if (!((Object)(object)p == (Object)null)) { FocusFXHolder component = ((Component)p).GetComponent(); if ((Object)(object)component != (Object)null) { component.Clear(); } } } } public class FocusShotMarker : MonoBehaviour { } public class FatiguePatch { public static class Player_OnSpawned_Fatigue_Patch { public static void Postfix(Player __instance) { if (((Character)__instance).IsOwner()) { SEMan sEMan = ((Character)__instance).GetSEMan(); if (sEMan != null && !sEMan.HaveStatusEffect(SE_Fatigue.NameHash)) { sEMan.AddStatusEffect(SE_Fatigue.NameHash, false, 0, 0f); Debug.Log((object)"[NazhikaCore] SE_Fatigue agregado en OnSpawned."); } } } } public static class Player_Load_Fatigue_Patch { public static void Postfix(Player __instance) { if (((Character)__instance).IsOwner()) { SEMan sEMan = ((Character)__instance).GetSEMan(); if (sEMan != null && !sEMan.HaveStatusEffect(SE_Fatigue.NameHash)) { sEMan.AddStatusEffect(SE_Fatigue.NameHash, false, 0, 0f); Debug.Log((object)"[NazhikaCore] SE_Fatigue agregado en Load."); } } } } public static void Init(Harmony harmony) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected O, but got Unknown harmony.Patch((MethodBase)AccessTools.Method(typeof(Player), "OnSpawned", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(Player_OnSpawned_Fatigue_Patch), "Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)AccessTools.Method(typeof(Player), "Load", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(Player_Load_Fatigue_Patch), "Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Debug.Log((object)"[NazhikaCore] FatiguePatch inicializado."); } } public static class FistBjornClawRecipePatch { private const string LOG = "[NazhikaCore/FistBjornClawRecipe]"; public static void Init(Harmony harmony) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown harmony.Patch((MethodBase)AccessTools.Method(typeof(ObjectDB), "Awake", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(FistBjornClawRecipePatch), "ObjectDB_Awake_Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Log.Info("[NazhikaCore/FistBjornClawRecipe] Patch registrado."); } private static void ObjectDB_Awake_Postfix(ObjectDB __instance) { //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_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0160: 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) //IL_016f: Expected O, but got Unknown //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0189: 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_0198: Expected O, but got Unknown //IL_019a: 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_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Expected O, but got Unknown if ((Object)(object)__instance == (Object)null) { return; } Recipe val = null; foreach (Recipe recipe in __instance.m_recipes) { if ((Object)(object)recipe?.m_item != (Object)null && ((Object)((Component)recipe.m_item).gameObject).name == "FistBjornClaw") { val = recipe; break; } } if ((Object)(object)val == (Object)null) { Log.Warning("[NazhikaCore/FistBjornClawRecipe] Receta 'FistBjornClaw' no encontrada."); return; } GameObject itemPrefab = __instance.GetItemPrefab("piece_workbench"); if ((Object)(object)itemPrefab != (Object)null) { CraftingStation component = itemPrefab.GetComponent(); if ((Object)(object)component != (Object)null) { val.m_craftingStation = component; val.m_minStationLevel = 1; } } GameObject itemPrefab2 = __instance.GetItemPrefab("DeerHide"); GameObject itemPrefab3 = __instance.GetItemPrefab("LeatherScraps"); GameObject itemPrefab4 = __instance.GetItemPrefab("Flint"); if ((Object)(object)itemPrefab2 == (Object)null || (Object)(object)itemPrefab3 == (Object)null || (Object)(object)itemPrefab4 == (Object)null) { Log.Warning("[NazhikaCore/FistBjornClawRecipe] Uno o más materiales no encontrados. " + $"DeerHide={(Object)(object)itemPrefab2 != (Object)null} LeatherScraps={(Object)(object)itemPrefab3 != (Object)null} Flint={(Object)(object)itemPrefab4 != (Object)null}"); return; } val.m_resources = (Requirement[])(object)new Requirement[3] { new Requirement { m_resItem = itemPrefab2.GetComponent(), m_amount = 3, m_amountPerLevel = 0, m_recover = true }, new Requirement { m_resItem = itemPrefab3.GetComponent(), m_amount = 3, m_amountPerLevel = 0, m_recover = true }, new Requirement { m_resItem = itemPrefab4.GetComponent(), m_amount = 10, m_amountPerLevel = 0, m_recover = true } }; Log.Info("[NazhikaCore/FistBjornClawRecipe] Receta de FistBjornClaw actualizada: 3 DeerHide + 3 LeatherScraps + 10 Flint @ Workbench lvl 1."); } } public static class Monk_KiPatches { private const string RpcAddKi = "NC_MonkAddKi"; public static void Init(Harmony harmony) { harmony.PatchAll(typeof(Monk_KiPatches)); Debug.Log((object)"[NazhikaCore] Monk_KiPatches inicializado."); } [HarmonyPatch(typeof(Player), "Awake")] [HarmonyPostfix] private static void Player_Awake_Postfix(Player __instance) { ZNetView nview = ((Character)__instance).m_nview; if (nview != null) { nview.Register("NC_MonkAddKi", (Action)RPC_MonkAddKi); } } [HarmonyPatch(typeof(Character), "RPC_Damage")] [HarmonyPostfix] private static void RPC_Damage_Postfix(Character __instance, long sender, HitData hit) { if (hit == null) { return; } Character attacker = hit.GetAttacker(); Player val = (Player)(object)((attacker is Player) ? attacker : null); if ((Object)(object)val == (Object)null) { return; } ZNetView nview = ((Character)val).m_nview; ZDO val2 = ((nview != null) ? nview.GetZDO() : null); if (val2 == null) { return; } string @string = val2.GetString("naz_class", string.Empty); if (!(@string != "Monk")) { ZNetView nview2 = ((Character)val).m_nview; if (nview2.IsValid()) { nview2.InvokeRPC("NC_MonkAddKi", Array.Empty()); } } } private static void RPC_MonkAddKi(long sender) { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { return; } ZNetView nview = ((Character)localPlayer).m_nview; ZDO val = ((nview != null) ? nview.GetZDO() : null); if (val != null) { string @string = val.GetString("naz_class", string.Empty); if (!(@string != "Monk")) { SE_OrbGauge.AddKiOnHit(localPlayer); } } } } [HarmonyPatch] public static class LightningStorm_BlockAttackPatch { public static void Init(Harmony harmony) { harmony.PatchAll(typeof(LightningStorm_BlockAttackPatch)); } [HarmonyPatch(typeof(Attack), "Start", new Type[] { typeof(Humanoid), typeof(Rigidbody), typeof(ZSyncAnimation), typeof(CharacterAnimEvent), typeof(VisEquipment), typeof(ItemData), typeof(Attack), typeof(float), typeof(float) })] [HarmonyPrefix] private static bool BlockAttackWhileLightningStorm(Humanoid character, ref bool __result) { Player val = (Player)(object)((character is Player) ? character : null); if (val == null) { return true; } SEMan sEMan = ((Character)val).GetSEMan(); if (sEMan == null) { return true; } if (!sEMan.HaveStatusEffect(SE_LightningStorm.NameHash)) { return true; } __result = false; return false; } } [HarmonyPatch] public static class LoginClasses { public static void Init(Harmony harmony) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected O, but got Unknown MethodInfo methodInfo = AccessTools.Method(typeof(Player), "OnSpawned", (Type[])null, (Type[])null); harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(typeof(LoginClasses), "Postfix_OnSpawned", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); MethodInfo methodInfo2 = AccessTools.Method(typeof(Player), "Awake", (Type[])null, (Type[])null); harmony.Patch((MethodBase)methodInfo2, (HarmonyMethod)null, new HarmonyMethod(typeof(LoginClasses), "Postfix_PlayerAwake", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Log.Info("[LoginClasses] ✅ Parches aplicados (OnSpawned + Player.Awake) — ZNetView-only + Perfil"); } private static void Postfix_PlayerAwake(Player __instance) { ZNetView val = (((Object)(object)__instance != (Object)null) ? ((Character)__instance).m_nview : null); if (!((Object)(object)val == (Object)null)) { Log.Info("[LoginClasses] ZNV.Register para '" + __instance.GetPlayerName() + "'"); val.Register("RPC_Class_Set", (Action)delegate(long sender, string classKey) { RPC_Class_Set(__instance, sender, classKey); }); val.Register("RPC_Class_Clear", (Action)delegate(long sender) { RPC_Class_Clear(__instance, sender); }); val.Register("RPC_Class_ActivateSkill", (Action)delegate(long sender) { RPC_Class_ActivateSkill(__instance, sender); }); } } private static void Postfix_OnSpawned(Player __instance) { Log.Info("[LoginClasses] OnSpawned '" + __instance.GetPlayerName() + "'"); ClassManager.RestoreClassFromZDO(__instance); string savedKey = ClassManager.GetSavedKey(__instance); if (!string.IsNullOrEmpty(savedKey)) { return; } string text = LoadClassFromProfile(__instance); if (!string.IsNullOrEmpty(text) && ClassManager.IsValidClass(text)) { ClassManager.SetSavedKey(__instance, text); ZNetView nview = ((Character)__instance).m_nview; ZDO val = ((nview != null) ? nview.GetZDO() : null); if (val != null) { TrySetOwnerIfAvailable(val); TryIncreaseDataRevision(val); } ClassManager.ApplyPassiveForKey(__instance, text); Log.Info("[OnSpawned] restaurado desde perfil → " + text); } } private static void RPC_Class_Set(Player player, long sender, string classKey) { if ((Object)(object)player == (Object)null) { Log.Info("[RPC_Class_Set] ❌ player null"); return; } if (!ClassManager.IsValidClass(classKey)) { ((Character)player).Message((MessageType)2, "Clase '" + classKey + "' no existe.", 0, (Sprite)null); Log.Info("[RPC_Class_Set] ❌ Clase inexistente '" + classKey + "'"); return; } ZDO val = (((Object)(object)((Character)player).m_nview != (Object)null) ? ((Character)player).m_nview.GetZDO() : null); if (val == null) { Log.Info("[RPC_Class_Set] ❌ sin ZDO"); return; } string @string = val.GetString("naz_class", string.Empty); if (!string.IsNullOrEmpty(@string) && @string != classKey) { ClassManager.RemovePassiveForKey(player, @string); } ClassManager.SetSavedKey(player, classKey); TrySetOwnerIfAvailable(val); TryIncreaseDataRevision(val); SaveClassToProfile(player, classKey); ClassManager.ApplyPassiveForKey(player, classKey); ((Character)player).Message((MessageType)2, "Clase asignada: " + classKey, 0, (Sprite)null); Log.Info("[RPC_Class_Set] ✅ " + player.GetPlayerName() + " → " + classKey); } private static void RPC_Class_Clear(Player player, long sender) { if ((Object)(object)player == (Object)null) { Log.Info("[RPC_Class_Clear] ❌ player null"); return; } ZDO val = (((Object)(object)((Character)player).m_nview != (Object)null) ? ((Character)player).m_nview.GetZDO() : null); if (val == null) { Log.Info("[RPC_Class_Clear] ❌ sin ZDO"); return; } string @string = val.GetString("naz_class", string.Empty); if (!string.IsNullOrEmpty(@string)) { ClassManager.RemovePassiveForKey(player, @string); } ClassManager.SetSavedKey(player, string.Empty); TrySetOwnerIfAvailable(val); TryIncreaseDataRevision(val); SaveClassToProfile(player, string.Empty); ((Character)player).Message((MessageType)2, "Clase removida", 0, (Sprite)null); Log.Info("[RPC_Class_Clear] ✅ " + player.GetPlayerName() + " sin clase"); } private static void RPC_Class_ActivateSkill(Player player, long sender) { if ((Object)(object)player == (Object)null) { Log.Info("[RPC_Class_ActivateSkill] ❌ player null"); } else { ClassManager.ActivateSkill(player); } } private static void SaveClassToProfile(Player p, string key) { try { MethodInfo method = typeof(Player).GetMethod("SetCustomData", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method != null) { method.Invoke(p, new object[2] { "naz_class", key ?? "" }); } else { FieldInfo field = typeof(Player).GetField("m_customData", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null && field.GetValue(p) is Dictionary dictionary) { dictionary["naz_class"] = key ?? ""; } } TryInvokeGameSaveProfile(); Log.Info("[LoginClasses] Perfil guardado inmediatamente (naz_class)."); } catch (Exception ex) { Log.Info("[LoginClasses] SaveClassToProfile error (no crítico): " + ex.Message); } } private static string LoadClassFromProfile(Player p) { try { MethodInfo method = typeof(Player).GetMethod("GetCustomData", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method != null) { string text = method.Invoke(p, new object[1] { "naz_class" }) as string; return text ?? ""; } FieldInfo field = typeof(Player).GetField("m_customData", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null && field.GetValue(p) is Dictionary dictionary && dictionary.TryGetValue("naz_class", out var value)) { return value ?? ""; } } catch (Exception ex) { Log.Info("[LoginClasses] LoadClassFromProfile error: " + ex.Message); } return ""; } private static void TrySetOwnerIfAvailable(ZDO zdo) { try { ZDOMan instance = ZDOMan.instance; if (instance != null) { MethodInfo method = typeof(ZDOMan).GetMethod("GetMyID", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); MethodInfo method2 = typeof(ZDO).GetMethod("SetOwner", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method != null && method2 != null) { object obj = method.Invoke(instance, null); method2.Invoke(zdo, new object[1] { obj }); } } } catch (Exception ex) { Log.Info("[LoginClasses] SetOwner reflection error (no crítico): " + ex.Message); } } private static void TryIncreaseDataRevision(ZDO zdo) { try { MethodInfo method = typeof(ZDO).GetMethod("IncreaseDataRevision", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method != null) { method.Invoke(zdo, null); } } catch (Exception ex) { Log.Info("[LoginClasses] IncreaseDataRevision reflection error (no crítico): " + ex.Message); } } private static bool TryInvokeGameSaveProfile() { try { Game instance = Game.instance; if ((Object)(object)instance == (Object)null) { return false; } MethodInfo method = typeof(Game).GetMethod("SavePlayerProfile", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[1] { typeof(bool) }, null); if (method != null) { method.Invoke(instance, new object[1] { false }); return true; } method = typeof(Game).GetMethod("SavePlayerProfileThreadsafe", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[1] { typeof(bool) }, null); if (method != null) { method.Invoke(instance, new object[1] { false }); return true; } } catch (Exception ex) { Log.Info("[LoginClasses] Game save reflection error: " + ex.Message); } return false; } } [HarmonyPatch] public static class MonkLeapPatches { private static bool s_initialized; private const float MinLeapInterval = 1.5f; private static float s_lastLeapTime = -999f; public static void Init(Harmony harmony) { if (!s_initialized) { s_initialized = true; harmony.PatchAll(typeof(MonkLeapPatches)); Debug.Log((object)"[NazhikaCore] MonkLeapPatches initialized."); } } [HarmonyPatch(typeof(Humanoid), "StartAttack")] [HarmonyPrefix] private static bool Prefix_StartAttack(Humanoid __instance, Character target, bool secondaryAttack) { if (!secondaryAttack) { return true; } Player val = (Player)(object)((__instance is Player) ? __instance : null); if ((Object)(object)val == (Object)null) { return true; } if ((Object)(object)val != (Object)(object)Player.m_localPlayer) { return true; } if (!val.IsClass()) { return true; } if (((Character)val).IsDead() || ((Character)val).InCutscene()) { return true; } if (Time.time - s_lastLeapTime < 1.5f) { return false; } if (MonkLeapSkill.TryActivate(val)) { s_lastLeapTime = Time.time; val.m_queuedSecondAttackTimer = 0f; } return false; } } public static class SwordPatches { private const bool OnlyForSwords = true; private const float FlatLightningBonus = 15f; private const float PctPhysicalToLightning = 0.25f; private const bool EnablePoison = true; private const float FlatPoisonBonus = 10f; private const float PctPhysicalToPoison = 0.1f; private const string ZdoKeyLightning = "swordlight_active"; private const string ZdoKeyPoison = "swordpoison_active"; public static void Init(Harmony harmony) { Patch_AddLightning_OnRpcDamage(harmony); Patch_AddPoison_OnRpcDamage(harmony); Debug.Log((object)"[NazhikaCore] SwordPatches.Init => parches (Lightning aditivo, Poison aditivo)"); } private static void Patch_AddLightning_OnRpcDamage(Harmony harmony) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown MethodInfo methodInfo = AccessTools.Method(typeof(Character), "RPC_Damage", (Type[])null, (Type[])null); HarmonyMethod val = new HarmonyMethod(typeof(SwordPatches), "RPC_Damage_AddLightning_Prefix", (Type[])null); harmony.Patch((MethodBase)methodInfo, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Debug.Log((object)"[NazhikaCore] Patch OK -> Character.RPC_Damage (Sword → +Lightning ADITIVO)"); } private static void RPC_Damage_AddLightning_Prefix(Character __instance, HitData hit) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Invalid comparison between Unknown and I4 try { if (hit == null || ((Object)(object)ZNet.instance != (Object)null && !ZNet.instance.IsServer()) || ((ZDOID)(ref hit.m_attacker)).IsNone() || hit.m_attacker == __instance.GetZDOID()) { return; } Character val = ResolveAttacker(hit); Player val2 = (Player)(object)((val is Player) ? val : null); if (val2 == null) { return; } ZNetView component = ((Component)val2).GetComponent(); if (!((Object)(object)component == (Object)null) && component.IsValid() && component.GetZDO() != null && component.GetZDO().GetInt("swordlight_active", 0) == 1 && (int)GetEffectiveSkill((Humanoid)(object)val2, hit) == 1) { float num = hit.m_damage.m_pierce + hit.m_damage.m_slash + hit.m_damage.m_blunt; float num2 = Mathf.Max(0f, 15f + num * Mathf.Max(0f, 0.25f)); if (num2 > 0f) { hit.m_damage.m_lightning += num2; } } } catch { } } private static void Patch_AddPoison_OnRpcDamage(Harmony harmony) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown MethodInfo methodInfo = AccessTools.Method(typeof(Character), "RPC_Damage", (Type[])null, (Type[])null); HarmonyMethod val = new HarmonyMethod(typeof(SwordPatches), "RPC_Damage_AddPoison_Prefix", (Type[])null); harmony.Patch((MethodBase)methodInfo, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Debug.Log((object)"[NazhikaCore] Patch OK -> Character.RPC_Damage (Sword → +Poison ADITIVO)"); } private static void RPC_Damage_AddPoison_Prefix(Character __instance, HitData hit) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Invalid comparison between Unknown and I4 try { if (hit == null || ((Object)(object)ZNet.instance != (Object)null && !ZNet.instance.IsServer()) || ((ZDOID)(ref hit.m_attacker)).IsNone() || hit.m_attacker == __instance.GetZDOID()) { return; } Character val = ResolveAttacker(hit); Player val2 = (Player)(object)((val is Player) ? val : null); if (val2 == null) { return; } ZNetView component = ((Component)val2).GetComponent(); if (!((Object)(object)component == (Object)null) && component.IsValid() && component.GetZDO() != null && component.GetZDO().GetInt("swordpoison_active", 0) == 1 && (int)GetEffectiveSkill((Humanoid)(object)val2, hit) == 1) { float num = hit.m_damage.m_pierce + hit.m_damage.m_slash + hit.m_damage.m_blunt; float num2 = Mathf.Max(0f, 10f + num * Mathf.Max(0f, 0.1f)); if (num2 > 0f) { hit.m_damage.m_poison += num2; } } } catch { } } private static Character ResolveAttacker(HitData hit) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) Character attacker = hit.GetAttacker(); if ((Object)(object)attacker != (Object)null) { return attacker; } if (((ZDOID)(ref hit.m_attacker)).IsNone() || (Object)(object)ZNetScene.instance == (Object)null) { return null; } GameObject val = ZNetScene.instance.FindInstance(hit.m_attacker); if (!Object.op_Implicit((Object)(object)val)) { return null; } return val.GetComponent(); } private static SkillType GetEffectiveSkill(Humanoid h, HitData hit) { //IL_0035: 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) ItemData val = ((h != null) ? h.GetCurrentWeapon() : null) ?? ((h != null) ? h.GetRightItem() : null); if (val != null && val.m_shared != null) { return val.m_shared.m_skillType; } return hit.m_skill; } } public static class TankAi { [HarmonyPatch(typeof(BaseAI), "FindEnemy")] private static class BaseAIFindEnemyPatch { [HarmonyPostfix] public static void Postfix(BaseAI __instance, ref Character __result) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) foreach (Player allPlayer in Player.GetAllPlayers()) { if ((Object)(object)allPlayer == (Object)null || ((Character)allPlayer).IsDead()) { continue; } float num = Vector3.Distance(((Component)allPlayer).transform.position, ((Component)__instance).transform.position); if (num < 25f) { ZNetView nview = ((Character)allPlayer).m_nview; ZDO val = ((nview != null) ? nview.GetZDO() : null); if (val != null && val.GetBool("naz_tank_agro", false)) { __result = (Character)(object)allPlayer; break; } } } } } [HarmonyPatch(typeof(BaseAI), "SetAlerted")] private static class BaseAISetAlertedPatch { [HarmonyPostfix] public static void Postfix(BaseAI __instance) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) foreach (Player allPlayer in Player.GetAllPlayers()) { if ((Object)(object)allPlayer == (Object)null || ((Character)allPlayer).IsDead()) { continue; } ZNetView nview = ((Character)allPlayer).m_nview; ZDO val = ((nview != null) ? nview.GetZDO() : null); if (val != null && val.GetBool("naz_tank_agro", false)) { float num = Vector3.Distance(((Component)allPlayer).transform.position, ((Component)__instance).transform.position); if (num < 25f) { AccessTools.Method(typeof(BaseAI), "FindEnemy", (Type[])null, (Type[])null)?.Invoke(__instance, null); break; } } } } } public static void Init(Harmony harmony) { harmony.PatchAll(typeof(BaseAIFindEnemyPatch)); harmony.PatchAll(typeof(BaseAISetAlertedPatch)); } } public static class Player_CheerEmoteRPC { public const string RpcCheer = "RPC_Nazhika_PlayCheer"; private static Harmony _harmony; private static bool _patched; public static void Init(Harmony harmony) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown if (!_patched) { _patched = true; _harmony = harmony; MethodInfo methodInfo = AccessTools.Method(typeof(Player), "Awake", (Type[])null, (Type[])null); MethodInfo methodInfo2 = AccessTools.Method(typeof(Player_CheerEmoteRPC), "PlayerAwake_Postfix", (Type[])null, (Type[])null); harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } private static void PlayerAwake_Postfix(Player __instance) { if ((Object)(object)((Character)(__instance?)).m_nview == (Object)null || !((Character)__instance).m_nview.IsValid()) { return; } ((Character)__instance).m_nview.Register("RPC_Nazhika_PlayCheer", (Action)delegate { if (Object.op_Implicit((Object)(object)((Character)__instance).m_animator)) { ((Character)__instance).m_animator.SetTrigger("emote_cheer"); } }); } } public static class Player_ToxicCloudRPC { public const string RpcSpawnToxicCloud = "RPC_NC_SpawnToxicCloud"; private const string ToxicFxPrefab = "bonemass_aoe"; private static readonly Color ToxicPurple = new Color(0.6f, 0.1f, 0.8f, 1f); private const float FxRootScale = 0.45f; private const float FxSizeScale = 0.65f; private const float ToxicRadius = 8f; private const float ToxicTickDamage = 20f; private const float ToxicTickInterval = 1f; private const float ToxicDuration = 10f; private const string SplashSpawnerName = "Splash spawner"; private const string KeepChildName = "ooz (1)"; private const string KillChild1Name = "splash_overtime"; private const string KillChild2Name = "wetsplash"; private const string PointLightToken = "point light"; private static bool _patched; public static void Init(Harmony harmony) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown if (_patched) { return; } _patched = true; try { MethodInfo methodInfo = AccessTools.Method(typeof(Player), "Awake", (Type[])null, (Type[])null); harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(typeof(Player_ToxicCloudRPC), "Player_Awake_Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Debug.Log((object)"[NazhikaCore] ✅ Player_ToxicCloudRPC Init OK"); } catch (Exception ex) { Debug.LogWarning((object)("[NazhikaCore] Player_ToxicCloudRPC Init error: " + ex.Message)); } } private static void Player_Awake_Postfix(Player __instance) { try { if (!((Object)(object)((Character)(__instance?)).m_nview == (Object)null) && ((Character)__instance).m_nview.IsValid()) { ((Character)__instance).m_nview.Register("RPC_NC_SpawnToxicCloud", (Action)RPC_SpawnToxicCloud); } } catch (Exception ex) { Debug.LogWarning((object)("[NazhikaCore] Player_ToxicCloudRPC register error: " + ex.Message)); } } private static void RPC_SpawnToxicCloud(long sender, ZPackage pkg) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_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_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) try { Vector3 center = pkg.ReadVector3(); ZDOID casterZDOID = ZDOID.None; foreach (Player s_player in Player.s_players) { if (((Character)s_player).GetOwner() == sender) { casterZDOID = ((Character)s_player).GetZDOID(); break; } } SpawnFx_Purple_Ooz1_Only(center); SpawnPoisonDamager(center, casterZDOID); } catch (Exception ex) { Debug.LogWarning((object)("[NazhikaCore] RPC_SpawnToxicCloud error: " + ex.Message)); } } private static void SpawnPoisonDamager(Vector3 center, ZDOID casterZDOID) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0011: 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_0034: Unknown result type (might be due to invalid IL or missing references) try { GameObject val = new GameObject("ToxicCloud_Damager"); val.transform.position = center; ToxicCloudDamager toxicCloudDamager = val.AddComponent(); toxicCloudDamager.Init(center, 8f, 20f, 1f, 10f, casterZDOID); } catch (Exception ex) { Debug.LogWarning((object)("[NazhikaCore] SpawnPoisonDamager error: " + ex.Message)); } } private static void SpawnFx_Purple_Ooz1_Only(Vector3 center) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Expected O, but got Unknown try { if ((Object)(object)ZNetScene.instance == (Object)null) { return; } GameObject prefab = ZNetScene.instance.GetPrefab("bonemass_aoe"); if ((Object)(object)prefab == (Object)null) { Debug.LogWarning((object)"[NazhikaCore] FX prefab no encontrado: \"bonemass_aoe\""); return; } GameObject val = Object.Instantiate(prefab, center, Quaternion.identity); ((Object)val).name = "fx_NC_ToxicCloud_Purple"; Transform transform = val.transform; transform.localScale *= 0.45f; Transform val2 = FindChildByName(val.transform, "Splash spawner"); if ((Object)(object)val2 == (Object)null) { Debug.LogWarning((object)"[NazhikaCore] No se encontró \"Splash spawner\" dentro de bonemass_aoe."); } else { if (!((Component)val2).gameObject.activeSelf) { ((Component)val2).gameObject.SetActive(true); } foreach (Transform item in val2) { Transform val3 = item; if (Object.op_Implicit((Object)(object)val3)) { string name = ((Object)((Component)val3).gameObject).name; if (EqualsName(name, "ooz (1)")) { ((Component)val3).gameObject.SetActive(true); PlayAllParticlesUnder(((Component)val3).gameObject, play: true); } else if (EqualsName(name, "splash_overtime") || EqualsName(name, "wetsplash")) { ((Component)val3).gameObject.SetActive(false); } else { ((Component)val3).gameObject.SetActive(false); } } } } ForceEnablePointLights(val); TintAllLights(val, ToxicPurple); ForceTintAllRenderers(val, ToxicPurple); RecolorAllParticlesHard(val, ToxicPurple); ScaleAllParticleSystems(val, 0.65f); } catch (Exception ex) { Debug.LogWarning((object)("[NazhikaCore] SpawnFx_Purple_Ooz1_Only error: " + ex.Message)); } } private static void ScaleAllParticleSystems(GameObject root, float sizeScale) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) try { ParticleSystem[] componentsInChildren = root.GetComponentsInChildren(true); ParticleSystem[] array = componentsInChildren; foreach (ParticleSystem val in array) { if (Object.op_Implicit((Object)(object)val)) { MainModule main = val.main; ((MainModule)(ref main)).startSize = ScaleMinMaxCurve(((MainModule)(ref main)).startSize, sizeScale); TrailModule trails = val.trails; if (((TrailModule)(ref trails)).enabled) { ((TrailModule)(ref trails)).widthOverTrail = ScaleMinMaxCurve(((TrailModule)(ref trails)).widthOverTrail, sizeScale); } } } } catch { } } private static MinMaxCurve ScaleMinMaxCurve(MinMaxCurve curve, float scale) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected I4, but got Unknown //IL_0060: Unknown result type (might be due to invalid IL or missing references) ParticleSystemCurveMode mode = ((MinMaxCurve)(ref curve)).mode; switch ((int)mode) { case 0: ((MinMaxCurve)(ref curve)).constant = ((MinMaxCurve)(ref curve)).constant * scale; break; case 3: ((MinMaxCurve)(ref curve)).constantMin = ((MinMaxCurve)(ref curve)).constantMin * scale; ((MinMaxCurve)(ref curve)).constantMax = ((MinMaxCurve)(ref curve)).constantMax * scale; break; case 1: case 2: ((MinMaxCurve)(ref curve)).curveMultiplier = ((MinMaxCurve)(ref curve)).curveMultiplier * scale; break; } return curve; } private static void PlayAllParticlesUnder(GameObject root, bool play) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) try { ParticleSystem[] componentsInChildren = root.GetComponentsInChildren(true); ParticleSystem[] array = componentsInChildren; foreach (ParticleSystem val in array) { if (Object.op_Implicit((Object)(object)val)) { EmissionModule emission = val.emission; ((EmissionModule)(ref emission)).enabled = true; if (play) { val.Play(true); } else { val.Stop(true, (ParticleSystemStopBehavior)1); } } } } catch { } } private static void TintAllLights(GameObject root, Color c) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) try { Light[] componentsInChildren = root.GetComponentsInChildren(true); Light[] array = componentsInChildren; foreach (Light val in array) { if (Object.op_Implicit((Object)(object)val)) { ((Behaviour)val).enabled = true; val.color = c; } } } catch { } } private static void RecolorAllParticlesHard(GameObject root, Color color) { //IL_0021: 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) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) try { ParticleSystem[] componentsInChildren = root.GetComponentsInChildren(true); ParticleSystem[] array = componentsInChildren; foreach (ParticleSystem val in array) { if (Object.op_Implicit((Object)(object)val)) { MainModule main = val.main; ((MainModule)(ref main)).startColor = new MinMaxGradient(color); ColorOverLifetimeModule colorOverLifetime = val.colorOverLifetime; if (((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled) { ((ColorOverLifetimeModule)(ref colorOverLifetime)).color = new MinMaxGradient(MakeSolidGradient(color)); } ColorBySpeedModule colorBySpeed = val.colorBySpeed; if (((ColorBySpeedModule)(ref colorBySpeed)).enabled) { ((ColorBySpeedModule)(ref colorBySpeed)).color = new MinMaxGradient(MakeSolidGradient(color)); } TrailModule trails = val.trails; if (((TrailModule)(ref trails)).enabled) { ((TrailModule)(ref trails)).colorOverLifetime = new MinMaxGradient(MakeSolidGradient(color)); ((TrailModule)(ref trails)).colorOverTrail = new MinMaxGradient(MakeSolidGradient(color)); } } } } catch { } } private static Gradient MakeSolidGradient(Color c) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) Gradient val = new Gradient(); val.SetKeys((GradientColorKey[])(object)new GradientColorKey[2] { new GradientColorKey(c, 0f), new GradientColorKey(c, 1f) }, (GradientAlphaKey[])(object)new GradientAlphaKey[2] { new GradientAlphaKey(c.a, 0f), new GradientAlphaKey(c.a, 1f) }); return val; } private static void ForceTintAllRenderers(GameObject root, Color color) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) try { Renderer[] componentsInChildren = root.GetComponentsInChildren(true); foreach (Renderer val in componentsInChildren) { if (!Object.op_Implicit((Object)(object)val)) { continue; } Material[] materials = val.materials; for (int j = 0; j < materials.Length; j++) { Material val2 = materials[j]; if (Object.op_Implicit((Object)(object)val2)) { Material val3 = new Material(val2); SetCommonMaterialColors(val3, color); materials[j] = val3; } } val.materials = materials; } } catch { } } private static void SetCommonMaterialColors(Material mat, Color color) { //IL_0087: 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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)mat)) { return; } try { if (mat.HasProperty("_Color")) { mat.SetColor("_Color", color); } } catch { } try { if (mat.HasProperty("_TintColor")) { mat.SetColor("_TintColor", color); } } catch { } try { if (mat.HasProperty("_EmissionColor")) { mat.SetColor("_EmissionColor", color); } } catch { } try { if (mat.HasProperty("_BaseColor")) { mat.SetColor("_BaseColor", color); } } catch { } try { mat.color = color; } catch { } } private static void ForceEnablePointLights(GameObject root) { try { Light[] componentsInChildren = root.GetComponentsInChildren(true); Light[] array = componentsInChildren; foreach (Light val in array) { if (Object.op_Implicit((Object)(object)val) && ContainsTokenInsensitive(((Object)((Component)val).gameObject).name, "point light")) { ((Behaviour)val).enabled = true; if (!((Component)val).gameObject.activeSelf) { ((Component)val).gameObject.SetActive(true); } } } } catch { } } private static Transform FindChildByName(Transform root, string exactName) { if (!Object.op_Implicit((Object)(object)root) || string.IsNullOrEmpty(exactName)) { return null; } Transform[] componentsInChildren = ((Component)root).GetComponentsInChildren(true); Transform[] array = componentsInChildren; foreach (Transform val in array) { if (Object.op_Implicit((Object)(object)val) && EqualsName(((Object)((Component)val).gameObject).name, exactName)) { return val; } } return null; } private static bool EqualsName(string a, string b) { return string.Equals(a?.Trim(), b?.Trim(), StringComparison.OrdinalIgnoreCase); } private static bool ContainsTokenInsensitive(string s, string token) { if (string.IsNullOrEmpty(s) || string.IsNullOrEmpty(token)) { return false; } return s.IndexOf(token, StringComparison.OrdinalIgnoreCase) >= 0; } } public class ToxicCloudDamager : MonoBehaviour { private float _radius; private float _tickDamage; private float _tickInterval; private float _duration; private ZDOID _casterZDOID; private float _elapsed; private float _tickTimer; public void Init(Vector3 pos, float radius, float tickDamage, float tickInterval, float duration, ZDOID casterZDOID) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) ((Component)this).transform.position = pos; _radius = radius; _tickDamage = tickDamage; _tickInterval = tickInterval; _duration = duration; _casterZDOID = casterZDOID; } private void Update() { _elapsed += Time.deltaTime; _tickTimer += Time.deltaTime; if (_elapsed >= _duration) { Object.Destroy((Object)(object)((Component)this).gameObject); } else if (_tickTimer >= _tickInterval) { _tickTimer = 0f; ApplyPoisonTick(); } } private void ApplyPoisonTick() { //IL_000c: 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_0063: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) List list = new List(); Character.GetCharactersInRange(((Component)this).transform.position, _radius, list); foreach (Character item in list) { if (!((Object)(object)item == (Object)null) && !item.IsDead()) { Player val = (Player)(object)((item is Player) ? item : null); if (val == null || !(((Character)val).GetZDOID() == _casterZDOID)) { HitData val2 = new HitData(); val2.m_damage.m_poison = _tickDamage; val2.m_point = ((Component)item).transform.position; val2.m_dir = Vector3.up; val2.SetAttacker((Character)null); item.Damage(val2); } } } } } } namespace NazhikaCore.Fx { public static class FocusFX { private const string FxSupportPrefab = "fx_DvergerMage_Support_start"; private const string FxBugPrefab = "vfx_BugRepellent"; private const string FxShotAoePrefab = "Catapult_Ammo_Projectile_AOE"; private static long Pid(Player p) { if (!((Object)(object)p != (Object)null)) { return 0L; } return p.GetPlayerID(); } private static FocusFXHolder GetOrAddHolder(Player p) { return ((Component)p).GetComponent() ?? ((Component)p).gameObject.AddComponent(); } public static bool HasDrawFX(Player p) { if ((Object)(object)p == (Object)null) { return false; } FocusFXHolder component = ((Component)p).GetComponent(); if ((Object)(object)component != (Object)null) { return component.HasFX; } return false; } public static void StartDrawFX(Player p) { if (!((Object)(object)p == (Object)null) && !((Object)(object)ZNetScene.instance == (Object)null) && !((Character)p).IsTeleporting()) { GetOrAddHolder(p).StartDraw(); } } public static void ShotFX(Player p) { if (!((Object)(object)p == (Object)null) && !((Object)(object)ZNetScene.instance == (Object)null) && !((Character)p).IsTeleporting()) { GetOrAddHolder(p).Shot(); } } public static void ClearDrawFX(Player p) { if (!((Object)(object)p == (Object)null)) { FocusFXHolder component = ((Component)p).GetComponent(); if ((Object)(object)component != (Object)null) { component.Clear(); } } } } public class FocusFXHolder : MonoBehaviour { private const string FxSupportPrefab = "fx_DvergerMage_Support_start"; private const string FxBugPrefab = "vfx_BugRepellent"; private const string FxShotAoePrefab = "Catapult_Ammo_Projectile_AOE"; private Player _player; private GameObject _fxSupport; private GameObject _fxBug; public bool HasFX { get { if (!((Object)(object)_fxSupport != (Object)null)) { return (Object)(object)_fxBug != (Object)null; } return true; } } private void Awake() { _player = ((Component)this).GetComponent(); } private void OnDisable() { Cleanup(); } private void OnDestroy() { Cleanup(); } public void StartDraw() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) if (!HasFX) { GameObject val = SpawnOnPlayer("fx_DvergerMage_Support_start", parentToPlayer: true); if (Object.op_Implicit((Object)(object)val)) { _fxSupport = val; } GameObject val2 = SpawnOnPlayer("vfx_BugRepellent", parentToPlayer: true); if (Object.op_Implicit((Object)(object)val2)) { RecolorAllParticles(val2, Color.red); _fxBug = val2; } } } public void Shot() { SpawnOnPlayer("Catapult_Ammo_Projectile_AOE", parentToPlayer: false); } public void Clear() { Cleanup(); } private void Cleanup() { if ((Object)(object)_fxSupport != (Object)null) { Object.Destroy((Object)(object)_fxSupport); _fxSupport = null; } if ((Object)(object)_fxBug != (Object)null) { Object.Destroy((Object)(object)_fxBug); _fxBug = null; } } private GameObject SpawnOnPlayer(string prefabName, bool parentToPlayer) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_player == (Object)null) { return null; } if (((Character)_player).IsTeleporting()) { return null; } if ((Object)(object)ZNetScene.instance == (Object)null) { return null; } GameObject prefab = ZNetScene.instance.GetPrefab(prefabName); if (!Object.op_Implicit((Object)(object)prefab)) { Debug.LogWarning((object)("[FocusFX] Prefab no encontrado: " + prefabName)); return null; } Vector3 val = ((Component)_player).transform.position + Vector3.up * 1.2f; GameObject val2 = Object.Instantiate(prefab, val, Quaternion.identity); if (parentToPlayer && (Object)(object)val2 != (Object)null) { val2.transform.SetParent(((Component)_player).transform, true); } return val2; } private static void RecolorAllParticles(GameObject root, Color c) { //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_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)root)) { ParticleSystem[] componentsInChildren = root.GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { MainModule main = componentsInChildren[i].main; ((MainModule)(ref main)).startColor = new MinMaxGradient(c); } } } } } namespace NazhikaCore.Features.DeathMessages { public static class ShoutDeath { private static class DeathPatch { internal static void RegisterRPC() { ZRoutedRpc.instance.Register("NazhikaDeath", (Action)OnDeathMessage); ManualLogSource log = _log; if (log != null) { log.LogInfo((object)"[ShoutDeath] RPC registrado en cliente."); } } private static void OnDeathMessage(long sender, string fullMessage) { ManualLogSource log = _log; if (log != null) { log.LogInfo((object)string.Format("[ShoutDeath] RPC recibido — sender={0}, mensaje='{1}', Chat.instance={2}", sender, fullMessage, ((Object)(object)Chat.instance == (Object)null) ? "NULL" : "OK")); } if ((Object)(object)Chat.instance != (Object)null) { ((Terminal)Chat.instance).AddString("☠ " + fullMessage + ""); Chat.instance.m_hideTimer = 0f; ((Component)((Terminal)Chat.instance).m_chatWindow).gameObject.SetActive(true); ManualLogSource log2 = _log; if (log2 != null) { log2.LogInfo((object)"[ShoutDeath] Mensaje agregado al chat local."); } } else { ManualLogSource log3 = _log; if (log3 != null) { log3.LogWarning((object)"[ShoutDeath] Chat.instance es null, no se pudo mostrar el mensaje."); } } } internal static void Postfix(Player __instance) { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Invalid comparison between Unknown and I4 if ((Object)(object)__instance == (Object)null || !((Character)__instance).IsPlayer()) { return; } HitData lastHit = ((Character)__instance).m_lastHit; string playerName = __instance.GetPlayerName(); ManualLogSource log = _log; if (log != null) { log.LogInfo((object)("[ShoutDeath] Postfix ejecutado — jugador='" + playerName + "', hit=" + ((lastHit == null) ? "NULL" : ((object)(HitType)(ref lastHit.m_hitType)).ToString()))); } string text; if (lastHit != null && _deathMessages.TryGetValue(lastHit.m_hitType, out var value)) { text = value.Value; ManualLogSource log2 = _log; if (log2 != null) { log2.LogInfo((object)$"[ShoutDeath] Mensaje por HitType '{lastHit.m_hitType}': '{text}'"); } if ((int)lastHit.m_hitType == 1) { Character attacker = lastHit.GetAttacker(); if ((Object)(object)attacker != (Object)null) { string hoverName = attacker.GetHoverName(); text = text + " " + hoverName; ManualLogSource log3 = _log; if (log3 != null) { log3.LogInfo((object)("[ShoutDeath] Atacante: '" + hoverName + "'")); } } else { ManualLogSource log4 = _log; if (log4 != null) { log4.LogWarning((object)"[ShoutDeath] EnemyHit pero attacker es null."); } } } } else { Character val = ((lastHit != null) ? lastHit.GetAttacker() : null); if ((Object)(object)val != (Object)null && !val.IsPlayer()) { string hoverName2 = val.GetHoverName(); text = "fue asesinado por " + hoverName2; ManualLogSource log5 = _log; if (log5 != null) { log5.LogInfo((object)("[ShoutDeath] Fallback — atacante: '" + hoverName2 + "'")); } } else { text = _unknownDeathMessage.Value; ManualLogSource log6 = _log; if (log6 != null) { log6.LogWarning((object)("[ShoutDeath] Usando mensaje desconocido: '" + text + "'")); } } } if (!string.IsNullOrWhiteSpace(text)) { string text2 = playerName + " " + text; ManualLogSource log7 = _log; if (log7 != null) { log7.LogInfo((object)("[ShoutDeath] Enviando RPC 'NazhikaDeath' a todos con mensaje: '" + text2 + "'")); } ZRoutedRpc.instance.InvokeRoutedRPC(ZRoutedRpc.Everybody, "NazhikaDeath", new object[1] { text2 }); ManualLogSource log8 = _log; if (log8 != null) { log8.LogInfo((object)"[ShoutDeath] RPC enviado correctamente."); } } else { ManualLogSource log9 = _log; if (log9 != null) { log9.LogWarning((object)"[ShoutDeath] Mensaje vacío, no se envió RPC."); } } } } private static ConfigEntry _unknownDeathMessage; private static Dictionary> _deathMessages; private static ManualLogSource _log; private const string RPC_NAME = "NazhikaDeath"; public static void Init(ConfigFile config, Harmony harmony, ManualLogSource log) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown _log = log; SetupConfig(config); harmony.Patch((MethodBase)AccessTools.Method(typeof(Player), "OnDeath", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(DeathPatch), "Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)AccessTools.Method(typeof(Chat), "Awake", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(DeathPatch), "RegisterRPC", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); _log.LogInfo((object)"[ShoutDeath] Init OK."); } private static void SetupConfig(ConfigFile config) { _unknownDeathMessage = config.Bind("Mensajes", "Desconocido", "ha muerto por causas desconocidas", (ConfigDescription)null); _deathMessages = new Dictionary> { { (HitType)0, config.Bind("Mensajes", "Undefined", "murió de forma indeterminada", (ConfigDescription)null) }, { (HitType)1, config.Bind("Mensajes", "EnemyHit", "fue asesinado por un", (ConfigDescription)null) }, { (HitType)2, config.Bind("Mensajes", "PlayerHit", "fue asesinado por otro jugador", (ConfigDescription)null) }, { (HitType)3, config.Bind("Mensajes", "Fall", "cayó desde una gran altura", (ConfigDescription)null) }, { (HitType)4, config.Bind("Mensajes", "Drowning", "se ahogó", (ConfigDescription)null) }, { (HitType)5, config.Bind("Mensajes", "Burning", "fue quemado vivo", (ConfigDescription)null) }, { (HitType)6, config.Bind("Mensajes", "Freezing", "se congeló", (ConfigDescription)null) }, { (HitType)7, config.Bind("Mensajes", "Poisoned", "murió envenenado", (ConfigDescription)null) }, { (HitType)8, config.Bind("Mensajes", "Water", "se ahogó en el agua", (ConfigDescription)null) }, { (HitType)9, config.Bind("Mensajes", "Smoke", "murió asfixiado por humo", (ConfigDescription)null) }, { (HitType)10, config.Bind("Mensajes", "EdgeOfWorld", "cayó del fin del mundo", (ConfigDescription)null) }, { (HitType)11, config.Bind("Mensajes", "Impact", "fue aplastado", (ConfigDescription)null) }, { (HitType)12, config.Bind("Mensajes", "Cart", "fue atropellado por un carro", (ConfigDescription)null) }, { (HitType)13, config.Bind("Mensajes", "Tree", "fue aplastado por un árbol", (ConfigDescription)null) }, { (HitType)14, config.Bind("Mensajes", "Self", "murió por sí mismo", (ConfigDescription)null) }, { (HitType)15, config.Bind("Mensajes", "Structural", "murió por un colapso estructural", (ConfigDescription)null) }, { (HitType)16, config.Bind("Mensajes", "Turret", "fue abatido por una torreta", (ConfigDescription)null) }, { (HitType)17, config.Bind("Mensajes", "Boat", "fue aplastado por un barco", (ConfigDescription)null) }, { (HitType)18, config.Bind("Mensajes", "Stalagtite", "fue aplastado por una estalactita", (ConfigDescription)null) } }; } } } namespace NazhikaCore.Features.Classes { public static class SelectorClass { public static void Init() { CommandManager.Instance.AddConsoleCommand((ConsoleCommand)(object)new ClaseCommand()); CommandManager.Instance.AddConsoleCommand((ConsoleCommand)(object)new RemoveClassCommand()); CommandManager.Instance.AddConsoleCommand((ConsoleCommand)(object)new ListZDOCommand()); Log.Info("[SelectorClass] ✅ Commands registrados (clase/removeclass/listzdo) — ZNetView-only + Perfil"); } } public class ClaseCommand : ConsoleCommand { public override string Name => "clase"; public override string Help => "clase — Asigna tu clase (local, ZDO + guarda en perfil)."; public override void Run(string[] args) { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { Console instance = Console.instance; if (instance != null) { instance.Print("No se encontró jugador local."); } Log.Info("[ClaseCommand] ❌ No local player"); return; } if (args == null || args.Length < 1) { Console instance2 = Console.instance; if (instance2 != null) { instance2.Print(((ConsoleCommand)this).Help); } return; } string text = args[0]; if (!string.IsNullOrEmpty(text)) { text = char.ToUpperInvariant(text[0]) + ((text.Length > 1) ? text.Substring(1).ToLowerInvariant() : ""); } if (!ClassManager.IsValidClass(text)) { Console instance3 = Console.instance; if (instance3 != null) { instance3.Print("❌ Clase '" + text + "' no existe. Disponibles: " + string.Join(", ", ClassManager.GetAvailableClassKeys())); } Log.Info("[ClaseCommand] ❌ Clase inválida '" + text + "'"); return; } ZNetView nview = ((Character)localPlayer).m_nview; if ((Object)(object)nview == (Object)null) { Console instance4 = Console.instance; if (instance4 != null) { instance4.Print("❌ Sin ZNetView en Player"); } return; } Log.Info("[ClaseCommand] → ZNV.InvokeRPC('RPC_Class_Set', '" + text + "')"); nview.InvokeRPC("RPC_Class_Set", new object[1] { text }); Console instance5 = Console.instance; if (instance5 != null) { instance5.Print("✔ Clase solicitada: '" + text + "'."); } } public override List CommandOptionList() { return null; } } public class RemoveClassCommand : ConsoleCommand { public override string Name => "removeclass"; public override string Help => "removeclass — Elimina tu clase (local, ZDO + limpia perfil)."; public override void Run(string[] args) { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { Console instance = Console.instance; if (instance != null) { instance.Print("No se encontró jugador local."); } Log.Info("[RemoveClassCommand] ❌ No local player"); return; } ZNetView nview = ((Character)localPlayer).m_nview; if ((Object)(object)nview == (Object)null) { Console instance2 = Console.instance; if (instance2 != null) { instance2.Print("❌ Sin ZNetView en Player"); } return; } Log.Info("[RemoveClassCommand] → ZNV.InvokeRPC('RPC_Class_Clear')"); nview.InvokeRPC("RPC_Class_Clear", Array.Empty()); Console instance3 = Console.instance; if (instance3 != null) { instance3.Print("✔ Clase eliminada."); } } public override List CommandOptionList() { return null; } } public class ListZDOCommand : ConsoleCommand { public override string Name => "listzdo"; public override string Help => "listzdo — Muestra naz_class desde el ZDO del jugador local."; public override void Run(string[] args) { //IL_0071: 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) Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { Console instance = Console.instance; if (instance != null) { instance.Print("❌ No local player"); } return; } ZNetView nview = ((Character)localPlayer).m_nview; ZDO val = ((nview != null) ? nview.GetZDO() : null); if (val == null) { Console instance2 = Console.instance; if (instance2 != null) { instance2.Print("❌ Sin ZDO"); } return; } string @string = val.GetString("naz_class", "Ninguna"); Console instance3 = Console.instance; if (instance3 != null) { instance3.Print(string.Format("\ud83d\udcdc ZDO[{0}] {1} = {2}", val.m_uid, "naz_class", @string)); } Log.Info(string.Format("[ListZDOCommand] {0}='{1}' uid={2}", "naz_class", @string, val.m_uid)); } public override List CommandOptionList() { return null; } } public static class ClearEffects { public static void Init() { CommandManager.Instance.AddConsoleCommand((ConsoleCommand)(object)new ClearEffectsCommand()); Log.Info("[ClearEffects] ✅ Command registrado: limpiarJugador "); } } internal class ClearEffectsCommand : ConsoleCommand { public override string Name => "limpiarJugador"; public override string Help => "clearse — Elimina TODOS los StatusEffects del jugador (solo admin o debugmode)."; public override void Run(string[] args) { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { Console instance = Console.instance; if (instance != null) { instance.Print("❌ No se encontró jugador local."); } Log.Info("[ClearEffects] ❌ No local player"); return; } if (args == null || args.Length < 1) { Console instance2 = Console.instance; if (instance2 != null) { instance2.Print(((ConsoleCommand)this).Help); } return; } string text = args[0]; ZNetView nview = ((Character)localPlayer).m_nview; if ((Object)(object)nview == (Object)null) { Console instance3 = Console.instance; if (instance3 != null) { instance3.Print("❌ Sin ZNetView en Player local."); } return; } Log.Info("[ClearEffects] → ZNV.InvokeRPC('RPC_ClearSE_Target', '" + text + "')"); nview.InvokeRPC("RPC_ClearSE_Target", new object[1] { text }); Console instance4 = Console.instance; if (instance4 != null) { instance4.Print("✔ Solicitud enviada: limpiar SE a '" + text + "'."); } } public override List CommandOptionList() { return null; } private static bool HasPermission(Player caller) { if ((Object)(object)caller == (Object)null) { return false; } if (caller.InDebugFlyMode()) { return true; } if ((Object)(object)ZNet.instance != (Object)null) { return ZNet.instance.IsAdmin(caller.GetPlayerName()); } return false; } } public class ArcherClass : PlayerClassBase { public override string ClassName => "Archer"; public override float CooldownSeconds => 15f; public override string SkillIconFile => "focusshot.png"; public override bool CooldownStartsOnEffectEnd => true; public override void ApplyPassiveBonus(Player player) { } public override void RemovePassiveBonus(Player player) { } public override void ActivateSkill(Player player) { if ((Object)(object)player == (Object)null) { return; } SEMan sEMan = ((Character)player).GetSEMan(); if (sEMan != null) { int stableHashCode = StringExtensionMethods.GetStableHashCode("SE_FocusShot"); if ((Object)(object)sEMan.GetStatusEffect(stableHashCode) != (Object)null) { ((Character)player).Message((MessageType)2, "\ud83c\udff9 Focus Shot ya está activo.", 0, (Sprite)null); return; } sEMan.AddStatusEffect(stableHashCode, false, 0, 0f); ((Character)player).Message((MessageType)2, "\ud83c\udff9 ¡Prepárate para cargar!", 0, (Sprite)null); Log.Info(player.GetPlayerName() + " activó Archer Focus (SE_FocusShot)."); } } } public class BerserkerClass : PlayerClassBase { public const float BurstCooldownSeconds = 20f; private static bool _passiveActive = true; private const string FuryKey = "naz_fury"; private const float MaxFury = 100f; private const string BurstCooldownUntilKey = "naz_berserkburst_cd_until"; public override string ClassName => "Berserker"; public override float CooldownSeconds => 0f; public override string SkillIconFile => "BerserkerBurst.png"; public override void ApplyPassiveBonus(Player player) { _passiveActive = true; SEMan val = ((player != null) ? ((Character)player).GetSEMan() : null); if (val != null) { if ((Object)(object)val.GetStatusEffect(SE_Berserkfury.NameHash) == (Object)null) { val.AddStatusEffect(SE_Berserkfury.NameHash, false, 0, 0f); Log.Info(player.GetPlayerName() + " recibió el pasivo SE_Berserkfury."); } if ((Object)(object)val.GetStatusEffect(SE_PassiveAtkSpeed.NameHash) == (Object)null) { val.AddStatusEffect(SE_PassiveAtkSpeed.NameHash, false, 0, 0f); } Log.Info(player.GetPlayerName() + " ahora es BERSERKER."); } } public override void RemovePassiveBonus(Player player) { _passiveActive = false; if (player != null) { SEMan sEMan = ((Character)player).GetSEMan(); if (sEMan != null) { sEMan.RemoveStatusEffect(SE_Berserkfury.NameHash, false); } } if (player != null) { SEMan sEMan2 = ((Character)player).GetSEMan(); if (sEMan2 != null) { sEMan2.RemoveStatusEffect(SE_PassiveAtkSpeed.NameHash, false); } } Log.Info(((player != null) ? player.GetPlayerName() : null) + " perdió su pasivo de BERSERKER."); } public override void ActivateSkill(Player player) { if ((Object)(object)player == (Object)null) { return; } SEMan sEMan = ((Character)player).GetSEMan(); if (sEMan == null) { return; } ZNetView nview = ((Character)player).m_nview; ZDO val = (((Object)(object)nview != (Object)null && nview.IsValid()) ? nview.GetZDO() : null); if (val != null && (Object)(object)ZNet.instance != (Object)null) { float @float = val.GetFloat("naz_berserkburst_cd_until", 0f); float num = (float)ZNet.instance.GetTimeSeconds(); if (num < @float) { int num2 = Mathf.CeilToInt(@float - num); ((Character)player).Message((MessageType)2, $"⏳ Habilidad en recarga… {num2}s", 0, (Sprite)null); return; } } if ((Object)(object)sEMan.GetStatusEffect(SE_BerserkBurst.NameHash) != (Object)null) { ((Character)player).Message((MessageType)2, "¡Burst ya activo!", 0, (Sprite)null); return; } float num4; if (val == null) { ZNetView nview2 = ((Character)player).m_nview; float? obj; if (nview2 == null) { obj = null; } else { ZDO zDO = nview2.GetZDO(); obj = ((zDO != null) ? new float?(zDO.GetFloat("naz_fury", 0f)) : null); } float? num3 = obj; num4 = num3.GetValueOrDefault(); } else { num4 = val.GetFloat("naz_fury", 0f); } float num5 = num4; if (num5 < 99.999f) { int num6 = Mathf.CeilToInt(100f - num5); ((Character)player).Message((MessageType)2, $"Necesitas Furia al máximo (+{num6}).", 0, (Sprite)null); return; } sEMan.AddStatusEffect(SE_BerserkBurst.NameHash, false, 0, 0f); if (val != null) { val.Set("naz_fury", 0f); } else { ZNetView nview3 = ((Character)player).m_nview; if (nview3 != null) { ZDO zDO2 = nview3.GetZDO(); if (zDO2 != null) { zDO2.Set("naz_fury", 0f); } } } ((Character)player).Message((MessageType)2, "¡Destrúyelo Todo!", 0, (Sprite)null); } public static void ResetPassive(Player player) { if (!((Object)(object)player == (Object)null)) { _passiveActive = true; SEMan sEMan = ((Character)player).GetSEMan(); if (sEMan != null && (Object)(object)sEMan.GetStatusEffect(SE_Berserkfury.NameHash) == (Object)null) { sEMan.AddStatusEffect(SE_Berserkfury.NameHash, false, 0, 0f); } Log.Info(player.GetPlayerName() + " recuperó el pasivo de BERSERKER."); } } } public static class ClassApi { private struct CacheEntry { public int Frame; public string Key; public PlayerClassBase Class; } private static readonly Dictionary s_cache = new Dictionary(); private static long GetCacheId(Player player) { if (!Object.op_Implicit((Object)(object)player)) { return 0L; } ZNetView nview = ((Character)player).m_nview; ZDO val = ((nview != null) ? nview.GetZDO() : null); if (val != null) { return ((ZDOID)(ref val.m_uid)).ID; } return player.GetPlayerID(); } public static string GetClassKey(Player player) { if (!Object.op_Implicit((Object)(object)player)) { return string.Empty; } long cacheId = GetCacheId(player); int frameCount = Time.frameCount; if (s_cache.TryGetValue(cacheId, out var value) && value.Frame == frameCount) { return value.Key ?? string.Empty; } string savedKey = ClassManager.GetSavedKey(player); PlayerClassBase cls = null; if (!string.IsNullOrEmpty(savedKey)) { ClassManager.TryGetClass(savedKey, out cls); } s_cache[cacheId] = new CacheEntry { Frame = frameCount, Key = (savedKey ?? string.Empty), Class = cls }; return savedKey ?? string.Empty; } public static PlayerClassBase GetClass(Player player) { if (!Object.op_Implicit((Object)(object)player)) { return null; } long cacheId = GetCacheId(player); int frameCount = Time.frameCount; if (s_cache.TryGetValue(cacheId, out var value) && value.Frame == frameCount) { return value.Class; } GetClassKey(player); if (s_cache.TryGetValue(cacheId, out value)) { return value.Class; } return null; } public static bool TryGetClass(Player player, out PlayerClassBase cls) { cls = GetClass(player); return cls != null; } public static bool HasAnyClass(Player player) { return !string.IsNullOrEmpty(GetClassKey(player)); } public static bool HasClass(Player player, string classKey, bool ignoreCase = false) { if (string.IsNullOrEmpty(classKey)) { return false; } string classKey2 = GetClassKey(player); if (!ignoreCase) { return classKey2 == classKey; } return string.Equals(classKey2, classKey, StringComparison.OrdinalIgnoreCase); } public static bool IsClass(Player player) where TClass : PlayerClassBase { PlayerClassBase @class = GetClass(player); return @class is TClass; } public static TClass AsClass(Player player) where TClass : PlayerClassBase { return GetClass(player) as TClass; } public static void ClearCache() { s_cache.Clear(); } } public static class ClassData { public class ClassInfo { public string ClassKey; public string DisplayName; public string ButtonLabel; public string WeaponType; public string Description; public string ActiveSkill; public string PassiveSkill; public string ImageFile; } public static readonly List Classes = new List { new ClassInfo { ClassKey = "Berserker", DisplayName = "Berserker", ButtonLabel = "Berserker", WeaponType = "Hachas", Description = "Guerrero salvaje que desata su furia en combate cuerpo a cuerpo.", ActiveSkill = "Activa: Entra en frenesí, aumentando su velocidad de ataque y daño durante un corto periodo.", PassiveSkill = "Pasiva: Cada impacto genera furia, incrementando su daño de forma acumulativa.", ImageFile = "Hachas.png" }, new ClassInfo { ClassKey = "Lancer", DisplayName = "Lancero", ButtonLabel = "Lancero", WeaponType = "Lanza", Description = "Combatiente preciso que domina la distancia media con lanzas y atgeir.", ActiveSkill = "Activa: Detona el sangrado acumulado en los enemigos.", PassiveSkill = "Pasiva: Sus ataques aplican sangrado que inflige daño en el tiempo.", ImageFile = "Lanzas.png" }, new ClassInfo { ClassKey = "Monk", DisplayName = "Bárbaro", ButtonLabel = "Bárbaro", WeaponType = "Puño", Description = "Canaliza su energía interna en cada golpe.", ActiveSkill = "Activa: Impacta el suelo, aturdiendo a los enemigos cercanos.", PassiveSkill = "Pasiva: Genera Ki al golpear, aumentando su daño y velocidad de ataque conforme se acumula.", ImageFile = "Monk.png" }, new ClassInfo { ClassKey = "Sword", DisplayName = "Espadachín", ButtonLabel = "Espadachín", WeaponType = "Espada", Description = "Aprovecha la esencia de bosses para imbuir sus armas con elementos.", ActiveSkill = "Activa: Absorbe un elemento de los jefes derrotados, imbuyendo sus ataques con poder elemental único.", PassiveSkill = "Pasiva: Cada golpe exitoso aumenta progresivamente su velocidad de ataque.", ImageFile = "Sword.png" }, new ClassInfo { ClassKey = "Tank", DisplayName = "Tanque", ButtonLabel = "Tanque", WeaponType = "Escudo", Description = "Especialista en absorber daño y control de mobs.", ActiveSkill = "Activa: Provoca a los enemigos cercanos.", PassiveSkill = "Pasiva: Reduce el daño recibido en función de su capacidad de bloqueo.", ImageFile = "Tank.png" }, new ClassInfo { ClassKey = "Mago", DisplayName = "Mago", ButtonLabel = "Mago", WeaponType = "Báculo", Description = "Usuario de artes arcanas que canaliza el poder de los bastones y hechizos.", ActiveSkill = "Activa: Absorbe una habilidad de los jefes derrotados, permitiéndole reutilizar su poder.", PassiveSkill = "Pasiva: Chance de recuperar eitr con cada ataque.", ImageFile = "Mago.png" }, new ClassInfo { ClassKey = "Arquero", DisplayName = "Arquero", ButtonLabel = "Arquero", WeaponType = "Arco", Description = "Cazador letal que domina el combate a distancia con precisión quirúrgica.", ActiveSkill = "Activa: Realiza un ataque cargado cuyo daño escala con la stamina consumida.", PassiveSkill = "Pasiva: Aumenta su probabilidad de golpe crítico en función de su nivel con arcos.", ImageFile = "Bow.png" } }; } public static class ClassExtensions { public static bool HasAnyClass(this Player p) { return ClassApi.HasAnyClass(p); } public static string GetClassKey(this Player p) { return ClassApi.GetClassKey(p); } public static PlayerClassBase GetPlayerClass(this Player p) { return ClassApi.GetClass(p); } public static bool HasClass(this Player p, string key, bool ignoreCase = false) { return ClassApi.HasClass(p, key, ignoreCase); } public static bool IsClass(this Player p) where TClass : PlayerClassBase { return ClassApi.IsClass(p); } public static TClass AsClass(this Player p) where TClass : PlayerClassBase { return ClassApi.AsClass(p); } } public static class ClassManager { public const string ZdoClassKey = "naz_class"; private static readonly Dictionary AvailableClasses = new Dictionary { { "Sword", new SwordClass() }, { "Tank", new TankClass() }, { "Lancer", new SpearClass() }, { "Berserker", new BerserkerClass() }, { "Arquero", new ArcherClass() }, { "Mago", new MageClass() }, { "Monk", new MonkClass() } }; public static bool IsValidClass(string key) { return AvailableClasses.ContainsKey(key); } public static string[] GetAvailableClassKeys() { return AvailableClasses.Keys.ToArray(); } public static bool TryGetClass(string key, out PlayerClassBase cls) { return AvailableClasses.TryGetValue(key, out cls); } public static string GetSavedKey(Player player) { object obj; if (player == null) { obj = null; } else { ZNetView nview = ((Character)player).m_nview; obj = ((nview != null) ? nview.GetZDO() : null); } ZDO val = (ZDO)obj; if (val != null) { return val.GetString("naz_class", string.Empty); } return string.Empty; } public static void SetSavedKey(Player player, string key) { object obj; if (player == null) { obj = null; } else { ZNetView nview = ((Character)player).m_nview; obj = ((nview != null) ? nview.GetZDO() : null); } ZDO val = (ZDO)obj; if (val != null) { val.Set("naz_class", key ?? string.Empty); } } public static void ApplyPassiveForKey(Player player, string key) { if (!string.IsNullOrEmpty(key) && AvailableClasses.TryGetValue(key, out var value)) { Log.Info("[ClassManager] apply passive " + value.ClassName + " → " + player.GetPlayerName()); value.ApplyPassiveBonus(player); } } public static void RemovePassiveForKey(Player player, string key) { if (!string.IsNullOrEmpty(key) && AvailableClasses.TryGetValue(key, out var value)) { Log.Info("[ClassManager] remove passive " + value.ClassName + " ← " + player.GetPlayerName()); value.RemovePassiveBonus(player); } } public static PlayerClassBase GetClass(Player player) { string savedKey = GetSavedKey(player); if (!AvailableClasses.TryGetValue(savedKey, out var value)) { return null; } return value; } public static void ActivateSkill(Player player) { PlayerClassBase @class = GetClass(player); if (@class == null) { Log.Info("[ClassManager.ActivateSkill] ❌ " + player.GetPlayerName() + " sin clase"); ((Character)player).Message((MessageType)2, "No tienes clase asignada.", 0, (Sprite)null); return; } Log.Info("[ClassManager.ActivateSkill] ▶ " + @class.ClassName + " → " + player.GetPlayerName()); if (@class.CheckAndFeedbackCooldown(player)) { @class.ActivateSkill(player); if (!@class.CooldownStartsOnEffectEnd && @class.DidActivateSkill(player)) { @class.TryBeginCooldown(player); SkillsUI.StartCooldown(@class.CooldownSeconds); } } } public static void RestoreClassFromZDO(Player player) { string savedKey = GetSavedKey(player); if (!string.IsNullOrEmpty(savedKey) && AvailableClasses.ContainsKey(savedKey)) { Log.Info("[RestoreClassFromZDO] reapply passive for '" + player.GetPlayerName() + "' → " + savedKey); ApplyPassiveForKey(player, savedKey); } else { Log.Info("[RestoreClassFromZDO] (sin clase) para " + player.GetPlayerName()); } } public static void Update() { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if (!Object.op_Implicit((Object)(object)localPlayer) || ((Character)localPlayer).IsDead() || ((Character)localPlayer).InCutscene()) { return; } PlayerClassBase @class = GetClass(localPlayer); if (@class == null || MainPlugin.ClassSkillKey == null || ((Object)(object)Chat.instance != (Object)null && Chat.instance.HasFocus()) || TextInput.IsVisible() || InventoryGui.IsVisible()) { return; } KeyboardShortcut value = MainPlugin.ClassSkillKey.Value; if (Input.GetKeyDown(((KeyboardShortcut)(ref value)).MainKey) || ((KeyboardShortcut)(ref value)).IsDown()) { ZNetView nview = ((Character)localPlayer).m_nview; if ((Object)(object)nview != (Object)null && nview.IsValid()) { nview.InvokeRPC("RPC_Class_ActivateSkill", Array.Empty()); } else { ActivateSkill(localPlayer); } } } } public static class ClassSpriteLoader { public static string ImageFolder { get; set; } = string.Empty; public static Sprite Load(string fileName) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrEmpty(fileName) || string.IsNullOrEmpty(ImageFolder)) { return null; } string text = Path.Combine(ImageFolder, fileName); if (!File.Exists(text)) { Log.Warning("[ClassSpriteLoader] ❌ Imagen no encontrada: " + text); return null; } try { string text2 = "file:///" + text.Replace("\\", "/"); WWW val = new WWW(text2); float num = 5f; float num2 = 0f; while (!val.isDone && num2 < num) { num2 += Time.deltaTime; } if (!string.IsNullOrEmpty(val.error)) { Log.Warning("[ClassSpriteLoader] ❌ Error cargando " + fileName + ": " + val.error); return null; } Texture2D texture = val.texture; if ((Object)(object)texture == (Object)null) { Log.Warning("[ClassSpriteLoader] ❌ Textura nula: " + fileName); return null; } ((Texture)texture).filterMode = (FilterMode)1; Sprite result = Sprite.Create(texture, new Rect(0f, 0f, (float)((Texture)texture).width, (float)((Texture)texture).height), new Vector2(0.5f, 0.5f)); Log.Info($"[ClassSpriteLoader] ✔ Sprite cargado: {fileName} ({((Texture)texture).width}x{((Texture)texture).height})"); return result; } catch (Exception ex) { Log.Warning("[ClassSpriteLoader] ❌ Excepción cargando " + fileName + ": " + ex.Message); return null; } } } public class MageTableInteract : MonoBehaviour, Hoverable, Interactable { public string GetHoverText() { return Localization.instance.Localize("[$KEY_Use] Seleccionar Clase"); } public string GetHoverName() { return "Mesa de Clases"; } public bool Interact(Humanoid user, bool hold, bool alt) { if (hold) { return false; } Player val = (Player)(object)((user is Player) ? user : null); if (val == null || (Object)(object)val != (Object)(object)Player.m_localPlayer) { return false; } Log.Info("[MageTableInteract] Mesa interactuada — abriendo UI de clases."); ClassSelectionUI.Instance.Show(); return true; } public bool UseItem(Humanoid user, ItemData item) { return false; } } public class ClassSelectionUI { private static ClassSelectionUI _instance; private GameObject _rootContainer; private bool _guiReady; private GameObject _leftPanel; private GameObject _midPanel; private GameObject _rightPanel; private Text _midTitle; private Text _midWeapon; private Text _midDesc; private Text _midActive; private Text _midPassive; private Text _midWarning; private Image _rightImage; private readonly Dictionary _spriteCache = new Dictionary(); private ClassData.ClassInfo _selected; private const float LeftW = 320f; private const float LeftH = 560f; private const float MidW = 340f; private const float MidH = 560f; private const float RightW = 380f; private const float RightH = 560f; private const float PanelGap = 16f; private const float TotalW = 1072f; private const float ButtonW = 240f; private const float ButtonH = 55f; public static ClassSelectionUI Instance => _instance ?? (_instance = new ClassSelectionUI()); public bool IsVisible { get; private set; } public void OnGUIAvailable() { _guiReady = true; _rootContainer = null; } public void Show() { if (!_guiReady) { Log.Warning("[ClassSelectionUI] GUI aún no disponible."); return; } Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer != (Object)null && ClassApi.HasAnyClass(localPlayer)) { ((Character)localPlayer).Message((MessageType)2, "⛔ Ya tienes una clase asignada.\nNo puedes usar la mesa.", 0, (Sprite)null); return; } EnsureCreated(); ResetToClassList(); _rootContainer.SetActive(true); IsVisible = true; GUIManager.BlockInput(true); } public void Hide() { if ((Object)(object)_rootContainer != (Object)null) { _rootContainer.SetActive(false); } IsVisible = false; GUIManager.BlockInput(false); } private void EnsureCreated() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_0051: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_rootContainer != (Object)null)) { _rootContainer = new GameObject("ClassSelectionUI_Root"); _rootContainer.transform.SetParent(GUIManager.CustomGUIFront.transform, false); RectTransform val = _rootContainer.AddComponent(); val.sizeDelta = new Vector2(1072f, 560f); BuildLeftPanel(); BuildMidPanel(); BuildRightPanel(); _rootContainer.SetActive(false); } } private void BuildLeftPanel() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Expected O, but got Unknown _leftPanel = GUIManager.Instance.CreateWoodpanel(_rootContainer.transform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), Vector2.zero, 320f, 560f, false); float num = -100f; for (int i = 0; i < ClassData.Classes.Count; i++) { ClassData.ClassInfo c = ClassData.Classes[i]; GameObject val = GUIManager.Instance.CreateButton(c.ButtonLabel, _leftPanel.transform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, num - (float)i * 60f), 240f, 55f); ((UnityEvent)val.GetComponent