using 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 _cooldowns = new Dictionary(); private readonly Dictionary _durBefore = new Dictionary(); private readonly Dictionary _lastDurability = new Dictionary(); 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() : 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 hashSet = new HashSet(); 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 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 originals = new Dictionary(); 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 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(); 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 val = ((IEnumerable)componentsInChildren).FirstOrDefault((Func)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(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(val, pos, Quaternion.identity); } } catch { } } return null; } private Animator BeginFastAnimation(Player p, float speed) { try { Animator componentInChildren = ((Component)p).GetComponentInChildren(); 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) ? "" : 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(); 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(); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.SetTrigger(text); } } catch { } } private void ApplyAttackSpeedBuff(Player p, float bonus) { try { Animator componentInChildren = ((Component)p).GetComponentInChildren(); 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(); 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(); } 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[" + text3 + " - " + text2 + "]\n착용 " + num + "/5\n2세트: " + text4 + "\n3세트: " + text5 + "\n4세트: " + text6 + "\n5세트: " + text7 + ""; } private string SetDisplayName(string id) { return id switch { "warrior" => "전사 세트", "tank" => "탱커 세트", "archer" => "아처 세트", "summoner" => "소환사 세트", "assassin" => "암살자 세트", _ => id, }; } private IEnumerable 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 list = new List(); 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(); } 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 list = new List(); 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(); 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 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; } }