using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("EWSFourSetsSkills")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.2.0.0")] [assembly: AssemblyInformationalVersion("0.2.0")] [assembly: AssemblyProduct("EWSFourSetsSkills")] [assembly: AssemblyTitle("EWSFourSetsSkills")] [assembly: AssemblyVersion("0.2.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace EWSFourSetsSkills { [BepInPlugin("kr.yeomin.ews.foursetskills", "EWS Four Sets Skills", "0.5.12")] public class Plugin : BaseUnityPlugin { private class ShieldState { public float hp; public float until; public GameObject fx; } [HarmonyPatch(typeof(Character), "Damage", new Type[] { typeof(HitData) })] private static class CharacterDamagePatch { private static void Prefix(Character __instance, HitData hit) { if ((Object)(object)I == (Object)null || hit == null || (Object)(object)__instance == (Object)null) { return; } Character hitAttacker = GetHitAttacker(hit); if ((Object)(object)hitAttacker != (Object)null && !(hitAttacker is Player) && I.IsSummonLike(hitAttacker) && I.summonFrenzyUntil.TryGetValue(hitAttacker, out var value)) { if (value > Time.time) { ScaleHit(hit, 1.15f); } else { I.summonFrenzyUntil.Remove(hitAttacker); } } } private static void Postfix(Character __instance, HitData hit) { if ((Object)(object)I == (Object)null || InternalDamage || hit == null || (Object)(object)__instance == (Object)null) { return; } Character hitAttacker = GetHitAttacker(hit); if ((Object)(object)hitAttacker == (Object)null || (Object)(object)hitAttacker == (Object)(object)__instance) { return; } if (!(hitAttacker is Player) && I.IsSummonLike(hitAttacker)) { if (!I.HasFiveSet("summoner")) { return; } float num = 0f; try { num = hit.GetTotalDamage(); } catch { } if (num > 0f) { try { hitAttacker.Heal(num * 0.2f, true); } catch { } I.summonFrenzyUntil[hitAttacker] = Time.time + 3f; } return; } Player val = (Player)(object)((hitAttacker is Player) ? hitAttacker : null); if (!((Object)(object)val == (Object)null) && !((Object)(object)val != (Object)(object)Player.m_localPlayer) && IsEnemyTarget(__instance)) { if (CaptainDamageScaleUntil > Time.time && CaptainDamageScale < 0.999f) { ScaleHit(hit, CaptainDamageScale); } I.TryPlayerProc(val, __instance, hit); } } } private class ArrowShockwaveMarker : MonoBehaviour { public Player owner; public float damage; public float radius = 3f; public bool exploded; public void Explode(Vector3 point) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0063: 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) if (!exploded) { exploded = true; if ((Object)(object)I != (Object)null && (Object)(object)owner != (Object)null) { DamageRadius(owner, point, radius, damage, DamageFlavor.Pierce); SpawnAny(new string[3] { "vfx_groundslam", "vfx_HitSparks", "vfx_sledge_hit" }, point, Quaternion.identity); PlayAny(new string[2] { "sfx_bow_hit", "sfx_sledge_hit" }, point); } } } private void OnCollisionEnter(Collision c) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) Vector3 val; if (c == null || c.contactCount <= 0) { val = ((Component)this).transform.position; } else { ContactPoint contact = c.GetContact(0); val = ((ContactPoint)(ref contact)).point; } Vector3 point = val; Explode(point); } private void OnTriggerEnter(Collider c) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) Explode(((Component)this).transform.position); } } private enum WeaponKind { Summon, Unknown, OneHandSword, OneHandAxe, OneHandMace, GreatSword, BattleAxe, TwoHandHammer, Polearm, Spear, Bow } private enum DamageFlavor { Slash, Blunt, Pierce } public const string Guid = "kr.yeomin.ews.foursetskills"; public const string Name = "EWS Four Sets Skills"; public const string Version = "0.5.12"; internal static Plugin I; internal static Harmony H; internal static ConfigEntry SwordsmanProc; internal static ConfigEntry BerserkerProc; internal static ConfigEntry ArcherProc; internal static ConfigEntry Cooldown; internal static bool InternalDamage; internal static bool SkillBusy; internal static float SkillBusyUntil; private readonly Dictionary cooldowns = new Dictionary(); private readonly Dictionary summonShields = new Dictionary(); private readonly Dictionary summonFrenzyUntil = new Dictionary(); private static float CaptainDamageScale = 1f; private static float CaptainDamageScaleUntil = 0f; private static Type CachedRemainingSetsType; private static MethodInfo CachedGetSetState; private static object CachedGetSetStateTarget; private void Awake() { //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Expected O, but got Unknown I = this; SwordsmanProc = ((BaseUnityPlugin)this).Config.Bind("Proc", "Swordsman", 0.25f, "검사 5세트 스킬 발동 확률"); BerserkerProc = ((BaseUnityPlugin)this).Config.Bind("Proc", "Berserker", 0.35f, "광전사 5세트 스킬 발동 확률"); ArcherProc = ((BaseUnityPlugin)this).Config.Bind("Proc", "Archer", 0.4f, "궁수 5세트 스킬 발동 확률"); Cooldown = ((BaseUnityPlugin)this).Config.Bind("Proc", "CooldownSeconds", 5f, "자동 발동 재사용 대기시간"); H = new Harmony("kr.yeomin.ews.foursetskills"); H.PatchAll(); CacheRemainingSetsApiOnce(); DisableLegacyFivePieceSkills(); FilterAssassinSetSource(); PatchProjectileImpact(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[EWS4] FINAL 0.5.12 EWS-ONLY loaded"); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[EWS4] sets: swordsman(tank), berserker(warrior), archer, summoner"); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[EWS4] F6 = force current weapon 5P skill test"); } private void Update() { if (SkillBusy && Time.time >= SkillBusyUntil) { SkillBusy = false; } if (Input.GetKeyDown((KeyCode)287) && (Object)(object)Player.m_localPlayer != (Object)null) { ForceCurrentSkill(Player.m_localPlayer); } CleanupShields(); } private static void CacheRemainingSetsApiOnce() { try { CachedRemainingSetsType = FindType("EWSRemainingSets.Plugin"); if (CachedRemainingSetsType == null) { Plugin i = I; if (i != null) { ((BaseUnityPlugin)i).Logger.LogWarning((object)"[EWS4] EWSRemainingSets.Plugin not found during startup cache"); } return; } CachedGetSetState = CachedRemainingSetsType.GetMethod("GetSetState", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (CachedGetSetState != null && !CachedGetSetState.IsStatic) { CachedGetSetStateTarget = ResolveInstanceOnce(CachedRemainingSetsType); } Plugin i2 = I; if (i2 != null) { ((BaseUnityPlugin)i2).Logger.LogInfo((object)("[EWS4] EWSRemainingSets API cached once: GetSetState=" + (CachedGetSetState != null))); } } catch (Exception ex) { Plugin i3 = I; if (i3 != null) { ((BaseUnityPlugin)i3).Logger.LogWarning((object)("[EWS4] startup API cache failed: " + ex.Message)); } } } private static object ResolveInstanceOnce(Type t) { if (t == null) { return null; } string[] array = new string[3] { "Instance", "_instance", "instance" }; foreach (string name in array) { try { FieldInfo field = t.GetField(name, BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { object value = field.GetValue(null); if (value != null) { return value; } } PropertyInfo property = t.GetProperty(name, BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (property != null) { object value2 = property.GetValue(null, null); if (value2 != null) { return value2; } } } catch { } } try { Object val = Object.FindObjectOfType(t); if (val != (Object)null) { return val; } } catch { } return null; } private static bool IsGatheringTorchTier(ItemData item) { if (item == null) { return false; } string text = GetPrefabName(item); if (string.IsNullOrEmpty(text) && (Object)(object)item.m_dropPrefab != (Object)null) { text = ((Object)item.m_dropPrefab).name; } if (string.IsNullOrEmpty(text)) { return false; } text = text.Replace("(Clone)", ""); switch (text) { default: return text == "GT_GatheringTorch_T6"; case "GT_GatheringTorch_T1": case "GT_GatheringTorch_T2": case "GT_GatheringTorch_T3": case "GT_GatheringTorch_T4": case "GT_GatheringTorch_T5": return true; } } [HarmonyPatch(typeof(Humanoid), "EquipItem")] private static bool IsSummonerStaffLike(ItemData item) { if (item == null || item.m_shared == null) { return false; } if (IsGatheringTorchTier(item)) { return true; } string text = GetPrefabName(item) ?? ""; string text2 = item.m_shared.m_name ?? ""; string text3 = ((object)Unsafe.As(ref item.m_shared.m_skillType)/*cast due to .constrained prefix*/).ToString(); if (text3.IndexOf("ElementalMagic", StringComparison.OrdinalIgnoreCase) >= 0 || text3.IndexOf("BloodMagic", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } string text4 = (text + " " + text2).ToLowerInvariant(); if (text4.Contains("staff") || text4.Contains("wand") || text4.Contains("지팡이")) { return true; } return false; } private static bool IsExactGatheringTorch(ItemData item) { string prefabName = GetPrefabName(item); if (string.IsNullOrEmpty(prefabName)) { return false; } prefabName = prefabName.Replace("(Clone)", ""); for (int i = 1; i <= 6; i++) { if (string.Equals(prefabName, "GT_GatheringTorch_T" + i, StringComparison.OrdinalIgnoreCase)) { return true; } } return false; } private static string GetPrefabName(ItemData item) { try { return (item != null && (Object)(object)item.m_dropPrefab != (Object)null) ? (((Object)item.m_dropPrefab).name ?? "") : ""; } catch { return ""; } } private void DisableLegacyFivePieceSkills() { //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Expected O, but got Unknown try { Type type = FindType("EWSRemainingSets.Plugin"); if (type == null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"[EWS4] EWSRemainingSets.Plugin not found yet; old 5P suppression skipped."); return; } string[] obj = new string[9] { "AssassinStabSkill", "GenericMeleeWhirlwind", "BerserkerAxeSkill", "BerserkerCrushSkill", "ArcherSkill", "TankSkill", "SummonerSkill", "SwordsmanSkill", "AssassinSkill" }; MethodInfo methodInfo = AccessTools.Method(typeof(Plugin), "BlockOldSkill", (Type[])null, (Type[])null); string[] array = obj; foreach (string n in array) { foreach (MethodInfo item in from x in type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic) where x.Name == n select x) { try { H.Patch((MethodBase)item, new HarmonyMethod(methodInfo), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[EWS4] disabled old skill: " + n)); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("[EWS4] old skill patch failed " + n + ": " + ex.Message)); } } } } catch (Exception ex2) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("[EWS4] legacy skill suppression error: " + ex2)); } } public static bool BlockOldSkill() { return false; } private void FilterAssassinSetSource() { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown try { Type type = FindType("EWSRemainingSets.Plugin"); MethodInfo methodInfo = ((type == null) ? null : type.GetMethod("AllSetIds", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)); if (methodInfo != null) { H.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(AccessTools.Method(typeof(Plugin), "AllSetIdsPostfix", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[EWS4] assassin removed from AllSetIds()"); } } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("[EWS4] assassin filter error: " + ex.Message)); } } public static void AllSetIdsPostfix(ref IEnumerable __result) { if (__result != null) { __result = __result.Where((string x) => !string.Equals(x, "assassin", StringComparison.OrdinalIgnoreCase)).ToArray(); } } private static Type FindType(string full) { Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); for (int i = 0; i < assemblies.Length; i++) { Type type = assemblies[i].GetType(full, throwOnError: false); if (type != null) { return type; } } return null; } internal bool HasFiveSet(string originalSetId) { try { MethodInfo cachedGetSetState = CachedGetSetState; if (cachedGetSetState != null) { object obj = (cachedGetSetState.IsStatic ? null : CachedGetSetStateTarget); if (cachedGetSetState.IsStatic || obj != null) { object obj2 = cachedGetSetState.Invoke(obj, new object[1] { originalSetId }); if (obj2 != null) { int num = ReadInt(obj2, "Count"); if (num <= 0) { num = ReadInt(obj2, "count"); } if (num >= 5) { return true; } } } } } catch { } try { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { return false; } int num2 = 0; foreach (ItemData allItem in ((Humanoid)localPlayer).GetInventory().GetAllItems()) { if (allItem != null && allItem.m_equipped && allItem.m_customData != null && allItem.m_customData.TryGetValue("EWS_SET_ID", out var value) && string.Equals(value, originalSetId, StringComparison.OrdinalIgnoreCase)) { num2++; } } return num2 >= 5; } catch { return false; } } private static int ReadInt(object o, string name) { try { Type type = o.GetType(); FieldInfo field = type.GetField(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { return Convert.ToInt32(field.GetValue(o)); } PropertyInfo property = type.GetProperty(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (property != null) { return Convert.ToInt32(property.GetValue(o, null)); } } catch { } return 0; } private static Character GetHitAttacker(HitData hit) { try { MethodInfo method = ((object)hit).GetType().GetMethod("GetAttacker", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method != null) { object? obj = method.Invoke(hit, null); return (Character)((obj is Character) ? obj : null); } } catch { } return null; } private static Character FindNearestEnemy(Vector3 center, float radius) { //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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) Character result = null; float num = radius * radius; foreach (Character allCharacter in Character.GetAllCharacters()) { if ((Object)(object)allCharacter == (Object)null || allCharacter is Player) { continue; } try { if (allCharacter.IsTamed()) { continue; } } catch { } Vector3 val = ((Component)allCharacter).transform.position - center; float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude; if (sqrMagnitude < num) { num = sqrMagnitude; result = allCharacter; } } return result; } private static bool IsEnemyTarget(Character c) { if ((Object)(object)c == (Object)null || c is Player) { return false; } try { if (c.IsTamed()) { return false; } } catch { } return true; } private void TryPlayerProc(Player p, Character victim, HitData sourceHit) { if (SkillBusy) { return; } ItemData equippedWeapon = GetEquippedWeapon(p); if (equippedWeapon == null) { return; } WeaponKind weaponKind = ClassifyWeapon(equippedWeapon); float baseDamage = Math.Max(1f, TotalDamage(sourceHit)); if (IsSwordsman(weaponKind) && HasFiveSet("tank")) { if (RollAndCooldown("swordsman", SwordsmanProc.Value)) { ((MonoBehaviour)this).StartCoroutine(SwordsmanSkill(p, weaponKind, baseDamage)); } } else if (IsBerserker(weaponKind) && HasFiveSet("warrior")) { if (RollAndCooldown("berserker", BerserkerProc.Value)) { ((MonoBehaviour)this).StartCoroutine(BerserkerSkill(p, weaponKind, baseDamage)); } } else if (weaponKind == WeaponKind.Bow && HasFiveSet("archer") && RollAndCooldown("archer", ArcherProc.Value)) { ((MonoBehaviour)this).StartCoroutine(ArrowStorm(p, baseDamage)); } } private bool RollAndCooldown(string key, float chance) { if (cooldowns.TryGetValue(key, out var value) && Time.time < value) { return false; } if (Random.value > Mathf.Clamp01(chance)) { return false; } cooldowns[key] = Time.time + Mathf.Max(0.1f, Cooldown.Value); return true; } private void BeginSkill(float seconds) { SkillBusy = true; SkillBusyUntil = Time.time + seconds; } private IEnumerator SwordsmanSkill(Player p, WeaponKind kind, float baseDamage) { switch (kind) { case WeaponKind.OneHandSword: yield return ((MonoBehaviour)this).StartCoroutine(SwordBladeStorm(p, baseDamage)); break; case WeaponKind.OneHandAxe: yield return ((MonoBehaviour)this).StartCoroutine(OneHandAxeCombo(p, baseDamage)); break; case WeaponKind.OneHandMace: yield return ((MonoBehaviour)this).StartCoroutine(OneHandMaceCombo(p, baseDamage)); break; } } private IEnumerator SwordBladeStorm(Player p, float baseDamage) { BeginSkill(1.18f); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[EWS4] 검사 - 양손검모션 환영검무 + 분신2 START"); GameObject val = FindChildByName(((Component)p).gameObject, "Visual"); List clones = new List(); if ((Object)(object)val != (Object)null) { Vector3[] array = (Vector3[])(object)new Vector3[2] { -((Component)p).transform.right * 1.2f, ((Component)p).transform.right * 1.2f }; for (int i = 0; i < array.Length; i++) { GameObject val2 = Object.Instantiate(val, ((Component)p).transform.position + array[i], ((Component)p).transform.rotation); ((Object)val2).name = "EWS_Sword_Phantom_" + i; StripCloneComponents(val2); clones.Add(val2); } } string[] trig = new string[3] { "greatsword0", "greatsword1", "greatsword2" }; float[] yaw = new float[15] { -55f, 35f, -25f, 60f, 0f, -45f, 20f, 50f, -35f, 15f, -60f, 40f, -10f, 55f, 0f }; for (int j = 0; j < 15; j++) { Trigger(p, trig[j % trig.Length]); foreach (GameObject item in clones) { Animator val3 = (((Object)(object)item != (Object)null) ? item.GetComponentInChildren(true) : null); if ((Object)(object)val3 != (Object)null) { val3.SetTrigger(trig[(j + 1) % trig.Length]); } } Vector3 val4 = Quaternion.Euler(0f, yaw[j], 0f) * ((Component)p).transform.forward; DamageCone(p, ((Component)p).transform.position + Vector3.up, val4, 3.4f, 80f, baseDamage * 0.11f, DamageFlavor.Slash); SpawnAny(new string[3] { "vfx_sword_hit", "vfx_HitSparks", "vfx_Battleaxe_hit" }, ((Component)p).transform.position + Vector3.up * 1.1f + val4 * 1.45f, Quaternion.LookRotation(val4)); PlayAny(new string[2] { "sfx_battleaxe_swing_wosh", "sfx_sword_swing" }, ((Component)p).transform.position); yield return (object)new WaitForSeconds(0.0625f); } Trigger(p, "greatsword_secondary"); foreach (GameObject item2 in clones) { Animator val5 = (((Object)(object)item2 != (Object)null) ? item2.GetComponentInChildren(true) : null); if ((Object)(object)val5 != (Object)null) { val5.SetTrigger("greatsword_secondary"); } } yield return (object)new WaitForSeconds(0.09f); DamageCone(p, ((Component)p).transform.position + Vector3.up, ((Component)p).transform.forward, 3.7f, 105f, baseDamage * 0.475f, DamageFlavor.Slash); FinalShockwave(p, ((Component)p).transform.position, 3.9f, baseDamage * 0.325f, DamageFlavor.Slash); foreach (GameObject item3 in clones) { if ((Object)(object)item3 != (Object)null) { Object.Destroy((Object)(object)item3); } } ((BaseUnityPlugin)this).Logger.LogInfo((object)"[EWS4] 검사 - 양손검모션 환영검무 + 분신2 END"); } private IEnumerator OneHandAxeCombo(Player p, float baseDamage) { BeginSkill(1.15f); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[EWS4] 검사 - 양손검모션 환영도끼난무 START"); GameObject val = FindChildByName(((Component)p).gameObject, "Visual"); List clones = new List(); if ((Object)(object)val != (Object)null) { Vector3[] array = (Vector3[])(object)new Vector3[2] { -((Component)p).transform.right * 1.15f, ((Component)p).transform.right * 1.15f }; for (int i = 0; i < array.Length; i++) { GameObject val2 = Object.Instantiate(val, ((Component)p).transform.position + array[i], ((Component)p).transform.rotation); ((Object)val2).name = "EWS_Axe_Phantom_" + i; StripCloneComponents(val2); clones.Add(val2); } } string[] trig = new string[3] { "greatsword0", "greatsword1", "greatsword2" }; float[] yaw = new float[12] { -48f, 30f, -20f, 52f, 8f, -40f, 24f, 45f, -28f, 16f, -54f, 35f }; for (int j = 0; j < 12; j++) { Trigger(p, trig[j % 3]); foreach (GameObject item in clones) { Animator val3 = (((Object)(object)item != (Object)null) ? item.GetComponentInChildren(true) : null); if ((Object)(object)val3 != (Object)null) { val3.SetTrigger(trig[(j + 1) % 3]); } } Vector3 val4 = Quaternion.Euler(0f, yaw[j], 0f) * ((Component)p).transform.forward; DamageCone(p, ((Component)p).transform.position + Vector3.up, val4, 3.5f, 82f, baseDamage * 0.12f, DamageFlavor.Slash); SpawnAny(new string[3] { "vfx_sword_hit", "vfx_HitSparks", "vfx_Battleaxe_hit" }, ((Component)p).transform.position + Vector3.up + val4 * 1.45f, Quaternion.LookRotation(val4)); PlayAny(new string[2] { "sfx_battleaxe_swing_wosh", "sfx_sword_swing" }, ((Component)p).transform.position); yield return (object)new WaitForSeconds(0.0675f); } Trigger(p, "greatsword_secondary"); foreach (GameObject item2 in clones) { Animator val5 = (((Object)(object)item2 != (Object)null) ? item2.GetComponentInChildren(true) : null); if ((Object)(object)val5 != (Object)null) { val5.SetTrigger("greatsword_secondary"); } } yield return (object)new WaitForSeconds(0.1f); DamageCone(p, ((Component)p).transform.position + Vector3.up, ((Component)p).transform.forward, 3.8f, 110f, baseDamage * 0.5f, DamageFlavor.Slash); FinalShockwave(p, ((Component)p).transform.position, 4f, baseDamage * 0.35f, DamageFlavor.Slash); foreach (GameObject item3 in clones) { if ((Object)(object)item3 != (Object)null) { Object.Destroy((Object)(object)item3); } } ((BaseUnityPlugin)this).Logger.LogInfo((object)"[EWS4] 검사 - 양손검모션 환영도끼난무 END"); } private IEnumerator OneHandMaceCombo(Player p, float baseDamage) { BeginSkill(1.4f); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[EWS4] 검사 - 충격파 강타(CaptainSkillTree) START"); IEnumerator enumerator = null; try { Type type = FindType("CaptainSkillTree.SkillTree.SkillEffect"); MethodInfo methodInfo = ((type == null) ? null : type.GetMethod("ShockwaveSlamCoroutine", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[1] { typeof(Player) }, null)); if (methodInfo != null) { enumerator = methodInfo.Invoke(null, new object[1] { p }) as IEnumerator; } } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("[EWS4] ShockwaveSlam bridge failed: " + ex.Message)); } if (enumerator != null) { yield return ((MonoBehaviour)this).StartCoroutine(enumerator); } else { Trigger(p, "mace_secondary"); yield return (object)new WaitForSeconds(0.3f); DamageRadius(p, ((Component)p).transform.position, 4.5f, baseDamage * 2.3f, DamageFlavor.Blunt); FinalShockwave(p, ((Component)p).transform.position, 4.8f, baseDamage * 0.5f, DamageFlavor.Blunt); } ((BaseUnityPlugin)this).Logger.LogInfo((object)"[EWS4] 검사 - 충격파 강타(CaptainSkillTree) END"); } private IEnumerator BerserkerSkill(Player p, WeaponKind kind, float baseDamage) { switch (kind) { case WeaponKind.GreatSword: yield return ((MonoBehaviour)this).StartCoroutine(GreatSwordClones(p, baseDamage)); break; case WeaponKind.BattleAxe: yield return ((MonoBehaviour)this).StartCoroutine(BerserkerExecution(p, baseDamage)); break; case WeaponKind.Polearm: yield return ((MonoBehaviour)this).StartCoroutine(PolearmWhirlwind(p, baseDamage)); break; case WeaponKind.Spear: yield return ((MonoBehaviour)this).StartCoroutine(SpearThrustStorm(p, baseDamage)); break; case WeaponKind.TwoHandHammer: yield return ((MonoBehaviour)this).StartCoroutine(TripleGroundSmash(p, baseDamage)); break; } } private IEnumerator GreatSwordClones(Player p, float baseDamage) { BeginSkill(1.85f); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[EWS4] 광전사 - 환영검무 START"); GameObject visual = FindChildByName(((Component)p).gameObject, "Visual"); List clones = new List(); if ((Object)(object)visual != (Object)null) { Vector3[] offsets = (Vector3[])(object)new Vector3[3] { -((Component)p).transform.right * 1.8f, ((Component)p).transform.right * 1.8f, -((Component)p).transform.forward * 1.5f }; string[] trig = new string[3] { "greatsword0", "greatsword1", "greatsword2" }; for (int i = 0; i < 3; i++) { GameObject val = Object.Instantiate(visual, ((Component)p).transform.position + offsets[i], ((Component)p).transform.rotation); ((Object)val).name = "EWS_GreatSword_Clone_" + i; StripCloneComponents(val); clones.Add(val); Animator componentInChildren = val.GetComponentInChildren(true); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.SetTrigger(trig[i]); } DamageCone(p, val.transform.position + Vector3.up, ((Component)p).transform.forward, 5.4f, 115f, baseDamage * 0.6f, DamageFlavor.Slash); PlayAny(new string[2] { "sfx_sword_swing", "sfx_battleaxe_swing_wosh" }, val.transform.position); yield return (object)new WaitForSeconds(0.12f); } } Trigger(p, "greatsword_secondary"); foreach (GameObject item in clones) { Animator val2 = (((Object)(object)item != (Object)null) ? item.GetComponentInChildren(true) : null); if ((Object)(object)val2 != (Object)null) { val2.SetTrigger("greatsword_secondary"); } } yield return (object)new WaitForSeconds(0.28f); DamageCone(p, ((Component)p).transform.position + Vector3.up, ((Component)p).transform.forward, 6f, 135f, baseDamage * 1.35f, DamageFlavor.Slash); SpawnAny(new string[2] { "vfx_sword_hit", "vfx_HitSparks" }, ((Component)p).transform.position + Vector3.up + ((Component)p).transform.forward * 2.2f, Quaternion.LookRotation(((Component)p).transform.forward)); FinalShockwave(p, ((Component)p).transform.position, 6.5f, baseDamage * 0.95f, DamageFlavor.Slash); yield return (object)new WaitForSeconds(0.55f); foreach (GameObject item2 in clones) { if ((Object)(object)item2 != (Object)null) { Object.Destroy((Object)(object)item2); } } ((BaseUnityPlugin)this).Logger.LogInfo((object)"[EWS4] 광전사 - 환영검무 END"); } private IEnumerator BerserkerExecution(Player p, float baseDamage) { BeginSkill(2.05f); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[EWS4] 광전사 - 쌍환영 회전참 + 대지강타 START"); GameObject val = FindChildByName(((Component)p).gameObject, "Visual"); List clones = new List(); Quaternion[] array = (Quaternion[])(object)new Quaternion[2]; if ((Object)(object)val != (Object)null) { Vector3[] array2 = (Vector3[])(object)new Vector3[2] { -((Component)p).transform.right * 2.1f, ((Component)p).transform.right * 2.1f }; for (int i = 0; i < 2; i++) { GameObject val2 = Object.Instantiate(val, ((Component)p).transform.position + array2[i], ((Component)p).transform.rotation); ((Object)val2).name = "EWS_BattleAxe_Whirl_Phantom_" + i; StripCloneComponents(val2); clones.Add(val2); array[i] = val2.transform.rotation; Animator componentInChildren = val2.GetComponentInChildren(true); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.speed *= 1.8f; componentInChildren.SetTrigger("battleaxe_secondary"); } } } float spinEnd = Time.time + 1.15f; float nextHit = Time.time; while (Time.time < spinEnd) { for (int j = 0; j < clones.Count; j++) { GameObject val3 = clones[j]; if (!((Object)(object)val3 == (Object)null)) { float num = ((j == 0) ? 1f : (-1f)); val3.transform.Rotate(0f, num * 760f * Time.deltaTime, 0f, (Space)0); } } if (Time.time >= nextHit) { foreach (GameObject item in clones) { if ((Object)(object)item != (Object)null) { DamageRadius(p, item.transform.position, 4.6f, baseDamage * 0.18f, DamageFlavor.Slash); } } nextHit = Time.time + 0.22f; } yield return null; } Trigger(p, "battleaxe_attack2"); yield return (object)new WaitForSeconds(0.28f); Vector3 val4 = ((Component)p).transform.position + ((Component)p).transform.forward * 1.5f; DamageRadius(p, val4, 6f, baseDamage * 0.45f, DamageFlavor.Slash); SpawnAny(new string[3] { "vfx_groundslam", "vfx_sledge_hit", "vfx_HitSparks" }, val4, Quaternion.identity); PlayAny(new string[2] { "sfx_sledge_hit", "sfx_battleaxe_swing_wosh" }, val4); FinalShockwave(p, val4, 6.7f, baseDamage * 0.95f, DamageFlavor.Slash); foreach (GameObject item2 in clones) { if ((Object)(object)item2 != (Object)null) { Object.Destroy((Object)(object)item2); } } ((BaseUnityPlugin)this).Logger.LogInfo((object)"[EWS4] 광전사 - 쌍환영 회전참 + 대지강타 END"); } private IEnumerator PolearmWhirlwind(Player p, float baseDamage) { BeginSkill(2.2f); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[EWS4] 광전사 - 쌍체 휠윈드 START"); float end = Time.time + 2f; float nextHit = Time.time; float nextBurst = Time.time; float burstAngle = 0f; GameObject visual = FindChildByName(((Component)p).gameObject, "Visual"); GameObject clone = null; Animator playerAnimator = ((Component)p).GetComponentInChildren(true); float oldSpeed = (((Object)(object)playerAnimator != (Object)null) ? playerAnimator.speed : 1f); if ((Object)(object)visual != (Object)null) { clone = Object.Instantiate(visual, ((Component)p).transform.position + ((Component)p).transform.right * 2f, ((Component)p).transform.rotation); ((Object)clone).name = "EWS_Polearm_Whirl_Phantom"; StripCloneComponents(clone); } Animator val = (((Object)(object)clone != (Object)null) ? clone.GetComponentInChildren(true) : null); Trigger(p, "greatsword_secondary"); if ((Object)(object)playerAnimator != (Object)null) { playerAnimator.speed = oldSpeed * 2f; } if ((Object)(object)val != (Object)null) { val.speed *= 2f; val.SetTrigger("greatsword_secondary"); } try { while (Time.time < end) { if ((Object)(object)visual != (Object)null) { visual.transform.Rotate(0f, 760f * Time.deltaTime, 0f, (Space)1); } if ((Object)(object)clone != (Object)null) { clone.transform.Rotate(0f, -760f * Time.deltaTime, 0f, (Space)0); } if (Time.time >= nextHit) { DamageRadius(p, ((Component)p).transform.position, 5.7f, baseDamage * 0.12f, DamageFlavor.Pierce); if ((Object)(object)clone != (Object)null) { DamageRadius(p, clone.transform.position, 5f, baseDamage * 0.08f, DamageFlavor.Pierce); } nextHit = Time.time + 0.22f; } if (Time.time >= nextBurst) { burstAngle += 100f; Vector3 val2 = Quaternion.Euler(0f, burstAngle, 0f) * Vector3.forward * 2.2f; SpawnAny(new string[2] { "vfx_HitSparks", "vfx_groundslam" }, ((Component)p).transform.position + val2, Quaternion.identity); if ((Object)(object)clone != (Object)null) { Vector3 val3 = Quaternion.Euler(0f, burstAngle + 180f, 0f) * Vector3.forward * 1.7f; SpawnAny(new string[2] { "vfx_HitSparks", "vfx_groundslam" }, clone.transform.position + val3, Quaternion.identity); } PlayAny(new string[2] { "sfx_sledge_hit", "sfx_atgeir_attack" }, ((Component)p).transform.position + val2); nextBurst = Time.time + 1.35f; } yield return null; } } finally { if ((Object)(object)playerAnimator != (Object)null) { playerAnimator.speed = oldSpeed; } if ((Object)(object)clone != (Object)null) { Object.Destroy((Object)(object)clone); } } FinalShockwave(p, ((Component)p).transform.position, 6.5f, baseDamage * 0.35f, DamageFlavor.Pierce); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[EWS4] 광전사 - 쌍체 휠윈드 END"); } private IEnumerator SpearThrustStorm(Player p, float baseDamage) { BeginSkill(2.2f); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[EWS4] 광전사 - 관통창 왕복찌르기 START"); Vector3 start = ((Component)p).transform.position; Quaternion startRot = ((Component)p).transform.rotation; IEnumerator enumerator = null; bool started = false; try { Type type = FindType("CaptainSkillTree.SkillTree.SkillEffect"); MethodInfo methodInfo = ((type == null) ? null : type.GetMethod("ExecutePierceChargeSequence", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[2] { typeof(Player), typeof(Character) }, null)); if (methodInfo != null) { Character val = FindNearestEnemy(((Component)p).transform.position, 12f); enumerator = methodInfo.Invoke(null, new object[2] { p, val }) as IEnumerator; started = true; } } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("[EWS4] ExecutePierceChargeSequence bridge failed: " + ex.Message)); } if (enumerator != null) { yield return ((MonoBehaviour)this).StartCoroutine(enumerator); } if (!started) { Vector3 dir = ((Component)p).transform.forward; for (int i = 0; i < 8; i++) { Trigger(p, "spear_poke"); DamageCone(p, ((Component)p).transform.position + Vector3.up, dir, 5.5f, 28f, baseDamage * 0.12f, DamageFlavor.Pierce); Transform transform = ((Component)p).transform; transform.position += dir * 0.45f; yield return (object)new WaitForSeconds(0.08f); } } Vector3 returnFrom = ((Component)p).transform.position; float returnTime = 0.48f; float tReturn = 0f; bool reverseHitDone = false; while (tReturn < returnTime) { tReturn += Time.deltaTime; float num = Mathf.Clamp01(tReturn / returnTime); ((Component)p).transform.position = Vector3.Lerp(returnFrom, start, num); ((Component)p).transform.rotation = startRot; if (!reverseHitDone && num >= 0.45f) { reverseHitDone = true; Trigger(p, "spear_poke"); DamageCone(p, ((Component)p).transform.position + Vector3.up, ((Component)p).transform.forward, 5.5f, 32f, baseDamage * 0.55f, DamageFlavor.Pierce); PlayAny(new string[2] { "sfx_atgeir_attack", "sfx_spear_poke" }, ((Component)p).transform.position); } yield return null; } ((Component)p).transform.position = start; ((Component)p).transform.rotation = startRot; FinalForwardShockwave(p, 9f, 34f, baseDamage * 0.35f, DamageFlavor.Pierce); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[EWS4] 광전사 - 관통창 왕복찌르기 END"); } private IEnumerator TripleGroundSmash(Player p, float baseDamage) { BeginSkill(1.1f); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[EWS4] 광전사 - 양손망치 분신 2강타(NO SPIN) START"); GameObject val = FindChildByName(((Component)p).gameObject, "Visual"); List clones = new List(); Vector3[] array = (Vector3[])(object)new Vector3[2] { -((Component)p).transform.right * 2f + ((Component)p).transform.forward * 0.6f, ((Component)p).transform.right * 2f + ((Component)p).transform.forward * 0.6f }; for (int i = 0; i < 2; i++) { if ((Object)(object)val == (Object)null) { break; } GameObject val2 = Object.Instantiate(val, ((Component)p).transform.position + array[i], ((Component)p).transform.rotation); ((Object)val2).name = "EWS_TwoHandHammer_Phantom_" + i; StripCloneComponents(val2); Animator componentInChildren = val2.GetComponentInChildren(true); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.Rebind(); componentInChildren.Update(0f); componentInChildren.speed = 1f; } clones.Add(val2); } yield return (object)new WaitForSeconds(0.06f); for (int j = 0; j < clones.Count; j++) { GameObject c = clones[j]; if (!((Object)(object)c == (Object)null)) { Animator componentInChildren2 = c.GetComponentInChildren(true); if ((Object)(object)componentInChildren2 != (Object)null) { componentInChildren2.SetTrigger("swing_sledge"); } yield return (object)new WaitForSeconds(0.18f); Vector3 val3 = c.transform.position + ((Component)p).transform.forward * 0.8f; DamageRadius(p, val3, 5.8f, baseDamage * 0.9f, DamageFlavor.Blunt); SpawnAny(new string[3] { "vfx_groundslam", "vfx_sledge_hit", "vfx_HitSparks" }, val3, Quaternion.identity); PlayAny(new string[2] { "sfx_sledge_hit", "sfx_sledge_swing" }, val3); } } yield return (object)new WaitForSeconds(0.1f); FinalShockwave(p, ((Component)p).transform.position + ((Component)p).transform.forward * 1f, 7.2f, baseDamage * 0.45f, DamageFlavor.Blunt); yield return (object)new WaitForSeconds(0.12f); foreach (GameObject item in clones) { if ((Object)(object)item != (Object)null) { Object.Destroy((Object)(object)item); } } ((BaseUnityPlugin)this).Logger.LogInfo((object)"[EWS4] 광전사 - 양손망치 분신 2강타(NO SPIN) END"); } private IEnumerator ArrowStorm(Player p, float baseDamage) { BeginSkill(2.6f); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[EWS4] 궁수 - 폭발화살 + 화살비 동시 발동 START"); CaptainDamageScale = 0.5f; CaptainDamageScaleUntil = Time.time + 2.4f; try { Type type = FindType("CaptainSkillTree.SkillTree.SkillEffect"); MethodInfo methodInfo = ((type == null) ? null : type.GetMethod("ExecuteExplosiveArrow", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[1] { typeof(Player) }, null)); MethodInfo methodInfo2 = ((type == null) ? null : type.GetMethod("ExecuteArrowRain", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[1] { typeof(Player) }, null)); if (methodInfo != null) { methodInfo.Invoke(null, new object[1] { p }); } if (methodInfo2 != null) { methodInfo2.Invoke(null, new object[1] { p }); } if (methodInfo == null && methodInfo2 == null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"[EWS4] bow Captain methods not found"); } } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("[EWS4] bow Captain bridge failed: " + ex.Message)); } yield return (object)new WaitForSeconds(2.35f); CaptainDamageScale = 1f; ((BaseUnityPlugin)this).Logger.LogInfo((object)"[EWS4] 궁수 - 폭발화살 + 화살비 동시 발동 END"); } private void SpawnArrowProjectile(Player owner, Vector3 origin, Vector3 dir, float damage, bool shockwaveOnHit) { //IL_002e: 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_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: 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_0055: 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) //IL_0057: 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_0090: Unknown result type (might be due to invalid IL or missing references) //IL_010b: 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_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) GameObject prefabAny = GetPrefabAny(new string[3] { "ArrowWood", "projectile_woodarrow", "ArrowFire" }); if ((Object)(object)prefabAny == (Object)null) { return; } Vector3 val = origin + Vector3.up * 1.55f + dir * 0.7f; GameObject val2 = Object.Instantiate(prefabAny, val, Quaternion.LookRotation(dir)); if (shockwaveOnHit) { ArrowShockwaveMarker arrowShockwaveMarker = val2.AddComponent(); arrowShockwaveMarker.owner = owner; arrowShockwaveMarker.damage = damage * 0.65f; arrowShockwaveMarker.radius = 3f; } HitData hit = NewHit(owner, damage, DamageFlavor.Pierce, val, dir); bool flag = false; try { Component[] components = val2.GetComponents(); foreach (Component val3 in components) { if ((Object)(object)val3 == (Object)null) { continue; } MethodInfo[] array = (from x in ((object)val3).GetType().GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) where x.Name == "Setup" select x).ToArray(); foreach (MethodInfo methodInfo in array) { object[] array2 = BuildProjectileSetupArgs(methodInfo.GetParameters(), owner, dir * 58f, hit); if (array2 != null) { try { methodInfo.Invoke(val3, array2); flag = true; } catch { continue; } break; } } if (flag) { break; } } } catch { } if (!flag) { Rigidbody component = val2.GetComponent(); if ((Object)(object)component != (Object)null) { component.velocity = dir * 58f; } } Object.Destroy((Object)(object)val2, 8f); } private void SpawnArrowProjectile(Player owner, Vector3 dir, float damage) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) SpawnArrowProjectile(owner, ((Component)owner).transform.position, dir, damage, shockwaveOnHit: false); } private static object[] BuildProjectileSetupArgs(ParameterInfo[] ps, Player owner, Vector3 velocity, HitData hit) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) object[] array = new object[ps.Length]; for (int i = 0; i < ps.Length; i++) { Type parameterType = ps[i].ParameterType; if (typeof(Character).IsAssignableFrom(parameterType)) { array[i] = owner; continue; } if (parameterType == typeof(Vector3)) { array[i] = velocity; continue; } if (parameterType == typeof(HitData)) { array[i] = hit; continue; } if (parameterType == typeof(ItemData)) { array[i] = null; continue; } if (parameterType == typeof(float)) { array[i] = 0f; continue; } if (parameterType == typeof(int)) { array[i] = 0; continue; } if (parameterType == typeof(bool)) { array[i] = false; continue; } if (!parameterType.IsValueType) { array[i] = null; continue; } try { array[i] = Activator.CreateInstance(parameterType); } catch { return null; } } return array; } private bool IsSummonLike(Character c) { if ((Object)(object)c == (Object)null) { return false; } try { Component[] components = ((Component)c).GetComponents(); foreach (Component val in components) { if (!((Object)(object)val == (Object)null)) { string name = ((object)val).GetType().Name; if (string.Equals(name, "SummonedSkeleton", StringComparison.OrdinalIgnoreCase) || string.Equals(name, "SummonedGoblin", StringComparison.OrdinalIgnoreCase)) { return true; } } } } catch { } string text = ((Object)((Component)c).gameObject).name.ToLowerInvariant(); if (!text.Contains("skeleton") && !text.Contains("skelett") && !text.Contains("troll")) { return text.Contains("summon"); } return true; } private void CleanupShields() { if (summonShields.Count == 0) { return; } List list = new List(); foreach (KeyValuePair summonShield in summonShields) { Character key = summonShield.Key; ShieldState value = summonShield.Value; if ((Object)(object)key == (Object)null || value == null || Time.time >= value.until || value.hp <= 0f) { list.Add(key); } } foreach (Character item in list) { RemoveShield(item); } } private void RemoveShield(Character c) { if (!((Object)(object)c == (Object)null) && summonShields.TryGetValue(c, out var value)) { if (value != null && (Object)(object)value.fx != (Object)null) { Object.Destroy((Object)(object)value.fx); } summonShields.Remove(c); } } private void PatchProjectileImpact() { //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Expected O, but got Unknown try { Type type = FindType("Projectile"); if (type == null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"[EWS4] Projectile type not found; arrow shockwave collision fallback only."); return; } MethodInfo methodInfo = AccessTools.Method(typeof(Plugin), "ProjectileImpactPrefix", (Type[])null, (Type[])null); foreach (MethodInfo item in from x in type.GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) where x.Name == "OnHit" select x) { try { H.Patch((MethodBase)item, new HarmonyMethod(methodInfo), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } catch { } } } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("[EWS4] projectile impact patch failed: " + ex.Message)); } } public static void ProjectileImpactPrefix(object __instance, object[] __args) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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_0079: 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) Component val = (Component)((__instance is Component) ? __instance : null); if ((Object)(object)val == (Object)null) { return; } ArrowShockwaveMarker component = val.GetComponent(); if ((Object)(object)component == (Object)null || component.exploded) { return; } Vector3 point = val.transform.position; if (__args != null) { foreach (object obj in __args) { if (obj is Vector3) { point = (Vector3)obj; break; } Collider val2 = (Collider)((obj is Collider) ? obj : null); if ((Object)(object)val2 != (Object)null) { point = val2.ClosestPoint(val.transform.position); break; } } } component.Explode(point); } private static bool IsSummonStaff(ItemData item) { if (IsSummonerStaffLike(item)) { return true; } if (item == null || item.m_shared == null) { return false; } string text = ""; try { if ((Object)(object)item.m_dropPrefab != (Object)null) { item.m_dropPrefab.GetComponent(); } if ((Object)(object)item.m_dropPrefab != (Object)null) { text = ((Object)item.m_dropPrefab).name ?? ""; } } catch { } string text2 = item.m_shared.m_name ?? ""; string text3 = item.m_shared.m_description ?? ""; string text4 = (text + " " + text2 + " " + text3).ToLowerInvariant(); if (text4.Contains("gt_gatheringtorch_t")) { return true; } if (text4.Contains("gatheringtorch")) { return true; } if (text4.Contains("소환")) { return true; } if (text4.Contains("summon")) { return true; } if (text4.Contains("횃불")) { return true; } if (text4.Contains("횟불")) { return true; } return false; } private void ForceCurrentSkill(Player p) { ItemData equippedWeapon = GetEquippedWeapon(p); if (equippedWeapon == null) { ((BaseUnityPlugin)this).Logger.LogInfo((object)"[EWS4] F6: weapon not found"); return; } WeaponKind weaponKind = ClassifyWeapon(equippedWeapon); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[EWS4] F6 force test kind=" + weaponKind)); SkillBusy = false; SkillBusyUntil = 0f; if (IsSwordsman(weaponKind)) { ((MonoBehaviour)this).StartCoroutine(SwordsmanSkill(p, weaponKind, 100f)); } else if (IsBerserker(weaponKind)) { ((MonoBehaviour)this).StartCoroutine(BerserkerSkill(p, weaponKind, 100f)); } else if (weaponKind == WeaponKind.Bow) { ((MonoBehaviour)this).StartCoroutine(ArrowStorm(p, 100f)); } } private WeaponKind ClassifyWeapon(ItemData w) { if (IsSummonStaff(w)) { return WeaponKind.Summon; } if (w == null || w.m_shared == null) { return WeaponKind.Unknown; } string text = ((object)Unsafe.As(ref w.m_shared.m_skillType)/*cast due to .constrained prefix*/).ToString().ToLowerInvariant(); string text2 = (w.m_shared.m_name ?? "").ToLowerInvariant(); string text3 = ""; try { if ((Object)(object)w.m_dropPrefab != (Object)null) { text3 = ((Object)w.m_dropPrefab).name.ToLowerInvariant(); } } catch { } string text4 = text + "|" + text2 + "|" + text3; if (text4.Contains("bow") && !text4.Contains("crossbow")) { return WeaponKind.Bow; } if (text4.Contains("polearm") || text4.Contains("atgeir")) { return WeaponKind.Polearm; } if (text4.Contains("spear")) { return WeaponKind.Spear; } if (text4.Contains("sledge") || text4.Contains("demolisher") || text4.Contains("stagbreaker") || text4.Contains("twohandhammer") || text4.Contains("two hand hammer") || ((text4.Contains("club") || text4.Contains("mace") || text4.Contains("hammer")) && IsTwoHanded(w))) { return WeaponKind.TwoHandHammer; } if (text4.Contains("battleaxe") || text4.Contains("battle axe") || (text4.Contains("axe") && IsTwoHanded(w))) { return WeaponKind.BattleAxe; } if (text4.Contains("greatsword") || text4.Contains("great sword") || text4.Contains("thsword") || text4.Contains("krom") || (text4.Contains("sword") && IsTwoHanded(w))) { return WeaponKind.GreatSword; } if (text4.Contains("axe")) { return WeaponKind.OneHandAxe; } if (text4.Contains("club") || text4.Contains("mace")) { return WeaponKind.OneHandMace; } if (text4.Contains("sword")) { return WeaponKind.OneHandSword; } return WeaponKind.Unknown; } private static bool IsTwoHanded(ItemData w) { if (w == null || w.m_shared == null) { return false; } try { FieldInfo field = ((object)w.m_shared).GetType().GetField("m_twoHanded", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { return Convert.ToBoolean(field.GetValue(w.m_shared)); } } catch { } return false; } private static bool IsSwordsman(WeaponKind k) { if (k != WeaponKind.OneHandSword && k != WeaponKind.OneHandAxe) { return k == WeaponKind.OneHandMace; } return true; } private static bool IsBerserker(WeaponKind k) { if (k != WeaponKind.GreatSword && k != WeaponKind.BattleAxe && k != WeaponKind.TwoHandHammer && k != WeaponKind.Polearm) { return k == WeaponKind.Spear; } return true; } private static ItemData GetEquippedWeapon(Player p) { if ((Object)(object)p == (Object)null) { return null; } string[] array = new string[2] { "m_rightItem", "m_leftItem" }; foreach (string name in array) { try { FieldInfo field = typeof(Humanoid).GetField(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); ItemData val = (ItemData)((field != null) ? /*isinst with value type is only supported in some contexts*/: null); if (val != null && val.m_shared != null) { string text = ((object)Unsafe.As(ref val.m_shared.m_itemType)/*cast due to .constrained prefix*/).ToString().ToLowerInvariant(); if (text.Contains("weapon") || text.Contains("torch")) { return val; } } } catch { } } return null; } private static HitData NewHit(Player owner, float amount, DamageFlavor flavor, Vector3 point, Vector3 dir) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //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_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) HitData val = new HitData(); switch (flavor) { case DamageFlavor.Slash: val.m_damage.m_slash = amount; break; case DamageFlavor.Blunt: val.m_damage.m_blunt = amount; break; default: val.m_damage.m_pierce = amount; break; } val.m_point = point; val.m_dir = ((Vector3)(ref dir)).normalized; val.m_pushForce = Mathf.Min(20f, amount * 0.03f); val.SetAttacker((Character)(object)owner); return val; } private static void Deal(Player owner, Character target, float amount, DamageFlavor flavor, Vector3 point, Vector3 dir) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)owner == (Object)null || (Object)(object)target == (Object)null || amount <= 0f) { return; } try { InternalDamage = true; target.Damage(NewHit(owner, amount, flavor, point, dir)); } finally { InternalDamage = false; } } private static void DamageRadius(Player owner, Vector3 center, float radius, float amount, DamageFlavor flavor) { //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_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_002e: 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_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_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_0044: 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) foreach (Character allCharacter in Character.GetAllCharacters()) { if (IsEnemyTarget(allCharacter)) { Vector3 centerPoint = allCharacter.GetCenterPoint(); if (!(Vector3.Distance(centerPoint, center) > radius)) { Vector3 val = centerPoint - center; Vector3 normalized = ((Vector3)(ref val)).normalized; Deal(owner, allCharacter, amount, flavor, centerPoint, normalized); } } } } private static void DamageCone(Player owner, Vector3 center, Vector3 forward, float range, float halfAngle, float amount, DamageFlavor flavor) { //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_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_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_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_003c: 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_0054: 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_0051: 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_006b: 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) foreach (Character allCharacter in Character.GetAllCharacters()) { if (!IsEnemyTarget(allCharacter)) { continue; } Vector3 centerPoint = allCharacter.GetCenterPoint(); Vector3 val = centerPoint - center; if (!(((Vector3)(ref val)).magnitude > range)) { Vector3 val2 = Vector3.ProjectOnPlane(val, Vector3.up); if (((Vector3)(ref val2)).sqrMagnitude < 0.01f) { val2 = forward; } if (!(Vector3.Angle(forward, ((Vector3)(ref val2)).normalized) > halfAngle)) { Deal(owner, allCharacter, amount, flavor, centerPoint, ((Vector3)(ref val2)).normalized); } } } } private static float TotalDamage(HitData h) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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_0024: 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_0032: 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_0040: 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) if (h == null) { return 0f; } DamageTypes damage = h.m_damage; return damage.m_blunt + damage.m_slash + damage.m_pierce + damage.m_chop + damage.m_pickaxe + damage.m_fire + damage.m_frost + damage.m_lightning + damage.m_poison + damage.m_spirit; } private static void ScaleHit(HitData h, float f) { h.m_damage.m_blunt *= f; h.m_damage.m_slash *= f; h.m_damage.m_pierce *= f; h.m_damage.m_chop *= f; h.m_damage.m_pickaxe *= f; h.m_damage.m_fire *= f; h.m_damage.m_frost *= f; h.m_damage.m_lightning *= f; h.m_damage.m_poison *= f; h.m_damage.m_spirit *= f; } private static void FinalShockwave(Player owner, Vector3 center, float radius, float damage, DamageFlavor flavor) { //IL_0001: 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_0053: Unknown result type (might be due to invalid IL or missing references) DamageRadius(owner, center, radius, damage, flavor); SpawnAny(new string[3] { "vfx_groundslam", "vfx_sledge_hit", "vfx_HitSparks" }, center, Quaternion.identity); PlayAny(new string[3] { "sfx_sledge_hit", "sfx_atgeir_attack", "sfx_battleaxe_swing_wosh" }, center); } private static void FinalForwardShockwave(Player owner, float range, float halfAngle, float damage, DamageFlavor flavor) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: 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_0021: 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_0024: 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_003a: 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_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) //IL_0075: 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) //IL_0077: 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) Vector3 center = ((Component)owner).transform.position + Vector3.up; Vector3 forward = ((Component)owner).transform.forward; DamageCone(owner, center, forward, range, halfAngle, damage, flavor); Vector3 pos = ((Component)owner).transform.position + forward * Mathf.Min(range * 0.55f, 4f); SpawnAny(new string[3] { "vfx_groundslam", "vfx_HitSparks", "vfx_sword_hit" }, pos, Quaternion.LookRotation(forward)); PlayAny(new string[2] { "sfx_atgeir_attack", "sfx_sledge_hit" }, pos); } private static void Trigger(Player p, string trigger) { if ((Object)(object)p == (Object)null || string.IsNullOrEmpty(trigger)) { return; } try { FieldInfo field = typeof(Character).GetField("m_zanim", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); object obj = ((field != null) ? field.GetValue(p) : null); if (obj != null) { MethodInfo method = obj.GetType().GetMethod("SetTrigger", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[1] { typeof(string) }, null); if (method != null) { method.Invoke(obj, new object[1] { trigger }); return; } } } catch { } Animator componentInChildren = ((Component)p).GetComponentInChildren(true); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.SetTrigger(trigger); } } private static GameObject GetPrefabAny(IEnumerable names) { if ((Object)(object)ZNetScene.instance == (Object)null) { return null; } foreach (string name in names) { try { GameObject prefab = ZNetScene.instance.GetPrefab(name); if ((Object)(object)prefab != (Object)null) { return prefab; } } catch { } } return null; } private static GameObject SpawnAny(IEnumerable names, Vector3 pos, Quaternion rot) { //IL_0014: 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) GameObject prefabAny = GetPrefabAny(names); if ((Object)(object)prefabAny == (Object)null) { return null; } try { GameObject obj = Object.Instantiate(prefabAny, pos, rot); Object.Destroy((Object)(object)obj, 4f); return obj; } catch { return null; } } private static GameObject SpawnAttachedAny(IEnumerable names, Transform parent) { //IL_0020: 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_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_0040: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)parent == (Object)null) { return null; } GameObject prefabAny = GetPrefabAny(names); if ((Object)(object)prefabAny == (Object)null) { return null; } try { GameObject obj = Object.Instantiate(prefabAny, parent.position + Vector3.up, Quaternion.identity, parent); obj.transform.localPosition = Vector3.up; return obj; } catch { return null; } } private static void PlayAny(IEnumerable names, Vector3 pos) { //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) SpawnAny(names, pos, Quaternion.identity); } private static GameObject FindChildByName(GameObject root, string name) { if ((Object)(object)root == (Object)null) { return null; } Transform[] componentsInChildren = root.GetComponentsInChildren(true); foreach (Transform val in componentsInChildren) { if (string.Equals(((Object)val).name, name, StringComparison.OrdinalIgnoreCase)) { return ((Component)val).gameObject; } } return null; } private static void StripCloneComponents(GameObject clone) { if ((Object)(object)clone == (Object)null) { return; } Collider[] componentsInChildren = clone.GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].enabled = false; } Rigidbody[] componentsInChildren2 = clone.GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren2.Length; i++) { componentsInChildren2[i].isKinematic = true; } MonoBehaviour[] componentsInChildren3 = clone.GetComponentsInChildren(true); foreach (MonoBehaviour val in componentsInChildren3) { if (!((Object)(object)val == (Object)null)) { string text = ((object)val).GetType().Name.ToLowerInvariant(); if (text.Contains("znet") || text.Contains("character") || text.Contains("ai")) { ((Behaviour)val).enabled = false; } } } } } }