Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of EWS Final5Sets v1.0.13
plugins\EWS_Final5Sets\EWSFourSetsSkills.dll
Decompiled 6 hours agousing 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<float> SwordsmanProc; internal static ConfigEntry<float> BerserkerProc; internal static ConfigEntry<float> ArcherProc; internal static ConfigEntry<float> Cooldown; internal static bool InternalDamage; internal static bool SkillBusy; internal static float SkillBusyUntil; private readonly Dictionary<string, float> cooldowns = new Dictionary<string, float>(); private readonly Dictionary<Character, ShieldState> summonShields = new Dictionary<Character, ShieldState>(); private readonly Dictionary<Character, float> summonFrenzyUntil = new Dictionary<Character, float>(); 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<float>("Proc", "Swordsman", 0.25f, "검사 5세트 스킬 발동 확률"); BerserkerProc = ((BaseUnityPlugin)this).Config.Bind<float>("Proc", "Berserker", 0.35f, "광전사 5세트 스킬 발동 확률"); ArcherProc = ((BaseUnityPlugin)this).Config.Bind<float>("Proc", "Archer", 0.4f, "궁수 5세트 스킬 발동 확률"); Cooldown = ((BaseUnityPlugin)this).Config.Bind<float>("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<SkillType, SkillType>(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<string> __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<GameObject> clones = new List<GameObject>(); 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<GameObject>(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<Animator>(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<Animator>(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<GameObject> clones = new List<GameObject>(); 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<GameObject>(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<Animator>(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<Animator>(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<GameObject> clones = new List<GameObject>(); 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<GameObject>(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<Animator>(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<Animator>(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<GameObject> clones = new List<GameObject>(); 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<GameObject>(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<Animator>(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<Animator>(true); float oldSpeed = (((Object)(object)playerAnimator != (Object)null) ? playerAnimator.speed : 1f); if ((Object)(object)visual != (Object)null) { clone = Object.Instantiate<GameObject>(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<Animator>(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<GameObject> clones = new List<GameObject>(); 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<GameObject>(val, ((Component)p).transform.position + array[i], ((Component)p).transform.rotation); ((Object)val2).name = "EWS_TwoHandHammer_Phantom_" + i; StripCloneComponents(val2); Animator componentInChildren = val2.GetComponentInChildren<Animator>(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<Animator>(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<GameObject>(prefabAny, val, Quaternion.LookRotation(dir)); if (shockwaveOnHit) { ArrowShockwaveMarker arrowShockwaveMarker = val2.AddComponent<ArrowShockwaveMarker>(); 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<Component>(); 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<Rigidbody>(); 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<Component>(); 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<Character> list = new List<Character>(); foreach (KeyValuePair<Character, ShieldState> 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<ArrowShockwaveMarker>(); 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<ItemDrop>(); } 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<SkillType, SkillType>(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<ItemType, ItemType>(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<Animator>(true); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.SetTrigger(trigger); } } private static GameObject GetPrefabAny(IEnumerable<string> 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<string> 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<GameObject>(prefabAny, pos, rot); Object.Destroy((Object)(object)obj, 4f); return obj; } catch { return null; } } private static GameObject SpawnAttachedAny(IEnumerable<string> 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<GameObject>(prefabAny, parent.position + Vector3.up, Quaternion.identity, parent); obj.transform.localPosition = Vector3.up; return obj; } catch { return null; } } private static void PlayAny(IEnumerable<string> 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<Transform>(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<Collider>(true); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].enabled = false; } Rigidbody[] componentsInChildren2 = clone.GetComponentsInChildren<Rigidbody>(true); for (int i = 0; i < componentsInChildren2.Length; i++) { componentsInChildren2[i].isKinematic = true; } MonoBehaviour[] componentsInChildren3 = clone.GetComponentsInChildren<MonoBehaviour>(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; } } } } } }
plugins\EWS_Final5Sets\EWSRemainingSets.dll
Decompiled 6 hours agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using BepInEx; using HarmonyLib; using UnityEngine; [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: CompilationRelaxations(8)] [assembly: AssemblyVersion("0.0.0.0")] namespace EWSRemainingSets; [BepInPlugin("kr.yeomin.ews.remainingsets", "EWS Final Five Sets", "1.0.4")] [BepInDependency(/*Could not decode attribute arguments.*/)] public sealed class Plugin : BaseUnityPlugin { internal static class Patches { public static bool ActionLockPrefix(object __instance) { if ((Object)(object)Instance == (Object)null || !Instance.IsSkillBusy()) { return true; } Player val = (Player)((__instance is Player) ? __instance : null); if ((Object)(object)val == (Object)null) { Humanoid val2 = (Humanoid)((__instance is Humanoid) ? __instance : null); val = (Player)(object)((val2 is Player) ? val2 : null); } if ((Object)(object)val != (Object)null && (Object)(object)val == (Object)(object)Player.m_localPlayer) { try { string text = "?"; StackTrace stackTrace = new StackTrace(); StackFrame frame = stackTrace.GetFrame(1); if (frame != null) { MethodBase method = frame.GetMethod(); if (method != null && method.Name != null) { text = method.Name; } } ((BaseUnityPlugin)Instance).Logger.LogInfo((object)("[EWS-AXE-DIAG] ActionLock BLOCK caller=" + text)); } catch { } return false; } return true; } public static void TooltipPostfix(ItemData __instance, ref string __result) { if (!((Object)(object)Instance == (Object)null) && __instance != null) { Instance.EnsureFinalTag(__instance); if (Instance.IsTagged(__instance)) { __result += Instance.BuildTooltip(__instance); } } } public static void DamagePostfix(Character __instance, object[] __args) { if (!((Object)(object)Instance == (Object)null) && !Instance._internalDamage && __args != null) { object obj = __args.FirstOrDefault((object o) => o != null && o.GetType().Name == "HitData"); if (obj != null) { Instance.OnSummonHit(__instance, obj); Instance.OnHit(__instance, obj); } } } public static void BlockPrefix(Humanoid __instance, object[] __args) { if (!((Object)(object)Instance == (Object)null)) { Player val = (Player)(object)((__instance is Player) ? __instance : null); if ((Object)(object)val != (Object)null && (Object)(object)val == (Object)(object)Player.m_localPlayer) { Instance.CaptureAllDurability("Humanoid.BlockAttack"); } } } public static void BlockPostfix(Humanoid __instance, object[] __args) { if (!((Object)(object)Instance == (Object)null)) { Player val = (Player)(object)((__instance is Player) ? __instance : null); if (!((Object)(object)val == (Object)null) && !((Object)(object)val != (Object)(object)Player.m_localPlayer)) { Instance.RestoreAllDurability("Humanoid.BlockAttack"); Instance.OnBlock(val, __args); } } } public static void AttackDurPrefix(Attack __instance) { if ((Object)(object)Instance == (Object)null || __instance == null) { return; } try { Character attackOwner = Instance.GetAttackOwner(__instance); Player val = (Player)(object)((attackOwner is Player) ? attackOwner : null); if ((Object)(object)val == (Object)(object)Player.m_localPlayer) { Instance.CaptureAllDurability("Attack.OnAttackTrigger"); } } catch { } } public static void AttackDurPostfix(Attack __instance) { if ((Object)(object)Instance == (Object)null || __instance == null) { return; } try { Character attackOwner = Instance.GetAttackOwner(__instance); Player val = (Player)(object)((attackOwner is Player) ? attackOwner : null); if ((Object)(object)val == (Object)(object)Player.m_localPlayer) { Instance.RestoreAllDurability("Attack.OnAttackTrigger"); } } catch { } } public static void ArmorDurPrefix(Player __instance) { if (!((Object)(object)Instance == (Object)null) && !((Object)(object)__instance != (Object)(object)Player.m_localPlayer)) { Instance.CaptureAllDurability("Player.DamageArmorDurability"); } } public static void ArmorDurPostfix(Player __instance) { if (!((Object)(object)Instance == (Object)null) && !((Object)(object)__instance != (Object)(object)Player.m_localPlayer)) { Instance.RestoreAllDurability("Player.DamageArmorDurability"); } } } private struct SetState { public string Id; public int Count; public string Tier; public float Mult; } internal const string SetKey = "EWS_SET_ID"; internal const string TierKey = "EWS_SET_TIER"; internal const float Proc3 = 0.2f; internal const float Proc4 = 0.1f; internal const float LegacyProc5 = 0.3f; internal const string LegacyCleanKey = "EWS5_LEGACY_SET_CLEANED"; internal const float BuffDuration = 10f; internal const float SkillCooldown = 8f; internal const float DurEpic = 0.6f; internal const float DurLegendary = 0.8f; internal const float DurMythic = 1f; internal static Plugin Instance; internal static Harmony Harmony; private bool _internalDamage; private bool _skillBusy; private float _skillBusyUntil; private readonly Dictionary<string, float> _cooldowns = new Dictionary<string, float>(); private readonly Dictionary<ItemData, float> _durBefore = new Dictionary<ItemData, float>(); private readonly Dictionary<ItemData, float> _lastDurability = new Dictionary<ItemData, float>(); private float _attackBuffUntil; private float _attackBuffFactor = 1f; private Assembly _epic; private Type _rarityType; private MethodInfo _createMagic; private MethodInfo _getMagic; private MethodInfo _rollMagic; private MethodInfo _saveMagic; private MethodInfo _initializeCustomData; private MethodInfo _initializeMagic; private MethodInfo _isMagic; private MethodInfo _isMagicSetItem; private readonly string[] ArmorPrefabs = new string[4] { "HelmetCarapace", "ArmorCarapaceChest", "ArmorCarapaceLegs", "CapeFeather" }; private void Awake() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Expected O, but got Unknown Instance = this; Harmony = new Harmony("kr.yeomin.ews.remainingsets"); ResolveEpicLootApi(); InstallPatches(); RegisterConsoleCommands(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[EWS-SETS] FINAL 5 SETS v1.0.4 loaded"); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[EWS-SETS] classes=warrior,tank,archer,summoner,assassin"); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[EWS-SETS] durability Epic60 Legendary80 Mythic100"); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[EWS-SETS] weapon mapping exclusive / armor random 5-set mapping"); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[EWS-SETS] EpicLoot legacy/random set items are filtered out"); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[EWS-SETS] warrior5 1H25 2H35 / archer5 40 / assassin5 20"); } private void ResolveEpicLootApi() { _epic = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault((Assembly a) => string.Equals(a.GetName().Name, "EpicLoot", StringComparison.OrdinalIgnoreCase)); if (_epic == null) { ((BaseUnityPlugin)this).Logger.LogError((object)"[EWS-SETS] EpicLoot assembly not loaded."); return; } Type[] source = SafeTypes(_epic).ToArray(); _rarityType = source.FirstOrDefault((Type t) => t.FullName == "EpicLoot.ItemRarity"); Type type = source.FirstOrDefault((Type t) => t.FullName == "EpicLoot.ItemDataExtensions"); if (type != null) { _createMagic = FindStatic(type, "CreateMagicItem", 1); _getMagic = FindStatic(type, "GetMagicItem", 1); _saveMagic = FindStatic(type, "SaveMagicItem", 2); _initializeCustomData = FindStatic(type, "InitializeCustomData", 1); _isMagic = type.GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic).FirstOrDefault((MethodInfo m) => m.Name == "IsMagic" && m.ReturnType == typeof(bool) && m.GetParameters().Length == 1); _isMagicSetItem = type.GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic).FirstOrDefault((MethodInfo m) => m.Name == "IsMagicSetItem" && m.ReturnType == typeof(bool) && m.GetParameters().Length == 1); } Type type2 = source.FirstOrDefault((Type t) => t.FullName == "EpicLoot.LootRoller"); if (type2 != null) { _rollMagic = type2.GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic).FirstOrDefault(delegate(MethodInfo m) { if (m.Name != "RollMagicItem") { return false; } ParameterInfo[] parameters = m.GetParameters(); return parameters.Length == 4 && _rarityType != null && parameters[0].ParameterType == _rarityType && parameters[1].ParameterType == typeof(ItemData); }); _initializeMagic = type2.GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic).FirstOrDefault((MethodInfo m) => m.Name == "InitializeMagicItem" && m.GetParameters().Length == 1 && m.GetParameters()[0].ParameterType == typeof(ItemData)); } ((BaseUnityPlugin)this).Logger.LogInfo((object)("[EWS-SETS] EpicLoot API roll=" + (_rollMagic != null) + " save=" + (_saveMagic != null) + " setCheck=" + (_isMagicSetItem != null))); } private bool EnsureEpicLootApi() { if (_rarityType != null && _rollMagic != null && _saveMagic != null) { return true; } ResolveEpicLootApi(); bool flag = _rarityType != null && _rollMagic != null && _saveMagic != null; if (!flag) { ((BaseUnityPlugin)this).Logger.LogError((object)"[EWS-SETS] EpicLoot API still unavailable at item-give time."); } return flag; } private MethodInfo FindStatic(Type t, string name, int argc) { return t.GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic).FirstOrDefault((MethodInfo m) => m.Name == name && m.GetParameters().Length == argc); } private void InstallPatches() { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Expected O, but got Unknown //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Expected O, but got Unknown //IL_0125: 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_014d: Expected O, but got Unknown //IL_014d: Expected O, but got Unknown //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Expected O, but got Unknown //IL_01c2: Expected O, but got Unknown //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Expected O, but got Unknown //IL_022a: Expected O, but got Unknown MethodInfo[] methods = typeof(ItemData).GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { if (methodInfo.Name == "GetTooltip" && methodInfo.ReturnType == typeof(string)) { Harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(AccessTools.Method(typeof(Patches), "TooltipPostfix", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } MethodInfo[] methods2 = typeof(Character).GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (MethodInfo methodInfo2 in methods2) { if (methodInfo2.Name == "Damage") { Harmony.Patch((MethodBase)methodInfo2, (HarmonyMethod)null, new HarmonyMethod(AccessTools.Method(typeof(Patches), "DamagePostfix", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } MethodInfo methodInfo3 = AccessTools.Method(typeof(Humanoid), "BlockAttack", (Type[])null, (Type[])null); if (methodInfo3 != null) { Harmony.Patch((MethodBase)methodInfo3, new HarmonyMethod(AccessTools.Method(typeof(Patches), "BlockPrefix", (Type[])null, (Type[])null)), new HarmonyMethod(AccessTools.Method(typeof(Patches), "BlockPostfix", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[EWS-SETS] BlockAttack hook OK"); } MethodInfo methodInfo4 = AccessTools.Method(typeof(Attack), "OnAttackTrigger", (Type[])null, (Type[])null); if (methodInfo4 != null) { Harmony.Patch((MethodBase)methodInfo4, new HarmonyMethod(AccessTools.Method(typeof(Patches), "AttackDurPrefix", (Type[])null, (Type[])null)), new HarmonyMethod(AccessTools.Method(typeof(Patches), "AttackDurPostfix", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } MethodInfo methodInfo5 = AccessTools.Method(typeof(Player), "DamageArmorDurability", (Type[])null, (Type[])null); if (methodInfo5 != null) { Harmony.Patch((MethodBase)methodInfo5, new HarmonyMethod(AccessTools.Method(typeof(Patches), "ArmorDurPrefix", (Type[])null, (Type[])null)), new HarmonyMethod(AccessTools.Method(typeof(Patches), "ArmorDurPostfix", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } PatchActionLock(typeof(Player), "Dodge"); PatchActionLock(typeof(Player), "Jump"); PatchActionLock(typeof(Humanoid), "StartAttack"); } private void PatchActionLock(Type type, string methodName) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { if (!(methodInfo.Name != methodName)) { try { Harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(AccessTools.Method(typeof(Patches), "ActionLockPrefix", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } catch { } } } } private bool IsSkillBusy() { if (_skillBusy && Time.time >= _skillBusyUntil) { _skillBusy = false; } return _skillBusy; } private void BeginSkill(float duration) { _skillBusy = true; _skillBusyUntil = Time.time + duration; } private void EndSkill() { _skillBusy = false; _skillBusyUntil = 0f; } private void Update() { if (_attackBuffUntil > 0f && Time.time >= _attackBuffUntil) { Animator val = (((Object)(object)Player.m_localPlayer != (Object)null) ? ((Component)Player.m_localPlayer).GetComponentInChildren<Animator>() : null); if ((Object)(object)val != (Object)null) { val.speed = 1f; } _attackBuffUntil = 0f; _attackBuffFactor = 1f; } } private void LateUpdate() { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { _lastDurability.Clear(); return; } if (!TryGetBestDurabilityState(localPlayer, out var best, out var reduction)) { _lastDurability.Clear(); return; } HashSet<ItemData> hashSet = new HashSet<ItemData>(); foreach (ItemData allItem in ((Humanoid)localPlayer).GetInventory().GetAllItems()) { if (allItem == null || !allItem.m_equipped) { continue; } hashSet.Add(allItem); if (_lastDurability.TryGetValue(allItem, out var value) && allItem.m_durability < value) { float durability = allItem.m_durability; float num = value - durability; float num2 = value - num * (1f - reduction); if (reduction >= 0.9999f) { num2 = value; } allItem.m_durability = Mathf.Max(0f, num2); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[EWS-SETS] DURABILITY PATH=LateUpdateFallback tier=" + best.Tier + " item=" + SafeName(allItem) + " before=" + value.ToString("0.###") + " observed=" + durability.ToString("0.###") + " final=" + allItem.m_durability.ToString("0.###"))); } _lastDurability[allItem] = allItem.m_durability; } foreach (ItemData item in _lastDurability.Keys.ToList()) { if (!hashSet.Contains(item)) { _lastDurability.Remove(item); } } } private void CaptureAllDurability(string path) { Player localPlayer = Player.m_localPlayer; if (!TryGetBestDurabilityState(localPlayer, out var _, out var _)) { return; } _durBefore.Clear(); foreach (ItemData allItem in ((Humanoid)localPlayer).GetInventory().GetAllItems()) { if (allItem != null && allItem.m_equipped) { _durBefore[allItem] = allItem.m_durability; } } } private void RestoreAllDurability(string path) { Player localPlayer = Player.m_localPlayer; if (!TryGetBestDurabilityState(localPlayer, out var best, out var reduction)) { _durBefore.Clear(); return; } foreach (KeyValuePair<ItemData, float> item in _durBefore.ToList()) { ItemData key = item.Key; if (key == null || !key.m_equipped) { continue; } float value = item.Value; float durability = key.m_durability; if (!(durability >= value)) { float num = value - durability; float num2 = value - num * (1f - reduction); if (reduction >= 0.9999f) { num2 = value; } key.m_durability = Mathf.Max(0f, num2); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[EWS-SETS] DURABILITY PATH=" + path + " tier=" + best.Tier + " item=" + SafeName(key) + " before=" + value.ToString("0.###") + " gameAfter=" + durability.ToString("0.###") + " final=" + key.m_durability.ToString("0.###"))); } } _durBefore.Clear(); } private bool TryGetBestDurabilityState(Player p, out SetState best, out float reduction) { best = default(SetState); reduction = 0f; if ((Object)(object)p == (Object)null) { return false; } foreach (string item in AllSetIds()) { SetState setState = GetSetState(p, item); if (setState.Count >= 2) { float num = TierDurability(setState.Tier); if (num > reduction) { reduction = num; best = setState; } } } return reduction > 0f; } private float TierDurability(string tier) { if (string.Equals(tier, "Mythic", StringComparison.OrdinalIgnoreCase)) { return 1f; } if (string.Equals(tier, "Legendary", StringComparison.OrdinalIgnoreCase)) { return 0.8f; } if (string.Equals(tier, "Epic", StringComparison.OrdinalIgnoreCase)) { return 0.6f; } return 0f; } private void OnSummonHit(Character victim, object hitObj) { if ((Object)(object)victim == (Object)null || hitObj == null) { return; } object attacker = GetAttacker(hitObj); Character val = (Character)((attacker is Character) ? attacker : null); if ((Object)(object)val == (Object)null || val is Player) { return; } Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { return; } SetState setState = GetSetState(localPlayer, "summoner"); if (setState.Count < 3 || !IsSummonLike(val, localPlayer)) { return; } if (Random.value < 0.2f) { ((MonoBehaviour)this).StartCoroutine(BuffSummonMove(val, 1.2f, 10f)); } if (setState.Count >= 4 && Random.value < 0.1f) { ((MonoBehaviour)this).StartCoroutine(BuffSummonAttack(val, 1.2f, 10f)); } if (setState.Count >= 5) { float num = ReadHitDamage(hitObj); if (num > 0f) { float num2 = num * 0.2f; val.Heal(num2, true); } } } private bool IsSummonLike(Character c, Player owner) { //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)c == (Object)null || (Object)(object)owner == (Object)null) { return false; } string text = (((Object)c).name ?? "") + " " + c.GetHoverName(); string text2 = text.ToLowerInvariant(); if (text2.Contains("goblin") || text2.Contains("skeleton") || text2.Contains("troll") || text2.Contains("summon") || text2.Contains("고블린") || text2.Contains("해골")) { return true; } try { if (c.IsTamed() && Vector3.Distance(((Component)c).transform.position, ((Component)owner).transform.position) < 80f) { return true; } } catch { } return false; } private float ReadHitDamage(object hitObj) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) try { object obj = ReadMember(hitObj, "m_damage"); if (obj is DamageTypes) { return TotalDamage((DamageTypes)obj); } } catch { } return 0f; } private IEnumerator BuffSummonMove(Character c, float factor, float duration) { if ((Object)(object)c == (Object)null) { yield break; } Dictionary<FieldInfo, float> originals = new Dictionary<FieldInfo, float>(); try { string[] array = new string[2] { "m_walkSpeed", "m_runSpeed" }; foreach (string name in array) { FieldInfo field = typeof(Character).GetField(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null && field.FieldType == typeof(float)) { float num = (originals[field] = (float)field.GetValue(c)); field.SetValue(c, num * factor); } } } catch { } yield return (object)new WaitForSeconds(duration); try { if (!((Object)(object)c != (Object)null)) { yield break; } foreach (KeyValuePair<FieldInfo, float> item in originals) { item.Key.SetValue(c, item.Value); } } catch { } } private IEnumerator BuffSummonAttack(Character c, float factor, float duration) { if ((Object)(object)c == (Object)null) { yield break; } Animator a = null; float oldSpeed = 1f; try { a = ((Component)c).GetComponentInChildren<Animator>(); if ((Object)(object)a != (Object)null) { oldSpeed = a.speed; a.speed = oldSpeed * factor; } } catch { } yield return (object)new WaitForSeconds(duration); try { if ((Object)(object)a != (Object)null) { a.speed = oldSpeed; } } catch { } } private void OnHit(Character victim, object hitObj) { //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_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) object attacker = GetAttacker(hitObj); Player val = (Player)((attacker is Player) ? attacker : null); if ((Object)(object)val == (Object)null || (Object)(object)val != (Object)(object)Player.m_localPlayer || (Object)(object)victim == (Object)null || (Object)(object)victim == (Object)(object)val || IsSkillBusy()) { return; } ItemData currentWeapon = GetCurrentWeapon(val); if (currentWeapon == null) { return; } EnsureFinalTag(currentWeapon); string text = TaggedSet(currentWeapon); if (string.IsNullOrEmpty(text) || !WeaponMatchesSet(currentWeapon, text)) { return; } SetState setState = GetSetState(val, text); if (setState.Count < 3) { return; } DamageTypes damage = currentWeapon.GetDamage(); if (Random.value < 0.2f) { ApplyThreeSet(val, text, setState); } if (setState.Count >= 4 && Random.value < 0.1f) { ApplyFourSet(val, victim, hitObj, text, setState, damage); } if (setState.Count < 5 || text == "summoner" || text == "tank" || CooldownActive(text)) { return; } float fivePieceProcChance = GetFivePieceProcChance(currentWeapon, text); float value = Random.value; ((BaseUnityPlugin)this).Logger.LogInfo((object)("[EWS-SETS] 5P set=" + text + " roll=" + (value * 100f).ToString("0.0") + " chance=" + (fivePieceProcChance * 100f).ToString("0.0"))); if (!(value >= fivePieceProcChance)) { SetCooldown(text); Vector3 centerPoint = victim.GetCenterPoint(); switch (text) { case "warrior": ((MonoBehaviour)this).StartCoroutine(GenericMeleeWhirlwind(val, damage, 3.5f, 5.2f, "WARRIOR")); break; case "archer": ((MonoBehaviour)this).StartCoroutine(ArcherSkill(val, centerPoint, damage)); break; case "assassin": ((MonoBehaviour)this).StartCoroutine(AssassinStabSkill(val, damage)); break; } } } private void OnBlock(Player p, object[] args) { //IL_00c6: 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_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_0150: 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_015a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)p == (Object)null || IsSkillBusy()) { return; } ItemData equippedShield = GetEquippedShield(p); if (equippedShield == null) { return; } EnsureFinalTag(equippedShield); if (TaggedSet(equippedShield) != "tank") { return; } SetState setState = GetSetState(p, "tank"); if (setState.Count < 3) { return; } if (Random.value < 0.2f) { AddStamina(p, 50f); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[EWS-SETS] TANK 3P stamina +50"); } float num = ReadIncomingDamage(args); Character val = FindAttackerFromArgs(args); if (setState.Count >= 4 && num > 0f && (Object)(object)val != (Object)null && (Object)(object)val != (Object)(object)p && Random.value < 0.1f) { DamageTypes damage = NewDamage("m_blunt", num * 2f); DealDamage(p, val, damage, 0.5f); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[EWS-SETS] TANK 4P reflect 200%"); } if (setState.Count >= 5 && !(num <= 0f) && !((Object)(object)val == (Object)null) && !((Object)(object)val == (Object)(object)p) && !CooldownActive("tank")) { float num2 = TierFiveChance(setState.Tier); if (!(Random.value >= num2)) { SetCooldown("tank"); DamageTypes damage2 = NewDamage("m_blunt", num * 3f); DealDamage(p, val, damage2, 0.5f); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[EWS-SETS] TANK 5P reflect 300%"); } } } private void ApplyThreeSet(Player p, string setId, SetState st) { switch (setId) { case "warrior": { float num = ((Character)p).GetMaxHealth() * 0.06f; ((Character)p).Heal(num, true); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[EWS-SETS] WARRIOR 3P heal 6%"); break; } case "archer": case "assassin": AddStamina(p, 50f); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[EWS-SETS] " + setId + " 3P stamina +50")); break; } } private void ApplyFourSet(Player p, Character victim, object hitObj, string setId, SetState st, DamageTypes baseDamage) { switch (setId) { case "warrior": case "archer": ApplyAttackSpeedBuff(p, 0.2f); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[EWS-SETS] " + setId + " 4P atkspd +20%")); break; case "assassin": ApplyAttackSpeedBuff(p, 0.25f); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[EWS-SETS] assassin 4P atkspd +25%"); break; } } private IEnumerator AssassinStabSkill(Player p, DamageTypes baseDamage) { //IL_0016: 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) BeginSkill(1.4f); Animator a = BeginFastAnimation(p, 3.5f); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[EWS-SETS] ASSASSIN 5P RAPID STAB START"); for (int i = 0; i < 10; i++) { TriggerCurrentAttack(p); int n = DamageCone(p, baseDamage, 0.35f, 6f, 38f, (i == 9) ? 5f : 0.5f); SpawnAssassinStabFx(p, i, 10); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[EWS-SETS] assassin stab " + (i + 1) + "/" + 10 + " targets=" + n)); yield return (object)new WaitForSeconds(0.13f); } EndFastAnimation(a); EndSkill(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[EWS-SETS] ASSASSIN 5P RAPID STAB END"); } private void SpawnAssassinStabFx(Player p, int index, int total) { //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_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_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_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: 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_009b: 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_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: 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_00bf: 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_00f5: 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_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)p == (Object)null) { return; } Vector3 forward = ((Component)p).transform.forward; forward.y = 0f; if (((Vector3)(ref forward)).sqrMagnitude < 0.001f) { forward = Vector3.forward; } ((Vector3)(ref forward)).Normalize(); Vector3 val = ((Character)p).GetCenterPoint() + forward * 1f; int num = 3; for (int i = 0; i < num; i++) { float num2 = ((num == 1) ? 0.5f : ((float)i / (float)(num - 1))); float num3 = Mathf.Lerp(-20f, 20f, num2); Vector3 val2 = Quaternion.Euler(0f, num3, 0f) * forward; float num4 = 1.8f + (float)i * 0.6f; Vector3 pos = val + val2 * num4; GameObject val3 = SpawnAny(pos, "vfx_HitSparks", "vfx_sword_hit"); if ((Object)(object)val3 != (Object)null) { val3.transform.localScale = Vector3.one * ((index == total - 1) ? 1f : 0.7f); } GameObject val4 = SpawnAny(pos, "vfx_fireball_hit", "fx_batteringram_fire"); if ((Object)(object)val4 != (Object)null) { val4.transform.localScale = Vector3.one * ((index == total - 1) ? 0.75f : 0.45f); } } } private void PlayWhirlwindSoundHeavy(Player p, bool heavy) { //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_0017: 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_0047: 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_0086: 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_00bc: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)p == (Object)null)) { Vector3 position = ((Component)p).transform.position; SpawnAny(position, "sfx_battleaxe_swing_wosh"); SpawnAny(position, "sfx_atgeir_attack"); SpawnAny(position, "sfx_sledge_swing"); SpawnAny(position, "sfx_sword_swing", "sfx_club_swing"); if (heavy) { SpawnAny(position, "sfx_battleaxe_swing_wosh"); SpawnAny(position, "sfx_sledge_swing"); SpawnAny(position, "sfx_atgeir_attack"); } } } private void SpawnWhirlwindElementImpact(Player p, int tick, int totalTicks, float radius) { //IL_0027: 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_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_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_007f: 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_0089: 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_005c: Unknown result type (might be due to invalid IL or missing references) //IL_012e: 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_019e: 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_0100: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_0193: 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)p == (Object)null || tick % 2 != 0) { return; } float num = (float)tick / (float)totalTicks * 360f; Vector3 val = Quaternion.Euler(0f, num, 0f) * ((Component)p).transform.forward; val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude < 0.001f) { val = Vector3.forward; } ((Vector3)(ref val)).Normalize(); float num2 = Mathf.Min(radius * 0.55f, 2.8f); Vector3 pos = ((Character)p).GetCenterPoint() + val * num2; bool flag = tick == totalTicks; if (tick % 4 == 0) { GameObject val2 = SpawnAny(pos, "vfx_fireball_hit", "vfx_FireballHit", "vfx_arrowhit_fire", "vfx_ArrowHitFire"); if ((Object)(object)val2 != (Object)null) { val2.transform.localScale = Vector3.one * (flag ? 1.15f : 0.75f); } SpawnAny(pos, "sfx_fireball_hit", "sfx_fireball_explode", "sfx_FireballHit"); return; } GameObject val3 = SpawnAny(pos, "vfx_lightning", "vfx_Lightning", "vfx_lightning_hit", "vfx_LightningHit", "fx_lightning"); if ((Object)(object)val3 != (Object)null) { val3.transform.localScale = Vector3.one * (flag ? 1.1f : 0.7f); } SpawnAny(pos, "sfx_lightning", "sfx_lightning_hit", "sfx_thunder", "sfx_electric"); } private IEnumerator GenericMeleeWhirlwind(Player p, DamageTypes baseDamage, float totalScale, float radius, string label) { //IL_0016: 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) float adjustedTotalScale = totalScale * 1.25f; float perTick = adjustedTotalScale / 8f; BeginSkill(2.15f); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[EWS-SETS] " + label + " WHIRLWIND START totalScale=" + (adjustedTotalScale * 100f).ToString("0.0") + "% duration=2.00s")); float end = Time.time + 2f; float nextTick = Time.time; float yaw = (((Object)(object)p != (Object)null) ? ((Component)p).transform.eulerAngles.y : 0f); int tick = 0; PlayWhirlwindSoundHeavy(p, heavy: true); while ((Object)(object)p != (Object)null && Time.time < end) { yaw += 720f * Time.deltaTime; Vector3 e = ((Component)p).transform.eulerAngles; ((Component)p).transform.rotation = Quaternion.Euler(e.x, yaw, e.z); if (Time.time >= nextTick && tick < 8) { nextTick += 0.25f; tick++; PlayWhirlwindSoundHeavy(p, tick == 8); int num = DamageRadius(p, ((Character)p).GetCenterPoint(), baseDamage, perTick, radius, (tick == 8) ? 7f : 1f); SpawnWhirlwindElementImpact(p, tick, 8, radius); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[EWS-SETS] " + label + " whirlwind " + tick + "/" + 8 + " targets=" + num + " scale=" + (perTick * 100f).ToString("0.00") + "%")); } yield return null; } while ((Object)(object)p != (Object)null && tick < 8) { tick++; int n = DamageRadius(p, ((Character)p).GetCenterPoint(), baseDamage, perTick, radius, (tick == 8) ? 7f : 1f); SpawnWhirlwindElementImpact(p, tick, 8, radius); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[EWS-SETS] " + label + " whirlwind catchup " + tick + "/" + 8 + " targets=" + n)); yield return null; } PlayWhirlwindSoundHeavy(p, heavy: true); EndSkill(); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[EWS-SETS] " + label + " WHIRLWIND END")); } private IEnumerator BerserkerAxeSkill(Player p, DamageTypes baseDamage) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return GenericMeleeWhirlwind(p, baseDamage, 3.5f, 5f, "BERSERKER AXE"); } private IEnumerator BerserkerCrushSkill(Player p, DamageTypes baseDamage) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return GenericMeleeWhirlwind(p, baseDamage, 3.6f, 5.5f, "BERSERKER BLUNT"); } private IEnumerator ArcherSkill(Player p, Vector3 center, DamageTypes baseDamage) { //IL_0016: 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_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) BeginSkill(1.35f); Animator a = BeginFastAnimation(p, 2.4f); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[EWS-SETS] ARCHER 5P SHOCKWAVE VOLLEY START"); for (int i = 0; i < 5; i++) { TriggerCurrentAttack(p); Vector3 offset = new Vector3(Random.Range(-1.2f, 1.2f), 0f, Random.Range(-1.2f, 1.2f)); Vector3 point = center + offset; int n = DamageRadius(p, point, baseDamage, 0.7f, 3.2f, (i == 4) ? 6f : 1.5f); SpawnArcherShockwave(point, (i == 4) ? 1.15f : 1f); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[EWS-SETS] archer shockwave " + (i + 1) + "/" + 5 + " targets=" + n)); yield return (object)new WaitForSeconds(0.24000001f); } EndFastAnimation(a); EndSkill(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[EWS-SETS] ARCHER 5P END"); } private IEnumerator TankSkill(Player p, float blockPower) { BeginSkill(0.8f); Animator a = BeginFastAnimation(p, 2f); TriggerCurrentAttack(p); int n = DamageRadius(baseDamage: NewDamage("m_blunt", blockPower * 3f), p: p, point: ((Component)p).transform.position, scale: 1f, radius: 6f, push: 12f); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[EWS-SETS] TANK 5P EARTH SHIELD SLAM targets=" + n + " damage=" + (blockPower * 3f).ToString("0.0"))); yield return (object)new WaitForSeconds(0.8f); EndFastAnimation(a); EndSkill(); } private IEnumerator SummonerSkill(Player p, DamageTypes baseDamage) { //IL_0016: 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) BeginSkill(1.7f); Animator a = BeginFastAnimation(p, 2.5f); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[EWS-SETS] SUMMONER 5P SOULFIRE NOVA START"); bool hitAny = false; for (int i = 0; i < 8; i++) { TriggerCurrentAttack(p); int n = DamageRadius(p, ((Component)p).transform.position, baseDamage, 0.45f, 6f, 1f); if (n > 0) { hitAny = true; } yield return (object)new WaitForSeconds(0.2f); } if (hitAny) { ((Character)p).Heal(((Character)p).GetMaxHealth() * 0.1f, true); } EndFastAnimation(a); EndSkill(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[EWS-SETS] SUMMONER 5P END"); } private IEnumerator SwordsmanSkill(Player p, DamageTypes baseDamage) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return GenericMeleeWhirlwind(p, baseDamage, 3.5f, 5.2f, "SWORDSMAN"); } private IEnumerator AssassinSkill(Player p, DamageTypes baseDamage) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return GenericMeleeWhirlwind(p, baseDamage, 3.5f, 4.3f, "ASSASSIN"); } private int DamageCone(Player p, DamageTypes baseDamage, float scale, float range, float halfAngle, float push) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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_0039: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: 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_00c9: 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_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) int num = 0; _ = ((Component)p).transform.position; Vector3 forward = ((Component)p).transform.forward; forward.y = 0f; if (((Vector3)(ref forward)).sqrMagnitude < 0.001f) { forward = Vector3.forward; } ((Vector3)(ref forward)).Normalize(); foreach (Character allCharacter in Character.GetAllCharacters()) { if (!((Object)(object)allCharacter == (Object)null) && !((Object)(object)allCharacter == (Object)(object)p) && !allCharacter.IsDead() && IsEnemy(p, allCharacter)) { Vector3 val = allCharacter.GetCenterPoint() - ((Character)p).GetCenterPoint(); val.y = 0f; float magnitude = ((Vector3)(ref val)).magnitude; if (!(magnitude > range) && (!(magnitude > 1.5f) || !(Vector3.Angle(forward, ((Vector3)(ref val)).normalized) > halfAngle))) { DealDamage(p, allCharacter, ScaleDamage(baseDamage, scale), push); num++; } } } return num; } private int DamageRadius(Player p, Vector3 point, DamageTypes baseDamage, float scale, float radius, float push) { //IL_003b: 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_004f: 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) int num = 0; foreach (Character allCharacter in Character.GetAllCharacters()) { if (!((Object)(object)allCharacter == (Object)null) && !((Object)(object)allCharacter == (Object)(object)p) && !allCharacter.IsDead() && IsEnemy(p, allCharacter) && !(Vector3.Distance(point, allCharacter.GetCenterPoint()) > radius)) { DealDamage(p, allCharacter, ScaleDamage(baseDamage, scale), push); num++; } } return num; } private void DealDamage(Player attacker, Character target, DamageTypes damage, float push) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //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_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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_0034: 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_005a: 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_0066: Unknown result type (might be due to invalid IL or missing references) HitData val = new HitData(); val.m_damage = damage; val.m_point = target.GetCenterPoint(); Vector3 dir = ((Component)target).transform.position - ((Component)attacker).transform.position; dir.y = 0f; if (((Vector3)(ref dir)).sqrMagnitude < 0.001f) { dir = ((Component)attacker).transform.forward; } else { ((Vector3)(ref dir)).Normalize(); } val.m_dir = dir; val.m_pushForce = push; val.SetAttacker((Character)(object)attacker); try { _internalDamage = true; target.Damage(val); } finally { _internalDamage = false; } } private void SpawnOneHandSwordBurst(Player p, int index, int total) { //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_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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_009b: 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_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: 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_00bc: 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_00f2: 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_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)p == (Object)null) { return; } try { Vector3 forward = ((Component)p).transform.forward; forward.y = 0f; if (((Vector3)(ref forward)).sqrMagnitude < 0.001f) { forward = Vector3.forward; } ((Vector3)(ref forward)).Normalize(); Vector3 val = Vector3.Cross(Vector3.up, forward); Vector3 normalized = ((Vector3)(ref val)).normalized; float num = ((total <= 1) ? 0f : ((float)index / (float)(total - 1))); float num2 = Mathf.Lerp(1.8f, 4.2f, num); float num3 = ((index % 2 == 0) ? (-1f) : 1f) * (0.35f + 0.15f * (float)(index % 3)); Vector3 pos = ((Character)p).GetCenterPoint() + forward * num2 + normalized * num3; GameObject val2 = SpawnAny(pos, "vfx_fireball_hit", "fx_batteringram_fire"); if ((Object)(object)val2 != (Object)null) { val2.transform.localScale = Vector3.one * ((index == total - 1) ? 1.75f : 1.25f); } GameObject val3 = SpawnAny(pos, "vfx_HitSparks", "vfx_sword_hit"); if ((Object)(object)val3 != (Object)null) { val3.transform.localScale = Vector3.one * ((index == total - 1) ? 1.45f : 1.05f); } } catch (Exception e) { ((BaseUnityPlugin)this).Logger.LogDebug((object)("[EWS-SETS] one-hand sword burst: " + Inner(e))); } } private void SpawnWeaponTipFlame(Player p, float scale) { //IL_002d: 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_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_004c: 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_00e0: 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_0085: 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_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)p == (Object)null) { return; } try { ItemData currentWeapon = GetCurrentWeapon(p); if (currentWeapon == null) { return; } try { object obj = ReadMember(currentWeapon, "m_dropPrefab"); } catch { } Vector3 pos = ((Character)p).GetCenterPoint() + ((Component)p).transform.forward * 1.2f; try { Transform[] componentsInChildren = ((Component)p).GetComponentsInChildren<Transform>(); Transform val = ((IEnumerable<Transform>)componentsInChildren).FirstOrDefault((Func<Transform, bool>)delegate(Transform t) { string text = ((((Object)t).name != null) ? ((Object)t).name.ToLowerInvariant() : ""); return text.Contains("right") && (text.Contains("hand") || text.Contains("weapon")); }); if ((Object)(object)val != (Object)null) { pos = val.position + ((Component)p).transform.forward * 0.8f; } } catch { } GameObject val2 = SpawnAny(pos, "vfx_fireball_hit", "fx_batteringram_fire"); if ((Object)(object)val2 != (Object)null) { val2.transform.localScale = Vector3.one * scale; } } catch { } } private void SpawnImpactFan(Player p, int points, float range, bool finisher) { //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_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_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) //IL_006c: 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_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_008a: 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_0097: Unknown result type (might be due to invalid IL or missing references) Vector3 forward = ((Component)p).transform.forward; forward.y = 0f; if (((Vector3)(ref forward)).sqrMagnitude < 0.001f) { forward = Vector3.forward; } ((Vector3)(ref forward)).Normalize(); for (int i = 0; i < points; i++) { float num = ((points == 1) ? 0.5f : ((float)i / (float)(points - 1))); float num2 = Mathf.Lerp(-35f, 35f, num); Vector3 val = Quaternion.Euler(0f, num2, 0f) * forward; Vector3 pos = ((Character)p).GetCenterPoint() + val * (2f + num * (range - 2f)); SpawnDustFire(pos, finisher ? 1f : 0.65f); } } private void SpawnArcherShockwave(Vector3 pos, float scale) { //IL_0054: 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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: 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_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_02ef: 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_0327: Unknown result type (might be due to invalid IL or missing references) //IL_035c: Unknown result type (might be due to invalid IL or missing references) //IL_0368: Unknown result type (might be due to invalid IL or missing references) string[] names = new string[8] { "vfx_groundslam", "vfx_GroundSlam", "vfx_sledge_hit", "vfx_SledgeHit", "vfx_lox_groundslam", "vfx_LoxGroundSlam", "vfx_lox_attack", "vfx_LoxAttack" }; GameObject val = SpawnAny(pos, names); if ((Object)(object)val != (Object)null) { val.transform.localScale = Vector3.one * (scale * 1.2f); SpawnAny(pos, "sfx_lox_attack", "sfx_LoxAttack", "sfx_sledge_hit", "sfx_sledge_swing"); GameObject val2 = SpawnAny(pos, "vfx_HitSparks", "vfx_sword_hit"); if ((Object)(object)val2 != (Object)null) { val2.transform.localScale = Vector3.one * (scale * 0.45f); } ((BaseUnityPlugin)this).Logger.LogInfo((object)("[EWS-SETS] ARCHER clean shockwave exact=" + ((Object)val).name)); return; } try { if ((Object)(object)ZNetScene.instance != (Object)null) { FieldInfo field = typeof(ZNetScene).GetField("m_namedPrefabs", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); object obj = ((field != null) ? field.GetValue(ZNetScene.instance) : null); if (obj is IDictionary dictionary) { foreach (DictionaryEntry item in dictionary) { object? value = item.Value; GameObject val3 = (GameObject)((value is GameObject) ? value : null); if ((Object)(object)val3 == (Object)null) { continue; } string text = ((Object)val3).name ?? ""; string text2 = text.ToLowerInvariant(); if (text2.Contains("fire") || text2.Contains("flame") || text2.Contains("explos") || text2.Contains("smoke") || text2.Contains("fog") || text2.Contains("mist") || text2.Contains("dust") || text2.Contains("cloud") || text2.Contains("poison")) { continue; } bool flag = text2.Contains("groundslam") || text2.Contains("shockwave") || text2.Contains("ground") || text2.Contains("slam") || text2.Contains("lox") || text2.Contains("sledge"); bool flag2 = text2.Contains("vfx") || text2.Contains("fx"); if (flag && flag2) { GameObject val4 = Object.Instantiate<GameObject>(val3, pos, Quaternion.identity); val4.transform.localScale = Vector3.one * (scale * 1.2f); SpawnAny(pos, "sfx_lox_attack", "sfx_sledge_hit", "sfx_sledge_swing"); GameObject val5 = SpawnAny(pos, "vfx_HitSparks", "vfx_sword_hit"); if ((Object)(object)val5 != (Object)null) { val5.transform.localScale = Vector3.one * (scale * 0.45f); } ((BaseUnityPlugin)this).Logger.LogInfo((object)("[EWS-SETS] ARCHER clean shockwave scan=" + text)); return; } } } } } catch (Exception e) { ((BaseUnityPlugin)this).Logger.LogDebug((object)("[EWS-SETS] archer clean shockwave scan: " + Inner(e))); } ((BaseUnityPlugin)this).Logger.LogInfo((object)"[EWS-SETS] ARCHER clean shockwave not found; damage only"); } private void SpawnDustFire(Vector3 pos, float scale) { //IL_0001: 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_0037: 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_0076: 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) GameObject val = SpawnAny(pos, "vfx_sledge_hit", "vfx_HitSparks", "vfx_sword_hit"); if ((Object)(object)val != (Object)null) { val.transform.localScale = Vector3.one * scale; } GameObject val2 = SpawnAny(pos, "vfx_fireball_hit", "fx_batteringram_fire"); if ((Object)(object)val2 != (Object)null) { val2.transform.localScale = Vector3.one * (scale * 0.75f); } } private GameObject SpawnAny(Vector3 pos, params string[] names) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) foreach (string text in names) { try { GameObject val = (((Object)(object)ZNetScene.instance != (Object)null) ? ZNetScene.instance.GetPrefab(text) : null); if ((Object)(object)val != (Object)null) { return Object.Instantiate<GameObject>(val, pos, Quaternion.identity); } } catch { } } return null; } private Animator BeginFastAnimation(Player p, float speed) { try { Animator componentInChildren = ((Component)p).GetComponentInChildren<Animator>(); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.speed = speed; } return componentInChildren; } catch { return null; } } private void EndFastAnimation(Animator a) { try { if ((Object)(object)a != (Object)null) { a.speed = 1f; } } catch { } } private bool TriggerCurrentAttackDiag(Player p) { try { ItemData currentWeapon = GetCurrentWeapon(p); if (currentWeapon == null || currentWeapon.m_shared == null) { ((BaseUnityPlugin)this).Logger.LogInfo((object)"[EWS-AXE-DIAG] TriggerCurrentAttack: weapon=null"); return false; } object obj = ReadMember(currentWeapon.m_shared, "m_attack"); object obj2 = ((obj != null) ? ReadMember(obj, "m_attackAnimation") : null); string text = ((obj2 != null) ? obj2.ToString() : ""); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[EWS-AXE-DIAG] triggerName=" + (string.IsNullOrEmpty(text) ? "<empty>" : text))); if (string.IsNullOrEmpty(text)) { return false; } object obj3 = ReadMember(p, "m_zanim"); if (obj3 != null) { MethodInfo method = obj3.GetType().GetMethod("SetTrigger", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[1] { typeof(string) }, null); if (method != null) { method.Invoke(obj3, new object[1] { text }); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[EWS-AXE-DIAG] ZSyncAnimation.SetTrigger OK"); return true; } ((BaseUnityPlugin)this).Logger.LogInfo((object)"[EWS-AXE-DIAG] ZSyncAnimation.SetTrigger NOT FOUND"); } else { ((BaseUnityPlugin)this).Logger.LogInfo((object)"[EWS-AXE-DIAG] m_zanim=null"); } Animator componentInChildren = ((Component)p).GetComponentInChildren<Animator>(); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.SetTrigger(text); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[EWS-AXE-DIAG] Animator.SetTrigger OK"); return true; } ((BaseUnityPlugin)this).Logger.LogInfo((object)"[EWS-AXE-DIAG] Animator=null"); return false; } catch (Exception e) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("[EWS-AXE-DIAG] TriggerCurrentAttack ERR=" + Inner(e))); return false; } } private void TriggerCurrentAttack(Player p) { try { ItemData currentWeapon = GetCurrentWeapon(p); if (currentWeapon == null || currentWeapon.m_shared == null) { return; } object obj = ReadMember(currentWeapon.m_shared, "m_attack"); object obj2 = ((obj != null) ? ReadMember(obj, "m_attackAnimation") : null); string text = ((obj2 != null) ? obj2.ToString() : ""); if (string.IsNullOrEmpty(text)) { return; } object obj3 = ReadMember(p, "m_zanim"); if (obj3 != null) { MethodInfo method = obj3.GetType().GetMethod("SetTrigger", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[1] { typeof(string) }, null); if (method != null) { method.Invoke(obj3, new object[1] { text }); return; } } Animator componentInChildren = ((Component)p).GetComponentInChildren<Animator>(); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.SetTrigger(text); } } catch { } } private void ApplyAttackSpeedBuff(Player p, float bonus) { try { Animator componentInChildren = ((Component)p).GetComponentInChildren<Animator>(); if (!((Object)(object)componentInChildren == (Object)null)) { _attackBuffFactor = Mathf.Max(_attackBuffFactor, 1f + bonus); componentInChildren.speed = _attackBuffFactor; _attackBuffUntil = Time.time + 10f; } } catch { } } private bool CooldownActive(string setId) { if (_cooldowns.TryGetValue(setId, out var value)) { return Time.time < value; } return false; } private void SetCooldown(string setId) { _cooldowns[setId] = Time.time + 8f; } private float GetFivePieceProcChance(ItemData weapon, string setId) { switch (setId) { case "archer": return 0.4f; case "assassin": return 0.2f; case "warrior": if (!IsTwoHandedWarriorWeapon(weapon)) { return 0.25f; } return 0.35f; default: return 0f; } } private float TierFiveChance(string tier) { if (string.Equals(tier, "Epic", StringComparison.OrdinalIgnoreCase)) { return 0.12f; } if (string.Equals(tier, "Legendary", StringComparison.OrdinalIgnoreCase)) { return 0.21f; } if (string.Equals(tier, "Mythic", StringComparison.OrdinalIgnoreCase)) { return 0.3f; } return 0f; } private bool IsTwoHandedWarriorWeapon(ItemData item) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) if (item == null || item.m_shared == null) { return false; } string text = ((object)item.m_shared.m_skillType).ToString(); string text2 = (item.m_shared.m_name ?? "") + " " + GetPrefabName(item); if (text.IndexOf("Polearm", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("Polearms", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } if (text2.IndexOf("Battleaxe", StringComparison.OrdinalIgnoreCase) >= 0 || text2.IndexOf("Sledge", StringComparison.OrdinalIgnoreCase) >= 0 || text2.IndexOf("Demolisher", StringComparison.OrdinalIgnoreCase) >= 0 || text2.IndexOf("THSword", StringComparison.OrdinalIgnoreCase) >= 0 || text2.IndexOf("Krom", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } return false; } private bool IsAxeWeapon(ItemData item) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) if (item == null || item.m_shared == null) { return false; } string text = ((object)item.m_shared.m_skillType).ToString(); string text2 = (item.m_shared.m_name ?? "") + " " + GetPrefabName(item); if (text.IndexOf("Axes", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("Axe", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } if (text2.IndexOf("Axe", StringComparison.OrdinalIgnoreCase) < 0) { return text2.IndexOf("도끼", StringComparison.OrdinalIgnoreCase) >= 0; } return true; } private void TriggerAxeComboAnimation(Player p, int comboStep) { if ((Object)(object)p == (Object)null) { return; } try { object obj = ReadMember(p, "m_zanim"); if (obj != null) { Type type = obj.GetType(); string[] array = new string[4] { "attack_chain", "attack_index", "attack_combo", "combo" }; foreach (string text in array) { try { MethodInfo method = type.GetMethod("SetInt", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[2] { typeof(string), typeof(int) }, null); if (method != null) { method.Invoke(obj, new object[2] { text, comboStep }); } } catch { } } } } catch { } try { Animator componentInChildren = ((Component)p).GetComponentInChildren<Animator>(); if ((Object)(object)componentInChildren != (Object)null) { string[] array2 = new string[4] { "attack_chain", "attack_index", "attack_combo", "combo" }; foreach (string text2 in array2) { try { componentInChildren.SetInteger(text2, comboStep); } catch { } } } } catch { } TriggerCurrentAttack(p); } private bool WeaponMatchesSet(ItemData item, string setId) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) if (item == null || item.m_shared == null) { return false; } string text = ((object)item.m_shared.m_skillType).ToString(); string text2 = (item.m_shared.m_name ?? "") + " " + GetPrefabName(item); switch (setId) { case "warrior": if (text.IndexOf("Axes", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("Axe", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } if (text.IndexOf("Polearm", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("Polearms", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } if (text.IndexOf("Clubs", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("Club", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } if (text.IndexOf("Swords", StringComparison.OrdinalIgnoreCase) >= 0 && (text2.IndexOf("THSword", StringComparison.OrdinalIgnoreCase) >= 0 || text2.IndexOf("Krom", StringComparison.OrdinalIgnoreCase) >= 0 || text2.IndexOf("2H", StringComparison.OrdinalIgnoreCase) >= 0)) { return true; } return false; case "archer": if (text.IndexOf("Bows", StringComparison.OrdinalIgnoreCase) >= 0) { return text.IndexOf("Crossbow", StringComparison.OrdinalIgnoreCase) < 0; } return false; case "assassin": if (text.IndexOf("Knives", StringComparison.OrdinalIgnoreCase) < 0 && text.IndexOf("Spear", StringComparison.OrdinalIgnoreCase) < 0 && text2.IndexOf("Knife", StringComparison.OrdinalIgnoreCase) < 0) { return text2.IndexOf("Spear", StringComparison.OrdinalIgnoreCase) >= 0; } return true; case "summoner": if (IsTagged(item)) { return TaggedSet(item) == "summoner"; } return false; default: return false; } } private ItemData GetEquippedShield(Player p) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) foreach (ItemData allItem in ((Humanoid)p).GetInventory().GetAllItems()) { if (allItem != null && allItem.m_equipped && allItem.m_shared != null) { string text = ((object)allItem.m_shared.m_itemType).ToString(); if (text.IndexOf("Shield", StringComparison.OrdinalIgnoreCase) >= 0) { return allItem; } } } return null; } private float ReadShieldPower(ItemData shield) { try { object obj = ReadMember(shield.m_shared, "m_blockPower"); if (obj is float) { return (float)obj; } } catch { } return 50f; } private float ReadIncomingDamage(object[] args) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) if (args == null) { return 0f; } object obj = args.FirstOrDefault((object o) => o != null && o.GetType().Name == "HitData"); if (obj == null) { return 0f; } object obj2 = ReadMember(obj, "m_damage"); if (obj2 is DamageTypes) { return TotalDamage((DamageTypes)obj2); } return 0f; } private Character FindAttackerFromArgs(object[] args) { if (args == null) { return null; } object obj = args.FirstOrDefault((object o) => o != null && o.GetType().Name == "HitData"); if (obj == null) { return null; } object attacker = GetAttacker(obj); return (Character)((attacker is Character) ? attacker : null); } private void EnsureFinalTag(ItemData item) { if (item == null || item.m_shared == null) { return; } string text = ItemTier(item); if (text == "None") { text = DetectEpicTier(item); } if ((item.m_customData == null || !item.m_customData.ContainsKey("EWS5_LEGACY_SET_CLEANED")) && IsEpicSet(item)) { ((BaseUnityPlugin)this).Logger.LogInfo((object)"[EWS-SETS] legacy EpicLoot set detected -> reroll non-set"); bool flag = MakeMagicNonSet(item, text); if (item.m_customData == null) { item.m_customData = new Dictionary<string, string>(); } item.m_customData["EWS5_LEGACY_SET_CLEANED"] = (flag ? "1" : "0"); if (flag) { ((BaseUnityPlugin)this).Logger.LogInfo((object)"[EWS-SETS] legacy EpicLoot set removed successfully"); } else { ((BaseUnityPlugin)this).Logger.LogWarning((object)"[EWS-SETS] legacy EpicLoot set reroll failed"); } } string text2 = MapWeaponSet(item); if (!string.IsNullOrEmpty(text2)) { Tag(item, text2, text); } else if (IsShieldItem(item)) { Tag(item, "tank", text); } else { if (!IsArmorItem(item)) { return; } string text3 = TaggedSet(item); if (IsFinalSetId(text3)) { if (ItemTier(item) == "None") { Tag(item, text3, text); } return; } string[] array = new string[5] { "warrior", "tank", "archer", "summoner", "assassin" }; string text4 = GetPrefabName(item) + "|" + SafeName(item) + "|" + item.m_quality; int num = text4.GetHashCode(); if (num == int.MinValue) { num = 0; } int num2 = Math.Abs(num) % array.Length; Tag(item, array[num2], text); } } private string MapWeaponSet(ItemData item) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) if (item == null || item.m_shared == null) { return ""; } if (IsTorchBaseWeapon(item)) { return "summoner"; } string text = ((object)item.m_shared.m_skillType).ToString(); string text2 = (item.m_shared.m_name ?? "") + " " + GetPrefabName(item); if (text.IndexOf("Knives", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("Spear", StringComparison.OrdinalIgnoreCase) >= 0 || text2.IndexOf("Knife", StringComparison.OrdinalIgnoreCase) >= 0 || text2.IndexOf("Spear", StringComparison.OrdinalIgnoreCase) >= 0) { return "assassin"; } if (text.IndexOf("Bows", StringComparison.OrdinalIgnoreCase) >= 0 && text.IndexOf("Crossbow", StringComparison.OrdinalIgnoreCase) < 0) { return "archer"; } if (text.IndexOf("Axes", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("Axe", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("Polearm", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("Polearms", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("Clubs", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("Club", StringComparison.OrdinalIgnoreCase) >= 0) { return "warrior"; } if (text.IndexOf("Swords", StringComparison.OrdinalIgnoreCase) >= 0 && (text2.IndexOf("THSword", StringComparison.OrdinalIgnoreCase) >= 0 || text2.IndexOf("Krom", StringComparison.OrdinalIgnoreCase) >= 0 || text2.IndexOf("2H", StringComparison.OrdinalIgnoreCase) >= 0)) { return "warrior"; } return ""; } private bool IsTorchBaseWeapon(ItemData item) { if (item == null) { return false; } string text = SafeName(item) ?? ""; string a = GetPrefabName(item) ?? ""; if (text.IndexOf("소환 1단계", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } if (string.Equals(a, "GT_GatheringTorch_T1", StringComparison.OrdinalIgnoreCase)) { return true; } return false; } private bool IsShieldItem(ItemData item) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) if (item == null || item.m_shared == null) { return false; } string text = ((object)item.m_shared.m_itemType).ToString(); return text.IndexOf("Shield", StringComparison.OrdinalIgnoreCase) >= 0; } private bool IsArmorItem(ItemData item) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) if (item == null || item.m_shared == null) { return false; } string text = ((object)item.m_shared.m_itemType).ToString(); if (text.IndexOf("Helmet", StringComparison.OrdinalIgnoreCase) < 0 && text.IndexOf("Chest", StringComparison.OrdinalIgnoreCase) < 0 && text.IndexOf("Legs", StringComparison.OrdinalIgnoreCase) < 0 && text.IndexOf("Shoulder", StringComparison.OrdinalIgnoreCase) < 0) { return text.IndexOf("Armor", StringComparison.OrdinalIgnoreCase) >= 0; } return true; } private bool IsFinalSetId(string id) { switch (id) { default: return id == "assassin"; case "warrior": case "tank": case "archer": case "summoner": return true; } } private string DetectEpicTier(ItemData item) { try { if (_getMagic != null) { object obj = _getMagic.Invoke(null, new object[1] { item }); if (obj != null) { object obj2 = ReadMember(obj, "Rarity"); if (obj2 == null) { obj2 = ReadMember(obj, "m_rarity"); } if (obj2 != null) { string text = obj2.ToString(); if (text.IndexOf("Mythic", StringComparison.OrdinalIgnoreCase) >= 0) { return "Mythic"; } if (text.IndexOf("Legendary", StringComparison.OrdinalIgnoreCase) >= 0) { return "Legendary"; } if (text.IndexOf("Epic", StringComparison.OrdinalIgnoreCase) >= 0) { return "Epic"; } } } } } catch { } return "Epic"; } private string BuildTooltip(ItemData item) { string text = TaggedSet(item); string text2 = ItemTier(item); int num = (((Object)(object)Player.m_localPlayer != (Object)null) ? GetSetState(Player.m_localPlayer, text).Count : 0); string text3 = SetDisplayName(text); string text4 = "내구도 소모 감소 Epic60% / Legendary80% / Mythic100%"; string text5 = ""; string text6 = ""; string text7 = ""; switch (text) { case "warrior": text5 = "적중 시 20% 확률 최대체력 6% 회복"; text6 = "적중 시 10% 확률 공격속도 +20% (10초)"; text7 = "휠윈드 / 한손 25% / 양손 35%"; break; case "tank": text5 = "막기 시 20% 확률 스태미나 +50"; text6 = "막기 시 10% 확률 받은 피해 200% 반사"; text7 = "막기 시 12/21/30% 확률 받은 피해 300% 반사"; break; case "archer": text5 = "적중 시 20% 확률 스태미나 +50"; text6 = "적중 시 10% 확률 공격속도 +20% (10초)"; text7 = "깔끔한 원형 지면 충격파 5연속 / 발동확률 40%"; break; case "summoner": text5 = "소환수 적중 시 20% 확률 해당 소환수 이동속도 +20% (10초)"; text6 = "소환수 적중 시 10% 확률 해당 소환수 공격속도 +20% (10초)"; text7 = "소환수 적중 시 준 피해의 20%를 해당 소환수가 회복"; break; case "assassin": text5 = "적중 시 20% 확률 스태미나 +50"; text6 = "적중 시 10% 확률 공격속도 +25% (10초)"; text7 = "창/단검 연속찌르기 10타 / 발동확률 20%"; break; } return "\n\n<color=#FFD36A>[" + text3 + " - " + text2 + "]</color>\n<color=#BBBBBB>착용 " + num + "/5</color>\n<color=#DDDDDD>2세트: " + text4 + "</color>\n<color=#DDDDDD>3세트: " + text5 + "</color>\n<color=#DDDDDD>4세트: " + text6 + "</color>\n<color=#FFD36A>5세트: " + text7 + "</color>"; } private string SetDisplayName(string id) { return id switch { "warrior" => "전사 세트", "tank" => "탱커 세트", "archer" => "아처 세트", "summoner" => "소환사 세트", "assassin" => "암살자 세트", _ => id, }; } private IEnumerable<string> AllSetIds() { yield return "warrior"; yield return "tank"; yield return "archer"; yield return "summoner"; yield return "assassin"; } private SetState GetSetState(Player p, string setId) { SetState result = new SetState { Id = setId, Count = 0, Tier = "None", Mult = 0f }; if ((Object)(object)p == (Object)null) { return result; } List<string> list = new List<string>(); foreach (ItemData allItem in ((Humanoid)p).GetInventory().GetAllItems()) { if (allItem != null && allItem.m_equipped && !(TaggedSet(allItem) != setId)) { result.Count++; list.Add(ItemTier(allItem)); } } if (result.Count > 5) { result.Count = 5; } if (list.Count == 0) { return result; } result.Mult = TierMult(result.Tier = list.OrderBy((string t) => TierRank(t)).FirstOrDefault()); return result; } private int TierRank(string tier) { if (string.Equals(tier, "Epic", StringComparison.OrdinalIgnoreCase)) { return 1; } if (string.Equals(tier, "Legendary", StringComparison.OrdinalIgnoreCase)) { return 2; } if (string.Equals(tier, "Mythic", StringComparison.OrdinalIgnoreCase)) { return 3; } return 0; } private float TierMult(string tier) { if (string.Equals(tier, "Epic", StringComparison.OrdinalIgnoreCase)) { return 0.4f; } if (string.Equals(tier, "Legendary", StringComparison.OrdinalIgnoreCase)) { return 0.7f; } if (string.Equals(tier, "Mythic", StringComparison.OrdinalIgnoreCase)) { return 1f; } return 0f; } private bool IsTagged(ItemData item) { if (item != null && item.m_customData != null) { return item.m_customData.ContainsKey("EWS_SET_ID"); } return false; } private string TaggedSet(ItemData item) { if (!IsTagged(item)) { return ""; } return item.m_customData["EWS_SET_ID"]; } private string ItemTier(ItemData item) { if (item == null || item.m_customData == null) { return "None"; } if (item.m_customData.TryGetValue("EWS_SET_TIER", out var value)) { return value; } return "None"; } private void Tag(ItemData item, string setId, string tier) { if (item.m_customData == null) { item.m_customData = new Dictionary<string, string>(); } if (IsFinalSetId(setId)) { item.m_customData["EWS_SET_ID"] = setId; item.m_customData["EWS_SET_TIER"] = tier; item.m_customData["EWS5_LEGACY_SET_CLEANED"] = "1"; } } private void RegisterConsoleCommands() { //IL_0036: 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: Expected O, but got Unknown //IL_0060: 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_0056: Expected O, but got Unknown //IL_008a: 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: Expected O, but got Unknown //IL_00b7: 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_00ac: Expected O, but got Unknown //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Expected O, but got Unknown //IL_0111: 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_0106: Expected O, but got Unknown //IL_013e: 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_0133: Expected O, but got Unknown ConsoleEvent val = null; ConsoleEvent val2 = null; ConsoleEvent val3 = null; ConsoleEvent val4 = null; ConsoleEvent val5 = null; ConsoleEvent val6 = null; ConsoleEvent val7 = null; try { if (val == null) { val = (ConsoleEvent)delegate(ConsoleEventArgs a) { GiveSet("warrior", TierArg(a)); }; } new ConsoleCommand("ewswarrior", "Give Warrior final set", val, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); if (val2 == null) { val2 = (ConsoleEvent)delegate(ConsoleEventArgs a) { GiveSet("tank", TierArg(a)); }; } new ConsoleCommand("ewstank", "Give Tank final set", val2, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); if (val3 == null) { val3 = (ConsoleEvent)delegate(ConsoleEventArgs a) { GiveSet("archer", TierArg(a)); }; } new ConsoleCommand("ewsarcher", "Give Archer final set", val3, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); if (val4 == null) { val4 = (ConsoleEvent)delegate(ConsoleEventArgs a) { GiveSet("summoner", TierArg(a)); }; } new ConsoleCommand("ewssummoner", "Give Summoner armor + torch placeholder", val4, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); if (val5 == null) { val5 = (ConsoleEvent)delegate(ConsoleEventArgs a) { BindSummonerWeapon(TierArg(a)); }; } new ConsoleCommand("ewssummonerbind", "Bind current torch-base summon weapon", val5, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); if (val6 == null) { val6 = (ConsoleEvent)delegate(ConsoleEventArgs a) { GiveSet("assassin", TierArg(a)); }; } new ConsoleCommand("ewsassassin", "Give Assassin final set", val6, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); if (val7 == null) { val7 = (ConsoleEvent)delegate { PrintStates(); }; } new ConsoleCommand("ewssetcheck", "Print equipped final set states", val7, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[EWS-SETS] final console commands registered"); } catch (Exception e) { ((BaseUnityPlugin)this).Logger.LogError((object)("[EWS-SETS] console command error: " + Inner(e))); } } private string TierArg(ConsoleEventArgs a) { string result = "Mythic"; try { if (a.Args != null && a.Args.Length >= 2 && !string.IsNullOrEmpty(a.Args[1])) { result = NormalizeTier(a.Args[1]); } } catch { } return result; } private string NormalizeTier(string tier) { if (string.Equals(tier, "epic", StringComparison.OrdinalIgnoreCase)) { return "Epic"; } if (string.Equals(tier, "legendary", StringComparison.OrdinalIgnoreCase)) { return "Legendary"; } return "Mythic"; } private void GiveSet(string setId, string tier) { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { return; } List<string> list = new List<string>(); list.AddRange(ArmorPrefabs); switch (setId) { case "warrior": list.Add("AtgeirBlackmetal"); list.Add("AxeBlackMetal"); list.Add("BattleaxeCrystal"); list.Add("SledgeDemolisher"); list.Add("THSwordKrom"); list.Add("MaceSilver"); list.Add("MaceIron"); break; case "tank": list.Add("ShieldCarapace"); list.Add("ShieldCarapaceBuckler"); break; case "archer": list.Add("BowSpineSnap"); break; case "assassin": list.Add("KnifeSkollAndHati"); list.Add("SpearCarapace"); break; } if (!EnsureEpicLootApi()) { try { ((Character)localPlayer).Message((MessageType)1, "EpicLoot API를 찾지 못해 지급을 중단했습니다.", 0, (Sprite)null); return; } catch { return; } } int num = 0; int num2 = 0; foreach (string item in list) { ItemData val = CreatePrefabItem(item); if (val == null) { num2++; continue; } if (!MakeMagicNonSet(val, tier)) { num2++; continue; } Tag(val, setId, tier); if (!((Humanoid)localPlayer).GetInventory().AddItem(val)) { num2++; continue; } num++; ((BaseUnityPlugin)this).Logger.LogInfo((object)("[EWS-SETS] GIVE OK set=" + setId + " prefab=" + item + " tier=" + tier)); } try { ((Character)localPlayer).Message((MessageType)1, SetDisplayName(setId) + " 지급 " + num + "개 / 실패 " + num2 + "개 (" + tier + ")", 0, (Sprite)null); } catch { } } private void BindSummonerWeapon(string tier) { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { return; } ItemData currentWeapon = GetCurrentWeapon(localPlayer); if (currentWeapon == null) { try { ((Character)localPlayer).Message((MessageType)1, "무기를 장착하세요.", 0, (Sprite)null); return; } catch { return; } } if (!IsTorchBaseWeapon(currentWeapon)) { try { ((Character)localPlayer).Message((MessageType)1, "소환 1단계 무기만 소환사 세트로 지정할 수 있습니다.", 0, (Sprite)null); return; } catch { return; } } Tag(currentWeapon, "summoner", tier); try { ((Character)localPlayer).Message((MessageType)1, "소환 1단계 -> 소환사 세트 " + tier, 0, (Sprite)null); } catch { } ((BaseUnityPlugin)this).Logger.LogInfo((object)("[EWS-SETS] SUMMONER weapon confirmed: " + SafeName(currentWeapon))); } private void PrintStates() { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { return; } foreach (string item in AllSetIds()) { SetState setState = GetSetState(localPlayer, item); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[EWS-SETS] CHECK " + item + " set=" + setState.Count + "/5 tier=" + setState.Tier + " mult=" + setState.Mult)); } } private ItemData CreatePrefabItem(string prefabName) { try { GameObject val = (((Object)(object)ObjectDB.instance != (Object)null) ? ObjectDB.instance.GetItemPrefab(prefabName) : null); if ((Object)(object)val == (Object)null && (Object)(object)ZNetScene.instance != (Object)null) { val = ZNetScene.instance.GetPrefab(prefabName); } if ((Object)(object)val == (Object)null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("[EWS-SETS] prefab missing: " + prefabName)); return null; } ItemDrop component = val.GetComponent<ItemDrop>(); if ((Object)(object)component == (Object)null) { return null; } ItemData val2 = component.m_itemData.Clone(); val2.m_stack = 1; return val2; } catch (Exception e) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("[EWS-SETS] CreatePrefabItem " + prefabName + ": " + Inner(e))); return null; } } private bool MakeMagicNonSet(ItemData item, string tier) { try { if (!EnsureEpicLootApi()) { return false; } if (_initializeCustomData != null) { _initializeCustomData.Invoke(null, new object[1] { item }); } if (_createMagic != null) { _createMagic.Invoke(null, new object[1] { item }); } if (_initializeMagic != null) { _initializeMagic.Invoke(null, new object[1] { item }); } object obj = Enum.Parse(_rarityType, tier, ignoreCase: true); for (int i = 1; i <= 50; i++) { object obj2 = _rollMagic.Invoke(null, new object[4] { obj, item, 0f, 0f }); if (obj2 == null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("[EWS-SETS] RollMagicItem null attempt=" + i)); continue; } _saveMagic.Invoke(null, new object[2] { item, obj2 }); bool flag = IsEpicSet(item); if (flag) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("[EWS-SETS] rejected EpicLoot random/legacy set roll attempt=" + i)); continue; } bool flag2 = false; if (_isMagic != null) { try { flag2 = (bool)_isMagic.Invoke(null, new object[1] { item }); } catch { flag2 = false; } } else { try { object obj4 = ((_getMagic != null) ? _getMagic.Invoke(null, new object[1] { item }) : null); flag2 = obj4 != null; } catch { flag2 = false; } } ((BaseUnityPlugin)this).Logger.LogInfo((object)("[EWS-SETS] magic attempt=" + i + " tier=" + tier + " IsMagic=" + flag2 + " EpicSet=" + flag)); if (flag2 && !flag) { return true; } } ((BaseUnityPlugin)this).Logger.LogError((object)("[EWS-SETS] failed to create non-set EpicLoot item tier=" + tier)); } catch (Exception e) { ((BaseUnityPlugin)this).Logger.LogError((object)("[EWS-SETS] MakeMagicNonSet: " + Inner(e))); } return false; } private bool IsEpicSet(ItemData item) { if (_isMagicSetItem == null) { return false; } try { return (bool)_isMagicSetItem.Invoke(null, new object[1] { item }); } catch { return false; } } private ItemData GetCurrentWeapon(Player p) { //IL_0069: Unknown result type (might be due to invalid IL or missing references) try { MethodInfo method = ((object)p).GetType().GetMethod("GetCurrentWeapon", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method != null) { object? obj = method.Invoke(p, null); return (ItemData)((obj is ItemData) ? obj : null); } } catch { } foreach (ItemData allItem in ((Humanoid)p).GetInventory().GetAllItems()) { if (allItem != null && allItem.m_equipped && allItem.m_shared != null) { string text = ((object)allItem.m_shared.m_itemType).ToString(); if (text.IndexOf("Weapon", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("Torch", StringComparison.OrdinalIgnoreCase) >= 0) { return allItem; } } } return null; } private Character GetAttackOwner(Attack attack) { if (attack == null) { return null; } string[] array = new string[4] { "m_character", "m_humanoid", "m_owner", "m_attacker" }; string[] array2 = array; foreach (string name in array2) { try { object obj = ReadMember(attack, name); Character val = (Character)((obj is Character) ? obj : null); if ((Object)(object)val != (Object)null) { return val; } Humanoid val2 = (Humanoid)((obj is Humanoid) ? obj : null); if ((Object)(object)val2 != (Object)null) { return (Character)(object)val2; } } catch { } } try { Type type = ((object)attack).GetType(); FieldInfo[] fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (FieldInfo fieldInfo in fields) { try { object value = fieldInfo.GetValue(attack); Character val3 = (Character)((value is Character) ? value : null); if ((Object)(object)val3 != (Object)null) { return val3; } Humanoid val4 = (Humanoid)((value is Humanoid) ? value : null); if ((Object)(object)val4 != (Object)null) { return (Character)(object)val4; } } catch { } } PropertyInfo[] properties = type.GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (PropertyInfo propertyInfo in properties) { if (propertyInfo.GetIndexParameters().Length != 0) { continue; } try { object value2 = propertyInfo.GetValue(attack, null); Character val5 = (Character)((value2 is Character) ? value2 : null); if ((Object)(object)val5 != (Object)null) { return val5; } Humanoid val6 = (Humanoid)((value2 is Humanoid) ? value2 : null); if ((Object)(object)val6 != (Object)null) { return (Character)(object)val6; } } catch { } } } catch { } return null; } private object GetAttacker(object hit) { if (hit == null) { return null; } try { MethodInfo method = hit.GetType().GetMethod("GetAttacker", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method != null) { return method.Invoke(hit, null); } } catch { } return null; } private bool IsEnemy(Player p, Character c) { try { MethodInfo methodInfo = typeof(BaseAI).GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic).FirstOrDefault((MethodInfo x) => x.Name == "IsEnemy" && x.ReturnType == typeof(bool) && x.GetParameters().Length == 2); if (methodInfo != null) { return (bool)methodInfo.Invoke(null, new object[2] { p, c }); } } catch { } if (c is Player) { return false; } try { MethodInfo method = ((object)c).GetType().GetMethod("IsTamed", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, Type.EmptyTypes, null); if (method != null && (bool)method.Invoke(c, null)) { return false; } } catch { } return true; } private void AddStamina(Player p, float amount) { try { MethodInfo method = ((object)p).GetType().GetMethod("AddStamina", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method != null) { method.Invoke(p, new object[1] { amount }); } } catch { } } private void AddEitr(Player p, float amount) { try { MethodInfo method = ((object)p).GetType().GetMethod("AddEitr", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method != null) { method.Invoke(p, new object[1] { amount }); } } catch { } } private DamageTypes ScaleDamage(DamageTypes d, float scale) { //IL_0000: 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_0071: 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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) try { object obj = d; FieldInfo[] fields = typeof(DamageTypes).GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (FieldInfo fieldInfo in fields) { if (!(fieldInfo.FieldType != typeof(float))) { float num = (float)fieldInfo.GetValue(obj); fieldInfo.SetValue(obj, num * scale); } } return (DamageTypes)obj; } catch { return d; } } private DamageTypes NewDamage(string field, float amount) { //IL_0002: 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_005b: 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_0055: Unknown result type (might be due to invalid IL or missing references) DamageTypes val = default(DamageTypes); try { object obj = val; FieldInfo field2 = typeof(DamageTypes).GetField(field, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field2 != null && field2.FieldType == typeof(float)) { field2.SetValue(obj, amount); } val = (DamageTypes)obj; return val; } catch { } return val; } private float TotalDamage(DamageTypes d) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) float num = 0f; try { object obj = d; FieldInfo[] fields = typeof(DamageTypes).GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (FieldInfo fieldInfo in fields) { if (fieldInfo.FieldType == typeof(float)) { num += Mathf.Abs((float)fieldInfo.GetValue(obj)); } } } catch { } return num; } private object ReadMember(object obj, string name) { if (obj == null) { return null; } Type type = obj.GetType(); FieldInfo field = type.GetField(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { return field.GetValue(obj); } PropertyInfo property = type.GetProperty(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (property != null && property.GetIndexParameters().Length == 0) { return property.GetValue(obj, null); } return null; } private string GetPrefabName(ItemData item) { try { FieldInfo field = typeof(ItemData).GetField("m_dropPrefab", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); GameObject val = (GameObject)((field != null) ? /*isinst with value type is only supported in some contexts*/: null); if ((Object)(object)val != (Object)null) { return ((Object)val).name ?? ""; } } catch { } return ""; } private string SafeName(ItemData item) { try { return (item != null && item.m_shared != null) ? item.m_shared.m_name : "unknown"; } catch { return "unknown"; } } private IEnumerable<Type> SafeTypes(Assembly a) { try { return a.GetTypes(); } catch (ReflectionTypeLoadException ex) { return ex.Types.Where((Type t) => t != null); } } private string Inner(Exception e) { Exception ex = e; while (ex.InnerException != null) { ex = ex.InnerException; } return ex.Message; } }