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 EpicJewels v1.0.1
plugins/EpicJewels.dll
Decompiled 3 days ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security.Permissions; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using EpicJewels.Common; using EpicJewels.EffectHelpers; using EpicJewels.GemEffects; using HarmonyLib; using JetBrains.Annotations; using Jewelcrafting; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Managers; using Jotunn.Utils; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.UI; using YamlDotNet.Serialization; using YamlDotNet.Serialization.NamingConventions; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("EpicJewels")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("EpicJewels")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("e3243d22-4307-4008-ba36-9f326008cde5")] [assembly: AssemblyFileVersion("1.0.1")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.1.0")] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace Jewelcrafting { [Flags] public enum VisualEffectCondition : uint { IsSkill = 0xFFFu, Swords = 1u, Knives = 2u, Clubs = 3u, Polearms = 4u, Spears = 5u, Blocking = 6u, Axes = 7u, Bows = 8u, Unarmed = 0xBu, Pickaxes = 0xCu, WoodCutting = 0xDu, Crossbows = 0xEu, IsItem = 0xFF000u, Helmet = 0x6000u, Chest = 0x7000u, Legs = 0xB000u, Hands = 0xC000u, Shoulder = 0x11000u, Tool = 0x13000u, GenericExtraAttributes = 0xFF000000u, Blackmetal = 0x40000000u, TwoHanded = 0x80000000u, SpecificExtraAttributes = 0xF00000u, Hammer = 0x113000u, Hoe = 0x213000u, Buckler = 0x100006u, Towershield = 0x200006u, FineWoodBow = 0x100008u, BowHuntsman = 0x200008u, BowDraugrFang = 0x300008u, PickaxeIron = 0x10000Cu, Club = 0x100003u } [AttributeUsage(AttributeTargets.Field)] public abstract class PowerAttribute : Attribute { public abstract float Add(float a, float b); } [AttributeUsage(AttributeTargets.Field)] public class OptionalPowerAttribute : Attribute { public readonly float DefaultValue; public OptionalPowerAttribute(float defaultValue) { DefaultValue = defaultValue; } } public class MultiplicativePercentagePowerAttribute : PowerAttribute { public override float Add(float a, float b) { return (float)(((1.0 + (double)a / 100.0) * (1.0 + (double)b / 100.0) - 1.0) * 100.0); } } public class MinPowerAttribute : PowerAttribute { public override float Add(float a, float b) { return Mathf.Min(a, b); } } public class MaxPowerAttribute : PowerAttribute { public override float Add(float a, float b) { return Mathf.Max(a, b); } } public class InverseMultiplicativePercentagePowerAttribute : PowerAttribute { public override float Add(float a, float b) { return (float)((1.0 - (1.0 - (double)a / 100.0) * (1.0 - (double)b / 100.0)) * 100.0); } } public class AdditivePowerAttribute : PowerAttribute { public override float Add(float a, float b) { return a + b; } } [PublicAPI] public static class API { [PublicAPI] public class GemInfo { public readonly string gemPrefab; public readonly Sprite gemSprite; public readonly Dictionary<string, float> gemEffects; public GemInfo(string gemPrefab, Sprite gemSprite, Dictionary<string, float> gemEffects) { this.gemPrefab = gemPrefab; this.gemSprite = gemSprite; this.gemEffects = gemEffects; } } public delegate bool GemBreakHandler(ItemData? container, ItemData gem, int count = 1); public delegate bool ItemBreakHandler(ItemData? container); public delegate bool ItemMirroredHandler(ItemData? item); public static event Action? OnEffectRecalc; public static bool IsLoaded() { return false; } internal static void InvokeEffectRecalc() { API.OnEffectRecalc?.Invoke(); } public static GameObject CreateNecklaceFromTemplate(string colorName, Color color) { return null; } public static GameObject CreateNecklaceFromTemplate(string colorName, Material material) { return null; } public static GameObject CreateRingFromTemplate(string colorName, Color color) { return null; } public static GameObject CreateRingFromTemplate(string colorName, Material material) { return null; } public static void MarkJewelry(GameObject jewelry) { } public static void AddGems(string type, string colorName, Color color) { } public static List<GameObject> AddGems(string type, string colorName, Material material, Color color) { return null; } public static GameObject AddDestructibleFromTemplate(string type, string colorName, Color color) { return null; } public static GameObject AddDestructibleFromTemplate(string type, string colorName, Material material) { return null; } public static GameObject AddUncutFromTemplate(string type, string colorName, Color color) { return null; } public static GameObject AddUncutFromTemplate(string type, string colorName, Material material) { return null; } public static GameObject AddAndRegisterUncutFromTemplate(string type, string colorName, Color color) { return null; } public static GameObject AddAndRegisterUncutFromTemplate(string type, string colorName, Material material) { return null; } public static GameObject AddShardFromTemplate(string type, string colorName, Color color) { return null; } public static GameObject AddShardFromTemplate(string type, string colorName, Material material) { return null; } public static GameObject[] AddTieredGemFromTemplate(string type, string colorName, Color color) { return null; } public static GameObject[] AddTieredGemFromTemplate(string type, string colorName, Material material, Color color) { return null; } public static void AddGem(GameObject prefab, string colorName) { } public static void AddShard(GameObject prefab, string colorName) { } public static void AddDestructible(GameObject prefab, string colorName) { } public static void AddUncutGem(GameObject prefab, string colorName, ConfigEntry<float>? dropChance = null) { } public static void AddGemEffect<T>(string name, string? englishDescription = null, string? englishDescriptionDetailed = null) where T : struct { } public static void AddGemConfig(string yaml) { } public static T GetEffectPower<T>(this Player player, string name) where T : struct { return default(T); } public static List<GemInfo?> GetGems(ItemData item) { return new List<GemInfo>(); } public static bool SetGems(ItemData item, List<GemInfo?> gems) { return false; } public static Sprite GetSocketBorder() { return null; } public static GameObject GetGemcuttersTable() { return null; } public static void AddParticleEffect(string prefabName, GameObject effect, VisualEffectCondition displayCondition) { } public static void SetSocketsLock(ItemData item, bool enabled) { } public static void OnGemBreak(GemBreakHandler callback) { } public static void OnItemBreak(ItemBreakHandler callback) { } public static void OnItemMirrored(ItemMirroredHandler callback) { } public static bool IsJewelryEquipped(Player player, string prefabName) { return false; } public static bool BlacklistItem(GameObject item) { return false; } } } namespace EpicJewels { [BepInPlugin("MidnightsFX.EpicJewels", "EpicJewels", "1.0.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] internal class EpicJewels : BaseUnityPlugin { [HarmonyPatch(typeof(InventoryGui), "Awake")] public static class EnableSynergyTextfit { [HarmonyPriority(0)] public static void Postfix() { IEnumerable<GameObject> enumerable = from obj in Resources.FindObjectsOfTypeAll<GameObject>() where ((Object)obj).name.StartsWith("JC_Synergies_Window") select obj; EJLogger.LogDebug($"Found {enumerable.Count()} Synergy panels to update."); foreach (GameObject item in enumerable) { try { EJLogger.LogDebug($"Updating Synergy GO {item}"); ((Component)item.transform.Find("Bkg/Left_Text/Left_Text_1")).gameObject.GetComponent<Text>().resizeTextForBestFit = true; } catch (Exception) { } } } } public const string PluginGUID = "MidnightsFX.EpicJewels"; public const string PluginName = "EpicJewels"; public const string PluginVersion = "1.0.1"; public static ManualLogSource Log; internal static bool CrystalLightsLoaded = false; internal ValConfig cfg; internal static AssetBundle EmbeddedResourceBundle; internal static Harmony Harmony = new Harmony("MidnightsFX.EpicJewels"); public static IDeserializer yamldeserializer = ((BuilderSkeleton<DeserializerBuilder>)new DeserializerBuilder()).WithNamingConvention(CamelCaseNamingConvention.Instance).Build(); public static ISerializer yamlserializer = ((BuilderSkeleton<SerializerBuilder>)new SerializerBuilder()).WithNamingConvention(CamelCaseNamingConvention.Instance).DisableAliases().Build(); public static Material spiritCreature; public void Awake() { Log = ((BaseUnityPlugin)this).Logger; cfg = new ValConfig(((BaseUnityPlugin)this).Config); AddLocalizations(); EmbeddedResourceBundle = LoadAssetBundle("EpicJewels.AssetsEmbedded.epicjewels"); EJLogger.LogDebug("Logging embedded assets."); string[] allAssetNames = EmbeddedResourceBundle.GetAllAssetNames(); foreach (string message in allAssetNames) { EJLogger.LogDebug(message); } EJLogger.LogInfo("Let the gems flow."); EffectList.AddGemEffects(); GemResources.AddGems(); Dictionary<string, BaseUnityPlugin> plugins = BepInExUtils.GetPlugins(false); if (plugins.Keys.Contains("org.bepinex.plugins.crystallights") || ValConfig.EnableCrystalLightsAlways.Value) { CrystalLightsLoaded = true; GemResources.AddAllCrystalLights(); EJLogger.LogInfo("Epic Crystal Lights enabled."); } spiritCreature = EmbeddedResourceBundle.LoadAsset<Material>("spirit_animal_mat.mat"); Assembly executingAssembly = Assembly.GetExecutingAssembly(); Harmony.PatchAll(executingAssembly); ValConfig.cfg.SaveOnConfigSet = true; ValConfig.cfg.Save(); } public static AssetBundle LoadAssetBundle(string bundleName) { Assembly assembly = typeof(EpicJewels).Assembly; string name = null; try { name = assembly.GetManifestResourceNames().Single((string str) => str.EndsWith(bundleName)); } catch (Exception) { } using Stream stream = assembly.GetManifestResourceStream(name); return AssetBundle.LoadFromStream(stream); } public static string LoadEmbeddedAssetToString(string assetName) { Assembly assembly = typeof(EpicJewels).Assembly; string text = null; try { text = assembly.GetManifestResourceNames().Single((string str) => str.EndsWith(assetName)); } catch (Exception) { } if (text == null) { return null; } string result; using (Stream stream = assembly.GetManifestResourceStream(text)) { using StreamReader streamReader = new StreamReader(stream); result = streamReader.ReadToEnd(); } return result; } private void AddLocalizations() { CustomLocalization localization = LocalizationManager.Instance.GetLocalization(); EJLogger.LogInfo("Loading Localizations."); string[] manifestResourceNames = typeof(EpicJewels).Assembly.GetManifestResourceNames(); foreach (string text in manifestResourceNames) { if (text.Contains("Localizations")) { EJLogger.LogDebug("Reading localization resource: " + text); string input = ReadEmbeddedResourceFile(text); string text2 = Regex.Replace(input, "\\/\\/.*", ""); string[] array = text.Split(new char[1] { '.' }); EJLogger.LogDebug("Adding localization: " + array[2]); localization.AddJsonFile(array[2], text2); } } } internal static string ReadEmbeddedResourceFile(string filename) { using Stream stream = typeof(EpicJewels).Assembly.GetManifestResourceStream(filename); using StreamReader streamReader = new StreamReader(stream); return streamReader.ReadToEnd(); } } internal static class GemResources { private class GemDefition { public Color Color { get; set; } public Material Material { get; set; } } private static Dictionary<string, GemDefition> GemDefinitions = new Dictionary<string, GemDefition>(); public static void AddGems() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) Material material = EpicJewels.EmbeddedResourceBundle.LoadAsset<Material>("gem_jade.mat"); Color color = default(Color); ((Color)(ref color))..ctor(0.031f, 0.69f, 0.043f, 1f); GemDefinitions.Add("Jade", new GemDefition { Color = color, Material = material }); Material material2 = EpicJewels.EmbeddedResourceBundle.LoadAsset<Material>("garnet_gem.mat"); Color color2 = default(Color); ((Color)(ref color2))..ctor(1f, 0.141f, 0.039f, 1f); GemDefinitions.Add("Garnet", new GemDefition { Color = color2, Material = material2 }); Material material3 = EpicJewels.EmbeddedResourceBundle.LoadAsset<Material>("amber_gem.mat"); Color color3 = default(Color); ((Color)(ref color3))..ctor(81f / 85f, 0.7568628f, 5f / 51f, 1f); GemDefinitions.Add("Amber", new GemDefition { Color = color3, Material = material3 }); Material material4 = EpicJewels.EmbeddedResourceBundle.LoadAsset<Material>("opal_gem.mat"); Color color4 = default(Color); ((Color)(ref color4))..ctor(0.945f, 0.988f, 0.988f, 1f); GemDefinitions.Add("Opal", new GemDefition { Color = color4, Material = material4 }); Material material5 = EpicJewels.EmbeddedResourceBundle.LoadAsset<Material>("amethyst_gem.mat"); Color color5 = default(Color); ((Color)(ref color5))..ctor(0.784f, 0.302f, 0.98f, 1f); GemDefinitions.Add("Amethyst", new GemDefition { Color = color5, Material = material5 }); Material material6 = EpicJewels.EmbeddedResourceBundle.LoadAsset<Material>("aquamarine_gem.mat"); Color color6 = default(Color); ((Color)(ref color6))..ctor(0.259f, 0.663f, 0.71f, 1f); GemDefinitions.Add("Aquamarine", new GemDefition { Color = color6, Material = material6 }); AddGemRegisterOverride("Jade"); AddGemRegisterOverride("Amber"); AddGemRegisterOverride("Aquamarine"); AddGemRegisterOverride("Garnet"); AddGemRegisterOverride("Opal"); AddGemRegisterOverride("Amethyst"); API.AddGemConfig(EpicJewels.LoadEmbeddedAssetToString("EJConfig.yaml")); } internal static void AddGemRegisterOverride(string name) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) API.AddGems(name, name.ToLower(), GemDefinitions[name].Color); MinimapManager.OnVanillaMapAvailable += delegate { string prefabName = "Raw_" + name.ToLower() + "_Gemstone"; IEnumerable<GameObject> enumerable = from obj in Resources.FindObjectsOfTypeAll<GameObject>() where ((Object)obj).name == prefabName select obj; EJLogger.LogDebug($"Found {enumerable.Count()} objects in the scene with the name {prefabName} to apply gem material to."); foreach (GameObject item in enumerable) { item.GetComponentsInChildren<MeshRenderer>().ToList().ForEach(delegate(MeshRenderer renderer) { ((Renderer)renderer).material = GemDefinitions[name].Material; }); } }; } internal static void AddAllCrystalLights() { AddCrystalLightResources("Jade"); AddCrystalLightResources("Amber"); AddCrystalLightResources("Aquamarine"); AddCrystalLightResources("Garnet"); AddCrystalLightResources("Opal"); AddCrystalLightResources("Amethyst"); JotunnPiece.SetupJotunnPieces(); } internal static void AddCrystalLightResources(string name) { JotunnPiece.JotunnBuildPiece jotunnBuildPiece = new JotunnPiece.JotunnBuildPiece(); jotunnBuildPiece.Name = name + " Brazier"; jotunnBuildPiece.Prefab = "CL_Brazier_" + name; jotunnBuildPiece.Sprite = "CL_Brazier_" + name; jotunnBuildPiece.Workbench = "forge"; jotunnBuildPiece.Category = "Crystal Lights"; jotunnBuildPiece.PieceCost = new List<JotunnPiece.PieceCost> { new JotunnPiece.PieceCost { prefab = "Uncut_" + name.ToLower() + "_Stone", amount = 10, refundable = true }, new JotunnPiece.PieceCost { prefab = "IronNails", amount = 4, refundable = true } }; jotunnBuildPiece.BeforePrefabRegistered = delegate(JotunnPiece.JotunnBuildPiece jbuildpiece) { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: 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) Piece component9 = jbuildpiece.Objs.Prefab.GetComponent<Piece>(); component9.m_name = "$EJ_Brazier_" + name; component9.m_description = "$EJ_Brazier_" + name + "_Description"; ((Component)jbuildpiece.Objs.Prefab.transform).GetComponentInChildren<Light>().color = GemDefinitions[name].Color; MainModule main9 = ((Component)jbuildpiece.Objs.Prefab.transform).GetComponentInChildren<ParticleSystem>().main; ((MainModule)(ref main9)).startColor = MinMaxGradient.op_Implicit(GemDefinitions[name].Color); }; JotunnPiece.RegisterJotunnPiece(jotunnBuildPiece); JotunnPiece.JotunnBuildPiece jotunnBuildPiece2 = new JotunnPiece.JotunnBuildPiece(); jotunnBuildPiece2.Name = name + " Chandelier"; jotunnBuildPiece2.Prefab = "CL_Chandelier_" + name; jotunnBuildPiece2.Sprite = "CL_Chandelier_" + name; jotunnBuildPiece2.Workbench = "forge"; jotunnBuildPiece2.Category = "Crystal Lights"; jotunnBuildPiece2.PieceCost = new List<JotunnPiece.PieceCost> { new JotunnPiece.PieceCost { prefab = "Uncut_" + name.ToLower() + "_Stone", amount = 15, refundable = true }, new JotunnPiece.PieceCost { prefab = "IronNails", amount = 5, refundable = true } }; jotunnBuildPiece2.BeforePrefabRegistered = delegate(JotunnPiece.JotunnBuildPiece jbuildpiece) { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: 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) Piece component8 = jbuildpiece.Objs.Prefab.GetComponent<Piece>(); component8.m_name = "$EJ_Chandelier_" + name; component8.m_description = "$EJ_Chandelier_" + name + "_Description"; ((Component)jbuildpiece.Objs.Prefab.transform).GetComponentInChildren<Light>().color = GemDefinitions[name].Color; MainModule main8 = ((Component)jbuildpiece.Objs.Prefab.transform).GetComponentInChildren<ParticleSystem>().main; ((MainModule)(ref main8)).startColor = MinMaxGradient.op_Implicit(GemDefinitions[name].Color); }; JotunnPiece.RegisterJotunnPiece(jotunnBuildPiece2); JotunnPiece.JotunnBuildPiece jotunnBuildPiece3 = new JotunnPiece.JotunnBuildPiece(); jotunnBuildPiece3.Name = name + " Hanging Bowl"; jotunnBuildPiece3.Prefab = "CL_Hanging_" + name; jotunnBuildPiece3.Sprite = "CL_Hanging_" + name; jotunnBuildPiece3.Workbench = "forge"; jotunnBuildPiece3.Category = "Crystal Lights"; jotunnBuildPiece3.PieceCost = new List<JotunnPiece.PieceCost> { new JotunnPiece.PieceCost { prefab = "Uncut_" + name.ToLower() + "_Stone", amount = 5, refundable = true }, new JotunnPiece.PieceCost { prefab = "IronNails", amount = 2, refundable = true } }; jotunnBuildPiece3.BeforePrefabRegistered = delegate(JotunnPiece.JotunnBuildPiece jbuildpiece) { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: 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) Piece component7 = jbuildpiece.Objs.Prefab.GetComponent<Piece>(); component7.m_name = "$EJ_Hanging_" + name; component7.m_description = "$EJ_Hanging_" + name + "_Description"; ((Component)jbuildpiece.Objs.Prefab.transform).GetComponentInChildren<Light>().color = GemDefinitions[name].Color; MainModule main7 = ((Component)jbuildpiece.Objs.Prefab.transform).GetComponentInChildren<ParticleSystem>().main; ((MainModule)(ref main7)).startColor = MinMaxGradient.op_Implicit(GemDefinitions[name].Color); }; JotunnPiece.RegisterJotunnPiece(jotunnBuildPiece3); JotunnPiece.JotunnBuildPiece jotunnBuildPiece4 = new JotunnPiece.JotunnBuildPiece(); jotunnBuildPiece4.Name = name + " Large Wall Light"; jotunnBuildPiece4.Prefab = "CL_Large_Wall_" + name; jotunnBuildPiece4.Sprite = "CL_Large_Wall_" + name; jotunnBuildPiece4.Workbench = "forge"; jotunnBuildPiece4.Category = "Crystal Lights"; jotunnBuildPiece4.PieceCost = new List<JotunnPiece.PieceCost> { new JotunnPiece.PieceCost { prefab = "Uncut_" + name.ToLower() + "_Stone", amount = 10, refundable = true }, new JotunnPiece.PieceCost { prefab = "IronNails", amount = 2, refundable = true } }; jotunnBuildPiece4.BeforePrefabRegistered = delegate(JotunnPiece.JotunnBuildPiece jbuildpiece) { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: 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) Piece component6 = jbuildpiece.Objs.Prefab.GetComponent<Piece>(); component6.m_name = "$EJ_Large_Wall_" + name; component6.m_description = "$EJ_Large_Wall_" + name + "_Description"; ((Component)jbuildpiece.Objs.Prefab.transform).GetComponentInChildren<Light>().color = GemDefinitions[name].Color; MainModule main6 = ((Component)jbuildpiece.Objs.Prefab.transform).GetComponentInChildren<ParticleSystem>().main; ((MainModule)(ref main6)).startColor = MinMaxGradient.op_Implicit(GemDefinitions[name].Color); }; JotunnPiece.RegisterJotunnPiece(jotunnBuildPiece4); JotunnPiece.JotunnBuildPiece jotunnBuildPiece5 = new JotunnPiece.JotunnBuildPiece(); jotunnBuildPiece5.Name = name + " Pole Light"; jotunnBuildPiece5.Prefab = "CL_Pole_" + name; jotunnBuildPiece5.Sprite = "CL_Pole_" + name; jotunnBuildPiece5.Workbench = "forge"; jotunnBuildPiece5.Category = "Crystal Lights"; jotunnBuildPiece5.PieceCost = new List<JotunnPiece.PieceCost> { new JotunnPiece.PieceCost { prefab = "Uncut_" + name.ToLower() + "_Stone", amount = 5, refundable = true }, new JotunnPiece.PieceCost { prefab = "Iron", amount = 2, refundable = true } }; jotunnBuildPiece5.BeforePrefabRegistered = delegate(JotunnPiece.JotunnBuildPiece jbuildpiece) { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: 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) Piece component5 = jbuildpiece.Objs.Prefab.GetComponent<Piece>(); component5.m_name = "$EJ_Pole_" + name; component5.m_description = "$EJ_Pole_" + name + "_Description"; ((Component)jbuildpiece.Objs.Prefab.transform).GetComponentInChildren<Light>().color = GemDefinitions[name].Color; MainModule main5 = ((Component)jbuildpiece.Objs.Prefab.transform).GetComponentInChildren<ParticleSystem>().main; ((MainModule)(ref main5)).startColor = MinMaxGradient.op_Implicit(GemDefinitions[name].Color); }; JotunnPiece.RegisterJotunnPiece(jotunnBuildPiece5); JotunnPiece.JotunnBuildPiece jotunnBuildPiece6 = new JotunnPiece.JotunnBuildPiece(); jotunnBuildPiece6.Name = name + " Raw Crystal"; jotunnBuildPiece6.Prefab = "CL_Raw_" + name; jotunnBuildPiece6.Sprite = "CL_Raw_" + name; jotunnBuildPiece6.Workbench = "piece_workbench"; jotunnBuildPiece6.Category = "Crystal Lights"; jotunnBuildPiece6.PieceCost = new List<JotunnPiece.PieceCost> { new JotunnPiece.PieceCost { prefab = "Uncut_" + name.ToLower() + "_Stone", amount = 5, refundable = true } }; jotunnBuildPiece6.BeforePrefabRegistered = delegate(JotunnPiece.JotunnBuildPiece jbuildpiece) { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: 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) Piece component4 = jbuildpiece.Objs.Prefab.GetComponent<Piece>(); component4.m_name = "$EJ_Raw_" + name; component4.m_description = "$EJ_Raw_" + name + "_Description"; ((Component)jbuildpiece.Objs.Prefab.transform).GetComponentInChildren<Light>().color = GemDefinitions[name].Color; MainModule main4 = ((Component)jbuildpiece.Objs.Prefab.transform).GetComponentInChildren<ParticleSystem>().main; ((MainModule)(ref main4)).startColor = MinMaxGradient.op_Implicit(GemDefinitions[name].Color); }; JotunnPiece.RegisterJotunnPiece(jotunnBuildPiece6); JotunnPiece.JotunnBuildPiece jotunnBuildPiece7 = new JotunnPiece.JotunnBuildPiece(); jotunnBuildPiece7.Name = name + " Small Wall Light"; jotunnBuildPiece7.Prefab = "CL_Small_Wall_" + name; jotunnBuildPiece7.Sprite = "CL_Small_Wall_" + name; jotunnBuildPiece7.Workbench = "forge"; jotunnBuildPiece7.Category = "Crystal Lights"; jotunnBuildPiece7.PieceCost = new List<JotunnPiece.PieceCost> { new JotunnPiece.PieceCost { prefab = "Uncut_" + name.ToLower() + "_Stone", amount = 3, refundable = true }, new JotunnPiece.PieceCost { prefab = "IronNails", amount = 1, refundable = true } }; jotunnBuildPiece7.BeforePrefabRegistered = delegate(JotunnPiece.JotunnBuildPiece jbuildpiece) { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: 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) Piece component3 = jbuildpiece.Objs.Prefab.GetComponent<Piece>(); component3.m_name = "$EJ_Small_Wall_" + name; component3.m_description = "$EJ_Small_Wall_" + name + "_Description"; ((Component)jbuildpiece.Objs.Prefab.transform).GetComponentInChildren<Light>().color = GemDefinitions[name].Color; MainModule main3 = ((Component)jbuildpiece.Objs.Prefab.transform).GetComponentInChildren<ParticleSystem>().main; ((MainModule)(ref main3)).startColor = MinMaxGradient.op_Implicit(GemDefinitions[name].Color); }; JotunnPiece.RegisterJotunnPiece(jotunnBuildPiece7); JotunnPiece.JotunnBuildPiece jotunnBuildPiece8 = new JotunnPiece.JotunnBuildPiece(); jotunnBuildPiece8.Name = name + " Standing Lamp"; jotunnBuildPiece8.Prefab = "CL_Standing_Lamp_" + name; jotunnBuildPiece8.Sprite = "CL_Standing_Lamp_" + name; jotunnBuildPiece8.Workbench = "forge"; jotunnBuildPiece8.Category = "Crystal Lights"; jotunnBuildPiece8.PieceCost = new List<JotunnPiece.PieceCost> { new JotunnPiece.PieceCost { prefab = "Uncut_" + name.ToLower() + "_Stone", amount = 1, refundable = true }, new JotunnPiece.PieceCost { prefab = "IronNails", amount = 1, refundable = true } }; jotunnBuildPiece8.BeforePrefabRegistered = delegate(JotunnPiece.JotunnBuildPiece jbuildpiece) { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: 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) Piece component2 = jbuildpiece.Objs.Prefab.GetComponent<Piece>(); component2.m_name = "$EJ_Standing_Lamp_" + name; component2.m_description = "$EJ_Standing_Lamp_" + name + "_Description"; ((Component)jbuildpiece.Objs.Prefab.transform).GetComponentInChildren<Light>().color = GemDefinitions[name].Color; MainModule main2 = ((Component)jbuildpiece.Objs.Prefab.transform).GetComponentInChildren<ParticleSystem>().main; ((MainModule)(ref main2)).startColor = MinMaxGradient.op_Implicit(GemDefinitions[name].Color); }; JotunnPiece.RegisterJotunnPiece(jotunnBuildPiece8); JotunnPiece.JotunnBuildPiece jotunnBuildPiece9 = new JotunnPiece.JotunnBuildPiece(); jotunnBuildPiece9.Name = name + " Standing Torch"; jotunnBuildPiece9.Prefab = "CL_Standing_Torch_" + name; jotunnBuildPiece9.Sprite = "CL_Standing_Torch_" + name; jotunnBuildPiece9.Workbench = "forge"; jotunnBuildPiece9.Category = "Crystal Lights"; jotunnBuildPiece9.PieceCost = new List<JotunnPiece.PieceCost> { new JotunnPiece.PieceCost { prefab = "Uncut_" + name.ToLower() + "_Stone", amount = 1, refundable = true }, new JotunnPiece.PieceCost { prefab = "Wood", amount = 2, refundable = true } }; jotunnBuildPiece9.BeforePrefabRegistered = delegate(JotunnPiece.JotunnBuildPiece jbuildpiece) { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: 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) Piece component = jbuildpiece.Objs.Prefab.GetComponent<Piece>(); component.m_name = "$EJ_Standing_Torch_" + name; component.m_description = "$EJ_Standing_Torch_" + name + "_Description"; ((Component)jbuildpiece.Objs.Prefab.transform).GetComponentInChildren<Light>().color = GemDefinitions[name].Color; MainModule main = ((Component)jbuildpiece.Objs.Prefab.transform).GetComponentInChildren<ParticleSystem>().main; ((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(GemDefinitions[name].Color); }; JotunnPiece.RegisterJotunnPiece(jotunnBuildPiece9); } } } namespace EpicJewels.GemEffects { public static class EffectList { public enum DmgEffect { AddBluntDamage, AddPierceDamage, AddSlashDamage, AddSpiritDamage, AddLightningDamage, AddPickaxeDamage, AddChopDamage } public static void AddGemEffects() { API.AddGemEffect<BluntResistance.Config>("Blunt Resistance", "$EJ_blunt_resistance_header.", "$EJ_blunt_resistance_header $EJ_by $1%."); API.AddGemEffect<PierceResistance.Config>("Pierce Resistance", "$EJ_pierce_resistance_header.", "$EJ_pierce_resistance_header $EJ_by $1%."); API.AddGemEffect<SlashResistance.Config>("Slash Resistance", "$EJ_slash_resistance_header.", "$EJ_slash_resistance_header $EJ_by $1%."); API.AddGemEffect<FireResistance.Config>("Fire Resistance", "$EJ_fire_resistance_header.", "$EJ_fire_resistance_header $EJ_by $1%."); API.AddGemEffect<PoisonResistance.Config>("Poison Resistance", "$EJ_poison_resistance_header.", "$EJ_poison_resistance_header $EJ_by $1%."); API.AddGemEffect<LightningResistance.Config>("Lightning Resistance", "$EJ_lightning_resistance_header.", "$EJ_lightning_resistance_header $EJ_by $1%."); API.AddGemEffect<AddBluntDamage.Config>("Add Blunt Damage", "$EJ_blunt_dmg_header.", "$EJ_blunt_dmg_header $EJ_eq $1% $EJ_dmg_explained_end $EJ_dmg_tooltip"); API.AddGemEffect<AddPierceDamage.Config>("Add Pierce Damage", "$EJ_pierce_dmg_header.", "$EJ_pierce_dmg_header $EJ_eq $1% $EJ_dmg_explained_end $EJ_dmg_tooltip"); API.AddGemEffect<AddSlashDamage.Config>("Add Slash Damage", "$EJ_slash_dmg_header.", "$EJ_slash_dmg_header $EJ_eq $1% $EJ_dmg_explained_end $EJ_dmg_tooltip"); API.AddGemEffect<AddSpiritDamage.Config>("Add Spirit Damage", "$EJ_spirit_dmg_header.", "$EJ_spirit_dmg_header $EJ_eq $1% $EJ_dmg_explained_end $EJ_dmg_tooltip"); API.AddGemEffect<AddLightningDamage.Config>("Add Lightning Damage", "$EJ_lightning_dmg_header.", "$EJ_lightning_dmg_header $EJ_eq $1% $EJ_dmg_explained_end $EJ_dmg_tooltip"); API.AddGemEffect<AddPickaxeDamage.Config>("Add Pickaxe Damage", "$EJ_pickaxe_dmg_header.", "$EJ_pickaxe_dmg_header $EJ_eq $1% $EJ_dmg_explained_end"); API.AddGemEffect<AddChopDamage.Config>("Add Chop Damage", "$EJ_woodcutting_dmg_header.", "$EJ_woodcutting_dmg_header $EJ_eq $1% $EJ_dmg_explained_end"); API.AddGemEffect<Inferno.Config>("Inferno", "$EJ_inferno_header", "$2% $EJ_inferno_ep1 $1% $EJ_inferno_ep2"); API.AddGemEffect<IncreaseEitr.Config>("Increase Eitr", "$EJ_more_eitr_header", "$EJ_more_eitr_details $1."); API.AddGemEffect<IncreaseStamina.Config>("Increase Stamina", "$EJ_more_stamina_header", "$EJ_more_stamina_explained $1."); API.AddGemEffect<IncreaseStaminaRegen.Config>("Increase Stamina Regen", "$EJ_stamina_regen_header", "$EJ_stamina_regen_explained $1%."); API.AddGemEffect<BlockReduceStamina.Config>("Block Reduce Stamina", "$EJ_stamina_block_cost_header", "$EJ_stamina_block_cost_explained $1%."); API.AddGemEffect<WeaponReducedStamina.Config>("Weapon Reduced Stamina", "$EJ_stamina_weapon_cost_header", "$EJ_stamina_weapon_cost_explained $1%."); API.AddGemEffect<CoinGreed.Config>("Coin Greed", "$EJ_coingreed_header", "$EJ_coingreed_pt1 $2% $EJ_coingreed_pt2 1-$1 $EJ_coingreed_pt3"); API.AddGemEffect<CoinHoarder.Config>("Coin Hoarder", "$EJ_coinhoarder", "Increase all of your damage by a fraction of the coins you carry."); API.AddGemEffect<WaterResistant.Config>("Water Resistant", "$EJ_water_prevent", "$EJ_water_prevent_pt1 $1 $EJ_water_prevent_pt2"); API.AddGemEffect<WaterFrenzy.Config>("Water Frenzy", "$EJ_water_dmg_buff", "$EJ_dmg_buff_pt1 $1% $EJ_water_dmg_buff_pt2"); API.AddGemEffect<WaterSwiftness.Config>("Water Swiftness", "$EJ_water_speed_buff", "$EJ_speed_buff_pt1 $1% $EJ_water_speed_buff_pt2"); API.AddGemEffect<BurningViking.Config>("Burning Viking", "$EJ_fire_speed_buff", "$EJ_speed_buff_pt1 $1% $EJ_fire_speed_buff_pt2"); API.AddGemEffect<BurningFrenzy.Config>("Burning Frenzy", "$EJ_fire_dmg_buff", "$EJ_dmg_buff_pt1 $1% $EJ_fire_dmg_buff_pt2"); API.AddGemEffect<ExpertFisher.Config>("Expert Fisher", "$EJ_skill_fishing", "$EJ_skill_fishing_pt1 $1% $EJ_skill_higher $EJ_skill_inc_visible"); API.AddGemEffect<ExpertMage.Config>("Expert Mage", "$EJ_skill_magic", "$EJ_skill_magic_pt1 $1% $EJ_skill_higher $EJ_skill_inc_visible"); API.AddGemEffect<ExpertHarvester.Config>("Expert Harvester", "$EJ_skill_harvest", "$EJ_skill_harvest_pt1 $1% $EJ_skill_higher $EJ_skill_inc_visible"); API.AddGemEffect<ExpertBrawler.Config>("Expert Brawler", "$EJ_brawling", "$EJ_brawling_pt1 $1% $EJ_skill_higher $EJ_skill_inc_visible"); API.AddGemEffect<ExpertAcrobat.Config>("Expert Acrobat", "$EJ_jump", "$EJ_jump_pt1 $1% $EJ_skill_higher $EJ_skill_inc_visible"); API.AddGemEffect<ExpertDaggers.Config>("Expert Daggers", "$EJ_knives", "$EJ_knives_pt1 $1% $EJ_skill_higher $EJ_skill_inc_visible"); API.AddGemEffect<ExpertSwordsman.Config>("Expert Swordsman", "$EJ_swords", "$EJ_swords_pt1 $1% $EJ_skill_higher $EJ_skill_inc_visible"); API.AddGemEffect<ExpertSmasher.Config>("Expert Smasher", "$EJ_maces", "$EJ_maces_pt1 $1% $EJ_skill_higher $EJ_skill_inc_visible"); API.AddGemEffect<ExpertPolearms.Config>("Expert Polearms", "$EJ_polearms", "$EJ_polearms_pt1 $1% $EJ_skill_higher $EJ_skill_inc_visible"); API.AddGemEffect<ExpertSpearmaiden.Config>("Expert Spearmaiden", "$EJ_spears", "$EJ_spears_pt1 $1% $EJ_skill_higher $EJ_skill_inc_visible"); API.AddGemEffect<ExpertAxemaster.Config>("Expert Axemaster", "$EJ_axes", "$EJ_axes_pt1 $1% $EJ_skill_higher $EJ_skill_inc_visible"); API.AddGemEffect<ExpertSprinter.Config>("Expert Sprinter", "$EJ_sprinter", "$EJ_sprinter_pt1 $1% $EJ_skill_higher $EJ_skill_inc_visible"); API.AddGemEffect<ReduceWeight.Config>("Reduce Weight", "$EJ_weight_reduce", "$EJ_weight_reduce_pt1 $1% $EJ_weight_reduce_pt2"); API.AddGemEffect<CoverOfDarkness.Config>("Cover of Darkness", "$EJ_cover_darkness", "$2% $EJ_cover_darkness_pt1 $1% $EJ_cover_darkness_pt2"); API.AddGemEffect<EitrConversion.Config>("Eitr Conversion", "$EJ_eitr_conversion", "$2% $EJ_eitr_conversion_pt1 $1% $EJ_eitr_conversion_pt2"); API.AddGemEffect<Retribution.Config>("Retribution", "$EJ_retribution", "$2% $EJ_retribution_pt1 $1% $EJ_retribution_pt2"); API.AddGemEffect<StaggeringBlock.Config>("Staggering Block", "Blocking can stagger attackers.", "$1% chance to stagger your attacker."); API.AddGemEffect<FlamingGuard.Config>("Burning Guard", "On block chance to return fire damage.", "$1% chance to set your attacker on fire for $2% of the blocked damage."); API.AddGemEffect<FreezingGuard.Config>("Freezing Guard", "On block chance to return frost damage.", "$1% chance to return frost damage for $2% of the blocked damage."); API.AddGemEffect<WetWorker.Config>("Wet Worker", "Reduces stamina usage when wet.", "$1% usage stamina cost reduction when wet."); API.AddGemEffect<EitrFused.Config>("Eitr Fused", "Uses eitr to increase damage.", "$1% increase to damage at the cost of $2 eitr per hit."); API.AddGemEffect<Farmer.Config>("Farmer", "Chance for bigger harvests.", "$2% chance to get $1 additional crops when harvesting."); API.AddGemEffect<Toxifier.Config>("Toxifier", "Gain adrenaline from poison damage around you.", "Gain $1 adrenaline whenever poison damage is applied within $2m."); API.AddGemEffect<AdrenalRewire.Config>("Adrenal Rewire", "Gain adrenaline from damage taken.", "Gain a small amount of adrenaline for each point of damage taken."); API.AddGemEffect<SoakedFury.Config>("Soaked Fury", "Gain additional adrenaline while wet.", "Gain $1% more adrenaline while you are wet."); API.AddGemEffect<BurningAdrenaline.Config>("Burning Adrenaline", "Gain additional adreanline while on fire.", "Gain $1% more adrenaline while you are on fire."); API.AddGemEffect<HarvestAdrenaline.Config>("Harvest Adrenaline", "Chance to gain adrenaline from harvesting.", "$2% Chance to gain $1% of damage done as adrenaline."); API.AddGemEffect<EitrFeedback.Config>("Eitr Feedback", "Chance to restore adrenaline from eitr use.", "$2% Chance to restore $1 adrenaline when consuming eitr."); API.AddGemEffect<CombatSpirit.Config>("Combat Spirit", "A spirit helps you in combat.", "A spirit aids you in combat for $1 seconds. Returns after a cooldown."); API.AddGemEffect<IntenseFire.Config>("Intense Fire", "An affinity for fire.", "You are +$1% fire resistant and have a higher chance to trigger Inferno."); API.AddGemEffect<SlipperyWhenWet.Config>("Slippery When Wet", "Water quickens you.", "You are $1% faster when wet."); API.AddGemEffect<SlipperyWhenWet.Config>("Waterproof", "You do not get wet.", "You do not get wet."); API.AddGemEffect<WeaponMaster.Config>("Weapon Master", "Experianced with weapons.", "Your skill with all weapons is $1% higher."); API.AddGemEffect<Spellsword.Config>("Spellsword", "Use eitr to increase weapon damage.", "$1% increase to damage at the cost of 5 eitr per hit."); } } public static class AddBluntDamage { [PublicAPI] public struct Config { [AdditivePower] public float Power; [AdditivePower] public float Chance; } } public static class AddChopDamage { [PublicAPI] public struct Config { [AdditivePower] public float Power; [AdditivePower] public float Chance; } } public static class AddLightningDamage { [PublicAPI] public struct Config { [AdditivePower] public float Power; [AdditivePower] public float Chance; } } internal class AddPickaxeDamage { [PublicAPI] public struct Config { [AdditivePower] public float Power; [AdditivePower] public float Chance; } } public static class AddPierceDamage { [PublicAPI] public struct Config { [AdditivePower] public float Power; [AdditivePower] public float Chance; } } public static class AddSlashDamage { [PublicAPI] public struct Config { [AdditivePower] public float Power; [AdditivePower] public float Chance; } } public static class AddSpiritDamage { [PublicAPI] public struct Config { [AdditivePower] public float Power; [AdditivePower] public float Chance; } } internal class AdrenalRewire { [PublicAPI] public struct Config { [InverseMultiplicativePercentagePower] public float Power; [InverseMultiplicativePercentagePower] public float Chance; } [HarmonyPatch(typeof(Character), "RPC_Damage")] public static class DamageTakenProvidesStamina { public static void Postfix(Character __instance, HitData hit) { //IL_0068: Unknown result type (might be due to invalid IL or missing references) if (!__instance.IsPlayer()) { return; } Player player = (Player)(object)((__instance is Player) ? __instance : null); float chance = player.GetEffectPower<Config>("Adrenal Rewire").Chance; if (!(Random.Range(0f, 100f) > chance)) { float power = player.GetEffectPower<Config>("Adrenal Rewire").Power; if (power > 0f) { float totalDamageOptions = hit.m_damage.GetTotalDamageOptions(); float num = totalDamageOptions * (power / (100f + __instance.GetMaxAdrenaline())); EJLogger.LogDebug($"Adrenal Rewire is restoring {num} stamina based on total damage of {totalDamageOptions} and power of {power}"); __instance.AddAdrenaline(num); } } } } } public static class BlockReduceStamina { [PublicAPI] public struct Config { [AdditivePower] public float Power; } [HarmonyPatch(typeof(Humanoid), "BlockAttack")] public static class ModifyBlockStaminaUse_Humanoid_BlockAttack_Patch { public static void Prefix(Humanoid __instance, HitData hit, Character attacker) { if (((Character)__instance).IsPlayer()) { Player player = (Player)(object)((__instance is Player) ? __instance : null); if (player.GetEffectPower<Config>("Block Reduce Stamina").Power > 0f) { float num = 100f / (100f + player.GetEffectPower<Config>("Block Reduce Stamina").Power); __instance.m_blockStaminaDrain *= num; } } } } } public static class BluntResistance { [PublicAPI] public struct Config { [InverseMultiplicativePercentagePower] public float Power; } [HarmonyPatch(typeof(Character), "RPC_Damage")] public static class ReduceBluntDamageTaken { [UsedImplicitly] private static void Prefix(Character __instance, HitData hit) { Player val = (Player)(object)((__instance is Player) ? __instance : null); if (val != null) { Character attacker = hit.GetAttacker(); if (attacker != null && (Object)(object)attacker != (Object)(object)__instance && hit.m_damage.m_blunt > 0f && val.GetEffectPower<Config>("Blunt Resistance").Power > 0f) { float num = (100f - val.GetEffectPower<Config>("Blunt Resistance").Power) / 100f; hit.m_damage.m_slash *= num; } } } } } internal class BurningAdrenaline { [PublicAPI] public struct Config { [MultiplicativePercentagePower] public float Power; } [HarmonyPatch(typeof(Player), "AddAdrenaline")] public static class ReducePoisonDamageTaken { private static readonly int Wetstatus = StringExtensionMethods.GetStableHashCode("Burning"); [UsedImplicitly] private static void Prefix(Player __instance, ref float v) { float power = __instance.GetEffectPower<Config>("Burning Adrenaline").Power; if (power > 0f && ((Character)__instance).GetSEMan().HaveStatusEffect(Wetstatus)) { float num = (power + 100f) / 100f; EJLogger.LogDebug($"Burning Adrenaline is increasing adrenaline gain by {num}"); v *= num; } } } } public static class BurningFrenzy { [PublicAPI] public struct Config { [AdditivePower] public float Power; } [HarmonyPatch(typeof(Character), "Damage")] private class AddBonusBonusDamageWhileOnFire { private static void Prefix(HitData hit) { if (hit.GetAttacker() is Player) { Character attacker = hit.GetAttacker(); Player val = (Player)(object)((attacker is Player) ? attacker : null); if (((Character)val).GetSEMan().HaveStatusEffect(burningstatus)) { float num = (100f + val.GetEffectPower<Config>("Burning Frenzy").Power) / 100f; hit.m_damage.m_blunt *= num; hit.m_damage.m_pierce *= num; hit.m_damage.m_pierce *= num; hit.m_damage.m_fire *= num; hit.m_damage.m_lightning *= num; hit.m_damage.m_frost *= num; hit.m_damage.m_spirit *= num; hit.m_damage.m_poison *= num; hit.m_damage.m_pickaxe *= num; } } } } private static int burningstatus = StringExtensionMethods.GetStableHashCode("Burning"); } public static class BurningViking { [PublicAPI] public struct Config { [InverseMultiplicativePercentagePower] public float Power; } [HarmonyPatch(typeof(Player), "GetJogSpeedFactor")] private class IncreaseJogSpeed { private static void Postfix(Player __instance, ref float __result) { if (((Character)__instance).GetSEMan().HaveStatusEffect(burningstatus) && __instance.GetEffectPower<Config>("Burning Viking").Power > 0f) { __result *= (__instance.GetEffectPower<Config>("Burning Viking").Power + 100f) / 100f; } } } [HarmonyPatch(typeof(Player), "GetRunSpeedFactor")] private class IncreaseRunSpeed { private static void Postfix(Player __instance, ref float __result) { if (((Character)__instance).GetSEMan().HaveStatusEffect(burningstatus) && __instance.GetEffectPower<Config>("Burning Viking").Power > 0f) { __result *= (__instance.GetEffectPower<Config>("Burning Viking").Power + 100f) / 100f; } } } private static int burningstatus = StringExtensionMethods.GetStableHashCode("Burning"); } public static class CoinGreed { [PublicAPI] public struct Config { [AdditivePower] public float Power; [InverseMultiplicativePercentagePower] public float Chance; } [HarmonyPatch(typeof(Character), "OnDeath")] public static class AddGreedOnDeathFromPlayer { [UsedImplicitly] private static void Postfix(Character __instance) { //IL_00b6: 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 (__instance.m_lastHit == null) { return; } Character attacker = __instance.m_lastHit.GetAttacker(); Player val = (Player)(object)((attacker is Player) ? attacker : null); if ((Object)(object)val == (Object)null) { return; } float power = val.GetEffectPower<Config>("Coin Greed").Power; if (power > 0f) { float num = val.GetEffectPower<Config>("Coin Greed").Chance / 100f; float value = Random.value; if (value < num) { float num2 = Random.Range(1f, Math.Max(1f, power)); GameObject val2 = Object.Instantiate<GameObject>(ObjectDB.instance.GetItemPrefab("Coins"), ((Component)__instance).gameObject.transform.position, ((Component)__instance).gameObject.transform.rotation); val2.GetComponent<ItemDrop>().m_itemData.m_stack = (int)num2; } } } } } internal static class CoinHoarder { [PublicAPI] public struct Config { [InverseMultiplicativePercentagePower] public float Power; } [HarmonyPatch(typeof(Character), "Damage")] internal static class IncreaseAllDamageByCoins { internal static void Prefix(HitData hit) { Character attacker = hit.GetAttacker(); Player val = (Player)(object)((attacker is Player) ? attacker : null); if (val != null) { Character attacker2 = hit.GetAttacker(); Player val2 = (Player)(object)((attacker2 is Player) ? attacker2 : null); if ((Object)(object)val2 != (Object)null && val2.GetEffectPower<Config>("Coin Hoarder").Power > 0f) { float num = CoinHoarderBonusCalc(val2); hit.m_damage.m_blunt *= num; hit.m_damage.m_pierce *= num; hit.m_damage.m_slash *= num; hit.m_damage.m_fire *= num; hit.m_damage.m_lightning *= num; hit.m_damage.m_frost *= num; hit.m_damage.m_spirit *= num; hit.m_damage.m_poison *= num; hit.m_damage.m_pickaxe *= num; } } } } internal static float CoinHoarderBonusCalc(Player player) { ItemData[] array = (from val in ((Humanoid)player).m_inventory.GetAllItems() where ((Object)val.m_dropPrefab).name == "Coins" select val).ToArray(); if (array.Length == 0) { return 1f; } float num = 0f; ItemData[] array2 = array; foreach (ItemData val2 in array2) { num += (float)val2.m_stack; } float power = player.GetEffectPower<Config>("Coin Hoarder").Power; float num2 = (float)Math.Log10(power * num); return num2 * 5.5f / 100f + 1f; } } public static class CombatSpirit { [PublicAPI] public struct Config { [AdditivePower] public float Power; } [HarmonyPatch(typeof(Player), "OnTargeted")] public static class CombatCompanion { private static void Postfix(Player __instance, bool sensed, bool alerted) { //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) if (!(__instance.GetEffectPower<Config>("Combat Spirit").Power > 0f && sensed && alerted)) { return; } if ((Object)(object)wolf == (Object)null && !have_spirit_companion) { ZNetScene.instance.m_namedPrefabs.TryGetValue(StringExtensionMethods.GetStableHashCode("Wolf"), out var value); Quaternion val = Quaternion.Euler(0f, Random.Range(0f, 360f), 0f); Vector3 position = ((Component)__instance).gameObject.transform.position; position.x += 1f; wolf = Object.Instantiate<GameObject>(value, position, val); cooldown_timer = 120f; have_spirit_companion = true; wolf.AddComponent<CharacterTimedDestruction>(); Character component = wolf.GetComponent<Character>(); wolf.GetComponent<CharacterTimedDestruction>().m_character = component; wolf.GetComponent<CharacterTimedDestruction>().Trigger(__instance.GetEffectPower<Config>("Combat Spirit").Power); SkinnedMeshRenderer componentInChildren = wolf.GetComponentInChildren<SkinnedMeshRenderer>(); ((Renderer)componentInChildren).material = EpicJewels.spiritCreature; Object.Destroy((Object)(object)wolf.GetComponent<CharacterDrop>()); Object.Destroy((Object)(object)wolf.GetComponent<Tameable>()); Humanoid component2 = wolf.GetComponent<Humanoid>(); Character component3 = wolf.GetComponent<Character>(); MonsterAI component4 = wolf.GetComponent<MonsterAI>(); component4.m_attackPlayerObjects = false; ((Character)component2).m_health = 1000f; ((Character)component2).m_deathEffects.m_effectPrefabs[1].m_enabled = false; ((Character)component2).m_deathEffects.m_effectPrefabs[0].m_enabled = false; ((Object)component2).name = "EJ_spirit_wolf"; if ((Object)(object)component2 != (Object)null) { ((Character)component2).m_faction = (Faction)0; } ((Object)wolf).name = "Spirit Wolf"; } float deltaTime = Time.deltaTime; if (cooldown_timer > 0f) { if (deltaTime > cooldown_timer * 60f) { cooldown_timer = 0f; } cooldown_timer -= deltaTime; if (cooldown_timer < 0f) { cooldown_timer = 0f; } } else if (recheck_spirit_spawn_timer > 3f) { recheck_spirit_spawn_timer = 0f; if (Character.s_characters.Any((Character c) => Vector3.Distance(((Component)__instance).gameObject.transform.position, ((Component)c).transform.position) < 100f && ((Object)c).name == "Spirit Wolf")) { have_spirit_companion = true; } else { have_spirit_companion = false; } } else { recheck_spirit_spawn_timer += Time.deltaTime; } } } private static GameObject wolf = null; private static bool have_spirit_companion = false; private static float recheck_spirit_spawn_timer = 0f; private static float cooldown_timer = 5f; } public static class CoverOfDarkness { [PublicAPI] public struct Config { [InverseMultiplicativePercentagePower] public float Power; [InverseMultiplicativePercentagePower] public float Chance; [AdditivePower] public float MaxCount; } [HarmonyPatch(typeof(Character), "Damage")] public static class SummonBatHelpers { private static void Prefix(HitData hit) { //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) if (!(hit.GetAttacker() is Player)) { return; } Character attacker = hit.GetAttacker(); Player player = (Player)(object)((attacker is Player) ? attacker : null); if (!(player.GetEffectPower<Config>("Cover of Darkness").Power > 0f) || !(Random.value < player.GetEffectPower<Config>("Cover of Darkness").Chance / 100f)) { return; } int stars = 1; float power = player.GetEffectPower<Config>("Cover of Darkness").Power; float num = power; if (num > 70f) { stars = 4; } else { float num2 = num; if (num2 > 50f) { stars = 3; } else { float num3 = num; if (num3 > 30f) { stars = 2; } } } if ((float)spawnedBats.Count >= player.GetEffectPower<Config>("Cover of Darkness").MaxCount) { List<ZDOID> list = new List<ZDOID>(); foreach (ZDOID spawnedBat in spawnedBats) { GameObject val = ZNetScene.instance.FindInstance(spawnedBat); if ((Object)(object)val != (Object)null && !list.Contains(spawnedBat)) { list.Add(spawnedBat); } } spawnedBats = list; if ((float)spawnedBats.Count >= player.GetEffectPower<Config>("Cover of Darkness").MaxCount) { return; } } if (player.GetEffectPower<Config>("Cover of Darkness").Power > 90f) { SpawnBat(player, stars); SpawnBat(player, stars); } else { SpawnBat(player, stars); } } } public static List<ZDOID> spawnedBats = new List<ZDOID>(); private static GameObject bat = null; private static void SpawnBat(Player player, int stars = 1) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)bat == (Object)null) { ZNetScene.instance.m_namedPrefabs.TryGetValue(StringExtensionMethods.GetStableHashCode("Bat"), out bat); } Quaternion val = Quaternion.Euler(0f, Random.Range(0f, 360f), 0f); Vector3 position = ((Component)player).gameObject.transform.position; position.y += 1f; GameObject val2 = Object.Instantiate<GameObject>(bat, position, val); Character component = val2.GetComponent<Character>(); ZNetView component2 = val2.GetComponent<ZNetView>(); component2.m_persistent = true; component.m_level = stars; Object.Destroy((Object)(object)val2.GetComponent<CharacterDrop>()); MonsterAI component3 = val2.GetComponent<MonsterAI>(); if ((Object)(object)component3 != (Object)null) { if ((Object)(object)val2.GetComponent<Tameable>() == (Object)null) { Tameable val3 = val2.AddComponent<Tameable>(); } component3.MakeTame(); } else { Object.Destroy((Object)(object)val2); } val2.AddComponent<CharacterTimedDestruction>(); val2.GetComponent<CharacterTimedDestruction>().m_character = component; val2.GetComponent<CharacterTimedDestruction>().Trigger(player.GetEffectPower<Config>("Cover of Darkness").Power); spawnedBats.Add(component.GetZDOID()); } } public static class EitrConversion { [PublicAPI] public struct Config { [AdditivePower] public float Power; [InverseMultiplicativePercentagePower] public float Chance; } [HarmonyPatch(typeof(Humanoid), "BlockAttack")] private static class HealOnParry { private static void Postfix(Humanoid __instance, ref bool __result) { Player val = (Player)(object)((__instance is Player) ? __instance : null); if (val != null && val.GetEffectPower<Config>("Eitr Conversion").Power > 0f) { float value = Random.value; float num = val.GetEffectPower<Config>("Eitr Conversion").Chance / 100f; if (value < num) { ((Character)val).AddEitr(((Character)val).GetMaxEitr() * (val.GetEffectPower<Config>("Eitr Conversion").Power / 100f)); } } } } } internal class EitrFeedback { [PublicAPI] public struct Config { [InverseMultiplicativePercentagePower] public float Power; [InverseMultiplicativePercentagePower] public float Chance; } [HarmonyPatch(typeof(Player), "RPC_UseEitr")] public static class ReducePierceDamageTaken { [UsedImplicitly] private static void Prefix(Player __instance, float v) { if (!(__instance.m_eitr <= 0f)) { float chance = __instance.GetEffectPower<Config>("Eitr Feedback").Chance; if (chance > 0f && Random.Range(0f, 100f) <= chance) { float power = __instance.GetEffectPower<Config>("Eitr Feedback").Power; EJLogger.LogDebug($"Eitr Feedback restoring {power} adrenaline from eitr use."); ((Character)__instance).AddAdrenaline(power); } } } } } public static class EitrFused { [PublicAPI] public struct Config { [InverseMultiplicativePercentagePower] public float Power; [AdditivePower] public float Cost; } } public static class ExpertAcrobat { [PublicAPI] public struct Config { [InverseMultiplicativePercentagePower] public float Power; } } public static class ExpertAxemaster { [PublicAPI] public struct Config { [InverseMultiplicativePercentagePower] public float Power; } } public static class ExpertBrawler { [PublicAPI] public struct Config { [InverseMultiplicativePercentagePower] public float Power; } } public static class ExpertDaggers { [PublicAPI] public struct Config { [InverseMultiplicativePercentagePower] public float Power; } } public static class ExpertFisher { [PublicAPI] public struct Config { [InverseMultiplicativePercentagePower] public float Power; } } public static class ExpertHarvester { [PublicAPI] public struct Config { [InverseMultiplicativePercentagePower] public float Power; } } public static class ExpertMage { [PublicAPI] public struct Config { [InverseMultiplicativePercentagePower] public float Power; } } public static class ExpertPolearms { [PublicAPI] public struct Config { [InverseMultiplicativePercentagePower] public float Power; } } public static class ExpertSmasher { [PublicAPI] public struct Config { [InverseMultiplicativePercentagePower] public float Power; } } public static class ExpertSpearmaiden { [PublicAPI] public struct Config { [InverseMultiplicativePercentagePower] public float Power; } } public static class ExpertSprinter { [PublicAPI] public struct Config { [InverseMultiplicativePercentagePower] public float Power; } } public static class ExpertSwordsman { [PublicAPI] public struct Config { [InverseMultiplicativePercentagePower] public float Power; } } public static class Farmer { [PublicAPI] public struct Config { [AdditivePower] public float Power; [AdditivePower] public float Chance; [AdditivePower] public float Pickup; } [HarmonyPatch(typeof(Pickable), "Interact")] public static class IncreaseCarryWeight { public static void Postfix(ref bool __result, Humanoid character, Pickable __instance) { if (!__result || !((Object)(object)character != (Object)null)) { return; } Player val = (Player)(object)((character is Player) ? character : null); if (val == null || !(val.GetEffectPower<Config>("Farmer").Power > 0f)) { return; } string item = ((Object)__instance.m_itemPrefab).name.Replace("(Clone)", "").Replace("Pickable_", ""); if (UnallowedGreenThumbPickables.Contains(item)) { return; } float value = Random.value; float num = val.GetEffectPower<Config>("Farmer").Chance / 100f; if (value < num) { int num2 = 0; for (int i = 0; (float)i < val.GetEffectPower<Config>("Farmer").Power; i++) { __instance.Drop(__instance.m_itemPrefab, num2++, 1); } } } } [HarmonyPatch(typeof(Player), "Update")] public static class AutoPickupNearby_Pickables { private static readonly int pickableMask = LayerMask.GetMask(new string[3] { "piece_nonsolid", "item", "Default_small" }); private static float fdt = Time.fixedDeltaTime; private static float last_update = 0f; private static float current_tick_time = 0f; public static void Postfix(Player __instance) { //IL_006d: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)__instance != (Object)null) || !(__instance.GetEffectPower<Config>("Farmer").Pickup > 0f)) { return; } current_tick_time += fdt; if (!(current_tick_time > last_update + 0.5f)) { return; } last_update = current_tick_time; Collider[] array = Physics.OverlapSphere(((Component)__instance).transform.position, 2f + __instance.GetEffectPower<Config>("Farmer").Pickup, pickableMask); foreach (Collider val in array) { Pickable val2 = ((Component)val).GetComponent<Pickable>() ?? ((Component)val).GetComponentInParent<Pickable>(); if ((Object)(object)val2 != (Object)null) { string item = ((Object)val2).name.Replace("(Clone)", "").Replace("Pickable_", ""); if (!UnallowedGreenThumbPickables.Contains(item) && val2.CanBePicked()) { val2.Interact((Humanoid)(object)__instance, false, false); } } } } } private static List<string> UnallowedGreenThumbPickables = new List<string> { "SurtlingCore", "Flint", "Wood", "Stone", "Amber", "AmberPearl", "Coins", "Ruby", "CryptRemains", "Obsidian", "Crystal", "Pot_Shard", "DragonEgg", "DvergrLantern", "DvergrMineTreasure", "SulfurRock", "VoltureEgg", "Swordpiece", "MoltenCore", "Hairstrands", "Tar", "BlackCore" }; } public static class FireResistance { [PublicAPI] public struct Config { [InverseMultiplicativePercentagePower] public float Power; } [HarmonyPatch(typeof(Character), "RPC_Damage")] public static class ReducePierceDamageTaken { [UsedImplicitly] private static void Prefix(Character __instance, HitData hit) { Player val = (Player)(object)((__instance is Player) ? __instance : null); if (val != null) { Character attacker = hit.GetAttacker(); if (attacker != null && (Object)(object)attacker != (Object)(object)__instance && hit.m_damage.m_fire > 0f && (val.GetEffectPower<Config>("Fire Resistance").Power > 0f || val.GetEffectPower<Config>("Intense Fire").Power > 0f)) { float num = (100f - (val.GetEffectPower<Config>("Fire Resistance").Power + val.GetEffectPower<Config>("Intense Fire").Power)) / 100f; hit.m_damage.m_fire *= num; } } } } } public static class FlamingGuard { [PublicAPI] public struct Config { [AdditivePower] public float Power; [AdditivePower] public float Chance; } [HarmonyPriority(600)] [HarmonyPatch(typeof(Humanoid), "BlockAttack")] private static class FlamingBlock_Patch { private static HitData originalHit = null; private static int burningstatus = StringExtensionMethods.GetStableHashCode("Burning"); private static void Prefix(HitData hit) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown originalHit = new HitData(hit.GetTotalDamage()); } private static void Postfix(Humanoid __instance, HitData hit, Character attacker, ref bool __result) { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) Player val = (Player)(object)((__instance is Player) ? __instance : null); if (val != null && val.GetEffectPower<Config>("Burning Guard").Chance > 0f && __result && !attacker.IsDead()) { float value = Random.value; float num = val.GetEffectPower<Config>("Burning Guard").Chance / 100f; if (value < num) { HitData val2 = new HitData(); val2.m_damage.m_fire = val.GetEffectPower<Config>("Burning Guard").Power / 100f * ((DamageTypes)(ref originalHit.m_damage)).GetTotalDamage(); val2.m_attacker = ((Character)val).GetZDOID(); val2.m_point = hit.m_point + new Vector3(0f, 0.5f); attacker.Damage(val2); attacker.m_seman.AddStatusEffect(burningstatus, true, 1, val.m_skills.GetSkill((SkillType)6).m_level); } } } } } internal class FreezingGuard { [PublicAPI] public struct Config { [AdditivePower] public float Power; [AdditivePower] public float Chance; } [HarmonyPriority(600)] [HarmonyPatch(typeof(Humanoid), "BlockAttack")] private static class FreezingBlock_Patch { private static HitData originalHit = null; private static int froststatus = StringExtensionMethods.GetStableHashCode("Frost"); private static void Prefix(HitData hit) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown originalHit = new HitData(hit.GetTotalDamage()); } private static void Postfix(Humanoid __instance, HitData hit, Character attacker, ref bool __result) { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) Player val = (Player)(object)((__instance is Player) ? __instance : null); if (val != null && val.GetEffectPower<Config>("Freezing Guard").Chance > 0f && __result && !attacker.IsDead()) { float value = Random.value; float num = val.GetEffectPower<Config>("Freezing Guard").Chance / 100f; if (value < num) { HitData val2 = new HitData(); val2.m_damage.m_frost = val.GetEffectPower<Config>("Freezing Guard").Power / 100f * ((DamageTypes)(ref originalHit.m_damage)).GetTotalDamage(); val2.m_attacker = ((Character)val).GetZDOID(); val2.m_point = hit.m_point + new Vector3(0f, 0.5f); attacker.Damage(val2); attacker.m_seman.AddStatusEffect(froststatus, true, 3, val.m_skills.GetSkill((SkillType)6).m_level); } } } } } internal class HarvestAdrenaline { [PublicAPI] public struct Config { [InverseMultiplicativePercentagePower] public float Power; [InverseMultiplicativePercentagePower] public float Chance; } [HarmonyPatch(typeof(Destructible), "RPC_Damage")] public static class AdrenalineFromDestructibles { public static void Postfix(HitData hit) { AddadrenalineForHarvest(hit); } } [HarmonyPatch(typeof(MineRock), "RPC_Hit")] public static class AdrenalineFromMineRocks { public static void Postfix(HitData hit) { AddadrenalineForHarvest(hit); } } [HarmonyPatch(typeof(MineRock5), "RPC_Damage")] public static class AdrenalineFromMineRocks5 { public static void Postfix(HitData hit) { AddadrenalineForHarvest(hit); } } [HarmonyPatch(typeof(TreeBase), "RPC_Damage")] public static class AdrenalineFromTreeBase { public static void Postfix(HitData hit) { AddadrenalineForHarvest(hit); } } [HarmonyPatch(typeof(TreeLog), "RPC_Damage")] public static class AdrenalineFromTreeLog { public static void Postfix(HitData hit) { AddadrenalineForHarvest(hit); } } public static void AddadrenalineForHarvest(HitData hit) { //IL_0076: Unknown result type (might be due to invalid IL or missing references) if ((hit.m_damage.m_chop > 0f || hit.m_damage.m_pickaxe > 0f) && hit.GetAttacker() is Player) { float num = Random.Range(0f, 100f); Character attacker = hit.GetAttacker(); Player val = (Player)(object)((attacker is Player) ? attacker : null); if (num <= val.GetEffectPower<Config>("Harvest Adrenaline").Chance) { float totalDamageOptions = hit.m_damage.GetTotalDamageOptions(include_poison: false, include_spirit: false, include_pickaxe_and_chop: true); float power = val.GetEffectPower<Config>("Harvest Adrenaline").Power; float num2 = totalDamageOptions * (power / 100f); EJLogger.LogDebug($"Harvest Adrenaline is restoring {num2} adrenaline based on total damage of {totalDamageOptions} and power of {power}"); ((Character)val).AddAdrenaline(num2); } } } } public static class IncreaseEitr { [PublicAPI] public struct Config { [AdditivePower] public float Power; } [HarmonyPatch(typeof(Player), "GetTotalFoodValue")] public static class IncreaseTotalStamina { public static void Postfix(Player __instance, ref float eitr) { eitr += __instance.GetEffectPower<Config>("Increase Eitr").Power; } } } public static class IncreaseStamina { [PublicAPI] public struct Config { [AdditivePower] public float Power; } [HarmonyPatch(typeof(Player), "GetTotalFoodValue")] public static class IncreaseTotalStamina { public static void Postfix(Player __instance, ref float stamina) { stamina += __instance.GetEffectPower<Config>("Increase Stamina").Power; } } } public static class IncreaseStaminaRegen { [PublicAPI] public struct Config { [InverseMultiplicativePercentagePower] public float Power; } [HarmonyPatch(typeof(SEMan), "ModifyStaminaRegen")] public static class IncreasePlayerStaminaRegen { public static void Postfix(SEMan __instance, ref float staminaMultiplier) { Character character = __instance.m_character; Player val = (Player)(object)((character is Player) ? character : null); if (val != null && (Object)(object)val != (Object)null && val.GetEffectPower<Config>("Increase Stamina Regen").Power > 0f) { float num = (val.GetEffectPower<Config>("Increase Stamina Regen").Power + 100f) / 100f; staminaMultiplier *= num; } } } } public static class Inferno { [PublicAPI] public struct Config { [MultiplicativePercentagePower] public float Power; [MultiplicativePercentagePower] public float Chance; } } public static class IntenseFire { [PublicAPI] public struct Config { [AdditivePower] public float Power; } } public static class LightningResistance { [PublicAPI] public struct Config { [InverseMultiplicativePercentagePower] public float Power; } [HarmonyPatch(typeof(Character), "RPC_Damage")] public static class ReducePierceDamageTaken { [UsedImplicitly] private static void Prefix(Character __instance, HitData hit) { Player val = (Player)(object)((__instance is Player) ? __instance : null); if (val != null) { Character attacker = hit.GetAttacker(); if (attacker != null && (Object)(object)attacker != (Object)(object)__instance && hit.m_damage.m_lightning > 0f && val.GetEffectPower<Config>("Lightning Resistance").Power > 0f) { float num = (100f - val.GetEffectPower<Config>("Lightning Resistance").Power) / 100f; hit.m_damage.m_lightning *= num; } } } } } public static class PierceResistance { [PublicAPI] public struct Config { [InverseMultiplicativePercentagePower] public float Power; } [HarmonyPatch(typeof(Character), "RPC_Damage")] public static class ReducePierceDamageTaken { [UsedImplicitly] private static void Prefix(Character __instance, HitData hit) { Player val = (Player)(object)((__instance is Player) ? __instance : null); if (val != null) { Character attacker = hit.GetAttacker(); if (attacker != null && (Object)(object)attacker != (Object)(object)__instance && hit.m_damage.m_pierce > 0f && val.GetEffectPower<Config>("Pierce Resistance").Power > 0f) { float num = (100f - val.GetEffectPower<Config>("Pierce Resistance").Power) / 100f; hit.m_damage.m_pierce *= num; } } } } } public static class PoisonResistance { [PublicAPI] public struct Config { [InverseMultiplicativePercentagePower] public float Power; } [HarmonyPatch(typeof(Character), "RPC_Damage")] public static class ReducePoisonDamageTaken { [UsedImplicitly] private static void Prefix(Character __instance, HitData hit) { Player val = (Player)(object)((__instance is Player) ? __instance : null); if (val != null) { Character attacker = hit.GetAttacker(); if (attacker != null && (Object)(object)attacker != (Object)(object)__instance && hit.m_damage.m_poison > 0f && val.GetEffectPower<Config>("Poison Resistance").Power > 0f) { float num = (100f - val.GetEffectPower<Config>("Poison Resistance").Power) / 100f; hit.m_damage.m_poison *= num; } } } } } public static class PracticedGemcutter { [PublicAPI] public struct Config { [InverseMultiplicativePercentagePower] public float Power; } [UsedImplicitly] private static void Postfix(Skills __instance, SkillType skillType, ref float __result) { if (!(((object)(SkillType)(ref skillType)).ToString() != "gemcutting") && !((Object)(object)Player.m_localPlayer == (Object)null)) { __result += Mathf.RoundToInt(Player.m_localPlayer.GetEffectPower<Config>("PracticedGemcutter").Power); } } } public static class ReduceWeight { [PublicAPI] public struct Config { [InverseMultiplicativePercentagePower] public float Power; } [HarmonyPatch(typeof(ItemData), "GetWeight")] public static class ReduceWeight_ItemData_GetWeight_Patch { public static void Postfix(ref float __result) { __result = ReduceWeightByPower(__result); } } [HarmonyPatch(typeof(ItemData), "GetNonStackedWeight")] public static class ReduceWeight_ItemData_GetNonstackedWeight_Patch { public static void Postfix(ref float __result) { __result = ReduceWeightByPower(__result); } } public static float ReduceWeightByPower(float original) { if ((Object)(object)Player.m_localPlayer == (Object)null) { return original; } if (Player.m_localPlayer.GetEffectPower<Config>("Reduce Weight").Power > 0f) { float num = 100f / (Player.m_localPlayer.GetEffectPower<Config>("Reduce Weight").Power + 100f); original *= num; } return original; } } public static class Retribution { [PublicAPI] public struct Config { [AdditivePower] public float Power; [InverseMultiplicativePercentagePower] public float Chance; } [HarmonyPatch(typeof(Humanoid), "BlockAttack")] private static class Retribution_Patch { private static HitData originalHit; private static void Prefix(HitData hit) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown originalHit = new HitData(hit.GetTotalDamage()); } private static void Postfix(Humanoid __instance, HitData hit, Character attacker, ref bool __result) { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) Player val = (Player)(object)((__instance is Player) ? __instance : null); if (val != null && val.GetEffectPower<Config>("Retribution").Power > 0f && __result && !attacker.IsDead()) { float value = Random.value; float num = val.GetEffectPower<Config>("Retribution").Chance / 100f; if (value < num) { HitData val2 = new HitData(); float totalDamage = originalHit.GetTotalDamage(); val2.m_damage.m_damage = totalDamage * (val.GetEffectPower<Config>("Retribution").Power / 100f); val2.m_attacker = ((Character)val).GetZDOID(); val2.m_point = hit.m_point + new Vector3(0f, 0.5f); attacker.Damage(val2); } } } } } public static class SlashResistance { [PublicAPI] public struct Config { [InverseMultiplicativePercentagePower] public float Power; } [HarmonyPatch(typeof(Character), "RPC_Damage")] public static class ReduceSlashDamageTaken { [UsedImplicitly] private static void Prefix(Character __instance, HitData hit) { Player val = (Player)(object)((__instance is Player) ? __instance : null); if (val != null) { Character attacker = hit.GetAttacker(); if (attacker != null && (Object)(object)attacker != (Object)(object)__instance && hit.m_damage.m_slash > 0f && val.GetEffectPower<Config>("Slash Resistance").Power > 0f) { float num = (100f - val.GetEffectPower<Config>("Slash Resistance").Power) / 100f; hit.m_damage.m_slash *= num; } } } } } public static class SlipperyWhenWet { [PublicAPI] public struct Config { [AdditivePower] public float Power; } } internal class SoakedFury { [PublicAPI] public struct Config { [MultiplicativePercentagePower] public float Power; } [HarmonyPatch(typeof(Player), "AddAdrenaline")] public static class ReducePoisonDamageTaken { private static readonly int Wetstatus = StringExtensionMethods.GetStableHashCode("Wet"); [UsedImplicitly] private static void Prefix(Player __instance, ref float v) { float power = __instance.GetEffectPower<Config>("Soaked Fury").Power; if (power > 0f && ((Character)__instance).GetSEMan().HaveStatusEffect(Wetstatus)) { float num = (power + 100f) / 100f; EJLogger.LogDebug($"Soaked Fury is increasing adrenaline gain by {num}"); v *= num; } } } } public static class Spellsword { [PublicAPI] public struct Config { [AdditivePower] public float Power; } } public static class StaggeringBlock { [PublicAPI] public struct Config { [AdditivePower] public float Power; } [HarmonyPatch(typeof(Humanoid), "BlockAttack")] private static class StaggeringBlock_Patch { private static void Postfix(Humanoid __instance, HitData hit, Character attacker, ref bool __result) { //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) Player val = (Player)(object)((__instance is Player) ? __instance : null); if (val != null && val.GetEffectPower<Config>("Staggering Block").Power > 0f && __result && (Object)(object)attacker != (Object)null && !attacker.IsDead()) { float value = Random.value; float num = val.GetEffectPower<Config>("Staggering Block").Power / 100f; if (value < num) { attacker.AddStaggerDamage(999f, -hit.m_dir, (HitData)null); } } } } } internal class Toxifier { [PublicAPI] public struct Config { [MultiplicativePercentagePower] public float Power; [MultiplicativePercentagePower] public float Distance; } [HarmonyPatch(typeof(Character), "AddPoisonDamage")] public static class ReducePoisonDamageTaken { [UsedImplicitly] private static void Postfix(Character __instance) { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Player.m_localPlayer != (Object)null && (Object)(object)__instance != (Object)(object)Player.m_localPlayer) { float power = Player.m_localPlayer.GetEffectPower<Config>("Toxifier").Power; if (power > 0f && Player.m_localPlayer.GetEffectPower<Config>("Toxifier").Distance > Vector3.Distance(((Component)Player.m_localPlayer).transform.position, ((Component)__instance).transform.position)) { ((Character)Player.m_localPlayer).AddAdrenaline(power); } } } } } public static class WaterFrenzy { [PublicAPI] public struct Config { [AdditivePower] public float Power; } [HarmonyPatch(typeof(Character), "Damage")] private class AddBonusSlashDamage { private static void Prefix(HitData hit) { Character attacker = hit.GetAttacker(); Player val = (Player)(object)((attacker is Player) ? attacker : null); if (val != null && (Object)(object)val != (Object)null && ((Character)val).GetSEMan().HaveStatusEffect(wetstatus)) { float num = (val.GetEffectPower<Config>("Water Frenzy").Power + 100f) / 100f; hit.m_damage.m_blunt *= num; hit.m_damage.m_pierce *= num; hit.m_damage.m_pierce *= num; hit.m_damage.m_fire *= num; hit.m_damage.m_lightning *= num; hit.m_damage.m_frost *= num; hit.m_damage.m_spirit *= num; hit.m_damage.m_poison *= num; hit.m_damage.m_pickaxe *= num; } } } private static int wetstatus = StringExtensionMethods.GetStableHashCode("Wet"); } public static class Waterproof { [PublicAPI] public struct Config { [AdditivePower] public float Power; } } internal class WaterResistant { [PublicAPI] public struct Config { [InverseMultiplicativePercentagePower] public float Power; } [HarmonyPatch(typeof(SEMan), "AddStatusEffect", new Type[] { typeof(int), typeof(bool), typeof(int), typeof(float) })] public static class Waterproof_SEMan_AddStatusEffect_Patch { public static bool Prefix(SEMan __instance, int nameHash) { if (__instance.m_character.IsPlayer()) { Character character = __instance.m_character; Player val = (Player)(object)((character is Player) ? character : null); if (val != null && nameHash == wet_hash) { if (val.GetEffectPower<Waterproof.Config>("Waterproof").Power > 0f) { return false; } if (val.GetEffectPower<Config>("Water Resistant").Power > 0f) { if (delayWetTill == 0f) { delayWetTill = Time.time + val.GetEffectPower<Config>("Water Resistant").Power; return false; } if (delayWetTill < Time.time) { if (delayWetTill + 2f < Time.time) { delayWetTill = 0f; return false; } delayWetTill = 0f; return true; } return false; } } } return true; } } private static float delayWetTill = 0f; private static int wet_hash = "Wet".GetHashCode(); } public static class WaterSwiftness { [PublicAPI] public struct Config { [InverseMultiplicativePercentagePower] public float Power; } [HarmonyPatch(typeof(Player), "GetJogSpeedFactor")] private class IncreaseJogSpeed { private static void Postfix(Player __instance, ref float __result) { if (((Character)__instance).GetSEMan().HaveStatusEffect(wetstatus) || (__instance.GetEffectPower<Waterproof.Config>("Waterproof").Power > 0f && (__instance.GetEffectPower<Config>("Water Swiftness").Power > 0f || __instance.GetEffectPower<Config>("Slippery When Wet").Power > 0f))) { float num = (__instance.GetEffectPower<Config>("Water Swiftness").Power + __instance.GetEffectPower<Config>("Slippery When Wet").Power + 100f) / 100f; __result *= num; } } } [HarmonyPatch(typeof(Player), "GetRunSpeedFactor")] private class IncreaseRunSpeed { private static void Postfix(Player __instance, ref float __result) { if (((Character)__instance).GetSEMan().HaveStatusEffect(wetstatus) || (__instance.GetEffectPower<Waterproof.Config>("Waterproof").Power > 0f && (__instance.GetEffectPower<Config>("Water Swiftness").Power > 0f || __instance.GetEffectPower<Config>("Slippery When Wet").Power > 0f))) { float num = (__instance.GetEffectPower<Config>("Water Swiftness").Power + __instance.GetEffectPower<Config>("Slippery When Wet").Power + 100f) / 100f; __result *= num; } } } private static int wetstatus = StringExtensionMethods.GetStableHashCode("Wet"); } public static class WeaponMaster { [PublicAPI] public struct Config { [AdditivePower] public float Power; } } public static class WeaponReducedStamina { [PublicAPI] public struct Config { [InverseMultiplicativePercentagePower] public float Power; } [HarmonyPatch(typeof(Attack), "GetAttackStamina")] public class ReduceStaminaCostForAttack { public static void Postfix(Attack __instance, ref float __result) { Humanoid character = __instance.m_character; Player val = (Player)(object)((character is Player) ? character : null); if (val != null && val.GetEffectPower<Config>("Weapon Reduced Stamina").Power > 0f) { float num = 100f / (val.GetEffectPower<Config>("Weapon Reduced Stamina").Power + 100f); __result *= num; } } } } public static class WetWorker { [PublicAPI] public struct Config { [AdditivePower] public float Power; } [HarmonyPatch(typeof(Attack), "GetAttackStamina")] public class ReduceStaminaCostWet_Patch { public static void Postfix(Attack __instance, ref float __result) { Humanoid character = __instance.m_character; Player val = (Player)(object)((character is Player) ? character : null); if (val != null && val.GetEffectPower<Config>("Wet Worker").Power > 0f && ((Character)val).GetSEMan().HaveStatusEffect(wetstatus)) { float num = 100f / (val.GetEffectPower<Config>("Wet Worker").Power + 100f); __result *= num; } } } private static int wetstatus = StringExtensionMethods.GetStableHashCode("Wet"); } } namespace EpicJewels.EffectHelpers { public static class AddDamageHarvestables { [HarmonyPatch(typeof(MineRock), "RPC_Hit")] private static class DamageRock { private static void Prefix(HitData hit) { ModifyHarvestDamage(hit); } } [HarmonyPatch(typeof(MineRock5), "RPC_Damage")] private static class DamageRock5 { private static void Prefix(HitData hit) { ModifyHarvestDamage(hit); } } [HarmonyPatch(typeof(TreeBase), "RPC_Damage")] private static class DamageTreebase { private static void Prefix(HitData hit) { ModifyHarvestDamage(hit); } } [HarmonyPatch(typeof(TreeLog), "RPC_Damage")] private static class DamageTreeLog { private static void Prefix(HitData hit) { ModifyHarvestDamage(hit); } } [HarmonyPatch(typeof(Destructible), "RPC_Damage")] private static class DamageDestructible { private static void Prefix(HitData hit) { ModifyHarvestDamage(hit); } } private static HitData ModifyHarvestDamage(HitData hit) { if (hit.GetAttacker() is Player) { Character attacker = hit.GetAttacker(); Player val = (Player)(object)((attacker is Player) ? attacker : null); float totalDamage = ((DamageTypes)(ref hit.m_damage)).GetTotalDamage(); float num = 0f; if (val.GetEffectPower<AddPickaxeDamage.Config>("Add Pickaxe Damage").Chance >= Random.value) { num = totalDamage * (val.GetEffectPower<AddPickaxeDamage.Config>("Add Pickaxe Damage").Power / 100f); } float num2 = 0f; if (val.GetEffectPower<AddChopDamage.Config>("Add Chop Damage").Chance >= Random.value) { num2 = totalDamage * (val.GetEffectPower<AddChopDamage.Config>("Add Chop Damage").Power / 100f); } if (val.GetEffectPower<EitrFused.Config>("Eitr Fused").Power > 0f || val.GetEffectPower<Spellsword.Config>("Spellsword").Power > 0f) { float num3 = val.GetEffectPower<EitrFused.Config>("Eitr Fused").Cost; if (val.GetEffectPower<Spellsword.Config>("Spellsword").Power > 0f) { num3 += 5f; } if (((Character)val).HaveEitr(num3)) { float num4 = (val.GetEffectPower<EitrFused.Config>("Eitr Fused").Power + val.GetEffectPower<Spellsword.Config>("Spellsword").Power) / 100f; num2 += hit.m_damage.m_chop * num4; num += hit.m_damage.m_pickaxe * num4; ((Character)val).UseEitr(num3); } else { EJLogger.LogDebug($"Eitr powered attack not triggered due to cost {num3}"); } } float num5 = num2 + num; EJLogger.LogDebug($"Added Damage {num5} = pickaxe: {num} chop: {num2} original_total_dmg {totalDamage}"); hit.m_damage.m_chop += num2; hit.m_damage.m_pickaxe += num; } return hit; } } [HarmonyPatch(typeof(Character), "Damage")] public static class IncreaseDamageByPowers { private static void Prefix(HitData hit) { if (!(hit.GetAttacker() is Player)) { return; } Character attacker = hit.GetAttacker(); Player val = (Player)(object)((attacker is Player) ? attacker : null); float totalDamage = ((DamageTypes)(ref hit.m_damage)).GetTotalDamage(); float value = Random.value; float value2 = Random.value; float num = 0f; if (val.GetEffectPower<AddBluntDamage.Config>("Add Blunt Damage").Chance / 100f >= value2) { num = totalDamage * (val.GetEffectPower<AddBluntDamage.Config>("Add Blunt Damage").Power / 100f); } float num2 = 0f; if (val.GetEffectPower<AddSlashDamage.Config>("Add Slash Damage").Chance / 100f >= value2) { num2 = totalDamage * (val.GetEffectPower<AddSlashDamage.Config>("Add Slash Damage").Power / 100f); } float num3 = 0f; if (val.GetEffectPower<AddPierceDamage.Config>("Add Pierce Damage").Chance / 100f >= value2) { num3 = totalDamage * (val.GetEffectPower<AddPierceDamage.Config>("Add Pierce Damage").Power / 100f); } float num4 = 0f; if (val.GetEffectPower<AddLightningDamage.Config>("Add Lightning Damage").Chance / 100f >= value) { num4 = totalDamage * (val.GetEffectPower<AddLightningDamage.Config>("Add Lightning Damage").Power / 100f); } float num5 = 0f; if (val.GetEffectPower<AddSpiritDamage.Config>("Add Spirit Damage").Chance / 100f >= value) { num5 = totalDamage * (val.GetEffectPower<AddSpiritDamage.Config>("Add Spirit Damage").Power / 100f); } float num6 = 0f; if (val.GetEffectPower<AddPickaxeDamage.Config>("Add Pickaxe Damage").Chance / 100f >= value2) { num6 = totalDamage * (val.GetEffectPower<AddPickaxeDamage.Config>("Add Pickaxe Damage").Power / 100f); } float num7 = 0f; if (val.GetEffectPower<AddChopDamage.Config>("Add Chop Damage").Chance / 100f >= value2) { num7 = totalDamage * (val.GetEffectPower<AddChopDamage.Config>("Add Chop Damage").Power / 100f); } if (val.GetEffectPower<EitrFused.Config>("Eitr Fused").Power > 0f || val.GetEffectPower<Spellsword.Config>("Spellsword").Power > 0f) { float num8 = val.GetEffectPower<EitrFused.Config>("Eitr Fused").Cost; if (val.GetEffectPower<Spellsword.Config>("Spellsword").Power > 0f) { num8 += 5f; } if (((Character)val).HaveEitr(num8)) { float num9 = (val.GetEffectPower<EitrFused.Config>("Eitr Fused").Power + val.GetEffectPower<Spellsword.Config>("Spellsword").Power) / 100f; num7 += hit.m_damage.m_chop * num9; num6 += hit.m_damage.m_pickaxe * num9; num5 += hit.m_damage.m_spirit * num9; num4 += hit.m_damage.m_lightning * num9; num3 += hit.m_damage.m_pierce * num9; num2 += hit.m_damage.m_slash * num9; num += hit.m_damage.m_blunt * num9; ((Character)val).UseEitr(num8); } else { EJLogger.LogDebug($"Eitr powered attack not triggered due to cost {num8}"); } } float num10 = num + num2 + num3 + num4 + num5 + num6 + num7; float num11 = val.GetEffectPower<Inferno.Config>("Inferno").Chance; if (val.GetEffectPower<IntenseFire.Config>("Intense Fire").Power > 0f) { num11 *= 1.5f; } num11 /= 100f; float value3 = Random.value; if (val.GetEffectPower<Inferno.Config>("Inferno").Power > 0f && value3 < num11) { float num12 = totalDamage * (val.GetEffectPower<Inferno.Config>("Inferno").Power / 100f); hit.m_damage.m_fire += num12; EJLogger.LogDebug($"Inferno activated, added fire damage: {num12}"); } EJLogger.LogDebug($"Inferno chance: {value3} < {num11} | elemental chance: {value} physical chance: {value2} \n Added Damage {num10} = blunt:{num} slash:{num2} pierce:{num3} lightning: {num4} spirit: {num5} pickaxe: {num6} original_total_dmg {totalDamage}"); hit.m_damage.m_blunt += num; hit.m_damage.m_pierce += num3; hit.m_damage.m_slash += num2; hit.m_damage.m_lightning += num4; hit.m_damage.m_spirit += num5; hit.m_damage.m_chop += num7; hit.m_damage.m_pickaxe += num6; } } public static class ItemDisplay { [HarmonyPatch(typeof(ItemData), "GetTooltip", new Type[] { typeof(ItemData), typeof(int), typeof(bool), typeof(float), typeof(int) })] public static class ItemToolTipDisplayEnhancer { public static List<ItemType> allowed_item_types = new List<ItemType> { (ItemType)20, (ItemType)4, (ItemType)3, (ItemType)14, (ItemType)22 }; private static void Postfix(ItemData item, ref string __result) { //IL_0042: 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)Player.m_localPlayer == (Object)null || !((Humanoid)Player.m_localPlayer).IsItemEquiped(item) || !ValConfig.EnableItemTooltipDisplay.Value || !allowed_item_types.Contains(item.m_shared.m_itemType)) { return; } float min = default(float); float max = default(float); ((Character)Player.m_localPlayer).GetSkills().GetRandomSkillRange(ref min, ref max, item.m_shared.m_skillType); float totalDamage = ((DamageTypes)(ref item.m_shared.m_damages)).GetTotalDamage(); Dictionary<string, DmgModDetails> dictionary = DetermineCharacterDamageModifiers(); float num = Player.m_localPlayer.GetEffectPower<CoinHoarder.Config>("Coin Hoarder").Power; if (num > 0f) { num = CoinHoarder.CoinHoarderBonusCalc(Player.m_localPlayer); } float power = Player.m_localPlayer.GetEffectPower<Spellsword.Config>("Spellsword").Power; List<string> list = __result.Split(new char[1] { '\n' }).ToList(); List<string> list2 = new List<string>(list); for (int i = 0; i < list.Count; i++) { if (list[i].Length < 17) { continue; } switch (list[i].Split(new char[1] { ':' })[0].Trim()) { case "$inventory_fire": if (num > 0f || power > 0f) { list2[i] = AddModifierExplainer(list[i], totalDamage, item.m_shared.m_damages.m_blunt, min, max, 0f, num, power); } break; case "$inventory_poison": if (num > 0f || power > 0f) { list2[i] = AddModifierExplainer(list[i], totalDamage, item.m_shared.m_damages.m_blunt, min, max, 0f, num, power); } break; case "$inventory_frost": if (num > 0f || power > 0f) { list2[i] = AddModifierExplainer(list[i], totalDamage, item.m_shared.m_damages.m_blunt, min, max, 0f, num, power); } break; case "$inventory_blunt": if (dictionary.ContainsKey("Add Blunt Damage")) { dictionary["Add Blunt Damage"].added = true; list2[i] = AddModifierExplainer(list[i], totalDamage, item.m_shared.m_damages.m_blunt, min, max, dictionary["Add Blunt Damage"].power, num, power); } else if (num > 0f ||