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 Arvore da Essencia de Valheim v0.9.14
plugins/TalentosErnandevc.dll
Decompiled 8 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Jotunn.Entities; using Jotunn.Managers; using Jotunn.Utils; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.Rendering; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("assembly_guiutils")] [assembly: IgnoresAccessChecksTo("assembly_utils")] [assembly: IgnoresAccessChecksTo("assembly_valheim")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("TalentosErnandevc")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.9.14.0")] [assembly: AssemblyInformationalVersion("0.9.14")] [assembly: AssemblyProduct("TalentosErnandevc")] [assembly: AssemblyTitle("TalentosErnandevc")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.9.14.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Talentos { internal sealed class ArmaEspectral { internal string Id; internal string Nome; internal string De = "da"; internal string Descricao; internal Poder Poder; internal string Prefab; internal DamageType TipoDeDano; internal string NomeDoDano; internal string[] Modelos; internal string[][] Referencias; internal Action<SharedData> Ajustar; internal List<ElementoDaEssencia> Elementos; internal GameObject PrefabCriado; internal Sprite Icone; internal float[] Regua; internal string Chave => "ernandevc.talentos.arma." + Id; } internal static class ArmasEspectrais { internal const int BiomaMaximo = 8; internal static readonly string[] NomeBioma = new string[9] { "", "Prado", "Floresta negra", "Pântano", "Montanha", "Planície", "Terras nevoadas", "Terras Cinzentas", "Norte profundo" }; private static readonly string[][] ReguaDeUmaMao = new string[9][] { null, new string[2] { "AxeFlint", "KnifeFlint" }, new string[1] { "SwordBronze" }, new string[1] { "SwordIron" }, new string[1] { "SwordSilver" }, new string[1] { "SwordBlackmetal" }, new string[1] { "SwordMistwalker" }, new string[1] { "SwordNiedhogg" }, new string[0] }; internal static readonly List<ArmaEspectral> Todas = new List<ArmaEspectral> { new ArmaEspectral { Id = "espada", Nome = "Espada Espectral", Descricao = "Espada de uma mão invocada pela Essência de Valheim. O escudo continua valendo.", Poder = Poder.Berserker, Prefab = "ernandevc_EspadaEspectral", TipoDeDano = (DamageType)2, NomeDoDano = "cortante", Modelos = new string[2] { "SwordBlackmetal", "SwordIron" }, Referencias = ReguaDeUmaMao }, new ArmaEspectral { Id = "arco", Nome = "Arco Espectral", De = "do", Descricao = "Arco invocado pela Essência de Valheim. Não usa flechas: atira flechas espectrais.", Poder = Poder.Vigilante, Prefab = "ernandevc_ArcoEspectral", TipoDeDano = (DamageType)4, NomeDoDano = "perfurante", Modelos = new string[3] { "BowHuntsman", "BowFineWood", "Bow" }, Referencias = new string[9][] { null, new string[1] { "Bow+ArrowWood" }, new string[2] { "BowFineWood+ArrowBronze", "BowFineWood+ArrowFlint" }, new string[1] { "BowHuntsman+ArrowIron" }, new string[2] { "BowDraugrFang+ArrowSilver", "BowDraugrFang+ArrowObsidian" }, new string[1] { "BowDraugrFang+ArrowNeedle" }, new string[1] { "BowSpineSnap+ArrowCarapace" }, new string[1] { "BowAshlands+ArrowCharred" }, new string[0] }, Ajustar = SemFlechas }, new ArmaEspectral { Id = "essencia", Nome = "Essência", Descricao = "Essência de Valheim atirada da mão. Gasta 30 de eitr por disparo.", Poder = Poder.Iluminado, Referencias = ReguaDeUmaMao, Elementos = EssenciaDoMago.Elementos } }; private static readonly Dictionary<string, ArmaEspectral> PorPrefab = MontarPorPrefab(); private const float EsperaMaxima = 1.5f; private static float invocarAte; private static Dictionary<string, ArmaEspectral> MontarPorPrefab() { Dictionary<string, ArmaEspectral> dictionary = new Dictionary<string, ArmaEspectral>(); foreach (ArmaEspectral toda in Todas) { if (toda.Prefab != null) { dictionary[toda.Prefab] = toda; } if (toda.Elementos == null) { continue; } foreach (ElementoDaEssencia elemento in toda.Elementos) { dictionary[elemento.Prefab] = toda; } } return dictionary; } internal static string NomePara(ArmaEspectral arma, Player player) { if (arma.Elementos != null) { return "Essência de " + EssenciaDoMago.Escolhido(player).Nome; } return arma.Nome; } internal static Sprite IconePara(ArmaEspectral arma, Player player) { Sprite val = ((arma.Elementos == null) ? null : EssenciaDoMago.Escolhido(player).Icone); if (!((Object)(object)val != (Object)null)) { return arma.Icone; } return val; } private static GameObject PrefabPara(ArmaEspectral arma, Player player) { if (arma.Elementos != null) { return EssenciaDoMago.Escolhido(player).PrefabCriado; } return arma.PrefabCriado; } internal static ArmaEspectral DoPoder(Poder poder) { return Todas.FirstOrDefault((ArmaEspectral a) => a.Poder == poder); } internal static ArmaEspectral DoItem(ItemData item) { if (item == null || !((Object)(object)item.m_dropPrefab != (Object)null) || !PorPrefab.TryGetValue(((Object)item.m_dropPrefab).name, out var value)) { return null; } return value; } internal static bool EhEspectral(ItemData item) { return DoItem(item) != null; } internal static int Nivel(Player player, ArmaEspectral arma) { if (!((Object)(object)player != (Object)null) || !player.m_customData.TryGetValue(arma.Chave, out var value) || !int.TryParse(value, NumberStyles.Integer, CultureInfo.InvariantCulture, out var result)) { return 1; } return Math.Max(1, result); } internal static long CustoDoNivel(int nivelDesejado) { if (nivelDesejado > 1) { return (long)Math.Round((double)Plugin.CustoBaseArma.Value * Math.Pow(2.0, nivelDesejado - 1)); } return 0L; } internal static int LimiteDaPotencia(Player player) { return BiomaAlcancado(player); } internal static string ComprarNivel(Player player, ArmaEspectral arma) { int num = Nivel(player, arma); int num2 = LimiteDaPotencia(player); if (num >= num2) { return $"A Potência {arma.De} {arma.Nome} está no limite do bioma ({NomeBioma[num2]} = {num2}). Derrote o próximo chefe para subir mais."; } int num3 = num + 1; long num4 = CustoDoNivel(num3); if (!Essencia.Gastar(player, num4)) { return $"Falta Essência: a Potência {num3} {arma.De} {arma.Nome} custa {Essencia.Formatar(num4)}."; } player.m_customData[arma.Chave] = num3.ToString(CultureInfo.InvariantCulture); return $"Potência {arma.De} {arma.Nome} subiu para o nível {num3}."; } internal static int BiomaAlcancado(Player player) { int num = 1; for (int i = 0; i < Chefes.Todos.Count; i++) { if (Chefes.Derrotado(player, Chefes.Todos[i])) { num = Mathf.Max(num, i + 2); } } return Mathf.Min(num, 8); } internal static float Forca(ArmaEspectral arma, Player player) { float[] array = Regua(arma); if (array == null) { return 0f; } int num = Mathf.Max(1, Nivel(player, arma)); return array[BiomaAlcancado(player)] * Plugin.FracaoDoBioma.Value * (1f + Plugin.BonusPorNivelArma.Value / 100f * (float)(num - 1)); } private static float[] Regua(ArmaEspectral arma) { if (arma.Regua != null) { return arma.Regua; } if ((Object)(object)ObjectDB.instance == (Object)null || ObjectDB.instance.m_items.Count == 0) { return null; } float[] array = new float[9]; StringBuilder stringBuilder = new StringBuilder("Régua de dano " + arma.De + " " + arma.Nome + ":"); for (int i = 1; i <= 8; i++) { string[] array2 = arma.Referencias[i]; foreach (string text in array2) { float num = ForcaDaReferencia(text); if (num > 0f) { array[i] = num; stringBuilder.Append($" {i}={text} {num:0}"); break; } } } if (array[1] <= 0f) { array[1] = ((array[2] > 0f) ? (array[2] * 0.6f) : 20f); stringBuilder.Append($" 1=estimado {array[1]:0}"); } for (int k = 2; k <= 8; k++) { if (!(array[k] > array[k - 1])) { int l; for (l = k + 1; l <= 8 && array[l] <= array[k - 1]; l++) { } array[k] = ((l <= 8) ? (array[k - 1] + (array[l] - array[k - 1]) / (float)(l - k + 1)) : (array[k - 1] * 1.25f)); stringBuilder.Append($" {k}=ajustado {array[k]:0}"); } } Plugin.Log.LogInfo((object)stringBuilder.ToString()); return arma.Regua = array; } private static float ForcaDaReferencia(string referencia) { float num = 0f; string[] array = referencia.Split('+'); for (int i = 0; i < array.Length; i++) { float num2 = ForcaDoItem(array[i].Trim()); if (num2 <= 0f) { return 0f; } num += num2; } return num; } private static float ForcaDoItem(string prefab) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(prefab); ItemDrop val = (((Object)(object)itemPrefab != (Object)null) ? itemPrefab.GetComponent<ItemDrop>() : null); if ((Object)(object)val == (Object)null) { return 0f; } DamageTypes damages = val.m_itemData.m_shared.m_damages; return Mathf.Max(damages.m_slash, Mathf.Max(damages.m_pierce, damages.m_blunt)); } internal static string DescricaoDoDano(ArmaEspectral arma, Player player) { return Ramos.ResumoDoDano(arma, player); } internal static DamageTypes DanoAtual(ArmaEspectral arma, Player player) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) return Calcular(arma, player, (arma.Elementos != null) ? EssenciaDoMago.Escolhido(player) : null); } internal static DamageTypes Dano(ArmaEspectral arma, Player player, ItemData item) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) return Calcular(arma, player, EssenciaDoMago.DoItem(item)); } private static DamageTypes Calcular(ArmaEspectral arma, Player player, ElementoDaEssencia elemento) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Invalid comparison between Unknown and I4 //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Invalid comparison between Unknown and I4 //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Invalid comparison between Unknown and I4 float num = Forca(arma, player); if (elemento != null) { DamageTypes result = elemento.Dano(num * (1f + Ramos.BonusDaEssencia(player, arma, elemento))); result.m_fire *= Ramos.MultiplicadorDaQueimadura(player, arma); return result; } DamageTypes dano = default(DamageTypes); DamageType tipoDeDano = arma.TipoDeDano; if ((int)tipoDeDano != 1) { if ((int)tipoDeDano != 4) { if ((int)tipoDeDano == 32) { dano.m_fire = num; } else { dano.m_slash = num; } } else { dano.m_pierce = num; } } else { dano.m_blunt = num; } Ramos.SomarElementos(player, arma, num, ref dano); return dano; } internal static ItemData Invocada(Player player) { if ((Object)(object)player == (Object)null) { return null; } ItemData[] array = (ItemData[])(object)new ItemData[4] { ((Humanoid)player).m_rightItem, ((Humanoid)player).m_leftItem, ((Humanoid)player).m_hiddenRightItem, ((Humanoid)player).m_hiddenLeftItem }; foreach (ItemData val in array) { if (EhEspectral(val)) { return val; } } return null; } internal static void Alternar(Player player) { ItemData val = Invocada(player); if (val != null) { invocarAte = 0f; ((Humanoid)player).UnequipItem(val, true); return; } if (invocarAte > 0f) { invocarAte = 0f; return; } Poder poder = Poderes.Escolhido(player); ArmaEspectral armaEspectral = DoPoder(poder); if (armaEspectral == null) { ((Character)player).Message((MessageType)2, (poder == Poder.Nenhum) ? "Escolha um modo de classe na árvore de talentos." : ("A arma espectral do " + Poderes.Nome[(int)poder] + " ainda não existe."), 0, (Sprite)null, false); } else if (((Character)player).InAttack() || ((Character)player).InDodge()) { invocarAte = Time.time + 1.5f; } else { Invocar(player, armaEspectral); } } internal static void AtualizarFila(Player player) { if (invocarAte <= 0f) { return; } if (Time.time > invocarAte || ((Character)player).IsDead()) { invocarAte = 0f; } else if (!((Character)player).InAttack() && !((Character)player).InDodge()) { invocarAte = 0f; ArmaEspectral armaEspectral = DoPoder(Poderes.Escolhido(player)); if (armaEspectral != null && Invocada(player) == null) { Invocar(player, armaEspectral); } } } internal static bool Invocar(Player player, ArmaEspectral arma) { GameObject val = PrefabPara(arma, player); if ((Object)(object)val == (Object)null) { Plugin.Log.LogWarning((object)(NomePara(arma, player) + ": o prefab não foi criado.")); return false; } ItemData val2 = val.GetComponent<ItemDrop>().m_itemData.Clone(); val2.m_dropPrefab = val; val2.m_stack = 1; val2.m_quality = 1; val2.m_durability = val2.GetMaxDurability(); if (!((Humanoid)player).EquipItem(val2, true)) { ((Character)player).Message((MessageType)2, "Agora não dá para invocar a arma.", 0, (Sprite)null, false); return false; } return true; } internal static void Registrar() { PrefabManager.OnVanillaPrefabsAvailable += CriarItens; } private static void CriarItens() { PrefabManager.OnVanillaPrefabsAvailable -= CriarItens; foreach (ArmaEspectral toda in Todas) { try { if (toda.Elementos != null) { EssenciaDoMago.CriarItens(toda); } else { CriarItem(toda); } } catch (Exception arg) { Plugin.Log.LogError((object)$"{toda.Nome}: erro ao criar o item: {arg}"); } } } private static void CriarItem(ArmaEspectral arma) { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected O, but got Unknown //IL_0122: Unknown result type (might be due to invalid IL or missing references) string text = arma.Modelos.FirstOrDefault((string nome) => (Object)(object)PrefabManager.Instance.GetPrefab(nome) != (Object)null); if (text == null) { Plugin.Log.LogWarning((object)(arma.Nome + ": nenhum modelo do jogo encontrado (" + string.Join(", ", arma.Modelos) + ").")); return; } CustomItem val = new CustomItem(arma.Prefab, text); if ((Object)(object)val.ItemPrefab == (Object)null || (Object)(object)val.ItemDrop == (Object)null) { Plugin.Log.LogWarning((object)(arma.Nome + ": não deu para copiar " + text + ".")); return; } SharedData shared = val.ItemDrop.m_itemData.m_shared; Sprite val2 = ((shared.m_icons != null && shared.m_icons.Length != 0) ? shared.m_icons[0] : null); shared.m_name = arma.Nome; shared.m_description = arma.Descricao; shared.m_weight = 0f; shared.m_value = 0; shared.m_maxQuality = 1; shared.m_useDurability = false; shared.m_canBeReparied = false; shared.m_teleportable = true; shared.m_damagesPerLevel = default(DamageTypes); arma.Ajustar?.Invoke(shared); arma.Icone = (((Object)(object)val2 != (Object)null) ? VisualEspectral.Dourar(val2) : null); if ((Object)(object)arma.Icone == (Object)null) { arma.Icone = (((Object)(object)val2 != (Object)null) ? val2 : Icone.Arvore); } shared.m_icons = (Sprite[])(object)new Sprite[1] { arma.Icone }; VisualEspectral.Aplicar(val.ItemPrefab); ItemManager.Instance.AddItem(val); arma.PrefabCriado = val.ItemPrefab; Plugin.Log.LogInfo((object)("Item pronto: " + arma.Nome + " (modelo " + text + ").")); } private static void SemFlechas(SharedData dados) { dados.m_ammoType = ""; GameObject prefab = PrefabManager.Instance.GetPrefab("ArrowWood"); ItemDrop val = (((Object)(object)prefab != (Object)null) ? prefab.GetComponent<ItemDrop>() : null); if ((Object)(object)val == (Object)null) { Plugin.Log.LogWarning((object)"Arco Espectral: não achei a flecha de madeira do jogo; o arco não vai atirar."); return; } Attack attack = val.m_itemData.m_shared.m_attack; Attack attack2 = dados.m_attack; attack2.m_projectileVel += attack.m_projectileVel; attack2.m_projectileVelMin += attack.m_projectileVelMin; attack2.m_projectileAccuracy += attack.m_projectileAccuracy; attack2.m_projectileAccuracyMin += attack.m_projectileAccuracyMin; attack2.m_attackHitNoise += attack.m_attackHitNoise; if (attack.m_drawVelocityCurve != null) { attack2.m_drawVelocityCurve = attack.m_drawVelocityCurve; } GameObject val2 = CriarFlechaEspectral(attack.m_attackProjectile); if ((Object)(object)val2 != (Object)null) { attack2.m_attackProjectile = val2; } } private static GameObject CriarFlechaEspectral(GameObject projetil) { if ((Object)(object)projetil == (Object)null) { Plugin.Log.LogWarning((object)"Arco Espectral: não achei o projétil da flecha do jogo; o arco não vai atirar."); return null; } GameObject val = PrefabManager.Instance.CreateClonedPrefab("ernandevc_FlechaEspectral", projetil); VisualEspectral.Aplicar(val); VisualEspectral.AdicionarLuz(val.transform, 1.5f, 1f); PrefabManager.Instance.AddPrefab(val); Plugin.Log.LogInfo((object)("Flecha espectral criada a partir de " + ((Object)projetil).name + ".")); return val; } } [HarmonyPatch(typeof(Player), "Update")] internal static class TeclaDaArmaEspectral { private static void Postfix(Player __instance) { if (!((Object)(object)__instance != (Object)(object)Player.m_localPlayer)) { if (((Character)__instance).TakeInput() && Teclas.Apertou(Plugin.TeclaArma)) { ArmasEspectrais.Alternar(__instance); } ArmasEspectrais.AtualizarFila(__instance); } } } [HarmonyPatch(typeof(Humanoid), "EquipItem")] internal static class EquiparArmaEspectral { private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instrucoes) { MethodInfo contem = AccessTools.Method(typeof(Inventory), "ContainsItem", (Type[])null, (Type[])null); List<CodeInstruction> list = instrucoes.ToList(); int num = list.FindIndex((CodeInstruction i) => CodeInstructionExtensions.Calls(i, contem)); if (num < 0) { Plugin.Log.LogWarning((object)"Arma espectral: não achei a checagem de inventário ao equipar; a arma não vai poder ser invocada."); return list; } list[num].opcode = OpCodes.Call; list[num].operand = AccessTools.Method(typeof(EquiparArmaEspectral), "ContemOuEspectral", (Type[])null, (Type[])null); return list; } private static bool ContemOuEspectral(Inventory inventario, ItemData item) { if (!ArmasEspectrais.EhEspectral(item)) { return inventario.ContainsItem(item); } return true; } } [HarmonyPatch(typeof(ItemData), "GetDamage", new Type[] { typeof(int), typeof(float) })] internal static class DanoDaArmaEspectral { private static void Postfix(ItemData __instance, float worldLevel, ref DamageTypes __result) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0050: 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) ArmaEspectral armaEspectral = ArmasEspectrais.DoItem(__instance); if (armaEspectral != null && !((Object)(object)Player.m_localPlayer == (Object)null)) { DamageTypes val = ArmasEspectrais.Dano(armaEspectral, Player.m_localPlayer, __instance); if (worldLevel > 0f && (Object)(object)Game.instance != (Object)null) { ((DamageTypes)(ref val)).IncreaseEqually(worldLevel * (float)Game.instance.m_worldLevelGearBaseDamage, true); } __result = val; } } } internal static class Arqueiro { internal static float RotaDeFugaAte; private static float rotaDeFugaProntaEm; internal static bool NaoGastaFlecha() { if (Poderes.PassivoAtivo(Poder.Vigilante)) { return true; } int num = Efeitos.N("aljava_infinita"); if (num > 0) { return Random.value < 0.1f * (float)num; } return false; } internal static void TentarRotaDeFuga(Player player) { if (!(Time.time < rotaDeFugaProntaEm) && Efeitos.N("rota_de_fuga") > 0) { RotaDeFugaAte = Time.time + 4f; rotaDeFugaProntaEm = Time.time + 60f; ((Character)player).Message((MessageType)1, "Rota de fuga!", 0, (Sprite)null, false); } } } [HarmonyPatch(typeof(Humanoid), "GetAttackDrawPercentage")] internal static class MaoFirmeArco { private static void Postfix(Humanoid __instance, ref float __result) { if (__result > 0f && __result < 1f && Efeitos.EhLocal((Character)(object)__instance)) { __result = Mathf.Clamp01(__result / (1f - 0.03f * (float)Efeitos.N("mao_firme"))); } } } [HarmonyPatch(typeof(ItemData), "GetWeaponLoadingTime")] internal static class MaoFirmeBesta { private static void Postfix(ref float __result) { if ((Object)(object)Player.m_localPlayer != (Object)null) { __result *= 1f - 0.03f * (float)Efeitos.N("mao_firme"); } } } [HarmonyPatch(typeof(ItemData), "GetDrawStaminaDrain")] internal static class RespiracaoControlada { private static void Postfix(ref float __result) { if ((Object)(object)Player.m_localPlayer != (Object)null) { __result *= 1f - 0.03f * (float)Efeitos.N("respiracao_controlada"); } } } [HarmonyPatch(typeof(Projectile), "Setup")] internal static class FlechaCerteira { private static void Prefix(Character owner, ref Vector3 velocity, ItemData item) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) if (Efeitos.EhLocal(owner) && item != null && Combate.Disparo(item.m_shared.m_skillType)) { velocity *= 1f + 0.1f * (float)Efeitos.N("flecha_certeira"); } } } [HarmonyPatch(typeof(Attack), "UseAmmo")] internal static class GastoDeFlecha { internal static bool Poupar; private static void Prefix(Attack __instance) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) Poupar = Efeitos.EhLocal((Character)(object)__instance.m_character) && __instance.m_weapon != null && Combate.Disparo(__instance.m_weapon.m_shared.m_skillType) && Arqueiro.NaoGastaFlecha(); } private static void Postfix() { Poupar = false; } } [HarmonyPatch(typeof(Inventory), "RemoveItem", new Type[] { typeof(ItemData), typeof(int) })] internal static class NaoTirarFlecha { private static bool Prefix(ref bool __result) { if (!GastoDeFlecha.Poupar) { return true; } __result = true; return false; } } [HarmonyPatch] internal static class VelocidadeDoArqueiro { private static IEnumerable<MethodBase> TargetMethods() { yield return AccessTools.Method(typeof(Player), "GetJogSpeedFactor", (Type[])null, (Type[])null); yield return AccessTools.Method(typeof(Player), "GetRunSpeedFactor", (Type[])null, (Type[])null); } private static void Postfix(Player __instance, ref float __result) { if (Efeitos.EhLocal((Character)(object)__instance)) { if (((Character)__instance).IsDrawingBow()) { __result *= 1f + 0.1f * (float)Efeitos.N("passos_de_cacador"); } if (Time.time < Arqueiro.RotaDeFugaAte) { __result *= 1.4f; } } } } [HarmonyPatch(typeof(Character), "RPC_Damage")] internal static class GatilhoRotaDeFuga { private static void Postfix(Character __instance, HitData hit) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown if (Efeitos.EhLocal(__instance) && hit != null && !hit.m_ranged && (Object)(object)hit.GetAttacker() != (Object)null && !__instance.IsDead()) { Arqueiro.TentarRotaDeFuga((Player)__instance); } } } internal static class AuraIluminado { private sealed class Anel { private const int Pontos = 72; private readonly GameObject objeto; private readonly LineRenderer linha; private readonly LineRenderer brilho; private readonly Vector3[] posicoes = (Vector3[])(object)new Vector3[72]; private float proximaAltura; private static Material material; private static int camadas; internal Anel() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) objeto = new GameObject("ernandevc_CirculoIluminado"); linha = Criar("Linha", 0.09f, new Color(1f, 0.86f, 0.45f, 0.9f)); brilho = Criar("Brilho", 0.45f, new Color(1f, 0.8f, 0.35f, 0.18f)); if (camadas == 0) { camadas = LayerMask.GetMask(new string[6] { "Default", "static_solid", "Default_small", "piece", "terrain", "vehicle" }); } } private LineRenderer Criar(string nome, float largura, Color cor) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown GameObject val = new GameObject(nome); val.transform.SetParent(objeto.transform, false); LineRenderer obj = val.AddComponent<LineRenderer>(); if ((Object)(object)material == (Object)null) { Shader val2 = Shader.Find("Sprites/Default"); material = new Material(((Object)(object)val2 != (Object)null) ? val2 : Shader.Find("UI/Default")); } ((Renderer)obj).sharedMaterial = material; obj.loop = true; obj.useWorldSpace = true; obj.positionCount = 72; obj.widthMultiplier = largura; obj.startColor = cor; obj.endColor = cor; ((Renderer)obj).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)obj).receiveShadows = false; obj.numCornerVertices = 2; return obj; } internal void Atualizar(Vector3 centro, float raio) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: 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_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: 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_00b3: 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_0094: Unknown result type (might be due to invalid IL or missing references) if (Time.time >= proximaAltura) { proximaAltura = Time.time + 0.1f; RaycastHit val2 = default(RaycastHit); for (int i = 0; i < 72; i++) { float num = (float)i * (float)Math.PI * 2f / 72f; Vector3 val = centro + new Vector3(Mathf.Cos(num) * raio, 0f, Mathf.Sin(num) * raio); float y = centro.y; if (Physics.Raycast(val + Vector3.up * 4f, Vector3.down, ref val2, 10f, camadas)) { y = ((RaycastHit)(ref val2)).point.y; } posicoes[i] = new Vector3(val.x, y + 0.08f, val.z); } } linha.SetPositions(posicoes); brilho.SetPositions(posicoes); } internal void Destruir() { Object.Destroy((Object)(object)objeto); } } private const string ChaveZdo = "ernandevc_circulo"; internal static int Hash; private static float proximaChecagem; private static readonly Dictionary<Player, Anel> Aneis = new Dictionary<Player, Anel>(); internal static float Bonus => Plugin.BonusDoCirculo.Value / 100f; internal static void RegistrarEfeitos() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown SE_Stats val = ScriptableObject.CreateInstance<SE_Stats>(); ((Object)val).name = "ernandevc_CirculoIluminado"; ((StatusEffect)val).m_name = "Círculo do Iluminado"; ((StatusEffect)val).m_tooltip = "Dentro do círculo do mago: mais vida, vigor e eitr máximos, dano, armadura e velocidade, e vida por segundo."; ((StatusEffect)val).m_ttl = 1.5f; ((StatusEffect)val).m_icon = Icone.Arvore; ItemManager.Instance.AddStatusEffect(new CustomStatusEffect((StatusEffect)(object)val, false)); Hash = ((StatusEffect)val).NameHash(); } internal static bool TemCirculo(Player player) { if ((Object)(object)player != (Object)null && (Object)(object)((Character)player).m_nview != (Object)null && ((Character)player).m_nview.IsValid()) { return ((Character)player).m_nview.GetZDO().GetBool("ernandevc_circulo", false); } return false; } internal static bool Dentro(Player player) { if ((Object)(object)player != (Object)null) { return ((Character)player).GetSEMan().HaveStatusEffect(Hash); } return false; } internal static void AtualizarLocal(Player player) { //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) ZDO zDO = ((Character)player).m_nview.GetZDO(); bool ativo = Iluminado.Ativo; if (zDO.GetBool("ernandevc_circulo", false) != ativo) { zDO.Set("ernandevc_circulo", ativo); } if (Time.time < proximaChecagem) { return; } proximaChecagem = Time.time + 0.5f; float value = Plugin.RaioDoCirculo.Value; bool flag = false; foreach (Player allPlayer in Player.GetAllPlayers()) { if (TemCirculo(allPlayer) && Vector3.Distance(((Component)allPlayer).transform.position, ((Component)player).transform.position) <= value) { flag = true; break; } } if (flag) { StatusEffect obj = ((Character)player).GetSEMan().AddStatusEffect(Hash, true, 0, 0f, (short)(-1)); SE_Stats val = (SE_Stats)(object)((obj is SE_Stats) ? obj : null); if (val != null) { ((StatusEffect)val).m_icon = IconesVetor.Pegar("sol") ?? Icone.Arvore; val.m_speedModifier = Bonus; val.m_modifyAttackSkill = (SkillType)999; val.m_damageModifier = 1f + Bonus; val.m_armorMultiplier = Bonus; val.m_tickInterval = 1f; val.m_healthPerTick = Plugin.CuraDoCirculo.Value; } } } internal static void AtualizarAnel(Player player) { //IL_0056: Unknown result type (might be due to invalid IL or missing references) bool num = TemCirculo(player) && !((Character)player).IsDead(); Aneis.TryGetValue(player, out var value); if (!num) { if (value != null) { value.Destruir(); Aneis.Remove(player); } return; } if (value == null) { value = new Anel(); Aneis[player] = value; } value.Atualizar(((Component)player).transform.position, Plugin.RaioDoCirculo.Value); } internal static void Esquecer(Player player) { if (Aneis.TryGetValue(player, out var value)) { value.Destruir(); Aneis.Remove(player); } } } [HarmonyPatch(typeof(Player), "Update")] internal static class CirculoDoIluminado { private static void Postfix(Player __instance) { if (!((Object)(object)((Character)__instance).m_nview == (Object)null) && ((Character)__instance).m_nview.IsValid()) { if ((Object)(object)__instance == (Object)(object)Player.m_localPlayer) { AuraIluminado.AtualizarLocal(__instance); } if (!GUIManager.IsHeadless()) { AuraIluminado.AtualizarAnel(__instance); } } } } [HarmonyPatch(typeof(Player), "OnDestroy")] internal static class CirculoSomeComOJogador { private static void Prefix(Player __instance) { if ((Object)(object)__instance != (Object)null) { AuraIluminado.Esquecer(__instance); } } } internal static class Berserker { internal const float DanoRecebido = 0.5f; internal static bool Ativo => Poderes.Ativo(Poder.Berserker); internal static void Iniciar() { Poderes.AoAtivar += delegate(Player player, Poder poder) { if (poder == Poder.Berserker) { ((Character)player).Message((MessageType)1, "Fúria: você recebe só metade do dano enquanto ela durar.", 0, (Sprite)null, false); } }; } } [HarmonyPatch(typeof(CharacterAnimEvent), "CustomFixedUpdate")] internal static class AtaqueRapido { private static void Postfix(CharacterAnimEvent __instance) { Character character = __instance.m_character; if (Efeitos.EhLocal(character) && Berserker.Ativo && character.InAttack() && __instance.m_pauseTimer <= 0f && __instance.m_animator.speed >= 0.01f) { __instance.m_animator.speed = 3f; } } } [HarmonyPatch(typeof(Attack), "GetAttackStamina")] internal static class AtaqueSemVigor { [HarmonyPriority(0)] private static void Postfix(Attack __instance, ref float __result) { if (Efeitos.EhLocal((Character)(object)__instance.m_character) && Berserker.Ativo) { __result = 0f; } } } [HarmonyPatch(typeof(Character), "RPC_Damage")] internal static class AparoDoBerserker { [HarmonyPriority(800)] private static void Prefix(Character __instance, HitData hit) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) if (hit == null || !Efeitos.EhLocal(__instance) || !Berserker.Ativo || __instance.IsDead()) { return; } Player val = (Player)__instance; Character attacker = hit.GetAttacker(); if (!((Object)(object)attacker == (Object)null) && !((Object)(object)attacker == (Object)(object)val)) { if (attacker.m_staggerWhenBlocked) { attacker.Stagger(-hit.m_dir); } ((Humanoid)val).m_perfectBlockEffect.Create(hit.m_point, Quaternion.identity, (Transform)null, 1f, -1, ((Character)val).GetZDOID()); } } } [HarmonyPatch(typeof(Character), "ApplyDamage")] internal static class MetadeDoDano { [HarmonyPriority(800)] private static void Prefix(Character __instance, HitData hit) { if (hit != null && Efeitos.EhLocal(__instance) && Berserker.Ativo) { hit.ApplyModifier(0.5f); } } } internal static class BarraDoInventario { private static readonly Color Teal = Desenho.Cor("#3fd0c0"); private static RectTransform barra; private static Text saldo; private static RectTransform zona; private static RectTransform aviso; private static RectTransform tinta; private static Text resumo; private static Text total; private static bool montadaEmLote; private static long ultimoSaldo = -1L; private static int ultimoResumo = -1; internal static void Criar(InventoryGui gui) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)barra != (Object)null) && !((Object)(object)gui.m_player == (Object)null)) { RectTransform player = gui.m_player; Rect rect = player.rect; float num = Mathf.Max(400f, ((Rect)(ref rect)).width); barra = Kit.Retangulo("TalentosErnandevc_Barra", (Transform)(object)player, 0f, 0f, num, 84f); barra.anchorMin = new Vector2(0f, 0f); barra.anchorMax = new Vector2(0f, 0f); barra.anchoredPosition = new Vector2(Plugin.BarraX.Value, -12f - Plugin.BarraY.Value); RectTransform obj = Kit.Retangulo("Arvore", (Transform)(object)barra, 0f, 0f, 84f, 84f); Image clarear = Kit.Caixa(obj, Desenho.Cor("#241a11"), Desenho.Cor("#5d4329"), 6, 3, clicavel: true); Kit.Imagem((Transform)(object)obj, Icone.Arvore, Color.white, 24f, 8f, 36f, 36f); saldo = Kit.Texto((Transform)(object)obj, "0", 2f, 50f, 80f, 22f, 14, Desenho.Cor("#ffd59a"), negrito: true, (TextAnchor)4); Interacao interacao = ((Component)obj).gameObject.AddComponent<Interacao>(); interacao.EscalaNoHover = 1.03f; interacao.Clarear = (Graphic)(object)clarear; interacao.AoClicar = Janela.Alternar; zona = Kit.Retangulo("Oferenda", (Transform)(object)barra, 94f, 0f, num - 94f, 84f); aviso = Kit.Retangulo("TalentosErnandevc_AvisoOferenda", (Transform)(object)player, 0f, 0f, 420f, 28f); aviso.anchorMin = new Vector2(0f, 1f); aviso.anchorMax = new Vector2(0f, 1f); aviso.pivot = new Vector2(0f, 0f); aviso.anchoredPosition = new Vector2(0f, 8f); Kit.Caixa(aviso, Desenho.Cor("#12302d"), Teal, 14, 2); Text val = Kit.Texto((Transform)(object)aviso, "Oferenda: escolha os itens que vão virar Essência", 14f, 0f, 400f, 28f, 14, Desenho.Cor("#dffaf6"), negrito: true, (TextAnchor)3); aviso.sizeDelta = new Vector2(Mathf.Ceil(val.preferredWidth) + 28f, 28f); tinta = Kit.Cheio("TalentosErnandevc_Tinta", (Transform)(object)player, -4f); Kit.Pintar(tinta, Desenho.Arredondado(8), new Color(0.12f, 0.45f, 0.42f, 0.16f), fatiado: true); Kit.Pintar(Kit.Cheio("Borda", (Transform)(object)tinta), Desenho.Moldura(8, 3), Teal, fatiado: true); MontarZona(emLote: false); Atualizar(gui); } } private static void MontarZona(bool emLote) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) Kit.Limpar((Transform)(object)zona); Image component = ((Component)zona).GetComponent<Image>(); if ((Object)(object)component != (Object)null) { Object.DestroyImmediate((Object)(object)component); } montadaEmLote = emLote; ultimoResumo = -1; float x = zona.sizeDelta.x; if (!emLote) { Image clarear = Kit.Caixa(zona, Desenho.Cor("#1d2725"), Desenho.Cor("#48605b"), 6, 3, clicavel: true); Kit.Imagem((Transform)(object)zona, Icone.Essencia, Color.white, 16f, 20f, 40f, 44f); Kit.Texto((Transform)(object)zona, "OFERENDA", 68f, 12f, x - 80f, 30f, 22, Desenho.Cor("#cfeee9"), negrito: true, (TextAnchor)0); Kit.Texto((Transform)(object)zona, "Solte um item aqui · clique sem item para oferecer vários", 68f, 44f, x - 80f, 24f, 14, Desenho.Cor("#b7d6d1"), negrito: false, (TextAnchor)0); Interacao obj = ((Component)zona).gameObject.GetComponent<Interacao>() ?? ((Component)zona).gameObject.AddComponent<Interacao>(); obj.EscalaNoHover = 1f; obj.Clarear = (Graphic)(object)clarear; obj.AoClicar = Oferenda.AoClicar; return; } Interacao component2 = ((Component)zona).gameObject.GetComponent<Interacao>(); if ((Object)(object)component2 != (Object)null) { component2.AoClicar = null; component2.Clarear = null; } Kit.Caixa(zona, Desenho.Cor("#163b37"), Teal, 6, 3, clicavel: true); resumo = Kit.Texto((Transform)(object)zona, "", 18f, 10f, x - 270f, 22f, 14, Desenho.Cor("#b7e6df"), negrito: false, (TextAnchor)0); total = Kit.Texto((Transform)(object)zona, "", 18f, 34f, x - 270f, 34f, 24, Desenho.Cor("#ffe39a"), negrito: true, (TextAnchor)0); Kit.Botao((Transform)(object)zona, "Oferecer", x - 246f, 20f, 112f, 44f, Oferenda.PedirConfirmacao); Kit.Botao((Transform)(object)zona, "Cancelar", x - 126f, 20f, 112f, 44f, Oferenda.SairDoLote); } internal static void Atualizar(InventoryGui gui) { if ((Object)(object)barra == (Object)null) { return; } Player localPlayer = Player.m_localPlayer; bool flag = gui.IsContainerOpen(); if (flag && Oferenda.EmLote) { Oferenda.SairDoLote(); } if (((Component)barra).gameObject.activeSelf == flag) { ((Component)barra).gameObject.SetActive(!flag); } bool emLote = Oferenda.EmLote; if (((Component)aviso).gameObject.activeSelf != emLote) { ((Component)aviso).gameObject.SetActive(emLote); ((Component)tinta).gameObject.SetActive(emLote); } if ((Object)(object)localPlayer == (Object)null) { return; } long num = Essencia.Saldo(localPlayer); if (num != ultimoSaldo) { ultimoSaldo = num; saldo.text = Essencia.Formatar(num); } if (montadaEmLote != emLote) { MontarZona(emLote); } Inventory inventory = ((Humanoid)localPlayer).GetInventory(); if (emLote) { Oferenda.Conferir(inventory); int quantos = Oferenda.Quantos; if (quantos != ultimoResumo) { ultimoResumo = quantos; resumo.text = ((quantos == 0) ? "Clique nos itens para marcar" : string.Format("{0} {1}", quantos, (quantos == 1) ? "item marcado" : "itens marcados")); total.text = "+" + Essencia.Formatar(Oferenda.Total()) + " Essência"; } if (Input.GetKeyDown((KeyCode)13) || Input.GetKeyDown((KeyCode)271)) { Oferenda.PedirConfirmacao(); } } MarcarEspacos(gui.m_playerGrid, inventory, emLote); } private static void MarcarEspacos(InventoryGrid grade, Inventory inventario, bool emLote) { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)grade == (Object)null || grade.m_elements == null) { return; } foreach (InventoryElement element in grade.m_elements) { if ((Object)(object)element == (Object)null) { continue; } MarcaDaOferenda marcaDaOferenda = ((Component)element).GetComponent<MarcaDaOferenda>(); if (!emLote) { if ((Object)(object)marcaDaOferenda != (Object)null) { marcaDaOferenda.Esconder(); } continue; } if ((Object)(object)marcaDaOferenda == (Object)null) { marcaDaOferenda = ((Component)element).gameObject.AddComponent<MarcaDaOferenda>(); } ItemData itemAt = inventario.GetItemAt(element.Position.x, element.Position.y); marcaDaOferenda.Mostrar(itemAt); } } } internal sealed class MarcaDaOferenda : MonoBehaviour { private Image fundo; private Image borda; private Image veu; private RectTransform selo; private Text valor; private ItemData mostrado; private int estado = -1; private void Montar() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)fundo != (Object)null)) { RectTransform val = (RectTransform)((Component)this).transform; fundo = Kit.Pintar(Kit.Cheio("ernandevc_fundo", (Transform)(object)val, 1f), Desenho.Arredondado(3), Color.clear, fatiado: true); InventoryElement component = ((Component)this).GetComponent<InventoryElement>(); Transform val2 = (((Object)(object)component != (Object)null && (Object)(object)component.m_icon != (Object)null) ? ((Component)component.m_icon).transform : null); while ((Object)(object)val2 != (Object)null && (Object)(object)val2.parent != (Object)(object)val) { val2 = val2.parent; } ((Component)fundo).transform.SetSiblingIndex(((Object)(object)val2 != (Object)null) ? val2.GetSiblingIndex() : 0); veu = Kit.Pintar(Kit.Cheio("ernandevc_veu", (Transform)(object)val, 1f), Desenho.Arredondado(3), new Color(0.05f, 0.07f, 0.1f, 0.55f), fatiado: true); borda = Kit.Pintar(Kit.Cheio("ernandevc_borda", (Transform)(object)val), Desenho.Moldura(3, 3), Desenho.Cor("#f2c14e"), fatiado: true); selo = Kit.Retangulo("ernandevc_valor", (Transform)(object)val, 0f, 0f, 60f, 18f); selo.anchorMin = new Vector2(1f, 1f); selo.anchorMax = new Vector2(1f, 1f); selo.pivot = new Vector2(1f, 0.5f); selo.anchoredPosition = new Vector2(6f, 0f); Kit.Caixa(selo, Desenho.Cor("#3a2c0e"), Desenho.Cor("#f2c14e"), 9, 1); valor = Kit.Texto((Transform)(object)selo, "", 0f, 0f, 60f, 18f, 11, Desenho.Cor("#ffe39a"), negrito: true, (TextAnchor)4); } } internal void Mostrar(ItemData item) { //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) Montar(); bool flag = Oferenda.Marcado(item); int num = ((item != null) ? (item.m_equipped ? 1 : (flag ? 2 : 3)) : 0); if (num != estado || item != mostrado || (flag && valor.text.Length == 0)) { estado = num; mostrado = item; ((Behaviour)fundo).enabled = true; ((Graphic)fundo).color = (flag ? new Color(0.23f, 0.17f, 0.055f, 0.9f) : new Color(0.08f, 0.27f, 0.26f, 0.55f)); ((Behaviour)veu).enabled = item?.m_equipped ?? false; ((Component)veu).transform.SetAsLastSibling(); ((Behaviour)borda).enabled = flag; ((Component)borda).transform.SetAsLastSibling(); ((Component)selo).gameObject.SetActive(flag); if (flag) { valor.text = "+" + Essencia.Formatar(Oferenda.ValorDe(item)); float num2 = Mathf.Ceil(valor.preferredWidth) + 12f; selo.sizeDelta = new Vector2(num2, 18f); ((Graphic)valor).rectTransform.sizeDelta = new Vector2(num2, 18f); ((Transform)selo).SetAsLastSibling(); } } } internal void Esconder() { if (!((Object)(object)fundo == (Object)null) && estado != -1) { estado = -1; mostrado = null; ((Behaviour)fundo).enabled = false; ((Behaviour)veu).enabled = false; ((Behaviour)borda).enabled = false; ((Component)selo).gameObject.SetActive(false); } } } [HarmonyPatch(typeof(InventoryGui), "Show")] internal static class CriarBarraDoInventario { private static void Postfix(InventoryGui __instance) { BarraDoInventario.Criar(__instance); } } [HarmonyPatch(typeof(InventoryGui), "Update")] internal static class AtualizarBarraDoInventario { private static void Postfix(InventoryGui __instance) { if (InventoryGui.IsVisible()) { BarraDoInventario.Atualizar(__instance); } } } [HarmonyPatch(typeof(InventoryGui), "Hide")] internal static class FecharComInventario { private static void Postfix() { Janela.Fechar(); Oferenda.SairDoLote(); } } internal enum Arvore { Guerreiro, Arqueiro, Mago, Utilidades } internal sealed class Talento { internal string Id; internal Arvore Arvore; internal int Fileira; internal string Nome; internal int NiveisMax; internal string Icone; internal string Chave; private readonly string sinal; private readonly float valor; private readonly string unidade; private readonly string texto; private readonly Func<int, string> porNivel; internal Talento(string id, Arvore arvore, int fileira, string nome, int niveisMax, string icone, string sinal, float valor, string unidade, string texto) : this(id, arvore, fileira, nome, niveisMax, icone, null) { this.sinal = sinal; this.valor = valor; this.unidade = unidade; this.texto = texto; } internal Talento(string id, Arvore arvore, int fileira, string nome, int niveisMax, string icone, Func<int, string> porNivel) { Id = id; Arvore = arvore; Fileira = fileira; Nome = nome; NiveisMax = niveisMax; Icone = icone; this.porNivel = porNivel; Chave = "ernandevc.talentos.nivel." + id; } internal string Efeito(int n) { if (n <= 0) { return "ainda não aprendido"; } if (porNivel != null) { return porNivel(Math.Min(n, NiveisMax)); } return sinal + Catalogo.Numero(valor * (float)n) + unidade + " " + texto; } } internal static class Catalogo { internal static readonly string[] NomeArvore = new string[4] { "Guerreiro", "Arqueiro", "Mago", "Utilidades" }; internal static readonly string[] IconeArvore = new string[4] { "espada", "arco", "chama", "mochila" }; private static readonly CultureInfo PtBr = new CultureInfo("pt-BR"); internal static readonly List<Talento> Todos = new List<Talento> { new Talento("forca_bruta", Arvore.Guerreiro, 1, "Força Bruta", 5, "punho", "+", 3f, "%", "de dano corpo a corpo"), new Talento("couro_de_troll", Arvore.Guerreiro, 1, "Couro de Troll", 5, "coracao", "+", 3f, "", "de vida máxima"), new Talento("folego_de_guerra", Arvore.Guerreiro, 1, "Fôlego de Guerra", 5, "vento", "−", 3f, "%", "de vigor nos ataques corpo a corpo"), new Talento("muralha_de_escudos", Arvore.Guerreiro, 2, "Muralha de Escudos", 3, "escudo", (int n) => $"+{10 * n}% de bloqueio e −{5 * n}% de vigor ao bloquear"), new Talento("aparo_perfeito", Arvore.Guerreiro, 2, "Aparo Perfeito", 3, "espada", "+", 20f, "%", "na janela de aparo"), new Talento("golpe_atordoante", Arvore.Guerreiro, 2, "Golpe Atordoante", 3, "faisca", "+", 15f, "%", "de atordoamento causado"), new Talento("sede_de_sangue", Arvore.Guerreiro, 3, "Sede de Sangue", 3, "gota", "", 2f, "%", "do dano corpo a corpo vira vida"), new Talento("golpe_de_misericordia", Arvore.Guerreiro, 3, "Golpe de Misericórdia", 3, "caveira", "+", 10f, "%", "de dano em alvo com menos de 30% de vida"), new Talento("valhalla_pode_esperar", Arvore.Guerreiro, 3, "Valhalla Pode Esperar", 1, "asas", (int n) => "abaixo de 20% de vida: metade do vigor e 30% menos dano por 8 s (recarga de 5 min)"), new Talento("olho_de_aguia", Arvore.Arqueiro, 1, "Olho de Águia", 5, "olho", "+", 3f, "%", "de dano com arco e besta"), new Talento("mao_firme", Arvore.Arqueiro, 1, "Mão Firme", 5, "mao", "−", 3f, "%", "no tempo para puxar o arco"), new Talento("respiracao_controlada", Arvore.Arqueiro, 1, "Respiração Controlada", 5, "vento", "−", 3f, "%", "de vigor ao puxar e segurar o arco"), new Talento("cacador_silencioso", Arvore.Arqueiro, 2, "Caçador Silencioso", 3, "adaga", "+", 15f, "%", "de dano no ataque furtivo"), new Talento("flecha_certeira", Arvore.Arqueiro, 2, "Flecha Certeira", 3, "flecha", "+", 10f, "%", "de velocidade da flecha"), new Talento("aljava_infinita", Arvore.Arqueiro, 2, "Aljava Infinita", 3, "infinito", "", 10f, "%", "de chance de não gastar a flecha"), new Talento("passos_de_cacador", Arvore.Arqueiro, 3, "Passos de Caçador", 3, "pegadas", "−", 10f, "%", "na lentidão com o arco puxado"), new Talento("tiro_de_longe", Arvore.Arqueiro, 3, "Tiro de Longe", 3, "alvo", "+", 10f, "%", "de dano em alvos a mais de 25 m"), new Talento("rota_de_fuga", Arvore.Arqueiro, 3, "Rota de Fuga", 1, "corrida", (int n) => "golpe corpo a corpo recebido: +40% de velocidade por 4 s (recarga de 1 min)"), new Talento("reserva_arcana", Arvore.Mago, 1, "Reserva Arcana", 5, "frasco", "+", 24f, "", "de eitr máximo"), new Talento("fluxo_de_eter", Arvore.Mago, 1, "Fluxo de Éter", 5, "ondas", "+", 4f, "%", "de regeneração de eitr"), new Talento("foco_elemental", Arvore.Mago, 1, "Foco Elemental", 5, "cristal", "+", 3f, "%", "de dano mágico"), new Talento("economia_arcana", Arvore.Mago, 2, "Economia Arcana", 3, "moeda", "−", 5f, "%", "de eitr gasto por magia"), new Talento("inspiracao_profunda", Arvore.Mago, 2, "Inspiração Profunda", 3, "livro", "+", 10f, "%", "de ganho de Inspiração (com tomo)"), new Talento("passo_etereo", Arvore.Mago, 2, "Passo Etéreo", 3, "teleporte", (int n) => $"magia (tecla {Tecla(Plugin.TeclaPassoEtereo)}): teleporte de {4 + 2 * n} m, 20 de eitr"), new Talento("escudo_de_mana", Arvore.Mago, 3, "Escudo de Mana", 3, "escudogota", "", 10f, "%", "do dano recebido sai do eitr"), new Talento("nova_gelida", Arvore.Mago, 3, "Nova Gélida", 3, "floco", (int n) => $"magia (tecla {Tecla(Plugin.TeclaNovaGelida)}): {(new int[3] { 30, 50, 80 })[n - 1]} de gelo a 6 m e 50% mais lento por 4 s, 40 de eitr"), new Talento("barreira_arcana", Arvore.Mago, 3, "Barreira Arcana", 3, "hexagono", (int n) => $"magia (tecla {Tecla(Plugin.TeclaBarreiraArcana)}): escudo de {60 * n} por 6 s, 30 de eitr"), new Talento("costas_de_mula", Arvore.Utilidades, 1, "Costas de Mula", 5, "mochila", "+", 40f, "", "de peso carregado"), new Talento("folego_de_corredor", Arvore.Utilidades, 1, "Fôlego de Corredor", 5, "vento", (int n) => (n < 5) ? $"−{20 * n}% de vigor ao correr" : "correr não gasta vigor"), new Talento("barriga_cheia", Arvore.Utilidades, 1, "Barriga Cheia", 5, "tigela", "+", 40f, "%", "de duração da comida"), new Talento("pernas_de_cervo", Arvore.Utilidades, 2, "Pernas de Cervo", 5, "galhada", "+", 10f, "%", "de velocidade de movimento"), new Talento("lenhador_e_minerador", Arvore.Utilidades, 2, "Lenhador e Minerador", 3, "machado", "+", 50f, "%", "de dano em árvores e minérios"), new Talento("vigor_de_ferro", Arvore.Utilidades, 2, "Vigor de Ferro", 5, "raio", "+", 20f, "", "de vigor máximo"), new Talento("repouso_profundo", Arvore.Utilidades, 3, "Repouso Profundo", 3, "lua", "+", 10f, " min", "de Descansado"), new Talento("colheita_farta", Arvore.Utilidades, 3, "Colheita Farta", 3, "trigo", "", 15f, "%", "de chance de item extra ao colher"), new Talento("sangue_quente", Arvore.Utilidades, 3, "Sangue Quente", 1, "chama", (int n) => "imune a Frio e Congelando") }; internal static readonly Dictionary<string, Talento> PorId = Todos.ToDictionary((Talento t) => t.Id); internal static int Custo(int fileira) { return Plugin.CustoFileira[fileira].Value; } internal static int Requisito(int fileira) { if (fileira > 1) { return Plugin.RequisitoFileira[fileira].Value; } return 0; } internal static string Numero(float valor) { return valor.ToString("0.#", PtBr); } private static string Tecla(ConfigEntry<KeyboardShortcut> tecla) { //IL_0007: 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) return ((tecla != null) ? ((object)tecla.Value/*cast due to .constrained prefix*/).ToString() : null) ?? "?"; } internal static List<Talento> DaArvore(Arvore arvore, int fileira) { return Todos.Where((Talento t) => t.Arvore == arvore && t.Fileira == fileira).ToList(); } internal static int Nivel(Player player, Talento talento) { if ((Object)(object)player != (Object)null && player.m_customData.TryGetValue(talento.Chave, out var value) && int.TryParse(value, NumberStyles.Integer, CultureInfo.InvariantCulture, out var result)) { return result; } return 0; } internal static int NiveisGastos(Player player, Arvore arvore) { return Todos.Where((Talento t) => t.Arvore == arvore).Sum((Talento t) => Nivel(player, t)); } internal static bool FileiraAberta(Player player, Arvore arvore, int fileira) { return NiveisGastos(player, arvore) >= Requisito(fileira); } internal static string Comprar(Player player, Talento talento) { int num = Nivel(player, talento); int num2 = Custo(talento.Fileira); if (num >= talento.NiveisMax) { return talento.Nome + " já está no nível máximo."; } if (!FileiraAberta(player, talento.Arvore, talento.Fileira)) { return $"A fileira {talento.Fileira} abre com {Requisito(talento.Fileira)} níveis gastos em {NomeArvore[(int)talento.Arvore]}."; } if (!Essencia.Gastar(player, num2)) { return "Falta Essência: " + talento.Nome + " custa " + Essencia.Formatar(num2) + "."; } player.m_customData[talento.Chave] = (num + 1).ToString(CultureInfo.InvariantCulture); return $"{talento.Nome} subiu para o nível {num + 1}."; } } internal sealed class Chefe { internal string Id; internal string Nome; internal string Atributo; internal string[] NomesInternos; internal string Chave; internal Chefe(string id, string nome, string atributo, params string[] nomesInternos) { Id = id; Nome = nome; Atributo = atributo; NomesInternos = nomesInternos; Chave = "ernandevc.talentos.chefe." + id; } } internal static class Chefes { internal const string RpcDerrotado = "ernandevc.talentos.ChefeDerrotado"; internal static readonly List<Chefe> Todos = new List<Chefe> { new Chefe("eikthyr", "Eikthyr", "+7,5 de vigor máximo e −5% de vigor ao correr e pular", "$enemy_eikthyr"), new Chefe("anciao", "Ancião", "+7,5 de vida máxima e +12,5% de dano em árvores", "$enemy_gdking"), new Chefe("massa_ossea", "Massa Óssea", "+12,5% de resistência a veneno", "$enemy_bonemass"), new Chefe("moder", "Moder", "+12,5% de resistência a gelo", "$enemy_dragon"), new Chefe("yagluth", "Yagluth", "+12,5% de resistência a fogo", "$enemy_goblinking"), new Chefe("rainha", "A Rainha", "+10 de eitr máximo", "$enemy_seekerqueen"), new Chefe("fader", "Fader", "+2,5% de dano em todos os ataques", "$enemy_fader"), new Chefe("kall", "Kall Fimbulbringer", "+5% de resistência a dano físico", "$enemy_frozenking", "$enemy_frozenking_p3") }; private static readonly Dictionary<string, Chefe> PorId = Todos.ToDictionary((Chefe c) => c.Id); internal static Chefe PorNomeInterno(string nome) { return Todos.FirstOrDefault((Chefe c) => c.NomesInternos.Contains(nome)); } internal static bool Derrotado(Player player, Chefe chefe) { if ((Object)(object)player != (Object)null) { return player.m_customData.ContainsKey(chefe.Chave); } return false; } internal static bool D(string id) { return Derrotado(Player.m_localPlayer, PorId[id]); } internal static void RPC_Derrotado(long remetente, string id) { Player localPlayer = Player.m_localPlayer; if (!((Object)(object)localPlayer == (Object)null) && PorId.TryGetValue(id, out var value) && !Derrotado(localPlayer, value)) { localPlayer.m_customData[value.Chave] = "1"; ((Character)localPlayer).Message((MessageType)2, value.Nome + " derrotado! Atributo permanente: " + value.Atributo, 0, (Sprite)null, false); Janela.AtualizarSeAberta(); } } } [HarmonyPatch(typeof(Game), "Start")] internal static class RegistrarRpcChefes { private static void Postfix() { ZRoutedRpc.instance.Register<string>("ernandevc.talentos.ChefeDerrotado", (Action<long, string>)Chefes.RPC_Derrotado); } } [HarmonyPatch(typeof(Character), "RPC_Damage")] internal static class ResistenciasDosChefes { private static void Prefix(Character __instance, HitData hit) { if (hit != null && Efeitos.EhLocal(__instance)) { if (Chefes.D("massa_ossea")) { hit.m_damage.m_poison *= 0.875f; } if (Chefes.D("moder")) { hit.m_damage.m_frost *= 0.875f; } if (Chefes.D("yagluth")) { hit.m_damage.m_fire *= 0.875f; } if (Chefes.D("kall")) { hit.m_damage.m_blunt *= 0.95f; hit.m_damage.m_slash *= 0.95f; hit.m_damage.m_pierce *= 0.95f; } } } } [HarmonyPatch(typeof(SEMan), "ModifyJumpStaminaUsage")] internal static class PuloDeEikthyr { private static void Postfix(SEMan __instance, ref float staminaUse) { if (Efeitos.EhLocal(__instance.m_character) && Chefes.D("eikthyr")) { staminaUse *= 0.95f; } } } internal sealed class ComandoTeste : ConsoleCommand { private const int NiveisDePoder = 5; private static readonly Poder[] PoderesDeClasse = new Poder[3] { Poder.Berserker, Poder.Vigilante, Poder.Iluminado }; public override string Name => "test-adm"; public override string Help => "Árvore da Essência: Essência para completar as árvores e os atributos de todos os chefes"; internal static void Registrar() { CommandManager.Instance.AddConsoleCommand((ConsoleCommand)(object)new ComandoTeste()); CommandManager.Instance.AddConsoleCommand((ConsoleCommand)(object)new ComandoSemRecarga()); } public override void Run(string[] args) { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { Console.instance.Print("Entre no mundo antes de usar o test-adm."); return; } long num = Catalogo.Todos.Sum((Talento t) => (long)t.NiveisMax * (long)Catalogo.Custo(t.Fileira)); long num2 = 0L; for (int num3 = 2; num3 <= 5; num3++) { num2 += Poderes.CustoDoNivel(num3) * PoderesDeClasse.Length; } for (int num4 = 2; num4 <= 8; num4++) { num2 += ArmasEspectrais.CustoDoNivel(num4) * ArmasEspectrais.Todas.Count; } long num5 = 0L; foreach (ArmaEspectral toda in ArmasEspectrais.Todas) { for (int num6 = 0; num6 < 3; num6++) { for (int num7 = 1; num7 <= Ramos.MaxDoNo(toda, num6); num7++) { num5 += Ramos.Custo(num6, num7) * Ramos.Todos.Count; } } } num2 += num5; Essencia.Adicionar(localPlayer, num + num2); foreach (Chefe todo in Chefes.Todos) { localPlayer.m_customData[todo.Chave] = "1"; } Poderes.ZerarRecarga(localPlayer); Janela.AtualizarSeAberta(); string text = $"+{Essencia.Formatar(num + num2)} Essência de Valheim e os {Chefes.Todos.Count} chefes liberados"; ((Character)localPlayer).Message((MessageType)2, text, 0, (Sprite)null, false); Console.instance.Print($"test-adm: {text} (talentos {Essencia.Formatar(num)}; poderes até o nível {5}, " + "Potência das armas até o 8 e todos os ramos " + Essencia.Formatar(num2) + "). Recarga do poder zerada."); } } internal sealed class ComandoSemRecarga : ConsoleCommand { public override string Name => "test-recarga"; public override string Help => "Árvore da Essência: liga/desliga a recarga do modo de classe (para testes)"; public override void Run(string[] args) { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { Console.instance.Print("Entre no mundo antes de usar o test-recarga."); return; } string text = (Poderes.AlternarSemRecarga(localPlayer) ? "Modo de classe sem recarga (digite test-recarga de novo para voltar ao normal)" : "Recarga do modo de classe de volta ao normal"); ((Character)localPlayer).Message((MessageType)2, text, 0, (Sprite)null, false); Console.instance.Print("test-recarga: " + text + "."); Janela.AtualizarSeAberta(); } } internal static class Combate { internal static bool CorpoACorpo(SkillType skill) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Invalid comparison between Unknown and I4 //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Invalid comparison between Unknown and I4 //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Invalid comparison between Unknown and I4 //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Invalid comparison between Unknown and I4 //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Invalid comparison between Unknown and I4 //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Invalid comparison between Unknown and I4 if ((int)skill != 1 && (int)skill != 2 && (int)skill != 3 && (int)skill != 4 && (int)skill != 5 && (int)skill != 7) { return (int)skill == 11; } return true; } internal static bool Disparo(SkillType skill) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 if ((int)skill != 8) { return (int)skill == 14; } return true; } internal static bool Magia(SkillType skill) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 if ((int)skill != 9) { return (int)skill == 10; } return true; } } [HarmonyPatch(typeof(Character), "Damage")] internal static class DanoCausado { private static void Prefix(Character __instance, HitData hit) { //IL_004e: 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_0136: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null || hit == null || (Object)(object)__instance == (Object)(object)localPlayer || (Object)(object)hit.GetAttacker() != (Object)(object)localPlayer) { return; } Poderes.UltimoCombate = Time.time; float num = (Chefes.D("fader") ? 1.025f : 1f); if (Combate.CorpoACorpo(hit.m_skill)) { num += 0.03f * (float)Efeitos.N("forca_bruta"); if (__instance.GetHealthPercentage() < 0.3f) { num += 0.1f * (float)Efeitos.N("golpe_de_misericordia"); } hit.m_staggerMultiplier *= 1f + 0.15f * (float)Efeitos.N("golpe_atordoante"); } else if (Combate.Disparo(hit.m_skill)) { num += 0.03f * (float)Efeitos.N("olho_de_aguia"); if (Vector3.Distance(((Component)localPlayer).transform.position, ((Component)__instance).transform.position) > 25f) { num += 0.1f * (float)Efeitos.N("tiro_de_longe"); } hit.m_backstabBonus *= 1f + 0.15f * (float)Efeitos.N("cacador_silencioso"); } else if (Combate.Magia(hit.m_skill)) { num += 0.03f * (float)Efeitos.N("foco_elemental"); } if (Combate.Magia(hit.m_skill) && Poderes.Ativo(Poder.Iluminado)) { num *= 2f; } if (Combate.Disparo(hit.m_skill) && Poderes.Ativo(Poder.Vigilante)) { num *= Plugin.DanoPorFlechaVigilante.Value / 100f; } if (num != 1f) { hit.ApplyModifier(num); } if (Combate.CorpoACorpo(hit.m_skill)) { float num2 = 0.02f * (float)Efeitos.N("sede_de_sangue") + (Poderes.PassivoAtivo(Poder.Berserker) ? 0.1f : 0f); if (num2 > 0f) { ((Character)localPlayer).Heal(hit.GetTotalDamage() * num2, false); } } } } [HarmonyPatch(typeof(Attack), "GetAttackStamina")] internal static class FolegoDeGuerra { private static void Postfix(Attack __instance, ref float __result) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) if (Efeitos.EhLocal((Character)(object)__instance.m_character) && __instance.m_weapon != null && Combate.CorpoACorpo(__instance.m_weapon.m_shared.m_skillType)) { __result *= 1f - 0.03f * (float)Efeitos.N("folego_de_guerra"); } } } [HarmonyPatch(typeof(Humanoid), "BlockAttack")] internal static class Bloqueio { internal static bool BloqueioDoJogadorLocal; private static void Prefix(Humanoid __instance) { BloqueioDoJogadorLocal = Efeitos.EhLocal((Character)(object)__instance); } private static void Postfix() { BloqueioDoJogadorLocal = false; } private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instrucoes) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Expected O, but got Unknown List<CodeInstruction> list = instrucoes.ToList(); int num = list.FindIndex((CodeInstruction i) => i.opcode == OpCodes.Ldc_R4 && i.operand is float num2 && Mathf.Approximately(num2, 0.25f)); if (num < 0) { Plugin.Log.LogWarning((object)"Aparo Perfeito: não achei a janela de aparo (0,25 s); o talento fica sem efeito."); return list; } CodeInstruction val = list[num]; CodeInstruction val2 = new CodeInstruction(OpCodes.Ldarg_0, (object)null); val2.labels.AddRange(val.labels); list[num] = val2; list.Insert(num + 1, new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(Bloqueio), "JanelaDeAparo", (Type[])null, (Type[])null))); return list; } private static float JanelaDeAparo(Humanoid quemBloqueia) { float num = 0.25f; if (Efeitos.EhLocal((Character)(object)quemBloqueia)) { num *= 1f + 0.2f * (float)Efeitos.N("aparo_perfeito"); } return num; } } [HarmonyPatch(typeof(ItemData), "GetBlockPower", new Type[] { typeof(float) })] internal static class PoderDeBloqueio { private static void Postfix(ref float __result) { if (Bloqueio.BloqueioDoJogadorLocal) { __result *= 1f + 0.1f * (float)Efeitos.N("muralha_de_escudos"); } } } [HarmonyPatch(typeof(SEMan), "ModifyBlockStaminaUsage")] internal static class VigorAoBloquear { private static void Postfix(SEMan __instance, ref float staminaUse) { if (staminaUse > 0f && Efeitos.EhLocal(__instance.m_character)) { staminaUse *= 1f - 0.05f * (float)Efeitos.N("muralha_de_escudos"); } } } [HarmonyPatch(typeof(Character), "RPC_Damage")] internal static class ValhallaPodeEsperar { private static float protecaoAte; private static float prontoEm; private static void Prefix(Character __instance, HitData hit) { if (Time.time < protecaoAte && Efeitos.EhLocal(__instance)) { hit.ApplyModifier(0.7f); } } private static void Postfix(Character __instance) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) if (Efeitos.EhLocal(__instance) && !__instance.IsDead() && !(Time.time < prontoEm) && Efeitos.N("valhalla_pode_esperar") > 0 && __instance.GetHealth() > 0f && __instance.GetHealthPercentage() < 0.2f) { Player val = (Player)__instance; ((Character)val).AddStamina(((Character)val).GetMaxStamina() * 0.5f); protecaoAte = Time.time + 8f; prontoEm = Time.time + 300f; ((Character)val).Message((MessageType)2, "Valhalla pode esperar!", 0, (Sprite)null, false); } } } internal static class Efeitos { internal static bool EhLocal(Character personagem) { if ((Object)(object)personagem != (Object)null) { return (Object)(object)personagem == (Object)(object)Player.m_localPlayer; } return false; } internal static int N(string id) { Player localPlayer = Player.m_localPlayer; if (!((Object)(object)localPlayer == (Object)null)) { return Catalogo.Nivel(localPlayer, Catalogo.PorId[id]); } return 0; } internal static float BonusVida() { return 3f * (float)N("couro_de_troll") + (Chefes.D("anciao") ? 7.5f : 0f); } internal static float BonusVigor() { return 20f * (float)N("vigor_de_ferro") + (Chefes.D("eikthyr") ? 7.5f : 0f); } internal static float BonusEitr() { return 24f * (float)N("reserva_arcana") + (Chefes.D("rainha") ? 10f : 0f); } } [HarmonyPatch(typeof(Player), "GetTotalFoodValue")] internal static class BonusDeAtributos { private static void Postfix(Player __instance, ref float hp, ref float stamina, ref float eitr) { if (Efeitos.EhLocal((Character)(object)__instance)) { hp += Efeitos.BonusVida(); stamina += Efeitos.BonusVigor(); eitr += Efeitos.BonusEitr(); if (AuraIluminado.Dentro(__instance)) { float num = 1f + AuraIluminado.Bonus; hp *= num; stamina *= num; eitr *= num; } } } } internal static class EfeitosDosRamos { internal static int Queimadura1; internal static int Queimadura2; internal static int Lentidao1; internal static int Lentidao2; internal static int Congelado1; internal static int Congelado2; internal static int Toxina1; internal static int Toxina2; internal static int Praga1; internal static int Praga2; internal static void RegistrarEfeitos() { Queimadura1 = Marca("ernandevc_Queimadura1", "Queimadura", 6f); Queimadura2 = Marca("ernandevc_Queimadura2", "Queimadura", 6f); Lentidao1 = Lento("ernandevc_Lentidao1", "Lentidão", -0.3f, 3f); Lentidao2 = Lento("ernandevc_Lentidao2", "Lentidão", -0.5f, 3f); Congelado1 = Lento("ernandevc_Congelado1", "Congelado", -1f, 1.5f); Congelado2 = Lento("ernandevc_Congelado2", "Congelado", -1f, 2.5f); Toxina1 = Toxina("ernandevc_Toxina1", 0.9f); Toxina2 = Toxina("ernandevc_Toxina2", 0.8f); Praga1 = Marca("ernandevc_Praga1", "Praga", 30f); Praga2 = Marca("ernandevc_Praga2", "Praga", 30f); } private static int Registrar(StatusEffect efeito, string id, string nome, float duracao) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown ((Object)efeito).name = id; efeito.m_name = nome; efeito.m_ttl = duracao; efeito.m_icon = Icone.Arvore; ItemManager.Instance.AddStatusEffect(new CustomStatusEffect(efeito, false)); return efeito.NameHash(); } private static int Marca(string id, string nome, float duracao) { return Registrar(ScriptableObject.CreateInstance<StatusEffect>(), id, nome, duracao); } private static int Lento(string id, string nome, float velocidade, float duracao) { SE_Stats obj = ScriptableObject.CreateInstance<SE_Stats>(); obj.m_speedModifier = velocidade; return Registrar((StatusEffect)(object)obj, id, nome, duracao); } private static int Toxina(string id, float dano) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) SE_Stats obj = ScriptableObject.CreateInstance<SE_Stats>(); obj.m_modifyAttackSkill = (SkillType)999; obj.m_damageModifier = dano; return Registrar((StatusEffect)(object)obj, id, "Toxina", 6f); } internal static bool MortoVivo(Character alvo) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Invalid comparison between Unknown and I4 if ((Object)(object)alvo != (Object)null) { return (int)alvo.m_faction == 3; } return false; } internal static bool Inimigo(Character alvo) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Invalid comparison between Unknown and I4 if ((Object)(object)alvo != (Object)null && !alvo.IsPlayer() && !alvo.IsTamed() && !alvo.IsDead()) { return (int)alvo.m_faction > 0; } return false; } internal static List<Character> Perto(Vector3 centro, float raio, Character exceto) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) return (from c in Character.GetAllCharacters() where (Object)(object)c != (Object)(object)exceto && Inimigo(c) && Vector3.Distance(((Component)c).transform.position, centro) <= raio orderby Vector3.Distance(((Component)c).transform.position, centro) select c).ToList(); } } [HarmonyPatch(typeof(Character), "Damage")] internal static class GolpeDosRamos { internal sealed class Golpe { internal int Disparo; internal ArmaEspectral Arma; internal Player Player; internal float Fogo; internal float Gelo; internal float Relampago; internal float Veneno; internal float Espirito; internal float Total; internal Vector3 Direcao; } private static bool emEfeito; private static float proximaExplosao; private static readonly Dictionary<ZDOID, float> CongelarDeNovoEm = new Dictionary<ZDOID, float>(); internal static int DisparoAtual; private static readonly Dictionary<string, int> UltimoDisparo = new Dictionary<string, int>(); private static int N(Golpe golpe, string ramo, int no) { Ramo ramo2 = Ramos.PorId(ramo); if (!Ramos.Ativo(golpe.Player, golpe.Arma, ramo2)) { return 0; } return Ramos.Nivel(golpe.Player, golpe.Arma, ramo2, no); } private static bool UmaVez(Golpe golpe, string efeito) { if (golpe.Disparo == 0) { return true; } if (UltimoDisparo.TryGetValue(efeito, out var value) && value == golpe.Disparo) { return false; } UltimoDisparo[efeito] = golpe.Disparo; return true; } private static void Prefix(Character __instance, HitData hit, ref Golpe __state) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) __state = null; Player localPlayer = Player.m_localPlayer; if (emEfeito || (Object)(object)localPlayer == (Object)null || hit == null || !EfeitosDosRamos.Inimigo(__instance) || (Object)(object)hit.GetAttacker() != (Object)(object)localPlayer) { return; } ItemData currentWeapon = ((Humanoid)localPlayer).GetCurrentWeapon(); ArmaEspectral armaEspectral = ArmasEspectrais.DoItem(currentWeapon); if (armaEspectral != null && hit.m_skill == currentWeapon.m_shared.m_skillType) { Golpe golpe = (__state = new Golpe { Disparo = DisparoAtual, Arma = armaEspectral, Player = localPlayer, Fogo = hit.m_damage.m_fire, Gelo = hit.m_damage.m_frost, Relampago = hit.m_damage.m_lightning, Veneno = hit.m_damage.m_poison, Espirito = hit.m_damage.m_spirit, Total = hit.GetTotalDamage(), Direcao = hit.m_dir }); SEMan sEMan = __instance.GetSEMan(); int num = N(golpe, "fogo", 1); if (golpe.Fogo > 0f && num > 0) { sEMan.AddStatusEffect((num >= 2) ? EfeitosDosRamos.Queimadura2 : EfeitosDosRamos.Queimadura1, true, 0, 0f, (short)(-1)); } int num2 = N(golpe, "espirito", 2); if (golpe.Espirito > 0f && num2 > 0 && EfeitosDosRamos.MortoVivo(__instance) && !__instance.IsBoss() && __instance.GetHealthPercentage() < ((num2 >= 2) ? 0.25f : 0.15f)) { hit.m_damage.m_damage += __instance.GetHealth() * 2f + 10f; Visual.Mostrar("spirit", __instance.GetCenterPoint()); } } } private static void Postfix(Character __instance, Golpe __state) { if (__state == null || (Object)(object)__instance == (Object)null) { return; } emEfeito = true; try { Efeitos(__instance, __state); } finally { emEfeito = false; } } private static void Efeitos(Character alvo, Golpe golpe) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02fa: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) SEMan sEMan = alvo.GetSEMan(); Vector3 centerPoint = alvo.GetCenterPoint(); int num = N(golpe, "fogo", 2); if (golpe.Fogo > 0f && num > 0 && Time.time >= proximaExplosao && UmaVez(golpe, "explosao") && Random.value < ((num >= 2) ? 0.3f : 0.15f)) { proximaExplosao = Time.time + 3f; Visual.Mostrar("fireball", centerPoint); foreach (Character item in EfeitosDosRamos.Perto(((Component)alvo).transform.position, 4f, alvo)) { HitData val = Novo(golpe.Player, item, centerPoint); val.m_damage.m_fire = golpe.Total * 0.5f; item.Damage(val); } } int num2 = N(golpe, "gelo", 1); if (golpe.Gelo > 0f && num2 > 0) { sEMan.AddStatusEffect((num2 >= 2) ? EfeitosDosRamos.Lentidao2 : EfeitosDosRamos.Lentidao1, true, 0, 0f, (short)(-1)); } int num3 = N(golpe, "gelo", 2); if (golpe.Gelo > 0f && num3 > 0 && !alvo.IsBoss() && UmaVez(golpe, "congelar") && Random.value < ((num3 >= 2) ? 0.2f : 0.1f)) { ZDOID zDOID = alvo.GetZDOID(); if (!CongelarDeNovoEm.TryGetValue(zDOID, out var value) || Time.time >= value) { CongelarDeNovoEm[zDOID] = Time.time + 8f; sEMan.AddStatusEffect((num3 >= 2) ? EfeitosDosRamos.Congelado2 : EfeitosDosRamos.Congelado1, true, 0, 0f, (short)(-1)); alvo.Stagger(golpe.Direcao); Visual.Mostrar("frost", centerPoint); } } int num4 = N(golpe, "relampago", 1); if (golpe.Relampago > 0f && num4 > 0 && !alvo.IsBoss() && UmaVez(golpe, "choque") && Random.value < ((num4 >= 2) ? 0.3f : 0.15f)) { alvo.Stagger(golpe.Direcao); } int num5 = N(golpe, "relampago", 2); if (golpe.Relampago > 0f && num5 > 0 && UmaVez(golpe, "cadeia")) { foreach (Character item2 in EfeitosDosRamos.Perto(((Component)alvo).transform.position, 8f, alvo).Take((num5 < 2) ? 1 : 2)) { HitData val2 = Novo(golpe.Player, item2, centerPoint); val2.m_damage.m_lightning = golpe.Relampago * 0.5f; item2.Damage(val2); Visual.Mostrar("lightning", item2.GetCenterPoint()); } } int num6 = N(golpe, "veneno", 1); if (golpe.Veneno > 0f && num6 > 0) { sEMan.AddStatusEffect((num6 >= 2) ? EfeitosDosRamos.Toxina2 : EfeitosDosRamos.Toxina1, true, 0, 0f, (short)(-1)); } int num7 = N(golpe, "veneno", 2); if (golpe.Veneno > 0f && num7 > 0) { sEMan.AddStatusEffect((num7 >= 2) ? EfeitosDosRamos.Praga2 : EfeitosDosRamos.Praga1, true, 0, 0f, (short)(-1)); } int num8 = N(golpe, "espirito", 1); if (golpe.Espirito > 0f && num8 > 0 && EfeitosDosRamos.MortoVivo(alvo) && UmaVez(golpe, "assombro")) { ((Character)golpe.Player).Heal(((Character)golpe.Player).GetMaxHealth() * ((num8 >= 2) ? 0.02f : 0.01f), true); } } private static HitData Novo(Player player, Character alvo, Vector3 origem) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0007: 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_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown HitData val = new HitData { m_point = alvo.GetCenterPoint() }; Vector3 val2 = alvo.GetCenterPoint() - origem; val.m_dir = ((Vector3)(ref val2)).normalized; val.m_skill = (SkillType)0; val.SetAttacker((Character)(object)player); return val; } } [HarmonyPatch(typeof(SE_Burning), "AddFireDamage")] internal static class QueimaduraRapida { private static void Prefix(SE_Burning __instance) { Character character = ((StatusEffect)__instance).m_character; if (!((Object)(object)character == (Object)null) && ((StatusEffect)__instance).NameHash() == SEMan.s_statusEffectBurning) { SEMan sEMan = character.GetSEMan(); if (sEMan.HaveStatusEffect(EfeitosDosRamos.Queimadura2)) { __instance.m_damageInterval = 0.5f; } else if (sEMan.HaveStatusEffect(EfeitosDosRamos.Queimadura1)) { __instance.m_damageInterval = 2f / 3f; } } } } [HarmonyPatch(typeof(Character), "OnDeath")] internal static class PragaAoMorrer { private static void Prefix(Character __instance) { //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Expected O, but got Unknown //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) ZNetView nview = __instance.m_nview; if (__instance is Player || (Object)(object)nview == (Object)null || !nview.IsValid() || !nview.IsOwner()) { return; } SEMan sEMan = __instance.GetSEMan(); bool flag = sEMan.HaveStatusEffect(EfeitosDosRamos.Praga2); if (!flag && !sEMan.HaveStatusEffect(EfeitosDosRamos.Praga1)) { return; } StatusEffect statusEffect = sEMan.GetStatusEffect(SEMan.s_statusEffectPoison); SE_Poison val = (SE_Poison)(object)((statusEffect is SE_Poison) ? statusEffect : null); if (val == null || val.m_damageLeft <= 0f) { return; } float poison = val.m_damageLeft * (flag ? 1f : 0.5f); ZDOID attacker = QuemFeriu(nview.GetZDO()); Vector3 centerPoint = __instance.GetCenterPoint(); Visual.Mostrar("poison", centerPoint); foreach (Character item in EfeitosDosRamos.Perto(((Component)__instance).transform.position, 5f, __instance)) { HitData val2 = new HitData(); val2.m_damage.m_poison = poison; val2.m_point = item.GetCenterPoint(); Vector3 val3 = item.GetCenterPoint() - centerPoint; val2.m_dir = ((Vector3)(ref val3)).normalized; val2.m_skill = (SkillType)0; val2.m_attacker = attacker; item.Damage(val2); } } private static ZDOID QuemFeriu(ZDO zdo) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) foreach (PlayerInfo player in ZNet.instance.GetPlayerList()) { if (zdo.GetBool(ZDOVars.s_attackers + player.m_name, false)) { return player.m_characterID; } } return ZDOID.None; } } internal static class Essencia { private const string ChaveSaldo = "ernandevc.talentos.essencia"; internal const string RpcGanho = "ernandevc.talentos.GanhoEssencia"; private static readonly CultureInfo PtBr = new CultureInfo("pt-BR"); private static readonly int[] TabelaPadrao = new int[6] { 2, 5, 20, 50, 100, 200 }; internal static long Saldo(Player player) { if ((Object)(object)player != (Object)null && player.m_customData.TryGetValue("ernandevc.talentos.essencia", out var value) && long.TryParse(value, NumberStyles.Integer, CultureInfo.InvariantCulture, out var result)) { return result; } return 0L; } internal static void Adicionar(Player player, long quantia) { if (!((Object)(object)player == (Object)null) && quantia > 0) { player.m_customData["ernandevc.talentos.essencia"] = (Saldo(player) + quantia).ToString(CultureInfo.InvariantCulture); } } internal static bool Gastar(Player player, long quantia) { long num = Saldo(player); if ((Object)(object)player == (Object)null || quantia < 0 || num < quantia) { return false; } player.m_customData["ernandevc.talentos.essencia"] = (num - quantia).ToString(CultureInfo.InvariantCulture); return true; } internal static string Formatar(long valor) { return valor.ToString("N0", PtBr); } private static int[] TabelaPorEstrela() { string[] array = Plugin.ValoresPorEstrela.Value.Split(','); int[] array2 = new int[array.Length]; for (int i = 0; i < array.Length; i++) { if (!int.TryParse(array[i].Trim(), NumberStyles.Integer, CultureInfo.InvariantCulture, out array2[i])) { Plugin.Log.LogWarning((object)("Valor por estrelas inválido: '" + Plugin.ValoresPorEstrela.Value + "'. Usando o padrão.")); return TabelaPadrao; } } if (array2.Length == 0) { return TabelaPadrao; } return array2; } internal static int Calcular(Character bicho) { int[] array = TabelaPorEstrela(); int num = Mathf.Clamp(bicho.GetLevel() - 1, 0, array.Length - 1); float num2 = (float)array[num] * bicho.m_health / Plugin.DivisorVidaBase.Value; return Mathf.Max(1, Mathf.RoundToInt(num2)); } internal static void RPC_Ganho(long remetente, int quantia, string nomeBicho) { Player localPlayer = Player.m_localPlayer; if (!((Object)(object)localPlayer == (Object)null)) { Adicionar(localPlayer, quantia); string text = "+" + Formatar(quantia) + " Essência de Valheim (" + Formatar(Saldo(localPlayer)) + ")"; MessageHud instance = MessageHud.instance; if (instance != null) { instance.ShowMessage((MessageType)1, text, 0, Icone.Essencia, false, true); } Janela.AtualizarSeAberta(); Plugin.Log.LogDebug((object)$"Essência +{quantia} por {nomeBicho}"); } } } [HarmonyPatch(typeof(Game), "Start")] internal static class RegistrarRpcEssencia { private static void Postfix() { ZRoutedRpc.instance.Register<int, string>("ernandevc.talentos.GanhoEssencia", (Action<long, int, string>)Essencia.RPC_Ganho); } } [HarmonyPatch(typeof(Character), "RPC_Damage")] internal static class CreditoDeInvocacao { private static void Prefix(Character __instance, HitData hit) { ZNetView nview = __instance.m_nview; if ((Object)(object)nview == (Object)null || !nview.IsValid() || !nview.IsOwner() || __instance.IsPlayer()) { return; } Character attacker = hit.GetAttacker(); if ((Object)(object)attacker == (Object)null || attacker.IsPlayer() || !attacker.IsTamed() || (Object)(object)attacker.m_nview == (Object)null || !attacker.m_nview.IsValid()) { return; } string text = attacker.m_nview.GetZDO().GetString(ZDOVars.s_follow, ""); if (!string.IsNullOrEmpty(text)) { ZDO zDO = nview.GetZDO(); string text2 = ZDOVars.s_attackers + text; if (!zDO.GetBool(text2, false)) { zDO.Set(text2, true); zDO.Set(ZDOVars.s_attackers, zDO.GetInt(ZDOVars.s_attackers, 0) + 1, false); } } } } [HarmonyPatch(typeof(Character), "OnDeath")] internal static class RecompensaPorAbate { private static void Prefix(Character __instance) { ZNetView nview = __instance.m_nview; if (__instance is Player || (Object)(object)nview == (Object)null || !nview.IsValid() || !nview.IsOwner() || __instance.IsTamed()) { return; } ZDO zDO = nview.GetZDO(); if (__instance.IsBoss()) { Chefe chefe = Chefes.PorNomeInterno(__instance.m_name); if (chefe != null) { ParaQuemCausouDano(zDO, delegate { Chefes.RPC_Derrotado(0L, chefe.Id); }, delegate(long uid) { ZRoutedRpc.instance.InvokeRoutedRPC(uid, "ernandevc.talentos.ChefeDerrotado", new object[1] { chefe.Id }); }); } } else { int quantia = Essencia.Calcular(__instance); string nome = __instance.m_name; ParaQuemCausouDano(zDO, delegate { Essencia.RPC_Ganho(0L, quantia, nome); }, delegate(long uid) { ZRoutedRpc.instance.InvokeRoutedRPC(uid, "ernandevc.talentos.GanhoEssencia", new object[2] { quantia, nome }); }); } } private static void ParaQuemCausouDano(ZDO zdo, Action local, Action<long> remoto) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) for