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 v0.9.25
plugins/EpicJewels.dll
Decompiled 4 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Concurrent; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.IO; using System.Linq; using System.Linq.Expressions; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Serialization; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using System.Threading; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using EpicJewels.Common; using EpicJewels.GemEffects; using HarmonyLib; using JetBrains.Annotations; using Jewelcrafting; using LocalizationManager; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.UI; using YamlDotNet.Core; using YamlDotNet.Core.Events; using YamlDotNet.Core.Tokens; using YamlDotNet.Helpers; using YamlDotNet.Serialization; using YamlDotNet.Serialization.BufferedDeserialization; using YamlDotNet.Serialization.BufferedDeserialization.TypeDiscriminators; using YamlDotNet.Serialization.Callbacks; using YamlDotNet.Serialization.Converters; using YamlDotNet.Serialization.EventEmitters; using YamlDotNet.Serialization.NamingConventions; using YamlDotNet.Serialization.NodeDeserializers; using YamlDotNet.Serialization.NodeTypeResolvers; using YamlDotNet.Serialization.ObjectFactories; using YamlDotNet.Serialization.ObjectGraphTraversalStrategies; using YamlDotNet.Serialization.ObjectGraphVisitors; using YamlDotNet.Serialization.Schemas; using YamlDotNet.Serialization.TypeInspectors; using YamlDotNet.Serialization.TypeResolvers; using YamlDotNet.Serialization.Utilities; using YamlDotNet.Serialization.ValueDeserializers; [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("0.0.1.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.1.0")] [module: UnverifiableCode] namespace EpicJewels { public class CustomGems { public CustomGems(AssetBundle embeddedResources) { AddGems(embeddedResources); } public void AddGems(AssetBundle embeddedResources) { //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) Material material = embeddedResources.LoadAsset<Material>("assets/custom/fbx_exports/gems/jade/gem_jade.mat"); Material material2 = embeddedResources.LoadAsset<Material>("assets/custom/fbx_exports/gems/garnet/garnet_gem.mat"); Material material3 = embeddedResources.LoadAsset<Material>("assets/custom/fbx_exports/gems/amber/amber_gem.mat"); Material material4 = embeddedResources.LoadAsset<Material>("assets/custom/fbx_exports/gems/opal/opal_gem.mat"); Material material5 = embeddedResources.LoadAsset<Material>("assets/custom/fbx_exports/gems/amethyst/amethyst_gem.mat"); Material material6 = embeddedResources.LoadAsset<Material>("assets/custom/fbx_exports/gems/aquamarine/aquamarine_gem.mat"); API.AddGems("Jade", "jade", material, new Color(0.031f, 0.69f, 0.043f, 1f)); API.AddGems("Amber", "amber", material3, new Color(1f, 0.776f, 0.071f, 1f)); API.AddGems("Aquamarine", "aquamarine", material6, new Color(0.259f, 0.663f, 0.71f, 1f)); API.AddGems("Garnet", "garnet", material2, new Color(1f, 0.141f, 0.039f)); API.AddGems("Opal", "opal", material4, new Color(0.945f, 0.988f, 0.988f, 1f)); API.AddGems("Amethyst", "amethyst", material5, new Color(0.784f, 0.302f, 0.98f, 1f)); API.AddGemConfig(EpicJewels.LoadEmbeddedAssetToString("EJConfig.yaml")); } } [BepInPlugin("MidnightsFX.EpicJewels", "EpicJewels", "0.9.25")] [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; EJLog.LogDebug((object)$"Found {enumerable.Count()} Synergy panels to update."); foreach (GameObject item in enumerable) { try { EJLog.LogDebug((object)$"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 = "0.9.25"; public static readonly ManualLogSource EJLog = Logger.CreateLogSource("EpicJewels"); internal Config cfg; internal static AssetBundle EmbeddedResourceBundle; internal static Harmony Harmony = new Harmony("MidnightsFX.EpicJewels"); public static IDeserializer yamldeserializer = new DeserializerBuilder().WithNamingConvention(CamelCaseNamingConvention.Instance).Build(); public static ISerializer yamlserializer = new SerializerBuilder().WithNamingConvention(CamelCaseNamingConvention.Instance).DisableAliases().Build(); public static Material spiritCreature; public void Awake() { Localizer.Load(); cfg = new Config(((BaseUnityPlugin)this).Config); EmbeddedResourceBundle = LoadAssetBundle("EpicJewels.AssetsEmbedded.epicjewels"); EJLog.LogDebug((object)"Logging embedded assets."); string[] allAssetNames = EmbeddedResourceBundle.GetAllAssetNames(); foreach (string text in allAssetNames) { EJLog.LogDebug((object)text); } EJLog.LogInfo((object)"Let the gems flow."); EffectList.AddGemEffects(); new CustomGems(EmbeddedResourceBundle); spiritCreature = EmbeddedResourceBundle.LoadAsset<Material>("assets/custom/fbx_exports/gems/spirit_animal_mat.mat"); Assembly executingAssembly = Assembly.GetExecutingAssembly(); Harmony.PatchAll(executingAssembly); } 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; } } } namespace EpicJewels.GemEffects { 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 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)); } } } } } public static class EitrFused { [PublicAPI] public struct Config { [InverseMultiplicativePercentagePower] public float Power; [AdditivePower] public float Cost; } } 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); } } } } } public static class Inferno { [PublicAPI] public struct Config { [MultiplicativePercentagePower] public float Power; [MultiplicativePercentagePower] 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; } } 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; } } } } } 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 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<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 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 ExpertHarvester { [PublicAPI] public struct Config { [InverseMultiplicativePercentagePower] public float Power; } } public static class ExpertMage { [PublicAPI] public struct Config { [InverseMultiplicativePercentagePower] public float Power; } } public static class ExpertFisher { [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 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 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 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_fire *= 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; } } 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); } } } } } 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 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 { EpicJewels.EJLog.LogDebug((object)$"Eitr powered attack not triggered due to cost {num3}"); } } float num5 = num2 + num; EpicJewels.EJLog.LogDebug((object)$"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 { EpicJewels.EJLog.LogDebug((object)$"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; EpicJewels.EJLog.LogDebug((object)$"Inferno activated, added fire damage: {num12}"); } EpicJewels.EJLog.LogDebug((object)$"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) || !Config.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 || power > 0f) { list2[i] = AddModifierExplainer(list[i], totalDamage, item.m_shared.m_damages.m_blunt, min, max, 0f, num, power); } break; case "$inventory_slash": if (dictionary.ContainsKey("Add Slash Damage")) { dictionary["Add Slash Damage"].added = true; list2[i] = AddModifierExplainer(list[i], totalDamage, item.m_shared.m_damages.m_slash, min, max, dictionary["Add Slash Damage"].power, num, power); } else if (num > 0f || power > 0f) { list2[i] = AddModifierExplainer(list[i], totalDamage, item.m_shared.m_damages.m_slash, min, max, 0f, num, power); } break; case "$inventory_pierce": if (dictionary.ContainsKey("Add Pierce Damage")) { dictionary["Add Pierce Damage"].added = true; list2[i] = AddModifierExplainer(list[i], totalDamage, item.m_shared.m_damages.m_pierce, min, max, dictionary["Add Pierce Damage"].power, num, power); } else if (num > 0f || power > 0f) { list2[i] = AddModifierExplainer(list[i], totalDamage, item.m_shared.m_damages.m_pierce, min, max, 0f, num, power); } break; case "$inventory_lightning": if (dictionary.ContainsKey("Add Lightning Damage")) { dictionary["Add Lightning Damage"].added = true; list2[i] = AddModifierExplainer(list[i], totalDamage, item.m_shared.m_damages.m_lightning, min, max, dictionary["Add Lightning Damage"].power, num, power); } else if (num > 0f || power > 0f) { list2[i] = AddModifierExplainer(list[i], totalDamage, item.m_shared.m_damages.m_lightning, min, max, 0f, num, power); } break; case "$inventory_spirit": if (dictionary.ContainsKey("Add Spirit Damage")) { dictionary["Add Spirit Damage"].added = true; list2[i] = AddModifierExplainer(list[i], totalDamage, item.m_shared.m_damages.m_spirit, min, max, dictionary["Add Spirit Damage"].power, num, power); } else if (num > 0f || power > 0f) { list2[i] = AddModifierExplainer(list[i], totalDamage, item.m_shared.m_damages.m_spirit, min, max, 0f, num, power); } break; } } foreach (KeyValuePair<string, DmgModDetails> item2 in dictionary) { if (!item2.Value.added) { list2.Add(BuildModifierExplainer(item2.Value.localizedName, totalDamage, min, max, item2.Value.power)); } } string text = string.Join("\n", list2.ToArray()); __result = text; } } private class DmgModDetails { public string localizedName { get; set; } public bool added { get; set; } public float power { get; set; } } private static Dictionary<string, DmgModDetails> DetermineCharacterDamageModifiers() { Dictionary<string, DmgModDetails> dictionary = new Dictionary<string, DmgModDetails>(); if (Player.m_localPlayer.GetEffectPower<AddSpiritDamage.Config>("Add Spirit Damage").Power > 0f) { dictionary.Add("Add Spirit Damage", new DmgModDetails { added = false, localizedName = "$inventory_spirit", power = Player.m_localPlayer.GetEffectPower<AddSpiritDamage.Config>("Add Spirit Damage").Power }); } if (Player.m_localPlayer.GetEffectPower<AddLightningDamage.Config>("Add Lightning Damage").Power > 0f) { dictionary.Add("Add Lightning Damage", new DmgModDetails { added = false, localizedName = "$inventory_lightning", power = Player.m_localPlayer.GetEffectPower<AddLightningDamage.Config>("Add Lightning Damage").Power }); } if (Player.m_localPlayer.GetEffectPower<AddPierceDamage.Config>("Add Pierce Damage").Power > 0f) { dictionary.Add("Add Pierce Damage", new DmgModDetails { added = false, localizedName = "$inventory_pierce", power = Player.m_localPlayer.GetEffectPower<AddPierceDamage.Config>("Add Pierce Damage").Power }); } if (Player.m_localPlayer.GetEffectPower<AddSlashDamage.Config>("Add Slash Damage").Power > 0f) { dictionary.Add("Add Slash Damage", new DmgModDetails { added = false, localizedName = "$inventory_slash", power = Player.m_localPlayer.GetEffectPower<AddSlashDamage.Config>("Add Slash Damage").Power }); } if (Player.m_localPlayer.GetEffectPower<AddBluntDamage.Config>("Add Blunt Damage").Power > 0f) { dictionary.Add("Add Blunt Damage", new DmgModDetails { added = false, localizedName = "$inventory_blunt", power = Player.m_localPlayer.GetEffectPower<AddBluntDamage.Config>("Add Blunt Damage").Power }); } return dictionary; } private static string AddModifierExplainer(string current_line, float total_dmg, float m_dmg_value, float min, float max, float bonus_power, float coinhoarder_mult = 1f, float spellsword_mult = 0f) { float num = total_dmg * (bonus_power / 100f); string[] array = current_line.Split(new char[1] { ' ' }); Match match = Regex.Match(array[1], "(?<=>)(\\d+)(?=<)"); if (!match.Success) { return current_line; } if (!int.TryParse(match.Value, out var result)) { return current_line; } if (spellsword_mult > 0f) { float num2 = Player.m_localPlayer.GetEffectPower<EitrFused.Config>("Eitr Fused").Cost + 5f; if (((Character)Player.m_localPlayer).HaveEitr(num2)) { coinhoarder_mult += 1f + spellsword_mult / 100f; } } array[1] = "<color=purple>" + (((float)result + num) * coinhoarder_mult).ToString("F1") + "</color>"; ref string reference = ref array[1]; reference = reference + " <color=purple>[+" + (num + (coinhoarder_mult * (float)result - (float)result)).ToString("F1") + "]</color>"; array[2] = $"<color=purple>({Mathf.RoundToInt((m_dmg_value + num + (coinhoarder_mult * (float)result - (float)result)) * min)}-{Mathf.RoundToInt((m_dmg_value + num + (coinhoarder_mult * (float)result - (float)result)) * max)})"; return string.Join(" ", array); } private static string BuildModifierExplainer(string dmg_localization, float total_dmg, float min, float max, float bonus_power) { float num = total_dmg * (bonus_power / 100f); return string.Format("{0}: <color=purple>{1}</color> <color=purple>({2}-{3})</color>", dmg_localization, num.ToString("F1"), Mathf.RoundToInt(num * min), Mathf.RoundToInt(num * max)); } } [HarmonyPatch(typeof(Skills), "GetSkillLevel")] public static class IncreaseSkillLevelPatch { private static void Postfix(Skills __instance, SkillType skillType, ref float __result) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) __result = IncreaseSkillPatch.DetermineSkillIncrease(__instance.m_player, skillType, __result, factor: false); } } [HarmonyPatch(typeof(Skills), "GetSkillFactor")] public static class IncreaseSkillPatch { [UsedImplicitly] private static void Postfix(Skills __instance, SkillType skillType, ref float __result) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) __result = DetermineSkillIncrease(__instance.m_player, skillType, __result); } public static float DetermineSkillIncrease(Player player, SkillType selectedSkill, float current_skill_level, bool factor = true) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected I4, but got Unknown //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Expected I4, but got Unknown //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Invalid comparison between Unknown and I4 float num = 0f; switch ((int)selectedSkill) { default: switch (selectedSkill - 100) { default: if ((int)selectedSkill == 999) { float power = player.GetEffectPower<WeaponMaster.Config>("Weapon Master").Power; num += player.GetEffectPower<ExpertHarvester.Config>("Expert Harvester").Power; num += player.GetEffectPower<ExpertHarvester.Config>("Expert Harvester").Power; num += power + player.GetEffectPower<ExpertSwordsman.Config>("Expert Swordsman").Power; num += power + player.GetEffectPower<ExpertSpearmaiden.Config>("Expert Spearmaiden").Power; num += power + player.GetEffectPower<ExpertSmasher.Config>("Expert Smasher").Power; num += power + player.GetEffectPower<ExpertPolearms.Config>("Expert Polearms").Power; num += player.GetEffectPower<ExpertMage.Config>("Expert Mage").Power; num += player.GetEffectPower<ExpertMage.Config>("Expert Mage").Power; num += player.GetEffectPower<ExpertFisher.Config>("Expert Fisher").Power; num += power + player.GetEffectPower<ExpertDaggers.Config>("Expert Daggers").Power; num += power + player.GetEffectPower<ExpertBrawler.Config>("Expert Brawler").Power; num += power + player.GetEffectPower<ExpertAxemaster.Config>("Expert Axemaster").Power; num += player.GetEffectPower<ExpertAcrobat.Config>("Expert Acrobat").Power; } break; case 4: if (player.GetEffectPower<ExpertFisher.Config>("Expert Fisher").Power > 0f) { num += player.GetEffectPower<ExpertFisher.Config>("Expert Fisher").Power; } break; case 0: if (player.GetEffectPower<ExpertAcrobat.Config>("Expert Acrobat").Power > 0f) { num += player.GetEffectPower<ExpertAcrobat.Config>("Expert Acrobat").Power; } break; case 2: if (player.GetEffectPower<ExpertSprinter.Config>("Expert Sprinter").Power > 0f) { num += player.GetEffectPower<ExpertSprinter.Config>("Expert Sprinter").Power; } break; case 1: case 3: case 5: case 6: case 7: case 8: case 9: case 10: break; } break; case 1: if (player.GetEffectPower<ExpertSwordsman.Config>("Expert Swordsman").Power > 0f || player.GetEffectPower<WeaponMaster.Config>("Weapon Master").Power > 0f) { num += player.GetEffectPower<ExpertSwordsman.Config>("Expert Swordsman").Power; num += player.GetEffectPower<WeaponMaster.Config>("Weapon Master").Power; } break; case 5: if (player.GetEffectPower<ExpertSpearmaiden.Config>("Expert Spearmaiden").Power > 0f || player.GetEffectPower<WeaponMaster.Config>("Weapon Master").Power > 0f) { num += player.GetEffectPower<ExpertSpearmaiden.Config>("Expert Spearmaiden").Power; num += player.GetEffectPower<WeaponMaster.Config>("Weapon Master").Power; } break; case 3: if (player.GetEffectPower<ExpertSmasher.Config>("Expert Smasher").Power > 0f || player.GetEffectPower<WeaponMaster.Config>("Weapon Master").Power > 0f) { num += player.GetEffectPower<ExpertSmasher.Config>("Expert Smasher").Power; num += player.GetEffectPower<WeaponMaster.Config>("Weapon Master").Power; } break; case 4: if (player.GetEffectPower<ExpertPolearms.Config>("Expert Polearms").Power > 0f || player.GetEffectPower<WeaponMaster.Config>("Weapon Master").Power > 0f) { num += player.GetEffectPower<ExpertPolearms.Config>("Expert Polearms").Power; num += player.GetEffectPower<WeaponMaster.Config>("Weapon Master").Power; } break; case 9: case 10: if (player.GetEffectPower<ExpertMage.Config>("Expert Mage").Power > 0f) { num += player.GetEffectPower<ExpertMage.Config>("Expert Mage").Power; } break; case 2: if (player.GetEffectPower<ExpertDaggers.Config>("Expert Daggers").Power > 0f || player.GetEffectPower<WeaponMaster.Config>("Weapon Master").Power > 0f) { num += player.GetEffectPower<ExpertDaggers.Config>("Expert Daggers").Power; num += player.GetEffectPower<WeaponMaster.Config>("Weapon Master").Power; } break; case 11: if (player.GetEffectPower<ExpertBrawler.Config>("Expert Brawler").Power > 0f || player.GetEffectPower<WeaponMaster.Config>("Weapon Master").Power > 0f) { num += player.GetEffectPower<ExpertBrawler.Config>("Expert Brawler").Power; num += player.GetEffectPower<WeaponMaster.Config>("Weapon Master").Power; } break; case 7: if (player.GetEffectPower<ExpertAxemaster.Config>("Expert Axemaster").Power > 0f || player.GetEffectPower<WeaponMaster.Config>("Weapon Master").Power > 0f) { num += player.GetEffectPower<ExpertAxemaster.Config>("Expert Axemaster").Power; num += player.GetEffectPower<WeaponMaster.Config>("Weapon Master").Power; } break; case 12: case 13: if (player.GetEffectPower<ExpertHarvester.Config>("Expert Harvester").Power > 0f) { num += player.GetEffectPower<ExpertHarvester.Config>("Expert Harvester").Power; } break; case 14: if (player.GetEffectPower<WeaponMaster.Config>("Weapon Master").Power > 0f) { num += player.GetEffectPower<WeaponMaster.Config>("Weapon Master").Power; } break; case 0: case 6: case 8: break; } float num2 = current_skill_level; if (factor) { return num2 + num / 100f; } return num2 + num; } } } namespace EpicJewels.Common { internal class Config { public static ConfigFile cfg; public static ConfigEntry<bool> EnableItemTooltipDisplay; public Config(ConfigFile cfgref) { cfg = cfgref; cfg.SaveOnConfigSet = true; CreateConfigValues(cfgref); } private void CreateConfigValues(ConfigFile Config) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown EnableItemTooltipDisplay = Config.Bind<bool>("Client config", "EnableItemTooltipDisplay", true, new ConfigDescription("Enables displaying some stat modifications on the item tooltip.", (AcceptableValueBase)null, Array.Empty<object>())); } } } 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; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Jewelcrafting { [PublicAPI] internal 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; } } [AttributeUsage(AttributeTargets.Field)] internal abstract class PowerAttribute : Attribute { public abstract float Add(float a, float b); } internal class AdditivePowerAttribute : PowerAttribute { public override float Add(float a, float b) { return a + b; } } internal class MultiplicativePercentagePowerAttribute : PowerAttribute { public override float Add(float a, float b) { return ((1f + a / 100f) * (1f + b / 100f) - 1f) * 100f; } } internal class InverseMultiplicativePercentagePowerAttribute : PowerAttribute { public override float Add(float a, float b) { return (1f - (1f - a / 100f) * (1f - b / 100f)) * 100f; } } internal class MinPowerAttribute : PowerAttribute { public override float Add(float a, float b) { return Mathf.Min(a, b); } } internal class MaxPowerAttribute : PowerAttribute { public override float Add(float a, float b) { return Mathf.Max(a, b); } } [AttributeUsage(AttributeTargets.Field)] internal class OptionalPowerAttribute : Attribute { public readonly float DefaultValue; public OptionalPowerAttribute(float defaultValue) { DefaultValue = defaultValue; } } [Flags] internal 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 } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [<b89b921d-8954-4084-bd4d-1feb826a594e>Embedded] internal sealed class <b89b921d-8954-4084-bd4d-1feb826a594e>EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [<b89b921d-8954-4084-bd4d-1feb826a594e>Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class <f6f8ff5f-fa45-43ba-9489-b740a9e7c98b>NullableAttribute : Attribute { public readonly byte[] NullableFlags; public <f6f8ff5f-fa45-43ba-9489-b740a9e7c98b>NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public <f6f8ff5f-fa45-43ba-9489-b740a9e7c98b>NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [<b89b921d-8954-4084-bd4d-1feb826a594e>Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [CompilerGenerated] internal sealed class <bb5e3e5e-5c47-485a-88ef-ea5afd7f01c7>NullableContextAttribute : Attribute { public readonly byte Flag; public <bb5e3e5e-5c47-485a-88ef-ea5afd7f01c7>NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace LocalizationManager { [<f6f8ff5f-fa45-43ba-9489-b740a9e7c98b>Nullable(0)] [PublicAPI] [<bb5e3e5e-5c47-485a-88ef-ea5afd7f01c7>NullableContext(1)] internal class Localizer { private static readonly Dictionary<string, Dictionary<string, Func<string>>> PlaceholderProcessors; private static readonly Dictionary<string, Dictionary<string, string>> loadedTexts; private static readonly ConditionalWeakTable<Localization, string> localizationLanguage; private static readonly List<WeakReference<Localization>> localizationObjects; [<f6f8ff5f-fa45-43ba-9489-b740a9e7c98b>Nullable(2)] private static BaseUnityPlugin _plugin; private static readonly List<string> fileExtensions; private static BaseUnityPlugin plugin { get { //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Expected O, but got Unknown if (_plugin == null) { IEnumerable<TypeInfo> source; try { source = Assembly.GetExecutingAssembly().DefinedTypes.ToList(); } catch (ReflectionTypeLoadException ex) { source = from t in ex.Types where t != null select t.GetTypeInfo(); } _plugin = (BaseUnityPlugin)Chainloader.ManagerObject.GetComponent((Type)source.First([<bb5e3e5e-5c47-485a-88ef-ea5afd7f01c7>NullableContext(0)] (TypeInfo t) => t.IsClass && typeof(BaseUnityPlugin).IsAssignableFrom(t))); } return _plugin; } } private static void UpdatePlaceholderText(Localization localization, string key) { localizationLanguage.TryGetValue(localization, out var value); string text = loadedTexts[value][key]; if (PlaceholderProcessors.TryGetValue(key, out var value2)) { text = value2.Aggregate(text, [<bb5e3e5e-5c47-485a-88ef-ea5afd7f01c7>NullableContext(0)] (string current, KeyValuePair<string, Func<string>> kv) => current.Replace("{" + kv.Key + "}", kv.Value())); } localization.AddWord(key, text); } public static void AddPlaceholder<T>(string key, string placeholder, ConfigEntry<T> config, [<f6f8ff5f-fa45-43ba-9489-b740a9e7c98b>Nullable(new byte[] { 2, 1, 1 })] Func<T, string> convertConfigValue = null) { if (convertConfigValue == null) { convertConfigValue = [<bb5e3e5e-5c47-485a-88ef-ea5afd7f01c7>NullableContext(0)] [return: <f6f8ff5f-fa45-43ba-9489-b740a9e7c98b>Nullable(1)] (T val) => val.ToString(); } if (!PlaceholderProcessors.ContainsKey(key)) { PlaceholderProcessors[key] = new Dictionary<string, Func<string>>(); } config.SettingChanged += [<bb5e3e5e-5c47-485a-88ef-ea5afd7f01c7>NullableContext(0)] (object _, EventArgs _) => { UpdatePlaceholder(); }; if (loadedTexts.ContainsKey(Localization.instance.GetSelectedLanguage())) { UpdatePlaceholder(); } void UpdatePlaceholder() { PlaceholderProcessors[key][placeholder] = () => convertConfigValue(config.Value); UpdatePlaceholderText(Localization.instance, key); } } public static void AddText(string key, string text) { List<WeakReference<Localization>> list = new List<WeakReference<Localization>>(); foreach (WeakReference<Localization> localizationObject in localizationObjects) { if (localizationObject.TryGetTarget(out var target)) { Dictionary<string, string> dictionary = loadedTexts[localizationLanguage.GetOrCreateValue(target)]; if (!target.m_translations.ContainsKey(key)) { dictionary[key] = text; target.AddWord(key, text); } } else { list.Add(localizationObject); } } foreach (WeakReference<Localization> item in list) { localizationObjects.Remove(item); } } public static void Load() { LoadLocalization(Localization.instance, Localization.instance.GetSelectedLanguage()); } private static void LoadLocalization(Localization __instance, string language) { if (!localizationLanguage.Remove(__instance)) { localizationObjects.Add(new WeakReference<Localization>(__instance)); } localizationLanguage.Add(__instance, language); Dictionary<string, string> dictionary = new Dictionary<string, string>(); foreach (string item in from f in Directory.GetFiles(Path.GetDirectoryName(Paths.PluginPath), plugin.Info.Metadata.Name + ".*", SearchOption.AllDirectories) where fileExtensions.IndexOf(Path.GetExtension(f)) >= 0 select f) { string text = Path.GetFileNameWithoutExtension(item).Split(new char[1] { '.' })[1]; if (dictionary.ContainsKey(text)) { Debug.LogWarning((object)("Duplicate key " + text + " found for " + plugin.Info.Metadata.Name + ". The duplicate file found at " + item + " will be skipped.")); } else { dictionary[text] = item; } } byte[] array = LoadTranslationFromAssembly("English"); if (array == null) { throw new Exception("Found no English localizations in mod " + plugin.Info.Metadata.Name + ". Expected an embedded resource translations/English.json or translations/English.yml."); } Dictionary<string, string> dictionary2 = new <c1115aee-2ebb-4910-9809-e81b758f145c>DeserializerBuilder().IgnoreFields().Build().Deserialize<Dictionary<string, string>>(Encoding.UTF8.GetString(array)); if (dictionary2 == null) { throw new Exception("Localization for mod " + plugin.Info.Metadata.Name + " failed: Localization file was empty."); } string text2 = null; if (language != "English") { if (dictionary.ContainsKey(language)) { text2 = File.ReadAllText(dictionary[language]); } else { byte[] array2 = LoadTranslationFromAssembly(language); if (array2 != null) { text2 = Encoding.UTF8.GetString(array2); } } } if (text2 == null && dictionary.ContainsKey("English")) { text2 = File.ReadAllText(dictionary["English"]); } if (text2 != null) { foreach (KeyValuePair<string, string> item2 in new <c1115aee-2ebb-4910-9809-e81b758f145c>DeserializerBuilder().IgnoreFields().Build().Deserialize<Dictionary<string, string>>(text2) ?? new Dictionary<string, string>()) { dictionary2[item2.Key] = item2.Value; } } loadedTexts[language] = dictionary2; foreach (KeyValuePair<string, string> item3 in dictionary2) { UpdatePlaceholderText(__instance, item3.Key); } } static Localizer() { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown PlaceholderProcessors = new Dictionary<string, Dictionary<string, Func<string>>>(); loadedTexts = new Dictionary<string, Dictionary<string, string>>(); localizationLanguage = new ConditionalWeakTable<Localization, string>(); localizationObjects = new List<WeakReference<Localization>>(); fileExtensions = new List<string> { ".json", ".yml" }; new Harmony("org.bepinex.helpers.LocalizationManager").Patch((MethodBase)AccessTools.DeclaredMethod(typeof(Localization), "LoadCSV", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(AccessTools.DeclaredMethod(typeof(Localizer), "LoadLocalization", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } [return: <f6f8ff5f-fa45-43ba-9489-b740a9e7c98b>Nullable(2)] private static byte[] LoadTranslationFromAssembly(string language) { foreach (string fileExtension in fileExtensions) { byte[] array = ReadEmbeddedFileBytes("translations." + language + fileExtension); if (array != null) { return array; } } return null; } [<bb5e3e5e-5c47-485a-88ef-ea5afd7f01c7>NullableContext(2)] public static byte[] ReadEmbeddedFileBytes([<f6f8ff5f-fa45-43ba-9489-b740a9e7c98b>Nullable(1)] string resourceFileName, Assembly containingAssembly = null) { using MemoryStream memoryStream = new MemoryStream(); if ((object)containingAssembly == null) { containingAssembly = Assembly.GetCallingAssembly(); } string text = containingAssembly.GetManifestResourceNames().FirstOrDefault([<bb5e3e5e-5c47-485a-88ef-ea5afd7f01c7>NullableContext(0)] (string str) => str.EndsWith(resourceFileName, StringComparison.Ordinal)); if (text != null) { containingAssembly.GetManifestResourceStream(text)?.CopyTo(memoryStream); } return (memoryStream.Length == 0L) ? null : memoryStream.ToArray(); } } } namespace System.Diagnostics.CodeAnalysis { [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] internal sealed class <c1115aee-2ebb-4910-9809-e81b758f145c>AllowNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] internal sealed class <c1115aee-2ebb-4910-9809-e81b758f145c>DisallowNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Method, Inherited = false)] internal sealed class <c1115aee-2ebb-4910-9809-e81b758f145c>DoesNotReturnAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] internal sealed class <c1115aee-2ebb-4910-9809-e81b758f145c>DoesNotReturnIfAttribute : Attribute { public bool ParameterValue { get; } public <c1115aee-2ebb-4910-9809-e81b758f145c>DoesNotReturnIfAttribute(bool parameterValue) { ParameterValue = parameterValue; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)] internal sealed class <c1115aee-2ebb-4910-9809-e81b758f145c>MaybeNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] internal sealed class <c1115aee-2ebb-4910-9809-e81b758f145c>MaybeNullWhenAttribute : Attribute { public bool ReturnValue { get; } public <c1115aee-2ebb-4910-9809-e81b758f145c>MaybeNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | Att