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 PraetorisClient v0.1.79
PraetorisClient.dll
Decompiled a day ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Concurrent; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Globalization; using System.IO; using System.IO.Compression; using System.Linq; using System.Linq.Expressions; using System.Net.Security; using System.Net.Sockets; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Authentication; using System.Security.Cryptography; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using EpicLoot; using EpicLoot.Abilities; using EpicLoot.Adventure; using EpicLoot.Config; using EpicLoot.ShardStones; using EpicLootAPI; using EpicLootLeslieAlphaTest.src; using EpicLootLeslieAlphaTest.src.MagicEffectss; using EpicLootLeslieAlphaTest.src.StatusEffects; using EpicLootLeslieAlphaTest.src.StatusEffects.VFX; using EpicLootLeslieAlphaTest.src.Utilities; using GUIFramework; using HarmonyLib; using JetBrains.Annotations; using Jotunn; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Managers; using Jotunn.Utils; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using PraetorisClient.CreatureOwnership; using PraetorisClient.EpicLootFeature; using PraetorisClient.Maintenance; using PraetorisClient.NetworkWardFeature; using PraetorisClient.ServerChestFeature; using PraetorisClient.ServerGuideFeature; using PraetorisClient.ShipPasswordFeature; using PraetorisClient.SurtlingBoats; using Splatform; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.UI; using ValheimRcon; using ValheimRcon.Commands; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("PraetorisClient")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("PraetorisClient")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("3A303D15-4E60-4110-8EDF-EDF38560FBE2")] [assembly: AssemblyFileVersion("0.1.79")] [assembly: TargetFramework(".NETFramework,Version=v4.8.1", FrameworkDisplayName = ".NET Framework 4.8.1")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.1.79.0")] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace EpicLootLeslieAlphaTest.src { public static class MagicEffects { public static void Init() { MagicItemEffectDefinition magicItemEffectDefinition = new MagicItemEffectDefinition("AncestralSlam", "Ancestral Slam", "Summons ancestral spirit to mirror your attacks for each enemy hit."); magicItemEffectDefinition.Requirements.AllowedItemTypes.Add("TwoHandedWeapon"); magicItemEffectDefinition.Requirements.AllowedSkillTypes.Add((SkillType)3); Helpers.Add(magicItemEffectDefinition.Requirements.AllowedRarities, ItemRarity.Epic, ItemRarity.Legendary, ItemRarity.Mythic, ItemRarity.Ancient); magicItemEffectDefinition.SelectionWeight = 1f; magicItemEffectDefinition.Register(); MagicItemEffectDefinition magicItemEffectDefinition2 = new MagicItemEffectDefinition("GlancingBlows", "Glancing Blows", "Increases your block value by 50%. Take addtional damage equal to 50% of all blocked or parried hits. This additional damage is only mitigate by player armor and is not reduced from player resistances."); Helpers.Add(magicItemEffectDefinition2.Requirements.AllowedItemTypes, "Bucklers", "RoundShields", "TowerShields", "OneHandedWeapon", "TwoHandedWeapon"); magicItemEffectDefinition2.Requirements.ItemHasBlockPower = true; Helpers.Add(magicItemEffectDefinition2.Requirements.AllowedRarities, ItemRarity.Magic, ItemRarity.Rare, ItemRarity.Epic, ItemRarity.Legendary, ItemRarity.Mythic, ItemRarity.Ancient); magicItemEffectDefinition2.ValuesPerRarity.Magic.Set(1f, 1f); magicItemEffectDefinition2.ValuesPerRarity.Rare = new ValueDef(1f, 1f, 1f); magicItemEffectDefinition2.ValuesPerRarity.Epic = new ValueDef(1f, 1f, 1f); magicItemEffectDefinition2.ValuesPerRarity.Legendary = new ValueDef(1f, 1f, 1f); magicItemEffectDefinition2.ValuesPerRarity.Mythic = new ValueDef(1f, 1f, 1f); magicItemEffectDefinition2.ValuesPerRarity.Ancient = new ValueDef(1f, 1f, 1f); magicItemEffectDefinition2.SelectionWeight = 5f; magicItemEffectDefinition2.Register(); MagicItemEffectDefinition magicItemEffectDefinition3 = new MagicItemEffectDefinition("Retaliation", "Retaliation +{0}", "On block gain a stack of Relatliation. On Attack consumes a stack of Relataliation to increase the attack speed of your next attack string. All stacks of Retaliation expire after 5 seconds. Consuming or gaining a stack of Retaliation resets the expiration timer."); Helpers.Add(magicItemEffectDefinition3.Requirements.AllowedItemTypes, "Bucklers", "RoundShields", "TowerShields", "OneHandedWeapon", "TwoHandedWeapon"); magicItemEffectDefinition3.Requirements.ItemHasBlockPower = true; Helpers.Add(magicItemEffectDefinition3.Requirements.AllowedRarities, ItemRarity.Magic, ItemRarity.Rare, ItemRarity.Epic, ItemRarity.Legendary, ItemRarity.Mythic, ItemRarity.Ancient); magicItemEffectDefinition3.ValuesPerRarity.Magic.Set(1f, 1f); magicItemEffectDefinition3.ValuesPerRarity.Rare = new ValueDef(2f, 2f, 1f); magicItemEffectDefinition3.ValuesPerRarity.Epic = new ValueDef(3f, 3f, 1f); magicItemEffectDefinition3.ValuesPerRarity.Legendary = new ValueDef(4f, 4f, 1f); magicItemEffectDefinition3.ValuesPerRarity.Mythic = new ValueDef(5f, 5f, 1f); magicItemEffectDefinition3.ValuesPerRarity.Ancient = new ValueDef(6f, 6f, 1f); magicItemEffectDefinition3.SelectionWeight = 2f; magicItemEffectDefinition3.Register(); MagicItemEffectDefinition magicItemEffectDefinition4 = new MagicItemEffectDefinition("Infusion", "Infusion +{0}%", "Cleanses certain status effects and adds <b><color=yellow>X</color></b>% of weapon damage as their respective type. Certain cleansed status effects grant addittional bonuses."); Helpers.Add(magicItemEffectDefinition4.Requirements.AllowedItemTypes, "OneHandedWeapon", "TwoHandedWeapon"); List<SkillType> allowedSkillTypes = magicItemEffectDefinition4.Requirements.AllowedSkillTypes; SkillType[] array = new SkillType[8]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); Helpers.Add(allowedSkillTypes, (SkillType[])(object)array); Helpers.Add(magicItemEffectDefinition4.Requirements.AllowedRarities, ItemRarity.Magic, ItemRarity.Rare, ItemRarity.Epic, ItemRarity.Legendary, ItemRarity.Mythic, ItemRarity.Ancient); magicItemEffectDefinition4.ValuesPerRarity.Magic.Set(2f, 4f); magicItemEffectDefinition4.ValuesPerRarity.Rare = new ValueDef(3f, 6f, 1f); magicItemEffectDefinition4.ValuesPerRarity.Epic = new ValueDef(4f, 8f, 1f); magicItemEffectDefinition4.ValuesPerRarity.Legendary = new ValueDef(5f, 10f, 1f); magicItemEffectDefinition4.ValuesPerRarity.Mythic = new ValueDef(6f, 12f, 1f); magicItemEffectDefinition4.ValuesPerRarity.Ancient = new ValueDef(7f, 14f, 1f); magicItemEffectDefinition4.SelectionWeight = 2f; magicItemEffectDefinition4.Ability = "Infusion"; AbilityProxyDefinition abilityProxyDefinition = new AbilityProxyDefinition("Infusion", AbilityActivationMode.Activated, typeof(Infusion.InfusionAbilityProxy)); abilityProxyDefinition.Ability.Cooldown = 120f; PrefabManager.OnPrefabsRegistered += delegate { EpicLoot.RegisterAsset("InfusionIcon", ObjectDB.instance.GetStatusEffect(StringExtensionMethods.GetStableHashCode("SetEffect_MageArmor"))?.m_icon); }; abilityProxyDefinition.Ability.IconAsset = "InfusionIcon"; magicItemEffectDefinition4.Register(); MagicItemEffectDefinition magicItemEffectDefinition5 = new MagicItemEffectDefinition("Whirlwind", "Whirlwind", "Spin"); magicItemEffectDefinition5.Requirements.AllowedItemTypes.Add("TwoHandedWeapon"); magicItemEffectDefinition5.Requirements.AllowedSkillTypes.Add((SkillType)4); Helpers.Add(magicItemEffectDefinition5.Requirements.AllowedRarities, ItemRarity.Epic, ItemRarity.Legendary, ItemRarity.Mythic, ItemRarity.Ancient); magicItemEffectDefinition5.SelectionWeight = 1f; magicItemEffectDefinition5.Register(); MagicItemEffectDefinition magicItemEffectDefinition6 = new MagicItemEffectDefinition("Onslaught", "Onslaught +{0}%", "Grants Onslaught on last hit of an attack string and when hitting a staggered enemy. While in last hit of attack string during Onslaught you continue attacking using the last hit animation of your attack string. Each consecutive Onslaught hit deals {0}% increased damage per hit. Onslaught expires if an enemy has not been struck with an attack in last hit animation for 2 seconds."); Helpers.Add(magicItemEffectDefinition6.Requirements.AllowedItemTypes, "OneHandedWeapon", "TwoHandedWeapon"); magicItemEffectDefinition6.Requirements.AllowedSkillTypes.Add((SkillType)3); Helpers.Add(magicItemEffectDefinition6.Requirements.AllowedRarities, ItemRarity.Magic, ItemRarity.Rare, ItemRarity.Epic, ItemRarity.Legendary, ItemRarity.Mythic, ItemRarity.Ancient); magicItemEffectDefinition6.ValuesPerRarity.Magic.Set(0.5f, 1f, 0.1f); magicItemEffectDefinition6.ValuesPerRarity.Rare = new ValueDef(0.5f, 1.5f, 0.1f); magicItemEffectDefinition6.ValuesPerRarity.Epic = new ValueDef(1f, 2f, 0.1f); magicItemEffectDefinition6.ValuesPerRarity.Legendary = new ValueDef(1.5f, 2.5f, 0.1f); magicItemEffectDefinition6.ValuesPerRarity.Mythic = new ValueDef(2f, 3f, 0.1f); magicItemEffectDefinition6.ValuesPerRarity.Ancient = new ValueDef(2f, 3f, 0.1f); magicItemEffectDefinition6.SelectionWeight = 1f; magicItemEffectDefinition6.Register(); } } } namespace EpicLootLeslieAlphaTest.src.Utilities { public static class Help { public static void CopyFieldsFrom<T, V>(this T target, V source) where T : Humanoid where V : Humanoid { Dictionary<string, FieldInfo> dictionary = typeof(T).GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic).ToDictionary((FieldInfo f) => f.Name); FieldInfo[] fields = typeof(V).GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (FieldInfo fieldInfo in fields) { if (dictionary.TryGetValue(fieldInfo.Name, out var value) && value.FieldType.IsAssignableFrom(fieldInfo.FieldType)) { value.SetValue(target, fieldInfo.GetValue(source)); } } } public static void Add<T>(this List<T> list, params T[] values) { list.AddRange(values); } public static void Remove<T>(this GameObject prefab) where T : Component { T val = default(T); if (prefab.TryGetComponent<T>(ref val)) { Object.DestroyImmediate((Object)(object)val); } } } public class HumanoidFactory { public static GameObject playerAncestor; private static bool Loaded; public static void Create() { //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)playerAncestor != (Object)null) { return; } GameObject playerPrefab = Game.instance.m_playerPrefab; bool activeSelf = playerPrefab.activeSelf; playerPrefab.SetActive(false); try { Player component = playerPrefab.GetComponent<Player>(); playerAncestor = Object.Instantiate<GameObject>(playerPrefab); playerAncestor.Remove<AbilityController>(); playerAncestor.Remove<AdventureComponent>(); playerAncestor.Remove<Player>(); playerAncestor.Remove<PlayerController>(); playerAncestor.Remove<Talker>(); playerAncestor.Remove<Skills>(); playerAncestor.Remove<ZSyncTransform>(); ((Object)playerAncestor).name = "playerAncestorHashString"; playerAncestor.GetComponent<ZNetView>().m_persistent = false; playerAncestor.GetComponent<ZNetView>().m_type = (ObjectType)0; Humanoid obj = playerAncestor.AddComponent<Humanoid>(); obj.CopyFieldsFrom<Humanoid, Player>(component); ((Character)obj).m_animator = playerAncestor.GetComponentInChildren<Animator>(); ((Character)obj).m_zanim = playerAncestor.GetComponent<ZSyncAnimation>(); ((Character)obj).m_body = playerAncestor.GetComponent<Rigidbody>(); ((Character)obj).m_collider = playerAncestor.GetComponent<CapsuleCollider>(); obj.m_visEquipment = playerAncestor.GetComponent<VisEquipment>(); ((Character)obj).m_turnSpeed = 0f; ((Character)obj).m_animEvent = playerAncestor.GetComponentInChildren<CharacterAnimEvent>(); ((Character)obj).m_eye = Utils.FindChild(playerAncestor.transform, "EyePos", (IterativeSearchType)0); if ((Object)(object)playerAncestor.GetComponent<ZSyncAnimation>() != (Object)null) { playerAncestor.GetComponent<ZSyncAnimation>().m_animator = playerAncestor.GetComponent<Animator>(); playerAncestor.GetComponent<ZSyncAnimation>().m_nview = playerAncestor.GetComponent<ZNetView>(); } Rigidbody component2 = playerAncestor.GetComponent<Rigidbody>(); if ((Object)(object)component2 != (Object)null) { component2.isKinematic = false; component2.useGravity = false; component2.constraints = (RigidbodyConstraints)126; } Shader shader = Shader.Find("Sprites/Default"); Renderer[] componentsInChildren = playerAncestor.GetComponentsInChildren<Renderer>(true); foreach (Renderer val in componentsInChildren) { Material[] materials = val.materials; if (materials.Length != 0) { materials[0].shader = shader; materials[0].mainTexture = null; materials[0].color = new Color(0.3f, 0.5f, 0.9f, 0.03f); if (materials.Length > 1) { materials[1].shader = shader; materials[1].mainTexture = null; materials[1].color = new Color(0.3f, 0.5f, 0.9f, 0f); } materials[0].SetColor("_SkinColor", new Color(0.3f, 0.5f, 0.9f, 0.03f)); val.materials = materials; } } componentsInChildren = playerAncestor.GetComponentsInChildren<Renderer>(true); foreach (Renderer val2 in componentsInChildren) { SkinnedMeshRenderer val3 = (SkinnedMeshRenderer)(object)((val2 is SkinnedMeshRenderer) ? val2 : null); if (val3 != null && (Object)(object)val3.sharedMesh != (Object)null) { _ = ((Object)val3.sharedMesh).name; } else if (val2 is MeshRenderer) { MeshFilter component3 = ((Component)val2).GetComponent<MeshFilter>(); if (component3 != null && (Object)(object)component3.sharedMesh != (Object)null) { _ = ((Object)component3.sharedMesh).name; } } } Collider[] componentsInChildren2 = playerAncestor.GetComponentsInChildren<Collider>(); for (int i = 0; i < componentsInChildren2.Length; i++) { componentsInChildren2[i].enabled = false; } ZNetScene.instance.m_namedPrefabs[StringExtensionMethods.GetStableHashCode("playerAncestorHashString")] = playerAncestor; playerAncestor.SetActive(false); } finally { playerPrefab.SetActive(activeSelf); } } } public static class WA { public static bool IsHeavyWeapon(ItemData item) { //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_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Invalid comparison between Unknown and I4 //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Invalid comparison between Unknown and I4 //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Invalid comparison between Unknown and I4 //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Invalid comparison between Unknown and I4 AnimationState animationState = item.m_shared.m_animationState; if ((int)animationState != 8 && (int)animationState != 2 && (int)animationState != 7) { return (int)animationState == 13; } return true; } public static bool IsRangedWeapon(ItemData item) { //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_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Invalid comparison between Unknown and I4 //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Invalid comparison between Unknown and I4 //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Invalid comparison between Unknown and I4 //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Invalid comparison between Unknown and I4 AnimationState animationState = item.m_shared.m_animationState; if ((int)animationState != 3 && (int)animationState != 10 && (int)animationState != 12) { return (int)animationState == 14; } return true; } public static bool IsTwoHanded(ItemData item) { //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_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Invalid comparison between Unknown and I4 //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Invalid comparison between Unknown and I4 //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Invalid comparison between Unknown and I4 //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Invalid comparison between Unknown and I4 //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Invalid comparison between Unknown and I4 //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Invalid comparison between Unknown and I4 //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Invalid comparison between Unknown and I4 AnimationState animationState = item.m_shared.m_animationState; if ((int)animationState != 8 && (int)animationState != 2 && (int)animationState != 7 && (int)animationState != 13 && (int)animationState != 15 && (int)animationState != 11) { return (int)animationState == 0; } return true; } } } namespace EpicLootLeslieAlphaTest.src.StatusEffects { public static class SERegistry { public static void RegisterStatusEffects() { Register<SE_Retaliation>("SE_Retaliation"); Register<SE_Onslaught>("SE_Onslaught"); Register<SE_FireInfused>("SE_FireInfused"); Register<SE_FrostInfused>("SE_FrostInfused"); Register<SE_LightningInfused>("SE_LightningInfused"); Register<SE_PoisonInfused>("SE_PoisonInfused"); Register<SE_WindInfused>("SE_WindInfused"); } private static void Register<T>(string effectName) where T : StatusEffect { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown T val = ScriptableObject.CreateInstance<T>(); ((Object)(object)val).name = effectName; ((StatusEffect)val).m_name = effectName; ItemManager.Instance.AddStatusEffect(new CustomStatusEffect((StatusEffect)(object)val, false)); } } public class SE_FireInfused : SE_Stats { public const string EffectName = "SE_FireInfused"; private GameObject m_vfxInstance; private GameObject m_vfxInstance2; private ItemData weapon; private float infusedFireDamage; public float Efficacy { get; set; } public override void Setup(Character character) { //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) ((SE_Stats)this).Setup(character); if (!((Object)(object)Player.m_localPlayer == (Object)null)) { Efficacy = Infusion.Efficacy; GameObject itemPrefab = ObjectDB.instance.GetItemPrefab("SwordDyrnwyn"); object icon; if (itemPrefab == null) { icon = null; } else { ItemDrop component = itemPrefab.GetComponent<ItemDrop>(); icon = ((component != null) ? component.m_itemData.m_shared.m_icons[0] : null); } ((StatusEffect)this).m_icon = (Sprite)icon; ((StatusEffect)this).m_name = "Fire Infused"; ((StatusEffect)this).m_ttl = 120f; Player localPlayer = Player.m_localPlayer; weapon = ((localPlayer != null) ? ((Humanoid)localPlayer).GetCurrentWeapon() : null); if (weapon != null && !WA.IsRangedWeapon(weapon)) { DamageTypes damage = weapon.GetDamage(); float totalDamage = ((DamageTypes)(ref damage)).GetTotalDamage(); float num = (WA.IsHeavyWeapon(weapon) ? 2f : 1f); Logger.LogWarning((object)string.Format("[FireInfused] weapon base damage:{0} efficacy:{1} weapon multiplier:{2} added:{3} + {4} * {5}", totalDamage, Efficacy, num, totalDamage * Player.m_localPlayer.GetTotalActiveMagicEffectValue("Infusion", 0.01f), Player.m_localPlayer.GetTotalActiveMagicEffectValue("Infusion", 0.01f) * Efficacy, num)); infusedFireDamage += totalDamage * Player.m_localPlayer.GetTotalActiveMagicEffectValue("Infusion", 0.01f) + Efficacy * Player.m_localPlayer.GetTotalActiveMagicEffectValue("Infusion", 0.1f) * num; weapon.m_shared.m_damages.m_fire += infusedFireDamage; Logger.LogWarning((object)$"Added {infusedFireDamage} fire damage"); } } } public override void Stop() { ((StatusEffect)this).Stop(); if (weapon != null) { weapon.m_shared.m_damages.m_fire -= infusedFireDamage; } if ((Object)(object)m_vfxInstance != (Object)null) { Object.Destroy((Object)(object)m_vfxInstance); } if ((Object)(object)m_vfxInstance2 != (Object)null) { Object.Destroy((Object)(object)m_vfxInstance2); } } public override void UpdateStatusEffect(float dt) { ((SE_Stats)this).UpdateStatusEffect(dt); if (!((Object)(object)Player.m_localPlayer == (Object)null)) { if (((Humanoid)Player.m_localPlayer).GetCurrentWeapon() == weapon && (Object)(object)m_vfxInstance == (Object)null) { CreateVFX(); } else if (((Humanoid)Player.m_localPlayer).GetCurrentWeapon() != weapon && (Object)(object)m_vfxInstance != (Object)null) { DestroyVFX(); } } } private void CreateVFX() { VisEquipment visEquipment = ((Humanoid)Player.m_localPlayer).m_visEquipment; if (!WA.IsTwoHanded(weapon)) { m_vfxInstance = Object.Instantiate<GameObject>(InfusionVFX.FireInfusionVFX, visEquipment.m_rightHand); m_vfxInstance.SetActive(true); return; } m_vfxInstance = Object.Instantiate<GameObject>(InfusionVFX.FireInfusionVFX, visEquipment.m_rightHand); m_vfxInstance2 = Object.Instantiate<GameObject>(InfusionVFX.FireInfusionVFX, visEquipment.m_leftHand); m_vfxInstance.SetActive(true); m_vfxInstance2.SetActive(true); } private void DestroyVFX() { if ((Object)(object)m_vfxInstance != (Object)null) { Object.Destroy((Object)(object)m_vfxInstance); m_vfxInstance = null; } if ((Object)(object)m_vfxInstance2 != (Object)null) { Object.Destroy((Object)(object)m_vfxInstance2); m_vfxInstance2 = null; } } } public class SE_FrostInfused : SE_Stats { public const string EffectName = "SE_FrostInfused"; private GameObject m_vfxInstance; private GameObject m_vfxInstance2; private ItemData weapon; private float infusedFrostDamage; public float Efficacy { get; set; } public override void Setup(Character character) { //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) ((SE_Stats)this).Setup(character); if (!((Object)(object)Player.m_localPlayer == (Object)null)) { Efficacy = Infusion.Efficacy; GameObject itemPrefab = ObjectDB.instance.GetItemPrefab("SwordMistwalker"); object icon; if (itemPrefab == null) { icon = null; } else { ItemDrop component = itemPrefab.GetComponent<ItemDrop>(); icon = ((component != null) ? component.m_itemData.m_shared.m_icons[0] : null); } ((StatusEffect)this).m_icon = (Sprite)icon; ((StatusEffect)this).m_name = "Frost Infused"; ((StatusEffect)this).m_ttl = 120f; Player localPlayer = Player.m_localPlayer; weapon = ((localPlayer != null) ? ((Humanoid)localPlayer).GetCurrentWeapon() : null); if (weapon != null && !WA.IsRangedWeapon(weapon)) { DamageTypes damage = weapon.GetDamage(); float totalDamage = ((DamageTypes)(ref damage)).GetTotalDamage(); float num = (WA.IsHeavyWeapon(weapon) ? 2f : 1f); Logger.LogWarning((object)string.Format("[FrostInfused] weapon base damage:{0} efficacy:{1} weapon multiplier:{2} added:{3} + {4} * {5}", totalDamage, Efficacy, num, totalDamage * Player.m_localPlayer.GetTotalActiveMagicEffectValue("Infusion", 0.01f), Player.m_localPlayer.GetTotalActiveMagicEffectValue("Infusion", 0.01f) * Efficacy, num)); infusedFrostDamage += totalDamage * Player.m_localPlayer.GetTotalActiveMagicEffectValue("Infusion", 0.01f) + Efficacy * Player.m_localPlayer.GetTotalActiveMagicEffectValue("Infusion", 0.1f) * num; weapon.m_shared.m_damages.m_frost += infusedFrostDamage; Logger.LogWarning((object)$"Added {infusedFrostDamage} frost damage"); } } } public override void Stop() { ((StatusEffect)this).Stop(); if (weapon != null) { weapon.m_shared.m_damages.m_frost -= infusedFrostDamage; } if ((Object)(object)m_vfxInstance != (Object)null) { Object.Destroy((Object)(object)m_vfxInstance); } if ((Object)(object)m_vfxInstance2 != (Object)null) { Object.Destroy((Object)(object)m_vfxInstance2); } } public override void UpdateStatusEffect(float dt) { ((SE_Stats)this).UpdateStatusEffect(dt); if (!((Object)(object)Player.m_localPlayer == (Object)null)) { if (((Humanoid)Player.m_localPlayer).GetCurrentWeapon() == weapon && (Object)(object)m_vfxInstance == (Object)null) { CreateVFX(); } else if (((Humanoid)Player.m_localPlayer).GetCurrentWeapon() != weapon && (Object)(object)m_vfxInstance != (Object)null) { DestroyVFX(); } } } private void CreateVFX() { VisEquipment visEquipment = ((Humanoid)Player.m_localPlayer).m_visEquipment; if (!WA.IsTwoHanded(weapon)) { m_vfxInstance = Object.Instantiate<GameObject>(InfusionVFX.FrostInfusionVFX, visEquipment.m_rightHand); m_vfxInstance.SetActive(true); return; } m_vfxInstance = Object.Instantiate<GameObject>(InfusionVFX.FrostInfusionVFX, visEquipment.m_rightHand); m_vfxInstance2 = Object.Instantiate<GameObject>(InfusionVFX.FrostInfusionVFX, visEquipment.m_leftHand); m_vfxInstance.SetActive(true); m_vfxInstance2.SetActive(true); } private void DestroyVFX() { if ((Object)(object)m_vfxInstance != (Object)null) { Object.Destroy((Object)(object)m_vfxInstance); m_vfxInstance = null; } if ((Object)(object)m_vfxInstance2 != (Object)null) { Object.Destroy((Object)(object)m_vfxInstance2); m_vfxInstance2 = null; } } } public class SE_LightningInfused : SE_Stats { public const string EffectName = "SE_LightningInfused"; private GameObject m_vfxInstance; private GameObject m_vfxInstance2; private ItemData weapon; private float infusedLightningDamage; public float Efficacy { get; set; } public override void Setup(Character character) { //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) ((SE_Stats)this).Setup(character); if (!((Object)(object)Player.m_localPlayer == (Object)null)) { Efficacy = Infusion.Efficacy; GameObject itemPrefab = ObjectDB.instance.GetItemPrefab("SwordNiedhoggLightning"); object icon; if (itemPrefab == null) { icon = null; } else { ItemDrop component = itemPrefab.GetComponent<ItemDrop>(); icon = ((component != null) ? component.m_itemData.m_shared.m_icons[0] : null); } ((StatusEffect)this).m_icon = (Sprite)icon; ((StatusEffect)this).m_name = "Lightning Infused"; ((StatusEffect)this).m_ttl = 120f; Player localPlayer = Player.m_localPlayer; weapon = ((localPlayer != null) ? ((Humanoid)localPlayer).GetCurrentWeapon() : null); if (weapon != null && !WA.IsRangedWeapon(weapon)) { DamageTypes damage = weapon.GetDamage(); float totalDamage = ((DamageTypes)(ref damage)).GetTotalDamage(); float num = (WA.IsHeavyWeapon(weapon) ? 2f : 1f); Logger.LogWarning((object)string.Format("[LightningInfused] weapon base damage:{0} efficacy:{1} weapon multiplier:{2} added:{3} + {4} * {5}", totalDamage, Efficacy, num, totalDamage * Player.m_localPlayer.GetTotalActiveMagicEffectValue("Infusion", 0.01f), Player.m_localPlayer.GetTotalActiveMagicEffectValue("Infusion", 0.01f) * Efficacy, num)); infusedLightningDamage += totalDamage * Player.m_localPlayer.GetTotalActiveMagicEffectValue("Infusion", 0.01f) + Efficacy * Player.m_localPlayer.GetTotalActiveMagicEffectValue("Infusion", 0.1f) * num; weapon.m_shared.m_damages.m_lightning += infusedLightningDamage; Logger.LogWarning((object)$"Added {infusedLightningDamage} lightning damage"); } } } public override void Stop() { ((StatusEffect)this).Stop(); if (weapon != null) { weapon.m_shared.m_damages.m_lightning -= infusedLightningDamage; } if ((Object)(object)m_vfxInstance != (Object)null) { Object.Destroy((Object)(object)m_vfxInstance); } if ((Object)(object)m_vfxInstance2 != (Object)null) { Object.Destroy((Object)(object)m_vfxInstance2); } } public override void UpdateStatusEffect(float dt) { ((SE_Stats)this).UpdateStatusEffect(dt); if (!((Object)(object)Player.m_localPlayer == (Object)null)) { if (((Humanoid)Player.m_localPlayer).GetCurrentWeapon() == weapon && (Object)(object)m_vfxInstance == (Object)null) { CreateVFX(); } else if (((Humanoid)Player.m_localPlayer).GetCurrentWeapon() != weapon && (Object)(object)m_vfxInstance != (Object)null) { DestroyVFX(); } } } private void CreateVFX() { VisEquipment visEquipment = ((Humanoid)Player.m_localPlayer).m_visEquipment; if (!WA.IsTwoHanded(weapon)) { m_vfxInstance = Object.Instantiate<GameObject>(InfusionVFX.LightningInfusionVFX, visEquipment.m_rightHand); m_vfxInstance.SetActive(true); return; } m_vfxInstance = Object.Instantiate<GameObject>(InfusionVFX.LightningInfusionVFX, visEquipment.m_rightHand); m_vfxInstance2 = Object.Instantiate<GameObject>(InfusionVFX.LightningInfusionVFX, visEquipment.m_leftHand); m_vfxInstance.SetActive(true); m_vfxInstance2.SetActive(true); } private void DestroyVFX() { if ((Object)(object)m_vfxInstance != (Object)null) { Object.Destroy((Object)(object)m_vfxInstance); m_vfxInstance = null; } if ((Object)(object)m_vfxInstance2 != (Object)null) { Object.Destroy((Object)(object)m_vfxInstance2); m_vfxInstance2 = null; } } } public class SE_Onslaught : SE_Stats { public const string EffectName = "SE_Onslaught"; public int m_stacks; public int m_maxStacks = 9999; private float m_onslaughtHits; private const float m_expire = 2f; public override void Setup(Character character) { ((SE_Stats)this).Setup(character); if ((Object)(object)character.m_animator != (Object)null) { GameObject itemPrefab = ObjectDB.instance.GetItemPrefab("MaceIron"); object icon; if (itemPrefab == null) { icon = null; } else { ItemDrop component = itemPrefab.GetComponent<ItemDrop>(); icon = ((component != null) ? component.m_itemData.m_shared.m_icons[0] : null); } ((StatusEffect)this).m_icon = (Sprite)icon; ((StatusEffect)this).m_name = "Onslaught Hits"; ((StatusEffect)this).m_flashIcon = true; m_stacks++; } } public void AddStack() { ((StatusEffect)this).m_ttl = 2f; if (m_stacks < m_maxStacks) { m_stacks++; ((StatusEffect)this).m_time = 0f; } } public void ConsumeStack() { if (m_stacks > 0) { m_stacks--; ((StatusEffect)this).m_time = 0f; } } public override void UpdateStatusEffect(float dt) { ((SE_Stats)this).UpdateStatusEffect(dt); Player localPlayer = Player.m_localPlayer; if (!WA.IsRangedWeapon((localPlayer != null) ? ((Humanoid)localPlayer).GetCurrentWeapon() : null)) { if (m_stacks <= 0 && !((StatusEffect)this).m_character.InAttack()) { ((StatusEffect)this).m_character.GetSEMan().RemoveStatusEffect((StatusEffect)(object)this, false); } if (!((Character)Player.m_localPlayer).InAttack() && ((StatusEffect)this).m_time > 1.5f) { m_onslaughtHits = 0f; } } } public override void ModifyAttack(SkillType skill, ref HitData hitData) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) ((SE_Stats)this).ModifyAttack(skill, ref hitData); Logger.LogWarning((object)$"stacks{m_stacks}"); Character character = ((StatusEffect)this).m_character; int? num = ((Humanoid)(((character is Humanoid) ? character : null)?)).m_currentAttack?.m_currentAttackCainLevel; if (m_stacks > 0 && !(num < 2)) { m_onslaughtHits += 1f; Logger.LogWarning((object)$"{m_onslaughtHits}"); float num2 = 1f + m_onslaughtHits * Player.m_localPlayer.GetTotalActiveMagicEffectValue("Onslaught", 0.01f); hitData.ApplyModifier(num2); } } public override string GetIconText() { return $"{m_onslaughtHits}"; } } public class SE_PoisonInfused : SE_Stats { public const string EffectName = "SE_PoisonInfused"; private GameObject m_vfxInstance; private GameObject m_vfxInstance2; private ItemData weapon; private float infusedPoisonDamage; public float Efficacy { get; set; } public override void Setup(Character character) { //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) ((SE_Stats)this).Setup(character); if (!((Object)(object)Player.m_localPlayer == (Object)null)) { Efficacy = Infusion.Efficacy; GameObject itemPrefab = ObjectDB.instance.GetItemPrefab("SwordNiedhoggNature"); object icon; if (itemPrefab == null) { icon = null; } else { ItemDrop component = itemPrefab.GetComponent<ItemDrop>(); icon = ((component != null) ? component.m_itemData.m_shared.m_icons[0] : null); } ((StatusEffect)this).m_icon = (Sprite)icon; ((StatusEffect)this).m_name = "Poison Infused"; ((StatusEffect)this).m_ttl = 120f; Player localPlayer = Player.m_localPlayer; weapon = ((localPlayer != null) ? ((Humanoid)localPlayer).GetCurrentWeapon() : null); if (weapon != null && !WA.IsRangedWeapon(weapon)) { DamageTypes damage = weapon.GetDamage(); float totalDamage = ((DamageTypes)(ref damage)).GetTotalDamage(); float num = (WA.IsHeavyWeapon(weapon) ? 2f : 1f); Logger.LogWarning((object)string.Format("[PoisonInfused] weapon base damage:{0} efficacy:{1} weapon multiplier:{2} added:{3} + {4} * {5}", totalDamage, Efficacy, num, totalDamage * Player.m_localPlayer.GetTotalActiveMagicEffectValue("Infusion", 0.01f), Player.m_localPlayer.GetTotalActiveMagicEffectValue("Infusion", 0.01f) * Efficacy, num)); infusedPoisonDamage += totalDamage * Player.m_localPlayer.GetTotalActiveMagicEffectValue("Infusion", 0.01f) + Efficacy * Player.m_localPlayer.GetTotalActiveMagicEffectValue("Infusion", 0.1f) * num; weapon.m_shared.m_damages.m_poison += infusedPoisonDamage; Logger.LogWarning((object)$"Added {infusedPoisonDamage} poison damage"); } } } public override void Stop() { ((StatusEffect)this).Stop(); if (weapon != null) { weapon.m_shared.m_damages.m_poison -= infusedPoisonDamage; } if ((Object)(object)m_vfxInstance != (Object)null) { Object.Destroy((Object)(object)m_vfxInstance); } if ((Object)(object)m_vfxInstance2 != (Object)null) { Object.Destroy((Object)(object)m_vfxInstance2); } } public override void UpdateStatusEffect(float dt) { ((SE_Stats)this).UpdateStatusEffect(dt); if (!((Object)(object)Player.m_localPlayer == (Object)null)) { if (((Humanoid)Player.m_localPlayer).GetCurrentWeapon() == weapon && (Object)(object)m_vfxInstance == (Object)null) { CreateVFX(); } else if (((Humanoid)Player.m_localPlayer).GetCurrentWeapon() != weapon && (Object)(object)m_vfxInstance != (Object)null) { DestroyVFX(); } } } private void CreateVFX() { VisEquipment visEquipment = ((Humanoid)Player.m_localPlayer).m_visEquipment; if (!WA.IsTwoHanded(weapon)) { m_vfxInstance = Object.Instantiate<GameObject>(InfusionVFX.PoisonInfusionVFX, visEquipment.m_rightHand); m_vfxInstance.SetActive(true); return; } m_vfxInstance = Object.Instantiate<GameObject>(InfusionVFX.PoisonInfusionVFX, visEquipment.m_rightHand); m_vfxInstance2 = Object.Instantiate<GameObject>(InfusionVFX.PoisonInfusionVFX, visEquipment.m_leftHand); m_vfxInstance.SetActive(true); m_vfxInstance2.SetActive(true); } private void DestroyVFX() { if ((Object)(object)m_vfxInstance != (Object)null) { Object.Destroy((Object)(object)m_vfxInstance); m_vfxInstance = null; } if ((Object)(object)m_vfxInstance2 != (Object)null) { Object.Destroy((Object)(object)m_vfxInstance2); m_vfxInstance2 = null; } } } public class SE_Retaliation : SE_Stats { public const string EffectName = "SE_Retaliation"; public int m_stacks; public int m_maxStacks = 1; private const float m_expire = 5f; private float baseSpeed = 1f; private bool addedRetaliationSpeed; private bool amAttacking; private static readonly Dictionary<string, float> _animSpeeds = new Dictionary<string, float> { { "atgeir_attack", 1.2f }, { "atgeir_secondary", 2f }, { "knife_stab", 1.2f }, { "knife_secondary", 1.1f }, { "battleaxe_attack", 1.6f }, { "swing_axe", 1.2f }, { "swing_longsword", 1.2f }, { "mace_secondary", 1.35f }, { "spear_poke", 1.2f }, { "sword_secondary", 0.5f }, { "dualaxes", 1.1f }, { "dualaxes_secondary", 1.1f }, { "dual_knives", 1.1f }, { "dual_knives_secondary", 1.2f }, { "greatsword", 1.2f }, { "greatsword_secondary", 1.2f }, { "swing_sledge", 1.4f }, { "unarmed_attack", 2.2f } }; public override void Setup(Character character) { ((SE_Stats)this).Setup(character); if ((Object)(object)character.m_animator != (Object)null) { m_maxStacks = Mathf.RoundToInt(Player.m_localPlayer.GetTotalActiveMagicEffectValue("Retaliation")); baseSpeed = character.m_animator.speed; character.m_animator.speed = ((Retaliation.AttackType != null && _animSpeeds.TryGetValue(Retaliation.AttackType, out var value)) ? value : 1.2f); GameObject itemPrefab = ObjectDB.instance.GetItemPrefab("ShieldBanded"); object icon; if (itemPrefab == null) { icon = null; } else { ItemDrop component = itemPrefab.GetComponent<ItemDrop>(); icon = ((component != null) ? component.m_itemData.m_shared.m_icons[3] : null); } ((StatusEffect)this).m_icon = (Sprite)icon; ((StatusEffect)this).m_name = "Retaliation"; ((StatusEffect)this).m_flashIcon = true; } } public void AddStack() { ((StatusEffect)this).m_ttl = 5f; if (m_stacks < m_maxStacks) { m_stacks++; ((StatusEffect)this).m_time = 0f; } } public void ConsumeStack() { if (m_stacks > 0) { m_stacks--; ((StatusEffect)this).m_time = 0f; } } public override void UpdateStatusEffect(float dt) { ((SE_Stats)this).UpdateStatusEffect(dt); Player localPlayer = Player.m_localPlayer; if (!WA.IsRangedWeapon((localPlayer != null) ? ((Humanoid)localPlayer).GetCurrentWeapon() : null)) { if (!((StatusEffect)this).m_character.InAttack() && amAttacking) { ConsumeStack(); } amAttacking = ((StatusEffect)this).m_character.InAttack(); if ((Object)(object)((StatusEffect)this).m_character.m_animator != (Object)null && ((StatusEffect)this).m_character.m_animator.speed >= 5f && !addedRetaliationSpeed) { Animator animator = ((StatusEffect)this).m_character.m_animator; animator.speed += ((Retaliation.AttackType != null && _animSpeeds.TryGetValue(Retaliation.AttackType, out var value)) ? value : 1.2f); addedRetaliationSpeed = true; } if ((Object)(object)((StatusEffect)this).m_character.m_animator != (Object)null && ((StatusEffect)this).m_character.m_animator.speed < 5f) { ((StatusEffect)this).m_character.m_animator.speed = ((Retaliation.AttackType != null && _animSpeeds.TryGetValue(Retaliation.AttackType, out var value2)) ? value2 : 1.2f); } if (m_stacks > 0 && !((StatusEffect)this).m_character.InAttack()) { ((StatusEffect)this).m_character.m_animator.speed = baseSpeed; } if (m_stacks <= 0 && !((StatusEffect)this).m_character.InAttack()) { ((StatusEffect)this).m_character.GetSEMan().RemoveStatusEffect((StatusEffect)(object)this, false); } } } public override void Stop() { ((StatusEffect)this).Stop(); if ((Object)(object)((StatusEffect)this).m_character?.m_animator != (Object)null) { ((StatusEffect)this).m_character.m_animator.speed = baseSpeed; } } public override string GetIconText() { return $"{m_stacks}"; } } public class SE_WindInfused : SE_Stats { public const string EffectName = "SE_WindInfused"; private GameObject m_vfxInstance; private GameObject m_vfxInstance2; private ItemData weapon; private float infusedWindValue; private float baseSpeed = 1f; public override void Setup(Character character) { ((SE_Stats)this).Setup(character); if (!((Object)(object)Player.m_localPlayer == (Object)null)) { weapon = ((Humanoid)Player.m_localPlayer).GetCurrentWeapon(); baseSpeed = ((StatusEffect)this).m_character.m_animator.speed; ((StatusEffect)this).m_name = "Wind Infused"; ((StatusEffect)this).m_ttl = 120f; } } public override void Stop() { ((StatusEffect)this).Stop(); ((StatusEffect)this).m_character.m_animator.speed = baseSpeed; if ((Object)(object)m_vfxInstance != (Object)null) { Object.Destroy((Object)(object)m_vfxInstance); } if ((Object)(object)m_vfxInstance2 != (Object)null) { Object.Destroy((Object)(object)m_vfxInstance2); } } public override void UpdateStatusEffect(float dt) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) ((SE_Stats)this).UpdateStatusEffect(dt); if (!((Object)(object)Player.m_localPlayer == (Object)null)) { _ = ((Humanoid)Player.m_localPlayer).m_visEquipment.m_rightItemInstance; _ = weapon.m_shared.m_animationState; _ = ((Humanoid)Player.m_localPlayer).m_visEquipment.m_rightHand; _ = ((Humanoid)Player.m_localPlayer).m_visEquipment.m_leftHand; if (((Character)Player.m_localPlayer).InAttack() && ((Humanoid)Player.m_localPlayer).GetCurrentWeapon() == weapon && baseSpeed <= 3f * baseSpeed) { Animator animator = ((StatusEffect)this).m_character.m_animator; float num = (animator.speed += Player.m_localPlayer.GetTotalActiveMagicEffectValue("Infusion", 0.01f)); } if (((Humanoid)Player.m_localPlayer).GetCurrentWeapon() == weapon && (Object)(object)m_vfxInstance == (Object)null) { CreateVFX(); } else if (((Humanoid)Player.m_localPlayer).GetCurrentWeapon() != weapon && (Object)(object)m_vfxInstance != (Object)null) { DestroyVFX(); } } } private void CreateVFX() { VisEquipment visEquipment = ((Humanoid)Player.m_localPlayer).m_visEquipment; if (!WA.IsTwoHanded(weapon)) { m_vfxInstance = Object.Instantiate<GameObject>(InfusionVFX.WindInfusionVFX, visEquipment.m_rightHand); m_vfxInstance.SetActive(true); PlayAll(m_vfxInstance); return; } m_vfxInstance = Object.Instantiate<GameObject>(InfusionVFX.WindInfusionVFX, visEquipment.m_rightHand); m_vfxInstance2 = Object.Instantiate<GameObject>(InfusionVFX.WindInfusionVFX, visEquipment.m_leftHand); m_vfxInstance.SetActive(true); m_vfxInstance2.SetActive(true); PlayAll(m_vfxInstance); PlayAll(m_vfxInstance2); } private void PlayAll(GameObject vfx) { //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_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) Light componentInChildren = vfx.GetComponentInChildren<Light>(); if ((Object)(object)componentInChildren != (Object)null) { ((Component)componentInChildren).gameObject.SetActive(false); } ParticleSystem[] componentsInChildren = vfx.GetComponentsInChildren<ParticleSystem>(); foreach (ParticleSystem val in componentsInChildren) { if ((Object)(object)((Component)val).transform == (Object)(object)vfx.transform) { val.Stop(); continue; } MainModule main = val.main; ((MainModule)(ref main)).loop = true; ((MainModule)(ref main)).duration = 2f; ((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(new Color(0.7607843f, 1f, 0.57254905f, 1f)); val.Play(); } } private void DestroyVFX() { if ((Object)(object)m_vfxInstance != (Object)null) { Object.Destroy((Object)(object)m_vfxInstance); m_vfxInstance = null; } if ((Object)(object)m_vfxInstance2 != (Object)null) { Object.Destroy((Object)(object)m_vfxInstance2); m_vfxInstance2 = null; } } } } namespace EpicLootLeslieAlphaTest.src.StatusEffects.VFX { public static class InfusionVFX { public static GameObject FireInfusionVFX; public static GameObject FrostInfusionVFX; public static GameObject LightningInfusionVFX; public static GameObject PoisonInfusionVFX; public static GameObject WindInfusionVFX; public static void Init() { FireInfusionVFX = BuildVFX(ZNetScene.instance.GetPrefab("Torch"), 0.1f); FrostInfusionVFX = BuildVFX(ZNetScene.instance.GetPrefab("vfx_Freezing"), 0.3f); LightningInfusionVFX = BuildVFX(ZNetScene.instance.GetPrefab("fx_Lightning"), 0.2f); PoisonInfusionVFX = BuildVFX(ZNetScene.instance.GetPrefab("vfx_Poison"), 0.2f); WindInfusionVFX = BuildVFX(ZNetScene.instance.GetPrefab("vfx_MeadSwimmer"), 0.08f); } private static GameObject BuildVFX(GameObject source, float scale) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: 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) if ((Object)(object)source == (Object)null) { return null; } GameObject val = new GameObject("InfusionVFX_" + ((Object)source).name); val.SetActive(false); Object.DontDestroyOnLoad((Object)(object)val); if ((Object)(object)val.GetComponent<TimedDestruction>() != (Object)null) { Object.Destroy((Object)(object)val.GetComponent<TimedDestruction>()); } ParticleSystem[] componentsInChildren = source.GetComponentsInChildren<ParticleSystem>(true); foreach (ParticleSystem val2 in componentsInChildren) { if (!((Object)(object)((Component)val2).transform == (Object)(object)source.transform)) { GameObject obj = Object.Instantiate<GameObject>(((Component)val2).gameObject, val.transform); obj.transform.localPosition = Vector3.zero; obj.transform.localRotation = Quaternion.identity; Transform transform = obj.transform; transform.localScale *= scale; } } return val; } } } namespace EpicLootLeslieAlphaTest.src.MagicEffectss { public class AncestralSlam { [HarmonyPatch(typeof(Attack), "OnAttackTrigger")] public class Attack_Trigger { public static void Prefix(Attack __instance) { if (__instance.m_character is Player) { _lastAttackCainLevel = __instance.m_currentAttackCainLevel; _lastAttackAnim = __instance.m_attackAnimation; _lastAttackRange = __instance.m_attackRange; _lastAttack = __instance; } } } [HarmonyPatch(typeof(Character), "Damage")] public class Character_Damage_SpawnClone_Patch { public static void Postfix(Character __instance, HitData hit) { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: 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_0087: 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) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) if (((Humanoid)Player.m_localPlayer).GetCurrentWeapon() == null) { return; } ItemData currentWeapon = ((Humanoid)Player.m_localPlayer).GetCurrentWeapon(); if (currentWeapon != null && currentWeapon.HasMagicEffect("AncestralSlam")) { Character attacker = hit.GetAttacker(); if (!((Object)(object)attacker == (Object)null) && !((Object)(object)attacker != (Object)(object)Player.m_localPlayer) && !ancestralClonesHASH.Contains(((Component)attacker).gameObject)) { Vector3 position = ((Component)__instance).transform.position; Vector3 val = position - ((Component)Player.m_localPlayer).transform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; SpawnAncestralSlam(rotation: (normalized != Vector3.zero) ? Quaternion.LookRotation(normalized) : ((Component)Player.m_localPlayer).transform.rotation, position: position - normalized * 1.5f, weapon: currentWeapon); } } } } [HarmonyPatch(typeof(Character), "Damage")] public class Character_Clone_Damage_Patch { public static void Prefix(Character __instance, HitData hit) { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Player.m_localPlayer == (Object)null) { return; } ItemData currentWeapon = ((Humanoid)Player.m_localPlayer).GetCurrentWeapon(); if (currentWeapon == null || !currentWeapon.HasMagicEffect("AncestralSlam")) { return; } Character attacker = hit.GetAttacker(); if (!((Object)(object)attacker == (Object)null) && ancestralClonesHASH.Contains(((Component)attacker).gameObject)) { float skillFactor = ((Character)Player.m_localPlayer).GetSkillFactor(currentWeapon.m_shared.m_skillType); float num = Random.Range(0.96f, 1.04f); DamageTypes damage = ((DamageTypes)(ref currentWeapon.m_shared.m_damages)).Clone(); if (_lastAttackCainLevel >= 2) { ((DamageTypes)(ref damage)).Modify((skillFactor * 0.75f + 0.25f) * 2f * num); } else { ((DamageTypes)(ref damage)).Modify((skillFactor * 0.75f + 0.25f) * num); } hit.m_damage = damage; } } } [HarmonyPatch(typeof(EnemyHud), "ShowHud")] internal class EnemyHud_ShowHud_Patch { private static bool Prefix(Character c) { return !ancestralClonesHASH.Contains(((Component)c).gameObject); } } private const float damageModifier = 1f; private static int _lastAttackCainLevel = 0; private static string _lastAttackAnim = ""; private static Attack _lastAttack = null; private static float _lastAttackRange = 2f; public static readonly HashSet<GameObject> ancestralClonesHASH = new HashSet<GameObject>(); internal static void SpawnAncestralSlam(Vector3 position, Quaternion rotation, ItemData weapon) { //IL_0013: 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_0064: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)HumanoidFactory.playerAncestor == (Object)null)) { GameObject val = Object.Instantiate<GameObject>(HumanoidFactory.playerAncestor, position, rotation); ancestralClonesHASH.Add(val); val.SetActive(true); bool flag = weapon.m_shared.m_secondaryAttack.m_attackAnimation == _lastAttackAnim; Humanoid component = val.GetComponent<Humanoid>(); component.m_rightItem = weapon.Clone(); val.GetComponent<Animator>(); ((Character)component).m_lookDir = rotation * Vector3.forward; ((Character)component).StartAttack((Character)null, flag); if (component.m_currentAttack != null) { Attack currentAttack = component.m_currentAttack; currentAttack.m_attackRange *= 1.2f; component.m_currentAttack.m_currentAttackCainLevel = _lastAttackCainLevel; ((Character)component).m_zanim.SetTrigger(_lastAttackAnim + _lastAttackCainLevel); } ((MonoBehaviour)component).StartCoroutine(DelayedDestruction(val.GetComponent<ZNetView>(), val, 2.5f)); } } private static IEnumerator DelayedDestruction(ZNetView zview, GameObject go, float attackTime) { yield return (object)new WaitForSeconds(attackTime + 0.5f); Character component = go.GetComponent<Character>(); if ((Object)(object)component != (Object)null) { EnemyHud instance = EnemyHud.instance; if (instance != null) { instance.RemoveCharacterHud(component); } Character.Instances.Remove((IMonoUpdater)(object)component); } ancestralClonesHASH.Remove(go); if ((Object)(object)zview != (Object)null && zview.IsOwner()) { ZNetScene.instance.Destroy(((Component)zview).gameObject); } } } public static class GlancingBlows { [HarmonyPatch(typeof(Humanoid), "BlockAttack")] public class Block_Attack_GlancingBlowsBlockAttackPrefix_Patch { public static void Prefix(HitData hit) { initialHitValue = hit.GetTotalBlockableDamage(); } } [HarmonyPatch(typeof(Humanoid), "BlockAttack")] public class Block_Attack_GlancingBlowsBlockAttackPostfix_Patch { public static void Postfix(HitData hit, Character attacker) { //IL_0082: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)Player.m_localPlayer) && Player.m_localPlayer.HasActiveMagicEffect("GlancingBlows", out var _)) { float num = initialHitValue * 0.5f; float health = ((Character)Player.m_localPlayer).GetHealth(); float num2 = (float)Math.Round(num - ((Character)Player.m_localPlayer).GetBodyArmor(), 2); if (!((Character)Player.m_localPlayer).IsDead() && num2 > 0f) { ((Character)Player.m_localPlayer).SetHealth(health - num2); DamageText.instance.ShowText((TextType)0, ((Component)Player.m_localPlayer).transform.position, num2.ToString(), true); } } } } [HarmonyPatch(typeof(ItemData), "GetBlockPower", new Type[] { typeof(int), typeof(float) })] public class GlancingBlowsDamage_Patch { public static void Postfix(float skillFactor, ref float __result) { if (Object.op_Implicit((Object)(object)Player.m_localPlayer) && Player.m_localPlayer.HasActiveMagicEffect("GlancingBlows", out var _)) { __result *= 1.5f; } } } private static float effectValue = 1f; private static float initialHitValue = 0f; } public static class Infusion { public enum InfusionElement { Fire, Frost, Lightning, Poison, Wind, Blood } public class InfusionAbilityProxy : Proxy { public static IEnumerator RechargeAnimation(Player player, float duration) { ((Character)player).m_zanim.SetBool("recharge_lightningstaff", true); yield return (object)new WaitForSeconds(duration); ((Character)player).m_zanim.SetBool("recharge_lightningstaff", false); ((Character)player).m_zanim.SetTrigger("recharge_lightningstaff_done"); } public override void Activate() { if (IsOnCooldown() || (Object)(object)Player.m_localPlayer == (Object)null) { return; } SetCooldownEndTime(Proxy.GetTime() + Cooldown); List<StatusEffect> list = new List<StatusEffect>(((Character)Player.m_localPlayer).GetSEMan().GetStatusEffects()); isInfused = false; Dictionary<InfusionElement, float> dictionary = new Dictionary<InfusionElement, float>(); List<StatusEffect> list2 = new List<StatusEffect>(); for (int num = list.Count - 1; num >= 0; num--) { string text = ((Object)list[num]).name.ToLower(); foreach (var (value, key) in elementMap) { if (text.Contains(value)) { float efficacy = GetEfficacy(list[num]); list2.Add(list[num]); if (!dictionary.ContainsKey(key) || efficacy > dictionary[key]) { dictionary[key] = efficacy; } break; } } } ((MonoBehaviour)Player.m_localPlayer).StartCoroutine(DeferRemoveAndApply(list2, dictionary)); static IEnumerator DeferRemoveAndApply(List<StatusEffect> toRemove, Dictionary<InfusionElement, float> bestEfficacy) { foreach (StatusEffect item in toRemove) { ((Character)Player.m_localPlayer).GetSEMan().RemoveStatusEffect(item, false); } yield return null; foreach (KeyValuePair<InfusionElement, float> item2 in bestEfficacy) { Efficacy = item2.Value; ((Character)Player.m_localPlayer).GetSEMan().AddStatusEffect(StringExtensionMethods.GetStableHashCode($"SE_{item2.Key}Infused"), false, 0, 0f, (short)(-1)); isInfused = true; } if (isInfused) { ((MonoBehaviour)Player.m_localPlayer).StartCoroutine(RechargeAnimation(Player.m_localPlayer, 1f)); } if (!isInfused) { ((Character)Player.m_localPlayer).m_zanim.SetTrigger("emote_shrug"); } } } } private static bool isInfused = false; private static readonly List<(string keyword, InfusionElement element)> elementMap = new List<(string, InfusionElement)> { ("fire", InfusionElement.Fire), ("burn", InfusionElement.Fire), ("frost", InfusionElement.Frost), ("freez", InfusionElement.Frost), ("lightning", InfusionElement.Lightning), ("shock", InfusionElement.Lightning), ("poison", InfusionElement.Poison), ("wind", InfusionElement.Wind), ("aero", InfusionElement.Wind), ("moder", InfusionElement.Wind), ("leaf", InfusionElement.Wind), ("petal", InfusionElement.Wind), ("blood", InfusionElement.Blood) }; private static readonly Dictionary<string, Func<StatusEffect, float>> efficacyType = new Dictionary<string, Func<StatusEffect, float>> { { "Burning", (StatusEffect se) => ((SE_Burning)se).m_fireDamageLeft }, { "Frost", (StatusEffect se) => ((StatusEffect)(SE_Frost)se).m_ttl * 10f }, { "Lightning", (StatusEffect se) => (!(se.m_ttl > 0f) || ((Character)Player.m_localPlayer).m_lastHit == null) ? 0f : ((Character)Player.m_localPlayer).m_lastHit.m_damage.m_lightning }, { "Poison", (StatusEffect se) => ((SE_Poison)se).m_damageLeft } }; public static float Efficacy; private static float GetEfficacy(StatusEffect se) { Logger.LogWarning((object)$"GetEfficacy: {((Object)se).name} found {efficacyType.ContainsKey(((Object)se).name)}"); if (efficacyType.TryGetValue(((Object)se).name, out Func<StatusEffect, float> value)) { return value(se); } return 0f; } } public static class Onslaught { [HarmonyPatch(typeof(Character), "Damage")] public class Attack_Trigger_Patch { public static void Prefix(Character __instance, HitData hit) { Character attacker = hit.GetAttacker(); Humanoid val = (Humanoid)(object)((attacker is Humanoid) ? attacker : null); if (!((Object)(object)val == (Object)null) && !((Object)(object)Player.m_localPlayer != (Object)(object)val) && ((Humanoid)Player.m_localPlayer).GetCurrentWeapon().HasMagicEffect("Onslaught") && ((val.m_currentAttack?.m_currentAttackCainLevel ?? (-1)) >= 2 || __instance.IsStaggering())) { SEMan sEMan = ((Character)Player.m_localPlayer).GetSEMan(); SE_Onslaught sE_Onslaught = sEMan.GetStatusEffect(StringExtensionMethods.GetStableHashCode("SE_Onslaught")) as SE_Onslaught; if ((Object)(object)sE_Onslaught != (Object)null) { sE_Onslaught.AddStack(); } else { (sEMan.AddStatusEffect(StringExtensionMethods.GetStableHashCode("SE_Onslaught"), false, 0, 0f, (short)(-1)) as SE_Onslaught).AddStack(); } } } } [HarmonyPatch(typeof(Attack), "Start")] public class Attack_Modify_Chain_Patch { public static void Postfix(Attack __instance, Humanoid character, ref bool __result) { if (!((Object)(object)character != (Object)(object)Player.m_localPlayer)) { SE_Onslaught sE_Onslaught = ((Character)character).GetSEMan().GetStatusEffect(StringExtensionMethods.GetStableHashCode("SE_Onslaught")) as SE_Onslaught; if (!((Object)(object)sE_Onslaught == (Object)null) && sE_Onslaught.m_stacks > 0 && character.GetCurrentWeapon().HasMagicEffect("Onslaught")) { __instance.m_currentAttackCainLevel = 2; __instance.m_zanim.SetTrigger(__instance.m_attackAnimation + "2"); sE_Onslaught.ConsumeStack(); } } } } } public static class PerfectStrike { [HarmonyPatch(typeof(Attack), "Start")] public static class Attack_PerfectStrikeAnimation_Patch { public static void Postfix(Attack __instance, Humanoid character) { if (!((Object)(object)character != (Object)(object)Player.m_localPlayer) && Player.m_localPlayer.HasActiveMagicEffect("PerfectStrike", out var _)) { if (isPerfectStrike) { int lastPerfectChain = ((_lastPerfectChain == 2) ? 1 : 2); __instance.m_currentAttackCainLevel = 2; __instance.m_zanim.SetTrigger(__instance.m_attackAnimation + lastPerfectChain); _lastPerfectChain = lastPerfectChain; _clicked = false; isPerfectStrike = false; _perfectDamagePending = true; } _currentAttack = __instance; _currentAnim = __instance.m_attackAnimation; _currentChain = __instance.m_currentAttackCainLevel; _currentAnimSpeed = __instance.m_speedFactor; _attackStartTime = Time.time; } } } [HarmonyPatch(typeof(PlayerController), "FixedUpdate")] public static class Input_AntiSpam_Patch { public static void Postfix(PlayerController __instance) { //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance.m_character != (Object)(object)Player.m_localPlayer || !Player.m_localPlayer.HasActiveMagicEffect("PerfectStrike", out var _)) { return; } if (!((Character)Player.m_localPlayer).InAttack()) { _clicked = false; _windowSFXplayed = false; if ((Object)(object)_windowVFXInstance != (Object)null) { Object.Destroy((Object)(object)_windowVFXInstance); _windowVFXInstance = null; } return; } float value = 0f; float num = 0f; float num2 = 0f; bool flag = _currentAnim != null && _attackDeltas.TryGetValue((_currentAnim, _currentChain, "default"), out value); if (flag) { num = value * 0.5f; num2 = value * 0.75f; } float num3 = Time.time - _attackStartTime; bool flag2 = _currentChain == 0 && _currentAnim != null && !_currentAnim.Contains("secondary"); if (flag && !flag2) { bool flag3 = num3 >= num && num3 <= num2; if (flag3 && (Object)(object)_windowVFXInstance == (Object)null) { if ((Object)(object)_cleanVFXPrefab == (Object)null) { GameObject prefab = ZNetScene.instance.GetPrefab("vfx_kiln_addore"); if ((Object)(object)prefab != (Object)null) { bool activeSelf = prefab.activeSelf; prefab.SetActive(false); _cleanVFXPrefab = Object.Instantiate<GameObject>(prefab); prefab.SetActive(activeSelf); Object.DestroyImmediate((Object)(object)_cleanVFXPrefab.GetComponent<ZNetView>()); } } if ((Object)(object)_cleanVFXPrefab != (Object)null) { GameObject rightItemInstance = ((Humanoid)Player.m_localPlayer).m_visEquipment.m_rightItemInstance; Transform val = (((Object)(object)rightItemInstance != (Object)null) ? rightItemInstance.transform : ((Humanoid)Player.m_localPlayer).m_visEquipment.m_rightHand); _windowVFXInstance = Object.Instantiate<GameObject>(_cleanVFXPrefab, val); _windowVFXInstance.SetActive(true); _windowVFXInstance.transform.localPosition = Vector3.zero; } } else if (!flag3 && (Object)(object)_windowVFXInstance != (Object)null) { Object.Destroy((Object)(object)_windowVFXInstance); _windowVFXInstance = null; } } if (ZInput.GetButtonDown("Attack")) { _nowClicked = Time.time; if (!_clicked) { _clicked = true; if (flag) { isPerfectStrike = num3 >= num && num3 <= num2; } } else { _ = isPerfectStrike; } } if (isPerfectStrike && !_windowSFXplayed && !flag2) { GameObject prefab2 = ZNetScene.instance.GetPrefab("sfx_perfectblock"); if ((Object)(object)prefab2 != (Object)null) { Object.Instantiate<GameObject>(prefab2, ((Component)Player.m_localPlayer).transform).transform.localPosition = Vector3.zero; _windowSFXplayed = true; } } if (Time.time - _nowClicked >= _clickSpam) { _clicked = false; } } } [HarmonyPatch(typeof(Character), "Damage")] public static class PerfectStrike_Damage_Patch { public static void Postfix(Character __instance, HitData hit) { if (_perfectDamagePending) { ((DamageTypes)(ref hit.m_damage)).Modify(Player.m_localPlayer.GetTotalActiveMagicEffectValue("PerfectStrike", 0.01f)); _perfectDamagePending = false; _windowSFXplayed = false; } } } private static float _attackStartTime; private static float _clickSpam = 0.25f; private static float _nowClicked; private static bool _clicked = false; private static bool _windowSFXplayed = false; private static int _lastPerfectChain = 0; private static bool isPerfectStrike = false; private static bool _perfectDamagePending = false; private static Attack _currentAttack; private static string _currentAnim; private static int _currentChain; private static float _currentAnimSpeed; private static GameObject _cleanVFXPrefab; private static GameObject _windowVFXInstance; private static readonly Dictionary<(string, int, string), float> _attackDeltas = new Dictionary<(string, int, string), float> { { ("battleaxe_attack", 0, "default"), 0.878f }, { ("battleaxe_attack", 0, "fast"), 0.599f }, { ("battleaxe_attack", 1, "default"), 1.04f }, { ("battleaxe_attack", 1, "fast"), 0.761f }, { ("battleaxe_attack", 2, "default"), 1.304f }, { ("battleaxe_attack", 2, "fast"), 1.078f }, { ("battleaxe_secondary", 0, "default"), 0.843f }, { ("greatsword", 0, "default"), 1.642f }, { ("greatsword", 0, "fast"), 1.258f }, { ("greatsword", 1, "default"), 0.839f }, { ("greatsword", 1, "fast"), 0.579f }, { ("greatsword", 2, "default"), 0.958f }, { ("greatsword", 2, "fast"), 0.682f }, { ("greatsword_secondary", 0, "default"), 2.125f }, { ("greatsword_secondary", 0, "fast"), 1.703f }, { ("swing_longsword", 0, "default"), 1.018f } }; } public static class Retaliation { [HarmonyPatch(typeof(Humanoid), "BlockAttack")] public class Block_Attack_Retaliate_Patch { public static void Postfix(Humanoid __instance, bool __result) { if (Player.m_localPlayer.HasActiveMagicEffect("Retaliation", out var _) && __result && !((Object)(object)__instance != (Object)(object)Player.m_localPlayer)) { SEMan sEMan = ((Character)__instance).GetSEMan(); SE_Retaliation sE_Retaliation = sEMan.GetStatusEffect(StringExtensionMethods.GetStableHashCode("SE_Retaliation")) as SE_Retaliation; if ((Object)(object)sE_Retaliation != (Object)null) { sE_Retaliation.AddStack(); } else { (sEMan.AddStatusEffect(StringExtensionMethods.GetStableHashCode("SE_Retaliation"), false, 0, 0f, (short)(-1)) as SE_Retaliation).AddStack(); } } } } [HarmonyPatch(typeof(Attack), "Start")] public class Humanoid_Attack_Patch { private static void Prefix(Attack __instance, Humanoid character) { if (!((Object)(object)character != (Object)(object)Player.m_localPlayer) && Player.m_localPlayer.HasActiveMagicEffect("Retaliation", out var _)) { AttackType = __instance.m_attackAnimation; } } } public static string AttackType; } public static class Whirlwind { [HarmonyPatch(typeof(CharacterAnimEvent), "CustomFixedUpdate")] [HarmonyPriority(0)] public static class Whirlwind_CharAnim_CFU_Patch { public static void Postfix(CharacterAnimEvent __instance) { //IL_0073: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance.m_character == (Object)null || (Object)(object)Player.m_localPlayer == (Object)null || (Object)(object)__instance.m_character != (Object)(object)Player.m_localPlayer) { return; } InWhirlwind = ((Humanoid)Player.m_localPlayer).GetCurrentWeapon().HasMagicEffect("Whirlwind") && (Object)(object)__instance.m_character != (Object)null && __instance.m_character.InAttack() && __instance.m_character.m_secondaryAttackHold && ((Humanoid)__instance.m_character).m_currentAttack.m_attackAnimation == "atgeir_secondary"; if (InWhirlwind) { if (__instance.m_animator.speed > 1f && __instance.m_animator.speed != 10f) { overFlowAnimSpeed = Mathf.Clamp(__instance.m_animator.speed - 2f, 0f, 0.4f); } __instance.m_animator.speed = 10f; WhirlwindDamage = true; __instance.m_character.m_attack = false; __instance.m_character.m_attackHold = false; } else if (!__instance.m_character.InAttack()) { WhirlwindDamage = false; overFlowAnimSpeed = 0f; } } } [HarmonyPatch(typeof(Character), "Damage")] public static class Whirlwind_Damage_Patch { public static void Prefix(Character __instance, HitData hit) { if (!((Object)(object)hit.GetAttacker() != (Object)(object)Player.m_localPlayer) && InWhirlwind) { ((DamageTypes)(ref hit.m_damage)).Modify(0.4f * (1f + overFlowAnimSpeed)); hit.m_staggerMultiplier = 1f; } } } [HarmonyPatch(typeof(Attack), "GetAttackStamina")] public static class Whirlwind_Stamina_Patch { public static void Postfix(ref float __result) { if (InWhirlwind) { __result *= 0.3f; } } } private static bool InWhirlwind; private static bool WhirlwindDamage; private static float overFlowAnimSpeed; } } namespace EpicLootAPI { [Serializable] [PublicAPI] public enum AbilityActivationMode { Passive, Triggerable, Activated } [Serializable] [PublicAPI] public enum AbilityAction { Custom, StatusEffect } [Serializable] [PublicAPI] public class AbilityDefinition { public string ID = ""; public string IconAsset = ""; public AbilityActivationMode ActivationMode; public float Cooldown; public AbilityAction Action; public List<string> ActionParams = new List<string>(); internal static readonly Method API_AddAbility = new Method("AddAbility"); internal static readonly Method API_UpdateAbility = new Method("UpdateAbility"); internal static List<AbilityDefinition> Abilities = new List<AbilityDefinition>(); [Description("Register a status effect ability which activates on player input")] public AbilityDefinition(string ID, string iconAsset, float cooldown, string statusEffectName) { this.ID = ID; ActivationMode = AbilityActivationMode.Activated; Cooldown = cooldown; Action = AbilityAction.StatusEffect; ActionParams.Add(statusEffectName); IconAsset = iconAsset; Abilities.Add(this); } internal AbilityDefinition(string ID, AbilityActivationMode mode) { this.ID = ID; ActivationMode = mode; } public AbilityDefinition() { } public static void RegisterAll() { foreach (AbilityDefinition item in new List<AbilityDefinition>(Abilities)) { item.Register(); } } public bool Register() { string text = JsonConvert.SerializeObject((object)this); if (!(API_AddAbility.Invoke(text)[0] is string value)) { return false; } RunTimeRegistry.Register(this, value); Abilities.Remove(this); EpicLoot.logger.LogDebug("Registered ability: " + ID); return true; } public bool Update() { if (!RunTimeRegistry.TryGetValue(this, out string value)) { return false; } string text = JsonConvert.SerializeObject((object)this); bool flag = (bool)(API_UpdateAbility.Invoke(value, text)[0] ?? ((object)false)); EpicLoot.logger.LogDebug($"Updated ability {ID}: {flag}"); return flag; } } [PublicAPI] public class AbilityProxyDefinition { public readonly AbilityDefinition Ability; public readonly Dictionary<string, Delegate> Callbacks = new Dictionary<string, Delegate>(); internal static readonly List<AbilityProxyDefinition> ProxyAbilities = new List<AbilityProxyDefinition>(); internal static readonly Method API_RegisterProxyAbility = new Method("RegisterProxyAbility"); internal static readonly Method API_UpdateProxyAbility = new Method("UpdateProxyAbility"); [Description("Register a complex ability behavior using Proxy class")] public AbilityProxyDefinition(string ID, AbilityActivationMode mode, Proxy definition) { Ability = new AbilityDefinition(ID, mode); RegisterCallbacks(definition); ProxyAbilities.Add(this); } [Description("Register a complex ability behavior using Proxy class")] public AbilityProxyDefinition(string ID, AbilityActivationMode mode, Type type) { Ability = new AbilityDefinition(ID, mode); if (!typeof(Proxy).IsAssignableFrom(type)) { EpicLoot.logger.LogError("Ability Proxy " + ID + " Type " + type.Name + " does not implement Proxy class"); return; } try { object obj = Activator.CreateInstance(type); RegisterCallbacks((Proxy)obj); ProxyAbilities.Add(this); } catch (Exception ex) { EpicLoot.logger.LogError("Failed to create instance of " + type.Name + ": " + ex.Message); } } private void RegisterCallbacks(Proxy implementation) { Type type = implementation.GetType(); MethodInfo[] methods = typeof(Proxy).GetMethods(); foreach (MethodInfo methodInfo in methods) { try { Type[] array = (from p in methodInfo.GetParameters() select p.ParameterType).ToArray(); MethodInfo method = type.GetMethod(methodInfo.Name, array); if (method == null) { EpicLoot.logger.LogWarning("Method " + methodInfo.Name + " not found in implementation"); continue; } Type type2 = ((!(methodInfo.ReturnType == typeof(void))) ? Expression.GetFuncType(array.Concat(new Type[1] { methodInfo.ReturnType }).ToArray()) : ((array.Length != 0) ? Expression.GetActionType(array) : typeof(Action))); Delegate value = Delegate.CreateDelegate(type2, implementation, method); Callbacks[methodInfo.Name] = value; } catch (Exception ex) { EpicLoot.logger.LogError("Failed to register callback for method " + methodInfo.Name + ": " + ex.Message); } } } public static void RegisterAll() { foreach (AbilityProxyDefinition item in new List<AbilityProxyDefinition>(ProxyAbilities)) { item.Register(); } } public bool Register() { string text = JsonConvert.SerializeObject((object)Ability); if (!(API_RegisterProxyAbility.Invoke(text, Callbacks)[0] is string value)) { return false; } RunTimeRegistry.Register(this, value); ProxyAbilities.Remove(this); EpicLoot.logger.LogDebug("Registered proxy ability: " + Ability.ID); return true; } public bool Update() { if (!RunTimeRegistry.TryGetValue(this, out string value)) { return false; } string text = JsonConvert.SerializeObject((object)Ability); bool flag = (bool)(API_UpdateProxyAbility.Invoke(value, text, Callbacks)[0] ?? ((object)false)); EpicLoot.logger.LogDebug($"Updated proxy ability: {Ability.ID}, {flag}"); return flag; } } [Description("Functions are converted into delegates when registered to epic loot")] [PublicAPI] public class Proxy { protected Player Player; public string AbilityID = ""; public float Cooldown; public virtual string CooldownEndKey => "EpicLoot." + AbilityID + ".CooldownEnd"; public virtual void Initialize(Player player, string id, float cooldown) { Player = player; AbilityID = id; Cooldown = cooldown; } public virtual void OnUpdate() { } public virtual bool ShouldTrigger() { return false; } public virtual bool IsOnCooldown() { if (HasCooldown()) { return GetTime() < GetCooldownEndTime(); } return false; } public virtual float TimeUntilCooldownEnds() { return Mathf.Max(0f, GetCooldownEndTime() - GetTime()); } public virtual float PercentCooldownComplete() { if (HasCooldown() && IsOnCooldown()) { return 1f - TimeUntilCooldownEnds() / Cooldown; } return 1f; } public virtual bool CanActivate() { return !IsOnCooldown(); } public virtual void TryActivate() { if (CanActivate()) { Activate(); } } public virtual void Activate() { if (HasCooldown()) { float cooldownEndTime = GetTime() + Cooldown; SetCooldownEndTime(cooldownEndTime); } } public virtual void ActivateCustomAction() { } public virtual void ActivateStatusEffectAction() { } public virtual bool HasCooldown() { return Cooldown > 0f; } public virtual void SetCooldownEndTime(float cooldownEndTime) { if (!((Object)(object)Player == (Object)null)) { ((Character)Player).m_nview.GetZDO().Set(CooldownEndKey, cooldownEndTime); } } public virtual float GetCooldownEndTime() { if ((Object)(object)Player == (Object)null) { return 0f; } return ((Character)Player).m_nview.GetZDO().GetFloat(CooldownEndKey, 0f); } public virtual void OnRemoved() { } protected static float GetTime() { return (float)ZNet.instance.GetTimeSeconds(); } } public static class EpicLoot { [PublicAPI] public static class ChangeReason { public const string Enchant = "Enchant"; public const string Augment = "Augment"; public const string Disenchant = "Disenchant"; public const string Rune = "Rune"; public const string Temper = "Temper"; public const string Socket = "Socket"; public const string Unsocket = "Unsocket"; public const string LootRoll = "LootRoll"; public const string Transfer = "Transfer"; public const string AddSocket = "AddSocket"; public const string Unspecified = "Unspecified"; } public static readonly Logger logger = new Logger(); private static readonly Method API_GetTotalActiveMagicEffectValue = new Method("GetTotalActiveMagicEffectValue"); private static readonly Method API_GetTotalActiveMagicEffectValueForWeapon = new Method("GetTotalActiveMagicEffectValueForWeapon"); private static readonly Method API_HasActiveMagicEffect = new Method("HasActiveMagicEffect"); private static readonly Method API_HasActiveMagicEffectOnWeapon = new Method("HasActiveMagicEffectOnWeapon"); private static readonly Method API_GetTotalActiveSetEffectValue = new Method("GetTotalActiveSetEffectValue"); private static readonly Method API_GetAllActiveMagicEffects = new Method("GetAllActiveMagicEffects"); private static readonly Method API_GetAllSetMagicEffects = new Method("GetAllActiveSetMagicEffects"); private static readonly Method API_GetPlayerTotalActiveMagicEffectValue = new Method("GetTotalPlayerActiveMagicEffectValue"); private static readonly Method API_PlayerHasActiveMagicEffect = new Method("PlayerHasActiveMagicEffect"); private static readonly Method API_HasLegendaryItem = new Method("HasLegendaryItem"); private static readonly Method API_HasLegendarySet = new Method("HasLegendarySet"); private static readonly Method API_RegisterAsset = new Method("RegisterAsset"); private static readonly Method API_GetMagicItemJson = new Method("GetMagicItemJson"); private static readonly Method API_RegisterMagicEffectRequirement = new Method("RegisterMagicEffectRequirement", typeof(string), typeof(Func<ItemData, object, string, bool, bool, bool, bool>)); private static readonly Method API_AddMagicItemChangedListener = new Method("AddMagicItemChangedListener", typeof(Action<ItemData, string>)); private static readonly Method API_RemoveMagicItemChangedListener = new Method("RemoveMagicItemChangedListener", typeof(Action<ItemData, string>)); private static readonly Method API_AddLootGeneratedListener = new Method("AddLootGeneratedListener", typeof(Action<ItemData>)); private static readonly Method API_RemoveLootGeneratedListener = new Method("RemoveLootGeneratedListener", typeof(Action<ItemData>)); private static readonly Method API_AddBountyCompletedListener = new Method("AddBountyCompletedListener", typeof(Action<Player, string>)); private static readonly Method API_RemoveBountyCompletedListener = new Method("RemoveBountyCompletedListener", typeof(Action<Player, string>)); private static readonly Method API_TryMakeMagicItem = new Method("TryMakeMagicItem"); private static readonly Method API_RollMagicItemJson = new Method("RollMagicItemJson"); private static readonly Method API_ApplyMagicItemJson = new Method("ApplyMagicItemJson"); private static readonly Method API_GetLuckFactor = new Method("GetLuckFactor"); private static readonly Method API_RollEffectCountForRarity = new Method("RollEffectCountForRarity"); private static readonly Method API_GetLegendaryIDs = new Method("GetLegendaryIDs"); private static readonly Method API_GetLegendaryInfoJson = new Method("GetLegendaryInfoJson"); private static readonly Method API_GetAvailableEffectTypes = new Method("GetAvailableEffectTypes"); private static readonly Method API_AddLootTables = new Method("AddLootTables"); private static readonly Method API_UpdateLootTables = new Method("UpdateLootTables"); private static readonly Method API_RegisterInventoryProvider = new Method("RegisterInventoryProvider", typeof(string), typeof(Func<List<ItemData>>), typeof(Func<string, int>), typeof(Func<string, int, int>), typeof(Func<ItemData, int, int>)); private static readonly Method API_UnregisterInventoryProvider = new Method("UnregisterInventoryProvider"); private static readonly Method API_RegisterEquipmentProvider = new Method("RegisterEquipmentProvider", typeof(string), typeof(Func<Player, List<ItemData>>)); private static readonly Method API_UnregisterEquipmentProvider = new Method("UnregisterEquipmentProvider"); private static readonly Method API_RegisterSacrificeFilter = new Method("RegisterSacrificeFilter", typeof(string), typeof(Func<ItemData, bool>)); private static readonly Method API_UnregisterSacrificeFilter = new Method("UnregisterSacrificeFilter"); private static readonly Method API_InvalidatePlayerEffectCache = new Method("InvalidatePlayerEffectCache"); private static readonly Method API_GetRegisteredProviders = new Method("GetRegisteredProviders"); private static readonly Method API_GetApiVersion = new Method("GetApiVersion"); private static readonly Method API_GetPluginVersion = new Method("GetPluginVersion"); private static readonly Method API_HasEndpoint = new Method("HasEndpoint"); private static readonly Method API_IsMagicItem = new Method("IsMagicItem"); private static readonly Method API_TryGetRarity = new Method("TryGetRarity"); private static readonly Method API_GetRarityCount = new Method("GetRarityCount"); private static readonly Method API_GetRarityColorByIndex = new Method("GetRarityColorByIndex"); private static readonly Method API_GetRarityDisplayNameByIndex = new Method("GetRarityDisplayNameByIndex"); private static readonly Method API_GetItemRarityColor = new Method("GetItemRarityColor"); private static readonly Method API_IsEpicLootItem = new Method("IsEpicLootItem"); private static readonly Method API_IsShardStone = new Method("IsShardStone"); private static readonly Method API_IsRunestone = new Method("IsRunestone"); private static readonly Method API_IsMagicCraftingMaterial = new Method("IsMagicCraftingMaterial"); private static readonly Method API_IsUnidentified = new Method("IsUnidentified"); private static readonly Method API_CanBeMagicItem = new Method("CanBeMagicItem"); private static readonly Method API_ItemHasMagicEffect = new Method("ItemHasMagicEffect"); private static readonly Method API_GetAllMagicEffectTypes = new Method("GetAllMagicEffectTypes"); private static readonly Method API_GetEnchantCostsJson = new Method("GetEnchantCostsJson"); private static readonly Method API_GetSacrificeProductsJson = new Method("GetSacrificeProductsJson"); private static readonly Method API_GetItemDisplayName = new Method("GetItemDisplayName"); private static readonly Method API_GetItemDecoratedName = new Method("GetItemDecoratedName", typeof(ItemData), typeof(string)); private static readonly Method API_ApplyMagicItemBackground = new Method("ApplyMagicItemBackground", typeof(GameObject), typeof(GameObject), typeof(ItemData), typeof(bool)); private static readonly Method API_ApplyMagicItemBackgroundToIcon = new Method("ApplyMagicItemBackgroundToIcon", typeof(GameObject), typeof(ItemData)); [PublicAPI] [Description("Send all your custom conversions, effects, item definitions, etc... to Epic Loot")] public static void RegisterAll() { MaterialConversion.RegisterAll(); MagicItemEffectDefinition.RegisterAll(); AbilityDefinition.RegisterAll(); CustomRecipe.RegisterAll(); Sacrifice.RegisterAll(); TreasureMap.RegisterAll(); SecretStashItem.RegisterAll(); LegendaryInfo.RegisterAll(); LegendarySetInfo.RegisterAll(); BountyTarget.RegisterAll(); AbilityProxyDefinition.RegisterAll(); } [PublicAPI] [Description("Register asset into EpicLoot in order to target them in your definitions")] public static bool RegisterAsset(string name, object asset) { bool flag = (bool)(API_RegisterAsset.Invoke(name, asset)[0] ?? ((object)false)); logger.LogDebug($"Registered asset: {name}, {flag}"); return flag; } [PublicAPI] public static bool RegisterMagicEffectRequirement(string externalRequirement, Func<ItemData, object, string, bool, bool, bool, bool> requirement) { bool flag = (bool)(API_RegisterMagicEffectRequirement.Invoke(externalRequirement, requirement)[0] ?? ((object)false)); logger.LogDebug($"Registered magic effect requirement: {externalRequirement}, {flag}"); return flag; } [PublicAPI] public static bool HasLegendaryItem(this Player player, string legendaryItemID) { bool flag = (bool)(API_HasLegendaryItem.Invoke(player, legendaryItemID)[0] ?? ((object)false)); logger.LogDebug($"Has legendary item: {legendaryItemID}, {flag} "); return flag; } [PublicAPI] public static bool HasLegendarySet(this Player player, string legendarySetID, out int count) { count = 0; object[] array = API_HasLegendarySet.Invoke(player, legendarySetID, count); count = (int)(array[3] ?? ((object)0)); bool flag = (bool)(array[0] ?? ((object)false)); logger.LogDebug($"Has legendary set: {legendarySetID}, {flag}, count: {count}"); return flag; } [PublicAPI] public static bool HasActiveMagicEffectOnWeapon(Player player, ItemData item, string effectType, out float effectValue) { effectValue = 0f; object[] array = API_HasActiveMagicEffectOnWeapon.Invoke(player, item, effectType, effectValue); effectValue = (float)(array[4] ?? ((object)0f)); bool flag = (bool)(array[0] ?? ((object)false)); logger.LogDebug($"Has magic effect on weapon: {effectType}, {flag}, value: {effectValue}"); return flag; } [PublicAPI] public static float GetTotalActiveMagicEffectValue(Player player, ItemData item, string effectType, float scale = 1f) { float num = (float)(API_GetTotalActiveMagicEffectValue.Invoke(player, item, effectType, scale)[0] ?? ((object)0f)); logger.LogDebug($"Total magic effect value: {effectType}, amount: {num}"); return num; } [PublicAPI] public static float GetTotalActiveMagicEffectValueForWeapon(Player player, ItemData item, string effectType, float scale = 1f) { float num = (float)(API_GetTotalActiveMagicEffectValueForWeapon.Invoke(player, item, effectType, scale)[0] ?? ((object)0f)); logger.LogDebug($"Total effect on weapon: {effectType}, amount: {num}"); return num; } [PublicAPI] public static bool HasActiveMagicEffect(Player player, string effectType, ItemData item, out float effectValue) { effectValue = 0f; object[] array = API_HasActiveMagicEffect.Invoke(player, effectType, item, effectValue); effectValue = (float)(array[4] ?? ((object)0f)); bool flag = (bool)(array[0] ?? ((object)false)); logger.LogDebug($"Has active effect: {effectType}, {flag}, value: {effectValue}"); return flag; } [PublicAPI] public static float GetTotalActiveSetEffectValue(Player player, string effectType, float scale = 1f) { float num = (float)(API_GetTotalActiveSetEffectValue.Invoke(player, effectType, scale)[0] ?? ((object)0f)); logger.LogDebug($"Total effect value: {effectType}, amount: {num}"); return num; } [PublicAPI] public static List<MagicItemEffect> GetAllActiveMagicEffects(this Player player, string effectType = null) { List<string> list = (List<string>)(API_GetAllActiveMagicEffects.Invoke(player, effectType)[0] ?? new List<string>()); if (list.Count <= 0) { return new List<MagicItemEffect>(); } List<MagicItemEffect> list2 = new List<MagicItemEffect>(); list2.DeserializeList(list); return list2; } [PublicAPI] public static List<MagicItemEffect> GetAllActiveSetMagicEffects(this Player player, string effectType = null) { List<string> list = (List<string>)(API_GetAllSetMagicEffects.Invoke(player, effectType)[0] ?? new List<string>()); if (list.Count <= 0) { return new List<MagicItemEffect>(); } List<MagicItemEffect> list2 = new List<MagicItemEffect>(); list2.DeserializeList(list); return list2; } private static void DeserializeList<T>(this List<T> output, List<string> input) { foreach (string item in input) { try { T val = JsonConvert.DeserializeObject<T>(item); if (val != null) { output.Add(val); } } catch { logger.LogWarning("Failed to parse " + typeof(T).Name); } } } [PublicAPI] public static float GetTotalActiveMagicEffectValue(this Player player, string effectType, float scale = 1f, ItemData ignoreThisItem = null) { float num = (float)(API_GetPlayerTotalActiveMagicEffectValue.Invoke(player, effectType, scale, ignoreThisItem)[0] ?? ((object)0f)); logger.LogDebug($"Total magic effect: {effectType}, value: {num}"); return num; } [PublicAPI] public static bool HasActiveMagicEffect(this Player player, string effectType, out float effectValue, float scale = 1f, ItemData ignoreThisItem = null) { effectValue = 0f; object[] array = API_PlayerHasActiveMagicEffect.Invoke(player, effectType, effectValue, scale, ignoreThisItem); effectValue = (float)(array[3] ?? ((object)0f)); bool flag = (bool)(array[0] ?? ((object)false)); logger.LogDebug($"Has active magic effect: {effectType}, value: {flag}"); return flag; } [PublicAPI] public static MagicItem GetMagicItem(this ItemData itemData) { string text = (string)(API_GetMagicItemJson.Invoke(itemData)[0] ?? ""); if (string.IsNullOrEmpty(text)) { return null; } return JsonConvert.DeserializeObject<MagicItem>(text); } [PublicAPI] public static bool AddMagicItemChangedListener(Action<ItemData, string> listener) { return (bool)(API_AddMagicItemChangedListener.Invoke(listener)[0] ?? ((object)false)); } [PublicAPI] public static bool RemoveMagicItemChangedListener(Action<ItemData, string> listener) { return (bool)(API_RemoveMagicItemChangedListener.Invoke(listener)[0] ?? ((object)false)); } [PublicAPI] public static bool AddLootGeneratedListener(Action<ItemData> listener) { return (bool)(API_AddLootGeneratedListener.Invoke(listener)[0] ?? ((object)false)); } [PublicAPI] public static bool RemoveLootGeneratedListener(Action<ItemData> listener) { return (bool)(API_RemoveLootGeneratedListener.Invoke(listener)[0] ?? ((object)false)); } [PublicAPI] public static bool AddBountyCompletedListener(Action<Player, string> listener) { return (bool)(API_AddBountyCompletedListener.Invoke(listener)[0] ?? ((object)false)); } [PublicAPI] public static bool RemoveBountyCompletedListener(Action<Player, string> listener) { return (bool)(API_RemoveBountyCompletedListener.Invoke(listener)[0] ?? ((object)false)); } [PublicAPI] public static bool TryMakeMagicItem(this ItemData item, ItemRarity rarity, float luck = 0f, string? legendaryID = null) { bool flag = (bool)(API_TryMakeMagicItem.Invoke(item, (int)rarity, luck, legendaryID ?? "")[0] ?? ((object)false)); logger.LogDebug($"Made magic item: {item?.m_shared?.m_name}, {rarity}, {flag}"); return flag; } [PublicAPI] public static MagicItem? RollMagicItem(ItemRarity rarity, ItemData item, float luck = 0f) { string text = (string)(API_RollMagicItemJson.Invoke((int)rarity, item, luck)[0] ?? ""); if (string.IsNullOrEmpty(text)) { return null; } try { return JsonConvert.DeserializeObject<MagicItem>(text); } catch { logger.LogWarning("Failed to parse rolled magic item"); return null; } } [PublicAPI] public static bool ApplyMagicItem(this ItemData item, MagicItem magicItem) { if (magicItem == null) { return false; } string text = JsonConvert.SerializeObject((object)magicItem); return (bool)(API_ApplyMagicItemJson.Invoke(item, text)[0] ?? ((object)false)); } [PublicAPI] public static float GetLuckFactor(Vector3 position) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) return (float)(API_GetLuckFactor.Invoke(position)[0] ?? ((object)0f)); } [PublicAPI] public static int RollEffectCountForRarity(ItemRarity rarity) { return (int)(API_RollEffectCountForRarity.Invoke((int)rarity)[0] ?? ((object)0)); } [PublicAPI] public static List<string> GetLegendaryIDs(ItemRarity rarity) { return (List<string>)(API_GetLegendaryIDs.Invoke((int)rarity)[0] ?? new List<string>()); } [PublicAPI] public static LegendaryInfo? GetLegendaryInfo(string legendaryID) { string text = (string)(API_GetLegendaryInfoJson.Invoke(legendaryID)[0] ?? ""); if (string.IsNullOrEmpty(text)) { return null; } try { return JsonConvert.DeserializeObject<LegendaryInfo>(text); } catch { logger.LogWarning("Failed to parse legendary info for " + legendaryID); return null; } } [PublicAPI] public static List<string> GetAvailableEffectTypes(this ItemData item, ItemRarity rarity, MagicItem? magicItem = null) { string text = ((magicItem == null) ? "" : JsonConvert.SerializeObject((object)magicItem)); return (List<string>)(API_GetAvailableEffectTypes.Invoke(item, text, (int)rarity)[0] ?? new List<string>()); } [PublicAPI] public static bool AddLootTables(string json) { if (!(API_AddLootTables.Invoke(json)[0] is string value)) { return false; } RunTimeRegistry.Register(json, value); logger.LogDebug("Registered external loot tables"); return true; } [PublicAPI] public static bool UpdateLootTables(string originalJson, string json) { if (!RunTimeRegistry.TryGetValue(originalJson, out string value)) { return false; } return (bool)(API_UpdateLootTables.Invoke(value, json)[0] ?? ((object)false)); } [PublicAPI] public static bool RegisterInventoryProvider(string id, Func<List<ItemData>> getItems, Func<string, int> countItem, Func<string, int, int> removeItem, Func<ItemData, int, int> removeExactItem) { bool flag = (bool)(API_RegisterInventoryProvider.Invoke(id, getItems, countItem, removeItem, removeExactItem)[0] ?? ((object)false)); logger.LogDebug($"Registered inventory provider: {id}, {flag}"); return flag; } [PublicAPI] public static bool UnregisterInventoryProvider(string id) { return (bool)(API_UnregisterInventoryProvider.Invoke(id)[0] ?? ((object)false)); } [PublicAPI] public static bool RegisterEquipmentProvider(string id, Func<Player, List<ItemData>> getExtraEquipped) { bool flag = (bool)(API_RegisterEquipmentProvider.Invoke(id, getExtraEquipped)[0] ?? ((object)false)); logger.LogDebug($"Registered equipment provider: {id}, {flag}"); return flag; } [PublicAPI] public static bool UnregisterEquipmentProvider(string id) { return (bool)(API_UnregisterEquipmentProvider.Invoke(id)[0] ?? ((object)false)); } [PublicAPI] public static void InvalidatePlayerEffectCache(this Player player) { API_InvalidatePlayerEffectCache.Invoke(player); } [PublicAPI] public static bool RegisterSacrificeFilter(string id, Func<ItemData, bool> canSacrifice) { bool flag = (bool)(API_RegisterSacrificeFilter.Invoke(id, canSacrifice)[0] ?? ((object)false)); logger.LogDebug($