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 FundeAtributo v1.0.0
FundeAtributo.dll
Decompiled 6 hours agousing System; using System.Collections.Generic; using System.Globalization; 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.FundeAtributo", "Funde Atributo", "1.0.0")] 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 bool Tem() { if (fogo > 0.1f || gelo > 0.1f || raio > 0.1f || veneno > 0.1f || espirito > 0.1f) { return true; } if (resistencias != null && resistencias != "") { return true; } if (equipar != null && equipar != "") { return true; } if (ataque != null && ataque != "") { 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 (resistencias != null && resistencias != "") { text = Somar(text, "resistencia"); } if (equipar != null && equipar != "") { text = Somar(text, "efeito da capa"); } if (ataque != null && ataque != "") { text = Somar(text, "efeito do golpe"); } 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), "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 + "\nAtributo fundido: " + 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)) { List<ItemData> equippedItems = ((Humanoid)Player.m_localPlayer).GetInventory().GetEquippedItems(); for (int i = 0; i < equippedItems.Count; i++) { 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(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; } } private const string Chave = "yuri.funde"; public static Plugin Inst; public static bool Aberto; public static List<string> EfeitosLigados = new List<string>(); private ConfigEntry<bool> Ligado; private ConfigEntry<string> Tecla; private ItemData origem; private ItemData destino; private Vector2 rolagem; private float proximoEfeito; private void Awake() { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown Inst = this; Ligado = ((BaseUnityPlugin)this).Config.Bind<bool>("Geral", "Ligado", true, "Passa o atributo de uma arma, armadura ou capa para outra. So no seu jogo."); Tecla = ((BaseUnityPlugin)this).Config.Bind<string>("Geral", "Tecla", "F7", "Tecla que abre a janela."); Harmony val = new Harmony("yuri.FundeAtributo"); val.PatchAll(typeof(Plugin).Assembly); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Funde Atributo 1.0.0"); } 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; } if (!(Time.time < proximoEfeito)) { proximoEfeito = Time.time + 1f; ManterEfeitos(Player.m_localPlayer); } } 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 void OnGUI() { //IL_0046: 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_00b5: 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_00d7: Unknown result type (might be due to invalid IL or missing references) if (!Aberto || !Ligado.Value || (Object)(object)Player.m_localPlayer == (Object)null) { return; } GUI.Box(new Rect(24f, 24f, 500f, 560f), ""); GUILayout.BeginArea(new Rect(36f, 36f, 476f, 536f)); GUILayout.Label("Funde Atributo", (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Clica na peça que doa o atributo. Depois na que recebe. A que doa é consumida.", (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Arma com arma, armadura com armadura, capa com capa.", (GUILayoutOption[])(object)new GUILayoutOption[0]); List<ItemData> list = Itens(Player.m_localPlayer); rolagem = GUILayout.BeginScrollView(rolagem, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(300f) }); for (int i = 0; i < list.Count; i++) { ItemData val = list[i]; string text = ""; if (val == origem) { text = " [doa]"; } else if (val == destino) { text = " [recebe]"; } if (GUILayout.Button(Nome(val) + text, (GUILayoutOption[])(object)new GUILayoutOption[0])) { Escolher(val); } } GUILayout.EndScrollView(); GUILayout.Label(Resumo(), (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); if (GUILayout.Button("Fundir", (GUILayoutOption[])(object)new GUILayoutOption[0])) { Fundir(Player.m_localPlayer); } if (GUILayout.Button("Limpar", (GUILayoutOption[])(object)new GUILayoutOption[0])) { origem = null; destino = null; } if (GUILayout.Button("Fechar", (GUILayoutOption[])(object)new GUILayoutOption[0])) { 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ó funde arma com arma, armadura com armadura e capa com capa."); return; } Bonus bonus = LerDoItem(origem); if (!bonus.Tem()) { Avisar(jogador, "Essa peça não tem atributo para passar."); return; } Bonus ja = LerGravado(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 consegui tirar a peça que doa."); return; } Gravar(destino, bonus2); Avisar(jogador, "Atributo passado para " + 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_0033: Invalid comparison between Unknown and I4 //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Invalid comparison between Unknown and I4 //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Invalid comparison between Unknown and I4 //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Invalid comparison between Unknown and I4 //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Invalid comparison between Unknown and I4 //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Invalid comparison between Unknown and I4 //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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 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 == 4 || (int)itemType == 22) { return 1; } if ((int)itemType == 5) { return 2; } if ((int)itemType == 6 || (int)itemType == 7 || (int)itemType == 11 || (int)itemType == 12) { return 3; } if ((int)itemType == 17) { return 4; } 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); } } } if ((bonus.equipar == null || bonus.equipar == "") && (Object)(object)item.m_shared.m_equipStatusEffect != (Object)null && item.m_shared.m_equipStatusEffect.m_name != "") { bonus.equipar = item.m_shared.m_equipStatusEffect.m_name; } else if ((bonus.equipar == null || bonus.equipar == "") && (Object)(object)item.m_shared.m_setStatusEffect != (Object)null && item.m_shared.m_setStatusEffect.m_name != "") { bonus.equipar = item.m_shared.m_setStatusEffect.m_name; } if ((bonus.ataque == null || bonus.ataque == "") && (Object)(object)item.m_shared.m_attackStatusEffect != (Object)null && item.m_shared.m_attackStatusEffect.m_name != "") { bonus.ataque = item.m_shared.m_attackStatusEffect.m_name; } return bonus; } 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); if (extra.equipar != null && extra.equipar != "") { bonus.equipar = extra.equipar; } else { bonus.equipar = ja.equipar; } if (extra.ataque != null && extra.ataque != "") { bonus.ataque = extra.ataque; } else { bonus.ataque = ja.ataque; } 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); } 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]; 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 "Sem atributo para 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]); if (bonus.equipar != null && bonus.equipar != "" && !list.Contains(bonus.equipar)) { list.Add(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])) { 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]); } } } } 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 && val.m_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; } } }