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 MushokuTenseiCore v1.8.0
plugins/MT.Core/MT.Core.dll
Decompiled 11 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.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.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Managers; using Jotunn.Utils; using MT.Core.Commands; using MT.Core.Compat; using MT.Core.Diario; using MT.Core.Especialidades; using MT.Core.I18n; using MT.Core.Mana; using MT.Core.Touki; using MT.Core.Vfx; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; using UnityEngine.Rendering; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")] [assembly: AssemblyCompany("MT.Core")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+a3d1e112c18dad5152e45a99f4e3179a3ca51bec")] [assembly: AssemblyProduct("MT.Core")] [assembly: AssemblyTitle("MT.Core")] [assembly: AssemblyVersion("1.0.0.0")] [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 MT.Core { public static class CoreConfig { public enum ModoMuerte { Clasico, Equilibrado, Protegido } public enum ModoAgotamiento { Anime, Suave } public static ConfigEntry<float> ReservaInicial; public static ConfigEntry<float> ReservaMaxima; public static ConfigEntry<float> ReservaExponente; public static ConfigEntry<float> ManaPorPuntoDeExperiencia; public static ConfigEntry<float> BonusVaciarse; public static ConfigEntry<float> TalentoNacimiento; public static ConfigEntry<int> RanurasComida; public static ConfigEntry<bool> NadoRelajado; public static ConfigEntry<float> SaltoAhorroBase; public static ConfigEntry<float> CargaEntrenadaMax; public static ConfigEntry<float> EntrenoVelocidad; public static ConfigEntry<float> EntrenoMaxDia; public static ConfigEntry<float> DescansoMult; public static ConfigEntry<float> DescansoMana; public static ConfigEntry<float> DescansoManaLaplace; public static ConfigEntry<float> ProbLaplace; public static ConfigEntry<float> ProbLaplaceNivel; public static ConfigEntry<float> RegenLaplace; public static ConfigEntry<float> ProbGranReserva; public static ConfigEntry<float> RegenManaMult; public static ConfigEntry<float> CargaPorCuerpo; public static ConfigEntry<float> CargaPorToki; public static ConfigEntry<float> CargaTopeSinToki; public static ConfigEntry<float> CargaTopeConToki; public static ConfigEntry<float> CuerpoMinimoDespertar; public static ConfigEntry<float> CuerpoDespertarSeguro; public static ConfigEntry<float> ProbabilidadMinima; public static ConfigEntry<float> ProbabilidadMaxima; public static ConfigEntry<float> VidaCrisis; public static ConfigEntry<float> EnfriamientoCrisis; public static ConfigEntry<float> AguanteStaminaMax; public static ConfigEntry<float> StaminaPorNivelToki; public static ConfigEntry<float> SaltoCosto; public static ConfigEntry<float> SaltoCostoMin; public static ConfigEntry<float> StaminaRegenBase; public static ConfigEntry<float> VidaRegenBase; public static ConfigEntry<float> VelAtaqueBase; public static ConfigEntry<float> VelAtaquePorNivel; public static ConfigEntry<float> VelAtaqueMantoPorNivel; public static ConfigEntry<float> VelAtaquePunos; public static ConfigEntry<float> VelAtaqueTope; public static ConfigEntry<float> PasivaDano; public static ConfigEntry<float> PasivaVelocidad; public static ConfigEntry<float> PasivaSalto; public static ConfigEntry<float> PasivaStamina; public static ConfigEntry<float> StaminaAtaquePorNivel; public static ConfigEntry<float> PasivaDanoBase; public static ConfigEntry<float> PasivaVelocidadBase; public static ConfigEntry<float> PasivaSaltoBase; public static ConfigEntry<float> PasivaStaminaBase; public static ConfigEntry<float> TambaleoPorNivel; public static ConfigEntry<float> DominioSinManto; public static ConfigEntry<float> DominioConManto; public static ConfigEntry<float> CaidaBase; public static ConfigEntry<float> ToukiXpFisica; public static ConfigEntry<float> NadoTokiBase; public static ConfigEntry<float> NadoTokiPorNivel; public static ConfigEntry<float> LaplaceMult; public static ConfigEntry<float> ManaPorRango; public static ConfigEntry<float> ManaPorMeditacion; public static ConfigEntry<float> ManaPorControl; public static ConfigEntry<float> TopeGeneral; public static ConfigEntry<float> TopeDiosDragon; public static ConfigEntry<float> XpAlAire; public static ConfigEntry<float> XpGolpeObjeto; public static ConfigEntry<float> XpMatar; public static ConfigEntry<float> XpEspecialista; public static ConfigEntry<float> TalarBase; public static ConfigEntry<float> TalarPorNivel; public static ConfigEntry<float> TopeStamina; public static ConfigEntry<float> TopeMana; public static ConfigEntry<float> ManaPorNivelToki; public static ConfigEntry<float> NadoMantoPorNivel; public static ConfigEntry<float> DanoObjetosPorNivel; public static ConfigEntry<float> PunosExtra; public static ConfigEntry<float> CostoActivar; public static ConfigEntry<bool> AuraPunos; public static ConfigEntry<bool> LlamasParticulas; public static ConfigEntry<float> AuraManosTamano; public static ConfigEntry<float> AuraGrosor; public static ConfigEntry<float> AuraRelleno; public static ConfigEntry<float> CaidaVidaPorNivel; public static ConfigEntry<float> CaidaVidaMinima; public static ConfigEntry<float> VidaPorCuerpo; public static ConfigEntry<float> StaminaEntrenadaMax; public static ConfigEntry<float> CaidaPorNivel; public static ConfigEntry<float> StaminaRegenPorNivel; public static ConfigEntry<float> VidaMaxPorNivel; public static ConfigEntry<bool> TextoXp; public static ConfigEntry<bool> NumerosXp; public static ConfigEntry<float> VidaRegenPorNivel; public static ConfigEntry<float> VidaRegenPlanaBase; public static ConfigEntry<float> VidaRegenPlanaPorNivel; public static ConfigEntry<float> VidaRegenEnCombate; public static ConfigEntry<float> VidaRegenCombateSegundos; public static ConfigEntry<float> VidaRegenMeditandoTope; public static ConfigEntry<float> BarraBase; public static ConfigEntry<float> BarraPorNivel; public static ConfigEntry<float> PerdidaTransferencia; public static ConfigEntry<float> MantenerQuieto; public static ConfigEntry<float> MantenerCorriendo; public static ConfigEntry<float> CostoGolpe; public static ConfigEntry<float> CostoSalto; public static ConfigEntry<float> VelocidadPorNivel; public static ConfigEntry<float> StaminaCorrerPorNivel; public static ConfigEntry<float> SaltoPorNivel; public static ConfigEntry<float> DanoPorNivel; public static ConfigEntry<float> AmortiguarPorNivel; public static ConfigEntry<float> DurezaPorNivel; public static ConfigEntry<float> SalvarGolpeMortal; public static ConfigEntry<float> SalvarSinManto; public static ConfigEntry<float> VidaMantoPorNivel; public static ConfigEntry<float> SorpresaPorNivel; public static ConfigEntry<float> ControlMaxReduccion; public static ConfigEntry<bool> ReflejoActivo; public static ConfigEntry<float> HitoReflejoGolpes; public static ConfigEntry<float> HitoNaturalMinutos; public static ConfigEntry<float> HitoMaestriaDano; public static ConfigEntry<bool> ToukiNaturalActivo; public static ConfigEntry<ModoMuerte> Muerte; public static ConfigEntry<bool> BarraManaSiempre; public static ConfigEntry<bool> AuraVisible; public static ConfigEntry<bool> NumerosDanoColor; public static ConfigEntry<float> NumerosDanoRojo; public static ConfigEntry<bool> DebugEntrenamiento; public static ConfigEntry<float> BarraX; public static ConfigEntry<float> BarraY; public static ConfigEntry<float> MeditacionCosto; public static ConfigEntry<float> MeditacionTopeReserva; public static ConfigEntry<float> MeditacionMinutosDiarios; public static ConfigEntry<float> BuffManaPorNivel; public static ConfigEntry<float> BuffRegenPorNivel; public static ConfigEntry<ModoAgotamiento> Agotamiento; public static ConfigEntry<bool> DescuentosGremio; public static void Bind(ConfigFile cfg) { //IL_0566: Unknown result type (might be due to invalid IL or missing references) //IL_056b: Unknown result type (might be due to invalid IL or missing references) //IL_0573: Expected O, but got Unknown //IL_0573: Unknown result type (might be due to invalid IL or missing references) //IL_057d: Expected O, but got Unknown //IL_0637: Unknown result type (might be due to invalid IL or missing references) //IL_063c: Unknown result type (might be due to invalid IL or missing references) //IL_0644: Expected O, but got Unknown //IL_0644: Unknown result type (might be due to invalid IL or missing references) //IL_064e: Expected O, but got Unknown //IL_066d: Unknown result type (might be due to invalid IL or missing references) //IL_0672: Unknown result type (might be due to invalid IL or missing references) //IL_067a: Expected O, but got Unknown //IL_067a: Unknown result type (might be due to invalid IL or missing references) //IL_0684: Expected O, but got Unknown //IL_0b27: Unknown result type (might be due to invalid IL or missing references) //IL_0b2c: Unknown result type (might be due to invalid IL or missing references) //IL_0b34: Expected O, but got Unknown //IL_0b34: Unknown result type (might be due to invalid IL or missing references) //IL_0b3e: Expected O, but got Unknown BarraBase = Admin(cfg, "4. Manto", "BarraBase", 0.25f, "Tamaño de la barra naranja (fracción del maná máximo) = base + nivel × por nivel."); BarraPorNivel = Admin(cfg, "4. Manto", "BarraPorNivel", 0.05f, "Aumento del tamaño de la barra naranja por nivel de tōki."); PerdidaTransferencia = Admin(cfg, "4. Manto", "PerdidaTransferencia", 0.1f, "Maná que se pierde al cargar o al devolver la barra naranja."); MantenerQuieto = Admin(cfg, "4. Manto", "MantenerQuieto", 0.5f, "Tōki por segundo con el manto activo, quieto o caminando."); MantenerCorriendo = Admin(cfg, "4. Manto", "MantenerCorriendo", 1.5f, "Tōki por segundo con el manto activo, corriendo."); CostoGolpe = Admin(cfg, "4. Manto", "CostoGolpe", 2f, "Tōki por golpe o disparo reforzado."); CostoSalto = Admin(cfg, "4. Manto", "CostoSalto", 1f, "Tōki por salto reforzado."); VelocidadPorNivel = Admin(cfg, "4. Manto", "VelocidadPorNivel", 0.04f, "Velocidad al correr por nivel con el manto (Nv 10 → +40 %)."); StaminaCorrerPorNivel = Admin(cfg, "4. Manto", "StaminaCorrerPorNivel", 0.04f, "Reducción de stamina al correr por nivel con el manto (Nv 10 → −40 %)."); VelAtaqueBase = Admin(cfg, "3. Tōki pasivo", "AtaqueVelBase", 0.02f, "Velocidad de ataque extra solo por tener el tōki despierto (puños, espada y cualquier arma)."); VelAtaquePorNivel = Admin(cfg, "3. Tōki pasivo", "AtaqueVelPorNivel", 0.01f, "Velocidad de ataque por nivel de tōki, siempre. Nv 10 → +12 % con la base."); VelAtaqueMantoPorNivel = Admin(cfg, "4. Manto", "AtaqueVelPorNivel", 0.015f, "Velocidad de ataque extra por nivel con el manto activo (Nv 10 → +15 %)."); VelAtaquePunos = Admin(cfg, "4. Manto", "AtaqueVelPunos", 0.25f, "Los puños sin arma ganan este extra sobre el bonus del tōki (0,25 = +25 % del bonus)."); VelAtaqueTope = Admin(cfg, "4. Manto", "AtaqueVelTope", 0.4f, "Tope de velocidad de ataque sumando tōki, puños y estilos de espada (0,4 = +40 %)."); StaminaAtaquePorNivel = Admin(cfg, "4. Manto", "StaminaAtaquePorNivel", 0.04f, "Reducción de stamina al atacar por nivel con el manto (Nv 10 → −40 %)."); SaltoPorNivel = Admin(cfg, "4. Manto", "SaltoPorNivelToki", 0.05f, "Altura de salto por nivel de tōki con el manto (Nv 10 → +50 %)."); DanoPorNivel = Admin(cfg, "4. Manto", "DanoPorNivel", 0.05f, "Daño físico cuerpo a cuerpo por nivel con el manto (Nv 10 → +50 %; a distancia, menos)."); PasivaDano = Admin(cfg, "3. Tōki pasivo", "DanoPorNivel", 0.015f, "Daño físico por nivel de tōki, siempre (sin manto). Nv 10 → +15 %."); PasivaVelocidad = Admin(cfg, "3. Tōki pasivo", "VelocidadPorNivel", 0.01f, "Velocidad al moverse por nivel de tōki, siempre. Nv 10 → +10 %."); PasivaSalto = Admin(cfg, "3. Tōki pasivo", "SaltoPorNivel", 0.015f, "Altura de salto por nivel de tōki, siempre. Nv 10 → +15 %."); PasivaStamina = Admin(cfg, "3. Tōki pasivo", "StaminaGastoPorNivel", 0.02f, "Menos stamina en todo (correr, atacar, bloquear, esquivar, nadar, sigilo, herramientas) por nivel de tōki. Se suma a la base."); PasivaDanoBase = Admin(cfg, "3. Tōki pasivo", "DanoBase", 0.05f, "Daño físico extra solo por tener el tōki despierto (Nv 1 → +6.5 %, Nv 10 → +20 %)."); PasivaVelocidadBase = Admin(cfg, "3. Tōki pasivo", "VelocidadBase", 0.1f, "Velocidad extra solo por tener el tōki despierto (Nv 1 → +11 %, Nv 10 → +20 %)."); PasivaSaltoBase = Admin(cfg, "3. Tōki pasivo", "SaltoBase", 0.05f, "Altura de salto extra solo por tener el tōki despierto (Nv 1 → +6.5 %, Nv 10 → +20 %)."); PasivaStaminaBase = Admin(cfg, "3. Tōki pasivo", "StaminaGastoBase", 0.1f, "Menos stamina en todo solo por tener el tōki despierto (Nv 1 → −12 %, Nv 10 → −30 %)."); TambaleoPorNivel = Admin(cfg, "3. Tōki pasivo", "TambaleoPorNivel", 0.025f, "Menos tambaleo al recibir golpes por nivel de tōki (Nv 10 → −25 %)."); CaidaBase = Admin(cfg, "3. Tōki pasivo", "CaidaBase", 0.5f, "Menos daño de caída solo por tener el tōki despierto (+ CaidaPorNivel; tope −90 %). Lo que quede se paga con maná azul y, si no hay, con vida."); NadoTokiBase = Admin(cfg, "3. Tōki pasivo", "NadoPasivoBase", 0.3f, "Velocidad al nadar extra solo por tener el tōki despierto, sin manto (+30 %)."); NadoTokiPorNivel = Admin(cfg, "3. Tōki pasivo", "NadoPasivoPorNivel", 0.05f, "Velocidad al nadar extra por nivel de tōki, sin manto (Nv 1 → +35 %, Nv 10 → +80 %)."); DominioSinManto = Admin(cfg, "3. Tōki pasivo", "DominioSinManto", 0.15f, "Experiencia de Dominio por cada punto de experiencia física (armas, correr, saltar, nadar, bloquear, talar, picar) sin el manto."); DominioConManto = Admin(cfg, "3. Tōki pasivo", "DominioConManto", 0.4f, "Lo mismo con el manto activo."); ToukiXpFisica = Admin(cfg, "3. Tōki pasivo", "ExperienciaFisica", 2f, "Multiplicador de experiencia de las habilidades físicas (armas, correr, saltar, nadar, sigilo, bloquear, talar, picar) con el tōki despierto."); AmortiguarPorNivel = Admin(cfg, "4. Manto", "Amortiguar", 0.06f, "Daño físico que amortigua el manto por nivel (Nv 4 → 24 %, Nv 10 → 60 %), pagando tōki."); DurezaPorNivel = Admin(cfg, "3. Tōki pasivo", "DurezaPorNivel", 0.02f, "Cuerpo endurecido: daño físico recibido menos por nivel, siempre, gratis (Nv 10 → −20 %). La armadura se suma encima."); SalvarGolpeMortal = Admin(cfg, "4. Manto", "EnfriamientoGolpeMortal", 60f, "Con el manto activo, un golpe mortal te deja con vida (CaidaVidaMinima) gastando la barra naranja. Segundos hasta repetirlo (0 = desactivado)."); SalvarSinManto = Admin(cfg, "3. Tōki pasivo", "EnfriamientoGolpeMortalSinManto", 180f, "Tōki despierto sin manto: también resiste un golpe mortal, con este enfriamiento menos 10 s por nivel (Nv 1 → 170 s, Nv 10 → 80 s). 0 = desactivado."); VidaMantoPorNivel = Admin(cfg, "4. Manto", "VidaMantoPorNivel", 0.015f, "Vida máxima extra (fracción) por nivel con el manto activo."); SorpresaPorNivel = Admin(cfg, "3. Tōki pasivo", "SorpresaPorNivel", 0.03f, "Reducción de daño de golpes por la espalda por nivel."); ControlMaxReduccion = Admin(cfg, "1. Maná", "ControlMaxReduccion", 0.4f, "Reducción de costos con Control del maná 100."); HitoReflejoGolpes = Admin(cfg, "5. Hitos", "ReflejoGolpes", 25f, "Reflejo (Nv 4): golpes por la espalda o caídas sobrevividos gracias al tōki."); HitoNaturalMinutos = Admin(cfg, "5. Hitos", "NaturalMinutos", 30f, "Tōki natural (Nv 7): minutos en total con el manto activo."); HitoMaestriaDano = Admin(cfg, "5. Hitos", "MaestriaDano", 10000f, "Maestría (Nv 10): daño total amortiguado con el tōki."); ReflejoActivo = cfg.Bind<bool>("5. Hitos", "Reflejo", true, "Nv 4: el tōki se activa solo un instante ante golpes por sorpresa y caídas (paga del maná azul)."); ToukiNaturalActivo = cfg.Bind<bool>("5. Hitos", "ToukiNatural", true, "Nv 7: manto débil siempre activo, a cambio de reservar maná máximo."); Muerte = cfg.Bind<ModoMuerte>("6. Muerte", "Modo", ModoMuerte.Equilibrado, new ConfigDescription("Pérdida de las habilidades MT al morir: Clasico (como Valheim), Equilibrado (la mitad), Protegido (nada).", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); MeditacionCosto = Admin(cfg, "8. Meditación", "CostoPorSegundo", 2f, "Maná que circula (se gasta) por segundo meditando."); MeditacionTopeReserva = Admin(cfg, "8. Meditación", "TopeReserva", 30f, "Hasta este nivel de Reserva, meditar la hace crecer; después solo da el buff."); MeditacionMinutosDiarios = Admin(cfg, "8. Meditación", "MinutosDiarios", 10f, "Minutos por día del juego con experiencia completa; después, al 25 %."); BuffManaPorNivel = Admin(cfg, "8. Meditación", "BuffManaPorNivel", 0.03f, "Mente en calma: maná máximo extra por nivel de meditación."); BuffRegenPorNivel = Admin(cfg, "8. Meditación", "BuffRegenPorNivel", 0.05f, "Mente en calma: regeneración de maná extra por nivel de meditación."); Agotamiento = cfg.Bind<ModoAgotamiento>("9. Agotamiento", "Modo", ModoAgotamiento.Anime, new ConfigDescription("Anime: colapso, agotamiento y desmayo si se repite. Suave: solo 10 s sin regenerar maná.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); DescuentosGremio = cfg.Bind<bool>("10. Gremio", "Descuentos", true, new ConfigDescription("Descuentos con los comerciantes según el rango del Gremio.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); DebugEntrenamiento = cfg.Bind<bool>("7. Interfaz", "AvisosEntrenamiento", true, "Mostrar en pantalla y en el log lo que entrenas al golpear árboles y rocas (para pruebas)."); BarraManaSiempre = cfg.Bind<bool>("7. Interfaz", "BarraManaSiempreVisible", true, "Mostrar siempre la barra azul de maná (el juego la oculta cuando está llena)."); AuraVisible = cfg.Bind<bool>("7. Interfaz", "AuraToki", true, "Aura de tōki con el manto: llamas de fuego envolviendo todo el cuerpo (shader propio)."); CaidaVidaPorNivel = Admin(cfg, "3. Tōki pasivo", "CaidaVidaPorNivel", 0.08f, "Si el maná no alcanza para la caída, lo que baja de vida se reduce esto por nivel de tōki (Nv 10 → −80 %)."); CaidaVidaMinima = Admin(cfg, "3. Tōki pasivo", "CaidaVidaMinima", 5f, "Con el tōki despierto, una caída nunca te mata: te deja como mínimo con esta vida."); AuraPunos = cfg.Bind<bool>("7. Interfaz", "AuraPunos", false, "Además, brillo de fuego envolviendo cada puño."); AuraGrosor = cfg.Bind<float>("7. Interfaz", "AuraGrosor", 0.035f, "Cuánto sobresale el aura del cuerpo (metros)."); AuraRelleno = cfg.Bind<float>("7. Interfaz", "AuraRelleno", 0.15f, "Llamas por dentro de la silueta: 0 = solo el contorno arde, 1 = todo el cuerpo cubierto."); AuraManosTamano = cfg.Bind<float>("7. Interfaz", "AuraManosTamano", 0.18f, "Tamaño del brillo de tōki en cada puño (metros)."); LlamasParticulas = cfg.Bind<bool>("7. Interfaz", "LlamasParticulas", false, "Además, llamas de partículas saliendo del cuerpo y las manos."); NumerosDanoColor = cfg.Bind<bool>("7. Interfaz", "NumerosDeDanoConColor", true, "Colorear los números de daño del juego de amarillo (poco) a rojo (mucho)."); NumerosDanoRojo = cfg.Bind<float>("7. Interfaz", "NumerosDeDanoRojoDesde", 150f, "Daño a partir del cual el número sale rojo del todo."); BarraX = cfg.Bind<float>("7. Interfaz", "BarraTokiX", 0.5f, "Posición horizontal de la barra naranja (0 = izquierda, 1 = derecha)."); BarraY = cfg.Bind<float>("7. Interfaz", "BarraTokiY", 0.93f, "Posición vertical de la barra naranja (0 = arriba, 1 = abajo)."); ReservaInicial = Admin(cfg, "1. Maná", "ReservaInicial", 10f, "Maná propio con Reserva 0."); ReservaMaxima = Admin(cfg, "1. Maná", "ReservaMaxima", 300f, "Maná propio con Reserva 100 (sin comida ni el resto de fuentes)."); ManaPorRango = Admin(cfg, "1. Maná", "ManaPorRangoMagico", 1.2f, "Maná por punto de tu mejor rango mágico (0–100; Dios = 100 → +120)."); ManaPorMeditacion = Admin(cfg, "1. Maná", "ManaPorMeditacion", 0.5f, "Maná por nivel de Meditación (100 → +50)."); ManaPorControl = Admin(cfg, "1. Maná", "ManaPorControl", 0.3f, "Maná por nivel de Control del maná (100 → +30)."); TopeGeneral = Admin(cfg, "1. Maná", "TopeVidaStaminaMana", 700f, "Máximo de vida, stamina y maná con todo (comida, tōki, talento…)."); XpAlAire = Admin(cfg, "11. Experiencia", "AlAire", 0.1f, "Experiencia del arma por practicar al aire (1 ataque por segundo cuenta)."); XpGolpeObjeto = Admin(cfg, "11. Experiencia", "GolpearObjetos", 0.3f, "Experiencia del arma al golpear árboles, rocas y objetos (2 veces por segundo como mucho)."); XpMatar = Admin(cfg, "11. Experiencia", "Matar", 1f, "Experiencia extra del arma al matar (× vida del enemigo / 50, entre 0.5 y 6; jefes ×3)."); XpEspecialista = Admin(cfg, "11. Experiencia", "Especialista", 1.25f, "Tu arma principal (habilidad de combate más alta) gana esta experiencia extra."); TalarBase = Admin(cfg, "3. Tōki pasivo", "TalarBase", 0.4f, "Con el tōki despierto, parte del daño físico de cualquier golpe también tala árboles y pica rocas (40 % + TalarPorNivel)."); TalarPorNivel = Admin(cfg, "3. Tōki pasivo", "TalarPorNivel", 0.06f, "Por nivel de tōki (Nv 10 → 100 %). La fuerza cuenta como herramienta de nivel 1 + nivel/2."); TopeStamina = Admin(cfg, "1. Maná", "TopeStamina", 700f, "Máximo de stamina con todo (comida, tōki, entrenamiento)."); TopeMana = Admin(cfg, "1. Maná", "TopeMana", 700f, "Máximo de maná con todo (comida, reserva, tōki, talento)."); ManaPorNivelToki = Admin(cfg, "3. Tōki pasivo", "ManaPorNivelToki", 15f, "Maná máximo extra por nivel de tōki (Nv 10 → +150). El tōki también es maná."); NadoMantoPorNivel = Admin(cfg, "4. Manto", "NadoPorNivel", 0.04f, "Velocidad al nadar por nivel con el manto (Nv 10 → +40 %), además de la pasiva."); DanoObjetosPorNivel = Admin(cfg, "4. Manto", "DanoObjetosPorNivel", 0.05f, "Daño a árboles, rocas y objetos por nivel con el manto (Nv 10 → +50 %)."); PunosExtra = Admin(cfg, "4. Manto", "MultiplicadorPunos", 1.5f, "Los puños aprovechan más el tōki: su bonus de daño se multiplica por esto."); CostoActivar = Admin(cfg, "4. Manto", "CostoActivar", 10f, "Maná azul que cuesta encender el manto (aparte de lo que pasa a la barra naranja)."); TopeDiosDragon = Admin(cfg, "1. Maná", "TopeDiosDragon", 1000f, "Máximo de vida, stamina y maná con el Dios Dragón."); ReservaExponente = Admin(cfg, "1. Maná", "ReservaExponente", 0.7f, "Curva de la reserva: menor = crece más rápido al principio."); ManaPorPuntoDeExperiencia = Admin(cfg, "1. Maná", "ManaPorPuntoDeExperiencia", 5f, "Maná gastado para ganar 1 punto de experiencia de Reserva."); BonusVaciarse = Admin(cfg, "1. Maná", "BonusVaciarse", 1.25f, "Multiplicador de experiencia si el gasto te deja por debajo del 10 % de maná."); NadoRelajado = Admin2(cfg, "8. Meditación", "NadoRelajado", value: true, "Nadar despacio no gasta stamina y la recupera; solo nadar rápido (correr) la gasta. Sin muerte por ahogo."); RanurasComida = cfg.Bind<int>("8. Meditación", "RanurasComida", 5, new ConfigDescription("Comidas distintas que puedes tener a la vez (Valheim: 3). Entre 3 y 8.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(3, 8), new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); SaltoAhorroBase = Admin(cfg, "3. Tōki pasivo", "SaltoAhorroBase", 0.5f, "(Ya no se usa: ver SaltoCosto.)"); SaltoCosto = Admin(cfg, "3. Tōki pasivo", "SaltoCosto", 2f, "Stamina por salto sin tōki y sin entrenar (Valheim: 10). Con el manto activo: 0."); SaltoCostoMin = Admin(cfg, "3. Tōki pasivo", "SaltoCostoMinimo", 1f, "Stamina por salto muy entrenado (Saltar + Aguante = 100) o con el tōki despierto."); CargaEntrenadaMax = Admin(cfg, "3. Tōki pasivo", "CargaEntrenadaTope", 100f, "Peso extra que se gana entrenando (+1 a +5 por esfuerzo). Con cuerpo (+50) y tōki (+50), el total llega a +200."); EntrenoVelocidad = Admin(cfg, "3. Tōki pasivo", "VelocidadEntrenamiento", 1f, "Multiplicador de lo rápido que crece el cuerpo entrenando (stamina entrenada y Aguante)."); EntrenoMaxDia = Admin(cfg, "3. Tōki pasivo", "StaminaEntrenadaPorDia", 15f, "Máximo de stamina que se gana entrenando por día del juego."); DescansoMana = Admin(cfg, "8. Meditación", "DescansoManaFuerza", 6f, "El bonus de descanso vale esto más para el maná (6 → Descansado ×2.5, sentado ×4, junto al fuego ×5.5, en la cama ×8.5)."); DescansoManaLaplace = Admin(cfg, "8. Meditación", "DescansoManaLaplace", 1.5f, "Con el Factor de Laplace, el bonus de descanso del maná es aún mayor (1.5 → sentado ×5.5, fuego ×7.75, cama ×12.25)."); DescansoMult = Admin(cfg, "8. Meditación", "Descanso", 1f, "Fuerza del bonus de descanso (1 = normal, 0 = sin bonus). Descansado +25 %, sentado +50 %, junto al fuego +25 %, en la cama +100 % a toda la regeneración."); ProbLaplace = Admin(cfg, "1. Maná", "ProbFactorLaplace", 0.015f, "Probabilidad de nacer con el Factor de Laplace (reserva ×2.5, sin tōki)."); LaplaceMult = Admin(cfg, "1. Maná", "ReservaLaplace", 1.7f, "Multiplicador de la reserva con el Factor de Laplace (1.7 ≈ 255 de maná propio con Reserva 100). Su Reserva crece +50 % más rápido."); ProbLaplaceNivel = Admin(cfg, "1. Maná", "ProbLaplacePorNivel", 0.005f, "Probabilidad de despertar el Factor de Laplace cada vez que sube la Reserva (solo con el tōki dormido)."); RegenLaplace = Admin(cfg, "1. Maná", "RegeneracionLaplaceExtra", 1.25f, "Factor de Laplace: su regeneración escala con su reserva (×ReservaLaplace) y además se multiplica por esto (1.25 = +25 %): se llena antes que la de un mago normal."); ProbGranReserva = Admin(cfg, "1. Maná", "ProbGranReserva", 0.2f, "Probabilidad de nacer con gran reserva (×1.5)."); RegenManaMult = Admin(cfg, "1. Maná", "RegeneracionMana", 0.6f, "Multiplicador de la regeneración de maná (0.6 = −40 %: menos magia, más estrategia)."); CargaPorCuerpo = Admin(cfg, "3. Tōki pasivo", "CargaPorNivelDeCuerpo", 1f, "Peso que puedes cargar por punto de Nivel de Cuerpo (100 → +100). Con el entrenamiento: +200 sin tōki."); CargaTopeSinToki = Admin(cfg, "3. Tōki pasivo", "CargaExtraTopeSinToki", 200f, "Máximo peso extra que da MT sin tōki. Mochilas de otros mods suman aparte."); CargaTopeConToki = Admin(cfg, "3. Tōki pasivo", "CargaExtraTopeConToki", 600f, "Máximo peso extra que da MT con tōki. Mochilas de otros mods suman aparte."); CargaPorToki = Admin(cfg, "3. Tōki pasivo", "CargaPorNivelDeToki", 40f, "Peso que puedes cargar por nivel de tōki (10 → +400; +600 en total)."); TalentoNacimiento = Admin(cfg, "2. Despertar", "TalentoNacimiento", 0.01f, "Probabilidad (una sola tirada por personaje) de nacer con el tōki despierto."); CuerpoMinimoDespertar = Admin(cfg, "2. Despertar", "CuerpoMinimo", 12f, "Nivel de Cuerpo desde el que puede despertar el tōki."); CuerpoDespertarSeguro = Admin(cfg, "2. Despertar", "CuerpoTope", 25f, "Nivel de Cuerpo en el que la probabilidad de despertar llega a su tope (99 %). Nunca es seguro."); ProbabilidadMinima = Admin(cfg, "2. Despertar", "ProbabilidadMinima", 0.03f, "Probabilidad por tirada con el Cuerpo mínimo."); ProbabilidadMaxima = Admin(cfg, "2. Despertar", "ProbabilidadTope", 0.99f, "Probabilidad por tirada con el Nivel de Cuerpo tope (máx. 0.99: nunca es 100 %)."); VidaCrisis = Admin(cfg, "2. Despertar", "VidaCrisis", 0.2f, "Momento de crisis: sobrevivir con menos de esta fracción de vida da una tirada doble."); EnfriamientoCrisis = Admin(cfg, "2. Despertar", "EnfriamientoCrisis", 600f, "Segundos entre tiradas de crisis."); StaminaEntrenadaMax = Admin(cfg, "3. Tōki pasivo", "StaminaEntrenadaMax", 60f, "Stamina máxima que se gana entrenando (esfuerzos de verdad), aparte del Aguante. Con Aguante: +200 sin tōki."); VidaPorCuerpo = Admin(cfg, "3. Tōki pasivo", "VidaPorNivelDeCuerpo", 0.2f, "Vida máxima extra por punto de Nivel de Cuerpo (100 → +20), con o sin tōki."); AguanteStaminaMax = Admin(cfg, "3. Tōki pasivo", "AguanteStaminaMax", 140f, "Stamina máxima extra con Aguante 100 (crece más rápido al principio)."); StaminaPorNivelToki = Admin(cfg, "3. Tōki pasivo", "StaminaPorNivelToki", 30f, "Stamina máxima extra por nivel de tōki (Nv 10 → +300; con el resto, +500 en total)."); CaidaPorNivel = Admin(cfg, "3. Tōki pasivo", "CaidaPorNivel", 0.05f, "Reducción de daño de caída por nivel de tōki."); StaminaRegenBase = Admin(cfg, "3. Tōki pasivo", "StaminaRegenBase", 0.5f, "Regeneración de stamina extra solo por tener el tōki despierto (0.50 = +50 %)."); StaminaRegenPorNivel = Admin(cfg, "3. Tōki pasivo", "StaminaRegenPorNivel", 0.05f, "Regeneración de stamina extra por nivel (Nv 1 → +55 %, Nv 10 → +100 %)."); TextoXp = cfg.Bind<bool>("Interfaz", "TextoExperiencia", true, "Flechitas «↑» sobre el personaje al ganar experiencia o entrenamiento."); NumerosXp = cfg.Bind<bool>("Interfaz", "NumerosExperiencia", false, "Además de las flechitas, el número «+N XP». Apagado por defecto: el progreso se lee en el Diario (F8)."); VidaMaxPorNivel = Admin(cfg, "3. Tōki pasivo", "VidaMaxPorNivel", 15f, "Vida máxima extra por nivel de tōki (Nv 10 → +150)."); VidaRegenBase = Admin(cfg, "3. Tōki pasivo", "VidaRegenBase", 0.25f, "Regeneración de vida extra solo por tener el tōki despierto (0.25 = +25 %)."); VidaRegenPorNivel = Admin(cfg, "3. Tōki pasivo", "VidaRegenPorNivel", 0.03f, "Regeneración de vida extra por nivel (Nv 1 → +28 %, Nv 10 → +55 %)."); VidaRegenPlanaBase = Admin(cfg, "3. Tōki pasivo", "VidaRegenPlanaBase", 0.001f, "Vida que regeneras por segundo, en fracción de la vida máxima, solo por tener el tōki despierto (0.001 = 0,1 %/s), aunque no hayas comido."); VidaRegenPlanaPorNivel = Admin(cfg, "3. Tōki pasivo", "VidaRegenPlanaPorNivel", 0.0002f, "Vida por segundo extra por nivel de tōki (Nv 10 → 0,3 %/s de la vida máxima)."); VidaRegenEnCombate = Admin(cfg, "3. Tōki pasivo", "VidaRegenEnCombate", 0.25f, "En combate (te golpearon hace poco) la regeneración propia del tōki se multiplica por esto (0.25 = un cuarto)."); VidaRegenCombateSegundos = Admin(cfg, "3. Tōki pasivo", "VidaRegenCombateSegundos", 8f, "Segundos sin recibir daño para volver a regenerar del todo."); VidaRegenMeditandoTope = Admin(cfg, "3. Tōki pasivo", "VidaRegenMeditandoTope", 0.003f, "Meditando se regenera el doble, hasta este tope por segundo (0.003 = 0,3 %/s de la vida máxima)."); } private static ConfigEntry<bool> Admin2(ConfigFile cfg, string section, string key, bool value, string description) { //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) //IL_001c: Expected O, but got Unknown //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown return cfg.Bind<bool>(section, key, value, new ConfigDescription(description, (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); } private static ConfigEntry<float> Admin(ConfigFile cfg, string section, string key, float value, string description) { //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) //IL_001c: Expected O, but got Unknown //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown return cfg.Bind<float>(section, key, value, new ConfigDescription(description, (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); } } public static class Estado { public static bool Levitando; } [BepInPlugin("mushokutensei.core", "MT Core", "1.8.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] [SynchronizationMode(/*Could not decode attribute arguments.*/)] public class MTCorePlugin : BaseUnityPlugin { public const string Guid = "mushokutensei.core"; public const string Version = "1.8.0"; public static ManualLogSource Log; private static void Paso(string que, Action accion) { try { accion(); } catch (Exception arg) { Log.LogError((object)$"MT Core: falló «{que}» al cargar (el resto sigue): {arg}"); } } private void Awake() { //IL_02ae: Unknown result type (might be due to invalid IL or missing references) Tr.Load(typeof(MTCorePlugin).Assembly, Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location)); Log = ((BaseUnityPlugin)this).Logger; CoreConfig.Bind(((BaseUnityPlugin)this).Config); MTKeys.Bind(((BaseUnityPlugin)this).Config); string iconDir = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "Icons"); MTSkills.Register(iconDir); SE_ToukiPasivo.Register(MTSkills.LoadIcon(iconDir, "insignia_toki_despierto") ?? MTSkills.LoadIcon(iconDir, "touki_pasivo")); SE_Talento.Register(iconDir); SE_MenteEnCalma.Register(MTSkills.LoadIcon(iconDir, "mente_en_calma")); SE_Agotamiento.Register(MTSkills.LoadIcon(iconDir, "agotamiento")); Paso("teclas del manto", MantoController.RegisterInput); Paso("tecla de meditar", Meditacion.RegisterInput); ((Component)this).gameObject.AddComponent<MantoController>(); ((Component)this).gameObject.AddComponent<Meditacion>(); ((Component)this).gameObject.AddComponent<EspecialidadesController>(); ((Component)this).gameObject.AddComponent<NadoController>(); ((Component)this).gameObject.AddComponent<ProgresoFisico>(); MTBundle.Load(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location)); ((Component)this).gameObject.AddComponent<ToukiAura>(); ((Component)this).gameObject.AddComponent<ToukiManos>(); ((Component)this).gameObject.AddComponent<ToukiPunos>(); ((Component)this).gameObject.AddComponent<ToukiCuerpo>(); Paso("diario", delegate { PaginasCore.Registrar(); ((Component)this).gameObject.AddComponent<DiarioVentana>(); }); CommandManager.Instance.AddConsoleCommand((ConsoleCommand)(object)new AliasCommand("mt_status", "Show mana, Body Level and Toki", (ConsoleCommand)(object)new EstadoCommand())); CommandManager.Instance.AddConsoleCommand((ConsoleCommand)(object)new AliasCommand("mt_specialties", "Show your specialties, ranks and the Guild", (ConsoleCommand)(object)new EspecialidadesCommand())); CommandManager.Instance.AddConsoleCommand((ConsoleCommand)(object)new AliasCommand("mt_awaken", "[cheat] Awaken your Toki now", (ConsoleCommand)(object)new DespertarCommand())); CommandManager.Instance.AddConsoleCommand((ConsoleCommand)(object)new AliasCommand("mt_sleep", "[cheat] Put your Toki back to sleep (to test the awakening again)", (ConsoleCommand)(object)new DormirCommand())); CommandManager.Instance.AddConsoleCommand((ConsoleCommand)(object)new AliasCommand("mt_level", "[cheat] mt_level <reserve|control|mastery|meditation> <0-100>", (ConsoleCommand)(object)new NivelCommand())); CommandManager.Instance.AddConsoleCommand((ConsoleCommand)(object)new AliasCommand("mt_boss", "[cheat] mt_boss <key> — register a defeated boss (e.g. defeated_eikthyr)", (ConsoleCommand)(object)new JefeCommand())); CommandManager.Instance.AddConsoleCommand((ConsoleCommand)(object)new AliasCommand("mt_milestone", "[cheat] mt_milestone <reflex|natural|mastery> — complete a milestone achievement (still needs the Toki level)", (ConsoleCommand)(object)new HitoCommand())); CommandManager.Instance.AddConsoleCommand((ConsoleCommand)(object)new AliasCommand("mt_talent", "[cheat] mt_talent <normal|greatreserve|laplace> — change your birth talent", (ConsoleCommand)(object)new TalentoCommand())); CommandManager.Instance.AddConsoleCommand((ConsoleCommand)(object)new ManaCommand()); CommandManager.Instance.AddConsoleCommand((ConsoleCommand)(object)new AliasCommand("mt_dragon_god", "[cheat] mt_dragon_god <on|off> — force the Dragon God caps (1000 health, stamina and mana) for testing", (ConsoleCommand)(object)new DiosDragonCommand())); new Harmony("mushokutensei.core").PatchAll(); ModCompat.Report(); Log.LogInfo((object)"MT Core 1.8.0 cargado"); } } public static class MTGui { public static readonly Color Oro = new Color(1f, 0.72f, 0.36f); public static readonly Color Texto = new Color(0.93f, 0.9f, 0.84f); public static readonly Color Gris = new Color(0.65f, 0.63f, 0.6f); public static readonly Color Naranja = new Color(1f, 0.55f, 0.12f); public static readonly Color Azul = new Color(0.45f, 0.7f, 1f); public static readonly Color Rojo = new Color(1f, 0.35f, 0.3f); private static Font _font; private static float _fontRetry; private static Texture2D _white; private static Texture2D _panel; private static Texture2D _border; private static GUIStyle _style; private static readonly string[] SinAveria = new string[6] { "Russian", "Ukrainian", "Chinese", "Chinese_Trad", "Japanese", "Korean" }; public static float Scale => Mathf.Clamp((float)Screen.height / 1080f, 0.75f, 2f); private static Font ValheimFont() { if (Array.IndexOf(SinAveria, Tr.Current) >= 0) { return null; } if ((Object)(object)_font != (Object)null) { return _font; } if (Time.unscaledTime < _fontRetry) { return null; } _fontRetry = Time.unscaledTime + 5f; Font[] source = Resources.FindObjectsOfTypeAll<Font>(); _font = ((IEnumerable<Font>)source).FirstOrDefault((Func<Font, bool>)((Font f) => ((Object)f).name.Contains("AveriaSerifLibre-Bold"))) ?? ((IEnumerable<Font>)source).FirstOrDefault((Func<Font, bool>)((Font f) => ((Object)f).name.StartsWith("Averia"))) ?? ((IEnumerable<Font>)source).FirstOrDefault((Func<Font, bool>)((Font f) => ((Object)f).name.Contains("Norse"))); return _font; } private static Texture2D Solid(Color c) { //IL_0002: 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_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0012: 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_001f: Expected O, but got Unknown Texture2D val = new Texture2D(1, 1) { hideFlags = (HideFlags)61 }; val.SetPixel(0, 0, c); val.Apply(); return val; } private static void Init() { //IL_000e: 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_0054: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_white != (Object)null)) { _white = Solid(Color.white); _panel = Solid(new Color(0.08f, 0.07f, 0.06f, 0.78f)); _border = Solid(new Color(0.55f, 0.4f, 0.2f, 0.9f)); } } public static GUIStyle Style(int size, Color color, TextAnchor anchor = (TextAnchor)3, bool bold = false) { //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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown //IL_006a: 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) Init(); if (_style == null) { _style = new GUIStyle(GUI.skin.label) { richText = true, wordWrap = false }; } _style.font = ValheimFont(); _style.fontSize = Mathf.RoundToInt((float)size * Scale); _style.fontStyle = (FontStyle)(bold ? 1 : 0); _style.alignment = anchor; _style.normal.textColor = color; return _style; } public static void Label(Rect r, string text, int size, Color color, TextAnchor anchor = (TextAnchor)3, bool bold = false) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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_005f: 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) GUIStyle val = Style(size, new Color(0f, 0f, 0f, 0.85f), anchor, bold); GUI.Label(new Rect(((Rect)(ref r)).x + 1.5f, ((Rect)(ref r)).y + 1.5f, ((Rect)(ref r)).width, ((Rect)(ref r)).height), StripColors(text), val); val = Style(size, color, anchor, bold); GUI.Label(r, text, val); } private static string StripColors(string s) { return Regex.Replace(s, "<color=[^>]*>|</color>", ""); } public static void Panel(Rect r) { //IL_0005: 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_0052: Unknown result type (might be due to invalid IL or missing references) Init(); GUI.color = Color.white; GUI.DrawTexture(new Rect(((Rect)(ref r)).x - 2f, ((Rect)(ref r)).y - 2f, ((Rect)(ref r)).width + 4f, ((Rect)(ref r)).height + 4f), (Texture)(object)_border); GUI.DrawTexture(r, (Texture)(object)_panel); } public static void Bar(Rect r, float fill, Color color) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0082: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00de: 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_011b: Unknown result type (might be due to invalid IL or missing references) Init(); fill = Mathf.Clamp01(fill); GUI.color = new Color(0.55f, 0.4f, 0.2f, 0.9f); GUI.DrawTexture(new Rect(((Rect)(ref r)).x - 2f, ((Rect)(ref r)).y - 2f, ((Rect)(ref r)).width + 4f, ((Rect)(ref r)).height + 4f), (Texture)(object)_white); GUI.color = new Color(0.05f, 0.05f, 0.05f, 0.85f); GUI.DrawTexture(r, (Texture)(object)_white); GUI.color = color; GUI.DrawTexture(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, ((Rect)(ref r)).width * fill, ((Rect)(ref r)).height), (Texture)(object)_white); GUI.color = new Color(1f, 1f, 1f, 0.25f); GUI.DrawTexture(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, ((Rect)(ref r)).width * fill, ((Rect)(ref r)).height * 0.35f), (Texture)(object)_white); GUI.color = Color.white; } public static void Icon(Rect r, Sprite sprite, float alpha = 1f) { //IL_000a: 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) //IL_0020: 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_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_007d: 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) if (!((Object)(object)sprite == (Object)null)) { Color color = GUI.color; GUI.color = new Color(1f, 1f, 1f, alpha * color.a); Texture2D texture = sprite.texture; Rect textureRect = sprite.textureRect; GUI.DrawTextureWithTexCoords(r, (Texture)(object)texture, new Rect(((Rect)(ref textureRect)).x / (float)((Texture)texture).width, ((Rect)(ref textureRect)).y / (float)((Texture)texture).height, ((Rect)(ref textureRect)).width / (float)((Texture)texture).width, ((Rect)(ref textureRect)).height / (float)((Texture)texture).height)); GUI.color = color; } } public static string Hex(Color c) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return ColorUtility.ToHtmlStringRGB(c); } } public static class MTKeys { public static ConfigEntry<KeyCode> Manto; public static ConfigEntry<KeyCode> Meditar; public static ConfigEntry<KeyCode> Paso; public static ConfigEntry<KeyCode> Lanzar; public static ConfigEntry<KeyCode> SiguienteHechizo; public static ConfigEntry<KeyCode> OcultarHechizo; public static ConfigEntry<KeyCode> MenuHechizos; public static ConfigEntry<KeyCode> Levitar; public static ConfigEntry<KeyCode> Aterrizar; public static ConfigEntry<KeyCode> Diario; public static void Bind(ConfigFile cfg) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) Manto = cfg.Bind<KeyCode>("0. Teclas", "Manto", (KeyCode)282, "Cargar el manto de tōki (mantener para apagarlo)."); Meditar = cfg.Bind<KeyCode>("0. Teclas", "Meditar", (KeyCode)104, "Meditar / dejar de meditar. Sentarse con X solo descansa (recupera maná sin gastarlo)."); if ((int)Meditar.Value == 0) { Meditar.Value = (KeyCode)104; } Paso = cfg.Bind<KeyCode>("0. Teclas", "PasoDeToki", (KeyCode)284, "Paso de Tōki (mod MT Paso)."); Lanzar = cfg.Bind<KeyCode>("0. Teclas", "LanzarHechizoTecla", (KeyCode)0, "Tecla opcional para lanzar el hechizo seleccionado (MT Magia). Por defecto ninguna: se lanza con el clic izquierdo y la varita o el bastón. F4 queda libre."); SiguienteHechizo = cfg.Bind<KeyCode>("0. Teclas", "SiguienteHechizo", (KeyCode)280, "Siguiente hechizo; con Alt, el anterior (mod MT Magia)."); MenuHechizos = cfg.Bind<KeyCode>("0. Teclas", "MenuHechizos", (KeyCode)290, "Abrir o cerrar el menú del grimorio: todos tus hechizos y los 9 favoritos (mod MT Magia)."); Levitar = cfg.Bind<KeyCode>("0. Teclas", "Levitar", (KeyCode)106, "Empezar a levitar (necesitas conocer Levitar, su rango y un foco en la mano) (mod MT Magia)."); Aterrizar = cfg.Bind<KeyCode>("0. Teclas", "Aterrizar", (KeyCode)107, "Dejar de levitar y bajar sin daño de caída (mod MT Magia)."); Diario = cfg.Bind<KeyCode>("0. Teclas", "Diario", (KeyCode)289, "Abrir o cerrar el Diario del aventurero: crónica, cuerpo y tōki, magia, espada y recetas."); OcultarHechizo = cfg.Bind<KeyCode>("0. Teclas", "OcultarHechizo", (KeyCode)281, "Ocultar/activar el hechizo seleccionado en el grimorio; con Alt, mostrar u ocultar la lista de ocultos (mod MT Magia)."); } public static bool Down(ConfigEntry<KeyCode> k) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return ZInput.GetKeyDown(k.Value, false); } public static bool Held(ConfigEntry<KeyCode> k) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return ZInput.GetKey(k.Value, false); } public static bool Up(ConfigEntry<KeyCode> k) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return ZInput.GetKeyUp(k.Value, false); } } public static class MTSkills { public static SkillType Reserva; public static SkillType Control; public static SkillType Dominio; public static SkillType Meditacion; public static SkillType Aguante; public static void Register(string iconDir) { //IL_001a: 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_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_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) Reserva = Add("reserva", Tr.Token("core_skill_reserva"), Tr.Token("core_skill_reserva_d"), iconDir); Control = Add("control", Tr.Token("core_skill_control"), Tr.Token("core_skill_control_d"), iconDir); Dominio = Add("dominio", Tr.Token("core_skill_dominio"), Tr.Token("core_skill_dominio_d"), iconDir); Aguante = Add("aguante", Tr.Token("core_skill_aguante"), Tr.Token("core_skill_aguante_d"), iconDir); Meditacion = Add("meditacion", Tr.Token("core_skill_meditacion"), Tr.Token("core_skill_meditacion_d"), iconDir); } private static SkillType Add(string id, string name, string description, string iconDir) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) return SkillManager.Instance.AddSkill(new SkillConfig { Identifier = "mushokutensei.core." + id, Name = name, Description = description, Icon = LoadIcon(iconDir, id), IncreaseStep = 1f }); } public static Sprite LoadIcon(string iconDir, string name) { string text = Path.Combine(iconDir, name + ".png"); if (!File.Exists(text)) { return null; } return AssetUtils.LoadSpriteFromFile(text); } } [HarmonyPatch(typeof(DamageText), "AddInworldText")] public static class NumerosDanoPatch { private static readonly Color Amarillo = new Color(1f, 0.92f, 0.35f); private static readonly Color Naranja = new Color(1f, 0.6f, 0.15f); private static readonly Color Rojo = new Color(1f, 0.2f, 0.15f); private static void Postfix(DamageText __instance, TextType type, string text) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //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_001a: Invalid comparison between Unknown and I4 //IL_00ea: 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_00fb: 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_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) if (!CoreConfig.NumerosDanoColor.Value || ((int)type != 0 && (int)type != 2 && (int)type != 1 && (int)type != 7) || (!float.TryParse(text, NumberStyles.Float, CultureInfo.InvariantCulture, out var result) && !float.TryParse(text, NumberStyles.Float, CultureInfo.CurrentCulture, out result))) { return; } IList value = Traverse.Create((object)__instance).Field("m_worldTexts").GetValue<IList>(); if (value != null && value.Count != 0) { TMP_Text value2 = Traverse.Create(value[value.Count - 1]).Field("m_textField").GetValue<TMP_Text>(); if (!((Object)(object)value2 == (Object)null)) { float num = Mathf.InverseLerp(Mathf.Log(5f), Mathf.Log(CoreConfig.NumerosDanoRojo.Value), Mathf.Log(Mathf.Max(result, 1f))); Color color = ((num < 0.5f) ? Color.Lerp(Amarillo, Naranja, num * 2f) : Color.Lerp(Naranja, Rojo, (num - 0.5f) * 2f)); color.a = ((Graphic)value2).color.a; ((Graphic)value2).color = color; } } } } public static class Rangos { public const int Count = 7; public static string[] Names { get { string[] array = new string[7]; for (int i = 0; i < 7; i++) { array[i] = Name(i); } return array; } } public static string Name(int rank) { return Tr.Get("core_rank_" + rank); } } public static class Topes { private const string Key = "MT.Core.DiosDragon"; public static Func<Player, bool> DiosDragonCheck; public static bool IsDiosDragon(Player p) { if ((Object)(object)p != (Object)null) { if (!p.m_customData.ContainsKey("MT.Core.DiosDragon")) { return DiosDragonCheck?.Invoke(p) ?? false; } return true; } return false; } public static float Cap(Player p) { if (!IsDiosDragon(p)) { return CoreConfig.TopeGeneral.Value; } return CoreConfig.TopeDiosDragon.Value; } public static float CapStamina(Player p) { if (!IsDiosDragon(p)) { return CoreConfig.TopeStamina.Value; } return CoreConfig.TopeDiosDragon.Value; } public static float CapMana(Player p) { if (!IsDiosDragon(p)) { return CoreConfig.TopeMana.Value; } return CoreConfig.TopeDiosDragon.Value; } public static void SetForced(Player p, bool on) { if (on) { p.m_customData["MT.Core.DiosDragon"] = "1"; } else { p.m_customData.Remove("MT.Core.DiosDragon"); } } } public class DiosDragonCommand : ConsoleCommand { public override string Name => "mt_dragon_god"; public override string Help => "[cheat] mt_dragon_god <on|off> — force the Dragon God caps (1000 health, stamina and mana) for testing"; public override bool IsCheat => true; public override void Run(string[] args) { Player localPlayer = Player.m_localPlayer; if (!((Object)(object)localPlayer == (Object)null)) { if (args.Length != 0) { Topes.SetForced(localPlayer, args[0].ToLowerInvariant() != "off"); } string text = (Topes.IsDiosDragon(localPlayer) ? Tr.Get("core_yes") : Tr.Get("core_no")); Console.instance.Print(Tr.Get("core_dragon_god_caps_health_stamina", text, Topes.Cap(localPlayer), Topes.CapStamina(localPlayer), Topes.CapMana(localPlayer))); } } } public static class XpTexto { public static readonly Color Oro = new Color(1f, 0.85f, 0.3f); public static readonly Color Cian = new Color(0.45f, 0.9f, 1f); private static float _ultimo; private static Material _mat; public static void Mostrar(Player p, string texto, Color color, int flechas = 6, bool conTexto = false) { //IL_0034: 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_003d: 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_0070: 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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008b: 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_00ec: 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_00f9: 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) if ((Object)(object)p == (Object)null || !CoreConfig.TextoXp.Value || Time.time - _ultimo < 0.15f) { return; } _ultimo = Time.time; Flechas(p, color, flechas); Explicar(p, color == Cian); if (!conTexto || !CoreConfig.NumerosXp.Value || (Object)(object)DamageText.instance == (Object)null) { return; } Vector3 val = ((Character)p).GetTopPoint() + Vector3.up * 0.3f; DamageText.instance.ShowText((TextType)7, val, texto, true); IList value = Traverse.Create((object)DamageText.instance).Field("m_worldTexts").GetValue<IList>(); if (value != null && value.Count != 0) { TMP_Text value2 = Traverse.Create(value[value.Count - 1]).Field("m_textField").GetValue<TMP_Text>(); if ((Object)(object)value2 != (Object)null) { ((Graphic)value2).color = new Color(color.r, color.g, color.b, ((Graphic)value2).color.a); } } } private static void Explicar(Player p, bool cuerpo) { string key = (cuerpo ? "MT.Core.AvisoFlechas.Cuerpo" : "MT.Core.AvisoFlechas.Espada"); p.m_customData.TryGetValue(key, out var value); int.TryParse(value, out var result); if (result < 3) { p.m_customData[key] = (result + 1).ToString(); ((Character)p).Message((MessageType)1, Tr.Get(cuerpo ? "core_xp_arrows_body_hint" : "core_xp_arrows_sword_hint"), 0, (Sprite)null, false); } } private static void Flechas(Player p, Color color, int count) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: 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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //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_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: 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_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0152: 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_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Expected O, but got Unknown //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: 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_0227: Unknown result type (might be due to invalid IL or missing references) Material val = Material(); if (!((Object)(object)val == (Object)null)) { GameObject val2 = new GameObject("MT_XpFlechas"); val2.transform.SetParent(((Component)p).transform, false); val2.transform.localPosition = Vector3.up * 0.3f; ParticleSystem val3 = val2.AddComponent<ParticleSystem>(); val3.Stop(true, (ParticleSystemStopBehavior)0); MainModule main = val3.main; ((MainModule)(ref main)).loop = false; ((MainModule)(ref main)).duration = 0.4f; ((MainModule)(ref main)).startLifetime = new MinMaxCurve(0.9f, 1.4f); ((MainModule)(ref main)).startSpeed = new MinMaxCurve(0.9f, 1.6f); ((MainModule)(ref main)).startSize = new MinMaxCurve(0.12f, 0.2f); ((MainModule)(ref main)).startColor = new MinMaxGradient(color, Color.Lerp(color, Color.white, 0.5f)); ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)0; EmissionModule emission = val3.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(0f); ((EmissionModule)(ref emission)).SetBursts((Burst[])(object)new Burst[1] { new Burst(0f, (short)Mathf.Clamp(count, 2, 30)) }); ShapeModule shape = val3.shape; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)10; ((ShapeModule)(ref shape)).radius = 0.55f; ((ShapeModule)(ref shape)).rotation = new Vector3(-90f, 0f, 0f); ColorOverLifetimeModule colorOverLifetime = val3.colorOverLifetime; ((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = true; Gradient val4 = new Gradient(); val4.SetKeys((GradientColorKey[])(object)new GradientColorKey[2] { new GradientColorKey(Color.white, 0f), new GradientColorKey(Color.white, 1f) }, (GradientAlphaKey[])(object)new GradientAlphaKey[4] { new GradientAlphaKey(0f, 0f), new GradientAlphaKey(1f, 0.15f), new GradientAlphaKey(1f, 0.6f), new GradientAlphaKey(0f, 1f) }); ((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(val4); ParticleSystemRenderer component = val2.GetComponent<ParticleSystemRenderer>(); component.renderMode = (ParticleSystemRenderMode)0; ((Renderer)component).sharedMaterial = val; Light obj = val2.AddComponent<Light>(); obj.color = color; obj.range = 2.5f; obj.intensity = 0.8f; Object.Destroy((Object)(object)obj, 0.4f); val3.Play(); Object.Destroy((Object)(object)val2, 2f); } } private static Material Material() { //IL_002f: 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_003c: Expected O, but got Unknown //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Expected O, but got Unknown //IL_00e4: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_mat != (Object)null) { return _mat; } Shader val = Shader.Find("Sprites/Default"); if ((Object)(object)val == (Object)null) { return null; } Texture2D val2 = new Texture2D(32, 32, (TextureFormat)4, false) { wrapMode = (TextureWrapMode)1 }; for (int i = 0; i < 32; i++) { for (int j = 0; j < 32; j++) { float num = ((float)j + 0.5f) / 32f - 0.5f; float num2 = ((float)i + 0.5f) / 32f; float num3 = 0f; if (num2 > 0.5f && num2 < 0.95f && Mathf.Abs(num) < (0.95f - num2) * 0.9f) { num3 = 1f; } else if (num2 > 0.08f && num2 <= 0.52f && Mathf.Abs(num) < 0.11f) { num3 = 1f; } val2.SetPixel(j, i, new Color(1f, 1f, 1f, num3)); } } val2.Apply(); _mat = new Material(val) { mainTexture = (Texture)(object)val2 }; return _mat; } } } namespace MT.Core.Vfx { public static class MTBundle { private static AssetBundle _bundle; private static readonly HashSet<string> _avisados = new HashSet<string>(); public static void Load(string pluginDir) { string text = Path.Combine(pluginDir, "Bundles", "mt_vfx"); if (!File.Exists(text)) { MTCorePlugin.Log.LogWarning((object)("No está el paquete de efectos: " + text)); return; } _bundle = AssetBundle.LoadFromFile(text); if ((Object)(object)_bundle == (Object)null) { MTCorePlugin.Log.LogWarning((object)"No se pudo cargar mt_vfx"); return; } IEnumerable<string> source = (from n in _bundle.GetAllAssetNames() where n.EndsWith(".mat") select n).Select(Path.GetFileNameWithoutExtension); MTCorePlugin.Log.LogInfo((object)("Paquete de efectos mt_vfx cargado. Materiales: " + string.Join(", ", source.ToArray()))); } public static Material Material(string name) { //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Expected O, but got Unknown Material val = (((Object)(object)_bundle != (Object)null) ? _bundle.LoadAsset<Material>(name) : null); if ((Object)(object)val == (Object)null) { if (_avisados.Add(name)) { MTCorePlugin.Log.LogWarning((object)(((Object)(object)_bundle == (Object)null) ? ("No se puede usar el material " + name + ": el paquete mt_vfx no está cargado") : ("No se encontró el material " + name + " en mt_vfx"))); } return null; } if ((Object)(object)val.shader == (Object)null || !val.shader.isSupported) { if (_avisados.Add(name)) { MTCorePlugin.Log.LogWarning((object)("El shader del material " + name + " (" + (((Object)(object)val.shader != (Object)null) ? ((Object)val.shader).name : "ninguno") + ") no funciona en este equipo")); } return null; } if (_avisados.Add(name)) { MTCorePlugin.Log.LogInfo((object)("Efecto " + name + " listo (shader " + ((Object)val.shader).name + ")")); } return new Material(val); } } public class ToukiAura : MonoBehaviour { private const string CopyName = "MT_AuraCopia"; private Material _aura; private float _check; private readonly Dictionary<SkinnedMeshRenderer, SkinnedMeshRenderer> _copies = new Dictionary<SkinnedMeshRenderer, SkinnedMeshRenderer>(); private void Update() { //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0234: 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_0259: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if ((((Object)(object)localPlayer != (Object)null && !((Character)localPlayer).IsDead() && CoreConfig.AuraVisible.Value) ? Manto.Factor(localPlayer) : 0f) <= 0f) { Clear(); return; } if ((Object)(object)_aura == (Object)null) { _aura = MTBundle.Material("MT_ToukiAura"); if ((Object)(object)_aura == (Object)null) { return; } _aura.SetFloat("_Thickness", CoreConfig.AuraGrosor.Value); _aura.SetFloat("_EdgePower", 2.2f); _aura.SetFloat("_Fill", CoreConfig.AuraRelleno.Value); } _aura.SetFloat("_Intensity", (1.2f + 0.15f * (float)ToukiRules.Level(localPlayer)) * (Manto.Active ? 1f : 0.4f)); _check -= Time.deltaTime; if (_check > 0f) { return; } _check = 0.5f; foreach (SkinnedMeshRenderer item in (from kv in _copies where (Object)(object)kv.Key == (Object)null || (Object)(object)kv.Value == (Object)null select kv.Key).ToList()) { if ((Object)(object)_copies[item] != (Object)null) { Object.Destroy((Object)(object)((Component)_copies[item]).gameObject); } _copies.Remove(item); } SkinnedMeshRenderer[] componentsInChildren = ((Component)localPlayer).GetComponentsInChildren<SkinnedMeshRenderer>(); foreach (SkinnedMeshRenderer val in componentsInChildren) { if (!(((Object)val).name == "MT_AuraCopia") && !((Object)(object)val.sharedMesh == (Object)null) && !_copies.ContainsKey(val)) { GameObject val2 = new GameObject("MT_AuraCopia") { layer = ((Component)val).gameObject.layer }; val2.transform.SetParent(((Component)val).transform.parent, false); val2.transform.localPosition = ((Component)val).transform.localPosition; val2.transform.localRotation = ((Component)val).transform.localRotation; val2.transform.localScale = ((Component)val).transform.localScale; SkinnedMeshRenderer val3 = val2.AddComponent<SkinnedMeshRenderer>(); val3.sharedMesh = val.sharedMesh; val3.bones = val.bones; val3.rootBone = val.rootBone; val3.updateWhenOffscreen = true; ((Renderer)val3).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)val3).receiveShadows = false; ((Renderer)val3).sharedMaterials = Enumerable.Repeat<Material>(_aura, val.sharedMesh.subMeshCount).ToArray(); _copies[val] = val3; } } foreach (KeyValuePair<SkinnedMeshRenderer, SkinnedMeshRenderer> copy in _copies) { ((Renderer)copy.Value).enabled = ((Renderer)copy.Key).enabled && ((Component)copy.Key).gameObject.activeInHierarchy; } } private void Clear() { if (_copies.Count == 0) { return; } foreach (SkinnedMeshRenderer value in _copies.Values) { if ((Object)(object)value != (Object)null) { Object.Destroy((Object)(object)((Component)value).gameObject); } } _copies.Clear(); } } public class ToukiPunos : MonoBehaviour { private Material _mat; private GameObject _l; private GameObject _r; private Player _for; private void Update() { Player localPlayer = Player.m_localPlayer; float num = (((Object)(object)localPlayer != (Object)null && !((Character)localPlayer).IsDead() && CoreConfig.AuraPunos.Value) ? Manto.Factor(localPlayer) : 0f); if ((Object)(object)localPlayer != (Object)(object)_for) { Clear(); _for = localPlayer; } if (num <= 0f) { Show(on: false); return; } if ((Object)(object)_mat == (Object)null) { _mat = MTBundle.Material("MT_ToukiAura"); } if ((Object)(object)_mat == (Object)null) { return; } if ((Object)(object)_l == (Object)null || (Object)(object)_r == (Object)null) { VisEquipment component = ((Component)localPlayer).GetComponent<VisEquipment>(); if ((Object)(object)component == (Object)null || (Object)(object)component.m_leftHand == (Object)null || (Object)(object)component.m_rightHand == (Object)null) { return; } Clear(); _l = Orb(component.m_leftHand); _r = Orb(component.m_rightHand); } _mat.SetFloat("_Intensity", (1.2f + 0.15f * (float)ToukiRules.Level(localPlayer)) * (Manto.Active ? 1f : 0.4f)); Show(on: true); } private GameObject Orb(Transform hand) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) GameObject obj = GameObject.CreatePrimitive((PrimitiveType)0); Object.Destroy((Object)(object)obj.GetComponent<Collider>()); ((Object)obj).name = "MT_ToukiPuno"; obj.transform.SetParent(hand, false); float value = CoreConfig.AuraManosTamano.Value; obj.transform.localScale = new Vector3(value, value, value * 1.3f); MeshRenderer component = obj.GetComponent<MeshRenderer>(); ((Renderer)component).sharedMaterial = _mat; ((Renderer)component).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)component).receiveShadows = false; return obj; } private void Show(bool on) { if ((Object)(object)_l != (Object)null && _l.activeSelf != on) { _l.SetActive(on); } if ((Object)(object)_r != (Object)null && _r.activeSelf != on) { _r.SetActive(on); } } private void Clear() { if ((Object)(object)_l != (Object)null) { Object.Destroy((Object)(object)_l); } if ((Object)(object)_r != (Object)null) { Object.Destroy((Object)(object)_r); } _l = (_r = null); } } public class ToukiCuerpo : MonoBehaviour { private static readonly string[] Huesos = new string[16] { "Hips", "Spine", "Spine1", "Spine2", "Neck", "Head", "LeftArm", "LeftForeArm", "RightArm", "RightForeArm", "LeftUpLeg", "LeftLeg", "LeftFoot", "RightUpLeg", "RightLeg", "RightFoot" }; private readonly List<ParticleSystem> _ps = new List<ParticleSystem>(); private Player _for; private void Update() { Player localPlayer = Player.m_localPlayer; float num = (((Object)(object)localPlayer != (Object)null && !((Character)localPlayer).IsDead() && CoreConfig.LlamasParticulas.Value) ? Manto.Factor(localPlayer) : 0f); if ((Object)(object)localPlayer != (Object)(object)_for) { Clear(); _for = localPlayer; } if (num <= 0f) { Rate(0f); return; } if (_ps.Count == 0) { Build(localPlayer); } int num2 = ToukiRules.Level(localPlayer); Rate((6f + 1.5f * (float)num2) * (Manto.Active ? 1f : 0.35f)); } private void Build(Player p) { SkinnedMeshRenderer val = ((Component)p).GetComponent<VisEquipment>()?.m_bodyModel; if ((Object)(object)val == (Object)null || val.bones == null) { return; } Transform[] bones = val.bones; foreach (Transform val2 in bones) { if (!((Object)(object)val2 == (Object)null)) { string n = ((Object)val2).name; if (Huesos.Any((string h) => n == h || n.EndsWith(":" + h) || n.EndsWith("_" + h))) { bool flag = n.Contains("Spine") || n.Contains("Hips"); _ps.Add(ToukiManos.Flame(val2, flag ? 0.16f : 0.09f, 0.14f, 0.3f)); } } } if (_ps.Count == 0) { List<Transform> list = val.bones.Where((Transform x) => (Object)(object)x != (Object)null && !((Object)x).name.ToLower().Contains("finger") && !((Object)x).name.ToLower().Contains("thumb")).ToList(); int num = Mathf.Max(1, list.Count / 16); for (int num2 = 0; num2 < list.Count; num2 += num) { _ps.Add(ToukiManos.Flame(list[num2], 0.12f, 0.14f, 0.3f)); } MTCorePlugin.Log.LogWarning((object)("Aura de tōki: huesos con otros nombres; uso " + _ps.Count + " de " + val.bones.Length)); } else { MTCorePlugin.Log.LogInfo((object)("Aura de tōki: " + _ps.Count + " emisores en el cuerpo")); } } private void Rate(float r) { //IL_0020: 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_0029: Unknown result type (might be due to invalid IL or missing references) foreach (ParticleSystem p in _ps) { if (!((Object)(object)p == (Object)null)) { EmissionModule emission = p.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(r); } } } private void Clear() { foreach (ParticleSystem p in _ps) { if ((Object)(object)p != (Object)null) { Object.Destroy((Object)(object)((Component)p).gameObject); } } _ps.Clear(); } } public class ToukiManos : MonoBehaviour { private ParticleSystem _left; private ParticleSystem _right; private Player _for; private static Texture2D _tex; private void Update() { Player localPlayer = Player.m_localPlayer; float num = (((Object)(object)localPlayer != (Object)null && !((Character)localPlayer).IsDead() && CoreConfig.LlamasParticulas.Value) ? Manto.Factor(localPlayer) : 0f); if ((Object)(object)localPlayer != (Object)(object)_for) { Destroy(); _for = localPlayer; } if (num <= 0f) { Emit(0f); return; } if ((Object)(object)_left == (Object)null || (Object)(object)_right == (Object)null) { VisEquipment component = ((Component)localPlayer).GetComponent<VisEquipment>(); if ((Object)(object)component == (Object)null || (Object)(object)component.m_leftHand == (Object)null || (Object)(object)component.m_rightHand == (Object)null) { return; } _left = Create(component.m_leftHand); _right = Create(component.m_rightHand); } int num2 = ToukiRules.Level(localPlayer); Emit((12f + 3f * (float)num2) * (Manto.Active ? 1f : 0.35f)); } private void Emit(float rate) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: 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) ParticleSystem[] array = (ParticleSystem[])(object)new ParticleSystem[2] { _left, _right }; foreach (ParticleSystem val in array) { if (!((Object)(object)val == (Object)null)) { EmissionModule emission = val.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(rate); } } } private void Destroy() { if ((Object)(object)_left != (Object)null) { Object.Destroy((Object)(object)((Component)_left).gameObject); } if ((Object)(object)_right != (Object)null) { Object.Destroy((Object)(object)((Component)_right).gameObject); } _left = (_right = null); } private static ParticleSystem Create(Transform hand) { return Flame(hand, 0.07f, 0.08f, 0.18f); } public static ParticleSystem Flame(Transform bone, float radius, float sizeMin, float sizeMax) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_002a: 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_0050: 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_0074: 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_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_00c3: 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_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: 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_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Expected O, but got Unknown //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_014c: 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_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: 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_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Expected O, but got Unknown GameObject val = new GameObject("MT_ToukiMano"); val.transform.SetParent(bone, false); ParticleSystem val2 = val.AddComponent<ParticleSystem>(); val2.Stop(true, (ParticleSystemStopBehavior)0); MainModule main = val2.main; ((MainModule)(ref main)).duration = 1f; ((MainModule)(ref main)).loop = true; ((MainModule)(ref main)).startLifetime = new MinMaxCurve(0.35f, 0.6f); ((MainModule)(ref main)).startSpeed = new MinMaxCurve(0.1f, 0.35f); ((MainModule)(ref main)).startSize = new MinMaxCurve(sizeMin, sizeMax); ((MainModule)(ref main)).startColor = new MinMaxGradient(new Color(1f, 0.55f, 0.1f, 0.9f), new Color(1f, 0.85f, 0.3f, 0.8f)); ((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(-0.35f); ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1; ((MainModule)(ref main)).maxParticles = 200; EmissionModule emission = val2.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(0f); ShapeModule shape = val2.shape; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)0; ((ShapeModule)(ref shape)).radius = radius; ColorOverLifetimeModule colorOverLifetime = val2.colorOverLifetime; ((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = true; Gradient val3 = new Gradient(); val3.SetKeys((GradientColorKey[])(object)new GradientColorKey[2] { new GradientColorKey(new Color(1f, 0.8f, 0.3f), 0f), new GradientColorKey(new Color(1f, 0.35f, 0.05f), 1f) }, (GradientAlphaKey[])(object)new GradientAlphaKey[3] { new GradientAlphaKey(0f, 0f), new GradientAlphaKey(0.9f, 0.15f), new GradientAlphaKey(0f, 1f) }); ((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(val3); SizeOverLifetimeModule sizeOverLifetime = val2.sizeOverLifetime; ((SizeOverLifetimeModule)(ref sizeOverLifetime)).enabled = true; ((SizeOverLifetimeModule)(ref sizeOverLifetime)).size = new MinMaxCurve(1f, AnimationCurve.Linear(0f, 1f, 1f, 0.3f)); ParticleSystemRenderer component = val.GetComponent<ParticleSystemRenderer>(); Shader val4 = Shader.Find("Legacy Shaders/Particles/Additive") ?? Shader.Find("Sprites/Default"); ((Renderer)component).material = new Material(val4) { mainTexture = (Texture)(object)Dot() }; component.renderMode = (ParticleSystemRenderMode)0; val2.Play(); return val2; } public static Texture2D Dot() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_002f: 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_0075: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_tex != (Object)null) { return _tex; } _tex = new Texture2D(32, 32, (TextureFormat)4, false); for (int i = 0; i < 32; i++) { for (int j = 0; j < 32; j++) { float num = Vector2.Distance(new Vector2((float)j, (float)i), new Vector2(15.5f, 15.5f)) / 16f; float num2 = Mathf.Clamp01(1f - num); _tex.SetPixel(j, i, new Color(1f, 1f, 1f, num2 * num2)); } } _tex.Apply(); return _tex; } } } namespace MT.Core.Touki { public static class BodyLevel { public struct Breakdown { public float Combat; public float Movement; public float Dexterity; public float Labor; public float Total; } public static readonly SkillType[] MeleeWeapons; public static readonly SkillType[] RangedWeapons; public static readonly SkillType[] Work; public static readonly SkillType[] Physical; public static bool IsPhysical(SkillType skill) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) return Physical.Contains(skill); } public static Breakdown Compute(Player player) { Breakdown result = new Breakdown { Combat = 0.6f * ((IEnumerable<SkillType>)MeleeWeapons).Max((Func<SkillType, float>)Lv) + 0.4f * Lv((SkillType)6), Movement = (Lv((SkillType)102) + Lv((SkillType)100) + Lv((SkillType)103)) / 3f, Dexterity = (((IEnumerable<SkillType>)RangedWeapons).Max((Func<SkillType, float>)Lv) + Lv((SkillType)101)) / 2f, Labor = (from x in Work.Select(Lv) orderby x descending select x).Take(2).Average() }; result.Total = Mathf.Clamp(0.45f * result.Combat + 0.25f * result.Movement + 0.15f * result.Dexterity + 0.15f * result.Labor, 0f, 100f); return result; float Lv(SkillType s) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return ((Character)player).GetSkillLevel(s); } } static BodyLevel() { SkillType[] array = new SkillType[7]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); MeleeWeapons = (SkillType[])(object)array; RangedWeapons = (SkillType[])(object)new SkillType[2] { (SkillType)8, (SkillType)14 }; SkillType[] array2 = new SkillType[3]; RuntimeHelpers.InitializeArray(array2, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); Work = (SkillType[])(object)array2; IEnumerable<SkillType> first = MeleeWeapons.Concat(RangedWeapons).Concat(Work); SkillType[] array3 = new SkillType[5]; RuntimeHelpers.InitializeArray(array3, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); Physical = first.Concat((IEnumerable<SkillType>)(object)array3).ToArray(); } } [HarmonyPatch(typeof(Character), "Damage")] public static class OutgoingDamagePatch { private static void Prefix(Character __instance, HitData hit) { 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; } int num = ToukiRules.Level(localPlayer); if (num <= 0) { return; } float num2 = WeaponMultiplier(hit); if (!(num2 <= 0f)) { float num3 = SE_ToukiPasivo.Dano(num); float num4 = Manto.Factor(localPlayer); if (num4 > 0f && (!Manto.Active || Manto.Spend(localPlayer, CoreConfig.CostoGolpe.Value, isEffort: true) > 0f)) { num3 += (float)num * num4 * CoreConfig.DanoPorNivel.Value; Manto.TrainDominio(localPlayer, 0.5f); } float num5 = 1f + num3 * num2; hit.m_damage.m_blunt *= num5; hit.m_damage.m_slash *= num5; hit.m_damage.m_pierce *= num5; } } private static float WeaponMultiplier(HitData hit) { //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_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected I4, but got Unknown SkillType skill = hit.m_skill; switch (skill - 1) { case 10: return CoreConfig.PunosExtra.Value; case 0: case 1: case 2: case 3: case 4: case 6: return 1f; case 7: return 0.8f; case 13: return 0.6f; default: return 0f; } } } [HarmonyPatch] public static class ObjectDamagePatch { private static IEnumerable<MethodBase> TargetMethods() { Type[] array = new Type[6] { typeof(TreeBase), typeof(TreeLog), typeof(MineRock), typeof(MineRock5), typeof(Destructible), typeof(WearNTear) }; for (int i = 0; i < array.Length; i++) { MethodInfo methodInfo = AccessTools.Method(array[i], "Damage", new Type[1] { typeof(HitData) }, (Type[])null); if (methodInfo != null) { yield return methodInfo; } } } private static void Prefix(HitData hit) { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null || hit == null || (Object)(object)hit.GetAttacker() != (Object)(object)localPlayer) { return; } int num = ToukiRules.Level(localPlayer); if (num > 0) { float num2 = hit.m_damage.m_blunt + hit.m_damage.m_slash + hit.m_damage.m_pierce; if (num2 > 0f) { float num3 = Mathf.Min(1f, CoreConfig.TalarBase.Value + (float)num * CoreConfig.TalarPorNivel.Value); hit.m_damage.m_chop = Mathf.Max(hit.m_damage.m_chop, num2 * num3); hit.m_damage.m_pickaxe = Mathf.Max(hit.m_damage.m_pickaxe, num2 * num3); hit.m_toolTier = (short)Mathf.Max((int)hit.m_toolTier, 1 + num / 2); } float num4 = Manto.Factor(localPlayer); if (!(num4 <= 0f) && (!Manto.Active || !(Manto.Spend(localPlayer, CoreConfig.CostoGolpe.Value * 0.5f, isEffort: true) <= 0f))) { float num5 = 1f + (float)num * num4 * CoreConfig.DanoObjetosPorNivel.Value; hit.m_damage.m_chop *= num5; hit.m_damage.m_pickaxe *= num5; hit.m_damage.m_blunt *= num5; hit.m_damage.m_slash *= num5; hit.m_damage.m_pierce *= num5; } } } } [HarmonyPatch(typeof(Character), "RPC_Damage")] public static class IncomingDamagePatch { private static void Prefix(Character __instance, HitData hit) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Invalid comparison between Unknown and I4 //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Invalid comparison between Unknown and I4 //IL_0066: 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) Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null || (Object)(object)__instance != (Object)(object)localPlayer || hit == null || ((Character)localPlayer).IsDead()) { return; } if (hit.GetTotalDamage() > 0f && (int)hit.m_hitType != 3) { Meditacion.Interrupt(); } if (!ToukiState.IsAwakened(localPlayer)) { return; } int num = ToukiRules.Level(localPlayer); if ((int)hit.m_hitType == 3) { AbsorbFall(localPlayer, hit); return; } bool flag = Vector3.Dot(((Component)localPlayer).transform.forward, hit.m_dir) > 0.3f; float num2 = Mathf.Clamp01(1f - (float)num * CoreConfig.DurezaPorNivel.Value); hit.m_damage.m_blunt *= num2; hit.m_damage.m_slash *= num2; hit.m_damage.m_pierce *= num2; if (flag) { ((DamageTypes)(ref hit.m_damage)).Modify(Mathf.Clamp01(1f - (float)num * CoreConfig.SorpresaPorNivel.Value)); } float num3 = hit.m_damage.m_blunt + hit.m_damage.m_slash + hit.m_damage.m_pierce; if (num3 <= 0f) { return; } float num4 = 0f; if (Manto.Active) { float num5 = num3 * (float)num * CoreConfig.AmortiguarPorNivel.Value; num4 = Manto.Spend(localPlayer, num5, isEffort: true) / Manto.CostMultiplier(localPlayer); if (num4 < num5) { num4 += PayFromBlue(localPlayer, num5 - num4); } } else if (Manto.Factor(localPlayer) > 0f) { num4 = PayFromBlue(localPlayer, num3 * (float)num * CoreConfig.AmortiguarPorNivel.Value * Manto.Factor(localPlayer)); } else if (flag && Manto.TryReflex(localPlayer)) { num4 = PayFromBlue(localPlayer, num3 * (float)num * CoreConfig.AmortiguarPorNivel.Value); ((Character)localPlayer).Message((MessageType)1, Tr.Get("core_toki_reflex"), 0, (Sprite)null, false); } if (!(num4 <= 0f)) { Hitos.Add(localPlayer, Hito.Maestria, num4); if (flag && num3 - num4 < ((Character)localPlayer).GetHealth()) { Hitos.Add(localPlayer, Hito.Reflejo, 1f); } float num6 = Mathf.Clamp01((num3 - num4) / num3); hit.m_damage.m_blunt *= num6; hit.m_damage.m_slash *= num6; hit.m_damage.m_pierce *= num6; Manto.TrainDominio(localPlayer, num4 * 0.05f); } } private static void AbsorbFall(Player p, HitData hit) { float totalDamage = hit.GetTotalDamage(); if (!(totalDamage <= 0f)) { float num = 0f; if (Manto.Active) { num = Manto.Spend(p, totalDamage, isEffort: true) / Manto.CostMultiplier(p); } if (num < totalDamage) { num += PayFromBlue(p, totalDamage - num); } if (num > 0.5f) { ((Character)p).Message((MessageType)1, (num >= totalDamage - 0.01f) ? Tr.Get("core_toki_cushions_fall") : Tr.Get("core_toki_cushions_part_fall"), 0, (Sprite)null, false); } if (num > 0f) { Hitos.Add(p, Hito.Maestria, num); } float num2 = Mathf.Max(0f, totalDamage - num); num2 *= Mathf.Clamp01(1f - (float)ToukiRules.Level(p) * CoreConfig.CaidaVidaPorNivel.Value); num2 = Mathf.Min(num2, Mathf.Max(0f, ((Character)p).GetHealth() - CoreConfig.CaidaVidaMinima.Value)); if (num2 < totalDamage - num - 0.01f && num2 < ((Character)p).GetHealth()) { Hitos.Add(p, Hito.Reflejo, 1f); } ((DamageTypes)(ref hit.m_damage)).Modify(Mathf.Clamp01(num2 / totalDamage)); } } private static float PayFromBlue(Player p, float damage) { float num = Manto.CostMultiplier(p); float num2 = Mathf.Min(damage * num, p.GetEitr() - 1f); if (num2 <= 0f) { return 0f; } ((Character)p).UseEitr(num2); return num2 / num; } } [HarmonyPatch(typeof(Character), "ApplyDamage")] public static class GolpeMortalPatch { private static float _last = -9999f; private static void Prefix(Character __instance, HitData hit) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Invalid comparison between Unknown and I4 Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null || (Object)(object)__instance != (Object)(object)localPlayer || hit == null || ((Character)localPlayer).IsDead() || !ToukiState.IsAwakened(localPlayer) || (int)hit.m_hitType == 3) { return; } int num = ToukiRules.Level(localPlayer); float num2 = (Manto.Active ? CoreConfig.SalvarGolpeMortal.Value : ((CoreConfig.SalvarSinManto.Value > 0f) ? Mathf.Max(30f, CoreConfig.SalvarSinManto.Value - 10f * (float)num) : 0f)); if (num2 <= 0f) { return; } float totalDamage = hit.GetTotalDamage(); float value = CoreConfig.CaidaVidaMinima.Value; if (!(totalDamage < ((Character)localPlayer).GetHealth()) && !(Time.time - _last < num2) && !(((Character)localPlayer).GetHealth() <= value)) { _last = Time.time; ((DamageTypes)(ref hit.m_damage)).Modify(Mathf.Clamp01((((Character)localPlayer).GetHealth() - value) / totalDamage)); if (Manto.Active) { Manto.Spend(localPlayer, Manto.Charge / Manto.CostMultiplier(localPlayer) + 1f, isEffort: true); } ((Character)localPlayer).Message((MessageType)2, Tr.Get("core_toki_withstands_deadly_blow"), 0, (Sprite)null, false); } } } [HarmonyPatch(typeof(Skills), "OnDeath")] public static class DeathPatch { private static SkillType[] Tracked => (SkillType[])(object)new SkillType[5] { (SkillType)(int)MTSkills.Reserva, (SkillType)(int)MTSkills.Control, (SkillType)(int)MTSkills.Dominio, (SkillType)(int)MTSkills.Meditacion, (SkillType)(int)MTSkills.Aguante }; private static void Prefix(Skills __instance, out float[] __state) { __state = null; if (CoreConfig.Muerte.Value != CoreConfig.ModoMuerte.Clasico) { SkillType[] tracked = Tracked; __state = new float[tracked.Length]; for (int i = 0; i < tracked.Length; i++) { __state[i] = GetSkill(__instance, tracked[i]).m_level; } } } private static void Postfix(Skills __instance, float[] __state) { if (__state == null) { return; } float num = ((CoreConfig.Muerte.Value == CoreConfig.ModoMuerte.Protegido) ? 1f : 0.5f); SkillType[] tracked = Tracked; for (int i = 0; i < tracked.Length; i++) { Skill skill = GetSkill(__instance, tracked[i]); float num2 = __state[i] - skill.m_level; if (num2 > 0f) { skill.m_level += num2 * num; } } } private static Skill GetSkill(Skills skills, SkillType type) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) return Traverse.Create((object)skills).Method("GetSkill", new object[1] { type }).GetValue<Skill>(); } } public static class Entrenamiento { private const string TrainedKey = "MT.Core.StaminaEntrenada"; private const string DayKey = "MT.Core.EntrenoDia"; private const string CarryKey = "MT.Core.CargaEntrenada"; public static float StaminaEntrenada(Player p) { if (!p.m_customData.TryGetValue("MT.Core.StaminaEntrenada", out var value) || !float.TryParse(value, NumberStyles.Float, CultureInfo.InvariantCulture, out var result)) { return 0f; } return result; } public static float ProgresoEsfuerzo(Player p) { return ProgresoFisico.Read(p, "Esfuerzo"); } public static float CargaEntrenada(Player p) { if (!p.m_customData.TryGetValue("MT.Core.CargaEntrenada", out var value) || !float.TryParse(value, NumberStyles.Float, CultureInfo.InvariantCulture, out var result)) { return 0f; } return result; } public static void Entrenar(Player p, float effort) { i
plugins/MT.Espada/MT.Espada.dll
Decompiled 11 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Jotunn.Entities; using Jotunn.Managers; using Jotunn.Utils; using MT.Core; using MT.Core.Commands; using MT.Core.Diario; using MT.Core.Especialidades; using MT.Core.I18n; using MT.Core.Touki; using MT.Core.Vfx; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.Rendering; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")] [assembly: AssemblyCompany("MT.Espada")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+a3d1e112c18dad5152e45a99f4e3179a3ca51bec")] [assembly: AssemblyProduct("MT.Espada")] [assembly: AssemblyTitle("MT.Espada")] [assembly: AssemblyVersion("1.0.0.0")] [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 MT.Espada { public enum Arte { Corriente = 1, EspejoDelAgua, Contracorriente, Remolino, AguasQuietas } public static class Artes { private const string Key = "MT.Espada.Artes"; public static string Name(Arte a) { return a switch { Arte.Corriente => "I · " + Tr.Get("espada_current_parry_arrows_projectiles"), Arte.EspejoDelAgua => "II · " + Tr.Get("espada_water_mirror_block_from_behind"), Arte.Contracorriente => "III · " + Tr.Get("espada_countercurrent_after_parry_hit_always"), Arte.Remolino => "IV · " + Tr.Get("espada_whirlpool_perfect_parry_staggers_everyone"), _ => "V · " + Tr.Get("espada_still_waters_stand_1_s"), }; } public static int Slots(Player p) { int num = Estilos.Rank(p, Estilo.Agua); if (num < 6) { if (num < 5) { return (num >= 4) ? 1 : 0; } return 2; } return 3; } public static List<Arte> Learned(Player p) { if (!p.m_customData.TryGetValue("MT.Espada.Artes", out var value) || string.IsNullOrEmpty(value)) { return new List<Arte>(); } return (from s in value.Split(new char[1] { ',' }) select (Arte)int.Parse(s)).ToList(); } public static bool Has(Player p, Arte a) { return Learned(p).Contains(a); } public static string Learn(Player p, Arte a) { List<Arte> list = Learned(p); if (list.Contains(a)) { return Tr.Get("espada_already_master_that_art"); } if (list.Count >= Slots(p)) { return Tr.Get("espada_can_t_learn_more_arts", new object[1] { Slots(p) }); } list.Add(a); p.m_customData["MT.Espada.Artes"] = string.Join(",", list.Select(delegate(Arte x) { int num = (int)x; return num.ToString(); })); return Tr.Get("espada_learned_secret_art", new object[1] { Name(a) }); } public static bool HasPrivacion(Player p) { if (Estilos.Rank(p, Estilo.Agua) >= 6 && Has(p, Arte.Corriente)) { return Has(p, Arte.EspejoDelAgua); } return false; } } [HarmonyPatch(typeof(Character), "Damage")] public static class OutgoingStylePatch { private static bool _extraHit; private static readonly PropertyInfo PasoLastDash = AccessTools.TypeByName("MT.Paso.PasoController")?.GetProperty("LastDashTime", BindingFlags.Static | BindingFlags.Public); private static void Prefix(Character __instance, HitData hit) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Invalid comparison between Unknown and I4 //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Invalid comparison between Unknown and I4 //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Invalid comparison between Unknown and I4 //IL_0114: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if (!_extraHit && !((Object)(object)localPlayer == (Object)null) && hit != null && !((Object)(object)__instance == (Object)(object)localPlayer) && !((Object)(object)hit.GetAttacker() != (Object)(object)localPlayer) && Array.IndexOf(BodyLevel.MeleeWeapons, hit.m_skill) >= 0 && Maestria.Hostile(localPlayer, __instance) && !(hit.GetTotalDamage() <= 0f)) { Maestria.Reset(localPlayer); bool value = Traverse.Create((object)localPlayer).Field("m_currentAttackIsSecondary").GetValue<bool>(); float num = 0f; if ((int)hit.m_skill == 1) { num += SwordGod(localPlayer, __instance, hit, value); } if ((int)hit.m_skill != 11) { num += WaterGod(localPlayer, __instance, hit); } num += NorthGod(localPlayer, __instance, hit, value); if ((int)hit.m_skill == 11) { Logros.Add(localPlayer, Logro.Desarmado); } num = Mathf.Min(num, 3f); if (num > 0f) { ((DamageTypes)(ref hit.m_damage)).Modify(1f + num); } MultiGolpe(localPlayer, __instance, hit); CombatState.LastHitTime = Time.time; if ((int)hit.m_skill == 1) { EntrenamientoEspada.Contact(localPlayer, combat: true); EstiloVfx.Burst(localPlayer, Estilo.Espada, hit.m_point); } if (value || __instance.IsStaggering() || Time.time - CombatState.LastDodgeStart < 2f) { Maestria.Train(localPlayer, Estilo.Norte, 3); } } } private static float SwordGod(Player p, Character target, HitData hit, bool secondary) { //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) int rank = Estilos.BonusRank(p, Estilo.Espada); int num = Estilos.Rank(p, Estilo.Espada); float num2 = 0.025f * (float)num; int num3 = (EntrenamientoEspada.ComboHit = EntrenamientoEspada.Session.CombatHit(Time.time, CombatState.LastDamagedTime)); float num4 = ((PasoLastDash != null) ? ((float)PasoLastDash.GetValue(null)) : (-999f)); if (target.GetHealth() >= target.GetMaxHealth() * 0.999f || Time.time - num4 < 1f) { num2 += Estilos.Scale(rank, 0.05f, 0.2f, 0.35f); Logros.Add(p, Logro.PrimerGolpe); } CombatState.NoteFirstHit(target); if (((Character)p).IsRunning()) { num2 += Estilos.Scale(rank, 0f, 0.1f, 0.2f); Logros.Add(p, Logro.GolpeCorriendo); } Attack value = Traverse.Create((object)p).Field("m_currentAttack").GetValue<Attack>(); if (value != null && value.m_attackChainLevels > 1 && Traverse.Create((object)value).Field("m_currentAttackCainLevel").GetValue<int>() >= value.m_attackChainLevels - 1) { Logros.Add(p, Logro.CadenaCompleta); } if (num >= 4) { bool flag = Time.time - CombatState.LastHitTime < 3f && CombatState.LastDamagedTime < CombatState.LastHitTime; if (num3 > 0) { CombatState.ComboStacks = (flag ? Mathf.Min(CombatState.ComboStacks + 1, 5) : 0); } num2 += 0.05f * (float)CombatState.ComboStacks; } bool flag2 = false; if ((secondary || num3 >= 3) && num >= 3 && num3 != 0) { if (num >= 6 && (secondary || num3 >= 6) && Time.time >= CombatState.LuzReadyAt && PayToki(p, 40f)) { num2 += 1.5f; CombatState.LuzReadyAt = Time.time + 30f; ((Character)p).Message((MessageType)1, Tr.Get("espada_long_sword_light"), 0, (Sprite)null, false); Tajo.Spawn(p, Tajo.Luz, 5f, 0.25f); flag2 = true; } else if (num >= 4 && (secondary || num3 >= 4) && Time.time >= CombatState.LunaReadyAt && PayToki(p, 20f)) { CombatState.LunaReadyAt = Time.time + 20f; CrescentMoon(p, target, hit); Tajo.Spawn(p, Tajo.Luna, 7f, 0.4f); flag2 = true; } else if (Time.time >= CombatState.SupersonicaReadyAt && PayToki(p, 15f)) { num2 += 0.5f; CombatState.SupersonicaReadyAt = Time.time + 15f; Tajo.Spawn(p, Tajo.Supersonica, 3f, 0.2f); flag2 = true; } } if (!flag2 && num3 != 0 && num >= 5) { Vector3 velocity = target.GetVelocity(); if (((Vector3)(ref velocity)).magnitude < 0.5f && CombatState.LagoReady(target) && PayToki(p, 25f)) { CombatState.UseLago(target); num2 += 0.4f; hit.m_staggerMultiplier *= 3f; } } return num2; } private static void MultiGolpe(Player p, Character target, HitData hit) { int num = Mathf.Max(Estilos.Rank(p, Estilo.Espada), Mathf.Max(Estilos.Rank(p, Estilo.Agua), Estilos.Rank(p, Estilo.Norte))); if (num >= 5) { bool flag = num >= 6; if (!(Random.value > (flag ? MTEspadaPlugin.ProbTripleGolpe.Value : MTEspadaPlugin.ProbDobleGolpe.Value))) { int count = ((!flag) ? 1 : 2); float share = (flag ? 0.85f : 0.7f); ((Character)p).Message((MessageType)1, flag ? Tr.Get("espada_triple_strike") : Tr.Get("espada_double_strike"), 0, (Sprite)null, false); ((MonoBehaviour)p).StartCoroutine(ExtraHits(p, target, hit, count, share)); } } } private static IEnumerator ExtraHits(Player p, Character target, HitData hit, int count, float share) { DamageTypes dmg = ((DamageTypes)(ref hit.m_damage)).Clone(); for (int i = 0; i < count; i++) { yield return (object)new WaitForSeconds(0.12f); if ((Object)(object)p == (Object)null || (Object)(object)p != (Object)(object)Player.m_localPlayer || ((Character)p).IsDead() || (Object)(object)target == (Object)null || target.IsDead() || Vector3.Distance(((Component)p).transform.position, ((Component)target).transform.position) > 5f) { break; } HitData val = new HitData { m_damage = ((DamageTypes)(ref dmg)).Clone(), m_point = target.GetCenterPoint() }; Vector3 val2 = ((Component)target).transform.position - ((Component)p).transform.position; val.m_dir = ((Vector3)(ref val2)).normalized; val.m_skill = hit.m_skill; val.m_pushForce = hit.m_pushForce * 0.3f; val.m_toolTier = hit.m_toolTier; HitData val3 = val; ((DamageTypes)(ref val3.m_damage)).Modify(share); val3.SetAttacker((Character)(object)p); _extraHit = true; try { target.Damage(val3); } finally { _extraHit = false; } } } private static void CrescentMoon(Player p, Character mainTarget, HitData hit) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0069: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: 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_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_009e: 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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: 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_00b7: 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_00c9: Expected O, but got Unknown _extraHit = true; try { foreach (Character allCharacter in Character.GetAllCharacters()) { if (Maestria.Hostile(p, allCharacter) && !((Object)(object)allCharacter == (Object)(object)mainTarget)) { Vector3 val = ((Component)allCharacter).transform.position - ((Component)p).transform.position; if (!(((Vector3)(ref val)).magnitude > 3.5f) && !(Vector3.Dot(((Component)p).transform.forward, ((Vector3)(ref val)).normalized) < 0.4f)) { HitData val2 = new HitData { m_damage = ((DamageTypes)(ref hit.m_damage)).Clone(), m_point = allCharacter.GetCenterPoint(), m_dir = ((Vector3)(ref val)).normalized, m_skill = hit.m_skill, m_pushForce = hit.m_pushForce }; ((DamageTypes)(ref val2.m_damage)).Modify(0.6f); val2.SetAttacker((Character)(object)p); allCharacter.Damage(val2); } } } } finally { _extraHit = false; } } private static float WaterGod(Player p, Character target, HitData hit) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) if (Time.time - CombatState.LastParryTime > 1.5f) { return 0f; } float num = Estilos.Scale(Estilos.BonusRank(p, Estilo.Agua), 0.1f, 0.4f, 0.7f); Logros.Add(p, Logro.Contraataque); Maestria.Train(p, Estilo.Agua, 6); EstiloVfx.Burst(p, Estilo.Agua, hit.m_point); if (Artes.Has(p, Arte.Contracorriente)) { target.Stagger(hit.m_dir); } if (CombatState.LastParryPerfect && Artes.HasPrivacion(p) && Time.time >= CombatState.PrivacionReadyAt) { CombatState.PrivacionReadyAt = Time.time + 30f; num += 2f; ((Character)p).Message((MessageType)1, Tr.Get("espada_sword_deprivation"), 0, (Sprite)null, false); } CombatState.LastParryTime = -999f; return num; } private static float NorthGod(Player p, Character target, HitData hit, bool secondary) { //IL_003e: 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_014f: Unknown result type (might be due to invalid IL or missing references) int rank = Estilos.BonusRank(p, Estilo.Norte); int num = Estilos.Rank(p, Estilo.Norte); float num2 = 0f; hit.m_backstabBonus += Estilos.Scale(rank, 0.1f, 0.5f, 1f); bool flag = Vector3.Dot(((Component)target).transform.forward, hit.m_dir) > 0.5f; if (flag) { Logros.Add(p, Logro.Espalda); } if (target.IsStaggering()) { num2 += Estilos.Scale(rank, 0.05f, 0.2f, 0.35f); if (num >= 6) { num2 += 0.3f; } if (num >= 5 && flag) { hit.m_backstabBonus += 1f; } Logros.Add(p, Logro.Tambaleado); } if (secondary) { num2 += Estilos.Scale(rank, 0.03f, 0.12f, 0.2f); Logros.Add(p, Logro.Secundario); } if (num >= 3 && Time.time - CombatState.LastDodgeStart < 2f) { hit.m_staggerMultiplier *= 1f + Estilos.Scale(num, 0f, 0.3f, 0.6f); } if (num >= 4 && Time.time - CombatState.LastWeaponSwitch < 5f && Time.time >= CombatState.GuardReadyAt) { CombatState.GuardReadyAt = Time.time + 10f; num2 += 0.15f; } int num3 = CombatState.DistinctWeapons(hit.m_skill); if (num >= 5) { num2 += 0.05f * (float)Mathf.Min(num3, 4); } return num2; } private static bool PayToki(Player p, float cost) { if (!Manto.Active || Manto.Charge < cost * Manto.CostMultiplier(p)) { return false; } Manto.Spend(p, cost, true); return true; } } [HarmonyPatch(typeof(Humanoid), "BlockAttack")] public static class BlockPatch { public struct State { public bool Active; public bool Perfect; public bool DirFlipped; public float Interval; public float Damage; public Vector3 Dir; } private static readonly FieldInfo PerfectInterval = AccessTools.Field(typeof(Humanoid), "m_perfectBlockInterval"); private static float BaseInterval() { if (PerfectInterval == null) { return 0.25f; } return Convert.ToSingle(PerfectInterval.IsLiteral ? PerfectInterval.GetRawConstantValue() : PerfectInterval.GetValue(null)); } private static void Prefix(Humanoid __instance, HitData hit, Character attacker, out State __state) { //IL_0135: 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_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0158: 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_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) __state = default(State); Player localPlayer = Player.m_localPlayer; if (!((Object)(object)localPlayer == (Object)null) && !((Object)(object)__instance != (Object)(object)localPlayer) && hit != null && Maestria.Armed(localPlayer) && Maestria.Hostile(localPlayer, attacker)) { int rank = Estilos.BonusRank(localPlayer, Estilo.Agua); __state.Active = true; __state.Interval = BaseInterval(); __state.Damage = hit.GetTotalDamage(); float num = Estilos.Scale(rank, 0.05f, 0.25f, 0.5f); if ((Object)(object)attacker != (Object)null && attacker.IsBoss() && Artes.Has(localPlayer, Arte.EspejoDelAgua)) { num += 0.25f; } float num2 = __state.Interval * (1f + num); Traverse val = Traverse.Create((object)localPlayer).Field("m_blockTimer"); if (Artes.Has(localPlayer, Arte.AguasQuietas) && Time.time - CombatState.StillSince >= 1f) { val.SetValue((object)0f); } float value = val.GetValue<float>(); __state.Perfect = value >= 0f && value < num2; if (__state.Perfect && value >= __state.Interval) { val.SetValue((object)(__state.Interval * 0.5f)); } if (Artes.Has(localPlayer, Arte.EspejoDelAgua) && Vector3.Dot(hit.m_dir, ((Component)localPlayer).transform.forward) > 0f) { __state.Dir = hit.m_dir; __state.DirFlipped = true; hit.m_dir = -((Component)localPlayer).transform.forward; } ((DamageTypes)(ref hit.m_damage)).Modify(1f - Estilos.Scale(rank, 0.03f, 0.12f, 0.2f)); } } private static void Postfix(Humanoid __instance, HitData hit, Character attacker, bool __result, State __state) { //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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown //IL_0060: 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_0070: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: 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_00d7: 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_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: 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_00f0: Expected O, but got Unknown //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_018a: 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) if (!__state.Active) { return; } if (__state.DirFlipped) { hit.m_dir = __state.Dir; } if (!__result) { return; } Player val = (Player)__instance; if (!__state.Perfect) { Maestria.Train(val, Estilo.Agua, 2); return; } CombatState.LastParryTime = Time.time; CombatState.LastParryPerfect = true; Logros.Add(val, Logro.ParryPerfecto); Maestria.Train(val, Estilo.Agua, 8); EstiloVfx.Burst(val, Estilo.Agua, ((Character)val).GetCenterPoint() + ((Component)val).transform.forward); int rank = Estilos.BonusRank(val, Estilo.Agua); int num = Estilos.Rank(val, Estilo.Agua); ((Character)val).AddStamina(10f * Estilos.Scale(rank, 0.05f, 0.2f, 0.35f) * 5f); if (num >= 3 && (Object)(object)attacker != (Object)null && !attacker.IsDead()) { HitData val2 = new HitData { m_point = attacker.GetCenterPoint(), m_dir = -hit.m_dir, m_skill = (SkillType)6 }; val2.m_damage.m_blunt = __state.Damage * Estilos.Scale(num, 0f, 0.15f, 0.4f); val2.SetAttacker((Character)(object)val); attacker.Damage(val2); } if (!Artes.Has(val, Arte.Remolino)) { return; } foreach (Character allCharacter in Character.GetAllCharacters()) { if (Maestria.Hostile(val, allCharacter) && Vector3.Distance(((Component)allCharacter).transform.position, ((Component)val).transform.position) < 4f) { allCharacter.Stagger(((Component)allCharacter).transform.position - ((Component)val).transform.position); } } } } [HarmonyPatch(typeof(Character), "RPC_Damage")] public static class IncomingStylePatch { private static void Prefix(Character __instance, HitData hit) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Invalid comparison between Unknown and I4 Player localPlayer = Player.m_localPlayer; if (!((Object)(object)localPlayer == (Object)null) && !((Object)(object)__instance != (Object)(object)localPlayer) && hit != null) { if (hit.GetTotalDamage() > 0f && (int)hit.m_hitType != 3 && !((Character)localPlayer).IsDodgeInvincible()) { CombatState.LastDamagedTime = Time.time; } if (hit.m_ranged && Artes.Has(localPlayer, Arte.Corriente)) { hit.m_blockable = true; } if (((Character)localPlayer).IsDodgeInvincible() && hit.m_dodgeable && Maestria.Hostile(localPlayer, hit.GetAttacker()) && Maestria.Armed(localPlayer) && Time.time - Maestria.UltimaEvasion > 2f) { Logros.Add(localPlayer, Logro.EsquivaLimite); Maestria.Train(localPlayer, Estilo.Norte, 6); } } } } [HarmonyPatch(typeof(Humanoid), "EquipItem")] public static class WeaponSwitchPatch { private static void Postfix(Humanoid __instance, ItemData item, bool __result) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if (__result && !((Object)(object)localPlayer == (Object)null) && !((Object)(object)__instance != (Object)(object)localPlayer) && item != null && Array.IndexOf(BodyLevel.MeleeWeapons, item.m_shared.m_skillType) >= 0 && !(Time.time - Mathf.Max(CombatState.LastHitTime, CombatState.LastDamagedTime) > 10f)) { CombatState.LastWeaponSwitch = Time.time; Logros.Add(localPlayer, Logro.CambioArma); } } } public static class CombatState { public static float LastParryTime = -999f; public static bool LastParryPerfect; public static float LastDodgeStart = -999f; public static float LastHitTime = -999f; public static float LastDamagedTime = -999f; public static int ComboStacks; public static float LastWeaponSwitch = -999f; public static float GuardReadyAt; public static SkillType LastKillWeapon = (SkillType)0; public static float StillSince; public static float SupersonicaReadyAt; public static float LunaReadyAt; public static float LuzReadyAt; public static float PrivacionReadyAt; private static readonly Dictionary<Character, float> FirstHit = new Dictionary<Character, float>(); private static readonly Dictionary<Character, float> LagoReadyAt = new Dictionary<Character, float>(); private static readonly Dictionary<SkillType, float> WeaponHits = new Dictionary<SkillType, float>(); public static void Reset() { //IL_0051: Unknown result type (might be due to invalid IL or missing references) LastParryTime = (LastDodgeStart = (LastHitTime = (LastDamagedTime = (LastWeaponSwitch = -999f)))); LastParryPerfect = false; ComboStacks = 0; GuardReadyAt = (SupersonicaReadyAt = (LunaReadyAt = (LuzReadyAt = (PrivacionReadyAt = 0f)))); LastKillWeapon = (SkillType)0; StillSince = Time.time; FirstHit.Clear(); LagoReadyAt.Clear(); WeaponHits.Clear(); } public static void NoteFirstHit(Character target) { if (!FirstHit.ContainsKey(target)) { FirstHit[target] = Time.time; } } public static bool KilledQuickly(Character target) { if (FirstHit.TryGetValue(target, out var value)) { return Time.time - value < 5f; } return false; } public static bool LagoReady(Character target) { if (LagoReadyAt.TryGetValue(target, out var value)) { return Time.time >= value; } return true; } public static void UseLago(Character target) { LagoReadyAt[target] = Time.time + 15f; } public static int DistinctWeapons(SkillType current) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) WeaponHits[current] = Time.time; return WeaponHits.Count((KeyValuePair<SkillType, float> kv) => kv.Key != current && Time.time - kv.Value < 10f); } public static void Cleanup() { foreach (Character item in FirstHit.Keys.Where((Character c) => (Object)(object)c == (Object)null || Time.time - FirstHit[c] > 60f).ToList()) { FirstHit.Remove(item); } foreach (Character item2 in LagoReadyAt.Keys.Where((Character c) => (Object)(object)c == (Object)null).ToList()) { LagoReadyAt.Remove(item2); } } } public static class DiarioEspada { public static void Registrar() { //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_0010: 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_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown Paginas.Registrar(new DiarioPagina { Id = "espada", TituloKey = "diario_tab_sword", Orden = 30, Dibujar = Dibujar }); } private static string NameKey(Estilo e) { return e switch { Estilo.Agua => "espada_water_god", Estilo.Espada => "espada_sword_god", _ => "espada_north_god", }; } public static void RangoSubido(Player p, Estilo e, int rango) { Cronica.Anotar(p, "cronica_sword_rank", new string[2] { "@" + NameKey(e), "@core_rank_" + rango.ToString(CultureInfo.InvariantCulture) }); } private static void Dibujar(Player p, DiarioEscritor e) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_022c: 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_0255: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) e.Titulo(Tr.Get("diario_tab_sword")); e.Parrafo(Tr.Get("diario_sword_intro"), (Color?)DiarioEscritor.TintaSuave, 15, 0f); Estilo[] all = Estilos.All; foreach (Estilo estilo in all) { int num = Estilos.Rank(p, estilo); e.Subtitulo(Estilos.Name(estilo), (Color?)null); e.Dato(Tr.Get("diario_current_rank"), Rangos.Name(num), (Color?)null); if (num >= 6) { e.Parrafo(Tr.Get("diario_rank_max"), (Color?)DiarioEscritor.TintaOro, 14, 0f); continue; } int num2 = num + 1; e.Dato(Tr.Get("diario_target_rank"), Rangos.Name(num2), (Color?)null); if (Estilos.RequirementCap(p) <= num) { e.Parrafo(Requisito(p), (Color?)DiarioEscritor.TintaRoja, 15, 0f); } int num3 = Maestria.XP(p, estilo); e.Progreso(Tr.Get("diario_sword_training"), Mathf.InverseLerp((float)Maestria.Umbrales[num], (float)Maestria.Umbrales[num2], (float)num3), $"{num3} / {Maestria.Umbrales[num2]}", (Color?)DiarioEscritor.TintaOro); e.Parrafo(Tr.Get("diario_sword_or_feats", new object[1] { Rangos.Name(num2) }), (Color?)DiarioEscritor.TintaSuave, 14, 0f); Logro[] array = Logros.Required[(int)estilo]; foreach (Logro l in array) { int num4 = Logros.Count(p, l); int num5 = Logros.Needed[num2]; e.Requisito(Logros.Name(l), (float)num4, (float)num5); } } List<Arte> list = Artes.Learned(p); e.Subtitulo(Tr.Get("diario_sword_arts"), (Color?)null); e.Parrafo(Tr.Get("diario_arts_slots", new object[2] { list.Count, Artes.Slots(p) }), (Color?)DiarioEscritor.TintaSuave, 15, 0f); if (list.Count == 0) { e.Parrafo(Tr.Get("diario_sword_arts_none"), (Color?)DiarioEscritor.TintaSuave, 14, 0f); } foreach (Arte item in list) { e.Parrafo("• " + Artes.Name(item), (Color?)DiarioEscritor.Tinta, 15, 0f); } } private static string Requisito(Player p) { int num = ToukiRules.Level(p); if (!ToukiState.IsAwakened(p)) { return Tr.Get("diario_sword_need_toki"); } if (num < 4) { return Tr.Get("diario_sword_need_toki_level", new object[1] { 4 }); } if (num < 6) { return Tr.Get("diario_sword_need_toki_level", new object[1] { 6 }); } if (!Estilos.Defeated(p, "defeated_goblinking")) { return Tr.Get("diario_need_boss", new object[1] { Tr.Localize(EventosCore.NombreJefe("defeated_goblinking")) }); } if (num < 8) { return Tr.Get("diario_sword_need_toki_level", new object[1] { 8 }); } return Tr.Get("diario_need_boss", new object[1] { Tr.Localize(EventosCore.NombreJefe("defeated_queen")) }); } } [HarmonyPatch] public static class DurabilidadPatch { private static IEnumerable<MethodBase> TargetMethods() { yield return AccessTools.Method(typeof(Attack), "Start", (Type[])null, (Type[])null); yield return AccessTools.Method(typeof(Attack), "OnAttackTrigger", (Type[])null, (Type[])null); } private static void Prefix(Attack __instance, out float __state) { __state = -1f; ItemData val = Weapon(__instance); if (val != null && (Object)(object)Owner(__instance) == (Object)(object)Player.m_localPlayer) { __state = val.m_durability; } } private static void Postfix(Attack __instance, float __state) { if (!(__state < 0f)) { ItemData val = Weapon(__instance); Player localPlayer = Player.m_localPlayer; if (val != null && !((Object)(object)localPlayer == (Object)null) && !(val.m_durability >= __state)) { float num = __state - val.m_durability; val.m_durability = Mathf.Min(val.GetMaxDurability(), val.m_durability + num * Ahorro(localPlayer, val)); } } } public static float Ahorro(Player p, ItemData w) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) float num = ((Character)p).GetSkillLevel(w.m_shared.m_skillType) / 100f; int num2 = Mathf.Max(Estilos.Rank(p, Estilo.Espada), Mathf.Max(Estilos.Rank(p, Estilo.Agua), Estilos.Rank(p, Estilo.Norte))); return Mathf.Clamp(num * 0.4f + (float)num2 / 6f * 0.35f, 0f, MTEspadaPlugin.DurabilidadMaxAhorro.Value); } private static ItemData Weapon(Attack a) { return Traverse.Create((object)a).Field("m_weapon").GetValue<ItemData>(); } private static Humanoid Owner(Attack a) { return Traverse.Create((object)a).Field("m_character").GetValue<Humanoid>(); } } public static class EntrenamientoEspada { public static TrainingSession Session = new TrainingSession(); public static string LastReward = Idle; public static float NoticeUntil; public static int ComboHit; private static string Idle => Tr.Get("espada_attack_train_swinging_air_counts"); public static void Reset() { Session = new TrainingSession(); LastReward = Idle; ComboHit = 0; NoticeUntil = 0f; } public static void Swing(Player p) { Maestria.Reset(p); if (Session.Begin(Time.time)) { Reward(p, Session.Upgrade(Time.time, 1), Tr.Get("espada_sword_practice")); Fatigue(p); } } public static void Contact(Player p, bool combat) { Reward(p, Session.Upgrade(Time.time, combat ? 4 : 2), combat ? Tr.Get("espada_hit_combat") : Tr.Get("espada_tree_rock")); } public static void Fatigue(Player p) { if (Session.Fatigue(Time.time, ((Character)p).GetStaminaPercentage())) { Reward(p, 8, Tr.Get("espada_effort_complete_recover_stamina")); } } public static void Reward(Player p, int amount, string source) { //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) if (amount > 0) { if (((Character)p).GetSEMan().HaveStatusEffect(StringExtensionMethods.GetStableHashCode("Rested"))) { amount = Mathf.CeilToInt((float)amount * 1.25f); } int num = Maestria.Award(p, Estilo.Espada, amount); LastReward = ((num > 0) ? $"+{num} XP · {source}" : Tr.Get("espada_maximum_experience_reached")); if (num > 0) { XpTexto.Mostrar(p, $"+{num} XP", (Color)((amount >= 8) ? new Color(1f, 0.6f, 0.2f) : XpTexto.Oro), 3 + num * 2, amount >= 8); } NoticeUntil = Time.time + 6f; } } } [HarmonyPatch(typeof(Attack), "OnAttackTrigger")] public static class PracticaAirePatch { private static readonly FieldInfo CharacterField = AccessTools.Field(typeof(Attack), "m_character"); private static readonly FieldInfo WeaponField = AccessTools.Field(typeof(Attack), "m_weapon"); private static void Prefix(Attack __instance) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Invalid comparison between Unknown and I4 object? value = CharacterField.GetValue(__instance); Player val = (Player)((value is Player) ? value : null); object? value2 = WeaponField.GetValue(__instance); ItemData val2 = (ItemData)((value2 is ItemData) ? value2 : null); if ((Object)(object)val != (Object)null && (Object)(object)val == (Object)(object)Player.m_localPlayer && !((Character)val).IsDead() && val2 != null && (int)val2.m_shared.m_skillType == 1) { EntrenamientoEspada.Swing(val); } } } [HarmonyPatch] public static class PracticaEntornoPatch { private static IEnumerable<MethodBase> TargetMethods() { Type[] array = new Type[5] { typeof(TreeBase), typeof(TreeLog), typeof(MineRock), typeof(MineRock5), typeof(Destructible) }; foreach (Type type in array) { yield return AccessTools.Method(type, "Damage", new Type[1] { typeof(HitData) }, (Type[])null); } } private static void Prefix(object __instance, HitData hit) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Invalid comparison between Unknown and I4 //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Invalid comparison between Unknown and I4 Player localPlayer = Player.m_localPlayer; if (!((Object)(object)localPlayer == (Object)null) && hit != null && !((Object)(object)hit.GetAttacker() != (Object)(object)localPlayer) && (int)hit.m_skill == 1) { Destructible val = (Destructible)((__instance is Destructible) ? __instance : null); if (val == null || (int)val.m_destructibleType == 2) { EntrenamientoEspada.Contact(localPlayer, combat: false); } } } } [HarmonyPatch(typeof(Character), "OnDeath")] public static class BajaEspadaPatch { private static readonly FieldInfo LastHit = AccessTools.Field(typeof(Character), "m_lastHit"); private static readonly ConditionalWeakTable<Character, object> Paid = new ConditionalWeakTable<Character, object>(); private static void Prefix(Character __instance) { //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Invalid comparison between Unknown and I4 //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: 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) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; object? value = LastHit.GetValue(__instance); HitData val = (HitData)((value is HitData) ? value : null); if ((Object)(object)localPlayer == (Object)null || val == null || (Object)(object)val.GetAttacker() != (Object)(object)localPlayer || __instance.IsPlayer() || __instance.IsTamed() || !BaseAI.IsEnemy((Character)(object)localPlayer, __instance) || Paid.TryGetValue(__instance, out var _)) { return; } Paid.Add(__instance, new object()); if ((int)val.m_skill == 1) { EntrenamientoEspada.Reward(localPlayer, __instance.IsBoss() ? 40 : 12, __instance.IsBoss() ? Tr.Get("espada_boss_slain") : Tr.Get("espada_sword_kill")); if (CombatState.KilledQuickly(__instance)) { Logros.Add(localPlayer, Logro.MuerteRapida); } } if ((int)CombatState.LastKillWeapon != 0 && CombatState.LastKillWeapon != val.m_skill) { Logros.Add(localPlayer, Logro.MuerteOtraArma); } CombatState.LastKillWeapon = val.m_skill; if (Estilos.Rank(localPlayer, Estilo.Norte) >= 6 && Maestria.Armed(localPlayer)) { ((Character)localPlayer).AddStamina(20f); } } } public class EspadaController : MonoBehaviour { private bool _wasDodging; private Vector3 _lastPos; private float _rankTimer; private void Awake() { Topes.DiosDragonCheck = (Player p) => Estilos.Rank(p, Estilo.Espada) >= 3 && Estilos.Rank(p, Estilo.Agua) >= 3 && Estilos.Rank(p, Estilo.Norte) >= 3 && Mathf.Max(Especialidades.AttackMagicLevel?.Invoke(p) ?? 0f, Especialidades.SupportMagicLevel?.Invoke(p) ?? 0f) >= 50f; } private void Update() { //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: 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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: 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) Player localPlayer = Player.m_localPlayer; Maestria.Reset(localPlayer); if ((Object)(object)localPlayer == (Object)null || ((Character)localPlayer).IsDead()) { _wasDodging = false; return; } Maestria.TryEvade(localPlayer); EntrenamientoEspada.Fatigue(localPlayer); bool flag = ((Character)localPlayer).InDodge(); if (flag && !_wasDodging) { CombatState.LastDodgeStart = Time.time; if (Maestria.Armed(localPlayer)) { EstiloVfx.Burst(localPlayer, Estilo.Norte, ((Component)localPlayer).transform.position + Vector3.up * 0.3f); } if (Maestria.Armed(localPlayer)) { EvasionScan.Trail(localPlayer); } } _wasDodging = flag; if (((Character)localPlayer).IsBlocking()) { Vector3 val = ((Component)localPlayer).transform.position - _lastPos; if (((Vector3)(ref val)).sqrMagnitude < 0.0004f) { goto IL_00cc; } } CombatState.StillSince = Time.time; goto IL_00cc; IL_00cc: _lastPos = ((Component)localPlayer).transform.position; _rankTimer += Time.deltaTime; if (_rankTimer < 2f) { return; } _rankTimer = 0f; SE_Estilos.Apply(localPlayer); CombatState.Cleanup(); Estilo[] all = Estilos.All; foreach (Estilo estilo in all) { if (Estilos.UpdateRank(localPlayer, estilo)) { int num = Estilos.StoredRank(localPlayer, estilo); ((Character)localPlayer).Message((MessageType)2, Tr.Get("espada_are_now_style", new object[2] { Estilos.RankNames[num], Estilos.Name(estilo) }), 0, (Sprite)null, false); DiarioEspada.RangoSubido(localPlayer, estilo, num); if (estilo == Estilo.Agua && num >= 4) { ((Character)localPlayer).Message((MessageType)1, Tr.Get("espada_can_learn_secret_art_type"), 0, (Sprite)null, false); } } } } } public class SE_Estilos : StatusEffect { public const string Name = "MT_Estilos"; public static readonly int Hash = StringExtensionMethods.GetStableHashCode("MT_Estilos"); public static void Register() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown SE_Estilos sE_Estilos = ScriptableObject.CreateInstance<SE_Estilos>(); ((Object)sE_Estilos).name = "MT_Estilos"; ((StatusEffect)sE_Estilos).m_name = ""; ((StatusEffect)sE_Estilos).m_ttl = 0f; ItemManager.Instance.AddStatusEffect(new CustomStatusEffect((StatusEffect)(object)sE_Estilos, false)); } public static void Apply(Player p) { if (!((Character)p).GetSEMan().HaveStatusEffect(Hash)) { ((Character)p).GetSEMan().AddStatusEffect(Hash, false, 0, 0f, (short)(-1)); } } public override void ModifyAttackStaminaUsage(float baseStaminaUse, ref float staminaUse) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Invalid comparison between Unknown and I4 Character character = base.m_character; Player val = (Player)(object)((character is Player) ? character : null); if (val != null) { ItemData currentWeapon = ((Humanoid)val).GetCurrentWeapon(); if (currentWeapon != null && (int)currentWeapon.m_shared.m_skillType == 1) { staminaUse *= 1f - Estilos.Scale(Estilos.BonusRank(val, Estilo.Espada), 0.03f, 0.12f, 0.2f); } } } } public class EspadaPruebaCommand : ConsoleCommand { private const string Backup = "MT.Espada.PruebaBackup"; public override string Name => "mt_sword_test"; public override string Help => "[cheat] mt_sword_test <0-6|restore> — try the three styles keeping a backup of your progress. Does not change Toki or bosses."; public override bool IsCheat => true; public override void Run(string[] args) { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null || args.Length != 1) { Console.instance.Print(((ConsoleCommand)this).Help); return; } if (args[0].Equals("restaurar", StringComparison.OrdinalIgnoreCase) || args[0].Equals("restore", StringComparison.OrdinalIgnoreCase)) { if (!localPlayer.m_customData.TryGetValue("MT.Espada.PruebaBackup", out var value)) { Console.instance.Print(Tr.Get("espada_there_no_saved_test")); return; } Dictionary<string, string> dictionary; try { dictionary = (from s in value.Split(new char[1] { ';' }, StringSplitOptions.RemoveEmptyEntries) select s.Split(new char[1] { ':' })).ToDictionary((string[] a) => a[0], (string[] a) => Encoding.UTF8.GetString(Convert.FromBase64String(a[1]))); } catch (Exception) { Console.instance.Print(Tr.Get("espada_test_backup_invalid_kept_unchanged")); return; } string[] array = localPlayer.m_customData.Keys.Where((string k) => k.StartsWith("MT.Espada.", StringComparison.Ordinal)).ToArray(); foreach (string key in array) { localPlayer.m_customData.Remove(key); } foreach (KeyValuePair<string, string> item in dictionary) { localPlayer.m_customData[item.Key] = item.Value; } CombatState.Reset(); EntrenamientoEspada.Reset(); Console.instance.Print(Tr.Get("espada_previous_progression_arts_restored")); return; } if (!int.TryParse(args[0], out var result) || result < 0 || result > 6) { Console.instance.Print(((ConsoleCommand)this).Help); return; } if (!localPlayer.m_customData.ContainsKey("MT.Espada.PruebaBackup")) { localPlayer.m_customData["MT.Espada.PruebaBackup"] = string.Join(";", from kv in localPlayer.m_customData where kv.Key.StartsWith("MT.Espada.", StringComparison.Ordinal) select kv.Key + ":" + Convert.ToBase64String(Encoding.UTF8.GetBytes(kv.Value))); } Estilo[] all = Estilos.All; for (int num = 0; num < all.Length; num++) { Estilo estilo = all[num]; Estilos.SetRank(localPlayer, estilo, result); localPlayer.m_customData["MT.Espada.XP." + estilo] = Maestria.Umbrales[result].ToString(CultureInfo.InvariantCulture); Logro[] array2 = Logros.Required[(int)estilo]; foreach (Logro l in array2) { Logros.Set(localPlayer, l, Logros.Needed[result]); } } localPlayer.m_customData.Remove("MT.Espada.Artes"); CombatState.Reset(); EntrenamientoEspada.Reset(); Maestria.EvasionReadyAt = 0f; string text = Estilos.RankNames[result]; Console.instance.Print(Tr.Get("espada_test_all_three_styles_use", new object[1] { text })); } } public enum Estilo { Espada, Agua, Norte } public static class Estilos { public static readonly Estilo[] All = new Estilo[3] { Estilo.Espada, Estilo.Agua, Estilo.Norte }; public const int Santo = 3; public const int Rey = 4; public const int Emperador = 5; public const int Dios = 6; public static string[] RankNames => Rangos.Names; public static string Name(Estilo e) { return e switch { Estilo.Agua => Tr.Get("espada_water_god"), Estilo.Espada => Tr.Get("espada_sword_god"), _ => Tr.Get("espada_north_god"), }; } public static int RankFromLevel(Player p, Estilo e) { return Mathf.Min(Mathf.Max(Logros.RankFromLogros(p, e), Maestria.Rank(p, e)), RequirementCap(p)); } public static int RequirementCap(Player p) { int num = ToukiRules.Level(p); if (!ToukiState.IsAwakened(p)) { return 2; } if (num < 4) { return 3; } if (num < 6 || !Defeated(p, "defeated_goblinking")) { return 4; } if (num < 8 || !Defeated(p, "defeated_queen")) { return 5; } return 6; } public static bool Defeated(Player p, string key) { if (!Gremio.Bosses(p).Contains(key)) { if ((Object)(object)ZoneSystem.instance != (Object)null) { return ZoneSystem.instance.GetGlobalKey(key); } return false; } return true; } private static string RankKey(Estilo e) { return "MT.Espada.Rango." + e; } public static int StoredRank(Player p, Estilo e) { if (!p.m_customData.TryGetValue(RankKey(e), out var value) || !int.TryParse(value, out var result)) { return 0; } return Mathf.Clamp(result, 0, 6); } public static int Rank(Player p, Estilo e) { return Mathf.Min(Mathf.Max(StoredRank(p, e), RankFromLevel(p, e)), RequirementCap(p)); } public static bool UpdateRank(Player p, Estilo e) { int num = RankFromLevel(p, e); if (num <= StoredRank(p, e)) { return false; } p.m_customData[RankKey(e)] = num.ToString(); return true; } public static int BonusRank(Player p, Estilo e) { return Rank(p, e); } public static void SetRank(Player p, Estilo e, int rank) { p.m_customData[RankKey(e)] = rank.ToString(); } public static float Scale(int rank, float p, float s, float d) { if (rank > 3) { return Mathf.Lerp(s, d, (float)(rank - 3) / 3f); } return Mathf.Lerp(p, s, (float)rank / 3f); } public static string Title(Player p) { int best = All.Max((Estilo e) => Rank(p, e)); List<string> source = All.Where((Estilo e) => Rank(p, e) == best).Select(Name).ToList(); string text = RankNames[best]; string text2 = string.Join(" " + Tr.Get("espada_style_and") + " ", source.Select((string n) => Tr.Get("espada_style_name", new object[1] { n }))); return Tr.Get("espada_style", new object[2] { text, text2 }); } } public class EstiloVfx : MonoBehaviour { private Material _material; private static float _next; public static void Burst(Player p, Estilo estilo, Vector3 point) { //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Expected O, but got Unknown //IL_00dc: 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_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Expected O, but got Unknown //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_016c: 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_00b1: 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_0188: 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_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: 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_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Expected O, but got Unknown //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) if (!MTEspadaPlugin.EfectosTajo.Value || Time.time < _next) { return; } _next = Time.time + 0.12f; Shader val = Shader.Find("Legacy Shaders/Particles/Additive") ?? Shader.Find("Sprites/Default"); if (!((Object)(object)val == (Object)null)) { int num = Estilos.Rank(p, estilo); bool active = Manto.Active; Color val2 = (Color)(estilo switch { Estilo.Norte => new Color(0.55f, 0.9f, 0.7f), Estilo.Agua => new Color(0.2f, 0.7f, 1f), _ => new Color(0.8f, 0.9f, 1f), }); if (active) { val2 = Color.Lerp(val2, Tajo.Toki, 0.45f); } GameObject val3 = new GameObject("MT_Estilo_" + estilo); val3.transform.position = point; val3.transform.rotation = Quaternion.LookRotation(((Component)p).transform.forward); EstiloVfx estiloVfx = val3.AddComponent<EstiloVfx>(); estiloVfx._material = new Material(val) { mainTexture = (Texture)(object)ToukiManos.Dot() }; ParticleSystem val4 = val3.AddComponent<ParticleSystem>(); val4.Stop(true, (ParticleSystemStopBehavior)0); MainModule main = val4.main; ((MainModule)(ref main)).loop = false; ((MainModule)(ref main)).startLifetime = MinMaxCurve.op_Implicit(0.3f + (float)num * 0.035f); ((MainModule)(ref main)).startSpeed = MinMaxCurve.op_Implicit(1.2f + (float)num * 0.35f); ((MainModule)(ref main)).startSize = MinMaxCurve.op_Implicit((estilo == Estilo.Agua) ? 0.065f : 0.035f); ((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(val2); ((MainModule)(ref main)).maxParticles = 48; ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1; ((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit((estilo == Estilo.Agua) ? 0.4f : 0f); EmissionModule emission = val4.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(0f); ShapeModule shape = val4.shape; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)4; ((ShapeModule)(ref shape)).angle = ((estilo == Estilo.Agua) ? 70f : 35f); ((ShapeModule)(ref shape)).radius = 0.2f + (float)num * 0.03f; ColorOverLifetimeModule colorOverLifetime = val4.colorOverLifetime; ((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = true; Gradient val5 = new Gradient(); val5.SetKeys((GradientColorKey[])(object)new GradientColorKey[2] { new GradientColorKey(val2, 0f), new GradientColorKey(val2, 1f) }, (GradientAlphaKey[])(object)new GradientAlphaKey[2] { new GradientAlphaKey(active ? 0.9f : 0.55f, 0f), new GradientAlphaKey(0f, 1f) }); ((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(val5); ParticleSystemRenderer component = ((Component)val4).GetComponent<ParticleSystemRenderer>(); ((Renderer)component).sharedMaterial = estiloVfx._material; component.renderMode = (ParticleSystemRenderMode)(estilo != Estilo.Agua); component.lengthScale = 2f; component.velocityScale = 0.15f; val4.Play(); val4.Emit(8 + num * 4 + (active ? 6 : 0)); Object.Destroy((Object)(object)val3, 1.2f); } } private void OnDestroy() { if ((Object)(object)_material != (Object)null) { Object.Destroy((Object)(object)_material); } } } [HarmonyPatch(typeof(Attack), "OnTrailStart")] public static class CorteVisualPatch { private static readonly FieldInfo CharacterField = AccessTools.Field(typeof(Attack), "m_character"); private static void Postfix(Attack __instance) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Invalid comparison between Unknown and I4 //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null || (Object)/*isinst with value type is only supported in some contexts*/ != (Object)(object)localPlayer) { return; } ItemData currentWeapon = ((Humanoid)localPlayer).GetCurrentWeapon(); if (currentWeapon != null && (int)currentWeapon.m_shared.m_skillType == 1) { int num = Estilos.Rank(localPlayer, Estilo.Espada); EstiloVfx.Burst(localPlayer, Estilo.Espada, ((Character)localPlayer).GetCenterPoint() + ((Component)localPlayer).transform.forward); if (num >= 2) { Tajo.Spawn(localPlayer, Manto.Active ? Tajo.Toki : Tajo.Supersonica, 1.5f + 0.18f * (float)num + (Manto.Active ? 0.5f : 0f), 0.2f); } } } } public class EvasionScan : MonoBehaviour { private Material _material; private RenderTexture _source; private float _age; private static float _nextTrail; private const float Lifetime = 0.45f; public static void Trail(Player p) { if (MTEspadaPlugin.EvasionSilueta.Value && !((Object)(object)p == (Object)null) && !(Time.time < _nextTrail)) { _nextTrail = Time.time + 0.65f; ((MonoBehaviour)p).StartCoroutine(CaptureTrail(p)); } } private static IEnumerator CaptureTrail(Player p) { for (int i = 0; i < 3; i++) { if ((Object)(object)p == (Object)null) { break; } if ((Object)(object)p != (Object)(object)Player.m_localPlayer) { break; } if (((Character)p).IsDead()) { break; } Capture(p, i); yield return (object)new WaitForSeconds(0.08f); } } public static bool Capture(Player p, int index = 0) { //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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Expected O, but got Unknown //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Expected O, but got Unknown //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0117: 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_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0131: 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_013b: 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_014e: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0341: Unknown result type (might be due to invalid IL or missing references) //IL_0343: Unknown result type (might be due to invalid IL or missing references) //IL_0350: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Unknown result type (might be due to invalid IL or missing references) //IL_039f: Unknown result type (might be due to invalid IL or missing references) //IL_03a4: Unknown result type (might be due to invalid IL or missing references) //IL_03a9: Unknown result type (might be due to invalid IL or missing references) //IL_03ad: Unknown result type (might be due to invalid IL or missing references) //IL_03b4: Unknown result type (might be due to invalid IL or missing references) //IL_03e2: Unknown result type (might be due to invalid IL or missing references) //IL_03e9: Unknown result type (might be due to invalid IL or missing references) //IL_03fa: Unknown result type (might be due to invalid IL or missing references) //IL_03ce: Unknown result type (might be due to invalid IL or missing references) //IL_03d3: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Expected O, but got Unknown //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Expected O, but got Unknown //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) Camera main = Camera.main; if ((Object)(object)main == (Object)null || (Object)(object)p == (Object)null) { return false; } Material val = MTBundle.Material("MT_EvasionScan"); Material val2 = MTBundle.Material("MT_EvasionCapture"); if ((Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null) { if ((Object)(object)val != (Object)null) { Object.Destroy((Object)(object)val); } if ((Object)(object)val2 != (Object)null) { Object.Destroy((Object)(object)val2); } return false; } RenderTexture val3 = new RenderTexture(256, 256, 24, (RenderTextureFormat)0) { name = "MT_EvasionSnapshot", filterMode = (FilterMode)1, wrapMode = (TextureWrapMode)1 }; val3.Create(); List<Mesh> list = new List<Mesh>(); List<Material> list2 = new List<Material>(); CommandBuffer val4 = new CommandBuffer { name = "MT captura evasión" }; Vector3 centerPoint = ((Character)p).GetCenterPoint(); Quaternion rotation = ((Component)main).transform.rotation; float num = 3.8f * Mathf.Max(1f, ((Component)p).transform.lossyScale.y); Matrix4x4 val5 = Matrix4x4.Scale(new Vector3(1f, 1f, -1f)); Matrix4x4 val6 = Matrix4x4.TRS(centerPoint - ((Component)main).transform.forward * 8f, rotation, Vector3.one); Matrix4x4 val7 = val5 * ((Matrix4x4)(ref val6)).inverse; try { val4.SetRenderTarget(RenderTargetIdentifier.op_Implicit((Texture)(object)val3)); val4.ClearRenderTarget(true, true, Color.clear); val4.SetViewProjectionMatrices(val7, GL.GetGPUProjectionMatrix(Matrix4x4.Ortho((0f - num) / 2f, num / 2f, (0f - num) / 2f, num / 2f, 0.1f, 20f), false)); Renderer[] componentsInChildren = ((Component)p).GetComponentsInChildren<Renderer>(); foreach (Renderer val8 in componentsInChildren) { if (!val8.enabled || !((Component)val8).gameObject.activeInHierarchy) { continue; } Mesh val9 = null; SkinnedMeshRenderer val10 = (SkinnedMeshRenderer)(object)((val8 is SkinnedMeshRenderer) ? val8 : null); if (val10 != null && (Object)(object)val10.sharedMesh != (Object)null) { val9 = new Mesh(); val10.BakeMesh(val9); list.Add(val9); } else if (val8 is MeshRenderer) { MeshFilter component = ((Component)val8).GetComponent<MeshFilter>(); val9 = ((component != null) ? component.sharedMesh : null); } if ((Object)(object)val9 == (Object)null) { continue; } Material[] sharedMaterials = val8.sharedMaterials; for (int j = 0; j < val9.subMeshCount && j < sharedMaterials.Length; j++) { Material val11 = sharedMaterials[j]; if (!((Object)(object)val11 == (Object)null)) { Material val12 = new Material(val2); if (val11.HasProperty("_MainTex")) { val12.mainTexture = val11.GetTexture("_MainTex"); val12.mainTextureScale = val11.GetTextureScale("_MainTex"); val12.mainTextureOffset = val11.GetTextureOffset("_MainTex"); } val12.color = (val11.HasProperty("_Color") ? val11.GetColor("_Color") : Color.white); list2.Add(val12); val4.DrawMesh(val9, val8.localToWorldMatrix, val12, j, 0); } } } Graphics.ExecuteCommandBuffer(val4); GameObject obj = GameObject.CreatePrimitive((PrimitiveType)5); ((Object)obj).name = "MT_EvasionScan"; Object.Destroy((Object)(object)obj.GetComponent<Collider>()); obj.transform.SetPositionAndRotation(centerPoint, rotation); obj.transform.localScale = Vector3.one * num; MeshRenderer component2 = obj.GetComponent<MeshRenderer>(); ((Renderer)component2).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)component2).receiveShadows = false; ((Renderer)component2).sharedMaterial = val; val.mainTexture = (Texture)(object)val3; val.SetFloat("_StepSeed", (float)(Time.frameCount + index * 17)); Vector3 val13 = ((Component)main).transform.InverseTransformDirection(((Character)p).GetVelocity()); Vector2 right = default(Vector2); ((Vector2)(ref right))..ctor(val13.x, val13.y); if (((Vector2)(ref right)).sqrMagnitude < 0.01f) { right = Vector2.right; } ((Vector2)(ref right)).Normalize(); val.SetVector("_ScanDir", new Vector4(right.x, right.y, 0f, 0f)); EvasionScan evasionScan = obj.AddComponent<EvasionScan>(); evasionScan._material = val; evasionScan._source = val3; return true; } catch (Exception ex) { Object.Destroy((Object)(object)val); val3.Release(); Object.Destroy((Object)(object)val3); MTCorePlugin.Log.LogWarning((object)("Captura de evasión: " + ex.Message)); return false; } finally { val4.Release(); Object.Destroy((Object)(object)val2); foreach (Mesh item in list) { Object.Destroy((Object)(object)item); } foreach (Material item2 in list2) { Object.Destroy((Object)(object)item2); } } } private void Update() { _age += Time.deltaTime; float num = Mathf.Clamp01(_age / 0.45f); _material.SetFloat("_Stretch", Mathf.Lerp(0.15f, 2.2f, num)); _material.SetFloat("_Stagger", 0.02f + 0.2f * num); _material.SetFloat("_LineWidth", Mathf.Lerp(0.95f, 0.25f, num)); _material.SetFloat("_Density", 1f - 0.65f * num); _material.SetFloat("_Concentration", 0.4f * num); _material.SetFloat("_AlphaGain", (1f - num) * 0.9f); if (num >= 1f) { Object.Destroy((Object)(object)((Component)this).gameObject); } } private void OnDestroy() { if ((Object)(object)_material != (Object)null) { Object.Destroy((Object)(object)_material); } if ((Object)(object)_source != (Object)null) { _source.Release(); Object.Destroy((Object)(object)_source); } } } public class EvasionPreviewCommand : ConsoleCommand { public override string Name => "mt_evasion_preview"; public override string Help => "Show your silhouette with the line-scan dodge effect, without moving or spending stamina"; public override void Run(string[] args) { Player localPlayer = Player.m_localPlayer; if (!((Object)(object)localPlayer == (Object)null)) { Console.instance.Print(EvasionScan.Capture(localPlayer) ? Tr.Get("espada_dodge_effect_generated") : Tr.Get("espada_effect_unavailable_check_mt_vfx")); } } } [HarmonyPatch(typeof(Projectile), "Setup")] public static class FlechaTokiPatch { private static readonly Color Brillo = new Color(1f, 0.92f, 0.6f); private static readonly Color Naranja = new Color(1f, 0.5f, 0.08f); private static void Postfix(Projectile __instance, Character owner, ItemData item) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: 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_003d: Invalid comparison between Unknown and I4 //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Invalid comparison between Unknown and I4 //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) //IL_00e7: Expected O, but got Unknown //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Expected O, but got Unknown //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0102: 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_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0118: 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) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_016f: 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_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Expected O, but got Unknown //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: 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_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if (!((Object)(object)localPlayer == (Object)null) && !((Object)(object)owner != (Object)(object)localPlayer) && Manto.Active && MTEspadaPlugin.TajosManto.Value && item != null) { SkillType skillType = item.m_shared.m_skillType; if ((int)skillType == 8 || (int)skillType == 14) { int num = ToukiRules.Level(localPlayer); float num2 = 1f + 0.08f * (float)num; GameObject gameObject = ((Component)__instance).gameObject; TrailRenderer val = gameObject.AddComponent<TrailRenderer>(); val.time = 0.35f * num2; val.startWidth = 0.22f * num2; val.endWidth = 0f; val.minVertexDistance = 0.05f; val.numCapVertices = 3; ((Renderer)val).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)val).receiveShadows = false; ((Renderer)val).material = new Material(Shader.Find("Legacy Shaders/Particles/Additive") ?? Shader.Find("Sprites/Default")) { mainTexture = (Texture)(object)ToukiManos.Dot() }; Gradient val2 = new Gradient(); val2.SetKeys((GradientColorKey[])(object)new GradientColorKey[3] { new GradientColorKey(Brillo, 0f), new GradientColorKey(Naranja, 0.35f), new GradientColorKey(new Color(1f, 0.25f, 0f), 1f) }, (GradientAlphaKey[])(object)new GradientAlphaKey[3] { new GradientAlphaKey(1f, 0f), new GradientAlphaKey(0.8f, 0.35f), new GradientAlphaKey(0f, 1f) }); val.colorGradient = val2; GameObject val3 = new GameObject("MT_ChispasFlecha"); val3.transform.SetParent(gameObject.transform, false); ParticleSystem obj = val3.AddComponent<ParticleSystem>(); obj.Stop(true, (ParticleSystemStopBehavior)0); MainModule main = obj.main; ((MainModule)(ref main)).loop = true; ((MainModule)(ref main)).startLifetime = new MinMaxCurve(0.25f, 0.5f); ((MainModule)(ref main)).startSpeed = new MinMaxCurve(0.2f, 1f); ((MainModule)(ref main)).startSize = new MinMaxCurve(0.05f, 0.14f * num2); ((MainModule)(ref main)).startColor = new MinMaxGradient(Brillo, Naranja); ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1; ((MainModule)(ref main)).maxParticles = 200; EmissionModule emission = obj.emission; ((EmissionModule)(ref emission)).rateOverDistance = MinMaxCurve.op_Implicit(6f * num2); ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(0f); ShapeModule shape = obj.shape; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)0; ((ShapeModule)(ref shape)).radius = 0.05f; ((Renderer)val3.GetComponent<ParticleSystemRenderer>()).material = ((Renderer)val).material; obj.Play(); Light obj2 = new GameObject("MT_LuzFlecha").AddComponent<Light>(); ((Component)obj2).transform.SetParent(gameObject.transform, false); obj2.type = (LightType)2; obj2.color = Naranja; obj2.range = 2.5f + 0.2f * (float)num; obj2.intensity = 2f; } } } } public enum Logro { PrimerGolpe, MuerteRapida, GolpeCorriendo, CadenaCompleta, ParryPerfecto, Contraataque, EsquivaLimite, Espalda, Tambaleado, MuerteOtraArma, CambioArma, Desarmado, Secundario } public static class Logros { public static readonly Logro[][] Required = new Logro[3][] { new Logro[3] { Logro.PrimerGolpe, Logro.MuerteRapida, Logro.GolpeCorriendo }, new Logro[3] { Logro.ParryPerfecto, Logro.Contraataque, Logro.EsquivaLimite }, new Logro[3] { Logro.Espalda, Logro.Tambaleado, Logro.MuerteOtraArma } }; public static readonly int[] Needed = new int[7] { 0, 10, 40, 120, 300, 700, 1500 }; public static string Name(Logro l) { return l switch { Logro.PrimerGolpe => Tr.Get("espada_first_hits_with_sword"), Logro.MuerteRapida => Tr.Get("espada_enemies_slain_under_5_s"), Logro.GolpeCorriendo => Tr.Get("espada_running_hits"), Logro.CadenaCompleta => Tr.Get("espada_full_combos"), Logro.ParryPerfecto => Tr.Get("espada_perfect_parries"), Logro.Contraataque => Tr.Get("espada_counterattacks_after_parry"), Logro.EsquivaLimite => Tr.Get("espada_last_moment_dodges"), Logro.Espalda => Tr.Get("espada_hits_from_behind"), Logro.Tambaleado => Tr.Get("espada_hits_on_staggered_enemies"), Logro.MuerteOtraArma => Tr.Get("espada_kills_with_different_weapon_than"), Logro.CambioArma => Tr.Get("espada_weapon_swaps_combat"), Logro.Desarmado => Tr.Get("espada_bare_handed_hits"), _ => Tr.Get("espada_secondary_attacks"), }; } private static string Key(Logro l) { return "MT.Espada.L." + l; } public static int Count(Player p, Logro l) { if (!p.m_customData.TryGetValue(Key(l), out var value) || !int.TryParse(value, NumberStyles.Integer, CultureInfo.InvariantCulture, out var result)) { return 0; } return result; } public static void Add(Player p, Logro l, int amount = 1) { if (!((Object)(object)p == (Object)null)) { p.m_customData[Key(l)] = (Count(p, l) + amount).ToString(CultureInfo.InvariantCulture); } } public static void Set(Player p, Logro l, int value) { p.m_customData[Key(l)] = value.ToString(CultureInfo.InvariantCulture); } public static int RankFromLogros(Player p, Estilo e) { int result = 0; int r; for (r = 1; r < Needed.Length; r++) { if (Required[(int)e].All((Logro l) => Count(p, l) >= Needed[r])) { result = r; } } return result; } } public static class Maestria { public static readonly int[] Umbrales = MaestriaRules.Umbrales; private static readonly Dictionary<Estilo, float> UltimaPractica = new Dictionary<Estilo, float>(); private static Player _owner; public static float EvasionReadyAt; public static float UltimaEvasion = -999f; private static float _nextThreatCheck; private static readonly MethodInfo Dodge = AccessTools.Method(typeof(Player), "Dodge", new Type[1] { typeof(Vector3) }, (Type[])null); public static int XP(Player p, Estilo e) { if (!p.m_customData.TryGetValue("MT.Espada.XP." + e, out var value) || !int.TryParse(value, out var result)) { return 0; } return Math.Max(0, result); } public static int Rank(Player p, Estilo e) { return MaestriaRules.Rank(XP(p, e)); } public static bool Armed(Player p) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Invalid comparison between Unknown and I4 if (((Humanoid)p).GetCurrentWeapon() != null && Array.IndexOf(BodyLevel.MeleeWeapons, ((Humanoid)p).GetCurrentWeapon().m_shared.m_skillType) >= 0) { return (int)((Humanoid)p).GetCurrentWeapon().m_shared.m_skillType != 11; } return false; } public static bool Hostile(Player p, Character c) { if ((Object)(object)c != (Object)null && (Object)(object)c != (Object)(object)p && !c.IsDead() && !c.IsPlayer() && !c.IsTamed()) { return BaseAI.IsEnemy((Character)(object)p, c); } return false; } public static void Reset(Player p) { if (!((Object)(object)_owner == (Object)(object)p)) { _owner = p; UltimaPractica.Clear(); EvasionReadyAt = 0f; UltimaEvasion = -999f; _nextThreatCheck = 0f; CombatState.Reset(); EntrenamientoEspada.Reset(); } } public static void Train(Player p, Estilo e, int amount) { Reset(p); if (!UltimaPractica.TryGetValue(e, out var value) || !(Time.time - value < 0.65f)) { UltimaPractica[e] = Time.time; Award(p, e, amount); } } public static int Award(Player p, Estilo e, int amount) { if (amount <= 0) { return 0; } int num = XP(p, e); int num2 = Mathf.Clamp(Mathf.RoundToInt((float)amount * MTEspadaPlugin.Experiencia.Value), 1, 100); int num3 = Math.Min(Umbrales[6], num + num2); p.m_customData["MT.Espada.XP." + e] = num3.ToString(CultureInfo.InvariantCulture); return Math.Max(0, num3 - num); } public static float Speed(int rank) { return MaestriaRules.Speed(rank); } public static float Reach(Player p) { return MaestriaRules.Reach(Estilos.Rank(p, Estilo.Espada), Manto.Active); } public static void TryEvade(Player p) { //IL_00ce: 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_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: 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_0143: Unknown result type (might be due to invalid IL or missing references) if (!MTEspadaPlugin.EvasionAutomatica.Value || Dodge == null || !Armed(p) || Estilos.Rank(p, Estilo.Norte) < 2 || Time.time < EvasionReadyAt || Time.time < _nextThreatCheck || ((Character)p).InAttack() || ((Character)p).InDodge() || ((Character)p).IsBlocking() || ((Character)p).IsStaggering() || !((Character)p).IsOnGround() || ((Character)p).IsSwimming() || ((Character)p).IsAttached() || !((Character)p).HaveStamina(30f)) { return; } _nextThreatCheck = Time.time + 0.1f; foreach (Character allCharacter in Character.GetAllCharacters()) { if (Hostile(p, allCharacter) && allCharacter.InAttack()) { Vector3 val = ((Component)p).transform.position - ((Component)allCharacter).transform.position; if (!(((Vector3)(ref val)).sqrMagnitude > 9f) && !(Vector3.Dot(((Component)allCharacter).transform.forward, ((Vector3)(ref val)).normalized) < 0.65f)) { int rank = Estilos.Rank(p, Estilo.Norte); EvasionReadyAt = Time.time + MaestriaRules.EvasionCooldown(rank); UltimaEvasion = Time.time; Dodge.Invoke(p, new object[1] { ((Vector3)(ref val)).normalized }); break; } } } } } [HarmonyPatch(typeof(Attack), "Start")] public static class AlcanceEspadaPatch { private sealed class BaseRange { public float Value; } private static readonly ConditionalWeakTable<Attack, BaseRange> Ranges = new ConditionalWeakTable<Attack, BaseRange>(); private static void Prefix(Attack __instance, Humanoid character, ItemData weapon) { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Invalid comparison between Unknown and I4 BaseRange value = Ranges.GetValue(__instance, (Attack a) => new BaseRange { Value = a.m_attackRange }); __instance.m_attackRange = value.Value; if ((Object)(object)character == (Object)(object)Player.m_localPlayer) { Player val = (Player)(object)((character is Player) ? character : null); if (val != null && weapon != null && (int)weapon.m_shared.m_skillType == 1) { __instance.m_attackRange += Maestria.Reach(val); } } } } public static class MaestriaRules { public static readonly int[] Umbrales = new int[7] { 0, 100, 450, 1400, 3600, 8000, 16000 }; public static int Rank(int xp) { int result = 0; for (int i = 1; i < Umbrales.Length; i++) { if (xp >= Umbrales[i]) { result = i; } } return result; } public static float Speed(int rank) { return (float)Math.Max(0, Math.Min(6, rank)) * 0.025f; } public static float Reach(int rank, bool touki) { return (float)Math.Max(0, Math.Min(6, rank)) * (touki ? 0.12f : 0.06f); } public static float EvasionCooldown(int rank) { return 20f - 3f * (float)Math.Max(0, Math.Min(4, rank - 2)); } } [BepInPlugin("mushokutensei.espada", "MT Espada", "1.8.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] public class MTEspadaPlugin : BaseUnityPlugin { public const string Guid = "mushokutensei.espada"; public const string Version = "1.8.0"; private static string _iconDir; public static ConfigEntry<bool> EfectosTajo; public static ConfigEntry<bool> TajosManto; public static ConfigEntry<float> ProbDobleGolpe; public static ConfigEntry<float> ProbTripleGolpe; public static ConfigEntry<float> DurabilidadMaxAhorro; public static ConfigEntry<bool> EvasionAutomatica; public static ConfigEntry<float> Experiencia; public static ConfigEntry<bool> EvasionSilueta; public static Sprite Icon(string name) { string text = Path.Combine(_iconDir, name + ".png"); if (!File.Exists(text)) { return null; } return AssetUtils.LoadSpriteFromFile(text); } private void Awake() { //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Expected O, but got Unknown //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Expected O, but got Unknown //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Expected O, but got Unknown //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Expected O, but got Unknown //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Expected O, but got Unknown //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Expected O, but got Unknown //IL_0279: Unknown result type (might be due to invalid IL or missing references) Tr.Load(typeof(MTEspadaPlugin).Assembly, Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location)); _iconDir = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "Icons"); EvasionSilueta = ((BaseUnityPlugin)this).Config.Bind<bool>("Interfaz", "SiluetaEvasion", true, "Silueta del personaje fragmentada en líneas al esquivar. Desactiva para reducir movimiento visual y coste gráfico."); EvasionAutomatica = ((BaseUnityPlugin)this).Config.Bind<bool>("Combate", "EvasionAutomatica", true, "Norte Avanzado+: anticipa ataques cercanos con una rodada real. Requiere arma cuerpo a cuerpo, suelo y 30 de stamina; respeta ataque y bloqueo manuales."); Experiencia = ((BaseUnityPlugin)this).Config.Bind<float>("Progresión", "MultiplicadorExperiencia", 1f, new ConfigDescription("Experiencia de práctica por estilo.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.25f, 5f), Array.Empty<object>())); ProbDobleGolpe = ((BaseUnityPlugin)this).Config.Bind<float>("Maestría", "ProbabilidadDobleGolpe", 0.25f, "Emperador en algún estilo: probabilidad de que un golpe cuente como 2 (el extra hace el 70 %)."); ProbTripleGolpe = ((BaseUnityPlugin)this).Config.Bind<float>("Maestría", "ProbabilidadTripleGolpe", 0.3f, "Dios en algún estilo: probabilidad de que un golpe cuente como 3 (los extra hacen el 85 %)."); DurabilidadMaxAhorro = ((BaseUnityPlugin)this).Config.Bind<float>("Maestría", "DurabilidadAhorroMax", 0.75f, "Desgaste del arma que se ahorra como máximo con la maestría (habilidad del arma + rango de estilo)."); TajosManto = ((BaseUnityPlugin)this).Config.Bind<bool>("Interfaz", "TajosConManto", true, "Con el manto de tōki activo, la estela de las armas al atacar se vuelve luz naranja (más ancha y larga, con luz en la punta)."); EfectosTajo = ((BaseUnityPlugin)this).Config.Bind<bool>("Interfaz", "EfectosTajo", true, "Tajos visibles (shader propio) en Espada Supersónica, Luna Creciente y Espada Larga de la Luz."); SE_Estilos.Register(); VelocidadAtaque.Bonus.Add(delegate(Player p) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Invalid comparison between Unknown and I4 ItemData currentWeapon = ((Humanoid)p).GetCurrentWeapon(); return (currentWeapon == null || (int)currentWeapon.m_shared.m_skillType != 1) ? 0f : Maestria.Speed(Estilos.Rank(p, Estilo.Espada)); }); ((Component)this).gameObject.AddComponent<EspadaController>(); ((Component)this).gameObject.AddComponent<EstelaToki>(); try { DiarioEspada.Registrar(); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("MT Espada: diario: " + ex)); } CommandManager.Instance.AddConsoleCommand((ConsoleCommand)new AliasCommand("mt_styles", "Show your sword styles, ranks and secret arts", (ConsoleCommand)(object)new EstilosCommand())); CommandManager.Instance.AddConsoleCommand((ConsoleCommand)new AliasCommand("mt_art", "mt_art <1-5> — learn a Water God secret art (King: 1, Emperor: 2, God: 3)", (ConsoleCommand)(object)new ArteCommand())); CommandManager.Instance.AddConsoleCommand((ConsoleCommand)new AliasCommand("mt_style_rank", "[cheat] mt_style_rank <sword|water|north> <0-6> — set a style rank (0 Beginner … 6 God)", (ConsoleCommand)(object)new EstiloRangoCommand())); CommandManager.Instance.AddConsoleCommand((ConsoleCommand)new AliasCommand("mt_sword_test", "[cheat] mt_sword_test <0-6|restore> — try the three styles keeping a backup of your progress. Does not change Toki or bosses.", (ConsoleCommand)(object)new EspadaPruebaCommand())); CommandManager.Instance.AddConsoleCommand((ConsoleCommand)new AliasCommand("mt_evasion_preview", "Show your silhouette with the line-scan dodge effect, without moving or spending stamina", (ConsoleCommand)(object)new EvasionPreviewCommand())); new Harmony("mushokutensei.espada").PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"MT Espada 1.8.0 cargado"); } } public class EstilosCommand : ConsoleCommand { public override string Name => "mt_styles"; public override string Help => "Show your sword styles, ranks and secret arts"; public override void Run(string[] args) { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { return; } StringBuilder stringBuilder = new StringBuilder(); Estilo[] all = Estilos.All; foreach (Estilo estilo in all) { int num = Estilos.Rank(localPlayer, estilo); stringBuilder.AppendLine(Estilos.Name(estilo) + ": " + Tr.Get("espada_rank") + " " + Estilos.RankNames[num]); stringBuilder.AppendLine(" " + Tr.Get("espada_experience") + $": {Maestria.XP(localPlayer, estilo)} / {((num < 6) ? Maestria.Umbrales[num + 1] : Maestria.Umbrales[6])} " + Tr.Get("espada_alternative_feats")); int num2 = Math.Min(num + 1, Logros.Needed.Length - 1); Logro[] array = Logros.Required[(int)estilo]; foreach (Logro l in array) { stringBuilder.AppendLine($" {Logros.Name(l)}: {Logros.Count(localPlayer, l)}" + ((num < 6) ? ($" / {Logros.Needed[num2]} " + Tr.Get("espada_for") + " " + Estilos.RankNames[num2]) : "")); } } stringBuilder.AppendLine(Tr.Get("espada_cap_from_requirements_toki") + ": " + Estilos.RankNames[Estilos.RequirementCap(localPlayer)]); stringBuilder.AppendLine(Tr.Get("espada_title") + ": " + Estilos.Title(localPlayer)); string text = Maestria.Speed(Estilos.Rank(localPlayer, Estilo.Espada)).ToString("P0"); string text2 = Maestria.Reach(localPlayer).ToString("F2"); string text3 = (Manto.Active ? Tr.Get("espada_active") : Tr.Get("espada_inactive")); stringBuilder.AppendLine(Tr.Get("espada_sword_speed_reach_m_t", new object[3] { text, text2, text3 })); string text4 = (MTEspadaPlugin.EvasionAutomatica.Value ? Tr.Get("espada_on") : Tr.Get("espada_off")); string text5 = Mathf.Max(0f, Maestria.EvasionReadyAt - Time.time).ToString("F1"); stringBuilder.AppendLine(Tr.Get("espada_north_dodge_available_from_advanced", new object[2] { text4, text5 })); List<Arte> list = Artes.Learned(localPlayer); stringBuilder.Append(Tr.Get("espada_secret_arts") + string.Format(" ({0}/{1}): {2}", list.Count, Artes.Slots(localPlayer), (list.Count == 0) ? Tr.Get("espada_none") : string.Join(", ", list.Select(Artes.Name)))); if (Artes.HasPrivacion(localPlayer)) { stringBuilder.Append("\n" + Tr.Get("espada_master_sword_deprivation")); } Console.instance.Print(stringBuilder.ToString()); } } public class ArteCommand : ConsoleCommand { public override string Name => "mt_art"; public override string Help => "mt_art <1-5> — learn a Water God secret art (King: 1, Emperor: 2, God: 3)"; public override void Run(string[] args) { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { return; } if (args.Length < 1 || !int.TryParse(args[0], out var result) || result < 1 || result > 5) { Console.instance.Print(((ConsoleCommand)this).Help); { foreach (Arte value in Enum.GetValues(typeof(Arte))) { Console.instance.Print(" " + Artes.Name(value)); } return; } } Console.instance.Print(Artes.Learn(localPlayer, (Arte)result)); } } public class EstiloRangoCommand : ConsoleCommand { public override string Name => "mt_style_rank"; public override string Help => "[cheat] mt_style_rank <sword|water|north> <0-6> — set a style rank (0 Beginner … 6 God)"; public override bool IsCheat => true; public override void Run(string[] args) { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null || args.Length < 2 || !Enum.TryParse<Estilo>(StyleArg(args[0]), ignoreCase: true, out var result) || !Enum.IsDefined(typeof(Estilo), result) || !int.TryParse(args[1], out var result2)) { Console.instance.Print(((ConsoleCommand)this).Help); return; } result2 = Mathf.Clamp(result2, 0, 6); Estilos.SetRank(localPlayer, result, result2); Logro[] array = Logros.Required[(int)result]; foreach (Logro l in array) { Logros.Set(localPlayer, l, Logros.Needed[result2]); } Console.instance.Print(Estilos.Name(result) + " = " + Estilos.RankNames[result2]); } private static string StyleArg(string a) { a = a.ToLowerInvariant(); return a switch { "north" => "norte", "water" => "agua", "sword" => "espada", _ => a, }; } } public class Tajo : MonoBehaviour { public static readonly Color Supersonica = new Color(0.75f, 0.9f, 1f); public static readonly Color Luna = new Color(0.55f, 0.75f, 1f); public static readonly Color Luz = new Color(1f, 0.85f, 0.35f); private Material _mat; private float _t; private float _duration; public static readonly Color Toki = new Color(1f, 0.6f, 0.15f); public static void Spawn(Player p, Color color, float size, float duration = 0.35f, float roll = 0f) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00af: 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_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_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)p == (Object)null) && MTEspadaPlugin.EfectosTajo.Value) { Material val = MTBundle.Material("MT_Tajo"); if (!((Object)(object)val == (Object)null)) { val.SetFloat("_Progress", 0f); val.SetColor("_Color", color); GameObject obj = GameObject.CreatePrimitive((PrimitiveType)5); Object.Destroy((Object)(object)obj.GetComponent<Collider>()); ((Object)obj).name = "MT_Tajo"; MeshRenderer component = obj.GetComponent<MeshRenderer>(); ((Renderer)component).sharedMaterial = val; ((Renderer)component).shadowCastingMode = (ShadowCastingMode)0; Vector3 forward = ((Component)p).transform.forward; obj.transform.position = ((Component)p).transform.position + Vector3.up * 1.1f + forward * (size * 0.35f); obj.transform.rotation = Quaternion.LookRotation(forward, Vector3.up) * Quaternion.Euler(0f, 0f, roll) * Quaternion.Euler(70f, 0f, 0f); obj.transform.localScale = new Vector3(size, size, 1f); Tajo tajo = obj.AddComponent<Tajo>(); tajo._mat = val; tajo._duration = duration; } } } private void Update() { _t += Time.deltaTime; _mat.SetFloat("_Progress", Mathf.Clamp01(_t / _duration)); if (_t >= _duration) { Object.Destroy((Object)(object)((Component)this).gameObject); } } private void OnDestroy() { if ((Object)(object)_mat != (Object)null) { Object.Destroy((Object)(object)_mat); } } } public class EstelaToki : MonoBehaviour { private class Original { public Color[] Colors; public float[] Sizes; public float Life; public Light Light; } private static readonly Color Naranja = new Color(1f, 0.55f, 0.1f); private static readonly Color Brillo = new Color(1f, 0.9f, 0.55f); private readonly Dictionary<MeleeWeaponTrail, Original> _changed = new Dictionary<MeleeWeaponTrail, Original>(); private float _check; private void Update() { Player localPlayer = Player.m_localPlayer; bool flag = (Object)(object)localPlayer != (Object)null && !((Character)localPlayer).IsDead() && Manto.Active && MTEspadaPlugin.TajosManto.Value; _check -= Time.deltaTime; if (_check <= 0f) { _check = 0.25f; if (!flag) { RestoreAll(); return; } HashSet<MeleeWeaponTrail> hashSet = new HashSet<MeleeWeaponTrail>(((Component)localPlayer).GetComponentsInChildren<MeleeWeaponTrail>(true)); foreach (MeleeWeaponTrail item in new List<MeleeWeaponTrail>(_changed.Keys)) { if ((Object)(object)item == (Object)null || !hashSet.Contains(item)) { Restore(item); } } int level = ToukiRules.Level(localPlayer); foreach (MeleeWeaponTrail item2 in hashSet) { if (!_changed.ContainsKey(item2)) { Apply(item2, level); } } } if (!flag) { return; } foreach (KeyValuePair<MeleeWeaponTrail, Original> item3 in _changed) { if (!((Object)(object)item3.Key == (Object)null) && !((Object)(object)item3.Value.Light == (Object)null)) { bool value = Traverse.Create((object)i
plugins/MT.Magia/MT.Magia.dll
Decompiled 11 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Managers; using Jotunn.Utils; using MT.Core; using MT.Core.Commands; using MT.Core.Diario; using MT.Core.Especialidades; using MT.Core.I18n; using MT.Core.Mana; using MT.Core.Touki; using MT.Core.Vfx; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.Animations; using UnityEngine.Playables; using UnityEngine.Rendering; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")] [assembly: AssemblyCompany("MT.Magia")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+a3d1e112c18dad5152e45a99f4e3179a3ca51bec")] [assembly: AssemblyProduct("MT.Magia")] [assembly: AssemblyTitle("MT.Magia")] [assembly: AssemblyVersion("1.0.0.0")] [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 MT.Magia { public static class Afinidad { private const string Key = "MT.Magia.Afinidad"; public static bool Get(Player p, out Escuela fav, out Escuela weak) { fav = (weak = Escuela.Fuego); if ((Object)(object)p == (Object)null || !p.m_customData.TryGetValue("MT.Magia.Afinidad", out var value)) { return false; } string[] array = value.Split(new char[1] { ',' }); if (array.Length == 2 && Enum.TryParse<Escuela>(array[0], out fav)) { return Enum.TryParse<Escuela>(array[1], out weak); } return false; } public static void Roll(Player p) { if (!((Object)(object)p == (Object)null) && !p.m_customData.ContainsKey("MT.Magia.Afinidad")) { Escuela[] all = Escuelas.All; Escuela escuela = all[Random.Range(0, all.Length)]; Escuela escuela2; do { escuela2 = all[Random.Range(0, all.Length)]; } while (escuela2 == escuela); p.m_customData["MT.Magia.Afinidad"] = escuela.ToString() + "," + escuela2; ((Character)p).Message((MessageType)2, Tr.Get("magia_magic_affinity_favorite_weak", new object[2] { Escuelas.Name(escuela), Escuelas.Name(escuela2) }), 0, (Sprite)null, false); } } public static float CostMult(Player p, Escuela e) { if (!Get(p, out var fav, out var weak)) { return 1f; } if (e != fav) { if (e != weak) { return 1f; } return 1.1f; } return 0.9f; } public static bool IsFavorite(Player p, Escuela e) { if (Get(p, out var fav, out var _)) { return fav == e; } return false; } public static string Describe(Player p) { if (!Get(p, out var fav, out var weak)) { return Tr.Get("magia_not_rolled"); } return Tr.Get("magia_favorite_weak", new object[2] { Escuelas.Name(fav), Escuelas.Name(weak) }); } } public static class Agarre { private static ConfigFile _cfg; private static readonly Dictionary<string, ConfigEntry<Vector3>> Rot = new Dictionary<string, ConfigEntry<Vector3>>(); private static readonly Dictionary<string, ConfigEntry<Vector3>> Pos = new Dictionary<string, ConfigEntry<Vector3>>(); private static readonly Dictionary<string, GameObject> Prefabs = new Dictionary<string, GameObject>(); public static readonly Vector3 GiroPorDefecto = new Vector3(90f, 0f, 0f); public const float EscalaPorDefecto = 0.7f; private static readonly Dictionary<string, ConfigEntry<float>> Size = new Dictionary<string, ConfigEntry<float>>(); public static void Init(ConfigFile cfg) { _cfg = cfg; } public static Vector3 Rotation(string prefab) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) return Entry(Rot, prefab, "Giro", GiroPorDefecto).Value; } public static Vector3 Offset(string prefab) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) return Entry(Pos, prefab, "Posicion", Vector3.zero).Value; } public static float Scale(string prefab) { if (!Size.TryGetValue(prefab, out var value)) { value = _cfg.Bind<float>("Agarre", prefab + ".Escala", 0.7f, "Tamaño del modelo (1 = original). Ajústalo en el juego con «mt_grab scale 0.7»."); Size[prefab] = value; } return Mathf.Clamp(value.Value, 0.2f, 3f); } public static void SetScale(string prefab, float value) { Scale(prefab); Size[prefab].Value = value; _cfg.Save(); if (Prefabs.TryGetValue(prefab, out var value2)) { Apply(value2.transform.Find("attach"), prefab); } } public static void Track(string prefab, GameObject go) { Prefabs[prefab] = go; } private static ConfigEntry<Vector3> Entry(Dictionary<string, ConfigEntry<Vector3>> map, string prefab, string kind, Vector3 def) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) if (map.TryGetValue(prefab, out var value)) { return value; } return map[prefab] = _cfg.Bind<Vector3>("Agarre", prefab + "." + kind, def, (kind == "Giro") ? "Giro del modelo en la mano (grados X, Y, Z). Ajústalo en el juego con mt_grab." : "Desplazamiento del modelo en la mano (metros X, Y, Z). Ajústalo en el juego con mt_grab."); } public static void Set(string prefab, Vector3? rot, Vector3? pos) { //IL_0014: 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_003e: 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) if (rot.HasValue) { Entry(Rot, prefab, "Giro", Vector3.zero).Value = rot.Value; } if (pos.HasValue) { Entry(Pos, prefab, "Posicion", Vector3.zero).Value = pos.Value; } _cfg.Save(); if (Prefabs.TryGetValue(prefab, out var value)) { Apply(value.transform.Find("attach")); } } public static void Apply(Transform attach, string prefab = null) { //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) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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_009d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)attach == (Object)null) { return; } Transform val = attach.Find("MT_Modelo"); if (!((Object)(object)val == (Object)null)) { if (prefab == null) { prefab = ((Object)attach.root).name.Replace("(Clone)", "").Trim(); } val.localRotation = Quaternion.Euler(Rotation(prefab)); val.localPosition = Offset(prefab); val.localScale = Vector3.one * Scale(prefab); Transform val2 = attach.root.Find("MT_ModeloSuelo"); if ((Object)(object)val2 != (Object)null) { val2.localScale = Vector3.one * Scale(prefab); } } } public static void Setup(string prefab, GameObject go) { Track(prefab, go); Apply(go.transform.Find("attach"), prefab); } public static Transform HeldModel(Player p, out string prefab) { prefab = null; ItemData currentWeapon = ((Humanoid)p).GetCurrentWeapon(); if ((Object)(object)currentWeapon?.m_dropPrefab == (Object)null) { return null; } prefab = ((Object)currentWeapon.m_dropPrefab).name; VisEquipment value = Traverse.Create((object)p).Field("m_visEquipment").GetValue<VisEquipment>(); GameObject val = (((Object)(object)value != (Object)null) ? Traverse.Create((object)value).Field("m_rightItemInstance").GetValue<GameObject>() : null); if (!((Object)(object)val != (Object)null)) { return null; } return Find(val.transform, "MT_Modelo"); } private static Transform Find(Transform t, string name) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown if (((Object)t).name == name) { return t; } foreach (Transform item in t) { Transform val = Find(item, name); if ((Object)(object)val != (Object)null) { return val; } } return null; } } public class AgarreCommand : ConsoleCommand { public override string Name => "mt_grab"; public override string Help => "mt_grab [rotX rotY rotZ] [posX posY posZ] — adjust how you hold the wand or staff in your hand (saved per item). mt_grab scale 0.7: size. No numbers: show values. mt_grab reset: rotation and position to 0."; public override void Run(string[] args) { //IL_004d: 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_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_0206: 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_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0175: 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) Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { return; } string prefab; Transform val = Agarre.HeldModel(localPlayer, out prefab); if ((Object)(object)val == (Object)null) { Console.instance.Print("Equip a mod wand or staff (with its own model)."); return; } if (args.Length == 0) { Console.instance.Print($"{prefab}: rotation {Fmt(Agarre.Rotation(prefab))} · position {Fmt(Agarre.Offset(prefab))} · scale {Agarre.Scale(prefab):0.##}\n{((ConsoleCommand)this).Help}"); return; } if (args[0].ToLowerInvariant() == "scale") { if (args.Length < 2 || !float.TryParse(args[1].Replace(',', '.'), NumberStyles.Float, CultureInfo.InvariantCulture, out var result)) { Console.instance.Print($"{prefab}: scale {Agarre.Scale(prefab):0.##}. Usage: mt_grab scale 0.7"); return; } Agarre.SetScale(prefab, result); val.localScale = Vector3.one * Agarre.Scale(prefab); Console.instance.Print($"{prefab}: scale {Agarre.Scale(prefab):0.##} (saved)"); return; } Vector3? rot = null; Vector3? pos = null; if (args[0].ToLowerInvariant() == "reset") { rot = Vector3.zero; pos = Vector3.zero; } else { if (args.Length >= 3 && TryVec(args, 0, out var v)) { rot = v; } if (args.Length >= 6 && TryVec(args, 3, out var v2)) { pos = v2; } if (!rot.HasValue) { Console.instance.Print(((ConsoleCommand)this).Help); return; } } Agarre.Set(prefab, rot, pos); val.localRotation = Quaternion.Euler(Agarre.Rotation(prefab)); val.localPosition = Agarre.Offset(prefab); Console.instance.Print(prefab + ": rotation " + Fmt(Agarre.Rotation(prefab)) + " · position " + Fmt(Agarre.Offset(prefab)) + " (saved)"); } private static bool TryVec(string[] a, int i, out Vector3 v) { //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_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) v = Vector3.zero; CultureInfo invariantCulture = CultureInfo.InvariantCulture; if (!float.TryParse(a[i].Replace(',', '.'), NumberStyles.Float, invariantCulture, out var result) || !float.TryParse(a[i + 1].Replace(',', '.'), NumberStyles.Float, invariantCulture, out var result2) || !float.TryParse(a[i + 2].Replace(',', '.'), NumberStyles.Float, invariantCulture, out var result3)) { return false; } v = new Vector3(result, result2, result3); return true; } private static string Fmt(Vector3 v) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0015: 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) return string.Format(CultureInfo.InvariantCulture, "{0:0.##} {1:0.##} {2:0.##}", v.x, v.y, v.z); } } public static class AguaVfx { private static readonly Color Agua = new Color(0.45f, 0.7f, 1f); private static readonly Color AguaClara = new Color(0.8f, 0.92f, 1f); public static void Diluvio(Vector3 pos) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //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_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) FuegoVfx.Destello(pos + Vector3.up, 14f, 2.5f, 0.6f, Agua); Particulas.Spawn(pos, new Particulas.Config { ColorA = new Color(Agua.r, Agua.g, Agua.b, 0.9f), ColorB = new Color(AguaClara.r, AguaClara.g, AguaClara.b, 0.8f), LifeMin = 0.8f, LifeMax = 1.3f, SpeedMin = 12f, SpeedMax = 20f, SizeMin = 0.1f, SizeMax = 0.25f, Gravity = 0.4f, Radius = 0.6f, Hemisphere = true, Rate = 250f, Duration = 1f, FadeIn = 0.05f, Grow = 0.6f, Max = 3000 }); Chaparron(pos, 10f, 4f, 700f); Salpicadura(pos, 3f, 70); } public static void Ventisca(Vector3 pos) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //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_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: 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_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) FuegoVfx.Destello(pos + Vector3.up, 12f, 2f, 0.6f, AguaClara); Particulas.Spawn(pos, new Particulas.Config { ColorA = new Color(1f, 1f, 1f, 0.9f), ColorB = new Color(0.75f, 0.88f, 1f, 0.7f), LifeMin = 1.2f, LifeMax = 2f, SpeedMin = 3f, SpeedMax = 8f, SizeMin = 0.06f, SizeMax = 0.16f, Gravity = -0.1f, Radius = 3f, Hemisphere = true, Rate = 300f, Duration = 2.5f, FadeIn = 0.1f, Max = 3000 }); Particulas.Spawn(pos, new Particulas.Config { ColorA = new Color(0.9f, 0.95f, 1f, 0.4f), ColorB = new Color(0.8f, 0.88f, 1f, 0.25f), LifeMin = 1.5f, LifeMax = 2.5f, SpeedMin = 1f, SpeedMax = 3f, SizeMin = 1.2f, SizeMax = 2.4f, Radius = 2f, Hemisphere = true, Burst = 25, Additive = false, FadeIn = 0.15f, Grow = 2.5f }); Particulas.Spawn(pos + Vector3.up * 8f, new Particulas.Config { ColorA = Color.white, ColorB = new Color(0.8f, 0.9f, 1f, 0.8f), LifeMin = 2.5f, LifeMax = 3.5f, SpeedMin = 0f, SpeedMax = 0.5f, SizeMin = 0.06f, SizeMax = 0.14f, Gravity = 0.25f, Radius = 10f, Rate = 400f, Duration = 4f, FadeIn = 0.1f, Max = 3000 }); } public static void Lavar(Player p) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: 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_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_0049: 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_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)p).transform.position; Particulas.Spawn(position + Vector3.up * 2.6f, new Particulas.Config { ColorA = new Color(Agua.r, Agua.g, Agua.b, 0.9f), ColorB = new Color(AguaClara.r, AguaClara.g, AguaClara.b, 0.8f), LifeMin = 0.45f, LifeMax = 0.7f, SpeedMin = 0.5f, SpeedMax = 1.5f, SizeMin = 0.08f, SizeMax = 0.2f, Gravity = 2f, Radius = 0.45f, Rate = 300f, Duration = 0.5f, FadeIn = 0.05f, Max = 1000 }); Salpicadura(position, 0.6f, 50); } private static void Chaparron(Vector3 pos, float radio, float segundos, float porSegundo) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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_0043: 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_0071: Unknown result type (might be due to invalid IL or missing references) Particulas.Spawn(pos + Vector3.up * 10f, new Particulas.Config { ColorA = new Color(Agua.r, Agua.g, Agua.b, 0.75f), ColorB = new Color(AguaClara.r, AguaClara.g, AguaClara.b, 0.6f), LifeMin = 0.8f, LifeMax = 1.1f, SpeedMin = 0f, SpeedMax = 1f, SizeMin = 0.06f, SizeMax = 0.14f, Gravity = 2.2f, Radius = radio, Rate = porSegundo, Duration = segundos, FadeIn = 0.05f, Max = 4000 }); } private static void Salpicadura(Vector3 pos, float radio, int cantidad) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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_0043: 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_0071: Unknown result type (might be due to invalid IL or missing references) Particulas.Spawn(pos + Vector3.up * 0.1f, new Particulas.Config { ColorA = new Color(AguaClara.r, AguaClara.g, AguaClara.b, 0.9f), ColorB = new Color(Agua.r, Agua.g, Agua.b, 0.7f), LifeMin = 0.4f, LifeMax = 0.8f, SpeedMin = 2f, SpeedMax = 4.5f, SizeMin = 0.06f, SizeMax = 0.16f, Gravity = 1.5f, Radius = radio, Hemisphere = true, Burst = cantidad, FadeIn = 0.02f, Max = 1000 }); } } public static class Aprendizaje { public static Spell Random(Player p, int minRank, int maxRank, Escuela? school = null) { HashSet<string> known = Pergaminos.Known(p); List<Spell> list = SpellBook.All.Where((Spell s) => !known.Contains(s.Id) && s.School != Escuela.Gravedad && s.Rank >= minRank && s.Rank <= maxRank && (!school.HasValue || s.School == school.Value)).ToList(); if (list.Count != 0) { return list[Random.Range(0, list.Count)]; } return null; } public static void Teach(Player p, Spell s, string como) { Pergaminos.Learn(p, s.Id); DiarioMagia.HechizoAprendido(p, s); ((Character)p).Message((MessageType)2, como + "\n«" + s.Name + "»", 0, (Sprite)null, false); } public static void AlFabricarVarita(Player p) { if (MTMagiaPlugin.AprenderVarita.Value) { Spell spell = Random(p, 0, 0); if (spell != null) { Teach(p, spell, Tr.Get("magia_crafting_wand_feel_mana_flow")); } } } public static void AlSubirRango(Player p, Escuela e, int rank) { if (MTMagiaPlugin.AprenderRango.Value) { Spell spell = Random(p, 0, rank, e); if (spell != null) { Teach(p, spell, Tr.Get("magia_practice_pays_off_discover_new")); } } } } [HarmonyPatch(typeof(InventoryGui), "DoCrafting")] public static class VaritaCraftPatch { private static int _antes; private static void Prefix(InventoryGui __instance, out bool __state) { Traverse obj = Traverse.Create((object)__instance); Recipe value = obj.Field("m_craftRecipe").GetValue<Recipe>(); ItemData value2 = obj.Field("m_craftUpgradeItem").GetValue<ItemData>(); __state = value2 == null && (Object)(object)value != (Object)null && (Object)(object)value.m_item != (Object)null && ((Object)value.m_item).name == "MT_VaritaAprendiz"; if (__state) { _antes = Contar(Player.m_localPlayer); } } private static int Contar(Player p) { if (!((Object)(object)p == (Object)null)) { return ((Humanoid)p).GetInventory().GetAllItems().Count((ItemData i) => (Object)(object)i.m_dropPrefab != (Object)null && ((Object)i.m_dropPrefab).name == "MT_VaritaAprendiz"); } return 0; } private static void Postfix(bool __state) { Player localPlayer = Player.m_localPlayer; if (__state && (Object)(object)localPlayer != (Object)null && Contar(localPlayer) > _antes) { Aprendizaje.AlFabricarVarita(localPlayer); } } } [HarmonyPatch(typeof(Trader), "GetAvailableItems")] public static class TraderPergaminoPatch { private static void Postfix(Trader __instance, ref List<TradeItem> __result) { //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_0099: 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_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Expected O, but got Unknown if (__result != null && MTMagiaPlugin.PrecioPergamino.Value > 0 && !((Object)(object)__instance == (Object)null) && ((Object)__instance).name.StartsWith("Haldor") && !__result.Any((TradeItem t) => (Object)(object)t.m_prefab != (Object)null && ((Object)t.m_prefab).name == "MT_PergaminoMagiaRara")) { ObjectDB instance = ObjectDB.instance; object obj; if (instance == null) { obj = null; } else { GameObject itemPrefab = instance.GetItemPrefab("MT_PergaminoMagiaRara"); obj = ((itemPrefab != null) ? itemPrefab.GetComponent<ItemDrop>() : null); } ItemDrop val = (ItemDrop)obj; if (!((Object)(object)val == (Object)null)) { __result = new List<TradeItem>(__result) { new TradeItem { m_prefab = val, m_stack = 1, m_price = MTMagiaPlugin.PrecioPergamino.Value, m_requiredGlobalKey = "" } }; } } } } public class Arco : MonoBehaviour { private LineRenderer _core; private LineRenderer _glow; private Light _light; private Vector3 _from; private Vector3 _to; private float _width; private float _grow; private float _born; public static Arco Spawn(Vector3 from, Vector3 to, Color color, float width = 0.3f, float duration = 0.3f, float grow = 0f) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0082: 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_00a8: 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_00e5: Unknown result type (might be due to invalid IL or missing references) if (MTMagiaPlugin.EfectosPropios.Value) { Vector3 val = to - from; if (!(((Vector3)(ref val)).sqrMagnitude < 0.01f)) { GameObject val2 = new GameObject("MT_ArcoElectrico"); Arco arco = val2.AddComponent<Arco>(); arco._from = from; arco._to = to; arco._width = width; arco._grow = grow; arco._born = Time.time; arco._glow = Line(val2.transform, "Halo", color, width); arco._core = Line(val2.transform, "Nucleo", Color.Lerp(color, Color.white, 0.8f), width * 0.3f); arco._light = new GameObject("Luz").AddComponent<Light>(); ((Component)arco._light).transform.SetParent(val2.transform, false); ((Component)arco._light).transform.position = to; arco._light.color = color; arco._light.range = 6f; arco._light.intensity = 2.5f; arco.Shape(); Object.Destroy((Object)(object)val2, duration); return arco; } } return null; } public void Retarget(Vector3 from, Vector3 to) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: 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) _from = from; _to = to; if ((Object)(object)_light != (Object)null) { ((Component)_light).transform.position = to; } } private static LineRenderer Line(Transform parent, string name, Color color, float width) { //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_002a: 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_003d: 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_0044: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name); val.transform.SetParent(parent, false); LineRenderer obj = val.AddComponent<LineRenderer>(); obj.useWorldSpace = true; ((Renderer)obj).material = Vfx.NewMaterial(Vfx.Tex("heal_streak"), color); Color startColor = (obj.endColor = color); obj.startColor = startColor; obj.startWidth = width; obj.endWidth = width * 0.6f; obj.textureMode = (LineTextureMode)0; obj.numCapVertices = 2; ((Renderer)obj).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)obj).receiveShadows = false; return obj; } private void Update() { Shape(); } private void Shape() { //IL_0016: 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_0039: 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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_008f: 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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: 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_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0118: 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) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: 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_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((_grow > 0f) ? Vector3.Lerp(_from, _to, Mathf.Clamp01((Time.time - _born) / _grow)) : _to); if ((Object)(object)_light != (Object)null) { ((Component)_light).transform.position = val; } float num = Vector3.Distance(_from, val); int num2 = Mathf.Clamp(Mathf.CeilToInt(num / 0.5f), 4, 60); Vector3 val2 = val - _from; Vector3 normalized = ((Vector3)(ref val2)).normalized; Vector3 val3 = Vector3.Cross(normalized, Vector3.up); if (((Vector3)(ref val3)).sqrMagnitude < 0.01f) { val3 = Vector3.Cross(normalized, Vector3.right); } ((Vector3)(ref val3)).Normalize(); Vector3 val4 = Vector3.Cross(val3, normalized); float num3 = Mathf.Clamp(num * 0.03f, 0.08f, 0.5f); Vector3[] array = (Vector3[])(object)new Vector3[num2 + 1]; for (int i = 0; i <= num2; i++) { float num4 = (float)i / (float)num2; float num5 = Mathf.Sin(num4 * (float)Math.PI); Vector3 val5 = (val3 * Random.Range(-1f, 1f) + val4 * Random.Range(-1f, 1f)) * num3 * num5; array[i] = Vector3.Lerp(_from, val, num4) + val5; } LineRenderer[] array2 = (LineRenderer[])(object)new LineRenderer[2] { _glow, _core }; foreach (LineRenderer obj in array2) { obj.positionCount = array.Length; obj.SetPositions(array); } float num6 = Random.Range(0.7f, 1.2f); _glow.widthMultiplier = num6; if ((Object)(object)_light != (Object)null) { _light.intensity = 2.5f * num6; } } } public static class ArmaduraMk1 { public class Modelo { public Mesh Mesh; public Material[] Mats; } public const string Prefab = "MT_ArmaduraMk1"; public const string Escudo = "MT_EscudoMk1"; public const string Canon = "MT_CanonMk1"; public const string Casco = "MT_CascoMk1"; public const string Grebas = "MT_GrebasMk1"; public const string Coraza = "MT_CorazaMk1"; public static readonly KeyValuePair<string, HumanBodyBones>[] Piezas = new KeyValuePair<string, HumanBodyBones>[15] { P("cabeza", (HumanBodyBones)10), P("pecho", (HumanBodyBones)8), P("cadera", (HumanBodyBones)0), P("brazo_der", (HumanBodyBones)14), P("brazo_izq", (HumanBodyBones)13), P("antebrazo_der", (HumanBodyBones)16), P("antebrazo_izq", (HumanBodyBones)15), P("mano_der", (HumanBodyBones)18), P("mano_izq", (HumanBodyBones)17), P("muslo_der", (HumanBodyBones)2), P("muslo_izq", (HumanBodyBones)1), P("pierna_der", (HumanBodyBones)4), P("pierna_izq", (HumanBodyBones)3), P("pie_der", (HumanBodyBones)6), P("pie_izq", (HumanBodyBones)5) }; public static readonly KeyValuePair<string, HumanBodyBones>[] PiezaEscudo = new KeyValuePair<string, HumanBodyBones>[1] { P("escudo", (HumanBodyBones)15) }; public static readonly KeyValuePair<string, HumanBodyBones>[] PiezaCanon = new KeyValuePair<string, HumanBodyBones>[1] { P("canon", (HumanBodyBones)16) }; public static bool Powered; private static Dictionary<string, Modelo> _cache; private static KeyValuePair<string, HumanBodyBones> P(string pieza, HumanBodyBones hueso) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return new KeyValuePair<string, HumanBodyBones>(pieza, hueso); } public static void Register() { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected O, but got Unknown //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Expected O, but got Unknown //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Expected O, but got Unknown //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Expected O, but got Unknown //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Expected O, but got Unknown //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Expected O, but got Unknown //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Expected O, but got Unknown //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Expected O, but got Unknown PrefabManager.OnVanillaPrefabsAvailable -= Register; RegistrarPieza("MT_CascoMk1", Tr.Token("magia_casco_mk1"), Tr.Token("magia_casco_mk1_d"), "casco_mk1", 8f, (RequirementConfig[])(object)new RequirementConfig[3] { new RequirementConfig("BlackMetal", 10, 0, true), new RequirementConfig("Iron", 10, 0, true), new RequirementConfig("Crystal", 3, 0, true) }); RegistrarPieza("MT_CorazaMk1", Tr.Token("magia_coraza_mk1"), Tr.Token("magia_coraza_mk1_d"), "coraza_mk1", 30f, (RequirementConfig[])(object)new RequirementConfig[4] { new RequirementConfig("BlackMetal", 30, 0, true), new RequirementConfig("Iron", 30, 0, true), new RequirementConfig("Crystal", 10, 0, true), new RequirementConfig("SurtlingCore", 10, 0, true) }); RegistrarPieza("MT_GrebasMk1", Tr.Token("magia_grebas_mk1"), Tr.Token("magia_grebas_mk1_d"), "grebas_mk1", 18f, (RequirementConfig[])(object)new RequirementConfig[3] { new RequirementConfig("BlackMetal", 20, 0, true), new RequirementConfig("Iron", 20, 0, true), new RequirementConfig("SurtlingCore", 4, 0, true) }); RegistrarArmadura(); RegistrarEscudo(); RegistrarCanon(); } private static void RegistrarArmadura() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Expected O, but got Unknown //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Expected O, but got Unknown //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Expected O, but got Unknown //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Expected O, but got Unknown //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Expected O, but got Unknown if (!((Object)(object)PrefabManager.Instance.GetPrefab("ArmorBronzeChest") == (Object)null)) { ItemConfig val = new ItemConfig(); val.Name = Tr.Token("magia_armadura_mk1"); val.Description = Tr.Token("magia_armadura_mk1_d"); val.Icon = MTMagiaPlugin.Icon("armadura_mk1"); val.CraftingStation = CraftingStations.Forge; val.MinStationLevel = 3; val.Requirements = (RequirementConfig[])(object)new RequirementConfig[5] { new RequirementConfig("MT_CascoMk1", 1, 1, true), new RequirementConfig("MT_CorazaMk1", 1, 1, true), new RequirementConfig("MT_GrebasMk1", 1, 1, true), new RequirementConfig("BlackMetal", 0, 10, true), new RequirementConfig("Crystal", 0, 5, true) }; CustomItem val2 = new CustomItem("MT_ArmaduraMk1", "ArmorBronzeChest", val); SharedData shared = val2.ItemDrop.m_itemData.m_shared; shared.m_armor = MTMagiaPlugin.Mk1Armadura.Value + 28f; shared.m_armorPerLevel = 4f; shared.m_weight = 60f; shared.m_movementModifier = 0f; shared.m_maxQuality = 3; shared.m_useDurability = true; shared.m_canBeReparied = true; shared.m_maxDurability = MTMagiaPlugin.Mk1Durabilidad.Value; shared.m_durabilityPerLevel = MTMagiaPlugin.Mk1Durabilidad.Value * 0.25f; HideVisual(val2.ItemPrefab); EnElSuelo(val2.ItemPrefab, new string[3] { "casco", "torso", "piernas" }, 2.3f); ItemManager.Instance.AddItem(val2); } } private static void RegistrarPieza(string prefab, string name, string desc, string icon, float weight, RequirementConfig[] req) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: 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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Expected O, but got Unknown //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown //IL_006f: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)PrefabManager.Instance.GetPrefab("BlackMetal") == (Object)null)) { CustomItem val = new CustomItem(prefab, "BlackMetal", new ItemConfig { Name = name, Description = desc, Icon = MTMagiaPlugin.Icon(icon), CraftingStation = CraftingStations.Forge, MinStationLevel = 3, Requirements = req }); SharedData shared = val.ItemDrop.m_itemData.m_shared; shared.m_itemType = (ItemType)1; shared.m_maxStackSize = 1; shared.m_weight = weight; shared.m_maxQuality = 1; shared.m_teleportable = true; string text = ((prefab == "MT_CascoMk1") ? "casco" : ((prefab == "MT_CorazaMk1") ? "torso" : "piernas")); HideVisual(val.ItemPrefab); EnElSuelo(val.ItemPrefab, new string[1] { text }, 1.6f); ItemManager.Instance.AddItem(val); } } public static bool WornPart(Player p, string field, string prefab) { if ((Object)(object)p != (Object)null) { return Is(Slot(p, field), prefab); } return false; } public static int Piezas_(Player p) { if (!Worn(p)) { return 0; } return 3; } private static void RegistrarEscudo() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Expected O, but got Unknown //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Expected O, but got Unknown //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Expected O, but got Unknown string text = (((Object)(object)PrefabManager.Instance.GetPrefab("ShieldIronTower") != (Object)null) ? "ShieldIronTower" : "ShieldBanded"); if (!((Object)(object)PrefabManager.Instance.GetPrefab(text) == (Object)null)) { ItemConfig val = new ItemConfig(); val.Name = Tr.Token("magia_escudo_mk1"); val.Description = Tr.Token("magia_escudo_mk1_d"); val.Icon = MTMagiaPlugin.Icon("escudo_mk1"); val.CraftingStation = CraftingStations.Forge; val.MinStationLevel = 3; val.Requirements = (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("BlackMetal", 15, 5, true), new RequirementConfig("Iron", 15, 5, true) }; CustomItem val2 = new CustomItem("MT_EscudoMk1", text, val); SharedData shared = val2.ItemDrop.m_itemData.m_shared; shared.m_blockPower = MTMagiaPlugin.Mk1BloqueoEscudo.Value; shared.m_blockPowerPerLevel = 6f; shared.m_deflectionForce = 60f; shared.m_weight = 18f; shared.m_movementModifier = -0.05f; shared.m_maxQuality = 3; ShieldInHand(val2.ItemPrefab); ItemManager.Instance.AddItem(val2); } } private static void EnElSuelo(GameObject prefab, string[] piezas, float escala) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0105: 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_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0127: 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) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: 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_00af: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("MT_Mk1_suelo"); val.transform.SetParent(prefab.transform, false); val.transform.localScale = Vector3.one * escala; Material val2 = Mk1Material.Body(); Bounds? val3 = null; foreach (string text in piezas) { Mesh val4 = Mk1Skin.StaticMesh(text); if (!((Object)(object)val4 == (Object)null)) { GameObject val5 = new GameObject(text); val5.transform.SetParent(val.transform, false); val5.AddComponent<MeshFilter>().sharedMesh = val4; MeshRenderer val6 = val5.AddComponent<MeshRenderer>(); if ((Object)(object)val2 != (Object)null) { ((Renderer)val6).sharedMaterial = val2; } if (!val3.HasValue) { val3 = val4.bounds; continue; } Bounds value = val3.Value; ((Bounds)(ref value)).Encapsulate(val4.bounds); val3 = value; } } if (val3.HasValue) { Bounds value2 = val3.Value; val.transform.localPosition = -new Vector3(((Bounds)(ref value2)).center.x, ((Bounds)(ref value2)).min.y, ((Bounds)(ref value2)).center.z) * escala; } } private static void CanonEnSuelo(GameObject prefab) { //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_0036: 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_0055: Unknown result type (might be due to invalid IL or missing references) Modelo modelo = Piece("canon"); if (!((Object)(object)modelo.Mesh == (Object)null)) { GameObject val = new GameObject("MT_Mk1_canon_suelo"); val.transform.SetParent(prefab.transform, false); val.transform.localRotation = Quaternion.Euler(90f, 0f, 0f); val.AddComponent<MeshFilter>().sharedMesh = modelo.Mesh; ((Renderer)val.AddComponent<MeshRenderer>()).sharedMaterials = modelo.Mats; } } private static void ShieldInHand(GameObject prefab) { bool num = ColocarEscudo(prefab, soloVisibles: true); HideVisual(prefab); if (!num) { MTMagiaPlugin.Log.LogWarning((object)"Mk-I: no se pudo poner el escudo en la mano"); } } public static bool ColocarEscudo(GameObject root, bool soloVisibles, float extra = 1f) { //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_015e: 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) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_014c: 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_0156: Unknown result type (might be due to invalid IL or missing references) //IL_018a: 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_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_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: 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_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_021b: 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) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: 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_0301: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Unknown result type (might be due to invalid IL or missing references) //IL_032d: Unknown result type (might be due to invalid IL or missing references) //IL_0332: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_0337: Unknown result type (might be due to invalid IL or missing references) //IL_034e: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Unknown result type (might be due to invalid IL or missing references) //IL_0366: Unknown result type (might be due to invalid IL or missing references) //IL_0367: Unknown result type (might be due to invalid IL or missing references) //IL_0369: Unknown result type (might be due to invalid IL or missing references) //IL_036d: Unknown result type (might be due to invalid IL or missing references) //IL_0372: Unknown result type (might be due to invalid IL or missing references) //IL_0377: Unknown result type (might be due to invalid IL or missing references) //IL_037c: Unknown result type (might be due to invalid IL or missing references) //IL_0380: Unknown result type (might be due to invalid IL or missing references) //IL_0385: Unknown result type (might be due to invalid IL or missing references) //IL_038f: Unknown result type (might be due to invalid IL or missing references) //IL_03a0: Unknown result type (might be due to invalid IL or missing references) MeshFilter val = null; Transform val2 = root.transform.Find("attach"); MeshFilter[] componentsInChildren = (((Object)(object)val2 != (Object)null) ? ((Component)val2).gameObject : root).GetComponentsInChildren<MeshFilter>(true); Bounds bounds; foreach (MeshFilter val3 in componentsInChildren) { MeshRenderer component = ((Component)val3).GetComponent<MeshRenderer>(); if ((Object)(object)val3.sharedMesh == (Object)null || (Object)(object)component == (Object)null || (soloVisibles && !((Renderer)component).enabled) || ((Object)val3).name.StartsWith("MT_Mk1")) { continue; } if (!((Object)(object)val == (Object)null)) { bounds = val3.sharedMesh.bounds; Vector3 size = ((Bounds)(ref bounds)).size; float sqrMagnitude = ((Vector3)(ref size)).sqrMagnitude; bounds = val.sharedMesh.bounds; size = ((Bounds)(ref bounds)).size; if (!(sqrMagnitude > ((Vector3)(ref size)).sqrMagnitude)) { continue; } } val = val3; } Modelo modelo = Piece("escudo"); if ((Object)(object)val == (Object)null || (Object)(object)modelo.Mesh == (Object)null) { return false; } Ejes(val.sharedMesh, out var c, out var ax, out var len); Ejes(modelo.Mesh, out var c2, out var ax2, out var len2); if (Vector3.Dot(Vector3.Cross(ax2[0], ax2[1]), ax2[2]) < 0f) { ax2[2] = -ax2[2]; } if (Vector3.Dot(Vector3.Cross(ax[0], ax[1]), ax[2]) < 0f) { ax[2] = -ax[2]; } if (MTMagiaPlugin.Mk1EscudoManoVoltear.Value) { ax2[1] = -ax2[1]; ax2[2] = -ax2[2]; } Quaternion val4 = Quaternion.LookRotation(ax2[2], ax2[0]); Quaternion val5 = Quaternion.LookRotation(ax[2], ax[0]) * Quaternion.Inverse(val4) * Quaternion.Euler(MTMagiaPlugin.Mk1EscudoManoGiro.Value); float num = len[0] / Mathf.Max(0.01f, len2[0]) * MTMagiaPlugin.Mk1EscudoManoEscala.Value * extra; if (float.IsNaN(num) || float.IsInfinity(num) || num <= 0f || float.IsNaN(val5.x)) { MTMagiaPlugin.Log.LogWarning((object)$"Mk-I: ajuste del escudo inválido (escala {num}); se usa tamaño 1"); num = MTMagiaPlugin.Mk1EscudoManoEscala.Value; val5 = Quaternion.Euler(MTMagiaPlugin.Mk1EscudoManoGiro.Value); bounds = val.sharedMesh.bounds; c = ((Bounds)(ref bounds)).center; bounds = modelo.Mesh.bounds; c2 = ((Bounds)(ref bounds)).center; } GameObject val6 = new GameObject("MT_Mk1_escudo_mano"); val6.transform.SetParent(((Component)val).transform, false); val6.transform.localRotation = val5; val6.transform.localScale = Vector3.one * num; Vector3 val7 = ((Vector3.Dot(c, ax[2]) < 0f) ? (-ax[2]) : ax[2]); float num2 = MTMagiaPlugin.Mk1EscudoManoSeparacion.Value / Mathf.Max(0.01f, ((Component)val).transform.lossyScale.x); val6.transform.localPosition = c - val5 * (c2 * num) + val7 * num2; val6.layer = ((Component)val).gameObject.layer; val6.AddComponent<MeshFilter>().sharedMesh = modelo.Mesh; ((Renderer)val6.AddComponent<MeshRenderer>()).sharedMaterials = modelo.Mats; return true; } private static void Ejes(Mesh mesh, out Vector3 c, out Vector3[] ax, out float[] len) { //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_004d: 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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: 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_0070: 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_007c: 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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: 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_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) Vector3[] array = (Vector3[])(mesh.isReadable ? ((Array)mesh.vertices) : ((Array)new Vector3[0])); if (array.Length >= 3) { Ejes(array, out c, out ax, out len); if (!float.IsNaN(len[0]) && len[0] > 0f) { return; } } Bounds bounds = mesh.bounds; c = ((Bounds)(ref bounds)).center; Vector3[] array2 = (Vector3[])(object)new Vector3[3] { Vector3.right, Vector3.up, Vector3.forward }; float[] sizes = new float[3] { ((Bounds)(ref bounds)).size.x, ((Bounds)(ref bounds)).size.y, ((Bounds)(ref bounds)).size.z }; int[] array3 = new int[3] { 0, 1, 2 }; Array.Sort(array3, (int i, int j) => sizes[j].CompareTo(sizes[i])); ax = (Vector3[])(object)new Vector3[3] { array2[array3[0]], array2[array3[1]], array2[array3[2]] }; len = new float[3] { sizes[array3[0]], sizes[array3[1]], sizes[array3[2]] }; } public static bool ReaplicarEscudo(Player p) { if ((Object)(object)p == (Object)null || !Is(Slot(p, "m_leftItem"), "MT_EscudoMk1")) { return false; } VisEquipment component = ((Component)p).GetComponent<VisEquipment>(); GameObject val = (((Object)(object)component != (Object)null) ? Traverse.Create((object)component).Field("m_leftItemInstance").GetValue<GameObject>() : null); if ((Object)(object)val == (Object)null) { return false; } MeshRenderer[] componentsInChildren = val.GetComponentsInChildren<MeshRenderer>(true); foreach (MeshRenderer val2 in componentsInChildren) { if (((Object)val2).name == "MT_Mk1_escudo_mano") { Object.Destroy((Object)(object)((Component)val2).gameObject); } } return ColocarEscudo(val, soloVisibles: false, ConArmadura(p)); } private static void Ejes(Vector3[] v, out Vector3 c, out Vector3[] ax, out float[] len) { //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_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: 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_0047: Unknown result type (might be due to invalid IL or missing references) //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_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: 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_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: 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_00e6: 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_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: 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) //IL_01af: 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_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_0230: 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_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0248: 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_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) c = Vector3.zero; Vector3[] array = v; foreach (Vector3 val in array) { c += val; } c /= (float)Mathf.Max(1, v.Length); float xx = 0f; float xy = 0f; float xz = 0f; float yy = 0f; float yz = 0f; float zz = 0f; array = v; for (int i = 0; i < array.Length; i++) { Vector3 val2 = array[i] - c; xx += val2.x * val2.x; xy += val2.x * val2.y; xz += val2.x * val2.z; yy += val2.y * val2.y; yz += val2.y * val2.z; zz += val2.z * val2.z; } Func<Vector3, Vector3> func = (Vector3 a) => new Vector3(xx * a.x + xy * a.y + xz * a.z, xy * a.x + yy * a.y + yz * a.z, xz * a.x + yz * a.y + zz * a.z); Vector3 normalized = default(Vector3); ((Vector3)(ref normalized))..ctor(0.3f, 0.9f, 0.2f); Vector3 val3; for (int num = 0; num < 60; num++) { val3 = func(normalized); normalized = ((Vector3)(ref val3)).normalized; } val3 = Vector3.Cross(normalized, (Mathf.Abs(normalized.x) < 0.9f) ? Vector3.right : Vector3.up); Vector3 normalized2 = ((Vector3)(ref val3)).normalized; for (int num2 = 0; num2 < 60; num2++) { normalized2 = func(normalized2); val3 = normalized2 - Vector3.Dot(normalized2, normalized) * normalized; normalized2 = ((Vector3)(ref val3)).normalized; } val3 = Vector3.Cross(normalized, normalized2); Vector3 normalized3 = ((Vector3)(ref val3)).normalized; ax = (Vector3[])(object)new Vector3[3] { normalized, normalized2, normalized3 }; len = new float[3]; for (int num3 = 0; num3 < 3; num3++) { float num4 = float.MaxValue; float num5 = float.MinValue; array = v; for (int i = 0; i < array.Length; i++) { float num6 = Vector3.Dot(array[i] - c, ax[num3]); num4 = Mathf.Min(num4, num6); num5 = Mathf.Max(num5, num6); } len[num3] = num5 - num4; } } private static int[] Axes(Vector3 s) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) int[] obj = new int[3] { 0, 1, 2 }; Array.Sort(obj, (int x, int y) => ((Vector3)(ref s))[y].CompareTo(((Vector3)(ref s))[x])); return obj; } private static Vector3 Axis(int i) { //IL_0013: 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_0007: Unknown result type (might be due to invalid IL or missing references) return (Vector3)(i switch { 1 => Vector3.up, 0 => Vector3.right, _ => Vector3.forward, }); } private static void RegistrarCanon() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Expected O, but got Unknown //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Expected O, but got Unknown //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Expected O, but got Unknown //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Expected O, but got Unknown //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: 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_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) string text = (((Object)(object)PrefabManager.Instance.GetPrefab("StaffIceShards") != (Object)null) ? "StaffIceShards" : "StaffFireball"); if (!((Object)(object)PrefabManager.Instance.GetPrefab(text) == (Object)null)) { ItemConfig val = new ItemConfig(); val.Name = Tr.Token("magia_canon_mk1"); val.Description = Tr.Token("magia_canon_mk1_d"); val.Icon = MTMagiaPlugin.Icon("canon_mk1"); val.CraftingStation = CraftingStations.Forge; val.MinStationLevel = 3; val.Requirements = (RequirementConfig[])(object)new RequirementConfig[3] { new RequirementConfig("BlackMetal", 20, 5, true), new RequirementConfig("Iron", 10, 5, true), new RequirementConfig("SurtlingCore", 5, 2, true) }; CustomItem val2 = new CustomItem("MT_CanonMk1", text, val); SharedData shared = val2.ItemDrop.m_itemData.m_shared; shared.m_itemType = (ItemType)3; shared.m_skillType = (SkillType)9; shared.m_damages = new DamageTypes { m_blunt = MTMagiaPlugin.Mk1DanoBala.Value }; shared.m_damagesPerLevel = new DamageTypes { m_blunt = 6f }; shared.m_attack.m_attackEitr = 0f; shared.m_attackStatusEffect = null; shared.m_secondaryAttack.m_attackEitr = 0f; shared.m_weight = 12f; shared.m_maxQuality = 3; shared.m_useDurability = true; shared.m_canBeReparied = true; shared.m_maxDurability = MTMagiaPlugin.Mk1CanonDurabilidad.Value; shared.m_durabilityPerLevel = MTMagiaPlugin.Mk1CanonDurabilidad.Value * 0.25f; HideVisual(val2.ItemPrefab); CanonEnSuelo(val2.ItemPrefab); ItemManager.Instance.AddItem(val2); } } private static void HideVisual(GameObject prefab) { //IL_004d: 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) Renderer[] componentsInChildren = prefab.GetComponentsInChildren<Renderer>(true); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].enabled = false; } Light[] componentsInChildren2 = prefab.GetComponentsInChildren<Light>(true); for (int i = 0; i < componentsInChildren2.Length; i++) { ((Behaviour)componentsInChildren2[i]).enabled = false; } ParticleSystem[] componentsInChildren3 = prefab.GetComponentsInChildren<ParticleSystem>(true); for (int i = 0; i < componentsInChildren3.Length; i++) { EmissionModule emission = componentsInChildren3[i].emission; ((EmissionModule)(ref emission)).enabled = false; } } public static bool Is(ItemData it, string prefab) { if (it != null && (Object)(object)it.m_dropPrefab != (Object)null) { return ((Object)it.m_dropPrefab).name == prefab; } return false; } public static ItemData Slot(Player p, string field) { return Traverse.Create((object)p).Field(field).GetValue<ItemData>(); } public static bool Worn(Player p) { if ((Object)(object)p != (Object)null) { return Is(Slot(p, "m_chestItem"), "MT_ArmaduraMk1"); } return false; } public static float ConArmadura(Player p) { if (!Worn(p)) { return 1f; } return MTMagiaPlugin.Mk1ConArmaduraEscala.Value; } public static bool HoldsCanon(Player p) { if ((Object)(object)p != (Object)null) { return Is(Slot(p, "m_rightItem"), "MT_CanonMk1"); } return false; } public static void Recargar() { _cache = null; Mk1Skin.ClearCache(); Mk1Material.ClearCache(); ArmaduraMk1Ctrl.Rebuild = true; } public static Modelo Piece(string name) { if (_cache == null) { _cache = new Dictionary<string, Modelo>(); } if (_cache.TryGetValue(name, out var value)) { return value; } string text = Path.Combine(MTMagiaPlugin.ModelDir, "mk1_" + name + ".obj"); List<string> materialNames; Mesh val = ObjModel.Load(text, out materialNames); if ((Object)(object)val == (Object)null) { MTMagiaPlugin.Log.LogWarning((object)("Mk-I: falta la pieza " + text)); return _cache[name] = new Modelo(); } val.RecalculateTangents(); Material val2 = Mk1Material.Armas(); if ((Object)(object)val2 == (Object)null) { return _cache[name] = new Modelo(); } Material[] array = (Material[])(object)new Material[val.subMeshCount]; for (int i = 0; i < array.Length; i++) { array[i] = (materialNames[i].Contains("UnderArmor") ? Mk1Material.Joint() : val2); } return _cache[name] = new Modelo { Mesh = val, Mats = array }; } } public class ArmaduraMk1Ctrl : MonoBehaviour { private class Conjunto { public readonly List<GameObject> Pieces = new List<GameObject>(); public float Since; public bool Built => Pieces.Count > 0; } public static bool Rebuild; private readonly Conjunto _armadura = new Conjunto(); private readonly Conjunto _escudo = new Conjunto(); private readonly Conjunto _canon = new Conjunto(); private readonly Conjunto _casco = new Conjunto(); private readonly Conjunto _grebas = new Conjunto(); private readonly List<Renderer> _hidden = new List<Renderer>(); private Player _for; private float _warnAt; private float _hideCheck; private Animator _animator; private AnimatorCullingMode _originalCulling; private float _nextBuildWarning; public static Transform CanonPiece; private bool _apuntando; private float _nextShot; private float _nadoPuesto = -1f; private bool _camara; public static float CamaraAplicada = 1f; public static bool CamaraReaplicar; public static bool CanonReaplicar; private Vector3 _off3; private Vector3 _offCombate; private float _minD; private float _maxD; private float _stepDist; private float _airTime; private float _peakY; private Vector3 _lastPos; private static GameObject _sfxPaso; private static bool _sfxBuscado; private GameObject _escudoRevisado; private bool _escudoConArmadura; private bool _canonConArmadura; private Transform _grown; private Vector3 _grownScale; private readonly List<Renderer> _hiddenParts = new List<Renderer>(); private float _partsCheck; private void OnDisable() { Clear(_armadura, restore: true); Clear(_escudo, restore: false); Clear(_canon, restore: false); Clear(_casco, restore: false); Clear(_grebas, restore: false); RestoreAnimator(); CanonPiece = null; ArmaduraMk1.Powered = false; } private void RestoreAnimator() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_animator != (Object)null) { _animator.cullingMode = _originalCulling; } _animator = null; } private void Canon(Player p) { //IL_009a: 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_00d1: 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_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00db: 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_00e1: 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_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0118: 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) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_013b: 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_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) _apuntando = false; if ((Object)(object)p == (Object)null || ((Character)p).IsDead() || !ArmaduraMk1.HoldsCanon(p) || ((Object)(object)Chat.instance != (Object)null && Chat.instance.HasFocus()) || Console.IsVisible() || Menu.IsVisible() || InventoryGui.IsVisible() || Minimap.IsOpen() || !ZInput.GetButton("Attack")) { return; } _apuntando = true; p.FaceLookDirection(); if (!(Time.time < _nextShot)) { _nextShot = Time.time + MTMagiaPlugin.Mk1Cadencia.Value; Vector3 val = Fx.AimPoint(p, 60f); MeshRenderer val2 = (((Object)(object)CanonPiece != (Object)null) ? ((Component)CanonPiece).GetComponent<MeshRenderer>() : null); Vector3 val3; Bounds bounds; if (!((Object)(object)val2 != (Object)null)) { val3 = Fx.HandOrigin(p); } else { bounds = ((Renderer)val2).bounds; val3 = ((Bounds)(ref bounds)).center; } Vector3 val4 = val3; Vector3 val5 = val - val4; val5 = ((((Vector3)(ref val5)).sqrMagnitude > 0.01f) ? ((Vector3)(ref val5)).normalized : ((Component)p).transform.forward); Vector3 val6 = val5; float num; if (!((Object)(object)val2 != (Object)null)) { num = 0f; } else { bounds = ((Renderer)val2).bounds; Vector3 extents = ((Bounds)(ref bounds)).extents; num = ((Vector3)(ref extents)).magnitude * 0.7f; } Vector3 muzzle = val4 + val6 * (num + 0.3f); Mk1Canon.Disparar(p, muzzle, val5); } } private void Camara(bool puesta) { //IL_0034: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) GameCamera instance = GameCamera.instance; if (!((Object)(object)instance == (Object)null)) { Traverse val = Traverse.Create((object)instance); if (puesta && !_camara) { _off3 = val.Field("m_3rdOffset").GetValue<Vector3>(); _offCombate = val.Field("m_3rdCombatOffset").GetValue<Vector3>(); _minD = val.Field("m_minDistance").GetValue<float>(); _maxD = val.Field("m_maxDistance").GetValue<float>(); float num = (CamaraAplicada = MTMagiaPlugin.Mk1Camara.Value); val.Field("m_3rdOffset").SetValue((object)new Vector3(_off3.x * num, _off3.y * num, _off3.z)); val.Field("m_3rdCombatOffset").SetValue((object)new Vector3(_offCombate.x * num, _offCombate.y * num, _offCombate.z)); val.Field("m_minDistance").SetValue((object)(_minD * num)); val.Field("m_maxDistance").SetValue((object)(_maxD * num)); float value = val.Field("m_distance").GetValue<float>(); val.Field("m_distance").SetValue((object)Mathf.Max(value * num, _minD * num)); _camara = true; } else if (!puesta && _camara) { val.Field("m_3rdOffset").SetValue((object)_off3); val.Field("m_3rdCombatOffset").SetValue((object)_offCombate); val.Field("m_minDistance").SetValue((object)_minD); val.Field("m_maxDistance").SetValue((object)_maxD); float value2 = val.Field("m_distance").GetValue<float>(); val.Field("m_distance").SetValue((object)Mathf.Clamp(value2 / CamaraAplicada, _minD, _maxD)); _camara = false; } } } private void LateUpdate() { //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if (CamaraReaplicar) { CamaraReaplicar = false; Camara(puesta: false); } Camara((Object)(object)localPlayer != (Object)null && !((Character)localPlayer).IsDead() && _armadura.Built); if ((Object)(object)localPlayer != (Object)null && ArmaduraMk1.Powered && ((Character)localPlayer).m_swimSpeed != _nadoPuesto) { ((Character)localPlayer).m_swimSpeed = ((Character)localPlayer).m_swimSpeed * MTMagiaPlugin.Mk1Nado.Value; _nadoPuesto = ((Character)localPlayer).m_swimSpeed; } if (!_apuntando) { return; } Player localPlayer2 = Player.m_localPlayer; Animator val = (((Object)(object)localPlayer2 != (Object)null) ? ((Component)localPlayer2).GetComponentInChildren<Animator>() : null); if ((Object)(object)val == (Object)null) { return; } Vector3 val2 = Fx.AimPoint(localPlayer2, 60f); HumanBodyBones[][] array = new HumanBodyBones[2][] { (HumanBodyBones[])(object)new HumanBodyBones[2] { (HumanBodyBones)14, (HumanBodyBones)16 }, (HumanBodyBones[])(object)new HumanBodyBones[2] { (HumanBodyBones)16, (HumanBodyBones)18 } }; foreach (HumanBodyBones[] array2 in array) { Transform boneTransform = val.GetBoneTransform(array2[0]); Transform boneTransform2 = val.GetBoneTransform(array2[1]); if (!((Object)(object)boneTransform == (Object)null) && !((Object)(object)boneTransform2 == (Object)null)) { Vector3 val3 = boneTransform2.position - boneTransform.position; Vector3 val4 = val2 - boneTransform.position; if (!(((Vector3)(ref val3)).sqrMagnitude < 1E-06f) && !(((Vector3)(ref val4)).sqrMagnitude < 1E-06f)) { boneTransform.rotation = Quaternion.FromToRotation(val3, val4) * boneTransform.rotation; } } } } private void Update() { Player localPlayer = Player.m_localPlayer; if (Rebuild) { Rebuild = false; _for = null; } if ((Object)(object)localPlayer != (Object)(object)_for) { Clear(_armadura, restore: true); Clear(_escudo, restore: false); Clear(_canon, restore: false); Clear(_casco, restore: false); Clear(_grebas, restore: false); RestoreAnimator(); _for = localPlayer; } bool flag = (Object)(object)localPlayer != (Object)null && !((Character)localPlayer).IsDead(); bool flag2 = flag && ArmaduraMk1.Worn(localPlayer); if (flag2 && Escuelas.Rank(localPlayer, Escuela.Tierra) < 3) { ((Humanoid)localPlayer).UnequipItem(ArmaduraMk1.Slot(localPlayer, "m_chestItem"), true); ((Character)localPlayer).Message((MessageType)2, Tr.Get("magia_need_earth_saint_rank_move"), 0, (Sprite)null, false); flag2 = false; } Keep(localPlayer, _armadura, flag2, ArmaduraMk1.Piezas); if (ArmaduraMk1.Worn(localPlayer) != _canonConArmadura) { _canonConArmadura = ArmaduraMk1.Worn(localPlayer); CanonReaplicar = true; } if (CanonReaplicar) { CanonReaplicar = false; Clear(_canon, restore: false); } Keep(localPlayer, _canon, flag && ArmaduraMk1.HoldsCanon(localPlayer), ArmaduraMk1.PiezaCanon); Keep(localPlayer, _casco, flag2, null); Keep(localPlayer, _grebas, flag2, null); HideForParts(localPlayer); EscudoVisible(localPlayer); CanonPiece = (_canon.Built ? _canon.Pieces[0].transform : null); Canon(localPlayer); if (!_armadura.Built && !_escudo.Built && !_canon.Built && !_casco.Built && !_grebas.Built) { RestoreAnimator(); } if (flag) { Pisadas(localPlayer, flag2); } if (!flag2 || !_armadura.Built) { ArmaduraMk1.Powered = false; return; } float num = MTMagiaPlugin.Mk1ManaSegundo.Value * Time.deltaTime; _ = ArmaduraMk1.Powered; ArmaduraMk1.Powered = localPlayer.GetEitr() > num + 0.5f; ItemData val = ArmaduraMk1.Slot(localPlayer, "m_chestItem"); if (ArmaduraMk1.Powered && val != null) { val.m_durability = Mathf.Max(0f, val.m_durability - MTMagiaPlugin.Mk1DesgasteSegundo.Value * Time.deltaTime); if (val.m_durability <= 0f) { ArmaduraMk1.Powered = false; Clear(_armadura, restore: true); Clear(_casco, restore: false); Clear(_grebas, restore: false); HideForParts(localPlayer); RestoreAnimator(); ((Humanoid)localPlayer).UnequipItem(val, true); ((Character)localPlayer).Message((MessageType)2, Tr.Get("magia_mk_i_broken_repair_forge"), 0, (Sprite)null, false); return; } } if (ArmaduraMk1.Powered) { ((Character)localPlayer).UseEitr(num); if (((Character)localPlayer).GetHealth() < ((Character)localPlayer).GetMaxHealth()) { ((Character)localPlayer).Heal(MTMagiaPlugin.Mk1RegenVida.Value * Time.deltaTime, false); } _hideCheck -= Time.deltaTime; if (!(_hideCheck <= 0f) || (!_grebas.Built && Mk1Skin.PartAvailable("piernas"))) { return; } _hideCheck = 0.5f; SkinnedMeshRenderer[] componentsInChildren = ((Component)localPlayer).GetComponentsInChildren<SkinnedMeshRenderer>(); foreach (SkinnedMeshRenderer val2 in componentsInChildren) { if (((Renderer)val2).enabled && !((Object)val2).name.StartsWith("MT_Mk1_")) { ((Renderer)val2).enabled = false; _hidden.Add((Renderer)(object)val2); } } } else { ArmaduraMk1.Powered = false; Clear(_armadura, restore: true); Clear(_casco, restore: false); Clear(_grebas, restore: false); HideForParts(localPlayer); RestoreAnimator(); ((Humanoid)localPlayer).UnequipItem(ArmaduraMk1.Slot(localPlayer, "m_chestItem"), true); ((Character)localPlayer).Message((MessageType)2, Tr.Get("magia_mk_i_runs_out_mana"), 0, (Sprite)null, false); } } private void Pisadas(Player p, bool worn) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: 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_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: 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) //IL_00e5: 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_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)p).transform.position; if (!((Character)p).IsOnGround()) { if (_airTime <= 0f) { _peakY = position.y; } _peakY = Mathf.Max(_peakY, position.y); _airTime += Time.deltaTime; _lastPos = position; return; } if (_airTime > 0f) { float num = _peakY - position.y; float value = MTMagiaPlugin.Mk1CaidaMinima.Value; if (num >= value) { float num2 = Mathf.Clamp01((num - value) / (value * 2f)); if (MTMagiaPlugin.Mk1TemblorCaida.Value > 0f) { GameCamera instance = GameCamera.instance; if (instance != null) { instance.AddShake(position, 12f, MTMagiaPlugin.Mk1TemblorCaida.Value * (1f + num2 * 2f), false); } } Tierra(position, 0.25f + num2 * 0.35f); if (worn) { SonidoPesado(position, fuerte: true); } if (worn && ArmaduraMk1.Powered) { Aterrizaje(p, position, 0.5f + num2 * 2.5f); } } else if (worn && num > 0.3f) { if (MTMagiaPlugin.Mk1TemblorPaso.Value > 0f) { GameCamera instance2 = GameCamera.instance; if (instance2 != null) { instance2.AddShake(position, 12f, MTMagiaPlugin.Mk1TemblorPaso.Value * 0.8f, false); } } SonidoPesado(position, fuerte: false); } } _airTime = 0f; if (!worn || !MTMagiaPlugin.Mk1Temblor.Value) { _lastPos = position; return; } Vector3 val = position - _lastPos; val.y = 0f; _lastPos = position; if (!(((Vector3)(ref val)).magnitude > 2f)) { _stepDist += ((Vector3)(ref val)).magnitude; float num3 = (((Character)p).IsRunning() ? 2.1f : 1.4f); if (_stepDist >= num3) { _stepDist = 0f; Paso(p, position, ((Character)p).IsRunning() ? 1f : 0.6f); } } } private static void Aterrizaje(Player p, Vector3 pos, float aire) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_003a: 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_003d: 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) float num = Mathf.Clamp(aire, 0.5f, 3f); float radius = 1.5f + num * 0.75f; DamageTypes damage = new DamageTypes { m_blunt = MTMagiaPlugin.Mk1DanoCaida.Value * num }; Fx.DamageArea(p, pos, radius, damage, (SkillType)9, 0f, 2f); } private static void Tierra(Vector3 pos, float fuerza) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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_0034: 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_0053: Unknown result type (might be due to invalid IL or missing references) Particulas.Spawn(pos + Vector3.up * 0.1f, new Particulas.Config { ColorA = new Color(0.55f, 0.47f, 0.36f, 0.7f), ColorB = new Color(0.45f, 0.4f, 0.32f, 0.5f), LifeMin = 0.6f, LifeMax = 1.2f, SpeedMin = 0.5f, SpeedMax = 2f * fuerza, SizeMin = 0.3f, SizeMax = 0.8f * fuerza, Radius = 0.5f, Hemisphere = true, Additive = false, Burst = (int)(18f * fuerza), Grow = 1.8f }); } private static void SonidoPesado(Vector3 pos, bool fuerte) { //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) List<string> nombres; if (!_sfxBuscado && (Object)(object)ZNetScene.instance != (Object)null) { _sfxBuscado = true; nombres = new List<string>(); foreach (GameObject prefab in ZNetScene.instance.m_prefabs) { if ((Object)(object)prefab != (Object)null && ((Object)prefab).name.StartsWith("sfx_")) { nombres.Add(((Object)prefab).name); } } string text = Buscar(new string[6][] { new string[1] { "footstep" }, new string[2] { "foot", "grass" }, new string[2] { "foot", "dirt" }, new string[2] { "troll", "foot" }, new string[2] { "troll", "step" }, new string[2] { "golem", "step" } }); _sfxPaso = ((text != null) ? ZNetScene.instance.GetPrefab(text) : null); MTMagiaPlugin.Log.LogInfo((object)("Mk-I: sonido de pisada reutilizado «" + (text ?? "ninguno") + "»")); } if (fuerte && (Object)(object)_sfxPaso != (Object)null) { Object.Instantiate<GameObject>(_sfxPaso, pos, Quaternion.identity); } string Buscar(params string[][] reglas) { foreach (string[] array in reglas) { foreach (string item in nombres) { string text2 = item.ToLowerInvariant(); bool flag = true; string[] array2 = array; foreach (string value in array2) { if (!text2.Contains(value)) { flag = false; break; } } if (flag) { return item; } } } return null; } } private void EscudoVisible(Player p) { //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)p == (Object)null || !ArmaduraMk1.Is(ArmaduraMk1.Slot(p, "m_leftItem"), "MT_EscudoMk1")) { _escudoRevisado = null; return; } VisEquipment component = ((Component)p).GetComponent<VisEquipment>(); GameObject val = (((Object)(object)component != (Object)null) ? Traverse.Create((object)component).Field("m_leftItemInstance").GetValue<GameObject>() : null); bool flag = ArmaduraMk1.Worn(p); if ((Object)(object)val == (Object)null || ((Object)(object)val == (Object)(object)_escudoRevisado && flag == _escudoConArmadura)) { return; } if ((Object)(object)val == (Object)(object)_escudoRevisado) { _escudoConArmadura = flag; ArmaduraMk1.ReaplicarEscudo(p); return; } _escudoRevisado = val; _escudoConArmadura = flag; if (flag) { ArmaduraMk1.ReaplicarEscudo(p); } MeshRenderer val2 = null; MeshRenderer[] componentsInChildren = val.GetComponentsInChildren<MeshRenderer>(true); foreach (MeshRenderer val3 in componentsInChildren) { if (((Object)val3).name == "MT_Mk1_escudo_mano") { val2 = val3; } } if ((Object)(object)val2 == (Object)null) { bool flag2
plugins/MT.Ojos/MT.Ojos.dll
Decompiled 11 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.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Managers; using Jotunn.Utils; using MT.Core.I18n; using MT.Core.Vfx; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.Rendering; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")] [assembly: AssemblyCompany("MT.Ojos")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+a3d1e112c18dad5152e45a99f4e3179a3ca51bec")] [assembly: AssemblyProduct("MT.Ojos")] [assembly: AssemblyTitle("MT.Ojos")] [assembly: AssemblyVersion("1.0.0.0")] [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 MT.Ojos { public class BrilloOjo : MonoBehaviour { private static BrilloOjo _inst; private Player _jugador; private Transform _cabeza; private readonly ParticleSystem[] _llamas = (ParticleSystem[])(object)new ParticleSystem[2]; private readonly string[] _tipos = new string[2]; private readonly Color[] _colores = (Color[])(object)new Color[2]; private float _tamano; public static Color ColorDe(string ojo) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) if (!(ojo == "MT_OjoPrevision")) { if (ojo == "MT_OjoVistaLejana") { return MTOjosPlugin.ColorVistaLejana.Value; } return MTOjosPlugin.ColorIdentificacion.Value; } return MTOjosPlugin.ColorPrevision.Value; } public static void Recalibrar() { if ((Object)(object)_inst != (Object)null) { _inst.Limpiar(); } } private void Awake() { _inst = this; } private void LateUpdate() { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer != (Object)(object)_jugador) { Limpiar(); _jugador = localPlayer; } if ((Object)(object)localPlayer == (Object)null || ((Character)localPlayer).IsDead() || !MTOjosPlugin.BrilloOjos.Value || !Cabeza(localPlayer)) { Mostrar(0, null); Mostrar(1, null); return; } if ((Object)(object)_llamas[0] != (Object)null && !Mathf.Approximately(_tamano, MTOjosPlugin.DiametroOjo.Value)) { Limpiar(); if (!Cabeza(localPlayer)) { return; } } List<string> puestos = Ojos.Puestos; Mostrar(0, (puestos.Count > 0) ? puestos[0] : null); Mostrar(1, (puestos.Count > 1) ? puestos[1] : null); } private void Mostrar(int i, string tipo) { //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_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_0023: 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_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: 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) //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_010b: Unknown result type (might be due to invalid IL or missing references) ParticleSystem val = _llamas[i]; if (tipo == null) { if ((Object)(object)val != (Object)null) { EmissionModule emission = val.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(0f); } _tipos[i] = null; return; } if ((Object)(object)val == (Object)null) { float num = MTOjosPlugin.DiametroOjo.Value / 0.04f; val = (_llamas[i] = ToukiManos.Flame(_cabeza, 0.07f, 0.06f * num, 0.14f * num)); ((Object)((Component)val).gameObject).name = "MT_OjoTouki_" + i; _tamano = MTOjosPlugin.DiametroOjo.Value; _tipos[i] = null; } Color val2 = ColorDe(tipo); if (_tipos[i] != tipo || _colores[i] != val2) { Teñir(val, val2); _tipos[i] = tipo; _colores[i] = val2; } EmissionModule emission2 = val.emission; ((EmissionModule)(ref emission2)).rateOverTime = MinMaxCurve.op_Implicit(22f); } private static void Teñir(ParticleSystem ps, Color col) { //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_0009: 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) //IL_0015: 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_0025: 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_0030: 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_004e: 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_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown //IL_0073: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0094: 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_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: 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_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: 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_00fe: Unknown result type (might be due to invalid IL or missing references) MainModule main = ps.main; ((MainModule)(ref main)).startColor = new MinMaxGradient(new Color(col.r, col.g, col.b, 0.9f), Color.Lerp(col, Color.white, 0.4f) * new Color(1f, 1f, 1f, 0.8f)); ColorOverLifetimeModule colorOverLifetime = ps.colorOverLifetime; Gradient val = new Gradient(); val.SetKeys((GradientColorKey[])(object)new GradientColorKey[2] { new GradientColorKey(Color.Lerp(col, Color.white, 0.4f), 0f), new GradientColorKey(col * 0.6f, 1f) }, (GradientAlphaKey[])(object)new GradientAlphaKey[3] { new GradientAlphaKey(0f, 0f), new GradientAlphaKey(0.9f, 0.15f), new GradientAlphaKey(0f, 1f) }); ((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(val); } private bool Cabeza(Player p) { if (Object.op_Implicit((Object)(object)_cabeza)) { return true; } SkinnedMeshRenderer val = ((Component)p).GetComponent<VisEquipment>()?.m_bodyModel; if ((Object)(object)val == (Object)null || val.bones == null) { return false; } Transform[] bones = val.bones; foreach (Transform val2 in bones) { if ((Object)(object)val2 != (Object)null && (((Object)val2).name == "Head" || ((Object)val2).name.EndsWith(":Head") || ((Object)val2).name.EndsWith("_Head"))) { _cabeza = val2; return true; } } return false; } public static string Diagnostico() { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if ((Object)(object)_inst == (Object)null || (Object)(object)localPlayer == (Object)null || (Object)(object)_inst._cabeza == (Object)null) { return "no head bone yet (equip an eye)"; } return $"on head bone '{((Object)_inst._cabeza).name}' at {_inst._cabeza.position.y - ((Component)localPlayer).transform.position.y:0.00} m above the feet"; } private void Limpiar() { _cabeza = null; for (int i = 0; i < 2; i++) { if ((Object)(object)_llamas[i] != (Object)null) { Object.Destroy((Object)(object)((Component)_llamas[i]).gameObject); } _llamas[i] = null; _tipos[i] = null; } } private void OnDisable() { Limpiar(); } private void OnDestroy() { Limpiar(); } } public static class Circulo { private static GameObject _ext; private static GameObject _int; private static Material _mExt; private static Material _mInt; public static void Actualizar(Component objetivo, float alfa) { //IL_0055: 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_005e: 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_006e: 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_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: 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_00e0: 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_00ef: 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_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_015c: 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) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)objetivo == (Object)null || alfa <= 0f) { if (Object.op_Implicit((Object)(object)_ext)) { _ext.SetActive(false); } } else if (Object.op_Implicit((Object)(object)_ext) || Crear()) { Collider component = objetivo.GetComponent<Collider>(); float num; Bounds bounds; if (!((Object)(object)component != (Object)null)) { num = 0.5f; } else { bounds = component.bounds; float x = ((Bounds)(ref bounds)).extents.x; bounds = component.bounds; num = Mathf.Max(x, ((Bounds)(ref bounds)).extents.z); } float num2 = Mathf.Clamp(num * 2.6f, 1f, 8f) * (0.85f + 0.15f * alfa); Vector3 position = objetivo.transform.position; if ((Object)(object)component != (Object)null) { bounds = component.bounds; position.y = ((Bounds)(ref bounds)).min.y; } _ext.transform.position = position + Vector3.up * 0.06f; _ext.transform.localScale = Vector3.one * num2; _ext.transform.rotation = Quaternion.Euler(90f, Time.time * 25f, 0f); _int.transform.localRotation = Quaternion.Euler(0f, 0f, (0f - Time.time) * 70f); float num3 = 0.75f + 0.25f * Mathf.Sin(Time.time * 3f); Pintar(_mExt, new Color(0.65f, 0.35f, 1f, 0.8f * alfa * num3)); Pintar(_mInt, new Color(0.85f, 0.6f, 1f, 0.7f * alfa)); if (!_ext.activeSelf) { _ext.SetActive(true); } } } private static void Pintar(Material m, Color c) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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) m.color = c; if (m.HasProperty("_TintColor")) { m.SetColor("_TintColor", c * 0.5f); } } private static bool Crear() { //IL_0088: 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_00b5: Unknown result type (might be due to invalid IL or missing references) Shader val = Shader.Find("Legacy Shaders/Particles/Additive") ?? Shader.Find("Sprites/Default"); if ((Object)(object)val == (Object)null) { return false; } _ext = Quad("MT_CirculoIdent", val, Textura(exterior: true), out _mExt); Object.DontDestroyOnLoad((Object)(object)_ext); _int = Quad("Interior", val, Textura(exterior: false), out _mInt); _int.transform.SetParent(_ext.transform, false); _int.transform.localScale = Vector3.one * 0.62f; _int.transform.localPosition = new Vector3(0f, 0f, -0.001f); return true; } private static GameObject Quad(string nombre, Shader shader, Texture2D tex, out Material mat) { //IL_0020: 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_002d: Expected O, but got Unknown GameObject obj = GameObject.CreatePrimitive((PrimitiveType)5); Object.Destroy((Object)(object)obj.GetComponent<Collider>()); ((Object)obj).name = nombre; Renderer component = obj.GetComponent<Renderer>(); mat = new Material(shader) { mainTexture = (Texture)(object)tex }; component.sharedMaterial = mat; component.shadowCastingMode = (ShadowCastingMode)0; component.receiveShadows = false; return obj; } private static Texture2D Textura(bool exterior) { //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_0019: Expected O, but got Unknown //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(256, 256, (TextureFormat)4, true) { wrapMode = (TextureWrapMode)1 }; Color[] array = (Color[])(object)new Color[65536]; for (int i = 0; i < 256; i++) { for (int j = 0; j < 256; j++) { float num = ((float)j + 0.5f) / 256f * 2f - 1f; float num2 = ((float)i + 0.5f) / 256f * 2f - 1f; float num3 = Mathf.Sqrt(num * num + num2 * num2); float num4 = Mathf.Atan2(num2, num); float num5; if (exterior) { num5 = Mathf.Max(Anillo(num3, 0.96f, 0.015f), Anillo(num3, 0.84f, 0.01f)); float num6 = Mathf.Abs(Mathf.Repeat(num4 / ((float)Math.PI * 2f) * 12f, 1f) - 0.5f); if (num3 > 0.86f && num3 < 0.94f && num6 < 0.06f) { num5 = 1f; } if (num3 > 0.87f && num3 < 0.93f && num6 > 0.2f && num6 < 0.24f) { num5 = Mathf.Max(num5, 0.6f); } } else { num5 = Anillo(num3, 0.95f, 0.02f); for (int k = 0; k < 2; k++) { for (int l = 0; l < 3; l++) { float num7 = (float)k * (float)Math.PI / 3f + (float)l * (float)Math.PI * 2f / 3f + (float)Math.PI / 2f; float num8 = num7 + (float)Math.PI * 2f / 3f; Vector2 a = new Vector2(Mathf.Cos(num7), Mathf.Sin(num7)) * 0.95f; Vector2 b = new Vector2(Mathf.Cos(num8), Mathf.Sin(num8)) * 0.95f; num5 = Mathf.Max(num5, Segmento(new Vector2(num, num2), a, b, 0.015f)); } } } array[i * 256 + j] = new Color(1f, 1f, 1f, num5); } } val.SetPixels(array); val.Apply(true); return val; } private static float Anillo(float r, float centro, float grosor) { return Mathf.Clamp01(1f - Mathf.Abs(r - centro) / grosor); } private static float Segmento(Vector2 p, Vector2 a, Vector2 b, float grosor) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: 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_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: 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_0029: 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_002c: 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) Vector2 val = b - a; float num = Mathf.Clamp01(Vector2.Dot(p - a, val) / ((Vector2)(ref val)).sqrMagnitude); return Mathf.Clamp01(1f - Vector2.Distance(p, a + val * num) / grosor); } } public static class Desgaste { private static readonly Dictionary<string, string> NombreDe = new Dictionary<string, string>(); private static float _avisoHasta; private static List<ItemData> _equipados; private static int _fotograma = -1; private static Player _de; public static void Init() { ItemManager.OnItemsRegistered += Configurar; } private static void Configurar() { string[] array = new string[3] { "MT_OjoIdentificacion", "MT_OjoVistaLejana", "MT_OjoPrevision" }; foreach (string text in array) { ObjectDB instance = ObjectDB.instance; object obj; if (instance == null) { obj = null; } else { GameObject itemPrefab = instance.GetItemPrefab(text); obj = ((itemPrefab != null) ? itemPrefab.GetComponent<ItemDrop>() : null); } ItemDrop val = (ItemDrop)obj; if (!((Object)(object)val == (Object)null)) { SharedData shared = val.m_itemData.m_shared; shared.m_useDurability = true; shared.m_maxDurability = MTOjosPlugin.DurabilidadMax.Value; shared.m_canBeReparied = true; shared.m_destroyBroken = false; shared.m_durabilityDrain = 0f; shared.m_durabilityPerLevel = MTOjosPlugin.DurabilidadMax.Value * 0.5f; val.m_itemData.m_durability = shared.m_maxDurability; NombreDe[text] = shared.m_name; } } } public static ItemData Item(string ojo) { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null || !NombreDe.TryGetValue(ojo, out var value)) { return null; } if (_fotograma != Time.frameCount || (Object)(object)_de != (Object)(object)localPlayer) { _equipados = ((Humanoid)localPlayer).GetInventory().GetEquippedItems(); _fotograma = Time.frameCount; _de = localPlayer; } foreach (ItemData equipado in _equipados) { if (equipado.m_shared.m_name == value) { return equipado; } } return null; } public static bool Funciona(string ojo) { if (!Ojos.Equipado(ojo)) { return false; } ItemData val = Item(ojo); if (val == null) { return false; } if (!val.m_shared.m_useDurability || val.m_durability > 0f) { return true; } Avisar(ojo); return false; } public static void Gastar(string ojo, float cantidad) { ItemData val = Item(ojo); if (val != null && val.m_shared.m_useDurability && !(cantidad <= 0f)) { bool num = val.m_durability > 0f; val.m_durability = Mathf.Max(0f, val.m_durability - cantidad); if (num && val.m_durability <= 0f) { Avisar(ojo); } } } private static void Avisar(string ojo) { if (!(Time.time < _avisoHasta)) { _avisoHasta = Time.time + 10f; ObjectDB instance = ObjectDB.instance; object obj; if (instance == null) { obj = null; } else { GameObject itemPrefab = instance.GetItemPrefab(ojo); obj = ((itemPrefab == null) ? null : itemPrefab.GetComponent<ItemDrop>()?.m_itemData.m_shared.m_name); } if (obj == null) { obj = ojo; } string text = Tr.Localize((string)obj); Player localPlayer = Player.m_localPlayer; if (localPlayer != null) { ((Character)localPlayer).Message((MessageType)2, Tr.Get("ojos_worn_out_repair_its_station", new object[1] { text }), 0, (Sprite)null, false); } } } } public class DesgasteEquipado : MonoBehaviour { private void Update() { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null || ((Character)localPlayer).IsDead() || !MTOjosPlugin.PuedeUsarTeclas()) { return; } float num = MTOjosPlugin.DesgasteEquipadoPorSegundo.Value * Time.deltaTime; if (num <= 0f) { return; } foreach (string puesto in Ojos.Puestos) { Desgaste.Gastar(puesto, num); } } } public class Fantasma : MonoBehaviour { private const float FadeIn = 0.1f; private const float FadeOut = 0.2f; private const float MaxVida = 2.5f; private const float MinVida = 0.3f; private static readonly Dictionary<string, Stack<Fantasma>> Pool = new Dictionary<string, Stack<Fantasma>>(); private static readonly List<Fantasma> Activos = new List<Fantasma>(); private static readonly HashSet<string> NoCopiable = new HashSet<string>(); private static GameObject _almacen; private static readonly Type[] Conservar = new Type[6] { typeof(Transform), typeof(Animator), typeof(SkinnedMeshRenderer), typeof(MeshRenderer), typeof(MeshFilter), typeof(LODGroup) }; private string _key; private Character _objetivo; private Transform _visualObjetivo; private Transform _copia; private Animator _anim; private Material _mat; private float _edad; private float _alfaFin = -1f; private float _distancia; public static bool Mostrar(Character c, string trigger, float distancia) { string prefabName = Utils.GetPrefabName(((Component)c).gameObject); if (NoCopiable.Contains(prefabName)) { return false; } foreach (Fantasma activo in Activos) { if ((Object)(object)activo._objetivo == (Object)(object)c) { activo.Iniciar(c, trigger, distancia); return true; } } if (Activos.Count >= MTOjosPlugin.PrevMaxSiluetas.Value) { Fantasma fantasma = null; foreach (Fantasma activo2 in Activos) { if ((Object)(object)fantasma == (Object)null || activo2._distancia > fantasma._distancia) { fantasma = activo2; } } if ((Object)(object)fantasma == (Object)null || fantasma._distancia <= distancia) { return false; } fantasma.Devolver(); } Fantasma fantasma2 = Sacar(prefabName, c); if ((Object)(object)fantasma2 == (Object)null) { NoCopiable.Add(prefabName); MTOjosPlugin.Log.LogInfo((object)("Previsión: '" + prefabName + "' no se puede copiar; se usa la marca de suelo.")); return false; } fantasma2.Iniciar(c, trigger, distancia); return true; } public static void TerminarTodos() { for (int num = Activos.Count - 1; num >= 0; num--) { Activos[num].Devolver(); } } public static void VaciarPool() { TerminarTodos(); foreach (Stack<Fantasma> value in Pool.Values) { foreach (Fantasma item in value) { if (Object.op_Implicit((Object)(object)item)) { Object.Destroy((Object)(object)((Component)item).gameObject); } } } Pool.Clear(); if (Object.op_Implicit((Object)(object)_almacen)) { Object.Destroy((Object)(object)_almacen); } _almacen = null; } private static Fantasma Sacar(string key, Character c) { if (Pool.TryGetValue(key, out var value)) { while (value.Count > 0) { Fantasma fantasma = value.Pop(); if (Object.op_Implicit((Object)(object)fantasma)) { return fantasma; } } } try { return Construir(key, c); } catch (Exception ex) { MTOjosPlugin.Log.LogWarning((object)("Previsión: error copiando '" + key + "': " + ex.Message)); return null; } } private static Fantasma Construir(string key, Character c) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Expected O, but got Unknown Animator componentInChildren = ((Component)c).GetComponentInChildren<Animator>(); if ((Object)(object)componentInChildren == (Object)null || (Object)(object)componentInChildren.runtimeAnimatorController == (Object)null) { return null; } if (!Object.op_Implicit((Object)(object)_almacen)) { _almacen = new GameObject("MT_Ojos_Almacen"); _almacen.SetActive(false); } GameObject val = Object.Instantiate<GameObject>(((Component)componentInChildren).gameObject, _almacen.transform); ((Object)val).name = "copia"; for (int i = 0; i < 3; i++) { Component[] componentsInChildren = val.GetComponentsInChildren<Component>(true); foreach (Component val2 in componentsInChildren) { if ((Object)(object)val2 == (Object)null || EsConservado(val2)) { continue; } if (val2 is ParticleSystem || val2 is ParticleSystemRenderer) { if ((Object)(object)val2.gameObject != (Object)(object)val) { Object.DestroyImmediate((Object)(object)val2.gameObject); } } else { try { Object.DestroyImmediate((Object)(object)val2); } catch { } } } } Material val3 = Transparente.Nuevo(Color.clear); if ((Object)(object)val3 == (Object)null) { Object.Destroy((Object)(object)val); return null; } int num = 0; Renderer[] componentsInChildren2 = val.GetComponentsInChildren<Renderer>(true); foreach (Renderer val4 in componentsInChildren2) { if (!(val4 is ParticleSystemRenderer)) { val4.shadowCastingMode = (ShadowCastingMode)0; val4.receiveShadows = false; Material[] array = (Material[])(object)new Material[val4.sharedMaterials.Length]; for (int k = 0; k < array.Length; k++) { array[k] = val3; } val4.sharedMaterials = array; SkinnedMeshRenderer val5 = (SkinnedMeshRenderer)(object)((val4 is SkinnedMeshRenderer) ? val4 : null); if (val5 != null) { val5.updateWhenOffscreen = true; } num++; } } if (num == 0) { Object.Destroy((Object)(object)val); Object.Destroy((Object)(object)val3); return null; } Animator component = val.GetComponent<Animator>(); component.applyRootMotion = false; component.fireEvents = false; component.cullingMode = (AnimatorCullingMode)0; GameObject val6 = new GameObject("MT_Fantasma_" + key); val6.SetActive(false); Fantasma fantasma = val6.AddComponent<Fantasma>(); fantasma._key = key; fantasma._mat = val3; fantasma._anim = component; fantasma._copia = val.transform; val.transform.SetParent(val6.transform, false); return fantasma; } private static bool EsConservado(Component comp) { Type type = ((object)comp).GetType(); Type[] conservar = Conservar; for (int i = 0; i < conservar.Length; i++) { if (conservar[i].IsAssignableFrom(type)) { return true; } } return false; } private void Iniciar(Character c, string trigger, float distancia) { _objetivo = c; _visualObjetivo = ((Component)((Component)c).GetComponentInChildren<Animator>()).transform; _distancia = distancia; _edad = 0f; _alfaFin = -1f; if (!Activos.Contains(this)) { Activos.Add(this); } Seguir(); ((Component)this).gameObject.SetActive(true); _anim.Rebind(); _anim.speed = MTOjosPlugin.PrevVelocidad.Value; _anim.Update(0f); _anim.SetTrigger(trigger); _anim.Update(MTOjosPlugin.PrevAdelanto.Value); PonerAlfa(0f); } private void LateUpdate() { if ((Object)(object)_objetivo == (Object)null || (Object)(object)_visualObjetivo == (Object)null || _objetivo.IsDead() || !((Component)_objetivo).gameObject.activeInHierarchy) { Devolver(); return; } _edad += Time.deltaTime; Seguir(); if (_alfaFin < 0f && ((_edad > 0.3f && !_objetivo.InAttack()) || _edad > 2.5f)) { _alfaFin = _edad; } float num; if (_alfaFin >= 0f) { num = 1f - (_edad - _alfaFin) / 0.2f; if (num <= 0f) { Devolver(); return; } } else { num = Mathf.Clamp01(_edad / 0.1f); } PonerAlfa(num); } private void Seguir() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0017: 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_0037: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) ((Component)this).transform.SetPositionAndRotation(_visualObjetivo.position, _visualObjetivo.rotation); _copia.localPosition = Vector3.zero; _copia.localRotation = Quaternion.identity; _copia.localScale = _visualObjetivo.lossyScale; } private void PonerAlfa(float a) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) Color value = MTOjosPlugin.PrevColor.Value; value.a = a * MTOjosPlugin.PrevOpacidad.Value; _mat.color = value; if (_mat.HasProperty("_TintColor")) { _mat.SetColor("_TintColor", value); } } private void Devolver() { Activos.Remove(this); _objetivo = null; _visualObjetivo = null; if (Object.op_Implicit((Object)(object)this)) { ((Component)this).gameObject.SetActive(false); if (!Pool.TryGetValue(_key, out var value)) { value = (Pool[_key] = new Stack<Fantasma>()); } if (!value.Contains(this)) { value.Push(this); } } } private void OnDestroy() { Activos.Remove(this); if (Object.op_Implicit((Object)(object)_mat)) { Object.Destroy((Object)(object)_mat); } } } public class Marca : MonoBehaviour { private const float Vida = 1.2f; private Material _mat; private float _edad; public static void Mostrar(Character c, Attack atk, bool area) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: 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_0022: 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_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_0070: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: 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_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_0106: 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) Transform transform = ((Component)c).transform; float num = Mathf.Max(atk.m_attackRange, 1f); Vector3 val; float num2; if (area) { val = transform.position + transform.forward * num; num2 = Mathf.Max(atk.m_attackRayWidth, 1.5f); } else { val = transform.position + transform.forward * num * 0.6f; num2 = num * 0.6f; } Material val2 = Transparente.Nuevo(Color.clear); if (!((Object)(object)val2 == (Object)null)) { GameObject obj = GameObject.CreatePrimitive((PrimitiveType)2); Object.DestroyImmediate((Object)(object)obj.GetComponent<Collider>()); ((Object)obj).name = "MT_Marca"; float y = default(float); if ((Object)(object)ZoneSystem.instance != (Object)null && ZoneSystem.instance.GetSolidHeight(val, ref y, 1000)) { val.y = y; } obj.transform.position = val + Vector3.up * 0.05f; obj.transform.localScale = new Vector3(num2 * 2f, 0.01f, num2 * 2f); Renderer component = obj.GetComponent<Renderer>(); component.sharedMaterial = val2; component.shadowCastingMode = (ShadowCastingMode)0; component.receiveShadows = false; obj.AddComponent<Marca>()._mat = val2; } } private void Update() { //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) //IL_0080: 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) _edad += Time.deltaTime; float num = ((_edad < 0.1f) ? (_edad / 0.1f) : (1f - (_edad - 0.1f) / 1.1f)); if (num <= 0f || !Prevision.Activo) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } Color value = MTOjosPlugin.PrevColor.Value; value.a = num * 0.4f; _mat.color = value; if (_mat.HasProperty("_TintColor")) { _mat.SetColor("_TintColor", value); } } private void OnDestroy() { if (Object.op_Implicit((Object)(object)_mat)) { Object.Destroy((Object)(object)_mat); } } } public class Identificacion : MonoBehaviour { private static int _mask; private Component _objetivo; private float _siguienteBusqueda; private GUIStyle _estilo; private GUIStyle _sombra; private const float Retardo = 0.3f; private const float Fundido = 0.2f; private Component _candidato; private float _desde; private float _alfa; private float _siguienteDatos; private string[] _lecturas = new string[0]; private static readonly Regex Etiquetas = new Regex("<.*?>"); private static readonly Color Violeta = new Color(0.72f, 0.45f, 1f); private GUIStyle _halo; private static Font _norse; private static bool _buscada; private static readonly string[] SinNorse = new string[6] { "Russian", "Ukrainian", "Chinese", "Chinese_Trad", "Japanese", "Korean" }; private float _desdeObjetivo; private Component _ultimo; private static Vector3 APantalla(Camera cam, Vector3 mundo) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: 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_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0022: 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) Vector3 val = cam.WorldToViewportPoint(mundo); return new Vector3(val.x * (float)Screen.width, val.y * (float)Screen.height, val.z); } private void Update() { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null || ((Character)localPlayer).IsDead() || !MTOjosPlugin.PuedeUsarTeclas() || !Desgaste.Funciona("MT_OjoIdentificacion")) { _objetivo = (_candidato = null); _alfa = 0f; return; } if (Valido(_objetivo)) { Desgaste.Gastar("MT_OjoIdentificacion", MTOjosPlugin.DesgasteIdentificacion.Value * Time.deltaTime); _alfa = Mathf.MoveTowards(_alfa, 1f, Time.deltaTime / 0.2f); } if (Time.time < _siguienteBusqueda) { return; } _siguienteBusqueda = Time.time + 0.1f; Component val = Apuntada(localPlayer); if ((Object)(object)val != (Object)(object)_candidato) { _candidato = val; _desde = Time.time; } if ((Object)(object)val != (Object)null && Time.time - _desde >= 0.3f) { if ((Object)(object)_objetivo != (Object)(object)val) { _objetivo = val; _alfa = 0f; _siguienteDatos = 0f; } } else if ((Object)(object)val != (Object)(object)_objetivo) { _objetivo = null; } } private static bool Valido(Component c) { if ((Object)(object)c != (Object)null) { Character val = (Character)(object)((c is Character) ? c : null); if (val == null || !val.IsDead()) { Pickable val2 = (Pickable)(object)((c is Pickable) ? c : null); if (val2 != null) { return val2.CanBePicked(); } return true; } } return false; } private static Component Apuntada(Player p) { //IL_0098: 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_00ec: 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) Transform val = (Object.op_Implicit((Object)(object)GameCamera.instance) ? ((Component)GameCamera.instance).transform : null); if ((Object)(object)val == (Object)null) { return null; } if (_mask == 0) { _mask = LayerMask.GetMask(new string[11] { "character", "character_net", "character_ghost", "character_noenv", "hitbox", "Default", "static_solid", "terrain", "piece", "item", "Default_small" }); } RaycastHit[] array = Physics.SphereCastAll(val.position, 0.25f, val.forward, MTOjosPlugin.IdentDistancia.Value * (VistaLejana.Mirando ? 3f : 1f), _mask); Component result = null; float num = float.MaxValue; float num2 = float.MaxValue; RaycastHit[] array2 = array; for (int i = 0; i < array2.Length; i++) { RaycastHit val2 = array2[i]; Component componentInParent = (Component)(object)((Component)((RaycastHit)(ref val2)).collider).GetComponentInParent<Character>(); if ((Object)(object)componentInParent == (Object)(object)p) { continue; } if ((Object)(object)componentInParent == (Object)null) { componentInParent = (Component)(object)((Component)((RaycastHit)(ref val2)).collider).GetComponentInParent<ItemDrop>(); } if ((Object)(object)componentInParent == (Object)null) { componentInParent = (Component)(object)((Component)((RaycastHit)(ref val2)).collider).GetComponentInParent<Pickable>(); } if ((Object)(object)componentInParent == (Object)null) { componentInParent = (Component)(object)((Component)((RaycastHit)(ref val2)).collider).GetComponentInParent<MineRock>(); } if ((Object)(object)componentInParent == (Object)null) { componentInParent = (Component)(object)((Component)((RaycastHit)(ref val2)).collider).GetComponentInParent<MineRock5>(); } if ((Object)(object)componentInParent == (Object)null) { if (!((RaycastHit)(ref val2)).collider.isTrigger) { num2 = Mathf.Min(num2, ((RaycastHit)(ref val2)).distance); } } else if (Valido(componentInParent) && ((RaycastHit)(ref val2)).distance < num) { num = ((RaycastHit)(ref val2)).distance; result = componentInParent; } } if (!(num < num2)) { return null; } return result; } private static Font Norse() { if (Array.IndexOf(SinNorse, Tr.Current) >= 0) { return null; } if (!_buscada) { _buscada = true; Font[] array = Resources.FindObjectsOfTypeAll<Font>(); string[] array2 = new string[3] { "Norsebold", "Norse", "AveriaSerifLibre-Bold" }; foreach (string value in array2) { Font[] array3 = array; foreach (Font val in array3) { if ((Object)(object)_norse == (Object)null && ((Object)val).name.StartsWith(value)) { _norse = val; } } } } return _norse; } private void LateUpdate() { Circulo.Actualizar(Valido(_objetivo) ? _objetivo : null, _alfa); } private void OnGUI() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Invalid comparison between Unknown and I4 //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0069: 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_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Expected O, but got Unknown //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Expected O, but got Unknown //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) if ((int)Event.current.type != 7 || !Valido(_objetivo) || (Object)(object)Player.m_localPlayer == (Object)null || ((Character)Player.m_localPlayer).IsDead() || !MTOjosPlugin.PuedeUsarTeclas() || !Desgaste.Funciona("MT_OjoIdentificacion")) { return; } if (_estilo == null) { _estilo = new GUIStyle(GUI.skin.label) { richText = true, alignment = (TextAnchor)3, wordWrap = false, fontStyle = (FontStyle)1 }; _sombra = new GUIStyle(_estilo); _sombra.normal.textColor = new Color(0.05f, 0f, 0.1f); _halo = new GUIStyle(_estilo); _halo.normal.textColor = Violeta; _estilo.normal.textColor = new Color(0.93f, 0.87f, 1f); } GUIStyle estilo = _estilo; GUIStyle sombra = _sombra; Font val = (_halo.font = Norse()); Font font = (sombra.font = val); estilo.font = font; if ((Object)(object)(Object.op_Implicit((Object)(object)GameCamera.instance) ? (((Component)GameCamera.instance).GetComponent<Camera>() ?? Camera.main) : Camera.main) == (Object)null) { return; } if ((Object)(object)_objetivo != (Object)(object)_ultimo) { _ultimo = _objetivo; _desdeObjetivo = Time.time; } if (Time.time >= _siguienteDatos) { _siguienteDatos = Time.time + 0.25f; _lecturas = Lecturas(_objetivo).ToArray(); } float num = Mathf.Clamp((float)Screen.height / 900f, 0.8f, 1.6f); GUIStyle estilo2 = _estilo; GUIStyle sombra2 = _sombra; int num2 = (_halo.fontSize = Mathf.RoundToInt((((Object)(object)Norse() != (Object)null) ? 19f : 16f) * num / 2f) * 2); int fontSize = (sombra2.fontSize = num2); estilo2.fontSize = fontSize; float num5 = Vector3.Distance(((Component)Player.m_localPlayer).transform.position, _objetivo.transform.position); List<string> list = new List<string> { "<color=#FFE49B>" + Principal(_objetivo) + "</color>", $"<color=#9CE8F1>{num5:0} m</color>" }; list.AddRange(_lecturas); float num6 = 22f * num; float num7 = 40f * num; float num8 = (float)Screen.height * 0.2f; float num9 = Time.time - _desdeObjetivo; for (int i = 0; i < list.Count; i++) { float num10 = Mathf.Clamp01((num9 - (float)i * 0.06f) / 0.2f) * _alfa; if (!(num10 <= 0f)) { float num11 = (1f - num10) * -12f * num; Linea(list[i], num7 + num11, num8 + (float)i * num6, num6, num10, i, num); } } } private void Linea(string texto, float x, float y, float alto, float a, int i, float ui) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01db: 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_014a: Unknown result type (might be due to invalid IL or missing references) Color color = GUI.color; GUI.color = new Color(0.8f, 0.6f, 1f, a * (0.75f + 0.25f * Mathf.Sin(Time.time * 4f + (float)i))); float num = 12f * ui; GUI.DrawTexture(new Rect(x + 5f * ui, y + (alto - num) / 2f, num, num), (Texture)(object)ToukiManos.Dot()); GUI.color = color; Rect val = default(Rect); ((Rect)(ref val))..ctor(x + 26f * ui, y, 420f, alto); string text = Etiquetas.Replace(texto, ""); Color color2 = GUI.color; float num2 = 0.25f + 0.1f * Mathf.Sin(Time.time * 3f + (float)i); GUI.color = new Color(1f, 1f, 1f, a * num2); for (int j = 0; j < 4; j++) { float num3 = ((j < 2) ? ((j == 0) ? (-1.5f) : 1.5f) : 0f); float num4 = ((j >= 2) ? ((j == 2) ? (-1.5f) : 1.5f) : 0f); GUI.Label(new Rect(((Rect)(ref val)).x + num3, ((Rect)(ref val)).y + num4, ((Rect)(ref val)).width, ((Rect)(ref val)).height), text, _halo); } GUI.color = new Color(1f, 1f, 1f, a * 0.9f); GUI.Label(new Rect(((Rect)(ref val)).x + 1f, ((Rect)(ref val)).y + 1f, ((Rect)(ref val)).width, ((Rect)(ref val)).height), text, _sombra); GUI.color = new Color(1f, 1f, 1f, a); GUI.Label(val, texto, _estilo); GUI.color = color2; } private static string Principal(Component objetivo) { //IL_00b4: Unknown result type (might be due to invalid IL or missing references) Character val = (Character)(object)((objetivo is Character) ? objetivo : null); if (val != null) { return Tr.Get("ojos_health") + $" {Mathf.CeilToInt(val.GetHealth())} / {Mathf.CeilToInt(val.GetMaxHealth())}"; } ItemDrop val2 = (ItemDrop)(object)((objetivo is ItemDrop) ? objetivo : null); if (val2 != null) { return Tr.Get("ojos_quantity") + $" ×{val2.m_itemData.m_stack}"; } Pickable val3 = (Pickable)(object)((objetivo is Pickable) ? objetivo : null); if (val3 != null) { return Tr.Get("ojos_base_yield") + $" ×{val3.m_amount}"; } int num = ((MineRock)(((objetivo is MineRock) ? objetivo : null)?)).m_minToolTier ?? ((MineRock5)objetivo).m_minToolTier; return Tr.Get("ojos_tool_tier") + $" {num}"; } private static List<string> Lecturas(Component objetivo) { //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0184: 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_019a: 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_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: 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) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0234: 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_024a: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) List<string> list = new List<string>(); ItemDrop val = (ItemDrop)(object)((objetivo is ItemDrop) ? objetivo : null); if (val != null) { ItemData itemData = val.m_itemData; list.Add("<color=#9CE8F1>" + Tr.Get("ojos_weight") + $" {itemData.GetWeight(-1):0.0}</color>"); list.Add("<color=#DFC5FF>" + Tr.Get("ojos_quality") + $" {itemData.m_quality}</color>"); if (itemData.m_shared.m_useDurability) { list.Add("<color=#FFE49B>" + Tr.Get("ojos_durability") + $" {Mathf.CeilToInt(itemData.m_durability)} / {Mathf.CeilToInt(itemData.GetMaxDurability())}</color>"); } return list; } Pickable val2 = (Pickable)(object)((objetivo is Pickable) ? objetivo : null); if (val2 != null) { ItemData val3 = ((!((Object)(object)val2.m_itemPrefab != (Object)null)) ? null : val2.m_itemPrefab.GetComponent<ItemDrop>()?.m_itemData); if (val3 != null) { list.Add("<color=#9CE8F1>" + Tr.Get("ojos_weight") + $" {val3.GetWeight(val2.m_amount):0.0}</color>"); } return list; } Character val4 = (Character)(object)((objetivo is Character) ? objetivo : null); DamageModifiers val5 = ((val4 != null) ? val4.GetDamageModifiers((WeakSpot)null) : (((MineRock)(((objetivo is MineRock) ? objetivo : null)?)).m_damageModifiers ?? ((MineRock5)objetivo).m_damageModifiers)); Add(list, Tr.Get("ojos_slash"), val5.m_slash); Add(list, Tr.Get("ojos_blunt"), val5.m_blunt); Add(list, Tr.Get("ojos_pierce"), val5.m_pierce); Add(list, Tr.Get("ojos_fire"), val5.m_fire); Add(list, Tr.Get("ojos_frost"), val5.m_frost); Add(list, Tr.Get("ojos_lightning"), val5.m_lightning); Add(list, Tr.Get("ojos_poison"), val5.m_poison); Add(list, Tr.Get("ojos_spirit"), val5.m_spirit); Add(list, Tr.Get("ojos_chop"), val5.m_chop); Add(list, Tr.Get("ojos_pickaxe"), val5.m_pickaxe); if (list.Count == 0) { list.Add("<color=#DDCCEE>" + Tr.Get("ojos_no_weaknesses_or_resistances") + "</color>"); } return list; } private static void Add(List<string> partes, string tipo, DamageModifier mod) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected I4, but got Unknown switch (mod - 1) { case 5: partes.Add("<color=#FF3030>" + tipo + " ×2</color>"); break; case 1: partes.Add("<color=#FF9933>" + tipo + " ×1,5</color>"); break; case 7: partes.Add("<color=#FFCC66>" + tipo + " ×1,25</color>"); break; case 6: partes.Add("<color=#A8E6A1>" + tipo + " ×0,75</color>"); break; case 0: partes.Add("<color=#66CC66>" + tipo + " ×0,5</color>"); break; case 4: partes.Add("<color=#2E8B57>" + tipo + " ×0,25</color>"); break; case 2: case 3: partes.Add("<color=#999999>" + tipo + ": " + Tr.Get("ojos_immune") + "</color>"); break; } } } [BepInPlugin("mushokutensei.ojos", "MT Ojos", "1.8.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] public class MTOjosPlugin : BaseUnityPlugin { public const string Guid = "mushokutensei.ojos"; public const string Version = "1.8.0"; public static ConfigEntry<KeyCode> TeclaZoom; public static ManualLogSource Log; public static string Dir; public static ConfigEntry<float> PrevAdelanto; public static ConfigEntry<float> PrevVelocidad; public static ConfigEntry<float> PrevOpacidad; public static ConfigEntry<float> PrevManaPorGolpe; public static ConfigEntry<float> PrevDistObjetivo; public static ConfigEntry<float> PrevDistCerca; public static ConfigEntry<int> PrevMaxSiluetas; public static ConfigEntry<Color> PrevColor; public static ConfigEntry<bool> PrevMarcaSuelo; public static ConfigEntry<float> ZoomMin; public static ConfigEntry<float> ZoomMax; public static ConfigEntry<float> ZoomManaPorSegundo; public static ConfigEntry<float> ZoomVelocidadMover; public static ConfigEntry<float> ZoomArco; public static ConfigEntry<bool> ZoomTelemetro; public static ConfigEntry<Color> ColorPrevision; public static ConfigEntry<Color> ColorVistaLejana; public static ConfigEntry<Color> ColorIdentificacion; public static ConfigEntry<float> IdentDistancia; public static ConfigEntry<float> IdentAltura; public static ConfigEntry<bool> BrilloOjos; public static ConfigEntry<float> DurabilidadMax; public static ConfigEntry<float> DesgasteIdentificacion; public static ConfigEntry<float> DesgasteVistaLejana; public static ConfigEntry<float> DesgastePrevision; public static ConfigEntry<float> PrevRalentizar; public static ConfigEntry<float> DesgasteEquipadoPorSegundo; public static ConfigEntry<float> DiametroOjo; private void Awake() { //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Expected O, but got Unknown //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Expected O, but got Unknown //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Expected O, but got Unknown //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Expected O, but got Unknown //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Expected O, but got Unknown //IL_02f7: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Unknown result type (might be due to invalid IL or missing references) //IL_035d: Unknown result type (might be due to invalid IL or missing references) //IL_03bf: Unknown result type (might be due to invalid IL or missing references) //IL_03c9: Expected O, but got Unknown //IL_0444: Unknown result type (might be due to invalid IL or missing references) //IL_044e: Expected O, but got Unknown //IL_0511: Unknown result type (might be due to invalid IL or missing references) //IL_051b: Expected O, but got Unknown //IL_05b6: Unknown result type (might be due to invalid IL or missing references) Tr.Load(typeof(MTOjosPlugin).Assembly, Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location)); Log = ((BaseUnityPlugin)this).Logger; Dir = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); PrevAdelanto = ((BaseUnityPlugin)this).Config.Bind<float>("Prevision", "Adelanto", 0.3f, new ConfigDescription("Segundos que la silueta empieza por delante del enemigo.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 0.8f), Array.Empty<object>())); PrevVelocidad = ((BaseUnityPlugin)this).Config.Bind<float>("Prevision", "VelocidadSilueta", 1.6f, new ConfigDescription("La animación de la silueta va acelerada: termina el golpe antes que el enemigo real.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 3f), Array.Empty<object>())); PrevOpacidad = ((BaseUnityPlugin)this).Config.Bind<float>("Prevision", "OpacidadSilueta", 0.55f, new ConfigDescription("Opacidad de la silueta.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 0.9f), Array.Empty<object>())); PrevColor = ((BaseUnityPlugin)this).Config.Bind<Color>("Prevision", "ColorSilueta", new Color(1f, 0.78f, 0.15f), "Color de la silueta (dorado, como el ojo; cámbialo si eres daltónico)."); PrevMaxSiluetas = ((BaseUnityPlugin)this).Config.Bind<int>("Prevision", "MaxSiluetas", 3, new ConfigDescription("Siluetas a la vez (las más cercanas).", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 6), Array.Empty<object>())); PrevMarcaSuelo = ((BaseUnityPlugin)this).Config.Bind<bool>("Prevision", "MarcaSueloArea", false, "Además de la silueta, marca en el suelo para golpes de área y criaturas que no se pueden copiar."); PrevManaPorGolpe = ((BaseUnityPlugin)this).Config.Bind<float>("Prevision", "ManaPorGolpe", 1f, "Maná por cada golpe previsto (es automático mientras llevas el ojo)."); PrevDistObjetivo = ((BaseUnityPlugin)this).Config.Bind<float>("Prevision", "DistanciaObjetivo", 20f, "Distancia máx. de enemigos que te apuntan a ti."); PrevDistCerca = ((BaseUnityPlugin)this).Config.Bind<float>("Prevision", "DistanciaCerca", 8f, "Distancia máx. de enemigos que te miran (aunque no sepamos su objetivo)."); ZoomMin = ((BaseUnityPlugin)this).Config.Bind<float>("VistaLejana", "Aumento", 4f, "Aumento al pulsar la tecla."); ZoomMax = ((BaseUnityPlugin)this).Config.Bind<float>("VistaLejana", "AumentoMaximo", 12f, "Aumento máximo con la rueda del ratón."); ZoomManaPorSegundo = ((BaseUnityPlugin)this).Config.Bind<float>("VistaLejana", "ManaPorSegundo", 0.25f, "Maná por segundo mientras haces zoom."); ZoomVelocidadMover = ((BaseUnityPlugin)this).Config.Bind<float>("VistaLejana", "VelocidadAlMirar", 0.75f, "Multiplicador de velocidad de movimiento mientras haces zoom."); ZoomArco = ((BaseUnityPlugin)this).Config.Bind<float>("VistaLejana", "AumentoArco", 2.5f, new ConfigDescription("Aumento automático al tensar el arco con el ojo puesto (1 = sin zoom). Con la tecla, el zoom completo.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 6f), Array.Empty<object>())); ZoomTelemetro = ((BaseUnityPlugin)this).Config.Bind<bool>("VistaLejana", "Telemetro", true, "Mientras miras: distancia en metros y nombre de lo que apuntas, bajo la mira."); ColorPrevision = ((BaseUnityPlugin)this).Config.Bind<Color>("Visual", "ColorPrevision", new Color(1f, 0.72f, 0.08f), "Color del brillo del ojo con Previsión (mt_eye color foresight r g b)."); ColorVistaLejana = ((BaseUnityPlugin)this).Config.Bind<Color>("Visual", "ColorVistaLejana", new Color(1f, 0.12f, 0.4f), "Color del brillo del ojo con Vista Lejana."); ColorIdentificacion = ((BaseUnityPlugin)this).Config.Bind<Color>("Visual", "ColorIdentificacion", new Color(0.65f, 0.3f, 1f), "Color del brillo del ojo con Identificación."); BrilloOjos = ((BaseUnityPlugin)this).Config.Bind<bool>("Visual", "LlamasOjos", false, "Tu ojo se enciende del color del ojo mágico puesto, con llamitas como el tōki."); DiametroOjo = ((BaseUnityPlugin)this).Config.Bind<float>("Visual", "TamanoBrillo", 0.04f, new ConfigDescription("Tamaño de las llamas de los ojos en la cabeza (0,04 = normal; mt_eye size).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.005f, 0.3f), Array.Empty<object>())); IdentAltura = ((BaseUnityPlugin)this).Config.Bind<float>("Identificacion", "Altura", 0.35f, "Metros sobre la cabeza de la criatura donde empieza el texto (justo bajo su barra de vida del juego)."); IdentDistancia = ((BaseUnityPlugin)this).Config.Bind<float>("Identificacion", "Distancia", 60f, "Distancia máx. de identificación de criaturas, botín, recursos recolectables y vetas visibles."); PrevRalentizar = ((BaseUnityPlugin)this).Config.Bind<float>("Prevision", "RalentizarEnemigo", 0.8f, new ConfigDescription("Velocidad de la animación del enemigo mientras ataca (1 = normal, 0,8 = 20 % más lento). Solo en el enemigo que previste.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 1f), Array.Empty<object>())); DurabilidadMax = ((BaseUnityPlugin)this).Config.Bind<float>("Desgaste", "Durabilidad", 100f, "Durabilidad de los ojos (+50 % por nivel de mejora). Se reparan en su estación."); DesgasteIdentificacion = ((BaseUnityPlugin)this).Config.Bind<float>("Desgaste", "IdentificacionPorSegundo", 0.1f, "Desgaste por segundo identificando una criatura (100 → ~16 min apuntando)."); DesgasteVistaLejana = ((BaseUnityPlugin)this).Config.Bind<float>("Desgaste", "VistaLejanaPorSegundo", 0.4f, "Desgaste por segundo de zoom (100 → ~4 min mirando)."); DesgastePrevision = ((BaseUnityPlugin)this).Config.Bind<float>("Desgaste", "PrevisionPorGolpe", 0.5f, "Desgaste por golpe previsto (100 → 200 golpes)."); DesgasteEquipadoPorSegundo = ((BaseUnityPlugin)this).Config.Bind<float>("Desgaste", "SoloLlevarloPorSegundo", 0f, new ConfigDescription("Desgaste extra por solo llevar el ojo puesto (0 = solo se gasta al usarlo).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); TeclaZoom = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Teclas", "VistaLejana", (KeyCode)122, "Mantener para usar el Ojo de la Vista Lejana."); PrefabManager.OnVanillaPrefabsAvailable += Ojos.Registrar; Desgaste.Init(); ((Component)this).gameObject.AddComponent<DesgasteEquipado>(); ((Component)this).gameObject.AddComponent<VistaLejana>(); ((Component)this).gameObject.AddComponent<Prevision>(); ((Component)this).gameObject.AddComponent<Identificacion>(); ((Component)this).gameObject.AddComponent<BrilloOjo>(); CommandManager.Instance.AddConsoleCommand((ConsoleCommand)(object)new OjoCommand()); new Harmony("mushokutensei.ojos").PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"MT Ojos 1.8.0 cargado"); } public static bool PuedeUsarTeclas() { if (((Object)(object)Chat.instance == (Object)null || !Chat.instance.HasFocus()) && !Console.IsVisible() && !Menu.IsVisible() && !InventoryGui.IsVisible() && !Minimap.IsOpen() && !TextInput.IsVisible()) { return !StoreGui.IsVisible(); } return false; } } public static class ObjModel { public static Mesh Load(string path, out List<string> materialNames) { //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_031a: Expected O, but got Unknown //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Unknown result type (might be due to invalid IL or missing references) materialNames = new List<string>(); if (!File.Exists(path)) { return null; } List<Vector3> list = new List<Vector3>(); List<Vector3> list2 = new List<Vector3>(); List<Vector2> list3 = new List<Vector2>(); List<Vector3> list4 = new List<Vector3>(); List<Vector3> list5 = new List<Vector3>(); List<Vector2> list6 = new List<Vector2>(); List<List<int>> list7 = new List<List<int>>(); List<int> list8 = null; CultureInfo invariantCulture = CultureInfo.InvariantCulture; string[] array = File.ReadAllLines(path); for (int i = 0; i < array.Length; i++) { string text = array[i].Trim(); if (text.Length == 0 || text[0] == '#') { continue; } string[] array2 = text.Split((char[]?)null, StringSplitOptions.RemoveEmptyEntries); switch (array2[0]) { case "v": list.Add(new Vector3(0f - float.Parse(array2[1], invariantCulture), float.Parse(array2[2], invariantCulture), float.Parse(array2[3], invariantCulture))); break; case "vn": list2.Add(new Vector3(0f - float.Parse(array2[1], invariantCulture), float.Parse(array2[2], invariantCulture), float.Parse(array2[3], invariantCulture))); break; case "vt": list3.Add(new Vector2(float.Parse(array2[1], invariantCulture), float.Parse(array2[2], invariantCulture))); break; case "usemtl": { string item = ((array2.Length > 1) ? array2[1] : "default"); int num = materialNames.IndexOf(item); if (num < 0) { materialNames.Add(item); list8 = new List<int>(); list7.Add(list8); } else { list8 = list7[num]; } break; } case "f": { if (list8 == null) { materialNames.Add("default"); list8 = new List<int>(); list7.Add(list8); } List<int> list9 = new List<int>(); for (int j = 1; j < array2.Length; j++) { string[] array3 = array2[j].Split(new char[1] { '/' }); list4.Add(list[Index(array3[0], list.Count)]); list6.Add((array3.Length > 1 && array3[1].Length > 0) ? list3[Index(array3[1], list3.Count)] : Vector2.zero); list5.Add((array3.Length > 2 && array3[2].Length > 0) ? list2[Index(array3[2], list2.Count)] : Vector3.up); list9.Add(list4.Count - 1); } for (int k = 1; k + 1 < list9.Count; k++) { list8.Add(list9[0]); list8.Add(list9[k + 1]); list8.Add(list9[k]); } break; } } } Mesh val = new Mesh { name = Path.GetFileNameWithoutExtension(path) }; val.SetVertices(list4); val.SetNormals(list5); val.SetUVs(0, list6); val.subMeshCount = list7.Count; for (int l = 0; l < list7.Count; l++) { val.SetTriangles(list7[l], l); } val.RecalculateBounds(); return val; } private static int Index(string s, int count) { int num = int.Parse(s, CultureInfo.InvariantCulture); if (num <= 0) { return count + num; } return num - 1; } public static Material[] Materials(List<string> names, Material template, string mtlPath) { //IL_0123: 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_012a: Expected O, but got Unknown //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) Dictionary<string, Color> dictionary = new Dictionary<string, Color>(); Dictionary<string, Color> dictionary2 = new Dictionary<string, Color>(); string text = null; CultureInfo invariantCulture = CultureInfo.InvariantCulture; if (File.Exists(mtlPath)) { string[] array = File.ReadAllLines(mtlPath); Color value = default(Color); for (int i = 0; i < array.Length; i++) { string[] array2 = array[i].Trim().Split((char[]?)null, StringSplitOptions.RemoveEmptyEntries); if (array2.Length != 0) { if (array2[0] == "newmtl" && array2.Length > 1) { text = array2[1]; } else if (text != null && array2.Length >= 4 && (array2[0] == "Kd" || array2[0] == "Ke")) { ((Color)(ref value))..ctor(Mathf.LinearToGammaSpace(float.Parse(array2[1], invariantCulture)), Mathf.LinearToGammaSpace(float.Parse(array2[2], invariantCulture)), Mathf.LinearToGammaSpace(float.Parse(array2[3], invariantCulture))); ((array2[0] == "Kd") ? dictionary : dictionary2)[text] = value; } } } } Material[] array3 = (Material[])(object)new Material[names.Count]; for (int j = 0; j < names.Count; j++) { Material val = (((Object)(object)template != (Object)null) ? new Material(template) : new Material(Shader.Find("Standard"))); ((Object)val).name = "MT_" + names[j]; string text2 = names[j]; if (!dictionary.ContainsKey(text2)) { int num = text2.LastIndexOf('.'); if (num > 0) { text2 = text2.Substring(0, num); } } if (val.HasProperty("_MainTex")) { val.SetTexture("_MainTex", (Texture)(object)Texture2D.whiteTexture); } if (val.HasProperty("_BumpMap")) { val.SetTexture("_BumpMap", (Texture)null); } if (val.HasProperty("_Color")) { val.SetColor("_Color", dictionary.TryGetValue(text2, out var value2) ? value2 : Color.gray); } if (dictionary2.TryGetValue(text2, out var value3) && ((Color)(ref value3)).maxColorComponent > 0.01f && val.HasProperty("_EmissionColor")) { val.EnableKeyword("_EMISSION"); val.SetColor("_EmissionColor", value3 * 1.5f); } array3[j] = val; } return array3; } public static void ReplaceVisual(GameObject itemPrefab, Mesh mesh, Material[] mats) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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_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_0066: Unknown result type (might be due to invalid IL or missing references) Renderer[] componentsInChildren = itemPrefab.GetComponentsInChildren<Renderer>(true); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].enabled = false; } GameObject val = new GameObject("MT_ModeloOjo"); val.transform.SetParent(itemPrefab.transform, false); val.transform.localPosition = new Vector3(0f, 0.09f, 0f); val.AddComponent<MeshFilter>().sharedMesh = mesh; ((Renderer)val.AddComponent<MeshRenderer>()).sharedMaterials = mats; val.layer = itemPrefab.layer; } } public class OjoCommand : ConsoleCommand { public override string Name => "mt_eye"; public override string Help => "mt_eye — show values · size s (flame size, default 0.04) · color <foresight|farsight|identification> r g b (0-1, 0-255 or #hex) · on/off · reset · scan (log the face: renderers, materials, eye bones)"; public override List<string> CommandOptionList() { return new List<string> { "scan", "size", "color", "on", "off", "reset" }; } public override void Run(string[] args) { //IL_00c1: Unknown result type (might be due to invalid IL or missing references) if (args.Length == 0) { Mostrar(); return; } switch (args[0].ToLowerInvariant()) { case "size": { if (args.Length >= 2 && F(args[1], out var v)) { MTOjosPlugin.DiametroOjo.Value = v; Mostrar(); return; } break; } case "color": { ConfigEntry<Color> val = ((args.Length > 1) ? Entrada(args[1]) : null); if (val != null && Leer(args, out var c)) { val.Value = c; Mostrar(); return; } break; } case "scan": Escanear(); return; case "on": MTOjosPlugin.BrilloOjos.Value = true; Mostrar(); return; case "off": MTOjosPlugin.BrilloOjos.Value = false; Mostrar(); return; case "reset": { ConfigEntryBase[] array = (ConfigEntryBase[])(object)new ConfigEntryBase[4] { (ConfigEntryBase)MTOjosPlugin.DiametroOjo, (ConfigEntryBase)MTOjosPlugin.ColorPrevision, (ConfigEntryBase)MTOjosPlugin.ColorVistaLejana, (ConfigEntryBase)MTOjosPlugin.ColorIdentificacion }; foreach (ConfigEntryBase obj in array) { obj.BoxedValue = obj.DefaultValue; } BrilloOjo.Recalibrar(); Mostrar(); return; } } Console.instance.Print(((ConsoleCommand)this).Help); } private static void Escanear() { //IL_03ac: Unknown result type (might be due to invalid IL or missing references) //IL_03bc: Unknown result type (might be due to invalid IL or missing references) //IL_03ce: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { Console.instance.Print("No player."); return; } ManualLogSource log = MTOjosPlugin.Log; log.LogInfo((object)"=== mt_eye scan ==="); int num = 0; Renderer[] componentsInChildren = ((Component)localPlayer).GetComponentsInChildren<Renderer>(true); foreach (Renderer val in componentsInChildren) { SkinnedMeshRenderer val2 = (SkinnedMeshRenderer)(object)((val is SkinnedMeshRenderer) ? val : null); MeshFilter component = ((Component)val).GetComponent<MeshFilter>(); Mesh val3 = (((Object)(object)val2 != (Object)null) ? val2.sharedMesh : (((Object)(object)component != (Object)null) ? component.sharedMesh : null)); log.LogInfo((object)string.Format("[R] {0} · {1} · on={2} · mesh={3}", Ruta(((Component)val).transform, ((Component)localPlayer).transform), ((object)val).GetType().Name, val.enabled && ((Component)val).gameObject.activeInHierarchy, Object.op_Implicit((Object)(object)val3) ? (((Object)val3).name + " sub=" + val3.subMeshCount + " blend=" + val3.blendShapeCount) : "-")); if ((Object)(object)val3 != (Object)null) { for (int j = 0; j < val3.blendShapeCount; j++) { log.LogInfo((object)(" blendshape " + val3.GetBlendShapeName(j))); } } Material[] sharedMaterials = val.sharedMaterials; foreach (Material val4 in sharedMaterials) { if ((Object)(object)val4 == (Object)null) { continue; } List<string> list = new List<string>(); string[] array = new string[10] { "_MainTex", "_EmissionMap", "_EmissionColor", "_SkinColor", "_ChestTex", "_LegsTex", "_EyeColor", "_EyeTex", "_Glow", "_GlowColor" }; foreach (string text in array) { if (val4.HasProperty(text)) { list.Add(text + "=" + ((!text.EndsWith("Tex") && !text.EndsWith("Map")) ? ((object)val4.GetColor(text)) : (Object.op_Implicit((Object)(object)val4.GetTexture(text)) ? ((Object)val4.GetTexture(text)).name : "null"))); } } log.LogInfo((object)(" mat " + ((Object)val4).name + " · shader " + ((Object)val4.shader).name + " · kw [" + string.Join(",", val4.shaderKeywords) + "] · " + string.Join(" · ", list))); } num++; } Transform[] componentsInChildren2 = ((Component)localPlayer).GetComponentsInChildren<Transform>(true); foreach (Transform val5 in componentsInChildren2) { string text2 = ((Object)val5).name.ToLowerInvariant(); if (text2.Contains("eye") || text2.Contains("head") || text2.Contains("face") || text2.Contains("beard") || text2.Contains("hair")) { log.LogInfo((object)$"[T] {Ruta(val5, ((Component)localPlayer).transform)} · y={val5.position.y - ((Component)localPlayer).transform.position.y:0.00} · scale={val5.lossyScale.x:0.###}"); } } Console.instance.Print($"Scan done: {num} renderers written to BepInEx/LogOutput.log (search for 'mt_eye scan')."); } private static string Ruta(Transform t, Transform raiz) { string text = ((Object)t).name; Transform parent = t.parent; while ((Object)(object)parent != (Object)null && (Object)(object)parent != (Object)(object)raiz) { text = ((Object)parent).name + "/" + text; parent = parent.parent; } return text; } private static ConfigEntry<Color> Entrada(string nombre) { return (ConfigEntry<Color>)(nombre.ToLowerInvariant() switch { "foresight" => MTOjosPlugin.ColorPrevision, "farsight" => MTOjosPlugin.ColorVistaLejana, "identification" => MTOjosPlugin.ColorIdentificacion, _ => null, }); } private static bool Leer(string[] a, out Color c) { //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_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) c = Color.white; if (a.Length == 3 && a[2].StartsWith("#")) { return ColorUtility.TryParseHtmlString(a[2], ref c); } if (a.Length < 5 || !F(a[2], out var v) || !F(a[3], out var v2) || !F(a[4], out var v3)) { return false; } float num = ((v > 1f || v2 > 1f || v3 > 1f) ? 255f : 1f); c = new Color(v / num, v2 / num, v3 / num); return true; } private static bool F(string s, out float v) { return float.TryParse(s.Replace(',', '.'), NumberStyles.Float, CultureInfo.InvariantCulture, out v); } private static void Mostrar() { //IL_0049: 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_006d: Unknown result type (might be due to invalid IL or missing references) Console.instance.Print(string.Format(CultureInfo.InvariantCulture, "Eye flames: {0} · size {1:0.###} · foresight #{2} · farsight #{3} · identification #{4}", MTOjosPlugin.BrilloOjos.Value ? "on" : "off", MTOjosPlugin.DiametroOjo.Value, ColorUtility.ToHtmlStringRGB(MTOjosPlugin.ColorPrevision.Value), ColorUtility.ToHtmlStringRGB(MTOjosPlugin.ColorVistaLejana.Value), ColorUtility.ToHtmlStringRGB(MTOjosPlugin.ColorIdentificacion.Value))); Console.instance.Print("Eye flames " + BrilloOjo.Diagnostico()); } } public static class Ojos { public const string Prevision = "MT_OjoPrevision"; public const string VistaLejana = "MT_OjoVistaLejana"; public const string Identificacion = "MT_OjoIdentificacion"; private static readonly Dictionary<string, string> Nombres = new Dictionary<string, string>(); private static float _cacheHasta; private static Player _cacheJugador; private static readonly List<string> Orden = new List<string>(); public const int MaxOjos = 2; public static List<string> Puestos { get { Refrescar(); return Orden; } } private static void Refrescar() { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer != (Object)(object)_cacheJugador) { Orden.Clear(); _cacheHasta = 0f; _cacheJugador = localPlayer; } if ((Object)(object)localPlayer == (Object)null) { Orden.Clear(); } else if (!(Time.time < _cacheHasta)) { _cacheHasta = Time.time + 0.1f; Actualizar(localPlayer); } } public static void Registrar() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Expected O, but got Unknown //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Expected O, but got Unknown //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: 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 //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Expected O, but got Unknown //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Expected O, but got Unknown try { Crear("MT_OjoIdentificacion", Tr.Token("ojos_ojo_identificacion"), Tr.Token("ojos_ojo_identificacion_d"), "ojo_identificacion", "GreydwarfEye", CraftingStations.Workbench, 2, new RequirementConfig("GreydwarfEye", 5, 0, true), new RequirementConfig("LeatherScraps", 3, 0, true), new RequirementConfig("Resin", 5, 0, true)); Crear("MT_OjoVistaLejana", Tr.Token("ojos_ojo_vista_lejana"), Tr.Token("ojos_ojo_vista_lejana_d"), "ojo_vista_lejana", "Crystal", CraftingStations.Forge, 2, new RequirementConfig("Iron", 2, 0, true), new RequirementConfig("GreydwarfEye", 5, 0, true), new RequirementConfig("TrollHide", 2, 0, true)); Crear("MT_OjoPrevision", Tr.Token("ojos_ojo_prevision"), Tr.Token("ojos_ojo_prevision_d"), "ojo_prevision", "Ruby", CraftingStations.Forge, 3, new RequirementConfig("Silver", 4, 0, true), new RequirementConfig("Crystal", 3, 0, true), new RequirementConfig("TrophyHatchling", 1, 0, true)); } finally { PrefabManager.OnVanillaPrefabsAvailable -= Registrar; } } private static void Crear(string prefab, string nombre, string desc, string modelo, string iconoDe, string estacion, int nivel, params RequirementConfig[] reqs) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0012: 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_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown CustomItem val = new CustomItem(prefab, "BeltStrength", new ItemConfig { Name = nombre, Description = desc, CraftingStation = estacion, MinStationLevel = nivel, Requirements = reqs }); SharedData shared = val.ItemDrop.m_itemData.m_shared; Nombres[shared.m_name] = prefab; shared.m_equipStatusEffect = null; shared.m_setStatusEffect = null; shared.m_setName = ""; shared.m_setSize = 0; string dir = MTOjosPlugin.Dir; string text = Path.Combine(Path.Combine(dir, "Icons"), modelo + ".png"); Sprite val2 = (File.Exists(text) ? AssetUtils.LoadSpriteFromFile(text) : null); if ((Object)(object)val2 == (Object)null) { ItemDrop prefab2 = Cache.GetPrefab<ItemDrop>(iconoDe); if ((Object)(object)prefab2 != (Object)null && prefab2.m_itemData.m_shared.m_icons.Length != 0) { val2 = prefab2.m_itemData.m_shared.m_icons[0]; } } if ((Object)(object)val2 != (Object)null) { shared.m_icons = (Sprite[])(object)new Sprite[1] { val2 }; } shared.m_equipStatusEffect = SE_Ojo.Crear(prefab, shared); string text2 = Path.Combine(Path.Combine(dir, "Models"), modelo + ".obj"); List<string> materialNames; Mesh val3 = ObjModel.Load(text2, out materialNames); if ((Object)(object)val3 != (Object)null) { GameObject prefab3 = PrefabManager.Instance.GetPrefab("Club"); object obj; if (prefab3 == null) { obj = null; } else { MeshRenderer componentInChildren = prefab3.GetComponentInChildren<MeshRenderer>(true); obj = ((componentInChildren != null) ? ((Renderer)componentInChildren).sharedMaterial : null); } Material template = (Material)obj; ObjModel.ReplaceVisual(val.ItemPrefab, val3, ObjModel.Materials(materialNames, template, Path.ChangeExtension(text2, ".mtl"))); } else { MTOjosPlugin.Log.LogWarning((object)("Modelo no encontrado: " + text2)); } ItemManager.Instance.AddItem(val); } public static bool EnInventario(string prefab) { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { return false; } foreach (ItemData allItem in ((Humanoid)localPlayer).GetInventory().GetAllItems()) { if (Nombres.TryGetValue(allItem.m_shared.m_name, out var value) && value == prefab) { return true; } } return false; } public static bool Equipado(string prefab) { Refrescar(); return Orden.Contains(prefab); } private static void Actualizar(Player p) { Dictionary<string, ItemData> ahora = new Dictionary<string, ItemData>(); foreach (ItemData equippedItem in ((Humanoid)p).GetInventory().GetEquippedItems()) { if (Nombres.TryGetValue(equippedItem.m_shared.m_name, out var value) && !ahora.ContainsKey(value)) { ahora[value] = equippedItem; } } string text = string.Join(",", Orden.ToArray()); Orden.RemoveAll((string o) => !ahora.ContainsKey(o)); foreach (string key2 in ahora.Keys) { if (!Orden.Contains(key2)) { Orden.Add(key2); } } while (Orden.Count > 2) { string key = Orden[0]; Orden.RemoveAt(0); ((Humanoid)p).UnequipItem(ahora[key], true); ((Character)p).Message((MessageType)2, Tr.Get("ojos_can_only_wear_2_eyes"), 0, (Sprite)null, false); } string text2 = string.Join(",", Orden.ToArray()); if (text != text2) { MTOjosPlugin.Log.LogInfo((object)("Ojos puestos: " + ((text2.Length > 0) ? text2 : "ninguno"))); } } } public class Prevision : MonoBehaviour { public const string SEName = "SE_MT_Prevision"; public static StatusEffect SE; private static readonly HashSet<string> Registrados = new HashSet<string>(); private static readonly Dictionary<int, float> UltimoAviso = new Dictionary<int, float>(); private static readonly Dictionary<string, Dictionary<string, Attack>> Ataques = new Dictionary<string, Dictionary<string, Attack>>(); public static bool Activo { get; private set; } private void Awake() { //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown SE = ScriptableObject.CreateInstance<StatusEffect>(); ((Object)SE).name = "SE_MT_Prevision"; SE.m_name = Tr.Token("ojos_se_prevision"); SE.m_tooltip = Tr.Token("ojos_se_prevision_tt"); SE.m_ttl = 0f; ItemManager.Instance.AddStatusEffect(new CustomStatusEffect(SE, false)); } private void Update() { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { if (Activo) { Apagar(null, null); } Fantasma.VaciarPool(); return; } bool flag = Desgaste.Funciona("MT_OjoPrevision") && !((Character)localPlayer).IsDead(); if (flag && !Activo) { Encender(localPlayer); } else if (!flag && Activo) { Apagar(localPlayer, null); } } private static void Encender(Player p) { Activo = true; ((Character)p).GetSEMan().AddStatusEffect(StringExtensionMethods.GetStableHashCode("SE_MT_Prevision"), false, 0, 0f, (short)0); } private static void Apagar(Player p, string msg) { Activo = false; Fantasma.TerminarTodos(); UltimoAviso.Clear(); if (!((Object)(object)p == (Object)null)) { ((Character)p).GetSEMan().RemoveStatusEffect(StringExtensionMethods.GetStableHashCode("SE_MT_Prevision"), true); if (msg != null) { ((Character)p).Message((MessageType)1, msg, 0, (Sprite)null, false); } } } private void OnDestroy() { Fantasma.VaciarPool(); } public static void OnTrigger(ZSyncAnimation z, string trigger) { //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: 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_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Invalid comparison between Unknown and I4 if (!Activo || string.IsNullOrEmpty(trigger) || !Desgaste.Funciona("MT_OjoPrevision")) { return; } try { Player localPlayer = Player.m_localPlayer; Character component = ((Component)z).GetComponent<Character>(); if ((Object)(object)localPlayer == (Object)null || (Object)(object)component == (Object)null || component.IsPlayer() || component.IsDead() || component.IsTamed()) { return; } BaseAI baseAI = component.GetBaseAI(); if ((Object)(object)baseAI == (Object)null || !BaseAI.IsEnemy(component, (Character)(object)localPlayer)) { return; } Attack val = BuscarAtaque(component, trigger); string text = Utils.GetPrefabName(((Component)component).gameObject) + "/" + trigger; if (Registrados.Add(text)) { MTOjosPlugin.Log.LogInfo((object)("Previsión: '" + text + "' → " + ((val != null) ? "ataque" : "no es ataque"))); } if (val == null) { return; } Vector3 val2 = ((Component)localPlayer).transform.position - ((Component)component).transform.position; float magnitude = ((Vector3)(ref val2)).magnitude; bool num = (Object)(object)baseAI.GetTargetCreature() == (Object)(object)localPlayer && magnitude <= MTOjosPlugin.PrevDistObjetivo.Value; bool flag = magnitude <= MTOjosPlugin.PrevDistCerca.Value && Vector3.Angle(((Component)component).transform.forward, val2) < 60f; if (!num && !flag) { return; } int instanceID = ((Object)component).GetInstanceID(); if (UltimoAviso.TryGetValue(instanceID, out var value) && Time.time - value < 0.15f) { return; } UltimoAviso[instanceID] = Time.time; if (UltimoAviso.Count > 64) { UltimoAviso.Clear(); } float value2 = MTOjosPlugin.PrevManaPorGolpe.Value; if (!(localPlayer.GetEitr() < value2)) { bool flag2 = (int)val.m_attackType == 4; bool flag3 = Fantasma.Mostrar(component, trigger, magnitude); if (flag3) { ((Character)localPlayer).UseEitr(value2); Desgaste.Gastar("MT_OjoPrevision", MTOjosPlugin.DesgastePrevision.Value); Ralentizado.Aplicar(component, z); } if (MTOjosPlugin.PrevMarcaSuelo.Value && (flag2 || !flag3)) { Marca.Mostrar(component, val, flag2); } } } catch (Exception ex) { MTOjosPlugin.Log.LogWarning((object)("Previsión: " + ex.Message)); } } private static Attack BuscarAtaque(Character c, string trigger) { string prefabName = Utils.GetPrefabName(((Component)c).gameObject); if (!Ataques.TryGetValue(prefabName, out var value)) { value = new Dictionary<string, Attack>(); Humanoid val = (Humanoid)(object)((c is Humanoid) ? c : null); if (val != null) { Anadir(value, val.m_defaultItems); Anadir(value, val.m_randomWeapon); if (val.m_randomSets != null) { ItemSet[] randomSets = val.m_randomSets; foreach (ItemSet val2 in randomSets) { Anadir(value, val2.m_items); } } foreach (ItemData allItem in val.GetInventory().GetAllItems()) { Anadir(value, allItem.m_shared); } } Ataques[prefabName] = value; } if (!value.TryGetValue(trigger, out var value2)) { return null; } return value2; } private static void Anadir(Dictionary<string, Attack> mapa, GameObject[] items) { if (items == null) { return; } foreach (GameObject val in items) { ItemDrop val2 = (Object.op_Implicit((Object)(object)val) ? val.GetComponent<ItemDrop>() : null); if ((Object)(object)val2 != (Object)null) { Anadir(mapa, val2.m_itemData.m_shared); } } } private static void Anadir(Dictionary<string, Attack> mapa, SharedData s) { if (s == null) { return; } Attack[] array = (Attack[])(object)new Attack[2] { s.m_attack, s.m_secondaryAttack }; foreach (Attack val in array) { if (val != null && !string.IsNullOrEmpty(val.m_attackAnimation) && !mapa.ContainsKey(val.m_attackAnimation)) { mapa[val.m_attackAnimation] = val; } } } } [HarmonyPatch(typeof(ZSyncAnimation), "SetTrigger")] public static class TriggerLocalPatch { public static void Postfix(ZSyncAnimation __instance, string name) { Prevision.OnTrigger(__instance, name); } } [HarmonyPatch(typeof(ZSyncAnimation), "RPC_SetTrigger")] public static class TriggerRemotoPatch { public static void Postfix(ZSyncAnimation __instance, string name) { Prevision.OnTrigger(__instance, name); } } public static class Transparente { private static readonly string[] Candidatos = new string[4] { "Legacy Shaders/Particles/Alpha Blended", "Sprites/Default", "Particles/Standard Unlit", "Unlit/Transparent" }; private static Shader _shader; private static bool _buscado; public static Material Nuevo(Color color) { //IL_0069: 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_006f: 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_0081: Expected O, but got Unknown if (!_buscado) { _buscado = true; string[] candidatos = Candidatos; for (int i = 0; i < candidatos.Length; i++) { _shader = Shader.Find(candidatos[i]); if ((Object)(object)_shader != (Object)null) { break; } } if ((Object)(object)_shader == (Object)null) { MTOjosPlugin.Log.LogWarning((object)"No hay shader transparente: Previsión sin siluetas ni marcas (ASSET NUEVO pendiente)."); } } if (!((Object)(object)_shader == (Object)null)) { return new Material(_shader) { color = color, renderQueue = 3100 }; } return null; } } public class Ralentizado : MonoBehaviour { private static readonly FieldRef<ZSyncAnimation, Animator> AnimRef = AccessTools.FieldRefAccess<ZSyncAnimation, Animator>("m_animator"); private Animator _anim; private Character _c; private float _hasta; private float _factor; private float _inicio; public static float FactorDe(ZSyncAnimation z) { Ralentizado component = ((Component)z).GetComponent<Ralentizado>(); if (!((Object)(object)component != (Object)null) || !((Behaviour)component).enabled) { return 1f; } return component._factor; } public static void Aplicar(Character c, ZSyncAnimation z) { float value = MTOjosPlugin.PrevRalentizar.Value; if (value >= 0.999f) { return; } ZNetView component = ((Component)c).GetComponent<ZNetView>(); if (!((Object)(object)component == (Object)null) && component.IsOwner()) { Animator val = AnimRef.Invoke(z); if (!((Object)(object)val == (Object)null)) { Ralentizado obj = ((Component)c).GetComponent<Ralentizado>() ?? ((Component)c).gameObject.AddComponent<Ralentizado>(); obj._anim = val; obj._c = c; obj._factor = value; obj._inicio = Time.time; obj._hasta = Time.time + 1.5f; ((Behaviour)obj).enabled = true; val.speed = value; } } } private void LateUpdate() { if ((Object)(object)_anim == (Object)null || (Object)(object)_c == (Object)null || Time.time > _hasta || (Time.time - _inicio > 0.25f && !_c.InAttack())) { Quitar(); } else if (!Mathf.Approximately(_anim.speed, _factor)) { _anim.speed = _factor; } } private void Quitar() { if ((Object)(object)_anim != (Object)null && Mathf.Approximately(_anim.speed, _factor)) { _anim.speed = 1f; } ((Behaviour)this).enabled = false; } private void OnDestroy() { if (((Behaviour)this).enabled) { Quitar(); } } } public class SE_Ojo : StatusEffect { public string Ojo; public static StatusEffect Crear(string prefab, SharedData s) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown SE_Ojo sE_Ojo = ScriptableObject.CreateInstance<SE_Ojo>(); ((Object)sE_Ojo).name = "MT_SE_" + prefab; sE_Ojo.Ojo = prefab; ((StatusEffect)sE_Ojo).m_name = s.m_name; ((StatusEffect)sE_Ojo).m_tooltip = s.m_description; ((StatusEffect)sE_Ojo).m_icon = ((s.m_icons != null && s.m_icons.Length != 0) ? s.m_icons[0] : null); ItemManager.Instance.AddStatusEffect(new CustomStatusEffect((StatusEffect)(object)sE_Ojo, false)); return (StatusEffect)(object)sE_Ojo; } public override string GetIconText() { ItemData val = Desgaste.Item(Ojo); if (val == null || !val.m_shared.m_useDurability) { return ""; } return Mathf.CeilToInt(100f * val.m_durability / Mathf.Max(1f, val.GetMaxDurability())) + "%"; } } public class VistaLejana : MonoBehaviour { private const float Transicion = 0.2f; private float _zoomObjetivo = 1f; private float _zoom = 1f; private float _fovBase; private bool _tieneBase; private Camera _cam; private static VistaLejana _inst; private bool _forzarFin; private GUIStyle _estilo; private GUIStyle _sombra; private string _telemetro; private float _siguienteRayo; private static int _mascara; private static readonly FieldRef<GameCamera, Camera> CamRef = AccessTools.FieldRefAccess<GameCamera, Camera>("m_camera"); public static bool Mirando { get; private
plugins/MT.Paso/MT.Paso.dll
Decompiled 11 hours agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Jotunn.Configs; using Jotunn.Managers; using Jotunn.Utils; using MT.Core; using MT.Core.I18n; using MT.Core.Touki; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")] [assembly: AssemblyCompany("MT.Paso")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+a3d1e112c18dad5152e45a99f4e3179a3ca51bec")] [assembly: AssemblyProduct("MT.Paso")] [assembly: AssemblyTitle("MT.Paso")] [assembly: AssemblyVersion("1.0.0.0")] [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 MT { public static class Magia_FxBridge { public static void Dust(Vector3 pos) { //IL_002a: 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) GameObject val = (((Object)(object)ZNetScene.instance != (Object)null) ? ZNetScene.instance.GetPrefab("fx_land") : null); if ((Object)(object)val != (Object)null) { Object.Instantiate<GameObject>(val, pos, Quaternion.identity); } } } } namespace MT.Paso { public class Afterimage : MonoBehaviour { private const float FadeSeconds = 0.35f; private const int Copies = 5; private static readonly string[] ShaderCandidates = new string[4] { "Legacy Shaders/Particles/Alpha Blended", "Sprites/Default", "Particles/Standard Unlit", "Unlit/Transparent" }; private static Shader _shader; private static bool _searched; private Material[] _materials; private float _age; private Color _color; public static void SpawnTrail(Player p, Vector3 start, Vector3 end, Color color) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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_0025: 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_002f: 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_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0042: 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_0066: Unknown result type (might be due to invalid IL or missing references) if (FindShader()) { SkinnedMeshRenderer[] componentsInChildren = ((Component)p).GetComponentsInChildren<SkinnedMeshRenderer>(); Vector3 val = ((Component)p).transform.position - start; for (int i = 0; i < 5; i++) { Vector3 rootPos = Vector3.Lerp(start, end, (float)i / 5f) + val; Spawn(componentsInChildren, ((Component)p).transform, rootPos, color * new Color(1f, 1f, 1f, 1f - (float)i / 5f)); } } } private static bool FindShader() { if (_searched) { return (Object)(object)_shader != (Object)null; } _searched = true; string[] shaderCandidates = ShaderCandidates; for (int i = 0; i < shaderCandidates.Length; i++) { _shader = Shader.Find(shaderCandidates[i]); if ((Object)(object)_shader != (Object)null) { break; } } if ((Object)(object)_shader == (Object)null) { Logger.CreateLogSource("MT Paso").LogWarning((object)"No hay shader transparente para las siluetas (asset A-P1 pendiente)."); } return (Object)(object)_shader != (Object)null; } private static void Spawn(SkinnedMeshRenderer[] renderers, Transform root, Vector3 rootPos, Color color) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //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_0025: 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_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown //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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: 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_00c0: 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_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: 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_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Expected O, but got Unknown GameObject val = new GameObject("MT_Afterimage"); val.transform.SetPositionAndRotation(rootPos, root.rotation); Afterimage afterimage = val.AddComponent<Afterimage>(); afterimage._color = color; List<Material> list = new List<Material>(); foreach (SkinnedMeshRenderer val2 in renderers) { if (((Renderer)val2).enabled && ((Component)val2).gameObject.activeInHierarchy && !((Object)(object)val2.sharedMesh == (Object)null)) { Mesh val3 = new Mesh(); val2.BakeMesh(val3); GameObject val4 = new GameObject("part"); val4.transform.SetParent(val.transform, false); val4.transform.localPosition = root.InverseTransformPoint(((Component)val2).transform.position); val4.transform.localRotation = Quaternion.Inverse(root.rotation) * ((Component)val2).transform.rotation; val4.AddComponent<MeshFilter>().sharedMesh = val3; Material val5 = new Material(_shader) { color = color }; ((Renderer)val4.AddComponent<MeshRenderer>()).sharedMaterial = val5; list.Add(val5); } } afterimage._materials = list.ToArray(); } private void Update() { //IL_0066: Unknown result type (might be due to invalid IL or missing references) _age += Time.deltaTime; float num = Mathf.Clamp01(1f - _age / 0.35f); Material[] materials = _materials; for (int i = 0; i < materials.Length; i++) { materials[i].color = new Color(_color.r, _color.g, _color.b, _color.a * num); } if (_age >= 0.35f) { MeshFilter[] componentsInChildren = ((Component)this).GetComponentsInChildren<MeshFilter>(); for (int i = 0; i < componentsInChildren.Length; i++) { Object.Destroy((Object)(object)componentsInChildren[i].sharedMesh); } materials = _materials; for (int i = 0; i < materials.Length; i++) { Object.Destroy((Object)(object)materials[i]); } Object.Destroy((Object)(object)((Component)this).gameObject); } } } public static class Aire { private static bool _usedAirJump; private static bool _usedAirDash; private static float _lastImpulse = -999f; public const int NivelDobleSalto = 5; public const int NivelImpulso = 4; public const int NivelImpulsoAire = 8; private static Rigidbody Body(Player p) { return Traverse.Create((object)p).Field("m_body").GetValue<Rigidbody>(); } public static void Tick(Player p) { if (((Character)p).IsOnGround() || ((Character)p).IsSwimming()) { _usedAirJump = false; _usedAirDash = false; } } private static bool Pay(Player p, float cost) { if (!Manto.Active || Manto.Charge < cost * Manto.CostMultiplier(p)) { return false; } Manto.Spend(p, cost, true); return true; } private static void ResetFall(Player p) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) Traverse.Create((object)p).Field("m_maxAirAltitude").SetValue((object)((Component)p).transform.position.y); } public static bool TryAirJump(Player p) { //IL_005b: 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) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_009a: 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_00b6: Unknown result type (might be due to invalid IL or missing references) if (Estado.Levitando) { return false; } if (_usedAirJump || ((Character)p).IsOnGround() || ((Character)p).IsSwimming() || ((Character)p).IsAttached() || ToukiRules.Level(p) < 5) { return false; } if (!Pay(p, 8f)) { return false; } Rigidbody val = Body(p); if ((Object)(object)val == (Object)null) { return false; } _usedAirJump = true; Vector3 linearVelocity = val.linearVelocity; float num = ((Character)p).m_jumpForce * (1f + (float)ToukiRules.Level(p) * CoreConfig.SaltoPorNivel.Value); val.linearVelocity = new Vector3(linearVelocity.x, Mathf.Max(linearVelocity.y, 0f) + num, linearVelocity.z); ResetFall(p); Magia_FxBridge.Dust(((Component)p).transform.position); Manto.TrainDominio(p, 0.3f); return true; } public static bool TryDodgeImpulse(Player p, Vector3 dir) { //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: 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_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0189: 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_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) if (Estado.Levitando) { return false; } if (!Manto.Active || ((Character)p).IsAttached() || Time.time - _lastImpulse < 0.6f) { return false; } int num = ToukiRules.Level(p); Rigidbody val = Body(p); if ((Object)(object)val == (Object)null) { return false; } if (!((Character)p).IsOnGround() && !((Character)p).IsSwimming()) { if (_usedAirDash || num < 8 || !Pay(p, 12f)) { return false; } _usedAirDash = true; Vector3 val2 = (((Object)(object)GameCamera.instance != (Object)null) ? ((Component)GameCamera.instance).transform.forward : ((Component)p).transform.forward); val.linearVelocity = ((Vector3)(ref val2)).normalized * (12f + (float)num) + Vector3.up * 2f; } else { if (num < 4 || !((Character)p).IsRunning() || !Pay(p, 6f)) { return false; } dir.y = 0f; if (((Vector3)(ref dir)).sqrMagnitude < 0.01f) { dir = ((Component)p).transform.forward; } val.linearVelocity = ((Vector3)(ref dir)).normalized * (14f + (float)num * 0.8f) + Vector3.up * 1.5f; } _lastImpulse = Time.time; ResetFall(p); Magia_FxBridge.Dust(((Component)p).transform.position); if (MTPasoPlugin.Afterimages.Value) { Vector3 position = ((Component)p).transform.position; Vector3 position2 = ((Component)p).transform.position; Vector3 linearVelocity = val.linearVelocity; Afterimage.SpawnTrail(p, position, position2 + ((Vector3)(ref linearVelocity)).normalized * 3f, MTPasoPlugin.AfterimageColor.Value); } PasoController.MarkDash(); Manto.TrainDominio(p, 0.5f); return true; } } [HarmonyPatch(typeof(Character), "Jump")] public static class AirJumpPatch { private static bool Prefix(Character __instance) { Player val = (Player)(object)((__instance is Player) ? __instance : null); if (val == null || (Object)(object)val != (Object)(object)Player.m_localPlayer || ((Character)val).IsOnGround()) { return true; } return !Aire.TryAirJump(val); } } [HarmonyPatch(typeof(Player), "Dodge")] public static class DodgeImpulsePatch { private static bool Prefix(Player __instance, Vector3 dodgeDir) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance != (Object)(object)Player.m_localPlayer) { return true; } return !Aire.TryDodgeImpulse(__instance, dodgeDir); } } [BepInPlugin("mushokutensei.paso", "MT Paso", "1.8.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] public class MTPasoPlugin : BaseUnityPlugin { public const string Guid = "mushokutensei.paso"; public const string Version = "1.8.0"; public const string ButtonName = "MT_Paso"; public static ConfigEntry<bool> Afterimages; public static ConfigEntry<Color> AfterimageColor; private void Awake() { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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_00ad: Expected O, but got Unknown //IL_00be: Unknown result type (might be due to invalid IL or missing references) Tr.Load(typeof(MTPasoPlugin).Assembly, Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location)); Afterimages = ((BaseUnityPlugin)this).Config.Bind<bool>("Visual", "ImagenesResiduales", true, "Dibujar siluetas residuales durante el Paso de Tōki."); AfterimageColor = ((BaseUnityPlugin)this).Config.Bind<Color>("Visual", "ColorSiluetas", new Color(1f, 0.6f, 0.2f, 0.45f), "Color de las siluetas (el alfa es la transparencia)."); InputManager.Instance.AddButton("mushokutensei.paso", new ButtonConfig { Name = "MT_Paso", Key = (KeyCode)284, ActiveInCustomGUI = false }); ((Component)this).gameObject.AddComponent<PasoController>(); new Harmony("mushokutensei.paso").PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"MT Paso 1.8.0 cargado"); } } public class PasoController : MonoBehaviour { private const float InvulnerableSeconds = 0.15f; private float _cooldownUntil; public static float LastDashTime { get; private set; } = -9999f; public static bool Invulnerable => Time.time - LastDashTime < 0.15f; private static float Distance(int l) { return Mathf.Lerp(5f, 15f, (float)(l - 4) / 6f); } private static float Cost(int l) { return Mathf.Lerp(12f, 15f, (float)(l - 4) / 6f); } private static float Cooldown(int l) { return Mathf.Lerp(6f, 3f, (float)(l - 4) / 6f); } public static void MarkDash() { LastDashTime = Time.time; } private void Update() { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer != (Object)null) { Aire.Tick(localPlayer); } if ((Object)(object)localPlayer == (Object)null || ((Character)localPlayer).IsDead() || !MTKeys.Down(MTKeys.Paso) || !CanTakeInput()) { return; } int num = ToukiRules.Level(localPlayer); if (num < 4) { ((Character)localPlayer).Message((MessageType)1, Tr.Get("paso_need_toki_level_4"), 0, (Sprite)null, false); } else if (!Manto.Active) { ((Character)localPlayer).Message((MessageType)1, Tr.Get("paso_activate_toki_mantle_f1"), 0, (Sprite)null, false); } else if (!(Time.time < _cooldownUntil) && ((Character)localPlayer).IsOnGround() && !((Character)localPlayer).IsAttached() && !((Character)localPlayer).IsTeleporting()) { if (Manto.Charge < Cost(num) * Manto.CostMultiplier(localPlayer)) { ((Character)localPlayer).Message((MessageType)1, Tr.Get("paso_not_enough_toki"), 0, (Sprite)null, false); } else { Dash(localPlayer, num); } } } private static bool CanTakeInput() { if (((Object)(object)Chat.instance == (Object)null || !Chat.instance.HasFocus()) && !Console.IsVisible() && !Menu.IsVisible() && !InventoryGui.IsVisible() && !TextInput.IsVisible()) { return !Minimap.IsOpen(); } return false; } private void Dash(Player p, int level) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_009f: 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_00a8: 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_00b4: 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_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_010f: 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_0069: 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_0142: 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_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) Rigidbody value = Traverse.Create((object)p).Field("m_body").GetValue<Rigidbody>(); CapsuleCollider value2 = Traverse.Create((object)p).Field("m_collider").GetValue<CapsuleCollider>(); if ((Object)(object)value == (Object)null || (Object)(object)value2 == (Object)null) { return; } Vector3 val = Traverse.Create((object)p).Field("m_moveDir").GetValue<Vector3>(); if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { val = ((Component)p).transform.forward; } val.y = 0f; ((Vector3)(ref val)).Normalize(); float num = Distance(level); Vector3 position = value.position; float num2 = value2.radius * 0.9f; Vector3 val2 = position + Vector3.up * num2; Vector3 val3 = position + Vector3.up * (value2.height - num2); int mask = LayerMask.GetMask(new string[6] { "Default", "static_solid", "Default_small", "piece", "terrain", "vehicle" }); RaycastHit val4 = default(RaycastHit); if (Physics.CapsuleCast(val2, val3, num2, val, ref val4, num, mask, (QueryTriggerInteraction)1)) { num = Mathf.Max(0f, ((RaycastHit)(ref val4)).distance - 0.2f); } if (!(num < 1f)) { Vector3 val5 = position + val * num; RaycastHit val6 = default(RaycastHit); if (Physics.Raycast(val5 + Vector3.up * 2f, Vector3.down, ref val6, 6f, mask, (QueryTriggerInteraction)1)) { val5.y = ((RaycastHit)(ref val6)).point.y; } Manto.Spend(p, Cost(level), true); if (MTPasoPlugin.Afterimages.Value) { Afterimage.SpawnTrail(p, position, val5, MTPasoPlugin.AfterimageColor.Value); } value.position = val5; ((Component)p).transform.position = val5; value.linearVelocity = val * 2f; LastDashTime = Time.time; _cooldownUntil = Time.time + Cooldown(level); Manto.TrainDominio(p, 1f); } } } [HarmonyPatch(typeof(Character), "RPC_Damage")] public static class DashInvulnerablePatch { private static bool Prefix(Character __instance) { if ((Object)(object)__instance == (Object)(object)Player.m_localPlayer) { return !PasoController.Invulnerable; } return true; } } }