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 HerancaDeAtributos v1.0.17
HerancaDeAtributos.dll
Decompiled 2 days agousing System; using System.Collections.Generic; using System.Globalization; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: AssemblyVersion("0.0.0.0")] namespace FundeAtributo; [BepInPlugin("yuri.HerancaDeAtributos", "Herança de Atributos", "1.0.17")] public class Plugin : BaseUnityPlugin { public class Bonus { public float fogo; public float gelo; public float raio; public float veneno; public float espirito; public string resistencias; public string equipar; public string ataque; public float bloqueio; public float defesa; public float aparar; public float adrenalina; public string parada; public float vigorCasa; public bool Tem() { if (fogo > 0.1f || gelo > 0.1f || raio > 0.1f || veneno > 0.1f || espirito > 0.1f) { return true; } if (bloqueio > 0.1f || defesa > 0.1f || aparar > 0.01f || adrenalina > 0.1f) { return true; } if (resistencias != null && resistencias != "") { return true; } if (equipar != null && equipar != "") { return true; } if (ataque != null && ataque != "") { return true; } if (parada != null && parada != "") { return true; } if (vigorCasa < -0.001f) { return true; } return false; } public string Texto() { string text = ""; if (espirito > 0.1f) { text = Somar(text, "espírito " + (int)espirito); } if (fogo > 0.1f) { text = Somar(text, "fogo " + (int)fogo); } if (gelo > 0.1f) { text = Somar(text, "gelo " + (int)gelo); } if (raio > 0.1f) { text = Somar(text, "raio " + (int)raio); } if (veneno > 0.1f) { text = Somar(text, "veneno " + (int)veneno); } if (bloqueio > 0.1f) { text = Somar(text, "defesa " + (int)bloqueio); } if (aparar > 1.05f) { text = Somar(text, "aparar"); } if (adrenalina > 0.1f) { text = Somar(text, "adrenalina " + (int)adrenalina); } if (vigorCasa < -0.001f) { text = Somar(text, "vigor em casa " + (int)(vigorCasa * 100f) + "%"); } if (resistencias != null && resistencias != "") { text = Somar(text, NomeRes(resistencias)); } if (equipar != null && equipar != "") { text = Somar(text, DescreverEfeitos(equipar)); } if (ataque != null && ataque != "") { text = Somar(text, "efeito de ataque"); } return text; } private static string Somar(string texto, string pedaco) { if (texto == "") { return pedaco; } return texto + ", " + pedaco; } } [HarmonyPatch(typeof(ItemData), "GetDamage", new Type[] { typeof(int), typeof(float) })] private static class AoDano { private static void Postfix(ItemData __instance, ref DamageTypes __result) { if (!((Object)(object)Inst == (Object)null) && Inst.Ligado.Value) { Bonus bonus = LerGravado(__instance); AplicarDano(ref __result, bonus); } } } [HarmonyPatch(typeof(ItemData), "GetBaseBlockPower", new Type[] { typeof(int) })] private static class AoBloqueio { private static void Postfix(ItemData __instance, ref float __result) { if (!((Object)(object)Inst == (Object)null) && Inst.Ligado.Value) { Bonus bonus = LerGravado(__instance); if (bonus.bloqueio > __result) { __result = bonus.bloqueio; } } } } [HarmonyPatch(typeof(ItemData), "GetDeflectionForce", new Type[] { typeof(int) })] private static class AoDefesa { private static void Postfix(ItemData __instance, ref float __result) { if (!((Object)(object)Inst == (Object)null) && Inst.Ligado.Value) { Bonus bonus = LerGravado(__instance); if (bonus.defesa > __result) { __result = bonus.defesa; } } } } [HarmonyPatch(typeof(Humanoid), "BlockAttack")] private static class AoAparar { private static void Prefix(Humanoid __instance, ItemData ___m_leftItem, ItemData ___m_rightItem) { TrocaParada.Entrar(__instance, ___m_leftItem, ___m_rightItem); } private static void Postfix() { TrocaParada.Sair(); } } private static class TrocaParada { private static int profundidade; private static ItemData itemA; private static ItemData itemB; private static float paradaA; private static float paradaB; private static float adrenalinaA; private static float adrenalinaB; private static StatusEffect efeitoA; private static StatusEffect efeitoB; private static bool mexeuA; private static bool mexeuB; private static int extrasA; private static int extrasB; public static void Entrar(Humanoid quem, ItemData esquerda, ItemData direita) { if (profundidade == 0) { Preparar(quem, esquerda, direita); } profundidade++; } public static void Sair() { profundidade--; if (profundidade <= 0) { profundidade = 0; Restaurar(itemA, paradaA, adrenalinaA, efeitoA, mexeuA, extrasA); Restaurar(itemB, paradaB, adrenalinaB, efeitoB, mexeuB, extrasB); itemA = null; itemB = null; mexeuA = false; mexeuB = false; extrasA = 0; extrasB = 0; } } private static void Restaurar(ItemData item, float parada, float adrenalina, StatusEffect efeito, bool mexeu, int extras) { if (item != null && item.m_shared != null && item.m_shared.m_damageModifiers != null) { while (extras > 0 && item.m_shared.m_damageModifiers.Count > 0) { item.m_shared.m_damageModifiers.RemoveAt(item.m_shared.m_damageModifiers.Count - 1); extras--; } } if (mexeu && item != null && item.m_shared != null) { item.m_shared.m_timedBlockBonus = parada; item.m_shared.m_perfectBlockAdrenaline = adrenalina; item.m_shared.m_perfectBlockStatusEffect = efeito; } } private static void Preparar(Humanoid quem, ItemData esquerda, ItemData direita) { mexeuA = false; mexeuB = false; itemA = null; itemB = null; if (!((Object)(object)Inst == (Object)null) && Inst.Ligado.Value && !((Object)(object)quem != (Object)(object)Player.m_localPlayer)) { mexeuA = PrepararItem(esquerda, out itemA, out paradaA, out adrenalinaA, out efeitoA, out extrasA); mexeuB = PrepararItem(direita, out itemB, out paradaB, out adrenalinaB, out efeitoB, out extrasB); } } private static bool PrepararItem(ItemData item, out ItemData guardado, out float parada, out float adrenalina, out StatusEffect efeito, out int extras) { guardado = null; parada = 0f; adrenalina = 0f; efeito = null; extras = 0; if (item == null || item.m_shared == null) { return false; } Bonus bonus = LerGravado(item); float timedBlockBonus = item.m_shared.m_timedBlockBonus; float perfectBlockAdrenaline = item.m_shared.m_perfectBlockAdrenaline; StatusEffect perfectBlockStatusEffect = item.m_shared.m_perfectBlockStatusEffect; bool flag = false; if (bonus.aparar > timedBlockBonus) { item.m_shared.m_timedBlockBonus = bonus.aparar; flag = true; } if (bonus.adrenalina > perfectBlockAdrenaline) { item.m_shared.m_perfectBlockAdrenaline = bonus.adrenalina; flag = true; } if ((Object)(object)perfectBlockStatusEffect == (Object)null && bonus.parada != null && bonus.parada != "") { string nome = bonus.parada.Split(new char[1] { ',' })[0]; StatusEffect val = AcharEfeito(nome); if ((Object)(object)val != (Object)null) { item.m_shared.m_perfectBlockStatusEffect = val; flag = true; } } extras = InjetarRes(item, bonus.resistencias); if (extras > 0) { flag = true; } if (!flag) { return false; } guardado = item; parada = timedBlockBonus; adrenalina = perfectBlockAdrenaline; efeito = perfectBlockStatusEffect; return true; } private static int InjetarRes(ItemData item, string res) { //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) if (item == null || item.m_shared == null || res == null || res == "") { return 0; } if (item.m_shared.m_damageModifiers == null) { item.m_shared.m_damageModifiers = new List<DamageModPair>(); } int num = 0; string[] array = res.Split(new char[1] { ',' }); for (int i = 0; i < array.Length; i++) { string[] array2 = array[i].Split(new char[1] { '=' }); if (array2.Length != 2) { continue; } try { DamageType val = (DamageType)Enum.Parse(typeof(DamageType), array2[0]); DamageModifier val2 = (DamageModifier)Enum.Parse(typeof(DamageModifier), array2[1]); if (Forca(val2) >= 3 && Forca(val2) > Forca(ModNaLista(item, val))) { DamageModPair item2 = new DamageModPair { m_type = val, m_modifier = val2 }; item.m_shared.m_damageModifiers.Add(item2); num++; } } catch { } } return num; } private static DamageModifier ModNaLista(ItemData item, DamageType tipo) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006b: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_006e: 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) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) List<DamageModPair> damageModifiers = item.m_shared.m_damageModifiers; DamageModifier val = (DamageModifier)0; for (int i = 0; i < damageModifiers.Count; i++) { if (damageModifiers[i].m_type == tipo && Forca(damageModifiers[i].m_modifier) > Forca(val)) { val = damageModifiers[i].m_modifier; } } return val; } } [HarmonyPatch(typeof(Player), "GetEquipmentHomeItemModifier")] private static class VigorDaCasa { private static void Postfix(Player __instance, ref float __result) { if ((Object)(object)Inst == (Object)null || !Inst.Ligado.Value || (Object)(object)__instance == (Object)null || ((Humanoid)__instance).GetInventory() == null) { return; } List<ItemData> equippedItems = ((Humanoid)__instance).GetInventory().GetEquippedItems(); float num = 0f; float num2 = 0f; for (int i = 0; i < equippedItems.Count; i++) { ItemData val = equippedItems[i]; if (val != null && val.m_shared != null) { num += val.m_shared.m_homeItemsStaminaModifier; num2 = MaisUtil(num2, LerGravado(val).vigorCasa); } } if (num2 < -0.001f && num2 < num - 0.001f) { __result += num2; } } } [HarmonyPatch(typeof(ItemData), "AddBlockTooltip")] private static class MostraAparo { private static ItemData item; private static bool mexeuAparo; private static bool mexeuAdrenalina; private static float aparoAntes; private static float adrenalinaAntes; private static void Prefix(ItemData __instance) { item = null; mexeuAparo = false; mexeuAdrenalina = false; if (!((Object)(object)Inst == (Object)null) && Inst.Ligado.Value && __instance != null && __instance.m_shared != null) { Bonus bonus = LerGravado(__instance); if (bonus.aparar > __instance.m_shared.m_timedBlockBonus) { aparoAntes = __instance.m_shared.m_timedBlockBonus; __instance.m_shared.m_timedBlockBonus = bonus.aparar; mexeuAparo = true; item = __instance; } if (bonus.adrenalina > __instance.m_shared.m_perfectBlockAdrenaline) { adrenalinaAntes = __instance.m_shared.m_perfectBlockAdrenaline; __instance.m_shared.m_perfectBlockAdrenaline = bonus.adrenalina; mexeuAdrenalina = true; item = __instance; } } } private static void Postfix() { if (item != null && item.m_shared != null) { if (mexeuAparo) { item.m_shared.m_timedBlockBonus = aparoAntes; } if (mexeuAdrenalina) { item.m_shared.m_perfectBlockAdrenaline = adrenalinaAntes; } } item = null; mexeuAparo = false; mexeuAdrenalina = false; } } [HarmonyPatch(typeof(ItemData), "GetTooltip", new Type[] { typeof(int) })] private static class AoDica { private static void Postfix(ItemData __instance, ref string __result) { if (!((Object)(object)Inst == (Object)null) && Inst.Ligado.Value) { Bonus bonus = LerGravado(__instance); if (bonus.Tem()) { __result = __result + "\nFundido: " + bonus.Texto(); } } } } [HarmonyPatch(typeof(Character), "GetDamageModifiers")] private static class AoResistencia { private static void Postfix(Character __instance, ref DamageModifiers __result) { if ((Object)(object)Inst == (Object)null || !Inst.Ligado.Value || (Object)(object)__instance != (Object)(object)Player.m_localPlayer) { return; } List<ItemData> equippedItems = ((Humanoid)Player.m_localPlayer).GetInventory().GetEquippedItems(); for (int i = 0; i < equippedItems.Count; i++) { if (Familia(equippedItems[i]) != 2) { Bonus bonus = LerGravado(equippedItems[i]); AplicarRes(ref __result, bonus.resistencias); } } } } [HarmonyPatch(typeof(Humanoid), "UpdateEquipmentStatusEffects")] private static class AoEquipar { private static void Postfix(Humanoid __instance) { if (!((Object)(object)Inst == (Object)null) && !((Object)(object)__instance != (Object)(object)Player.m_localPlayer)) { ManterEfeitos(Player.m_localPlayer); } } } [HarmonyPatch(typeof(Attack), "DoMeleeAttack")] private static class GolpePerto { private static void Prefix(Humanoid ___m_character) { TrocaEfeito.Entrar(___m_character); } private static void Postfix() { TrocaEfeito.Sair(); } } [HarmonyPatch(typeof(Attack), "FireProjectileBurst")] private static class GolpeLonge { private static void Prefix(Humanoid ___m_character) { TrocaEfeito.Entrar(___m_character); } private static void Postfix() { TrocaEfeito.Sair(); } } private static class TrocaEfeito { private static int profundidade; private static ItemData item; private static StatusEffect anterior; public static void Entrar(Humanoid quem) { if (profundidade == 0) { Preparar(quem); } profundidade++; } public static void Sair() { profundidade--; if (profundidade <= 0) { profundidade = 0; if (item != null && item.m_shared != null) { item.m_shared.m_attackStatusEffect = anterior; } item = null; anterior = null; } } private static void Preparar(Humanoid quem) { item = null; anterior = null; if ((Object)(object)Inst == (Object)null || !Inst.Ligado.Value || (Object)(object)quem != (Object)(object)Player.m_localPlayer) { return; } ItemData currentWeapon = quem.GetCurrentWeapon(); if (currentWeapon != null && currentWeapon.m_shared != null && !((Object)(object)currentWeapon.m_shared.m_attackStatusEffect != (Object)null)) { Bonus bonus = LerGravado(currentWeapon); StatusEffect val = AcharEfeito(bonus.ataque); if (!((Object)(object)val == (Object)null)) { item = currentWeapon; anterior = currentWeapon.m_shared.m_attackStatusEffect; currentWeapon.m_shared.m_attackStatusEffect = val; } } } } [HarmonyPatch(typeof(GameCamera), "UpdateMouseCapture")] private static class SoltaCursor { private static void Postfix() { if (Aberto) { ZCursor.LockState = (CursorLockMode)0; ZCursor.Show(); } } } [HarmonyPatch(typeof(Player), "TakeInput")] private static class SemJogo { private static void Postfix(ref bool __result) { if (Aberto) { __result = false; } } } [HarmonyPatch(typeof(PlayerController), "TakeInput")] private static class SemComando { private static void Postfix(ref bool __result) { if (Aberto) { __result = false; } } } [HarmonyPatch(typeof(Menu), "Update")] private static class SemPausa { private static bool Prefix() { if (quadroSemPausa == Time.frameCount) { return false; } if (!Aberto || !ZInput.GetKeyDown((KeyCode)27, true)) { return true; } Aberto = false; quadroSemPausa = Time.frameCount; return false; } } [HarmonyPatch(typeof(ZInput), "GetMouseDelta")] private static class SemOlhar { private static bool Prefix(ref Vector2 __result) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) if (!Aberto) { return true; } __result = Vector2.zero; return false; } } [HarmonyPatch(typeof(ZInput), "GetMouseButton")] private static class SemClique { private static bool Prefix(ref bool __result) { if (!Aberto) { return true; } __result = false; return false; } } [HarmonyPatch(typeof(ZInput), "GetMouseButtonUp")] private static class SemSolta { private static bool Prefix(ref bool __result) { if (!Aberto) { return true; } __result = false; return false; } } [HarmonyPatch(typeof(InventoryGui), "DoCrafting")] private static class GuardaMelhoria { private static void Prefix(InventoryGui __instance) { DentroMelhoria++; LimparPeca(); if (!(CampoMelhoria == null)) { object? value = CampoMelhoria.GetValue(__instance); GuardarPeca((ItemData)((value is ItemData) ? value : null)); } } private static void Postfix() { DentroMelhoria--; if (DentroMelhoria < 0) { DentroMelhoria = 0; } LimparPeca(); } } [HarmonyPatch(typeof(Inventory), "RemoveItem", new Type[] { typeof(ItemData) })] private static class GuardaAoTirar { private static void Prefix(ItemData item) { if (DentroMelhoria > 0) { GuardarPeca(item); } } } [HarmonyPatch(typeof(Inventory), "AddItem", new Type[] { typeof(string), typeof(int), typeof(int), typeof(int), typeof(long), typeof(string), typeof(Vector2i), typeof(bool), typeof(bool), typeof(bool) })] private static class CopiaNaMelhoria { private static void Postfix(ItemData __result) { if (DentroMelhoria > 0) { ColarPeca(__result); } } } [HarmonyPatch(typeof(Inventory), "AddItem", new Type[] { typeof(string), typeof(int), typeof(int), typeof(int), typeof(long), typeof(string), typeof(bool), typeof(bool) })] private static class CopiaNaMelhoriaCurta { private static void Postfix(ItemData __result) { if (DentroMelhoria > 0) { ColarPeca(__result); } } } private const string Chave = "yuri.funde"; public static Plugin Inst; public static bool Aberto; private static int quadroSemPausa; public static List<string> EfeitosLigados = new List<string>(); private ConfigEntry<bool> Ligado; private ConfigEntry<string> Tecla; private ConfigEntry<int> Largura; private ConfigEntry<int> Altura; public static FieldInfo CampoMelhoria; public static Dictionary<string, string> DadosMelhoria; public static string NomeMelhoria; public static string PrefabMelhoria; public static int DentroMelhoria; private ItemData origem; private ItemData destino; private Vector2 rolagem; private static string conjuntosAssinatura; private static Texture2D fundo; private static GUIStyle titulo; private static GUIStyle texto; private void Awake() { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Expected O, but got Unknown //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Expected O, but got Unknown //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Expected O, but got Unknown Inst = this; Ligado = ((BaseUnityPlugin)this).Config.Bind<bool>("Geral", "Ligado", true, "Escudo com escudo: o que fica guarda o aparar, a adrenalina de aparo e a defesa mais alta. Roupa passa o efeito. So no seu jogo."); Tecla = ((BaseUnityPlugin)this).Config.Bind<string>("Geral", "Tecla", "F7", "Tecla que abre a janela."); Largura = ((BaseUnityPlugin)this).Config.Bind<int>("Geral", "Eixo X", LerNumero("Largura", 552), new ConfigDescription("Largura da janela do F7.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(360, 1600), new object[0])); Altura = ((BaseUnityPlugin)this).Config.Bind<int>("Geral", "Eixo Y", LerNumero("Altura", 700), new ConfigDescription("Altura da janela do F7.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(360, 1400), new object[0])); CampoMelhoria = typeof(InventoryGui).GetField("m_craftUpgradeItem", BindingFlags.Instance | BindingFlags.NonPublic); Harmony val = new Harmony("yuri.HerancaDeAtributos"); val.PatchAll(typeof(Plugin).Assembly); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Herança de Atributos 1.0.17"); } private int LerNumero(string chave, int padrao) { try { string configFilePath = ((BaseUnityPlugin)this).Config.ConfigFilePath; if (!File.Exists(configFilePath)) { return padrao; } string[] array = File.ReadAllLines(configFilePath); string text = chave + " = "; for (int i = 0; i < array.Length; i++) { string text2 = array[i].Trim(); if (text2.StartsWith(text) && int.TryParse(text2.Substring(text.Length).Trim(), out var result)) { return result; } } } catch { } return padrao; } private void Update() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) if (!Ligado.Value || (Object)(object)Player.m_localPlayer == (Object)null) { if (Aberto) { Aberto = false; } return; } if (Input.GetKeyDown(LerTecla())) { Aberto = !Aberto; } if (Aberto && Input.GetKeyDown((KeyCode)27)) { Aberto = false; quadroSemPausa = Time.frameCount; } PassarConjuntos(Player.m_localPlayer); ManterEfeitos(Player.m_localPlayer); } private static void PassarConjuntos(Player jogador) { if ((Object)(object)jogador == (Object)null || ((Humanoid)jogador).GetInventory() == null) { return; } List<ItemData> allItems = ((Humanoid)jogador).GetInventory().GetAllItems(); if (allItems == null || allItems.Count == 0) { return; } string text = ""; int num = 0; for (int i = 0; i < allItems.Count; i++) { ItemData val = allItems[i]; if (val != null && val.m_equipped && Familia(val) == 3) { text = text + "|" + val.m_shared.m_name + ":" + val.m_quality; num++; } } if (num == 0 || text == conjuntosAssinatura) { return; } Bonus bonus = new Bonus(); int num2 = 0; for (int i = 0; i < allItems.Count; i++) { ItemData val = allItems[i]; if (EhConjuntoPedido(val)) { bonus = Juntar(bonus, LerDoItem(val)); num2++; } } if (num2 == 0) { return; } bool flag = false; for (int i = 0; i < allItems.Count; i++) { ItemData val = allItems[i]; if (val != null && val.m_equipped && Familia(val) == 3) { Bonus bonus2 = LerGravado(val); Bonus bonus3 = Juntar(bonus2, bonus); if (bonus3.equipar != bonus2.equipar || bonus3.resistencias != bonus2.resistencias || Math.Abs(bonus3.vigorCasa - bonus2.vigorCasa) > 0.001f) { flag = true; } Gravar(val, bonus3); } } conjuntosAssinatura = text; if (flag) { Avisar(jogador, "Os conjuntos foram para a armadura que você está usando."); } } private static bool EhConjuntoPedido(ItemData item) { if (item == null || item.m_shared == null || item.m_shared.m_name == null) { return false; } return item.m_shared.m_name switch { "$item_chest_berserker_undead" => true, "$item_helmet_berserker" => true, "$item_helmet_celebration" => true, "$item_helmet_fishinghat" => true, _ => false, }; } private KeyCode LerTecla() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: 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_002f: Unknown result type (might be due to invalid IL or missing references) try { return (KeyCode)Enum.Parse(typeof(KeyCode), Tecla.Value); } catch { return (KeyCode)288; } } private static Texture2D Fundo() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_0042: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)fundo != (Object)null) { return fundo; } fundo = new Texture2D(1, 1); fundo.SetPixel(0, 0, new Color(0.06f, 0.06f, 0.06f, 0.96f)); fundo.Apply(); return fundo; } private static void GarantirEstilo() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Expected O, but got Unknown //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown if (texto == null) { texto = new GUIStyle(GUI.skin.label); texto.fontSize = 16; texto.wordWrap = true; texto.richText = false; texto.normal.textColor = Color.white; texto.padding = new RectOffset(0, 0, 2, 8); titulo = new GUIStyle(texto); titulo.fontSize = 22; titulo.padding = new RectOffset(0, 0, 0, 10); } } private static void Linha(string frase, GUIStyle estilo, float largura) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown float num = estilo.CalcHeight(new GUIContent(frase), largura); if (num < (float)estilo.fontSize + 8f) { num = (float)estilo.fontSize + 8f; } GUILayout.Label(frase, estilo, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(largura), GUILayout.Height(num) }); } private void OnGUI() { //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0166: 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) if (!Aberto || !Ligado.Value || (Object)(object)Player.m_localPlayer == (Object)null) { return; } GarantirEstilo(); float num = Largura.Value; float num2 = Altura.Value; if (num < 360f) { num = 360f; } if (num2 < 360f) { num2 = 360f; } float num3 = num - 32f; float num4 = num2 - 380f; if (num4 < 70f) { num4 = 70f; } Rect val = default(Rect); ((Rect)(ref val))..ctor(20f, 20f, num, num2); GUI.DrawTexture(val, (Texture)(object)Fundo()); GUILayout.BeginArea(new Rect(((Rect)(ref val)).x + 16f, ((Rect)(ref val)).y + 14f, num3, ((Rect)(ref val)).height - 28f)); Linha("Herança de Atributos", titulo, num3); Linha("Elmo, peitoral, calça, capa e luva passam o efeito entre si.", texto, num3); Linha("Escudo: primeiro o que some, depois o que fica. O que fica guarda o aparar, a adrenalina de aparo e a defesa mais alta.", texto, num3); Linha("Com a janela aberta o personagem não anda, não olha e não bate.", texto, num3); List<ItemData> list = Itens(Player.m_localPlayer); rolagem = GUILayout.BeginScrollView(rolagem, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(num4) }); for (int i = 0; i < list.Count; i++) { ItemData val2 = list[i]; string text = ""; if (val2 == origem) { text = " [doa]"; } else if (val2 == destino) { text = " [recebe]"; } if (GUILayout.Button(Nome(val2) + text, (GUILayoutOption[])(object)new GUILayoutOption[0])) { Escolher(val2); } } GUILayout.EndScrollView(); Linha(Resumo(), texto, num3); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); if (GUILayout.Button("Fundir", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(34f) })) { Fundir(Player.m_localPlayer); } if (GUILayout.Button("Limpar", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(34f) })) { origem = null; destino = null; } if (GUILayout.Button("Fechar", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(34f) })) { Aberto = false; } GUILayout.EndHorizontal(); GUILayout.EndArea(); } private void Escolher(ItemData item) { if (origem == null || origem == item) { origem = item; if (destino == item) { destino = null; } } else { destino = item; } } private string Resumo() { if (origem == null) { return "Nenhuma peça doando."; } if (destino == null) { return "Doa: " + Nome(origem) + ". Escolhe quem recebe."; } return "Doa: " + Nome(origem) + " -> Recebe: " + Nome(destino) + "\n" + TextoPassa(origem); } private void Fundir(Player jogador) { if (origem == null || destino == null || origem == destino) { Avisar(jogador, "Escolhe duas peças diferentes."); return; } if (!((Humanoid)jogador).GetInventory().ContainsItem(origem) || !((Humanoid)jogador).GetInventory().ContainsItem(destino)) { Avisar(jogador, "A peça não está mais na bolsa."); origem = null; destino = null; return; } if (Familia(origem) == 0 || Familia(origem) != Familia(destino)) { Avisar(jogador, "Só arma com arma, roupa com roupa, e escudo com escudo."); return; } Bonus bonus = LerDoItem(origem); if (!bonus.Tem()) { Avisar(jogador, "Essa peça não tem atributo pra passar."); return; } Bonus ja = LerGravado(destino); if (Familia(destino) == 2) { ja = Juntar(ja, LerDoItem(destino)); } Bonus bonus2 = Juntar(ja, bonus); if (origem.m_equipped) { ((Humanoid)jogador).UnequipItem(origem, false); } if (!((Humanoid)jogador).GetInventory().RemoveOneItem(origem)) { Avisar(jogador, "Não deu pra tirar a peça que doa."); return; } Gravar(destino, bonus2); if (Familia(destino) == 2) { Avisar(jogador, "O escudo que ficou guarda o aparar, a adrenalina de aparo e a defesa mais alta."); } else { Avisar(jogador, "Atributo passado pra " + Nome(destino) + "."); } origem = null; destino = null; ManterEfeitos(jogador); } private static void Avisar(Player jogador, string texto) { ((Character)jogador).Message((MessageType)2, texto, 0, (Sprite)null, true); } private static int Familia(ItemData item) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Invalid comparison between Unknown and I4 //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Invalid comparison between Unknown and I4 //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Invalid comparison between Unknown and I4 //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Invalid comparison between Unknown and I4 //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Invalid comparison between Unknown and I4 //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Invalid comparison between Unknown and I4 //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Invalid comparison between Unknown and I4 //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Invalid comparison between Unknown and I4 //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Invalid comparison between Unknown and I4 //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Invalid comparison between Unknown and I4 //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Invalid comparison between Unknown and I4 if (item == null || item.m_shared == null) { return 0; } ItemType itemType = item.m_shared.m_itemType; if ((int)itemType == 3 || (int)itemType == 14 || (int)itemType == 22 || (int)itemType == 4 || (int)itemType == 15) { return 1; } if ((int)itemType == 5) { return 2; } if ((int)itemType == 6 || (int)itemType == 7 || (int)itemType == 11 || (int)itemType == 12 || (int)itemType == 17) { return 3; } return 0; } private static List<ItemData> Itens(Player jogador) { List<ItemData> allItems = ((Humanoid)jogador).GetInventory().GetAllItems(); List<ItemData> list = new List<ItemData>(); for (int i = 0; i < allItems.Count; i++) { if (Familia(allItems[i]) != 0) { list.Add(allItems[i]); } } return list; } private static string Nome(ItemData item) { string name = item.m_shared.m_name; string text = name; if (Localization.instance != null) { text = Localization.instance.Localize(name); } return text + " q" + item.m_quality; } private static Bonus LerDoItem(ItemData item) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) Bonus bonus = LerGravado(item); DamageTypes damage = item.GetDamage(); bonus.fogo = Maior(bonus.fogo, damage.m_fire); bonus.gelo = Maior(bonus.gelo, damage.m_frost); bonus.raio = Maior(bonus.raio, damage.m_lightning); bonus.veneno = Maior(bonus.veneno, damage.m_poison); bonus.espirito = Maior(bonus.espirito, damage.m_spirit); if (item.m_shared.m_damageModifiers != null) { for (int i = 0; i < item.m_shared.m_damageModifiers.Count; i++) { DamageModPair val = item.m_shared.m_damageModifiers[i]; if (Forca(val.m_modifier) >= 3) { bonus.resistencias = PorRes(bonus.resistencias, val.m_type, val.m_modifier); } } } bonus.equipar = Acrescentar(bonus.equipar, NomeEfeito(item.m_shared.m_equipStatusEffect)); bonus.equipar = Acrescentar(bonus.equipar, NomeEfeito(item.m_shared.m_setStatusEffect)); if (item.m_shared.m_homeItemsStaminaModifier < 0f) { bonus.vigorCasa = MaisUtil(bonus.vigorCasa, item.m_shared.m_homeItemsStaminaModifier); } bonus.ataque = Acrescentar(bonus.ataque, NomeEfeito(item.m_shared.m_attackStatusEffect)); bonus.bloqueio = Maior(bonus.bloqueio, item.GetBaseBlockPower()); bonus.defesa = Maior(bonus.defesa, item.GetDeflectionForce()); bonus.aparar = Maior(bonus.aparar, item.m_shared.m_timedBlockBonus); bonus.adrenalina = Maior(bonus.adrenalina, item.m_shared.m_perfectBlockAdrenaline); bonus.parada = Acrescentar(bonus.parada, NomeEfeito(item.m_shared.m_perfectBlockStatusEffect)); return bonus; } private static float MaisUtil(float a, float b) { if (a >= 0f) { return (b < 0f) ? b : a; } if (b >= 0f) { return a; } if (a < b) { return a; } return b; } private static float Maior(float a, float b) { if (a > b) { return a; } return b; } private static Bonus Juntar(Bonus ja, Bonus extra) { Bonus bonus = new Bonus(); bonus.fogo = Maior(ja.fogo, extra.fogo); bonus.gelo = Maior(ja.gelo, extra.gelo); bonus.raio = Maior(ja.raio, extra.raio); bonus.veneno = Maior(ja.veneno, extra.veneno); bonus.espirito = Maior(ja.espirito, extra.espirito); bonus.resistencias = MesclarRes(ja.resistencias, extra.resistencias); bonus.equipar = JuntarNomes(ja.equipar, extra.equipar); bonus.ataque = JuntarNomes(ja.ataque, extra.ataque); bonus.bloqueio = Maior(ja.bloqueio, extra.bloqueio); bonus.defesa = Maior(ja.defesa, extra.defesa); bonus.aparar = Maior(ja.aparar, extra.aparar); bonus.adrenalina = Maior(ja.adrenalina, extra.adrenalina); bonus.parada = JuntarNomes(ja.parada, extra.parada); bonus.vigorCasa = MaisUtil(ja.vigorCasa, extra.vigorCasa); return bonus; } private static string MesclarRes(string a, string b) { //IL_007b: 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_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) string text = a; string[] array = ((b == null) ? "" : b).Split(new char[1] { ',' }); for (int i = 0; i < array.Length; i++) { string[] array2 = array[i].Split(new char[1] { '=' }); if (array2.Length == 2 && !(array2[0] == "")) { try { DamageType tipo = (DamageType)Enum.Parse(typeof(DamageType), array2[0]); DamageModifier mod = (DamageModifier)Enum.Parse(typeof(DamageModifier), array2[1]); text = PorRes(text, tipo, mod); } catch { } } } return text; } private static string PorRes(string atual, DamageType tipo, DamageModifier mod) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: 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) if (Forca(mod) < 3) { return atual; } string text = ((object)tipo).ToString(); string text2 = ((object)mod).ToString(); int num = Forca(mod); string[] array = ((atual == null) ? "" : atual).Split(new char[1] { ',' }); string text3 = ""; bool flag = false; for (int i = 0; i < array.Length; i++) { string[] array2 = array[i].Split(new char[1] { '=' }); if (array2.Length != 2 || array2[0] == "") { continue; } string text4 = array[i]; if (array2[0] == text) { flag = true; try { DamageModifier mod2 = (DamageModifier)Enum.Parse(typeof(DamageModifier), array2[1]); if (num > Forca(mod2)) { text4 = text + "=" + text2; } } catch { text4 = text + "=" + text2; } } if (text3 != "") { text3 += ","; } text3 += text4; } if (!flag) { if (text3 != "") { text3 += ","; } text3 = text3 + text + "=" + text2; } return text3; } private static int Forca(DamageModifier mod) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: 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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Invalid comparison between Unknown and I4 //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Invalid comparison between Unknown and I4 //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Invalid comparison between Unknown and I4 //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Invalid comparison between Unknown and I4 //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Invalid comparison between Unknown and I4 //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Invalid comparison between Unknown and I4 if ((int)mod == 3) { return 6; } if ((int)mod == 5) { return 5; } if ((int)mod == 1) { return 4; } if ((int)mod == 7) { return 3; } if ((int)mod == 4) { return 2; } if ((int)mod == 0) { return 1; } if ((int)mod == 8) { return 0; } if ((int)mod == 2) { return -1; } return -2; } private static void Gravar(ItemData item, Bonus bonus) { if (item.m_customData == null) { item.m_customData = new Dictionary<string, string>(); } item.m_customData["yuri.funde"] = Num(bonus.fogo) + "|" + Num(bonus.gelo) + "|" + Num(bonus.raio) + "|" + Num(bonus.veneno) + "|" + Num(bonus.espirito) + "|" + Limpo(bonus.resistencias) + "|" + Limpo(bonus.equipar) + "|" + Limpo(bonus.ataque) + "|" + Num(bonus.bloqueio) + "|" + Num(bonus.defesa) + "|" + Num(bonus.aparar) + "|" + Limpo(bonus.parada) + "|" + Num(bonus.adrenalina) + "|" + Num(bonus.vigorCasa); } private static string Num(float valor) { return valor.ToString(CultureInfo.InvariantCulture); } private static string Limpo(string texto) { if (texto == null) { return ""; } return texto; } public static Bonus LerGravado(ItemData item) { Bonus bonus = new Bonus(); if (item == null || item.m_customData == null) { return bonus; } if (!item.m_customData.TryGetValue("yuri.funde", out var value) || value == null) { return bonus; } string[] array = value.Split(new char[1] { '|' }); if (array.Length < 8) { return bonus; } bonus.fogo = Numero(array[0]); bonus.gelo = Numero(array[1]); bonus.raio = Numero(array[2]); bonus.veneno = Numero(array[3]); bonus.espirito = Numero(array[4]); bonus.resistencias = array[5]; bonus.equipar = array[6]; bonus.ataque = array[7]; if (array.Length >= 12) { bonus.bloqueio = Numero(array[8]); bonus.defesa = Numero(array[9]); bonus.aparar = Numero(array[10]); bonus.parada = array[11]; } if (array.Length >= 13) { bonus.adrenalina = Numero(array[12]); } if (array.Length >= 14) { bonus.vigorCasa = Numero(array[13]); } return bonus; } private static float Numero(string texto) { if (float.TryParse(texto, NumberStyles.Float, CultureInfo.InvariantCulture, out var result)) { return result; } return 0f; } private static string TextoPassa(ItemData item) { Bonus bonus = LerDoItem(item); if (!bonus.Tem()) { return "Nada pra passar."; } return "Passa: " + bonus.Texto(); } private static void ManterEfeitos(Player jogador) { List<string> list = new List<string>(); List<ItemData> equippedItems = ((Humanoid)jogador).GetInventory().GetEquippedItems(); for (int i = 0; i < equippedItems.Count; i++) { Bonus bonus = LerGravado(equippedItems[i]); AdicionarNomes(list, bonus.equipar); } SEMan sEMan = ((Character)jogador).GetSEMan(); if (sEMan == null) { return; } for (int i = EfeitosLigados.Count - 1; i >= 0; i--) { if (!list.Contains(EfeitosLigados[i]) && !EfeitoNativo(jogador, EfeitosLigados[i])) { StatusEffect val = AcharEfeito(EfeitosLigados[i]); if ((Object)(object)val != (Object)null) { sEMan.RemoveStatusEffect(val, true); } EfeitosLigados.RemoveAt(i); } } for (int i = 0; i < list.Count; i++) { StatusEffect val2 = AcharEfeito(list[i]); if (!((Object)(object)val2 == (Object)null)) { if (!sEMan.HaveStatusEffect(val2)) { sEMan.AddStatusEffect(val2, false, 1, 0f, (short)0); } if (!EfeitosLigados.Contains(list[i])) { EfeitosLigados.Add(list[i]); } } } } private static bool EfeitoNativo(Player jogador, string nome) { if ((Object)(object)jogador == (Object)null || ((Humanoid)jogador).GetInventory() == null || nome == null || nome == "") { return false; } List<ItemData> equippedItems = ((Humanoid)jogador).GetInventory().GetEquippedItems(); for (int i = 0; i < equippedItems.Count; i++) { ItemData val = equippedItems[i]; if (val != null && val.m_shared != null) { if (EfeitoEh(val.m_shared.m_equipStatusEffect, nome)) { return true; } if (EfeitoEh(val.m_shared.m_setStatusEffect, nome)) { return true; } } } return false; } private static bool EfeitoEh(StatusEffect efeito, string nome) { if ((Object)(object)efeito == (Object)null || nome == null || nome == "") { return false; } if (efeito.m_name == nome) { return true; } if (((Object)efeito).name == nome) { return true; } return false; } private static string NomeRes(string res) { string text = ""; string[] array = res.Split(new char[1] { ',' }); for (int i = 0; i < array.Length; i++) { string[] array2 = array[i].Split(new char[1] { '=' }); if (array2.Length == 2 && !(array2[0] == "")) { string text2 = array2[0]; switch (text2) { case "Pierce": text2 = "perfuração"; break; case "Slash": text2 = "corte"; break; case "Blunt": text2 = "contusão"; break; case "Fire": text2 = "fogo"; break; case "Frost": text2 = "gelo"; break; case "Lightning": text2 = "raio"; break; case "Poison": text2 = "veneno"; break; case "Spirit": text2 = "espírito"; break; } if (text != "") { text += ", "; } text += text2; } } if (text == "") { return "resistência"; } return "resistência a " + text; } private static string NomeEfeito(StatusEffect efeito) { if ((Object)(object)efeito == (Object)null) { return ""; } string text = ((efeito.m_name == null) ? "" : efeito.m_name); string text2 = ((((Object)efeito).name == null) ? "" : ((Object)efeito).name); if (text != "" && text2 != "" && text != text2) { return text + "," + text2; } if (text != "") { return text; } return text2; } private static string JuntarNomes(string a, string b) { return Acrescentar(a, b); } private static string Acrescentar(string lista, string nomes) { string text = ((lista == null) ? "" : lista); if (nomes == null || nomes == "") { return text; } string[] array = nomes.Split(new char[1] { ',' }); foreach (string text2 in array) { if (!(text2 == "") && !ContemNome(text, text2)) { if (text != "") { text += ","; } text += text2; } } return text; } private static bool ContemNome(string lista, string nome) { if (lista == null || lista == "") { return false; } string[] array = lista.Split(new char[1] { ',' }); for (int i = 0; i < array.Length; i++) { if (array[i] == nome) { return true; } } return false; } private static void AdicionarNomes(List<string> quer, string nomes) { if (nomes == null || nomes == "") { return; } string[] array = nomes.Split(new char[1] { ',' }); for (int i = 0; i < array.Length; i++) { if (array[i] != "" && !quer.Contains(array[i])) { quer.Add(array[i]); } } } private static string DescreverEfeitos(string nomes) { bool flag = false; bool flag2 = false; string[] array = nomes.Split(new char[1] { ',' }); for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (EhFurtividade(array[i])) { flag = true; } else { flag2 = true; } } } string text = ""; if (flag) { text = "furtividade"; } if (flag2) { if (text != "") { text += ", "; } text += "efeito herdado"; } return text; } private static bool EhFurtividade(string nome) { //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Invalid comparison between Unknown and I4 //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Invalid comparison between Unknown and I4 string text = nome.ToLower(); if (text.IndexOf("sneak") >= 0 || text.IndexOf("troll") >= 0 || text.IndexOf("stealth") >= 0 || text.IndexOf("furt") >= 0) { return true; } StatusEffect val = AcharEfeito(nome); SE_Stats val2 = (SE_Stats)(object)((val is SE_Stats) ? val : null); if ((Object)(object)val2 == (Object)null) { return false; } if (val2.m_stealthModifier > 0.01f) { return true; } if ((int)val2.m_skillLevel == 101 || (int)val2.m_skillLevel2 == 101) { return true; } return false; } public static StatusEffect AcharEfeito(string nome) { if (nome == null || nome == "" || (Object)(object)ObjectDB.instance == (Object)null || ObjectDB.instance.m_StatusEffects == null) { return null; } List<StatusEffect> statusEffects = ObjectDB.instance.m_StatusEffects; for (int i = 0; i < statusEffects.Count; i++) { StatusEffect val = statusEffects[i]; if (!((Object)(object)val == (Object)null)) { if (val.m_name == nome) { return val; } if (((Object)val).name == nome) { return val; } } } return null; } public static void AplicarDano(ref DamageTypes dano, Bonus bonus) { if (bonus.fogo > dano.m_fire) { dano.m_fire = bonus.fogo; } if (bonus.gelo > dano.m_frost) { dano.m_frost = bonus.gelo; } if (bonus.raio > dano.m_lightning) { dano.m_lightning = bonus.raio; } if (bonus.veneno > dano.m_poison) { dano.m_poison = bonus.veneno; } if (bonus.espirito > dano.m_spirit) { dano.m_spirit = bonus.espirito; } } public static void AplicarRes(ref DamageModifiers mods, string res) { //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_0099: 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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: 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) if (res == null || res == "") { return; } string[] array = res.Split(new char[1] { ',' }); for (int i = 0; i < array.Length; i++) { string[] array2 = array[i].Split(new char[1] { '=' }); if (array2.Length != 2) { continue; } try { DamageType tipo = (DamageType)Enum.Parse(typeof(DamageType), array2[0]); DamageModifier mod = (DamageModifier)Enum.Parse(typeof(DamageModifier), array2[1]); if (Forca(mod) > Forca(LerMod(mods, tipo))) { EscreverMod(ref mods, tipo, mod); } } catch { } } } private static DamageModifier LerMod(DamageModifiers mods, DamageType tipo) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Invalid comparison between Unknown and I4 //IL_000e: 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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Invalid comparison between Unknown and I4 //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_00f2: 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_004b: Invalid comparison between Unknown and I4 //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Invalid comparison between Unknown and I4 //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Invalid comparison between Unknown and I4 //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Invalid comparison between Unknown and I4 //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Invalid comparison between Unknown and I4 //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Invalid comparison between Unknown and I4 //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) if ((int)tipo == 1) { return mods.m_blunt; } if ((int)tipo == 2) { return mods.m_slash; } if ((int)tipo == 4) { return mods.m_pierce; } if ((int)tipo == 8) { return mods.m_chop; } if ((int)tipo == 16) { return mods.m_pickaxe; } if ((int)tipo == 32) { return mods.m_fire; } if ((int)tipo == 64) { return mods.m_frost; } if ((int)tipo == 128) { return mods.m_lightning; } if ((int)tipo == 256) { return mods.m_poison; } if ((int)tipo == 512) { return mods.m_spirit; } return (DamageModifier)0; } private static void EscreverMod(ref DamageModifiers mods, DamageType tipo, DamageModifier mod) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Invalid comparison between Unknown and I4 //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Invalid comparison between Unknown and I4 //IL_0024: 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_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Invalid comparison between Unknown and I4 //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Invalid comparison between Unknown and I4 //IL_0052: 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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Invalid comparison between Unknown and I4 //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Invalid comparison between Unknown and I4 //IL_007f: 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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Invalid comparison between Unknown and I4 //IL_0094: 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_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Invalid comparison between Unknown and I4 //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Invalid comparison between Unknown and I4 //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: 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) if ((int)tipo == 1) { mods.m_blunt = mod; } else if ((int)tipo == 2) { mods.m_slash = mod; } else if ((int)tipo == 4) { mods.m_pierce = mod; } else if ((int)tipo == 8) { mods.m_chop = mod; } else if ((int)tipo == 16) { mods.m_pickaxe = mod; } else if ((int)tipo == 32) { mods.m_fire = mod; } else if ((int)tipo == 64) { mods.m_frost = mod; } else if ((int)tipo == 128) { mods.m_lightning = mod; } else if ((int)tipo == 256) { mods.m_poison = mod; } else if ((int)tipo == 512) { mods.m_spirit = mod; } } private static void GuardarPeca(ItemData item) { if (DadosMelhoria == null && item != null && item.m_customData != null && item.m_customData.TryGetValue("yuri.funde", out var value) && value != null && !(value == "")) { DadosMelhoria = new Dictionary<string, string>(item.m_customData); if (item.m_shared != null) { NomeMelhoria = item.m_shared.m_name; } if ((Object)(object)item.m_dropPrefab != (Object)null) { PrefabMelhoria = ((Object)item.m_dropPrefab).name; } } } private static void ColarPeca(ItemData item) { if (DadosMelhoria == null || item == null) { return; } bool flag = false; if (NomeMelhoria != null && item.m_shared != null && item.m_shared.m_name == NomeMelhoria) { flag = true; } if (!flag && PrefabMelhoria != null && (Object)(object)item.m_dropPrefab != (Object)null && ((Object)item.m_dropPrefab).name == PrefabMelhoria) { flag = true; } if (!flag) { return; } if (item.m_customData == null) { item.m_customData = new Dictionary<string, string>(); } foreach (KeyValuePair<string, string> dadosMelhorium in DadosMelhoria) { if (!item.m_customData.TryGetValue(dadosMelhorium.Key, out var value) || value == null || value == "") { item.m_customData[dadosMelhorium.Key] = dadosMelhorium.Value; } } } private static void LimparPeca() { DadosMelhoria = null; NomeMelhoria = null; PrefabMelhoria = null; } }