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 v3.19.27
plugins/MT.Aldeas/MT.Aldeas.dll
Decompiled a day 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 Jotunn.Configs; using Jotunn.Entities; using Jotunn.Managers; using MT.Aldeas.Creatures; using MT.Aldeas.Dialogos; using MT.Aldeas.Mundo; using MT.Core; using MT.Core.I18n; using MT.Core.Mapa; using MT.Core.Npc; using MT.Core.Planos; using MT.Core.Rueda; using MT.Dialogos.Rueda; 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.Aldeas")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+f72fd27a1cef3fefa2078e5313c902bbcd510c4b")] [assembly: AssemblyProduct("MT.Aldeas")] [assembly: AssemblyTitle("MT.Aldeas")] [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.Aldeas { [BepInPlugin("bryanrf.mushoku.aldeas", "MT Aldeas", "1.2.2")] [BepInDependency("mushokutensei.core", "2.99.36")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class MTAldeasPlugin : BaseUnityPlugin { public const string Guid = "bryanrf.mushoku.aldeas"; public const string Name = "MT Aldeas"; public const string Version = "1.2.2"; public static ManualLogSource Log; public static ConfigEntry<bool> MostrarEnMapa; private void Awake() { Log = ((BaseUnityPlugin)this).Logger; Tr.Load(typeof(MTAldeasPlugin).Assembly, Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location)); MostrarEnMapa = ((BaseUnityPlugin)this).Config.Bind<bool>("Map", "ShowVillages", false, "Mark villages on the map when you get close. Off: only teleport circles are marked."); Parches.Aplicar("bryanrf.mushoku.aldeas", typeof(MTAldeasPlugin).Assembly, ((BaseUnityPlugin)this).Logger); AldeanoCreature.Register(); AldeasEnMundo.Init(); RumoresAldea.Init(); Log.LogInfo((object)"MT Aldeas v1.2.2 cargado correctamente."); } } } namespace MT.Aldeas.Mundo { public static class AldeaRules { private struct Pieza { public string Prefab; public float X; public float Z; public float RotY; } public const string PlanoCasaGranjero = "aldea_casa_granjero"; public const string PlanoCasaLenador = "aldea_casa_lenador"; public const string PlanoPoblado = "aldea_poblado"; public const int ZonasPorCelda = 16; public const int UnaDeCada = 4; public const string PrefabAldeano = "MT_Aldeano"; private static readonly Pieza[] ElementosPlazaYHuerto = new Pieza[25] { new Pieza { Prefab = "fire_pit", X = 0f, Z = 0f, RotY = 0f }, new Pieza { Prefab = "wood_bench", X = -2.5f, Z = 0f, RotY = 90f }, new Pieza { Prefab = "wood_bench", X = 2.5f, Z = 0f, RotY = 270f }, new Pieza { Prefab = "wood_bench", X = 0f, Z = -2.5f, RotY = 0f }, new Pieza { Prefab = "piece_groundtorch_wood", X = -3.5f, Z = -3.5f, RotY = 45f }, new Pieza { Prefab = "piece_groundtorch_wood", X = 3.5f, Z = -3.5f, RotY = 315f }, new Pieza { Prefab = "wood_fence", X = 10f, Z = 6f, RotY = 0f }, new Pieza { Prefab = "wood_fence", X = 13f, Z = 6f, RotY = 0f }, new Pieza { Prefab = "wood_fence", X = 16f, Z = 6f, RotY = 0f }, new Pieza { Prefab = "wood_fence", X = 10f, Z = 12f, RotY = 0f }, new Pieza { Prefab = "wood_fence", X = 13f, Z = 12f, RotY = 0f }, new Pieza { Prefab = "wood_fence", X = 16f, Z = 12f, RotY = 0f }, new Pieza { Prefab = "wood_fence", X = 9f, Z = 8f, RotY = 90f }, new Pieza { Prefab = "wood_fence", X = 9f, Z = 10f, RotY = 90f }, new Pieza { Prefab = "wood_fence", X = 17f, Z = 8f, RotY = 90f }, new Pieza { Prefab = "wood_fence", X = 17f, Z = 10f, RotY = 90f }, new Pieza { Prefab = "Pickable_Carrot", X = 11.5f, Z = 8f, RotY = 0f }, new Pieza { Prefab = "Pickable_Carrot", X = 13.5f, Z = 8f, RotY = 0f }, new Pieza { Prefab = "Pickable_Carrot", X = 15.5f, Z = 8f, RotY = 0f }, new Pieza { Prefab = "Pickable_Turnip", X = 11.5f, Z = 10f, RotY = 0f }, new Pieza { Prefab = "Pickable_Turnip", X = 13.5f, Z = 10f, RotY = 0f }, new Pieza { Prefab = "Pickable_Turnip", X = 15.5f, Z = 10f, RotY = 0f }, new Pieza { Prefab = "wood_stack", X = -10f, Z = 6f, RotY = 0f }, new Pieza { Prefab = "wood_stack", X = -12f, Z = 6f, RotY = 0f }, new Pieza { Prefab = "piece_logbench", X = -11f, Z = 4f, RotY = 0f } }; public static List<PiezaPlano> GenerarPlaza() { //IL_0019: 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) List<PiezaPlano> list = new List<PiezaPlano>(); for (int i = 0; i < ElementosPlazaYHuerto.Length; i++) { Pieza pieza = ElementosPlazaYHuerto[i]; list.Add(new PiezaPlano { Nombre = pieza.Prefab, Px = pieza.X, Py = 0f, Pz = pieza.Z, Ry = pieza.RotY, Rw = 1f }); } return list; } public static bool TieneAldea(long mundo, int cx, int cy) { if (cx == 0 && cy == 0) { return false; } return CeldasRules.Toca(mundo, cx, cy, 7, 4); } public static void ZonaElegida(long mundo, int cx, int cy, out int zx, out int zy) { CeldasRules.Zona(mundo, cx, cy, 8, 16, 2, ref zx, ref zy); } public static string ClaveCelda(int cx, int cy) { return $"mt_aldea_c_{cx}_{cy}"; } } public static class AldeasEnMundo { private static bool _iniciado; public static void Init() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown if (!_iniciado) { _iniciado = true; RegistrarPlanosIncrustados(); GameObject val = new GameObject("MT_AldeasMundo"); Object.DontDestroyOnLoad((Object)(object)val); if (MTAldeasPlugin.MostrarEnMapa.Value) { val.AddComponent<AvistadorAldeas>(); } val.AddComponent<ColocadorAldeas>(); } } private static void RegistrarPlanosIncrustados() { Assembly assembly = typeof(AldeasEnMundo).Assembly; string[] manifestResourceNames = assembly.GetManifestResourceNames(); foreach (string text in manifestResourceNames) { if (!text.EndsWith(".blueprint")) { continue; } using Stream stream = assembly.GetManifestResourceStream(text); if (stream != null) { using StreamReader streamReader = new StreamReader(stream); string text2 = streamReader.ReadToEnd(); Planos.RegistrarIncrustado(Path.GetFileNameWithoutExtension(text.Replace("Planos/", "")), text2); } } List<PiezaPlano> list = AldeaRules.GenerarPlaza(); Planos.RegistrarIncrustado("aldea_poblado", PlanoRules.Escribir(list, "aldea_poblado", "MT")); } public static void MontarAldea(Vector3 centro, Quaternion rot) { //IL_0002: 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_002b: 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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0091: 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_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_00ac: 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_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //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) //IL_006b: 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_00c8: 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_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_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_0124: 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_0126: 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_0145: 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_014e: 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_0160: 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_016a: 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_0176: 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_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0181: 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_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0196: 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_019c: 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_00f0: 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_010a: 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) float y = ((Quaternion)(ref rot)).eulerAngles.y; int num = default(int); Planos.Colocar(AldeaRules.GenerarPlaza(), centro, y, 0L, false, true, ref num); List<PiezaPlano> list = Planos.Cargar("aldea_casa_granjero"); Vector3 val = centro + rot * new Vector3(14f, 0f, 4f); Quaternion val2; if (list != null) { val2 = rot * Quaternion.Euler(0f, 180f, 0f); Planos.Colocar(list, val, ((Quaternion)(ref val2)).eulerAngles.y, 0L, false, true, ref num); } List<PiezaPlano> list2 = Planos.Cargar("aldea_casa_lenador"); Vector3 val3 = centro + rot * new Vector3(-14f, 0f, 4f); if (list2 != null) { Planos.Colocar(list2, val3, y, 0L, false, true, ref num); } Vector3 val4 = centro + rot * new Vector3(0f, 0f, 16f); if (list != null) { val2 = rot * Quaternion.Euler(0f, 270f, 0f); Planos.Colocar(list, val4, ((Quaternion)(ref val2)).eulerAngles.y, 0L, false, true, ref num); } SpawnearAldeano(val, val + rot * new Vector3(0f, 0f, -4f), centro, RolAldeano.Granjero); SpawnearAldeano(val3, val3 + rot * new Vector3(0f, 0f, -4f), centro, RolAldeano.Lenador); SpawnearAldeano(val4, centro, centro, RolAldeano.Posadera); SpawnearAldeano(centro + rot * Vector3.back * 3f, centro, centro, RolAldeano.Anciano); } private static void SpawnearAldeano(Vector3 casa, Vector3 trabajo, Vector3 plaza, RolAldeano rol) { //IL_0022: 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_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_003f: Unknown result type (might be due to invalid IL or missing references) ZNetScene instance = ZNetScene.instance; GameObject val = ((instance != null) ? instance.GetPrefab("MT_Aldeano") : null); if (!((Object)(object)val == (Object)null)) { AldeanoNpc component = Object.Instantiate<GameObject>(val, trabajo, Quaternion.identity).GetComponent<AldeanoNpc>(); if ((Object)(object)component != (Object)null) { component.ConfigurarSitios(casa, trabajo, plaza, rol); } } } } public class AvistadorAldeas : MonoBehaviour { private const float Intervalo = 4f; private const float RadioAvistar = 800f; private float _siguiente; private void Update() { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_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_00fb: 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_0118: 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_012c: 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_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Invalid comparison between Unknown and I4 //IL_0142: 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_013b: Invalid comparison between Unknown and I4 if (Time.time < _siguiente) { return; } _siguiente = Time.time + 4f; Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null || (Object)(object)ZNet.instance == (Object)null || WorldGenerator.instance == null) { return; } long worldUID = ZNet.instance.GetWorldUID(); Vector3 position = ((Component)localPlayer).transform.position; int num = Mathf.FloorToInt((position.x + 32f) / 1024f); int num2 = Mathf.FloorToInt((position.z + 32f) / 1024f); Vector3 val = default(Vector3); for (int i = -1; i <= 1; i++) { for (int j = -1; j <= 1; j++) { int cx = num + i; int cy = num2 + j; if (!AldeaRules.TieneAldea(worldUID, cx, cy)) { continue; } AldeaRules.ZonaElegida(worldUID, cx, cy, out var zx, out var zy); ((Vector3)(ref val))..ctor((float)zx * 64f, 0f, (float)zy * 64f); if (Vector2.Distance(new Vector2(position.x, position.z), new Vector2(val.x, val.z)) <= 800f) { Biome biome = WorldGenerator.instance.GetBiome(val.x, val.z, 0.02f, false); if ((int)biome == 1 || (int)biome == 8) { MarcasLugares.Avistar("aldea_poblado", val); } } } } } } public class ColocadorAldeas : MonoBehaviour { private const float Intervalo = 12f; private float _siguiente; private readonly List<Vector3> _posiciones = new List<Vector3>(16); private readonly HashSet<long> _vacias = new HashSet<long>(); private static readonly RequisitosSitio Requisitos = new RequisitosSitio { Bioma = (Biome b) => (int)b == 1 || (int)b == 8, Huella = 22f, SobreAguaCentro = 3f, SobreAguaBorde = 2f, Desnivel = 2.5f }; private void Update() { //IL_0073: 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_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_00d3: 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_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_018b: 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_019a: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: 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_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0232: 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) if (Time.time < _siguiente) { return; } _siguiente = Time.time + 12f; ZNet instance = ZNet.instance; if ((Object)(object)instance == (Object)null || !instance.IsServer() || (Object)(object)ZoneSystem.instance == (Object)null || WorldGenerator.instance == null) { return; } _posiciones.Clear(); if ((Object)(object)Player.m_localPlayer != (Object)null) { _posiciones.Add(((Component)Player.m_localPlayer).transform.position); } List<ZNetPeer> peers = instance.GetPeers(); for (int i = 0; i < peers.Count; i++) { if (peers[i] != null) { _posiciones.Add(peers[i].m_refPos); } } long worldUID = instance.GetWorldUID(); Vector3 val2 = default(Vector3); float y = default(float); for (int j = 0; j < _posiciones.Count; j++) { Vector3 val = _posiciones[j]; int num = Mathf.FloorToInt((val.x + 32f) / 1024f); int num2 = Mathf.FloorToInt((val.z + 32f) / 1024f); if (!AldeaRules.TieneAldea(worldUID, num, num2)) { continue; } string text = AldeaRules.ClaveCelda(num, num2); if (ZoneSystem.instance.GetGlobalKey(text)) { continue; } AldeaRules.ZonaElegida(worldUID, num, num2, out var zx, out var zy); ((Vector3)(ref val2))..ctor((float)zx * 64f, 0f, (float)zy * 64f); long item = ((long)num << 32) ^ (uint)num2; if (_vacias.Contains(item)) { continue; } Vector2 val3 = new Vector2(val.x - val2.x, val.z - val2.z); if (((Vector2)(ref val3)).magnitude > 180f) { continue; } if (!SitiosTerreno.Vale(WorldGenerator.instance, val2.x, val2.z, Requisitos, ref y)) { _vacias.Add(item); continue; } val2.y = y; if (SitiosTerreno.HayBase(val2, 45f) || Location.IsInsideNoBuildLocation(val2) || EscudoGremio.Protege(val2)) { _vacias.Add(item); continue; } SitiosTerreno.Alisar(val2, 20f, 28f, 0f); AldeasEnMundo.MontarAldea(val2, Quaternion.identity); ZoneSystem.instance.SetGlobalKey(text); } } } } namespace MT.Aldeas.Dialogos { public static class RumoresAldea { [CompilerGenerated] private static class <>O { public static Proveedor <0>__ProveedorOpciones; } private static bool _iniciado; private static readonly string[] ClavesRumores = new string[6] { "aldeas_rumor_cosecha", "aldeas_rumor_bosque", "aldeas_rumor_clima", "aldeas_rumor_potencias", "aldeas_rumor_noche", "aldeas_rumor_viajeros" }; public static void Init() { //IL_0042: 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_004d: Expected O, but got Unknown if (!_iniciado) { _iniciado = true; ConversacionNpc.RegistrarConversable((Func<Character, bool>)((Character c) => (Object)(object)c != (Object)null && (Object)(object)((Component)c).GetComponent<AldeanoNpc>() != (Object)null)); object obj = <>O.<0>__ProveedorOpciones; if (obj == null) { Proveedor val = ProveedorOpciones; <>O.<0>__ProveedorOpciones = val; obj = (object)val; } ConversacionNpc.Registrar((Proveedor)obj, 50); } } private static void ProveedorOpciones(Character npc, Player jugador, List<RuedaOpcion> opciones) { //IL_0069: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)npc == (Object)null) && !((Object)(object)jugador == (Object)null) && !((Object)(object)((Component)npc).GetComponent<AldeanoNpc>() == (Object)null)) { opciones.Add(ConversacionNpc.Opcion(Tr.Get("aldeas_opcion_rumores"), Tr.Get("aldeas_opcion_rumores_d"), (Action<Player>)delegate(Player j) { ContarRumor(npc, j); }, new Color(1f, 0.84f, 0f), true, (string)null, "hablar", false, (string)null)); } } private static void ContarRumor(Character npc, Player jugador) { //IL_003f: 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) if (!((Object)(object)npc == (Object)null) && !((Object)(object)jugador == (Object)null)) { int num = Random.Range(0, ClavesRumores.Length); string text = Tr.Get(ClavesRumores[num]); Chat instance = Chat.instance; if (instance != null) { instance.SetNpcText(((Component)npc).gameObject, Vector3.up * 2.2f, 20f, 6f, npc.GetHoverName(), text, false); } ((Character)jugador).Message((MessageType)2, text, 0, (Sprite)null, false); } } } } namespace MT.Aldeas.Creatures { public static class AldeanoCreature { public const string PrefabName = "MT_Aldeano"; public static void Register() { //IL_0038: 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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown //IL_00a9: 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_0166: Expected O, but got Unknown //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Expected O, but got Unknown //IL_01c3: Unknown result type (might be due to invalid IL or missing references) string text = (((Object)(object)PrefabManager.Instance.GetPrefab("Skeleton") != (Object)null) ? "Skeleton" : "Draugr"); if (!((Object)(object)PrefabManager.Instance.GetPrefab(text) == (Object)null)) { CreatureConfig val = new CreatureConfig { Name = Tr.Token("aldeas_nombre_aldeano"), Faction = (Faction)0, Group = "Aldeanos" }; CustomCreature val2 = new CustomCreature("MT_Aldeano", text, val); GameObject prefab = val2.Prefab; CuerpoHumano.Aplicar(prefab); Humanoid component = prefab.GetComponent<Humanoid>(); if ((Object)(object)component != (Object)null) { ((Character)component).m_name = Tr.Token("aldeas_nombre_aldeano"); ((Character)component).m_faction = (Faction)0; ((Character)component).m_boss = false; ((Character)component).m_bossEvent = ""; ((Character)component).m_speed = 3.5f; ((Character)component).m_runSpeed = 6.5f; component.m_defaultItems = (GameObject[])(object)new GameObject[0]; component.m_randomWeapon = (GameObject[])(object)new GameObject[0]; component.m_randomArmor = (GameObject[])(object)new GameObject[0]; component.m_randomShield = (GameObject[])(object)new GameObject[0]; component.m_randomSets = (ItemSet[])(object)new ItemSet[0]; component.m_randomItems = (RandomItem[])(object)new RandomItem[0]; } MonsterAI component2 = prefab.GetComponent<MonsterAI>(); if ((Object)(object)component2 != (Object)null) { component2.m_attackPlayerObjects = false; ((BaseAI)component2).m_fleeRange = 20f; component2.m_fleeIfLowHealth = 1.01f; ((BaseAI)component2).m_idleSound = new EffectList(); ((BaseAI)component2).m_alertedEffects = new EffectList(); } CharacterDrop component3 = prefab.GetComponent<CharacterDrop>(); if ((Object)(object)component3 != (Object)null) { component3.m_drops.Clear(); } Humanizar.Aplicar(prefab, (Oficio)7, true, false, 20, -1); if ((Object)(object)prefab.GetComponent<AldeanoNpc>() == (Object)null) { prefab.AddComponent<AldeanoNpc>(); } (prefab.GetComponent<PersonalidadNpc>() ?? prefab.AddComponent<PersonalidadNpc>()).Arquetipo = (ArquetipoConducta)0; CreatureManager.Instance.AddCreature(val2); Debug.Log((object)"[MT.Aldeas] Criatura 'MT_Aldeano' registrada con éxito."); } } } public enum RolAldeano { Granjero, Lenador, Posadera, Anciano } public enum EstadoRutina { Trabajar, PlazaAtardecer, DormirNoche, Huyendo } public class AldeanoNpc : MonoBehaviour { private const string ZdoRol = "mt_aldeano_rol"; private const string ZdoCasa = "mt_aldeano_casa"; private const string ZdoTrabajo = "mt_aldeano_trabajo"; private const string ZdoPlaza = "mt_aldeano_plaza"; private const float Llegar = 3.2f; private const float RadioCama = 14f; private const float EsperaCama = 25f; private static readonly HashSet<Transform> CamasOcupadas = new HashSet<Transform>(); private static readonly Collider[] Cerca = (Collider[])(object)new Collider[64]; public RolAldeano Rol; public EstadoRutina Estado; private Character _character; private Humanoid _humanoid; private MonsterAI _ai; private ZNetView _nview; private ZSyncAnimation _anim; private Rigidbody _body; private Vector3 _posCasa; private Vector3 _posTrabajo; private Vector3 _posPlaza; private bool _puntosIniciados; private GameObject _punto; private float _siguienteChequeo; private float _siguienteGesto; private float _haciaCamaDesde = -1f; private float _agradecimientoEn = -1f; private string _herramientaEquipada; private string _bucle; private bool _trabajando; private bool _estabaHuyendo; private Transform _cama; private bool _acostado; private bool EnRed { get { if ((Object)(object)_anim != (Object)null && (Object)(object)_nview != (Object)null) { return _nview.IsValid(); } return false; } } private void Awake() { //IL_005d: Unknown result type (might be due to invalid IL or missing references) _character = ((Component)this).GetComponent<Character>(); _humanoid = ((Component)this).GetComponent<Humanoid>(); _ai = ((Component)this).GetComponent<MonsterAI>(); _nview = ((Component)this).GetComponent<ZNetView>(); _anim = ((Component)this).GetComponent<ZSyncAnimation>(); _body = ((Component)this).GetComponent<Rigidbody>(); if ((Object)(object)_character != (Object)null) { _character.m_faction = (Faction)0; } if ((Object)(object)_ai != (Object)null) { _ai.m_attackPlayerObjects = false; ((BaseAI)_ai).m_viewRange = 25f; ((BaseAI)_ai).m_hearRange = 25f; } if ((Object)(object)((Component)this).GetComponent<ArbitroIntencionNpc>() == (Object)null) { ((Component)this).gameObject.AddComponent<ArbitroIntencionNpc>(); } LeerRol(); } private void Start() { InicializarPuntos(); ActualizarFicha(); } private void OnDestroy() { Levantarse(); if ((Object)(object)_punto != (Object)null) { Object.Destroy((Object)(object)_punto); } } private ZDO Zdo() { if (!((Object)(object)_nview != (Object)null) || !_nview.IsValid()) { return null; } return _nview.GetZDO(); } private void LeerRol() { ZDO val = Zdo(); if (val == null) { return; } int num = val.GetInt("mt_aldeano_rol", -1); if (num < 0) { num = Mathf.Abs(SemillaNpc.De(val)) % 4; if (_nview.IsOwner()) { val.Set("mt_aldeano_rol", num); } } Rol = (RolAldeano)Mathf.Clamp(num, 0, 3); } private void InicializarPuntos() { //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_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007e: 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_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_00b4: 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_00bb: 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_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: 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_0048: 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_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_0066: 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_006c: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: 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) if (_puntosIniciados) { return; } ZDO val = Zdo(); Vector3 position = ((Component)this).transform.position; if (val != null && val.GetVec3("mt_aldeano_casa", Vector3.zero) != Vector3.zero) { _posCasa = val.GetVec3("mt_aldeano_casa", position); _posTrabajo = val.GetVec3("mt_aldeano_trabajo", position); _posPlaza = val.GetVec3("mt_aldeano_plaza", position); } else { _posCasa = position; _posTrabajo = position + Quaternion.Euler(0f, (float)Rol * 60f, 0f) * Vector3.forward * 5f; _posPlaza = position + Vector3.back * 10f; if (val != null && _nview.IsOwner()) { val.Set("mt_aldeano_casa", _posCasa); val.Set("mt_aldeano_trabajo", _posTrabajo); val.Set("mt_aldeano_plaza", _posPlaza); } } _puntosIniciados = true; } public void ConfigurarSitios(Vector3 casa, Vector3 trabajo, Vector3 plaza, RolAldeano rol) { //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_0010: 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_0017: 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_004f: 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_0071: Unknown result type (might be due to invalid IL or missing references) Rol = rol; _posCasa = casa; _posTrabajo = trabajo; _posPlaza = plaza; _puntosIniciados = true; ZDO val = Zdo(); if (val != null && _nview.IsOwner()) { val.Set("mt_aldeano_rol", (int)rol); val.Set("mt_aldeano_casa", _posCasa); val.Set("mt_aldeano_trabajo", _posTrabajo); val.Set("mt_aldeano_plaza", _posPlaza); } ActualizarFicha(); } private void ActualizarFicha() { FichaNpc val = FichaNpc.De(((Component)this).gameObject); string text = ((Rol == RolAldeano.Granjero) ? "aldeas_cargo_granjero" : ((Rol == RolAldeano.Lenador) ? "aldeas_cargo_lenador" : ((Rol == RolAldeano.Posadera) ? "aldeas_cargo_posadera" : "aldeas_cargo_anciano"))); val.Cargo = Tr.Get(text); string text2 = ((Rol == RolAldeano.Granjero) ? "aldeas_nombre_granjero" : ((Rol == RolAldeano.Lenador) ? "aldeas_nombre_lenador" : ((Rol == RolAldeano.Posadera) ? "aldeas_nombre_posadera" : "aldeas_nombre_anciano"))); if (string.IsNullOrEmpty(val.Nombre)) { val.Nombre = Tr.Get(text2); } if ((Object)(object)_character != (Object)null) { _character.m_name = val.Nombre; } } private void Update() { if (!((Object)(object)_character == (Object)null) && !_character.IsDead() && !((Object)(object)_ai == (Object)null) && !((Object)(object)_nview == (Object)null) && _nview.IsValid() && _nview.IsOwner() && !(Time.time < _siguienteChequeo)) { _siguienteChequeo = Time.time + 0.5f; Evaluar(); Ejecutar(); } } private void LateUpdate() { //IL_0023: 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_0073: 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) if (_acostado && !((Object)(object)_cama == (Object)null)) { ((Component)this).transform.position = _cama.position; ((Component)this).transform.rotation = _cama.rotation; if ((Object)(object)_body != (Object)null) { _body.useGravity = false; _body.linearVelocity = Vector3.zero; } _character.SetMoveDir(Vector3.zero); } } private void Evaluar() { //IL_006a: 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_009c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((BaseAI)_ai).GetTargetCreature() != (Object)null || Presas.EnPeligro(_character, 25f)) { Estado = EstadoRutina.Huyendo; _estabaHuyendo = true; return; } if (_estabaHuyendo) { _estabaHuyendo = false; if (Time.time >= _agradecimientoEn) { _agradecimientoEn = Time.time + 30f; if ((Object)(object)Player.GetClosestPlayer(((Component)this).transform.position, 8f) != (Object)null) { Chat instance = Chat.instance; if (instance != null) { instance.SetNpcText(((Component)this).gameObject, Vector3.up * 2f, 20f, 4f, _character.GetHoverName(), Tr.Get("aldeas_gracias_rescatado"), false); } } } } float num = (((Object)(object)EnvMan.instance != (Object)null) ? EnvMan.instance.GetDayFraction() : 0.4f); bool flag = (Object)(object)EnvMan.instance != (Object)null && EnvMan.IsNight(); Estado = ((flag || num > 0.85f || num < 0.2f) ? EstadoRutina.DormirNoche : ((num >= 0.7f) ? EstadoRutina.PlazaAtardecer : EstadoRutina.Trabajar)); } private void Ejecutar() { //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_0076: 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_0059: Unknown result type (might be due to invalid IL or missing references) if (Estado != EstadoRutina.DormirNoche) { Levantarse(); } if (Estado != EstadoRutina.Trabajar) { DejarTrabajo(); } switch (Estado) { case EstadoRutina.Huyendo: { Bucle(null); Character val = BuscarDefensorCercano(); if ((Object)(object)val != (Object)null) { Ir(((Component)val).transform.position); } else { Seguir(null); } break; } case EstadoRutina.DormirNoche: Dormir(); break; case EstadoRutina.PlazaAtardecer: if (Ir(_posPlaza)) { MirarHacia(_posPlaza); if (Time.time >= _siguienteGesto) { _siguienteGesto = Time.time + Random.Range(10f, 18f); Bucle((Random.value < 0.6f) ? "sit" : "kneel"); } } break; case EstadoRutina.Trabajar: EquiparHerramientaTrabajo(); if (Ir(_posTrabajo)) { Trabajar(); } break; } } private bool Ir(Vector3 destino) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0039: 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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown Vector3 val = destino - ((Component)this).transform.position; val.y = 0f; if (((Vector3)(ref val)).magnitude <= 3.2f) { Seguir(null); _character.SetMoveDir(Vector3.zero); return true; } Bucle(null); if ((Object)(object)_punto == (Object)null) { _punto = new GameObject("MT_PuntoAldeano"); } _punto.transform.position = destino; Seguir(_punto); return false; } private void Seguir(GameObject g) { if ((Object)(object)_ai.GetFollowTarget() != (Object)(object)g) { _ai.SetFollowTarget(g); } } private void Trabajar() { //IL_0033: 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) if (Time.time < _siguienteGesto || !EnRed) { return; } _siguienteGesto = Time.time + Random.Range(5f, 10f); MirarHacia(_posTrabajo + ((Component)this).transform.forward); switch (Rol) { case RolAldeano.Granjero: case RolAldeano.Lenador: _anim.SetTrigger("attack"); break; case RolAldeano.Posadera: if (!_trabajando) { _anim.SetInt("crafting", 1); _trabajando = true; } break; default: Bucle((Random.value < 0.5f) ? "relax" : "sit"); break; } } private void DejarTrabajo() { if (_trabajando && EnRed) { _anim.SetInt("crafting", 0); } _trabajando = false; DesequiparHerramienta(); } private void Dormir() { //IL_0033: 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) if (_acostado) { return; } if ((Object)(object)_cama == (Object)null) { _cama = BuscarCama(); } if ((Object)(object)_cama == (Object)null) { if (Ir(_posCasa) && Time.time >= _siguienteGesto) { _siguienteGesto = Time.time + 20f; Bucle("sit"); } return; } if (_haciaCamaDesde < 0f) { _haciaCamaDesde = Time.time; } if (Ir(_cama.position) || Time.time - _haciaCamaDesde > 25f) { Acostarse(); } } private Transform BuscarCama() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) int num = Physics.OverlapSphereNonAlloc(_posCasa, 14f, Cerca); Transform val = null; float num2 = float.MaxValue; for (int i = 0; i < num; i++) { Bed val2 = (((Object)(object)Cerca[i] != (Object)null) ? ((Component)Cerca[i]).GetComponentInParent<Bed>() : null); if (!((Object)(object)val2 == (Object)null) && !((Object)(object)val2.m_spawnPoint == (Object)null) && !CamasOcupadas.Contains(val2.m_spawnPoint)) { Vector3 val3 = val2.m_spawnPoint.position - _posCasa; float sqrMagnitude = ((Vector3)(ref val3)).sqrMagnitude; if (sqrMagnitude < num2) { num2 = sqrMagnitude; val = val2.m_spawnPoint; } } } if ((Object)(object)val != (Object)null) { CamasOcupadas.Add(val); } return val; } private void Acostarse() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) Seguir(null); Bucle(null); DesequiparHerramienta(); _acostado = true; ((Component)this).transform.position = _cama.position; if (EnRed) { _anim.SetBool("attach_bed", true); } } private void Levantarse() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //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) if (_acostado) { if (EnRed) { _anim.SetBool("attach_bed", false); } if ((Object)(object)_cama != (Object)null) { ((Component)this).transform.position = _cama.position + Vector3.up * 0.4f; } if ((Object)(object)_body != (Object)null) { _body.useGravity = true; } } _acostado = false; if ((Object)(object)_cama != (Object)null) { CamasOcupadas.Remove(_cama); } _cama = null; _haciaCamaDesde = -1f; } private void Bucle(string e) { if (e == _bucle) { return; } if (!EnRed) { _bucle = e; return; } if (_bucle == "sit") { _anim.SetBool("emote_sit", false); } if (_bucle != null) { _anim.SetTrigger("emote_stop"); } _bucle = e; if (e != null) { if (e == "sit") { _anim.SetBool("emote_sit", true); } else { _anim.SetTrigger("emote_" + e); } } } private void MirarHacia(Vector3 punto) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) Vector3 val = punto - ((Component)this).transform.position; val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude > 0.01f) { _character.SetLookDir(((Vector3)(ref val)).normalized, 0f); } } private void EquiparHerramientaTrabajo() { if (!((Object)(object)_humanoid == (Object)null) && !((Object)(object)ObjectDB.instance == (Object)null)) { string text = ((Rol == RolAldeano.Granjero) ? "Hoe" : ((Rol == RolAldeano.Lenador) ? "AxeStone" : null)); if (text != null && !(_herramientaEquipada == text)) { ArmaNpc.Empunar(_humanoid, (SkillType)0, new string[1] { text }); _herramientaEquipada = text; } } } private void DesequiparHerramienta() { if (!((Object)(object)_humanoid == (Object)null) && _herramientaEquipada != null) { _humanoid.HideHandItems(false, true); _herramientaEquipada = null; } } private Character BuscarDefensorCercano() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_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_00a5: 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) int num = Physics.OverlapSphereNonAlloc(((Component)this).transform.position, 35f, Cerca); Character result = null; float num2 = float.MaxValue; for (int i = 0; i < num; i++) { Collider val = Cerca[i]; if ((Object)(object)val == (Object)null) { continue; } Character componentInParent = ((Component)val).GetComponentInParent<Character>(); if (!((Object)(object)componentInParent == (Object)null) && !((Object)(object)componentInParent == (Object)(object)_character) && !componentInParent.IsDead() && (componentInParent is Player || (int)componentInParent.m_faction == 0 || (Object)(object)((Component)componentInParent).GetComponent<CompaneroNpc>() != (Object)null)) { Vector3 val2 = ((Component)componentInParent).transform.position - ((Component)this).transform.position; float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; if (sqrMagnitude < num2) { num2 = sqrMagnitude; result = componentInParent; } } } return result; } } }
plugins/MT.Comercio/MT.Comercio.dll
Decompiled a day 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; using BepInEx; using HarmonyLib; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Managers; using Jotunn.Utils; using MT.Comercio.Mercado; using MT.Core; using MT.Core.Economia; using MT.Core.Especialidades; using MT.Core.I18n; using MT.Core.Modelos; using MT.Core.Npc; using MT.Core.Registro; using MT.Core.Rueda; using MT.Core.UI; using MT.Dialogos.Rueda; 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.Comercio")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+f72fd27a1cef3fefa2078e5313c902bbcd510c4b")] [assembly: AssemblyProduct("MT.Comercio")] [assembly: AssemblyTitle("MT.Comercio")] [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.Comercio { public static class BancoRules { public const int SaldoMaximo = 100000000; public const int DiasMes = 30; public const float ComisionMes = 0.01f; public static int Leer(string texto) { if (string.IsNullOrEmpty(texto) || !int.TryParse(texto, NumberStyles.Integer, CultureInfo.InvariantCulture, out var result)) { return 0; } return Limitar(result); } public static string Escribir(int saldo) { return Limitar(saldo).ToString(CultureInfo.InvariantCulture); } public static int Ingresable(int saldo, int oro) { if (oro > 0) { return (int)Math.Min(oro, 100000000L - (long)Limitar(saldo)); } return 0; } public static int Retirable(int saldo, int oro) { if (oro > 0) { return Math.Min(oro, Limitar(saldo)); } return 0; } public static int CantidadValida(string texto, int maximo) { if (!int.TryParse(texto, NumberStyles.None, CultureInfo.InvariantCulture, out var result)) { return 0; } if (result <= 0 || result > maximo) { return 0; } return result; } public static int MesesCumplidos(double desdeDia, double hoyDia) { if (!(hoyDia <= desdeDia)) { return (int)Math.Floor((hoyDia - desdeDia) / 30.0); } return 0; } public static int Comision(int saldo, int meses) { saldo = Limitar(saldo); int num = 0; for (int i = 0; i < Math.Min(meses, 120); i++) { if (saldo <= 0) { break; } int num2 = Math.Max(1, (int)Math.Ceiling((float)saldo * 0.01f)); saldo -= num2; num += num2; } return num; } private static int Limitar(int v) { if (v >= 0) { if (v <= 100000000) { return v; } return 100000000; } return 0; } } public sealed class CuentaBanco : IBanco { private const string Clave = "MT.Banco."; public static readonly CuentaBanco Instancia = new CuentaBanco(); private const string ClaveCobro = "MT.Banco.cobro."; private static string ClaveMundo() { return "MT.Banco." + (((Object)(object)ZNet.instance != (Object)null) ? ZNet.instance.GetWorldUID() : 0); } public int Saldo(Player p) { if ((Object)(object)p == (Object)null) { return 0; } p.m_customData.TryGetValue(ClaveMundo(), out var value); return BancoRules.Leer(value); } public bool Ingresar(Player p, int oro, string motivo) { if ((Object)(object)p == (Object)null) { return false; } int num = Saldo(p); int num2 = BancoRules.Ingresable(num, oro); if (num2 <= 0) { return false; } Guardar(p, num + num2); if (!string.IsNullOrEmpty(motivo) && (Object)(object)p == (Object)(object)Player.m_localPlayer) { ((Character)p).Message((MessageType)1, Tr.Get("banco_ingreso", new object[2] { num2, Tr.Get(motivo) }), 0, (Sprite)null, false); } return true; } public bool Retirar(Player p, int oro) { if ((Object)(object)p == (Object)null) { return false; } int num = Saldo(p); int num2 = BancoRules.Retirable(num, oro); if (num2 <= 0 || num2 != oro) { return false; } Guardar(p, num - num2); return true; } public int CobrarComision(Player p) { if ((Object)(object)p == (Object)null || (Object)(object)ZNet.instance == (Object)null) { return 0; } CultureInfo invariantCulture = CultureInfo.InvariantCulture; double num = ZNet.instance.GetTimeSeconds() / 1800.0; string key = "MT.Banco.cobro." + ZNet.instance.GetWorldUID(); if (!p.m_customData.TryGetValue(key, out var value) || !double.TryParse(value, NumberStyles.Float, invariantCulture, out var result) || double.IsNaN(result) || result > num) { p.m_customData[key] = num.ToString("0.##", invariantCulture); return 0; } int num2 = BancoRules.MesesCumplidos(result, num); if (num2 <= 0) { return 0; } int num3 = Saldo(p); int num4 = BancoRules.Comision(num3, num2); Guardar(p, num3 - num4); p.m_customData[key] = (result + (double)(num2 * 30)).ToString("0.##", invariantCulture); TesoroGremio.Sumar(num4); return num4; } private static void Guardar(Player p, int saldo) { p.m_customData[ClaveMundo()] = BancoRules.Escribir(saldo); } } public class PiezaBanco : MonoBehaviour, Interactable, Hoverable { public const string PrefabName = "MT_Banco"; public bool Interact(Humanoid user, bool hold, bool alt) { if (!hold) { Player val = (Player)(object)((user is Player) ? user : null); if (val != null && !((Object)(object)val != (Object)(object)Player.m_localPlayer)) { VentanaBanco.Abrir(((Component)this).transform); return true; } } return false; } public bool UseItem(Humanoid user, ItemData item) { return false; } public string GetHoverText() { Player localPlayer = Player.m_localPlayer; int num = (((Object)(object)localPlayer != (Object)null) ? CuentaBanco.Instancia.Saldo(localPlayer) : 0); return Tr.Get("banco_nombre") + "\n" + Tr.Get("banco_saldo", new object[1] { num }) + "\n[<color=yellow><b>" + TeclasHover.Usar + "</b></color>] " + Tr.Get("banco_abrir"); } public string GetHoverName() { return Tr.Get("banco_nombre"); } public float GetHoverOffset() { return 1.5f; } public static void Register() { //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_002f: 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_004f: 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_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Expected O, but got Unknown //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Expected O, but got Unknown GameObject prefab = PrefabManager.Instance.GetPrefab("piece_table"); if (!((Object)(object)prefab == (Object)null)) { PieceConfig val = new PieceConfig { Name = Tr.Token("banco_nombre"), Description = Tr.Token("banco_desc"), Icon = Iconos.Get("servicio_banco"), PieceTable = "_HammerPieceTable", Category = ((object)(PieceCategory)0/*cast due to .constrained prefix*/).ToString() }; val.AddRequirement(new RequirementConfig("FineWood", 10, 0, true)); val.AddRequirement(new RequirementConfig("Bronze", 2, 0, true)); CustomPiece val2 = new CustomPiece("MT_Banco", ((Object)prefab).name, val); if (!((Object)(object)val2.PiecePrefab == (Object)null)) { ModeloEmbebido.PonerEnPieza(typeof(PiezaBanco).Assembly, val2.PiecePrefab, "banco_gremio", 1f, false, false); val2.PiecePrefab.AddComponent<PiezaBanco>(); PieceManager.Instance.AddPiece(val2); } } } } public class VentanaBanco : MonoBehaviour { private static Texture2D _icono; private const float Ancho = 720f; private const float Alto = 226f; private const float AltoHoja = 72f; private const float DistanciaMax = 6f; private static string _cantidad = "0"; private static float _refresco; private static Transform _banco; private static bool _abierta; private static int _saldo; private static int _encima; private static string _mensaje = ""; private static bool _mensajeBueno; public static bool Abierta => _abierta; public static void Abrir(Transform banco) { if (_abierta) { Cerrar(); } _banco = banco; _abierta = true; _mensaje = ""; _refresco = 0f; SonidosVanilla.AbrirCofre(banco); int num = CuentaBanco.Instancia.CobrarComision(Player.m_localPlayer); if (num > 0) { _mensaje = Tr.Get("banco_comision", new object[2] { num, 30 }); } Refrescar(Player.m_localPlayer); int num2 = BancoRules.Ingresable(_saldo, _encima); _cantidad = ((num2 > 0) ? num2.ToString() : ((_encima > 0) ? _encima.ToString() : "0")); MediadorFocoUI.SolicitarFoco("VentanaBanco", true, (Action)Cerrar); } public static void Cerrar() { if (_abierta) { _abierta = false; _banco = null; MediadorFocoUI.LiberarFoco("VentanaBanco"); BloqueoClic.Bloquear(0.35f); } } private void Awake() { _icono = Iconos.Textura("UI/ventana_banco.png"); } private void OnDisable() { Cerrar(); } private void Update() { //IL_0032: 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) if (_abierta) { Player localPlayer = Player.m_localPlayer; if ((Object)(object)_banco == (Object)null || (Object)(object)localPlayer == (Object)null || ((Character)localPlayer).IsDead() || Vector3.Distance(((Component)localPlayer).transform.position, _banco.position) > 6f || InventoryGui.IsVisible() || Menu.IsVisible() || Console.IsVisible()) { Cerrar(); } else if (Time.unscaledTime >= _refresco) { _refresco = Time.unscaledTime + 0.5f; Refrescar(localPlayer); } } } private static void Refrescar(Player p) { _saldo = CuentaBanco.Instancia.Saldo(p); _encima = (((Object)(object)p != (Object)null) ? Monedas.Contar(((Humanoid)p).GetInventory()) : 0); } private void OnGUI() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Invalid comparison between Unknown and I4 //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Invalid comparison between Unknown and I4 //IL_009d: 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_00a8: 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_0107: 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_0169: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_banco == (Object)null) { return; } Event current = Event.current; if ((int)current.type == 4 && (int)current.keyCode == 27) { Cerrar(); VentanasEsc.EscUsado(); current.Use(); return; } Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { Cerrar(); return; } int depth = GUI.depth; try { GUI.depth = -50; float num = PanelServicio.Escala(UiPergamino.Px(720f, 1f), UiPergamino.Px(226f, 1f)); Rect val = UiPergamino.Ventana(PanelServicio.Centrado(UiPergamino.Px(720f, 1f), UiPergamino.Px(226f, 1f), num), num); float num2 = ((Rect)(ref val)).y + UiPergamino.Cabecera(val, num, _icono, Tr.Get("banco_nombre"), (string)null, (Letra)null, false); float num3 = UiPergamino.Px(10f, num); float num4 = (((Rect)(ref val)).width - num3) / 2f; float num5 = UiPergamino.Px(72f, num); Saldo(new Rect(((Rect)(ref val)).x, num2, num4, num5), num, "banco_cuenta", _saldo); Saldo(new Rect(((Rect)(ref val)).x + num4 + num3, num2, num4, num5), num, "banco_bolsa", _encima); num2 += num5 + num3; if (Operaciones(new Rect(((Rect)(ref val)).x, num2, ((Rect)(ref val)).width, UiPergamino.Px(26f, num)), num, localPlayer)) { Cerrar(); return; } num2 += UiPergamino.Px(32f, num); bool flag = _mensaje.Length > 0 && !_mensajeBueno; string text = ((_mensaje.Length > 0) ? _mensaje : Tr.Get("banco_cerrar")); UiPergamino.Escribir(new Rect(((Rect)(ref val)).x, num2, ((Rect)(ref val)).width, UiPergamino.Px(16f, num)), text, flag ? Letra.MaderaSuave : Letra.Pie, num, (TextAnchor)3, true); } finally { GUI.depth = depth; } } private static void Saldo(Rect area, float s, string clave, int valor) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0003: 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) //IL_003a: Unknown result type (might be due to invalid IL or missing references) Rect val = UiPergamino.Hoja(area, s, false); float y = ((Rect)(ref val)).y; UiPergamino.Encabezado(ref y, val, Tr.Get(clave), s); UiPergamino.Oro(new Rect(((Rect)(ref val)).x, y, ((Rect)(ref val)).width, UiPergamino.Px(25f, s)), valor, Letra.Cifra, s, (TextAnchor)3); } private static bool Operaciones(Rect fila, float s, Player p) { //IL_002c: 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) float num = UiPergamino.Ancho(Tr.Get("banco_cantidad"), Letra.Madera, s); UiPergamino.Escribir(new Rect(((Rect)(ref fila)).x, ((Rect)(ref fila)).y, num, ((Rect)(ref fila)).height), Tr.Get("banco_cantidad"), Letra.Madera, s, (TextAnchor)3, false); float num2 = ((Rect)(ref fila)).x + num + UiPergamino.Px(8f, s); Rect val = default(Rect); ((Rect)(ref val))..ctor(num2, ((Rect)(ref fila)).y, UiPergamino.Px(90f, s), ((Rect)(ref fila)).height); string text = UiPergamino.CampoTexto(val, "MT.Banco.Cantidad", _cantidad, 10, s); if (text != _cantidad) { _cantidad = text; _mensaje = ""; } num2 = ((Rect)(ref val)).xMax + UiPergamino.Px(8f, s); if (UiPergamino.BotonIzquierda(ref num2, ((Rect)(ref fila)).y, Tr.Get("banco_ingresar"), s)) { Operar(p, ingresar: true); } if (UiPergamino.BotonIzquierda(ref num2, ((Rect)(ref fila)).y, Tr.Get("banco_retirar"), s)) { Operar(p, ingresar: false); } float xMax = ((Rect)(ref fila)).xMax; return UiPergamino.BotonDerecha(ref xMax, ((Rect)(ref fila)).y, Tr.Get("core_ui_cerrar"), s); } private static void Operar(Player p, bool ingresar) { GUI.FocusControl((string)null); Refrescar(p); int num = (ingresar ? BancoRules.Ingresable(_saldo, _encima) : _saldo); int num2 = BancoRules.CantidadValida(_cantidad, num); if (num2 <= 0) { Aviso(bueno: false, Tr.Get("banco_limite", new object[1] { num })); return; } if (ingresar) { Ingresar(p, num2); } else { Retirar(p, num2); } Refrescar(p); int num3 = BancoRules.Ingresable(_saldo, _encima); _cantidad = ((num3 > 0) ? num3.ToString() : ((_encima > 0) ? _encima.ToString() : "0")); } private static void Ingresar(Player p, int pedido) { int oro = Mathf.Min(pedido, Monedas.Contar(((Humanoid)p).GetInventory())); oro = BancoRules.Ingresable(CuentaBanco.Instancia.Saldo(p), oro); if (oro <= 0) { Aviso(bueno: false, Tr.Get("banco_sin_oro")); return; } if (!Monedas.Retirar(((Humanoid)p).GetInventory(), oro)) { Aviso(bueno: false, Tr.Get("banco_sin_oro")); return; } CuentaBanco.Instancia.Ingresar(p, oro, null); Aviso(bueno: true, Tr.Get("banco_ingresado", new object[1] { oro })); } private static void Retirar(Player p, int pedido) { int num = BancoRules.Retirable(CuentaBanco.Instancia.Saldo(p), pedido); if (num <= 0) { Aviso(bueno: false, Tr.Get("banco_sin_saldo")); return; } GameObject val = (((Object)(object)ObjectDB.instance != (Object)null) ? ObjectDB.instance.GetItemPrefab("Coins") : null); Inventory inventory = ((Humanoid)p).GetInventory(); if ((Object)(object)val == (Object)null || !inventory.CanAddItem(val, num)) { Aviso(bueno: false, Tr.Get("banco_inventario_lleno")); } else if (CuentaBanco.Instancia.Retirar(p, num)) { inventory.AddItem(val, num); Aviso(bueno: true, Tr.Get("banco_retirado", new object[1] { num })); } } private static void Aviso(bool bueno, string texto) { _mensaje = texto; _mensajeBueno = bueno; } } public class PerfilComercio { public string Id; public string NombreKey; public Categoria[] Oficio = (Categoria[])(object)new Categoria[0]; public Categoria[] Compra = (Categoria[])(object)new Categoria[0]; public Categoria[] NoCompra = (Categoria[])(object)new Categoria[0]; public float Afinidad = 0.6f; public int OroMaximo = 600; public List<OfertaComercio> Ofertas = new List<OfertaComercio>(); public float AfinidadCon(Categoria c) { //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_0037: Unknown result type (might be due to invalid IL or missing references) if (Contiene(NoCompra, c)) { return 0f; } if (Contiene(Oficio, c)) { return 1f; } if (Compra.Length != 0 && !Contiene(Compra, c)) { return 0f; } return Afinidad; } public Categoria[] Demandables() { List<Categoria> list = new List<Categoria>(Oficio); for (int i = 0; i < Compra.Length; i++) { if (!list.Contains(Compra[i])) { list.Add(Compra[i]); } } if (list.Count == 0) { for (int j = 0; j < 10; j++) { if (!Contiene(NoCompra, (Categoria)j)) { list.Add((Categoria)j); } } } return list.ToArray(); } private static bool Contiene(Categoria[] a, Categoria c) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between I4 and Unknown for (int i = 0; i < a.Length; i++) { if ((int)a[i] == (int)c) { return true; } } return false; } } public class ComercianteNpc : MonoBehaviour, ITienda, ITiendaNpc { private const string ZdoStock = "mt_com_stock"; private const string ZdoOro = "mt_com_oro"; private const string ZdoReposicion = "mt_com_t"; private const string ZdoDiaRotacion = "mt_com_dia"; private const string ClaveReputacion = "mt_com_rep_"; public PerfilComercio Perfil; public bool EnRueda; public Func<Player, bool> Disponible; private ZNetView _nview; private readonly List<Existencia> _stock = new List<Existencia>(); private readonly HashSet<string> _selectos = new HashSet<string>(); private int _peligro = -1; private static readonly List<ComercianteNpc> Todos = new List<ComercianteNpc>(); private int _semillaEstable; public Biome Bioma { get { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) if (WorldGenerator.instance == null) { return (Biome)1; } return WorldGenerator.instance.GetBiome(((Component)this).transform.position); } } public int BiomaInt => (int)Bioma; public RumorMercado RumorHoy => MercadoVivoRules.ObtenerRumor(Dia, SemillaMercader); public EstadoLiquidez Sentimiento => MercadoVivoRules.ObtenerSentimiento(Oro, (Perfil != null) ? Perfil.OroMaximo : 1000); public bool ZonaPeligrosa { get { //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_0027: 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_002f: Invalid comparison between Unknown and I4 if (_peligro < 0 && WorldGenerator.instance != null) { Biome biome = WorldGenerator.instance.GetBiome(((Component)this).transform.position); _peligro = (((biome & 0x260) > 0) ? 1 : 0); } return _peligro == 1; } } public bool EsPropio { get { if ((Object)(object)_nview != (Object)null && _nview.IsValid()) { return _nview.IsOwner(); } return false; } } public string Nombre { get { if (Perfil == null) { return ""; } return Tr.Get(Perfil.NombreKey); } } public List<Existencia> Existencias => _stock; public int Oro { get { ZDO obj = Zdo(); if (obj == null) { return 0; } return obj.GetInt("mt_com_oro", (Perfil != null) ? Perfil.OroMaximo : 0); } } public long Dia { get { if (!((Object)(object)EnvMan.instance != (Object)null)) { return (long)(Ahora() / 1800.0); } return EnvMan.instance.GetDay(); } } public int SemillaMercader { get { if (_semillaEstable != 0) { return _semillaEstable; } int num = ((Perfil != null) ? StringExtensionMethods.GetStableHashCode(Perfil.Id) : 0); if ((Object)(object)_nview == (Object)null) { _nview = ((Component)this).GetComponent<ZNetView>() ?? ((Component)this).GetComponentInParent<ZNetView>(); } ZDO val = (((Object)(object)_nview != (Object)null && _nview.IsValid()) ? _nview.GetZDO() : null); if (val != null) { num ^= SemillaNpc.De(val); _semillaEstable = ((num == 0) ? 1 : num); return _semillaEstable; } return num ^ StringExtensionMethods.GetStableHashCode(((Object)((Component)this).gameObject).name); } } public Categoria DemandaHoy { get { int num = ComercioRules.DemandaDelDia(Dia, SemillaMercader, (Perfil != null) ? Perfil.Demandables() : null); if (num < 0) { return (Categoria)9; } return (Categoria)num; } } public bool SoloVende { get { if (Perfil != null && Perfil.OroMaximo <= 0) { return Perfil.Demandables().Length == 0; } return false; } } public int UltimaCompraNpc { get; private set; } public bool DisponiblePara(Player p) { if ((Object)(object)p != (Object)null) { if (Disponible != null) { return Disponible(p); } return true; } return false; } public int RangoRequerido(string id) { if (!_selectos.Contains(id)) { return -1; } return SelectosRules.RangoPara(ZonaPeligrosa); } public bool PuedeComprar(Player p, string id) { if (RangoRequerido(id) >= 0) { return Gremio.Rango(p) >= RangoRequerido(id); } return true; } public static ComercianteNpc Agregar(GameObject go, PerfilComercio perfil) { if ((Object)(object)go == (Object)null || perfil == null) { return null; } ComercianteNpc obj = go.GetComponent<ComercianteNpc>() ?? go.AddComponent<ComercianteNpc>(); obj.Perfil = perfil; return obj; } private void Awake() { _nview = ((Component)this).GetComponent<ZNetView>() ?? ((Component)this).GetComponentInParent<ZNetView>(); } private void OnEnable() { if (!Todos.Contains(this)) { Todos.Add(this); } } private void OnDisable() { Todos.Remove(this); } public static ComercianteNpc Cercano(Vector3 p, float radio) { //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_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) ComercianteNpc result = null; float num = radio * radio; for (int i = 0; i < Todos.Count; i++) { ComercianteNpc comercianteNpc = Todos[i]; if (!((Object)(object)comercianteNpc == (Object)null) && comercianteNpc.Perfil != null) { Vector3 val = ((Component)comercianteNpc).transform.position - p; float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude; if (sqrMagnitude <= num) { num = sqrMagnitude; result = comercianteNpc; } } } return result; } private ZDO Zdo() { if (!((Object)(object)_nview != (Object)null) || !_nview.IsValid()) { return null; } return _nview.GetZDO(); } private static double Ahora() { if (!((Object)(object)ZNet.instance != (Object)null)) { return Time.time; } return ZNet.instance.GetTimeSeconds(); } public bool Abrir(Player jugador) { ZDO val = Zdo(); if ((Object)(object)jugador == (Object)null || val == null || Perfil == null || !DisponiblePara(jugador)) { return false; } if (!_nview.IsOwner()) { _nview.ClaimOwnership(); } Cargar(); VentanaComercio.Abrir(this, jugador); return true; } public void Cargar() { ZDO val = Zdo(); _stock.Clear(); if (val == null || Perfil == null) { return; } _stock.AddRange(ComercioRules.Leer(val.GetString("mt_com_stock", ""))); double num = Ahora(); long num2 = val.GetLong("mt_com_t", -1L); long num3 = val.GetLong("mt_com_dia", -1L); long dia = Dia; bool flag = num2 < 0 || num3 < 0; float num4 = ((num2 < 0) ? 0f : ((float)((num - (double)num2) / 1800.0))); List<OfertaComercio> list = new List<OfertaComercio>(); string text = SelectosRules.Siguiente(Perfil.Ofertas, Desbloqueado); _selectos.Clear(); for (int i = 0; i < Perfil.Ofertas.Count; i++) { OfertaComercio ofertaComercio = Perfil.Ofertas[i]; if (Desbloqueado(ofertaComercio.JefeRequerido)) { list.Add(ofertaComercio); } else if (text != null && ofertaComercio.JefeRequerido == text) { list.Add(ofertaComercio); _selectos.Add(ofertaComercio.Prefab); } } int extra = SelectosRules.Extra(ZonaPeligrosa); int count = list.FindAll((OfertaComercio o) => o.Fija).Count; int num5 = count + ComercioRules.ContarOfertasActivas(list.Count - count, extra); int num6 = 0; for (int num7 = 0; num7 < _stock.Count; num7++) { if (_stock[num7].Objetivo > 0) { num6++; } } bool flag2 = num6 > num5 && num6 >= list.Count && list.Count > 3; bool flag3 = flag || num3 != dia || num4 >= 0.95f || flag2; if (flag3) { ComercioRules.RotarStock(_stock, list, dia, SemillaMercader, flag || flag2, extra); } if (num4 >= 0.05f || flag) { ComercioRules.ReponerTodo(_stock, num4); int cantidad = val.GetInt("mt_com_oro", Perfil.OroMaximo); cantidad = ComercioRules.Reponer(cantidad, Perfil.OroMaximo, num4); MercadoVivoRules.SimularTrafico(_stock, ref cantidad, Perfil.OroMaximo, num4, SemillaMercader, dia, BiomaInt); if (EsPropio) { val.Set("mt_com_oro", cantidad); val.Set("mt_com_t", (long)num); val.Set("mt_com_dia", dia); Guardar(); } } else if (flag3 && EsPropio) { val.Set("mt_com_dia", dia); Guardar(); } } private void Guardar() { ZDO obj = Zdo(); if (obj != null) { obj.Set("mt_com_stock", ComercioRules.Escribir(_stock)); } } private static bool Desbloqueado(string jefe) { if (!string.IsNullOrEmpty(jefe)) { if ((Object)(object)ZoneSystem.instance != (Object)null) { return ZoneSystem.instance.GetGlobalKey(jefe); } return false; } return true; } public static int Reputacion(Player p, PerfilComercio perfil) { if (!((Object)(object)p != (Object)null) || perfil == null || !p.m_customData.TryGetValue("mt_com_rep_" + perfil.Id, out var value) || !int.TryParse(value, out var result)) { return 0; } return result; } private static void SumarReputacion(Player p, PerfilComercio perfil, int monedas) { int num = Mathf.Min(20000, Reputacion(p, perfil) + monedas); p.m_customData["mt_com_rep_" + perfil.Id] = num.ToString(); } public float Descuento(Player p) { return ComercioRules.BonoReputacion(Reputacion(p, Perfil)) + Gremio.Discount(p) * (CoreConfig.DescuentosGremio.Value ? 1f : 0f); } public float ValorBaseCompra(string id) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0015: 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_0027: Unknown result type (might be due to invalid IL or missing references) float num = MercadoMundo.Valor(id); Categoria val = ValorObjeto.CategoriaDe(id); num *= MercadoVivoRules.FactorBiomaCompra(BiomaInt, val, id); RumorMercado rumorHoy = RumorHoy; if (val == rumorHoy.CategoriaAfectada) { num *= rumorHoy.FactorOferta; } return num; } public float ValorBaseVenta(ItemData item) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: 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_002e: Unknown result type (might be due to invalid IL or missing references) float num = MercadoMundo.Valor(item); Categoria val = ValorObjeto.CategoriaDe(item); string id = ValorObjeto.Id(item); num *= MercadoVivoRules.FactorBiomaVenta(BiomaInt, val, id); RumorMercado rumorHoy = RumorHoy; if (val == rumorHoy.CategoriaAfectada) { num *= rumorHoy.FactorDemanda; } return num; } public int PrecioCompra(Player p, Existencia e) { return ComercioRules.PrecioCompra(ValorBaseCompra(e.Id), e.Cantidad, e.Objetivo, Descuento(p)); } public int PrecioVenta(Player p, ItemData item) { //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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) string text = ValorObjeto.Id(item); if (text == null || item.m_equipped || Perfil == null) { return 0; } Categoria val = ValorObjeto.CategoriaDe(item); int num = ComercioRules.Buscar(_stock, text); int cantidad = ((num >= 0) ? _stock[num].Cantidad : 0); int objetivo = ((num >= 0) ? _stock[num].Objetivo : 0); return ComercioRules.PrecioVenta(ValorBaseVenta(item), cantidad, objetivo, Perfil.AfinidadCon(val), val == DemandaHoy, ComercioRules.BonoReputacion(Reputacion(p, Perfil)), ValorObjeto.Estado(item)); } public int PrecioTotal(Player p, string id, int cantidad) { int num = ComercioRules.Buscar(_stock, id); if (num < 0) { return 0; } int num2 = 0; Existencia existencia = _stock[num]; float valorBase = ValorBaseCompra(id); float descuento = Descuento(p); for (int i = 0; i < cantidad; i++) { if (existencia.Cantidad <= 0) { break; } num2 += ComercioRules.PrecioCompra(MercadoMundo.ValorTrasFlujo(id, valorBase, -i), existencia.Cantidad, existencia.Objetivo, descuento); existencia.Cantidad--; } return num2; } public bool Comprar(Player p, string id, int cantidad, out string mensaje) { mensaje = ComprarInterno(p, id, cantidad, out var ok); return ok; } private string ComprarInterno(Player p, string id, int cantidad, out bool ok) { ok = false; if (!EsPropio) { return Tr.Get("com_busy"); } int num = ComercioRules.Buscar(_stock, id); if (num < 0 || _stock[num].Cantidad <= 0) { return Tr.Get("com_sold_out"); } if (!PuedeComprar(p, id)) { return MotivoRango(id); } cantidad = Mathf.Min(cantidad, _stock[num].Cantidad); GameObject val = (((Object)(object)ObjectDB.instance != (Object)null) ? ObjectDB.instance.GetItemPrefab(id) : null); if ((Object)(object)val == (Object)null || ValorObjeto.ValorPrefab(id) <= 0f) { return Tr.Get("com_sold_out"); } int num2 = PrecioTotal(p, id, cantidad); Inventory inventory = ((Humanoid)p).GetInventory(); if (!Monedas.Tiene(inventory, num2)) { return Tr.Get("com_no_gold", new object[1] { num2 }); } if (!inventory.CanAddItem(val, cantidad)) { return Tr.Get("com_no_room"); } Monedas.Retirar(inventory, num2); inventory.AddItem(val, cantidad); ComercioRules.Restar(_stock, id, cantidad); Zdo().Set("mt_com_oro", Mathf.Min(Perfil.OroMaximo * 3, Oro + num2)); Guardar(); SumarReputacion(p, Perfil, num2); MercadoMundo.Flujo(id, -cantidad); ok = true; return Tr.Get("com_bought", new object[3] { Localizar(val), cantidad, num2 }); } public int PrecioTotalVenta(Player p, ItemData item, int cantidad) { //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_007e: 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_0088: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)p == (Object)null || item == null || cantidad <= 0 || cantidad > item.m_stack) { return 0; } string id = ValorObjeto.Id(item); int num = 0; int num2 = ComercioRules.Buscar(_stock, id); Existencia existencia = ((num2 >= 0) ? _stock[num2] : new Existencia(id, 0, 0)); float valorBase = ValorBaseVenta(item); Categoria val = ValorObjeto.CategoriaDe(item); for (int i = 0; i < cantidad; i++) { int num3 = ComercioRules.PrecioVenta(MercadoMundo.ValorTrasFlujo(id, valorBase, i), existencia.Cantidad, existencia.Objetivo, Perfil.AfinidadCon(val), val == DemandaHoy, ComercioRules.BonoReputacion(Reputacion(p, Perfil)), ValorObjeto.Estado(item)); if (num3 <= 0) { break; } num += num3; existencia.Cantidad++; } return num; } public bool Saturado(string id) { int num = ComercioRules.Buscar(_stock, id); if (num >= 0) { return _stock[num].Cantidad >= ComercioRules.Saturacion(_stock[num].Objetivo); } return false; } public string MotivoRango(string id) { return Tr.Get("com_selecto_rango", new object[1] { Gremio.Ranks[Mathf.Clamp(RangoRequerido(id), 0, Gremio.Ranks.Length - 1)] }); } public bool Vender(Player p, ItemData item, int cantidad, out string mensaje) { mensaje = VenderInterno(p, item, cantidad, out var ok); return ok; } private string VenderInterno(Player p, ItemData item, int cantidad, out bool ok) { ok = false; if ((Object)(object)p == (Object)null || item == null) { return Tr.Get("com_sold_out"); } int num = PrecioTotalVenta(p, item, cantidad); if (num <= 0) { return Tr.Get(Saturado(ValorObjeto.Id(item)) ? "com_saturado" : "com_not_interested"); } return EjecutarVenta(p, item, cantidad, num, out ok); } public bool VenderRegateado(Player p, ItemData item, int cantidad, int precioPropuestoUnidad, out string mensaje, out int nuevoPrecioSugerido) { nuevoPrecioSugerido = 0; if ((Object)(object)p == (Object)null || item == null) { mensaje = Tr.Get("com_sold_out"); return false; } int num = PrecioVenta(p, item); if (num <= 0) { mensaje = Tr.Get(Saturado(ValorObjeto.Id(item)) ? "com_saturado" : "com_not_interested"); return false; } float skillFactor = MTComercioPlugin.NivelHabilidad(p); float repFactor = ComercioRules.BonoReputacion(Reputacion(p, Perfil)) / 0.1f; int rangoGremio = Gremio.Rango(p); float liquidezBonus = MercadoVivoRules.AjusteToleranciaLiquidez(Oro, (Perfil != null) ? Perfil.OroMaximo : 1000); EvaluacionRegateo evaluacionRegateo = RegateoRules.Evaluar(num, precioPropuestoUnidad, skillFactor, repFactor, rangoGremio, liquidezBonus); if (evaluacionRegateo.Resultado == ResultadoRegateo.Rechazado) { mensaje = Tr.Get(evaluacionRegateo.MensajeKey); nuevoPrecioSugerido = num; return false; } if (evaluacionRegateo.Resultado == ResultadoRegateo.Contraoferta) { nuevoPrecioSugerido = evaluacionRegateo.PrecioAcordado; int num2 = evaluacionRegateo.PrecioAcordado * cantidad; mensaje = Tr.Get(evaluacionRegateo.MensajeKey, new object[2] { evaluacionRegateo.PrecioAcordado, num2 }); return false; } int num3 = evaluacionRegateo.PrecioAcordado * cantidad; bool ok; string text = EjecutarVenta(p, item, cantidad, num3, out ok); if (ok) { MTComercioPlugin.SubirHabilidad(p, evaluacionRegateo.Xp); if (evaluacionRegateo.PrecioAcordado > num) { mensaje = Tr.Get("com_haggle_accepted", new object[1] { num3 }); return true; } } mensaje = text; return ok; } private string EjecutarVenta(Player p, ItemData item, int cantidad, int total, out bool ok) { ok = false; if (!EsPropio) { return Tr.Get("com_busy"); } Inventory inventory = ((Humanoid)p).GetInventory(); if (item == null || !inventory.ContainsItem(item)) { return Tr.Get("com_sold_out"); } if (item.m_equipped) { return Tr.Get("com_equipped"); } cantidad = Mathf.Clamp(cantidad, 1, item.m_stack); string id = ValorObjeto.Id(item); if (total <= 0) { return Tr.Get(Saturado(id) ? "com_saturado" : "com_not_interested"); } if (Oro < total) { return Tr.Get("com_trader_no_gold"); } GameObject val = (((Object)(object)ObjectDB.instance != (Object)null) ? ObjectDB.instance.GetItemPrefab("Coins") : null); if ((Object)(object)val == (Object)null) { return Tr.Get("com_sold_out"); } if (item.m_stack > cantidad && !inventory.CanAddItem(val, total)) { return Tr.Get("com_no_room"); } string text = Tr.Localize(item.m_shared.m_name); if (!ComercioRules.Sumar(_stock, id, cantidad)) { return Tr.Get("com_not_interested"); } inventory.RemoveItem(item, cantidad); inventory.AddItem(val, total); Zdo().Set("mt_com_oro", Oro - total); Guardar(); SumarReputacion(p, Perfil, total); MercadoMundo.Flujo(id, cantidad); ok = true; return Tr.Get("com_sold", new object[3] { text, cantidad, total }); } public int ComprarParaNpc(string id, int cantidad, int oroDisponible) { if (!EsPropio || Perfil == null || cantidad <= 0) { return 0; } Cargar(); int num = ComercioRules.Buscar(_stock, id); if (num < 0 || _stock[num].Cantidad <= 0 || ValorObjeto.ValorPrefab(id) <= 0f) { return 0; } if (_selectos.Contains(id)) { return 0; } cantidad = Mathf.Min(cantidad, _stock[num].Cantidad); int num2 = 0; int num3 = 0; Existencia existencia = _stock[num]; for (int i = 0; i < cantidad; i++) { int num4 = ComercioRules.PrecioCompra(ValorBaseCompra(id), existencia.Cantidad, existencia.Objetivo, 0f); if (num2 + num4 > oroDisponible) { break; } num2 += num4; existencia.Cantidad--; num3++; } if (num3 == 0) { return 0; } ComercioRules.Restar(_stock, id, num3); MercadoMundo.Flujo(id, -num3); Zdo().Set("mt_com_oro", Mathf.Min(Perfil.OroMaximo * 3, Oro + num2)); Guardar(); UltimaCompraNpc = num3; return num2; } public void ExistenciasNpc(List<string> ids) { ids.Clear(); if (Perfil == null) { return; } Cargar(); for (int i = 0; i < _stock.Count; i++) { if (_stock[i].Cantidad > 0) { ids.Add(_stock[i].Id); } } } public int PrecioNpc(string id) { if (Perfil == null) { return 0; } Cargar(); int num = ComercioRules.Buscar(_stock, id); if (num < 0 || _stock[num].Cantidad <= 0) { return 0; } return ComercioRules.PrecioCompra(ValorBaseCompra(id), _stock[num].Cantidad, _stock[num].Objetivo, 0f); } public static string Localizar(GameObject prefab) { ItemDrop val = (((Object)(object)prefab != (Object)null) ? prefab.GetComponent<ItemDrop>() : null); return Tr.Localize(((Object)(object)val != (Object)null) ? val.m_itemData.m_shared.m_name : (((Object)(object)prefab != (Object)null) ? ((Object)prefab).name : "")); } } internal static class ComercioEnRueda { [CompilerGenerated] private static class <>O { public static Proveedor <0>__Opciones; } private const int Orden = 100; private static readonly Color Dorado = new Color(1f, 0.8f, 0.3f); internal static void Registrar() { //IL_0010: 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_001b: Expected O, but got Unknown object obj = <>O.<0>__Opciones; if (obj == null) { Proveedor val = Opciones; <>O.<0>__Opciones = val; obj = (object)val; } ConversacionNpc.Registrar((Proveedor)obj, 100); } private static void Opciones(Character npc, Player p, List<RuedaOpcion> lista) { //IL_0054: Unknown result type (might be due to invalid IL or missing references) ComercianteNpc tienda = ((Component)npc).GetComponent<ComercianteNpc>(); if (!((Object)(object)tienda == (Object)null) && tienda.EnRueda && tienda.DisponiblePara(p)) { lista.Add(ConversacionNpc.Opcion(Tr.Get("com_trade_action"), (string)null, (Action<Player>)delegate(Player j) { tienda.Abrir(j); }, Dorado, true, (string)null, "comerciar", false, (string)null)); } } } public struct Existencia { public string Id; public int Cantidad; public int Objetivo; public Existencia(string id, int cantidad, int objetivo) { Id = id; Cantidad = cantidad; Objetivo = objetivo; } } public class OfertaComercio { public string Prefab; public int Objetivo; public string JefeRequerido; public bool Fija; public OfertaComercio(string prefab, int objetivo, string jefeRequerido = "", bool fija = false) { Prefab = prefab; Objetivo = objetivo; JefeRequerido = jefeRequerido ?? ""; Fija = fija; } } public static class ComercioRules { public const int NumCategorias = 10; public const float MargenVenta = 0.55f; public const float FactorMin = 0.5f; public const float FactorMax = 1.6f; public const float FactorMinCompra = 0.85f; public const float DescuentoMaximo = 0.25f; public const float ReposicionDiaria = 0.35f; public const float BonoDemanda = 0.35f; public const float ReputacionMax = 0.1f; public const int VolumenReputacionMax = 20000; public const int MaxEntradas = 48; public const float SaturacionVeces = 3f; public static float FactorOferta(int cantidad, int objetivo) { float num = ((objetivo > 0) ? objetivo : 10); float val = (float)Math.Pow(((float)Math.Max(0, cantidad) + 1f) / (num + 1f), -0.5); return Math.Max(0.5f, Math.Min(1.6f, val)); } public static float BonoReputacion(int volumen) { return 0.1f * (float)Math.Max(0, Math.Min(20000, volumen)) / 20000f; } public static int PrecioCompra(float valorBase, int cantidad, int objetivo, float descuento) { if (valorBase <= 0f) { return 0; } float num = Math.Max(0f, Math.Min(0.25f, descuento)); double value = (double)valorBase * (double)Math.Max(0.85f, FactorOferta(cantidad, objetivo)) * (double)(1f - num); return Math.Max(1, (int)Math.Ceiling(Math.Round(value, 4))); } public static int Saturacion(int objetivo) { return (int)((float)Math.Max(objetivo, 10) * 3f); } public static float FactorSaturacion(int cantidad, int objetivo) { float num = Math.Max(objetivo, 10); return Math.Min(1f, (num + 1f) / ((float)Math.Max(0, cantidad) + 1f)); } public static int PrecioVenta(float valorBase, int cantidad, int objetivo, float afinidad, bool demandaHoy, float bonoReputacion, float estado) { if (valorBase <= 0f || afinidad <= 0f) { return 0; } if (cantidad >= Saturacion(objetivo)) { return 0; } float num = FactorSaturacion(cantidad, objetivo) * 0.55f * afinidad * (demandaHoy ? 1.35f : 1f) * (1f + bonoReputacion) * Math.Max(0.1f, Math.Min(1f, estado)); int num2 = Math.Max(1, (int)Math.Round(valorBase * 0.85f * 0.75f)); return Math.Max(0, Math.Min(num2 - 1, (int)Math.Floor(valorBase * num))); } public static int Reponer(int cantidad, int objetivo, float dias) { if (dias <= 0f) { return cantidad; } double num = Math.Pow(0.6500000059604645, dias); double num2 = (double)objetivo + (double)(cantidad - objetivo) * num; int val = (int)((cantidad < objetivo) ? Math.Ceiling(num2) : Math.Floor(num2)); return Math.Max(0, val); } public static int DemandaDelDia(long dia, int semilla, Categoria[] posibles) { if (posibles == null || posibles.Length == 0) { return -1; } long num = (dia * 2654435761u) ^ ((long)semilla * 40503L); int num2 = (int)(((num ^ (num >> 13)) % posibles.Length + posibles.Length) % posibles.Length); return (int)posibles[num2]; } public static List<Existencia> Leer(string datos) { List<Existencia> list = new List<Existencia>(); if (string.IsNullOrEmpty(datos)) { return list; } string[] array = datos.Split(';'); for (int i = 0; i < array.Length; i++) { if (list.Count >= 48) { break; } string[] array2 = array[i].Split(':'); if (array2.Length == 3 && array2[0].Length != 0 && int.TryParse(array2[1], NumberStyles.Integer, CultureInfo.InvariantCulture, out var result) && int.TryParse(array2[2], NumberStyles.Integer, CultureInfo.InvariantCulture, out var result2) && Buscar(list, array2[0]) < 0) { list.Add(new Existencia(array2[0], Math.Max(0, result), Math.Max(0, result2))); } } return list; } public static string Escribir(List<Existencia> lista) { if (lista == null || lista.Count == 0) { return ""; } StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < lista.Count; i++) { Existencia existencia = lista[i]; if (!string.IsNullOrEmpty(existencia.Id) && existencia.Id.IndexOf(':') < 0 && existencia.Id.IndexOf(';') < 0) { if (stringBuilder.Length > 0) { stringBuilder.Append(';'); } stringBuilder.Append(existencia.Id).Append(':').Append(existencia.Cantidad.ToString(CultureInfo.InvariantCulture)) .Append(':') .Append(existencia.Objetivo.ToString(CultureInfo.InvariantCulture)); } } return stringBuilder.ToString(); } public static int Buscar(List<Existencia> lista, string id) { for (int i = 0; i < lista.Count; i++) { if (lista[i].Id == id) { return i; } } return -1; } public static void ReponerTodo(List<Existencia> lista, float dias) { for (int num = lista.Count - 1; num >= 0; num--) { Existencia value = lista[num]; value.Cantidad = Reponer(value.Cantidad, value.Objetivo, dias); if (value.Objetivo == 0 && value.Cantidad == 0) { lista.RemoveAt(num); } else { lista[num] = value; } } } public static bool Sumar(List<Existencia> lista, string id, int cantidad) { int num = Buscar(lista, id); if (num >= 0) { Existencia value = lista[num]; value.Cantidad += cantidad; lista[num] = value; return true; } if (lista.Count >= 48) { return false; } lista.Add(new Existencia(id, cantidad, 0)); return true; } public static bool Restar(List<Existencia> lista, string id, int cantidad) { int num = Buscar(lista, id); if (num < 0 || lista[num].Cantidad < cantidad || cantidad <= 0) { return false; } Existencia value = lista[num]; value.Cantidad -= cantidad; lista[num] = value; return true; } public static int ContarOfertasActivas(int totalOfertas, int extra = 0) { if (totalOfertas <= 3) { return totalOfertas; } int val = (int)Math.Round((float)totalOfertas * 0.45f); return Math.Min(totalOfertas, Math.Max(3, Math.Min(8, val)) + Math.Max(0, extra)); } public static int HashCadena(string s) { if (string.IsNullOrEmpty(s)) { return 0; } int num = 5381; for (int i = 0; i < s.Length; i++) { num = ((num << 5) + num) ^ s[i]; } return num; } public static int VariarCantidad(int objetivo, long dia, int semilla, string prefab) { if (objetivo <= 0) { return 0; } if (objetivo == 1) { return 1; } int num = HashCadena(prefab) ^ (int)(dia * 37) ^ (semilla * 17); int num2 = Math.Abs(num ^ (num >> 7)); if (objetivo == 2) { return 1 + num2 % 2; } if (objetivo <= 5) { return 1 + num2 % objetivo; } int num3 = Math.Max(1, (int)Math.Round((float)objetivo * 0.4f)); int num4 = objetivo - num3 + 1; int num5 = num3 + num2 % num4; if (objetivo >= 20) { num5 = num5 / 5 * 5; if (num5 < 5) { num5 = 5; } } return Math.Min(objetivo, num5); } public static List<OfertaComercio> SeleccionarOfertas(List<OfertaComercio> disponibles, long dia, int semilla, int extra = 0) { List<OfertaComercio> list = new List<OfertaComercio>(); if (disponibles == null || disponibles.Count == 0) { return list; } List<OfertaComercio> list2 = new List<OfertaComercio>(disponibles.Count); foreach (OfertaComercio disponible in disponibles) { if (disponible.Fija) { list.Add(disponible); } else { list2.Add(disponible); } } if (list.Count > 0) { List<OfertaComercio> collection = SeleccionarOfertas(list2, dia, semilla, extra); list.AddRange(collection); return list; } int count = disponibles.Count; int num = ContarOfertasActivas(count, extra); if (num >= count) { list.AddRange(disponibles); return list; } List<int> list3 = new List<int>(count); for (int i = 0; i < count; i++) { list3.Add(i); } uint num2 = (uint)((dia * 2654435761u) ^ ((long)semilla * 40503L) ^ 0x9E3779B9u); for (int num3 = count - 1; num3 > 0; num3--) { num2 = num2 * 1664525 + 1013904223; int index = (int)(num2 % (uint)(num3 + 1)); int value = list3[num3]; list3[num3] = list3[index]; list3[index] = value; } list3.RemoveRange(num, count - num); list3.Sort(); for (int j = 0; j < list3.Count; j++) { list.Add(disponibles[list3[j]]); } return list; } public static void RotarStock(List<Existencia> stock, List<OfertaComercio> ofertasDesbloqueadas, long dia, int semilla, bool primeraVez, int extra = 0) { if (stock == null) { return; } List<OfertaComercio> list = SeleccionarOfertas(ofertasDesbloqueadas, dia, semilla, extra); for (int num = stock.Count - 1; num >= 0; num--) { Existencia value = stock[num]; if (value.Objetivo != 0) { bool flag = false; for (int i = 0; i < list.Count; i++) { if (list[i].Prefab == value.Id) { flag = true; break; } } if (!flag) { stock.RemoveAt(num); } else { for (int j = 0; j < list.Count; j++) { if (list[j].Prefab == value.Id) { value.Objetivo = list[j].Objetivo; int num2 = VariarCantidad(list[j].Objetivo, dia, semilla, list[j].Prefab); if (primeraVez || value.Cantidad < num2) { value.Cantidad = num2; } stock[num] = value; break; } } } } } for (int k = 0; k < list.Count; k++) { OfertaComercio ofertaComercio = list[k]; if (Buscar(stock, ofertaComercio.Prefab) < 0 && stock.Count < 48) { int cantidad = VariarCantidad(ofertaComercio.Objetivo, dia, semilla, ofertaComercio.Prefab); stock.Add(new Existencia(ofertaComercio.Prefab, cantidad, ofertaComercio.Objetivo)); } } } } internal sealed class FichaOperacion { private object _clave; private Vector2 _descripcion; private int _precioPropuesto = -1; private string _textoPrecio = ""; public int Cantidad { get; private set; } = 1; public int PrecioPropuesto { get { if (_precioPropuesto <= 0) { return 1; } return _precioPropuesto; } set { _precioPropuesto = value; _textoPrecio = ((value > 0) ? value.ToString() : ""); } } public void Elegir(object clave) { //IL_0030: 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) if (!object.Equals(clave, _clave)) { _clave = clave; Cantidad = 1; _precioPropuesto = -1; _textoPrecio = ""; _descripcion = Vector2.zero; } } public void Reiniciar() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) _clave = null; Cantidad = 1; _precioPropuesto = -1; _textoPrecio = ""; _descripcion = Vector2.zero; } public void Dibujar(Rect zona, float s, string nombre, string sub, string descripcion, int unidad, int total, int maximo, string motivo) { //IL_001a: 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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0162: 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_01d0: 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_0215: Unknown result type (might be due to invalid IL or missing references) Cantidad = Mathf.Clamp(Cantidad, 1, Mathf.Max(1, maximo)); Rect val = UiPergamino.Hoja(zona, s, false); float num = ((Rect)(ref val)).y; UiPergamino.TituloHoja(ref num, val, nombre, sub, s); if (!string.IsNullOrEmpty(descripcion)) { float num2 = Mathf.Min(UiPergamino.Px(64f, s), UiPergamino.Alto(descripcion, Letra.Hoja, s, ((Rect)(ref val)).width - UiPergamino.Px(14f, s))); UiPergamino.TextoDesplazable(new Rect(((Rect)(ref val)).x, num, ((Rect)(ref val)).width, num2), ref _descripcion, descripcion, Letra.Hoja, s, (TextAnchor)0); num += num2 + UiPergamino.Px(8f, s); } UiPergamino.DatoOro(ref num, val, Tr.Get("com_unit"), unidad, s, (Letra)null, 6f); float num3 = UiPergamino.Px(20f, s); UiPergamino.Escribir(new Rect(((Rect)(ref val)).x, num, ((Rect)(ref val)).width * 0.5f, num3), Tr.Get("com_qty"), Letra.Hoja, s, (TextAnchor)3, false); Cantidad = UiPergamino.Cantidad(new Rect(((Rect)(ref val)).xMax - UiPergamino.Px(78f, s), num, UiPergamino.Px(78f, s), num3), Cantidad, maximo, s, 1); num += num3 + UiPergamino.Px(6f, s); UiPergamino.Raya(new Rect(((Rect)(ref val)).x, num, ((Rect)(ref val)).width, UiPergamino.Linea(s))); num += UiPergamino.Px(6f, s); UiPergamino.Escribir(new Rect(((Rect)(ref val)).x, num, ((Rect)(ref val)).width * 0.5f, UiPergamino.Px(20f, s)), Tr.Get("com_total"), Letra.Hoja, s, (TextAnchor)3, false); UiPergamino.Oro(new Rect(((Rect)(ref val)).x, num, ((Rect)(ref val)).width, UiPergamino.Px(20f, s)), total, Letra.HojaTitulo, s, (TextAnchor)5); num += UiPergamino.Px(28f, s); if (!string.IsNullOrEmpty(motivo)) { UiPergamino.Escribir(new Rect(((Rect)(ref val)).x, num, ((Rect)(ref val)).width, UiPergamino.Px(30f, s)), motivo, Letra.Aviso, s, (TextAnchor)0, true); } } public void DibujarVenta(Rect zona, float s, string nombre, string sub, string descripcion, int unidadBase, int maximo, string motivo) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: 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) //IL_00d7: 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_0173: 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_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_0353: Unknown result type (might be due to invalid IL or missing references) //IL_038b: Unknown result type (might be due to invalid IL or missing references) //IL_03c1: Unknown result type (might be due to invalid IL or missing references) //IL_0406: Unknown result type (might be due to invalid IL or missing references) Cantidad = Mathf.Clamp(Cantidad, 1, Mathf.Max(1, maximo)); if (_precioPropuesto < 1) { _precioPropuesto = Mathf.Max(1, unidadBase); _textoPrecio = _precioPropuesto.ToString(); } Rect val = UiPergamino.Hoja(zona, s, false); float num = ((Rect)(ref val)).y; UiPergamino.TituloHoja(ref num, val, nombre, sub, s); if (!string.IsNullOrEmpty(descripcion)) { float num2 = Mathf.Min(UiPergamino.Px(50f, s), UiPergamino.Alto(descripcion, Letra.Hoja, s, ((Rect)(ref val)).width - UiPergamino.Px(14f, s))); UiPergamino.TextoDesplazable(new Rect(((Rect)(ref val)).x, num, ((Rect)(ref val)).width, num2), ref _descripcion, descripcion, Letra.Hoja, s, (TextAnchor)0); num += num2 + UiPergamino.Px(6f, s); } UiPergamino.DatoOro(ref num, val, Tr.Get("com_unit_offer"), unidadBase, s, (Letra)null, 4f); float num3 = UiPergamino.Px(20f, s); string text = Tr.Get("com_haggle_your_price"); if (_precioPropuesto > unidadBase) { int num4 = Mathf.RoundToInt((float)(_precioPropuesto - unidadBase) / (float)Mathf.Max(1, unidadBase) * 100f); text = text + " (" + Tr.Get("com_haggle_markup", new object[1] { num4 }) + ")"; } UiPergamino.Escribir(new Rect(((Rect)(ref val)).x, num, ((Rect)(ref val)).width * 0.6f, num3), text, Letra.Hoja, s, (TextAnchor)3, false); float num5 = UiPergamino.Px(78f, s); string text2 = UiPergamino.CampoTextoHoja(new Rect(((Rect)(ref val)).xMax - num5, num, num5, num3), "com_precio_propuesto", _textoPrecio, 8, s, (TextAnchor)4); if (text2 != _textoPrecio) { StringBuilder stringBuilder = new StringBuilder(text2.Length); for (int i = 0; i < text2.Length; i++) { if (char.IsDigit(text2[i])) { stringBuilder.Append(text2[i]); } } _textoPrecio = stringBuilder.ToString(); if (int.TryParse(_textoPrecio, NumberStyles.None, CultureInfo.InvariantCulture, out var result)) { _precioPropuesto = Mathf.Clamp(result, 1, 9999999); } else if (string.IsNullOrEmpty(_textoPrecio)) { _precioPropuesto = 1; } } if (GUI.GetNameOfFocusedControl() != "com_precio_propuesto" && (string.IsNullOrEmpty(_textoPrecio) || _precioPropuesto < 1)) { _precioPropuesto = Mathf.Max(1, unidadBase); _textoPrecio = _precioPropuesto.ToString(); } num += num3 + UiPergamino.Px(4f, s); UiPergamino.Escribir(new Rect(((Rect)(ref val)).x, num, ((Rect)(ref val)).width * 0.5f, num3), Tr.Get("com_qty"), Letra.Hoja, s, (TextAnchor)3, false); Cantidad = UiPergamino.Cantidad(new Rect(((Rect)(ref val)).xMax - UiPergamino.Px(78f, s), num, UiPergamino.Px(78f, s), num3), Cantidad, maximo, s, 1); num += num3 + UiPergamino.Px(4f, s); int num6 = _precioPropuesto * Cantidad; UiPergamino.Raya(new Rect(((Rect)(ref val)).x, num, ((Rect)(ref val)).width, UiPergamino.Linea(s))); num += UiPergamino.Px(4f, s); UiPergamino.Escribir(new Rect(((Rect)(ref val)).x, num, ((Rect)(ref val)).width * 0.5f, UiPergamino.Px(20f, s)), Tr.Get("com_total"), Letra.Hoja, s, (TextAnchor)3, false); UiPergamino.Oro(new Rect(((Rect)(ref val)).x, num, ((Rect)(ref val)).width, UiPergamino.Px(20f, s)), num6, Letra.HojaTitulo, s, (TextAnchor)5); num += UiPergamino.Px(24f, s); if (!string.IsNullOrEmpty(motivo)) { UiPergamino.Escribir(new Rect(((Rect)(ref val)).x, num, ((Rect)(ref val)).width, UiPergamino.Px(30f, s)), motivo, Letra.Aviso, s, (TextAnchor)0, true); } } } public static class Iconos { private static readonly IconosEmbebidos Recursos = new IconosEmbebidos(typeof(Iconos).Assembly, "MT.Comercio"); public static Sprite Get(string nombre) { return Recursos.Get(nombre); } public static Texture2D Textura(string recurso) { return Recursos.Textura(recurso); } } public static class MercaderValheim { public static readonly PerfilComercio Ambulante = new PerfilComercio { Id = "valheim_mercader", NombreKey = "com_traveling_trader", Oficio = (Categoria[])(object)new Categoria[2] { (Categoria)7, (Categoria)6 }, Afinidad = 0.45f, OroMaximo = 2000 }; } [HarmonyPatch(typeof(Trader), "Start")] public static class MercaderValheimAlta { private static void Postfix(Trader __instance) { if ((Object)(object)__instance != (Object)null) { ComercianteNpc.Agregar(((Component)__instance).gameObject, MercaderValheim.Ambulante); } } } [HarmonyPatch(typeof(Trader), "Interact")] public static class MercaderValheimInteract { private static bool Prefix(Trader __instance, Humanoid __0, bool __1, bool __2, ref bool __result) { if (!(!__2 || __1)) { Player val = (Player)(object)((__0 is Player) ? __0 : null); if (val != null) { ComercianteNpc component = ((Component)__instance).GetComponent<ComercianteNpc>(); if ((Object)(object)component == (Object)null) { return true; } __result = component.Abrir(val); return !__result; } } return true; } } [HarmonyPatch(typeof(Trader), "GetHoverText")] public static class MercaderValheimHover { private static void Postfix(Trader __instance, ref string __result) { if ((Object)(object)__instance != (Object)null && (Object)(object)((Component)__instance).GetComponent<ComercianteNpc>() != (Object)null) { __result = __result + "\n[<color=yellow><b>L.Shift + " + TeclasHover.Usar + "</b></color>] " + Tr.Get("com_sell_anything"); } } } [BepInPlugin("mushokutensei.comercio", "MT Comercio", "1.4.30")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency("mushokutensei.core", "2.99.64")] [BepInDependency("bryanrf.mushoku.dialogos", "1.11.0")] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] public sealed class MTComercioPlugin : BaseUnityPlugin { public const string Guid = "mushokutensei.comercio"; public const string Version = "1.4.30"; public static SkillType RegateoSkill; public static float NivelHabilidad(Player p) { //IL_0009: 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) if ((Object)(object)p == (Object)null || (int)RegateoSkill == 0) { return 0f; } return ((Character)p).GetSkillFactor(RegateoSkill); } public static void SubirHabilidad(Player p, float xp) { //IL_0009: 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) if (!((Object)(object)p == (Object)null) && (int)RegateoSkill != 0 && !(xp <= 0f)) { ((Character)p).RaiseSkill(RegateoSkill, xp); } } private void Awake() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0039: 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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown //IL_0064: 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) Tr.Load(typeof(MTComercioPlugin).Assembly, Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location)); RegateoSkill = SkillManager.Instance.AddSkill(new SkillConfig { Identifier = "mushokutensei.comercio.regateo", Name = Tr.Token("com_skill_regateo"), Description = Tr.Token("com_skill_regateo_d"), IncreaseStep = 1f }); ((Component)this).gameObject.AddComponent<VentanaComercio>(); VentanasEsc.Registrar((Func<bool>)(() => VentanaComercio.Abierta), (Action)VentanaComercio.Cerrar); Tiendas.Registrar((Func<Vector3, float, ITiendaNpc>)((Vector3 posicion, float radio) => (ITiendaNpc)(object)ComercianteNpc.Cercano(posicion, radio))); MercadoMundo.Registrar(); ComercioEnRueda.Registrar(); ((Component)this).gameObject.AddComponent<VentanaBanco>(); VentanasEsc.Registrar((Func<bool>)(() => VentanaBanco.Abierta), (Action)VentanaBanco.Cerrar); Bancos.Registrar((IBanco)(object)CuentaBanco.Instancia); PrefabManager.OnVanillaPrefabsAvailable += AlTenerPrefabs; Parches.Aplicar("mushokutensei.comercio", typeof(MTComercioPlugin).Assembly, ((BaseUnityPlugin)this).Logger); ((BaseUnityPlugin)this).Logger.LogInfo((object)"MT Comercio 1.4.30 cargado"); } private void AlTenerPrefabs() { PrefabManager.OnVanillaPrefabsAvailable -= AlTenerPrefabs; PiezaBanco.Register(); } } internal static class PaletaComercio { internal static readonly Color Texto = new Color(0.96f, 0.91f, 0.81f); internal static readonly Color Secundario = new Color(0.84f, 0.8f, 0.71f); internal static readonly Color Oro = new Color(0.96f, 0.82f, 0.55f); internal static readonly Color Favorable = new Color(0.73f, 0.88f, 0.77f); internal static readonly Color Aviso = new Color(1f, 0.76f, 0.65f); } public enum ResultadoRegateo { Aceptado, Contraoferta, Rechazado } public struct EvaluacionRegateo { public ResultadoRegateo Resultado; public int PrecioAcordado; public string MensajeKey; public float Xp; public EvaluacionRegateo(ResultadoRegateo resultado, int precioAcordado, string mensajeKey, float xp) { Resultado = resultado; PrecioAcordado = precioAcordado; MensajeKey = mensajeKey; Xp = xp; } } public static class RegateoRules { public const float MargenBase = 0.05f; public const float MaxBonusHabilidad = 0.35f; public const float MaxBonusReputacion = 0.15f; public const float MaxBonusRangoGremio = 0.15f; public static float ToleranciaMaxima(float skillFactor, float repFactor, int rangoGremio, float liquidezBonus = 0f) { float num = Math.Max(0f, Math.Min(1f, skillFactor)); float num2 = Math.Max(0f, Math.Min(1f, repFactor)); float num3 = Math.Max(0f, Math.Min(6, rangoGremio)) / 6f; return Math.Max(0.02f, 0.05f + num * 0.35f + num2 * 0.15f + num3 * 0.15f + liquidezBonus); } public static EvaluacionRegateo Evaluar(int precioBase, int precioPropuesto, float skillFactor, float repFactor, int rangoGremio, float liquidezBonus = 0f) { if (precioBase <= 0) { return new EvaluacionRegateo(ResultadoRegateo.Rechazado, 0, "com_not_interested", 0f); } if (precioPropuesto <= precioBase) { return new EvaluacionRegateo(ResultadoRegateo.Aceptado, precioPropuesto, "com_sold", 0.2f); } float num = (float)(precioPropuesto - precioBase) / (float)precioBase; float num2 = ToleranciaMaxima(skillFactor, repFactor, rangoGremio, liquidezBonus); if (num <= num2) { float num3 = precioPropuesto - precioBase; float xp = 1f + Math.Min(25f, num3 * 0.05f); return new EvaluacionRegateo(ResultadoRegateo.Aceptado, precioPropuesto, "com_haggle_accepted", xp); } if (num <= num2 * 1.55f) { int num4 = precioBase + (int)Math.Round((float)precioBase * num2 * 0.85f); if (num4 <= precioBase) { num4 = precioBase + 1; } return new EvaluacionRegateo(ResultadoRegateo.Contraoferta, num4, "com_haggle_counter", 0.5f); } return new EvaluacionRegateo(ResultadoRegateo.Rechazado, precioBase, "com_haggle_rejected", 0f); } } public static class SelectosRules { public static readonly string[] Etapas = new string[8] { "", "defeated_eikthyr", "defeated_gdking", "defeated_bonemass", "defeated_dragon", "defeated_goblinking", "defeated_queen", "defeated_fader" }; public const int RangoSelecto = 3; public const int ExtraPeligro = 3; public static int Etapa(string jefe) { return Math.Max(0, Array.IndexOf(Etapas, jefe ?? "")); } public static string Siguiente(List<OfertaComercio> ofertas, Func<string, bool> desbloqueado) { string result = null; int num = int.MaxValue; foreach (OfertaComercio oferta in ofertas) { if (!desbloqueado(oferta.JefeRequerido)) { int num2 = Etapa(oferta.JefeRequerido); if (num2 < num) { num = num2; result = oferta.JefeRequerido; } } } return result; } public static int RangoPara(bool zonaPeligrosa) { if (!zonaPeligrosa) { return 3; } return 2; } public static int Extra(bool zonaPeligrosa) { if (!zonaPeligrosa) { return 0; } return 3; } } public class VentanaComercio : MonoBehaviour { private static bool _abierta; private static Texture2D _icono; private const float Ancho = 720f; private const float Alto = 420f; private const float AnchoLista = 200f; private static ComercianteNpc _com; private static Player _jugador; private static bool _soloVende; private static bool _vender; private static string _elegidoVenta; private static ItemData _elegidoMochila; private static readonly FichaOperacion Ficha = new FichaOperacion(); private static readonly List<Existencia> Venta = new List<Existencia>(48); private static readonly List<ItemData> Mochila = new List<ItemData>(64); private static readonly List<int> PreciosVenta = new List<int>(64); private static float _refresco; private static float _scroll; private static float _mensajeHasta; private static string _mensaje = ""; private static bool _mensajeBueno; public static bool Abierta => _abierta; public static void Abrir(ComercianteNpc com, Player jugador) { if (_abierta) { Cerrar(); } _abierta = true; _com = com; _jugador = jugador; _soloVende = com.SoloVende; _vender = false; _elegidoVenta = null; _elegidoMochila = null; _scroll = 0f; _refresco = 0f; _mensaje = ""; Ficha.Reiniciar(); MediadorFocoUI.SolicitarFoco("VentanaComercio", true, (Action)Cerrar); } public static void Cerrar() { if (_abierta) { _abierta = false; _com = null; _jugador = null; MediadorFocoUI.LiberarFoco("VentanaComercio"); BloqueoClic.Bloquear(0.35f); } } private void Awake() { _icono = Iconos.Textura("UI/ventana_mercader.png"); } private void OnDisable() { Cerrar(); } private void Update() { //IL_003f: 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) if (!_abierta) { return; } Player localPlayer = Player.m_localPlayer; if ((Object)(object)_com == (Object)null || (Object)(object)localPlayer == (Object)null || (Object)(object)_jugador != (Object)(object)localPlayer || ((Character)localPlayer).IsDead() || Vector3.Distance(((Component)localPlayer).transform.position, ((Component)_com).transform.position) > 6f || InventoryGui.IsVisible() || Menu.IsVisible() || Console.IsVisible()) { Cerrar(); return; } if (!_com.EsPropio) { ((Character)localPlayer).Message((MessageType)2, Tr.Get("com_busy"), 0, (Sprite)null, false); Cerrar(); return; } _refresco -= Time.unscaledDeltaTime; if (_refresco <= 0f) { Refrescar(localPlayer); } } private static void Refrescar(Player p) { _refresco = 0.5f; Venta.Clear(); List<Existencia> existencias = _com.Existencias; for (int i = 0; i < existencias.Count; i++) { if (existencias[i].Cantidad > 0 && ValorObjeto.ValorPrefab(existencias[i].Id) > 0f) { Venta.Add(existencias[i]); } } if (Indice(_elegidoVenta) < 0) { _elegidoVenta = ((Venta.Count > 0) ? Venta[0].Id : null); } Mochila.Clear(); PreciosVenta.Clear(); if (_soloVende) { return; } List<ItemData> allItems = ((Humanoid)p).GetInventory().GetAllItems(); for (int j = 0; j < allItems.Count; j++) { int num = _com.PrecioVenta(p, allItems[j]); if (num > 0) { int k; for (k = 0; k < PreciosVenta.Count && PreciosVenta[k] >= num; k++) { } Mochila.Insert(k, allItems[j]); PreciosVenta.Insert(k, num); } } if (!Mochila.Contains(_elegidoMochila)) { _elegidoMochila = ((Mochila.Count > 0) ? Mochila[0] : null); } } private static int Indice(string id) { if (id == null) { return -1; } for (int i = 0; i < Venta.Count; i++) { if (Venta[i].Id == id) { return i; } } return -1; } private static void Aviso(bool ok, string texto) { _mensaje = texto ?? ""; _mensajeBueno = ok; _mensajeHasta = Time.unscaledTime + 4f; } private void OnGUI() { //IL_0298: 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: Invalid comparison between Unknown and I4 //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Invalid comparison between Unknown and I4 //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_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_0233: Unknown result type (might be due to invalid IL or missing references) //IL_023d: 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_0228: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_com == (Object)null || (Object)(object)_jugador == (Object)null) { return; } Event current = Event.current; if ((int)current.type == 4 && (int)current.keyCode == 27) { Cerrar(); VentanasEsc.EscUsado(); current.Use(); return; } int depth = GUI.depth; Color color = GUI.color; try { GUI.depth = -50; float num = UiPergamino.Px(720f, 1f); float num2 = UiPergamino.Px(420f, 1f); float num3 = PanelServicio.Escala(num, num2); Rect val = UiPergamino.Ventana(PanelServicio.Centrado(num, num2, num3), num3); float num4 = ((Rect)(ref val)).y + UiPergamino.Cabecera(val, num3, _icono, _com.Nombre, Subtitulo(), (Letra)null, false); float num5 = ((Rect)(ref val)).x + UiPergamino.Px(6f, num3); if (UiPergamino.Pestana(ref num5, num4, Tr.Get("com_for_sale"), !_vender, num3) && _vender) { _vender = false; _scroll = 0f; Ficha.Reiniciar(); } if (!_soloVende && UiPergamino.Pestana(ref num5, num4, Tr.Get("com_you_sell"), _vender, num3) && !_vender) { _vender = true; _scroll = 0f; Ficha.Reiniciar(); } num4 += UiPergamino.Px(25f, num3) - UiPergamino.Linea(num3); float num6 = UiPergamino.Px(66f, num3); Rect val2 = default(Rect); ((Rect)(ref val2))..ctor(((Rect)(ref val)).x, num4, ((Rect)(ref val)).width, ((Rect)(ref val)).yMax - num6 - num4); Rect val3 = UiPergamino.Panel(val2, num3); Rect marco = default(Rect); ((Rect)(ref marco))..ctor(((Rect)(ref val3)).x, ((Rect)(ref val3)).y, UiPergamino.Px(200f, num3), ((Rect)(ref val3)).height); Rect zona = default(Rect); ((Rect)(ref zona))..ctor(((Rect)(ref marco)).xMax + UiPergamino.Px(10f, num3), ((Rect)(ref val3)).y, ((Rect)(ref val3)).xMax - ((Rect)(ref marco)).xMax - UiPergamino.Px(10f, num3), ((Rect)(ref val3)).height); if (_vender) { ListaMochila(marco, num3, current); HojaVenta(zona, num3); } else { ListaVenta(marco, num3, current); HojaCompra(zona, num3); } Pie(new Rect(((Rect)(ref val)).x, ((Rect)(ref val2)).yMax + UiPergamino.Px(10f, num3), ((Rect)(ref val)).width, ((Rect)(ref val)).yMax - ((Rect)(ref val2)).yMax - UiPergamino.Px(10f, num3)), num3); } finally { GUI.depth = depth; GUI.color = color; } } private static string Subtitulo() { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected I4, but got Unknown if (_soloVende) { return null; } string text = Tr.Get("com_rep", new object[1] { Mathf.RoundToInt(_com.Descuento(_jugador) * 100f) }); string text2 = Tr.Get("com_demand", new object[1] { Tr.Get("com_cat_" + (int)_com.DemandaHoy) }); string text3 = Tr.Get("com_sent_" + (int)_com.Sentimiento); RumorMercado rumorHoy = _com.RumorHoy; string text4 = ((rumorHoy.Id == 5) ? "" : (" · " + Tr.Get(rumorHoy.TituloKey))); return text + " · " + text2 + " · " + text3 + text4; } private static void Pie(Rect pie, float s) { //IL_0023: 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_018e: Unknown result type (might be due to invalid IL or missing references) float num = UiPergamino.Px(26f, s); float x = ((Rect)(ref pie)).x; x += Etiqueta(new Rect(x, ((Rect)(ref pie)).y, 0f, num), s, Tr.Get("com_gold_you_label"), Monedas.Contar(((Humanoid)_jugador).GetInventory()), Letra.Madera); if (!_soloVende) { string sufijo = " (" + Tr.Get("com_sent_" + (int)_com.Sentimiento) + ")"; Etiqueta(new Rect(x + UiPergamino.Px(14f, s), ((Rect)(ref pie)).y, 0f, num), s, Tr.Get("com_gold_trader_label"), _com.Oro, Letra.MaderaSuave, sufijo); } float xMax = ((Rect)(ref pie)).xMax; if (UiPergamino.BotonDerecha(ref xMax, ((Rect)(ref pie)).y, Tr.Get("com_back"), s)) { Cerrar(); return; } bool enabled = GUI.enabled; GUI.enabled = enabled && Motivo() == null && (_vender ? (_elegidoMochila != null) : (Indice(_elegidoVenta) >= 0)); bool num2 = UiPergamino.BotonDerecha(ref xMax, ((Rect)(ref pie)).y, Tr.Get(_vender ? "com_you_sell" : "com_buy"), s); GUI.enabled = enabled; if (num2) { Operar(); } Rect val = new Rect(((Rect)(ref pie)).x, ((Rect)(ref pie)).y + num + UiPergamino.Px(6f, s), ((Rect)(ref pie)).width, UiPergamino.Px(16f, s)); bool flag = Time.unscaledTime < _mensajeHasta && _mensaje.Length > 0; string text = (_soloVende ? Tr.Get("com_hint_buy") : ((_com.RumorHoy.Id != 5) ? Tr.Get(_com.RumorHoy.DescripcionKey) : Tr.Get("com_hint"))); UiPergamino.Escribir(val, flag ? _mensaje : text, (!flag) ? Letra.Pie : (_mensajeBueno ? Letra.Madera : Letra.MaderaSuave), s, (TextAnchor)4, false); } private static float Etiqueta(Rect r, float s, string etiqueta, int oro, Letra letra, string sufijo = null) { //IL_0026: 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_00ba: Unknown result type (might be due to invalid IL or missing references) float num = UiPergamino.Ancho(etiqueta, letra, s); UiPergamino.Escribir(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, num + 2f, ((Rect)(ref r)).height), etiqueta, letra, s, (TextAnchor)3, false); float num2 = UiPergamino.Oro(new Rect(((Rect)(ref r)).x + num + UiPergamino.Px(4f, s), ((Rect)(ref r)).y, 0f, ((Rect)(ref r)).height), oro, letra, s, (TextAnchor)3); if (!string.IsNullOrEmpty(sufijo)) { float num3 = ((Rect)(ref r)).x + num + UiPergamino.Px(4f, s) + num2 + UiPergamino.Px(4f, s); float num4 = UiPergamino.Ancho(sufijo, letra, s); UiPergamino.Escribir(new Rect(num3, ((Rect)(ref r)).y, num4 + 2f, ((Rect)(ref r)).height), sufijo, letra, s, (TextAnchor)3, false); return num + UiPergamino.Px(4f, s) + num2 + UiPergamino.Px(4f, s) + num4; } return num + UiPergamino.Px(4f, s) + num2; } private static float Desplazar(Rect zona, Event ev, float scroll, int filas, float s) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Invalid comparison between Unknown and I4 //IL_002e: 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) float num = Mathf.Max(0f, (float)filas * UiPergamino.Px(25f, s) - ((Rect)(ref zona)).height); if ((int)ev.type == 6 && ((Rect)(ref zona)).Contains(ev.mousePosition)) { scroll += ev.delta.y * 20f * s; ev.Use(); } return Mathf.Clamp(scroll, 0f, num); } private static void ListaVenta(Rect marco, float s, Event ev) { //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_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_0050: 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_0157: Unknown result type (might be due to invalid IL or missing references) Rect val = UiPergamino.Lista(marco, s); _scroll = Desplazar(val, ev, _scroll, Venta.Count, s); if (Venta.Count == 0) { EstadoListaVacia.Dibujar(val, Tr.Get("com_empty_stock"), s, (Letra)null, (IconoListaVacia)null); return; } float num = UiPergamino.Px(25f, s); GUI.BeginGroup(val); Rect val2 = default(Rect); for (int i = 0; i < Venta.Count; i++) { ((Rect)(ref val2))..ctor(0f, (float)i * num - _scroll, ((Rect)(ref val)).width, num); if (!(((Rect)(ref val2)).yMax < 0f) && !(((Rect)(ref val2)).y > ((Rect)(ref val)).height)) { Existencia e = Venta[i]; GameObject val3 = (((Object)(object)ObjectDB.instance != (Object)null) ? ObjectDB.instance.GetItemPrefab(e.Id) : null); ItemDrop val4 = (((Object)(object)val3 != (Object)null) ? val3.GetComponent<ItemDrop>() : null); int num2 = _com.PrecioCompra(_jugador, e); float num3 = ValorObjeto.ValorPrefab(e.Id); string text = (((float)num2 > num3 * 1.1f) ? " ▲" : (((float)num2 < num3 * 0.9f) ? " ▼" : "")); string text2 = ((_com.RangoRequerido(e.Id) >= 0) ? "✦ " : ""); if (UiPergamino.Fila(val2, s, text2 + ComercianteNpc.Localizar(val3), num2 + text, e.Id == _elegidoVenta, false, ((Object)(object)val4 != (Object)null) ? val4.m_itemData.GetIcon() : null)) { _elegidoVenta = e.Id; } } } GUI.EndGroup(); } private static void ListaMochila(Rect marco, float s, Event ev) { //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_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_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_005b: 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_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_00e2: Unknown result type (might be due to invalid IL or missing references) Rect val = UiPergamino.Lista(marco, s); _scroll = Desplazar(val, ev, _scroll, Mochila.Count, s); if (Mochila.Count == 0) { EstadoListaVacia.Dibujar(val, Tr.Get("com_empty_sell"), s, (Letra)null, (IconoListaVacia)null); return; } float num = UiPergamino.Px(25f, s); Categoria demandaHoy = _com.DemandaHoy; GUI.BeginGroup(val); Rect val2 = default(Rect); for (int i = 0; i < Mochila.Count; i++) { ((Rect)(ref val2))..ctor(0f, (float)i * num - _scroll, ((Rect)(ref val)).width, num); if (!(((Rect)(ref val2)).yMax < 0f) && !(((Rect)(ref val2)).y > ((Rect)(ref val)).height)) { ItemData val3 = Mochila[i]; string text = ((ValorObjeto.CategoriaDe(val3) == demandaHoy) ? "★ " : "") + Tr.Localize(val3.m_shared.m_name); if (UiPergamino.Fila(val2, s, text, "+" + PreciosVenta[i], val3 == _elegidoMochila, false, val3.GetIcon())) { _elegidoMochila = val3; } } } GUI.EndGroup(); } private static void HojaCompra(Rect zona, float s) { //IL_0082: 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_00b3: 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_0059: 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) int num = Indice(_elegidoVenta); GameObject val = ((num >= 0 && (Object)(object)ObjectDB.instance != (Object)null) ? ObjectDB.instance.GetItemPrefab(Venta[num].Id) : null); ItemDrop val2 = (((Object)(object)val != (Object)null) ? val.GetComponent<ItemDrop>() : null); if ((Object)(object)val2 == (Object)null) { UiPergamino.Hoja(zona, s, false); return; } Existencia e = Venta[num]; Ficha.Elegir(e.Id); Categoria cat = ValorObjeto.CategoriaDe(e.Id); string text = Tr.Get("com_left", new object[1] { e.Cantidad }); float num2 = MercadoVivoRules.FactorBiomaCompra(_com.BiomaInt, cat, e.Id); if (num2 < 0.95f) { text = text + " · " + Tr.Get("com_biome_local_surplus"); } else if (num2 > 1.05f) { text = text + " · " + Tr.Get("com_biome_imported"); } Ficha.Dibujar(zona, s, ComercianteNpc.Localizar(val), text, Tr.Localize(val2.m_itemData.m_shared.m_description), _com.PrecioCompra(_jugador, e), _com.PrecioTotal(_jugador, e.Id, Ficha.Cantidad), e.Cantidad, Motivo()); } private static void HojaVenta(Rect zona, float s) { //IL_0032: 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_004e: 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_001c: 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_007d: 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_00b1: 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) ItemData elegidoMochila = _elegidoMochila; int num = ((elegidoMochila != null) ? Mochila.IndexOf(elegidoMochila) : (-1)); if (num < 0) { UiPergamino.Hoja(zona, s, false); return; } Ficha.Elegir(elegidoMochila); Categoria val = ValorObjeto.CategoriaDe(elegidoMochila); string text = "x" + elegidoMochila.m_stack; if (val == _com.DemandaHoy) { text = text + " · " + Tr.Get("com_demand_badge"); } RumorMercado rumorHoy = _com.RumorHoy; if (val == rumorHoy.CategoriaAfectada && rumorHoy.Id != 5) { text = text + " · " + Tr.Get("com_rumor_badge"); } float num2 = MercadoVivoRules.FactorBiomaVenta(_com.BiomaInt, val, ValorObjeto.Id(elegidoMochila)); if (num2 > 1.1f) { text = text + " · " + Tr.Get("com_biome_high"); } else if (num2 < 0.9f) { text = text + " · " + Tr.Get("com_biome_low"); } Ficha.DibujarVenta(zona, s, Tr.Localize(elegidoMochila.m_shared.m_name), text, Tr.Localize(elegidoMochila.m_shared.m_description), PreciosVenta[num], elegidoMochila.m_stack, null); } private static string Motivo() { if (_vender) { return null; } int num = Indice(_elegidoVenta); if (num < 0) { return null; } Existencia existencia = Venta[num]; GameObject val = (((Object)(object)ObjectDB.instance != (Object)null) ? ObjectDB.instance.GetItemPrefab(existencia.Id) : null); int num2 = _com.PrecioTotal(_jugador, existencia.Id, Ficha.Cantidad); if (existencia.Cantidad <= 0) { return Tr.Get("com_sold_out"); } if (!_com.PuedeComprar(_jugador, existencia.Id)) { return _com.MotivoRango(existencia.Id); } if (Monedas.Contar(((Humanoid)_jugador).GetInventory()) < num2) { return Tr.Get("com_no_gold", new object[1] { num2 }); } if ((Object)(object)val != (Object)null && !((Humanoid)_jugador).GetInventory().CanAddItem(val, Ficha.Cantidad)) { return Tr.Get("com_no_room"); } return null; } private static void Operar() { GUI.FocusControl((string)null); bool flag; string mensaje; if (_vender) { int num = ((_elegidoMochila != null) ? Mochila.IndexOf(_elegidoMochila) : (-1)); int num2 = ((num >= 0 && num < PreciosVenta.Count) ? PreciosVenta[num] : 0); int precioPropuestoUnidad = ((Ficha.PrecioPropuesto > 0) ? Ficha.PrecioPropuesto : num2); flag = _com.VenderRegateado(_jugador, _elegidoMochila, Ficha.Cantidad, precioPropuestoUnidad, out mensaje, out var nuevoPrecioSugerido); if (nuevoPrecioSugerido > 0) { Ficha.PrecioPropuesto = nuevoPrecioSugerido; } } else { flag = _com.Comprar(_jugador, _elegidoVenta, Ficha.Cantidad, out mensaje); } Aviso(flag, mensaje); if (flag) { Ficha.Reiniciar(); } _refresco = 0f; } } } namespace MT.Comercio.Mercado { public static class MercadoMundo { private struct Ritmo { public float Volumen; public float Elasticidad; } [CompilerGenerated] private static class <>O { public static Operacion <0>__Aplicar; } private const string Clave = "mercado"; private const string Operacion = "mercado"; private const float UmbralBarato = 0.8f; private const float UmbralCaro = 1.4f; private static readonly Dictionary<Categoria, Ritmo> Ritmos = new Dictionary<Categoria, Ritmo> { { (Categoria)0, new Ritmo { Volumen = 40f, Elasticidad = 0.7f } }, { (Categoria)1, new Ritmo { Volumen = 30f, Elasticidad = 0.6f } }, { (Categoria)2, new Ritmo { Volumen = 10f, Elasticidad = 0.5f } }, { (Categoria)3, new Ritmo { Volumen = 3f, Elasticidad = 0.35f } }, { (Categoria)4, new Ritmo { Volumen = 3f, Elasticidad = 0.35f } }, { (Categoria)5, new Ritmo { Volumen = 100f, Elasticidad = 0.5f } }, { (Categoria)6, new Ritmo { Volumen = 8f, Elasticidad = 0.5f } }, { (Categoria)7, new Ritmo { Volumen = 10f, Elasticidad = 0.3f } }, { (Categoria)8, new Ritmo { Volumen = 3f, Elasticidad = 0.3f } }, { (Categoria)9, new Ritmo { Volumen = 20f, Elasticidad = 0.4f } } }; private static string _leido; private static Dictionary<string, MercadoRules.Entrada> _mapa = new Dictionary<string, MercadoRules.Entrada>(); private static double Hoy { get { if (!((Object)(object)ZNet.instance != (Object)null)) { return 0.0; } return ZNet.instance.GetTimeSeconds() / 1800.0; } } public static void Registrar() { //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_0020: Expected O, but got Unknown object obj = <>O.<0>__Aplicar; if (obj == null) { Operacion val = Aplicar; <>O.<0>__Aplicar = val; obj = (object)val; } RegistroMundo.RegistrarOperacion("mercado", (Operacion)obj); } public static float Indice(string id) { if (string.IsNullOrEmpty(id)) { return 1f; } string text = RegistroMundo.Leer("mercado"); if ((object)text != _leido) { _mapa = MercadoRules.Leer(text); _leido = text; } if (!_mapa.TryGetValue(id, out var value)) { return 1f; } return MercadoRules.Hoy(value, Hoy); } public static float Valor(string id) { return ValorObjeto.ValorPrefab(id) * Indice(id); } public static float Valor(ItemData item) { return ValorObjeto.Valor(item) * Indice(ValorObjeto.Id(item)); } public static float ValorTrasFlujo(string id, float valorBase, int unidades) { //IL_0042: 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_004d: Unknown result type (might be due to invalid IL or missing references) GameObject val = (((Object)(object)ObjectDB.instance != (Object)null) ? ObjectDB.instance.GetItemPrefab(id) : null); ItemDrop val2 = (((Object)(object)val != (Object)null) ? val.GetComponent<ItemDrop>() : null); Categoria key = (Categoria)((!((Object)(object)val2 != (Object)null)) ? 9 : ((int)ValorObjeto.CategoriaDe(val2.m_itemData))); if (!Ritmos.TryGetValue(key, out var value)) { value = Ritmos[(Categoria)9]; } return valorBase * MercadoRules.Mover(Indice(id), unidades, value.Volumen, value.Elasticidad); } public static void Flujo(string id, int unidades) { if (!string.IsNullOrEmpty(id) && unidades != 0) { RegistroMundo.Pedir("mercado", id + ":" + unidades.ToString(CultureInfo.InvariantCulture)); } } private static void Aplicar(long remitente, string datos, Escritor registro) { //IL_00b0: Unknown result type (might be due to invalid IL or missing references) int num = datos.LastIndexOf(':'); if (num <= 0 || num > 64) { return; } string text = datos.Substring(0, num); if (!int.TryParse(datos.Substring(num + 1), NumberStyles.Integer, CultureInfo.InvariantCulture, out var result) || result == 0 || result < -999 || result > 999) { return; } GameObject val = (((Object)(object)ObjectDB.instance != (Object)null) ? ObjectDB.instance.GetItemPrefab(text) : null); ItemDrop val2 = (((Object)(object)val != (Object)null) ? val.GetComponent<ItemDrop>() : null); if (!((Object)(object)val2 == (Object)null) && text.IndexOf(';') < 0 && text.IndexOf('=') < 0 && text.IndexOf('@') < 0) { if (!Ritmos.TryGetValue(ValorObjeto.CategoriaDe(val2.m_itemData), out var value)) { value = Ritmos[(Categoria)9]; } Dictionary<string, MercadoRules.Entrada> dictionary = MercadoRules.Leer(registro.Leer("mercado")); double hoy = Hoy; dictionary.TryGetValue(text, out var value2); float num2 = MercadoRules.Hoy(value2, hoy); float num3 = MercadoRules.Mover(num2, result, value.Volumen, value.Elasticidad); dictionary[text] = new MercadoRules.Entrada { Indice = num3, Dia = hoy }; if (num2 >= 0.8f && num3 < 0.8f) { Noticias.Agregar(registro, "barato", text, ""); } if (num2 <= 1.4f && num3 > 1.4f) { Noticias.Agregar(registro, "caro", text, ""); } registro.Escribir("mercado", MercadoRules.Escribir(dictionary)); } } } public static class MercadoRules { public sealed class Entrada { public float Indice = 1f; public double Dia; } public const float Minimo = 0.65f; public const float Maximo = 1.75f; public const float VidaMediaDias = 2.5f; public const int MaxEntradas = 400; public static float Paso(float volumenDia, float elasticidad) { return elasticidad / Math.Max(1f, volumenDia); } public static float Mover(float indice, int unidadesVendidas, float volumenDia, float elasticidad) { double num = Math.Exp((float)(-unidadesVendidas) * Paso(volumenDia, elasticidad)); return Limitar((float)((double)indice * num)); } public static float Reponer(float indice, float dias) { if (dias <= 0f) { return indice; } double num = Math.Pow(0.5, dias / 2.5f); return Limitar((float)Math.Exp(Math.Log(Math.Max(0.001, indice)) * num)); } public static float Limitar(float i) { if (!float.IsNaN(i) && !float.IsInfinity(i)) { return Math.Max(0.65f, Math.Min(1.75f, i)); } return 1f; } public static string Escribir(Dictionary<string, Entrada> m) { StringBuilder stringBuilder = new StringBuilder(); int num = 0; foreach (KeyValuePair<string, Entrada> item in m) { if (!(Math.Abs(item.Value.Indice - 1f) < 0.01f) && num < 400) { if (stringBuilder.Length > 0) { stringBuilder.Append(';'); } stringBuilder.Append(item.Key).Append('=').Append(item.Value.Indice.ToString("0.###", CultureInfo.InvariantCulture)) .Append('@') .Append(item.Value.Dia.ToString("0.##", CultureInfo.InvariantCulture)); num++; } } return stringBuilder.ToString(); } public static Dictionary<string, Entrada> Leer(string s) { Dictionary<string, Entrada> dictionary = new Dictionary<string, Entrada>(); if (string.IsNullOrEmpty(s)) { return dictionary; } string[] array = s.Split(';'); foreach (string text in array) { int num = text.IndexOf('='); int num2 = text.IndexOf('@'); if (num > 0 && num2 > num && dictionary.Count < 400 && float.TryParse(text.Substring(num + 1, num2 - num - 1), NumberStyles.Float, CultureInfo.InvariantCulture, out var result) && double.TryParse(text.Substring(num2 + 1), NumberStyles.Float, CultureInfo.InvariantCulture, out var result2) && !double.IsNaN(result2)) { dictionary[text.Substring(0, num)] = new Entrada { Indice = Limitar(result), Dia = result2 }; } } return dictionary; } public static float Hoy(Entrada e, double hoy) { if (e != null) { return Reponer(e.Indice, (float)Math.Max(0.0, hoy - e.Dia)); } return 1f; } } public enum EstadoLiquidez { Apretado, Estable, Prospero } public struct RumorMercado { public int Id; public string TituloKey; public string DescripcionKey; public Categoria CategoriaAfectada; public float FactorDemanda; public float FactorOferta; public RumorMercado(int id, string tit, string desc, Categoria cat, flo
plugins/MT.Dialogos/MT.Dialogos.dll
Decompiled a day 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 BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Jotunn.Entities; using Jotunn.Managers; using Jotunn.Utils; using MT.Core; using MT.Core.Diario; using MT.Core.I18n; using MT.Core.Npc; using MT.Core.Rueda; using MT.Core.UI; using MT.Dialogos.Rueda; 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.Dialogos")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+f72fd27a1cef3fefa2078e5313c902bbcd510c4b")] [assembly: AssemblyProduct("MT.Dialogos")] [assembly: AssemblyTitle("MT.Dialogos")] [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.Dialogos { public enum Situacion { Seguir, Esperar, LiderMuerto, AliadoMuerto, Huir, Curo, Ayuda, LiderHerido, Bebo, Jefe, Reencuentro, Muchos, Combate, Baja, BajaLider, FinHerido, FinCombate, Bioma, Noche, Lluvia, Cansado, Cargado, Nadando, Hoguera, Respuesta, Broma, Anecdota, Saludo, HeridoAjeno, Ambiente, FinDuro, VuelveLider, Nieve, Confianza, Recuerdo, JefeVencido, Construir, Dormir, Mazmorra, EquipoNuevo, Lanzo, Barco, Orsted } public struct DefSituacion { public int Prioridad; public float Enfriamiento; public float Probabilidad; public bool Ambiente; } public static class DialogosRules { public const int Urgente = 70; public const float HuecoUrgente = 2f; public const float HuecoNormal = 8f; public const float SilencioAmbiente = 60f; public const float HuecoGrupo = 4f; public const float HuecoGlobal = 15f; public static readonly int Total = Enum.GetValues(typeof(Situacion)).Length; public static readonly DefSituacion[] Defs = Crear(); public static readonly int[] Orden = Ordenar(); public const float VientoTormenta = 0.7f; public const float SinRepetir = 1800f; public static readonly int[] UmbralConfianza = new int[4] { 0, 8, 25, 60 }; private static DefSituacion D(int prioridad, float enfriamiento, float probabilidad, bool ambiente = false) { return new DefSituacion { Prioridad = prioridad, Enfriamiento = enfriamiento, Probabilidad = probabilidad, Ambiente = ambiente }; } private static DefSituacion[] Crear() { DefSituacion[] array = new DefSituacion[Enum.GetValues(typeof(Situacion)).Length]; array[0] = D(100, 5f, 1f); array[1] = D(100, 5f, 1f); array[2] = D(95, 60f, 1f); array[3] = D(92, 45f, 1f); array[4] = D(90, 25f, 1f); array[5] = D(85, 10f, 0.8f); array[6] = D(80, 30f, 0.9f); array[7] = D(75, 30f, 0.8f); array[8] = D(70, 20f, 0.6f); array[9] = D(70, 60f, 1f); array[10] = D(65, 300f, 1f); array[11] = D(60, 60f, 0.5f); array[12] = D(50, 40f, 0.25f); array[13] = D(45, 30f, 0.2f); array[14] = D(45, 40f, 0.35f); array[15] = D(40, 30f, 0.8f); array[16] = D(35, 60f, 0.25f); array[17] = D(30, 90f, 0.9f); array[18] = D(25, 600f, 0.8f); array[19] = D(25, 600f, 0.6f); array[20] = D(20, 90f, 0.5f); array[21] = D(20, 180f, 0.6f); array[22] = D(20, 120f, 0.5f); array[23] = D(20, 240f, 0.5f); array[24] = D(15, 10f, 1f); array[25] = D(10, 150f, 0.2f, ambiente: true); array[26] = D(10, 200f, 0.15f, ambiente: true); array[27] = D(60, 20f, 0.9f); array[28] = D(30, 90f, 0.7f); array[29] = D(10, 120f, 0.25f, ambiente: true); array[30] = D(40, 45f, 0.7f); array[31] = D(62, 60f, 1f); array[32] = D(25, 600f, 0.6f); array[33] = D(64, 60f, 1f); array[34] = D(10, 300f, 0.25f, ambiente: true); array[35] = D(88, 30f, 1f); array[36] = D(15, 300f, 0.3f, ambiente: true); array[37] = D(30, 600f, 0.8f); array[38] = D(35, 300f, 0.8f); array[39] = D(30, 120f, 0.7f); array[40] = D(72, 4f, 1f); array[41] = D(22, 150f, 0.6f); array[42] = D(58, 120f, 0.8f); return array; } private static int[] Ordenar() { int[] array = new int[Defs.Length]; for (int i = 0; i < array.Length; i++) { array[i] = i; } Array.Sort(array, (int a, int b) => (Defs[b].Prioridad == Defs[a].Prioridad) ? a.CompareTo(b) : Defs[b].Prioridad.CompareTo(Defs[a].Prioridad)); return array; } public static string Nombre(Situacion s) { return s.ToString().ToLowerInvariant(); } public static string MatizBarco(bool zarpa, bool hablaNadando, float viento) { if (hablaNadando) { return "nado"; } if (zarpa) { return "zarpa"; } if (!(viento >= 0.7f)) { return null; } return "tormenta"; } public static int Elegir(bool[] activa, float[] listoEn, float ahora, float ultimoDicho, float ultimoGlobal, bool enCombate, float charla, Func<double> azar) { for (int i = 0; i < Orden.Length; i++) { int num = Orden[i]; if (!activa[num] || ahora < listoEn[num]) { continue; } DefSituacion defSituacion = Defs[num]; bool flag = defSituacion.Prioridad >= 70; if (!(ahora - ultimoDicho < (flag ? 2f : 8f)) && (flag || (!(charla <= 0f) && !(ahora - ultimoGlobal < 15f / Math.Max(0.5f, charla)))) && (!defSituacion.Ambiente || (!enCombate && !(ahora - Math.Max(ultimoDicho, ultimoGlobal) < 60f / Math.Max(0.5f, charla))))) { float num2 = (flag ? defSituacion.Probabilidad : Math.Min(1f, defSituacion.Probabilidad * charla)); if (azar() < (double)num2) { listoEn[num] = ahora + Enfriamiento(num, charla); return num; } listoEn[num] = ahora + Enfriamiento(num, charla) * 0.5f; } } return -1; } public static float Enfriamiento(int situacion, float charla) { DefSituacion defSituacion = Defs[situacion]; if (!defSituacion.Ambiente) { return defSituacion.Enfriamiento; } return defSituacion.Enfriamiento / Math.Max(0.5f, charla); } public static int Variante(int total, int ultima, double azar) { if (total <= 1) { return 1; } double num = Math.Max(0.0, Math.Min(0.999999, azar)); if (ultima < 1 || ultima > total) { return 1 + (int)(num * (double)total); } int num2 = 1 + (int)(num * (double)(total - 1)); if (num2 < ultima) { return num2; } return num2 + 1; } public static int Confianza(int dias, int combates, int jefes, int salvo) { double num = (double)Math.Max(0, dias) + (double)Math.Max(0, combates) * 0.5 + (double)(Math.Max(0, jefes) * 5) + (double)Math.Max(0, salvo); int result = 0; for (int i = 1; i < UmbralConfianza.Length; i++) { if (num >= (double)UmbralConfianza[i]) { result = i; } } return result; } public static float Reaccion(bool urgente, double azar) { double num = Math.Max(0.0, Math.Min(1.0, azar)); return (float)(urgente ? (0.2 + num * 0.25) : (0.6 + num * 0.8)); } public static float Duracion(int letras) { return Math.Max(3f, Math.Min(7f, 2.5f + (float)letras * 0.06f)); } } public sealed class BolsaFrases { private readonly string[] _claves; private int _indice; private float _rellenadaEn = float.MinValue; private string _ultima; public int Cuantas => _claves.Length; public BolsaFrases(string[] claves) { _claves = claves ?? new string[0]; _indice = _claves.Length; } public string Sacar(float ahora, bool puedeRepetir, Func<double> azar) { if (_claves.Length == 0) { return null; } if (_indice >= _claves.Length) { if (!puedeRepetir && _rellenadaEn != float.MinValue && ahora - _rellenadaEn < 1800f) { return null; } for (int num = _claves.Length - 1; num > 0; num--) { int num2 = (int)(Math.Max(0.0, Math.Min(0.999999, azar())) * (double)(num + 1)); string text = _claves[num]; _claves[num] = _claves[num2]; _claves[num2] = text; } if (_claves.Length > 1 && _claves[0] == _ultima) { string text2 = _claves[0]; _claves[0] = _claves[_claves.Length - 1]; _claves[_claves.Length - 1] = text2; } _indice = 0; _rellenadaEn = ahora; } return _ultima = _claves[_indice++]; } } public sealed class DialogosCommand : ConsoleCommand { public override string Name => "mt_dialogos"; public override string Help => "mt_dialogos [profile] — MT Dialogues dictionary: lines per profile and situation, and rejected keys"; public override void Run(string[] args) { DiccionarioFrases diccionario = PerfilesDialogo.Diccionario; Console.instance.Print("MT Dialogues: " + diccionario.Total + " lines, " + diccionario.Rechazadas.Count + " rejected keys."); foreach (string id in PerfilesDialogo.Ids) { if (args.Length != 0 && args[0] != id) { continue; } string text = " " + id + ":"; foreach (Situacion value in Enum.GetValues(typeof(Situacion))) { int num = diccionario.Cuantas(id, value); if (num > 0) { text = text + " " + DialogosRules.Nombre(value) + "=" + num; } } Console.instance.Print(text); } for (int i = 0; i < diccionario.Rechazadas.Count && i < 40; i++) { Console.instance.Print(" ! " + diccionario.Rechazadas[i]); } } } public struct ClaveFrase { public string Clave; public string Fuente; public string Matiz; public Situacion Situacion; public int Variante; public const string Prefijo = "dialogo_"; private static readonly Dictionary<string, Situacion> PorNombre = CrearNombres(); private static Dictionary<string, Situacion> CrearNombres() { Dictionary<string, Situacion> dictionary = new Dictionary<string, Situacion>(StringComparer.Ordinal); foreach (Situacion value in Enum.GetValues(typeof(Situacion))) { dictionary[DialogosRules.Nombre(value)] = value; } return dictionary; } public static bool Parsear(string clave, out ClaveFrase r, out string motivo) { r = default(ClaveFrase); motivo = null; if (clave == null || !clave.StartsWith("dialogo_", StringComparison.Ordinal)) { motivo = "sin prefijo dialogo_"; return false; } string[] array = clave.Substring("dialogo_".Length).Split('_'); if (array.Length < 2 || array[0].Length == 0) { motivo = "falta fuente o situación"; return false; } if (!PorNombre.TryGetValue(array[1], out var value)) { motivo = "situación desconocida «" + array[1] + "»"; return false; } int num = array.Length; int variante = 1; if (num > 2 && int.TryParse(array[num - 1], out var result)) { if (result < 2) { motivo = "variante " + result + " (la primera no lleva número)"; return false; } variante = result; num--; } string text = ((num > 2) ? string.Join("_", array, 2, num - 2) : null); if (text != null && text.Length == 0) { motivo = "matiz vacío"; return false; } r = new ClaveFrase { Clave = clave, Fuente = array[0], Situacion = value, Matiz = text, Variante = variante }; return true; } public static string Indice(string fuente, Situacion s, string matiz) { string[] obj = new string[5] { fuente, "|", null, null, null }; int num = (int)s; obj[2] = num.ToString(); obj[3] = "|"; obj[4] = matiz; return string.Concat(obj); } } public sealed class DiccionarioFrases { private readonly Dictionary<string, string[]> _indice = new Dictionary<string, string[]>(StringComparer.Ordinal); private readonly List<string> _rechazadas = new List<string>(); private readonly HashSet<string> _fuentes = new HashSet<string>(StringComparer.Ordinal); private static readonly string[] Vacio = new string[0]; public int Total { get; private set; } public IList<string> Rechazadas => _rechazadas; public ICollection<string> Fuentes => _fuentes; public static DiccionarioFrases Construir(IEnumerable<string> claves, ICollection<string> fuentesValidas) { DiccionarioFrases diccionarioFrases = new DiccionarioFrases(); Dictionary<string, List<ClaveFrase>> dictionary = new Dictionary<string, List<ClaveFrase>>(StringComparer.Ordinal); foreach (string clafe in claves) { if (!ClaveFrase.Parsear(clafe, out var r, out var motivo)) { diccionarioFrases._rechazadas.Add(clafe + ": " + motivo); continue; } if (fuentesValidas != null && !fuentesValidas.Contains(r.Fuente)) { diccionarioFrases._rechazadas.Add(clafe + ": fuente sin perfil «" + r.Fuente + "»"); continue; } string key = ClaveFrase.Indice(r.Fuente, r.Situacion, r.Matiz); if (!dictionary.TryGetValue(key, out var value)) { value = (dictionary[key] = new List<ClaveFrase>()); } value.Add(r); diccionarioFrases._fuentes.Add(r.Fuente); } foreach (KeyValuePair<string, List<ClaveFrase>> item in dictionary) { item.Value.Sort((ClaveFrase a, ClaveFrase b) => a.Variante.CompareTo(b.Variante)); for (int num = 0; num < item.Value.Count; num++) { if (item.Value[num].Variante != num + 1) { diccionarioFrases._rechazadas.Add(item.Value[num].Clave + ": aviso, numeración con hueco (se usa igual)"); break; } } string[] array = new string[item.Value.Count]; for (int num2 = 0; num2 < array.Length; num2++) { array[num2] = item.Value[num2].Clave; } diccionarioFrases._indice[item.Key] = array; diccionarioFrases.Total += array.Length; } return diccionarioFrases; } public string[] De(string fuente, Situacion s, string matiz) { if (!_indice.TryGetValue(ClaveFrase.Indice(fuente, s, matiz), out var value)) { return Vacio; } return value; } public string[] De(string[] fuentes, Situacion s, string matiz) { int num = 0; for (int i = 0; i < fuentes.Length; i++) { num += De(fuentes[i], s, matiz).Length; } if (num == 0) { return Vacio; } string[] array = new string[num]; int num2 = 0; for (int j = 0; j < fuentes.Length; j++) { string[] array2 = De(fuentes[j], s, matiz); Array.Copy(array2, 0, array, num2, array2.Length); num2 += array2.Length; } return array; } public int Cuantas(string fuente, Situacion s) { int num = 0; int num2 = (int)s; string value = fuente + "|" + num2 + "|"; foreach (KeyValuePair<string, string[]> indie in _indice) { if (indie.Key.StartsWith(value, StringComparison.Ordinal)) { num += indie.Value.Length; } } return num; } } public sealed class DirectorDialogos : MonoBehaviour { private sealed class Estado { public Character C; public ZNetView Nview; public MonsterAI Ai; public CompaneroNpc Comp; public string Perfil; public readonly bool[] Activa = new bool[DialogosRules.Total]; public readonly float[] ListoEn = new float[DialogosRules.Total]; public float UltimoDicho = -100f; public float EvaluarEn; public float FinCombateEn = -100f; public float CombateDesde; public float LejosDesde = -1f; public bool Iniciado; public bool PrevSiguiendo; public bool PrevCombate; public bool PrevNoche; public bool LiderMuertoDicho; public bool Duelo; public bool BajaAliada; public int PrevClima; public int MaxEnemigos; public float VidaMinima = 1f; public Biome PrevBioma; public Biome BiomaNuevo; public float BiomaNuevoDesde; public int JefeVisto; public bool Curo; public bool Bebo; public bool Baja; public bool BajaLider; public string Lanzo; public bool JefeVencido; public string JefeVencidoNombre; public bool PrevDentro; public bool PrevCama; public bool PrevSentado; public bool CasiMuere; public bool PeleaDigna; public bool PrevBarco; public bool Zarpa; public int EquipoHash; public float EquipoEn; public Player Saludable; public readonly Dictionary<long, float> Saludados = new Dictionary<long, float>(); } private struct Respuesta { public Estado Quien; public string Bromista; public float En; } private struct Pendiente { public Estado Quien; public string Clave; public string Arg; public int Prioridad; public float En; public Situacion Sit; } private const float RadioOyentes = 35f; private const float CadaBusqueda = 3f; private const string RpcDecir = "MT_DialogoDecir"; private const float VidaEnemigoDigno = 60f; private static readonly Dictionary<Character, Estado> Estados = new Dictionary<Character, Estado>(); private static readonly List<Estado> Lista = new List<Estado>(); private static readonly HashSet<Character> Mudos = new HashSet<Character>(); private static readonly Dictionary<ZDOID, float> Reencuentros = new Dictionary<ZDOID, float>(); private static readonly Dictionary<long, float> UltimoGrupo = new Dictionary<long, float>(); private static readonly List<Respuesta> Respuestas = new List<Respuesta>(); private static readonly List<Pendiente> Pendientes = new List<Pendiente>(); private static readonly int Resting = StringExtensionMethods.GetStableHashCode("Resting"); private static readonly Func<double> Azar = () => Random.value; private static float _ultimoGlobal = -100f; private float _buscarEn; private int _turno; private static readonly Situacion[] TemasRueda = new Situacion[6] { Situacion.Anecdota, Situacion.Recuerdo, Situacion.Broma, Situacion.Ambiente, Situacion.Respuesta, Situacion.Saludo }; private const string PerfilOrsted = "orsted"; private const float DistanciaMiedo = 18f; private static readonly Situacion[] Charla = new Situacion[3] { Situacion.Anecdota, Situacion.Broma, Situacion.Recuerdo }; private static readonly List<string> Recuerdos = new List<string>(); private void Awake() { EventosNpc.AlCurar += AlCurar; EventosNpc.AlConsumir += AlConsumir; EventosNpc.AlLanzar += AlLanzar; } internal static void Responder(Character npc, Player p, string tema) { //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_002c: Invalid comparison between Unknown and I4 //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Invalid comparison between Unknown and I4 //IL_0099: 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_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: 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_010d: Unknown result type (might be due to invalid IL or missing references) ArquetipoConducta val = PersonalidadNpc.De(npc); string text; string text2; if (!(tema == "quien")) { if (tema == "zona") { text = Zona(npc); text2 = "point"; } else { text = ComoEsta(npc); text2 = (((int)val != 2) ? ((npc.GetHealthPercentage() < 0.4f) ? "despair" : "thumbsup") : ((npc.GetHealthPercentage() < 0.4f) ? null : "challenge")); } } else { text = Quien(npc); text2 = (((int)val == 2) ? "challenge" : "flex"); } Chat instance = Chat.instance; if (instance != null) { instance.SetNpcText(((Component)npc).gameObject, Vector3.up * 2.2f, 20f, 6f, npc.GetHoverName(), text, false); } Vector3 val2 = ((Component)p).transform.position - ((Component)npc).transform.position; val2.y = 0f; if (((Vector3)(ref val2)).sqrMagnitude > 0.01f && !npc.IsSwimming() && !Presas.EnPeligro(npc, 18f)) { npc.SetLookDir(((Vector3)(ref val2)).normalized, 0f); } if (!string.IsNullOrEmpty(text2) && !npc.InAttack() && npc.IsOnGround() && !Presas.EnPeligro(npc, 24f)) { ZSyncAnimation component = ((Component)npc).GetComponent<ZSyncAnimation>(); if (component != null) { component.SetTrigger("emote_" + text2); } } } private static string Quien(Character npc) { string text = ((Object)((Component)npc).gameObject).name.Replace("(Clone)", "").Trim(); if (text == "MT_Orsted") { return Tr.Get("dialogo_ask_who_orsted"); } FichaNpc component = ((Component)npc).GetComponent<FichaNpc>(); if ((Object)(object)component != (Object)null && component.Rol >= 0) { string text2 = Tr.Get("dialogo_ask_who_rol_" + component.Rol, new object[1] { component.Rango }); if (!string.IsNullOrEmpty(component.Nombre)) { return Tr.Get("dialogo_ask_who_name", new object[1] { component.Nombre }) + " " + text2; } return text2; } if (text.StartsWith("MT_Guardia")) { return Tr.Get("dialogo_ask_who_guard"); } return Tr.Get("dialogo_ask_who_generic"); } private static string Zona(Character npc) { //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) if (npc.InInterior()) { return Tr.Get("dialogo_ask_area_dungeon"); } return Tr.GetOr("dialogo_ask_area_" + ((object)(Biome)((WorldGenerator.instance != null) ? ((int)WorldGenerator.instance.GetBiome(((Component)npc).transform.position)) : 0)/*cast due to .constrained prefix*/).ToString().ToLowerInvariant(), Tr.Get("dialogo_ask_area_generic")); } private static string ComoEsta(Character npc) { float healthPercentage = npc.GetHealthPercentage(); string text = Tr.Get((healthPercentage > 0.75f) ? "dialogo_ask_how_hp_high" : ((healthPercentage > 0.4f) ? "dialogo_ask_how_hp_mid" : "dialogo_ask_how_hp_low")); HambreNpc component = ((Component)npc).GetComponent<HambreNpc>(); string text2 = (((Object)(object)component == (Object)null) ? "" : (" " + Tr.Get(component.TieneHambre ? "dialogo_ask_how_hungry" : "dialogo_ask_how_fed"))); return text + text2; } internal static void Charlar(Character npc, Player p) { //IL_006e: 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) if (Estados.TryGetValue(npc, out var value) && value.Perfil != null) { int num = Random.Range(0, TemasRueda.Length); for (int i = 0; i < TemasRueda.Length; i++) { if (Decir(value, TemasRueda[(num + i) % TemasRueda.Length], null, p.GetPlayerName(), Time.time, mezclar: true)) { return; } } } Chat instance = Chat.instance; if (instance != null) { instance.SetNpcText(((Component)npc).gameObject, Vector3.up * 2.2f, 20f, 3f, npc.GetHoverName(), Tr.Get("dialogo_talk_nothing"), false); } } private void OnDestroy() { EventosNpc.AlCurar -= AlCurar; EventosNpc.AlConsumir -= AlConsumir; EventosNpc.AlLanzar -= AlLanzar; } private static void AlLanzar(Character quien, string nombreToken) { if (Estados.TryGetValue(quien, out var value)) { value.Lanzo = nombreToken; value.EvaluarEn = 0f; } } private static void AlCurar(Character quien, Character objetivo) { if (!((Object)(object)quien == (Object)(object)objetivo) && Estados.TryGetValue(quien, out var value)) { value.Curo = true; value.EvaluarEn = 0f; Player val = (Player)(object)((objetivo is Player) ? objetivo : null); if ((Object)(object)val != (Object)null && (Object)(object)value.Comp != (Object)null && value.Comp.LiderId == val.GetPlayerID() && (Object)(object)value.Nview != (Object)null && value.Nview.IsValid() && value.Nview.IsOwner()) { MemoriaCompanero.De(value.Nview, value.Comp.LiderId)?.SumarSalvo(); } } } private static void AlConsumir(Character quien, string objeto) { if (Estados.TryGetValue(quien, out var value)) { value.Bebo = true; value.EvaluarEn = 0f; } } private static bool Digno(Character c) { if ((Object)(object)c != (Object)null) { if (!c.IsBoss() && c.GetLevel() <= 1) { return c.GetMaxHealth() >= 60f; } return true; } return false; } internal static void AlMorir(Character muerto) { //IL_012a: 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_00ac: 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_02f6: 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_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_01e1: Unknown result type (might be due to invalid IL or missing references) Player val = (Player)(object)((muerto is Player) ? muerto : null); Vector3 val2; if ((Object)(object)val != (Object)null) { for (int i = 0; i < Lista.Count; i++) { Estado estado = Lista[i]; if (!((Object)(object)estado.C == (Object)null) && !((Object)(object)estado.Comp == (Object)null) && estado.Comp.LiderId == val.GetPlayerID() && !((Object)(object)estado.Nview == (Object)null) && estado.Nview.IsValid() && estado.Nview.IsOwner()) { val2 = ((Component)estado.C).transform.position - ((Component)val).transform.position; if (!(((Vector3)(ref val2)).sqrMagnitude > 3600f)) { estado.Duelo = true; estado.Nview.GetZDO().Set("mt_dialogo_lider_caido", true); estado.ListoEn[2] = 0f; Decir(estado, Situacion.LiderMuerto, null, val.GetPlayerName(), Time.time); estado.LiderMuertoDicho = true; } } } } else if ((int)muerto.m_faction == 0 || (Object)(object)((Component)muerto).GetComponent<CompaneroNpc>() != (Object)null) { string hoverName = muerto.GetHoverName(); float time = Time.time; bool flag = false; HitData val3 = Campos.UltimoGolpe.Invoke(muerto); Character val4 = ((val3 != null) ? val3.GetAttacker() : null); for (int j = 0; j < Lista.Count; j++) { Estado estado2 = Lista[j]; if ((Object)(object)estado2.C == (Object)null || (Object)(object)estado2.C == (Object)(object)muerto || estado2.C.IsDead()) { continue; } val2 = ((Component)estado2.C).transform.position - ((Component)muerto).transform.position; if (((Vector3)(ref val2)).sqrMagnitude > 1600f) { continue; } estado2.BajaAliada = true; (((Component)estado2.C).GetComponent<MemoriaEmocionalNpc>() ?? ((Component)estado2.C).gameObject.AddComponent<MemoriaEmocionalNpc>()).RegistrarBajaAliada(muerto, val4); if (!flag && (Object)(object)estado2.Nview != (Object)null && estado2.Nview.IsValid() && estado2.Nview.IsOwner()) { estado2.ListoEn[3] = 0f; if (Decir(estado2, Situacion.AliadoMuerto, null, hoverName, time)) { flag = true; } } } } else { if (!Digno(muerto)) { return; } if (muerto.IsBoss()) { for (int k = 0; k < Lista.Count; k++) { Estado estado3 = Lista[k]; Player val5 = (((Object)(object)estado3.Comp != (Object)null && estado3.Comp.Siguiendo) ? estado3.Comp.Lider : null); if (!((Object)(object)val5 == (Object)null) && !(Vector3.Distance(((Component)val5).transform.position, ((Component)muerto).transform.position) > 60f)) { estado3.JefeVencido = true; estado3.JefeVencidoNombre = muerto.m_name; } } } HitData val6 = Campos.UltimoGolpe.Invoke(muerto); Character val7 = ((val6 != null) ? val6.GetAttacker() : null); if ((Object)(object)val7 == (Object)null) { return; } if (Estados.TryGetValue(val7, out var value)) { value.Baja = true; return; } Player val8 = (Player)(object)((val7 is Player) ? val7 : null); if ((Object)(object)val8 == (Object)null || (!muerto.IsBoss() && muerto.GetLevel() <= 1)) { return; } long playerID = val8.GetPlayerID(); for (int l = 0; l < Lista.Count; l++) { Estado estado4 = Lista[l]; if ((Object)(object)estado4.Comp != (Object)null && estado4.Comp.LiderId == playerID && estado4.Comp.Siguiendo) { estado4.BajaLider = true; } } } } private void Update() { if (!MTDialogosPlugin.Activo.Value || (Object)(object)Player.m_localPlayer == (Object)null || (Object)(object)ZNet.instance == (Object)null) { return; } float time = Time.time; if (time >= _buscarEn) { _buscarEn = time + 3f; Buscar(); } Responder(time); Soltar(time); if (Lista.Count == 0) { return; } for (int i = 0; i < 3 && i < Lista.Count; i++) { _turno = (_turno + 1) % Lista.Count; Estado estado = Lista[_turno]; if (!(time < estado.EvaluarEn)) { estado.EvaluarEn = time + 0.9f + Random.value * 0.2f; Evaluar(estado, time); } } } private static void Buscar() { for (int num = Lista.Count - 1; num >= 0; num--) { if ((Object)(object)Lista[num].C == (Object)null) { Estados.Remove(Lista[num].C); Lista.RemoveAt(num); } } if (Mudos.Count > 512) { Mudos.Clear(); } Mudos.RemoveWhere((Character c) => (Object)(object)c == (Object)null); List<Character> allCharacters = Character.GetAllCharacters(); for (int num2 = 0; num2 < allCharacters.Count; num2++) { Character val = allCharacters[num2]; if (!((Object)(object)val == (Object)null) && !Estados.ContainsKey(val) && !Mudos.Contains(val)) { string text = PerfilesDialogo.De(val); if (text == null) { Mudos.Add(val); continue; } Estado estado = new Estado { C = val, Perfil = text, Nview = ((Component)val).GetComponent<ZNetView>(), Ai = ((Component)val).GetComponent<MonsterAI>(), Comp = ((Component)val).GetComponent<CompaneroNpc>(), EvaluarEn = Time.time + 1f + Random.value }; Estados[val] = estado; Lista.Add(estado); } } } private static bool OrstedCerca(Character c) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < Lista.Count; i++) { Estado estado = Lista[i]; if (!(estado.Perfil != "orsted") && !((Object)(object)estado.C == (Object)null) && !estado.C.IsDead()) { Vector3 val = ((Component)estado.C).transform.position - ((Component)c).transform.position; if (((Vector3)(ref val)).sqrMagnitude < 324f) { return true; } } } return false; } private static void A(Estado e, Situacion s) { e.Activa[(int)s] = true; } private static void Quitar(Estado e, Situacion s) { e.Activa[(int)s] = false; } private static void Evaluar(Estado e, float t) { //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_040e: Unknown result type (might be due to invalid IL or missing references) //IL_0419: Unknown result type (might be due to invalid IL or missing references) //IL_0796: Unknown result type (might be due to invalid IL or missing references) //IL_079b: Unknown result type (might be due to invalid IL or missing references) //IL_07a2: Unknown result type (might be due to invalid IL or missing references) //IL_07c5: Unknown result type (might be due to invalid IL or missing references) //IL_0c74: Unknown result type (might be due to invalid IL or missing references) //IL_0c79: Unknown result type (might be due to invalid IL or missing references) Character c = e.C; bool curo = e.Curo; bool bebo = e.Bebo; bool baja = e.Baja; bool bajaLider = e.BajaLider; bool jefeVencido = e.JefeVencido; string lanzo = e.Lanzo; e.Lanzo = null; e.Curo = (e.Bebo = (e.Baja = (e.BajaLider = (e.JefeVencido = false)))); if ((Object)(object)c == (Object)null || c.IsDead() || (Object)(object)e.Nview == (Object)null || !e.Nview.IsValid() || !e.Nview.IsOwner()) { return; } Player localPlayer = Player.m_localPlayer; if (BaseAI.IsEnemy((Character)(object)localPlayer, c)) { e.Iniciado = false; } else { if (!HayOyentes(((Component)c).transform.position)) { return; } for (int i = 0; i < e.Activa.Length; i++) { e.Activa[i] = false; } string text = ""; string text2 = null; string matiz = null; string arg = ""; e.Saludable = null; CompaneroNpc comp = e.Comp; bool flag = (Object)(object)comp != (Object)null && comp.Siguiendo; Player val = (flag ? comp.Lider : null); Character val2 = (((Object)(object)e.Ai != (Object)null) ? ((BaseAI)e.Ai).GetTargetCreature() : null); bool flag2 = (Object)(object)val2 != (Object)null || c.InAttack() || Presas.EnPeligro(c, 20f); bool flag3 = (Object)(object)val2 != (Object)null && val2.IsBoss(); bool flag4 = c.InInterior(); MemoriaCompanero memoriaCompanero = (((Object)(object)comp != (Object)null && comp.LiderId != 0L) ? MemoriaCompanero.De(e.Nview, comp.LiderId) : null); int num = memoriaCompanero?.Confianza ?? 0; if ((Object)(object)comp != (Object)null && e.Iniciado) { if (flag && !e.PrevSiguiendo) { A(e, Situacion.Seguir); } else if (!flag && e.PrevSiguiendo && comp.LiderId != 0L) { A(e, Situacion.Esperar); } } e.PrevSiguiendo = flag; float healthPercentage = c.GetHealthPercentage(); if (flag2 && healthPercentage < 0.3f) { A(e, Situacion.Ayuda); } if (curo) { A(e, Situacion.Curo); } if (lanzo != null) { A(e, Situacion.Lanzo); } if (bebo) { A(e, Situacion.Bebo); } int num2 = (flag2 ? Enemigos(c, 15f) : 0); bool flag5 = false; if (flag2 && !e.PrevCombate) { e.CombateDesde = t; e.MaxEnemigos = 0; e.VidaMinima = 1f; e.CasiMuere = false; e.BajaAliada = false; e.PeleaDigna = Digno(val2) || num2 >= 2; if (t - e.FinCombateEn > 15f && (Digno(val2) || num2 >= 2)) { A(e, Situacion.Combate); } } if (flag2) { if (num2 > e.MaxEnemigos) { e.MaxEnemigos = num2; } if (healthPercentage < e.VidaMinima) { e.VidaMinima = healthPercentage; } if (Digno(val2)) { e.PeleaDigna = true; } if ((Object)(object)val != (Object)null && !((Character)val).IsDead() && ((Character)val).GetHealthPercentage() < 0.15f) { e.CasiMuere = true; } if (baja && num2 >= 1) { A(e, Situacion.Baja); } } if (!flag2 && e.PrevCombate) { e.FinCombateEn = t; flag5 = true; } e.PrevCombate = flag2; if (flag5 && (Object)(object)val == (Object)null) { Final(e, t, 1f); } if (bajaLider) { A(e, Situacion.BajaLider); } if (flag3 && ((Object)val2).GetInstanceID() != e.JefeVisto) { e.JefeVisto = ((Object)val2).GetInstanceID(); A(e, Situacion.Jefe); text = val2.m_name; } if (num2 >= 5) { A(e, Situacion.Muchos); } if (e.Perfil != "orsted" && OrstedCerca(c)) { A(e, Situacion.Orsted); } if ((Object)(object)val != (Object)null && Vector3.Distance(((Component)val).transform.position, ((Component)c).transform.position) < 30f) { if (((Character)val).IsDead()) { if (!e.LiderMuertoDicho) { A(e, Situacion.LiderMuerto); } } else { e.LiderMuertoDicho = false; e.Duelo = e.Nview.GetZDO().GetBool("mt_dialogo_lider_caido", false); if (e.Duelo) { A(e, Situacion.VuelveLider); } float healthPercentage2 = ((Character)val).GetHealthPercentage(); if (flag2 && healthPercentage2 < 0.25f && (num2 >= 3 || flag3)) { A(e, Situacion.Huir); } if (flag2 && healthPercentage2 < 0.35f) { A(e, Situacion.LiderHerido); } if (flag5) { Final(e, t, healthPercentage2); if (memoriaCompanero != null && e.PeleaDigna) { memoriaCompanero.SumarCombate(); } if (memoriaCompanero != null && e.CasiMuere) { memoriaCompanero.SumarCasi(); } } if (jefeVencido && e.JefeVencidoNombre != null) { A(e, Situacion.JefeVencido); memoriaCompanero?.Jefe(e.JefeVencidoNombre); } bool flag6 = ((Character)val).InInterior(); if (e.Iniciado && flag6 && !e.PrevDentro) { A(e, Situacion.Mazmorra); } e.PrevDentro = flag6; bool flag7 = ((Character)val).InBed(); if (e.Iniciado && flag7 && !e.PrevCama) { A(e, Situacion.Dormir); } e.PrevCama = flag7; if (!flag2) { if (((Character)val).GetStaminaPercentage() < 0.1f && !((Character)val).IsSwimming()) { A(e, Situacion.Cansado); } if (((Character)val).IsEncumbered()) { A(e, Situacion.Cargado); } if (((Character)val).IsSwimming()) { A(e, Situacion.Nadando); } Navegar(e, val, t); SEMan sEMan = ((Character)val).GetSEMan(); bool flag8 = ((Character)val).IsSitting() || (sEMan != null && sEMan.HaveStatusEffect(Resting)); if (flag8 && !e.PrevSentado) { e.ListoEn[23] = Mathf.Min(e.ListoEn[23], t); e.ListoEn[26] = Mathf.Min(e.ListoEn[26], t + 12f); e.ListoEn[34] = Mathf.Min(e.ListoEn[34], t + 25f); e.ListoEn[25] = Mathf.Min(e.ListoEn[25], t + 40f); } else if (flag8) { Situacion[] charla = Charla; foreach (Situacion situacion in charla) { e.ListoEn[(int)situacion] = Mathf.Min(e.ListoEn[(int)situacion], t + 45f); } } e.PrevSentado = flag8; if (flag8) { A(e, Situacion.Hoguera); } A(e, Situacion.Broma); A(e, Situacion.Anecdota); if ((Object)(object)val == (Object)(object)localPlayer && ((Character)localPlayer).InPlaceMode()) { A(e, Situacion.Construir); } if (t >= e.EquipoEn) { e.EquipoEn = t + 5f; int num3 = Equipo(val); if (e.Iniciado && e.EquipoHash != 0 && num3 != 0 && num3 != e.EquipoHash) { A(e, Situacion.EquipoNuevo); } e.EquipoHash = num3; } if (memoriaCompanero != null) { if (num > memoriaCompanero.ConfianzaDicha) { A(e, Situacion.Confianza); } if (t >= e.ListoEn[34]) { Recordar(memoriaCompanero, out matiz, out arg); } if (matiz != null) { A(e, Situacion.Recuerdo); } } } if (!flag4 && !((Character)val).InInterior()) { text2 = Bioma(e, val, t); } ZDOID uid = e.Nview.GetZDO().m_uid; if (!Reencuentros.TryGetValue(uid, out var value) || t - value > 600f) { A(e, Situacion.Reencuentro); } Reencuentros[uid] = t; } } else if (!flag2) { if ((Object)(object)comp != (Object)null && !flag && comp.LiderId != 0L) { VuelveDueno(e, comp, t); } Neutral(e, t); if (e.Activa[31]) { Quitar(e, Situacion.Saludo); e.Saludable = null; } if ((Object)(object)e.Saludable != (Object)null && text.Length == 0) { text = e.Saludable.GetPlayerName(); } } if (!flag4 && ((Object)(object)val == (Object)null || !((Character)val).InInterior())) { bool flag9 = (Object)(object)EnvMan.instance != (Object)null && EnvMan.IsNight(); if (e.Iniciado && flag9 && !e.PrevNoche) { A(e, Situacion.Noche); } e.PrevNoche = flag9; int num4 = Clima(); if (e.Iniciado && num4 != e.PrevClima && num4 != 0) { A(e, (num4 == 2) ? Situacion.Nieve : Situacion.Lluvia); } e.PrevClima = num4; } if (!e.Iniciado) { bool flag10 = e.Activa[10]; for (int k = 0; k < e.Activa.Length; k++) { e.Activa[k] = false; } e.Activa[10] = flag10; e.Iniciado = true; } long num5 = (((Object)(object)comp != (Object)null) ? comp.LiderId : 0); if (num5 != 0L && UltimoGrupo.TryGetValue(num5, out var value2) && t - value2 < 4f) { for (int l = 0; l < e.Activa.Length; l++) { if (DialogosRules.Defs[l].Prioridad < 85) { e.Activa[l] = false; } } } Player val3 = (((Object)(object)val != (Object)null) ? val : (((Object)(object)e.Saludable != (Object)null) ? e.Saludable : (((Object)(object)comp != (Object)null && comp.LiderId != 0L) ? comp.Lider : null))); if ((Object)(object)val3 == (Object)(object)localPlayer && Ocupado()) { for (int m = 0; m < e.Activa.Length; m++) { if (DialogosRules.Defs[m].Prioridad < 70) { e.Activa[m] = false; } } } int num6 = DialogosRules.Elegir(e.Activa, e.ListoEn, t, e.UltimoDicho, _ultimoGlobal, flag2, MTDialogosPlugin.Charla.Value, Azar); if (num6 < 0) { return; } Situacion situacion2 = (Situacion)num6; string matiz2 = null; bool mezclar = false; string text3 = (((Object)(object)val3 != (Object)null) ? val3.GetPlayerName() : ""); switch (situacion2) { case Situacion.JefeVencido: text = e.JefeVencidoNombre ?? ""; break; case Situacion.Lanzo: text = lanzo ?? ""; break; case Situacion.Bioma: matiz2 = text2; text = ((text2 != null) ? ("$biome_" + text2) : ""); break; case Situacion.Recuerdo: matiz2 = matiz; text = arg; break; case Situacion.Confianza: matiz2 = "nivel" + num.ToString(CultureInfo.InvariantCulture); text = text3; break; case Situacion.Saludo: if ((Object)(object)EnvMan.instance != (Object)null && EnvMan.IsNight()) { matiz2 = "noche"; } break; case Situacion.Barco: matiz2 = DialogosRules.MatizBarco(e.Zarpa, c.IsSwimming(), ((Object)(object)EnvMan.instance != (Object)null) ? EnvMan.instance.GetWindIntensity() : 0f); text = text3; break; case Situacion.Seguir: case Situacion.Reencuentro: case Situacion.Hoguera: if (num >= 2) { matiz2 = "amigo"; mezclar = true; } text = text3; break; case Situacion.VuelveLider: if (e.Duelo) { matiz2 = "muerte"; } else if (num >= 2) { matiz2 = "amigo"; mezclar = true; } text = text3; break; case Situacion.FinDuro: if (e.BajaAliada) { matiz2 = "luto"; e.BajaAliada = false; } text = text3; break; default: text = text3; break; case Situacion.Jefe: break; } if (Decir(e, situacion2, matiz2, text, t, mezclar)) { if (situacion2 == Situacion.Confianza) { memoriaCompanero?.Confio(num); } if (situacion2 == Situacion.LiderMuerto) { e.LiderMuertoDicho = true; } if (situacion2 == Situacion.VuelveLider && e.Duelo) { e.Duelo = false; e.Nview.GetZDO().Set("mt_dialogo_lider_caido", false); } if (situacion2 == Situacion.Bioma) { e.PrevBioma = e.BiomaNuevo; } if (situacion2 == Situacion.Barco) { e.Zarpa = false; } if (situacion2 == Situacion.Saludo && (Object)(object)e.Saludable != (Object)null) { e.Saludados[e.Saludable.GetPlayerID()] = t; } if (situacion2 == Situacion.Broma) { PedirRespuesta(e, t); } if (situacion2 == Situacion.JefeVencido) { e.JefeVencidoNombre = null; } Mirar(e, situacion2, val); } } } private static void Final(Estado e, float t, float vidaLider) { float num = t - e.CombateDesde; if (e.BajaAliada) { A(e, Situacion.FinDuro); } else if (vidaLider < 0.5f) { A(e, Situacion.FinHerido); } else if (e.VidaMinima < 0.5f || num > 45f || e.MaxEnemigos >= 4) { A(e, Situacion.FinDuro); } else if (num < 30f && e.MaxEnemigos <= 2 && e.VidaMinima > 0.7f && vidaLider > 0.7f) { A(e, Situacion.FinCombate); } } private unsafe static string Bioma(Estado e, Player lider, float t) { //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_000d: 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_001e: 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_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_0039: 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_0041: 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_0076: 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) Biome currentBiome = lider.GetCurrentBiome(); if ((int)currentBiome == 0) { return null; } if ((int)e.PrevBioma == 0 || !e.Iniciado) { e.PrevBioma = currentBiome; return null; } if (currentBiome == e.PrevBioma) { e.BiomaNuevo = (Biome)0; return null; } if (currentBiome != e.BiomaNuevo) { e.BiomaNuevo = currentBiome; e.BiomaNuevoDesde = t; return null; } if (t - e.BiomaNuevoDesde < 5f) { return null; } A(e, Situacion.Bioma); if (t < e.ListoEn[17]) { e.PrevBioma = currentBiome; } return ((object)(*(Biome*)(¤tBiome))/*cast due to .constrained prefix*/).ToString().ToLowerInvariant(); } private static int Clima() { EnvSetup val = (((Object)(object)EnvMan.instance != (Object)null) ? EnvMan.instance.GetCurrentEnvironment() : null); if (val == null) { return 0; } if (val.m_isFreezing) { return 2; } return val.m_isWet ? 1 : 0; } private static void VuelveDueno(Estado e, CompaneroNpc comp, float t) { //IL_001d: 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) Player lider = comp.Lider; float num = (((Object)(object)lider != (Object)null) ? Vector3.Distance(((Component)lider).transform.position, ((Component)e.C).transform.position) : 999f); if (num > 25f) { if (e.LejosDesde < 0f) { e.LejosDesde = t; } } else if (num < 6f && e.LejosDesde >= 0f) { if (t - e.LejosDesde > 60f) { A(e, Situacion.VuelveLider); } e.LejosDesde = -1f; } } private static void Neutral(Estado e, float t) { //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_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) Vector3 position = ((Component)e.C).transform.position; List<Player> allPlayers = Player.GetAllPlayers(); bool flag = false; for (int i = 0; i < allPlayers.Count; i++) { Player val = allPlayers[i]; if ((Object)(object)val == (Object)null || ((Character)val).IsDead()) { continue; } float num = Vector3.Distance(((Component)val).transform.position, position); if (!(num > 8f)) { flag = true; if (((Character)val).GetHealthPercentage() < 0.3f) { A(e, Situacion.HeridoAjeno); } if (num < 5f && (Object)(object)e.Saludable == (Object)null && (!e.Saludados.TryGetValue(val.GetPlayerID(), out var value) || t - value > 300f)) { e.Saludable = val; A(e, Situacion.Saludo); } } } if (flag) { A(e, Situacion.Ambiente); } if (e.Saludados.Count > 32) { e.Saludados.Clear(); } } private static void Navegar(Estado e, Player lider, float t) { bool flag = ((Character)lider).IsAttachedToShip() || (Object)(object)((Character)lider).GetStandingOnShip() != (Object)null; if (flag && !e.PrevBarco) { e.Zarpa = true; e.ListoEn[41] = Mathf.Min(e.ListoEn[41], t + 3f); } if (!flag) { e.Zarpa = false; } e.PrevBarco = flag; if (flag) { A(e, Situacion.Barco); } } private static void Mirar(Estado e, Situacion s, Player lider) { //IL_00d2: 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_00ec: 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) if (e.C.IsSwimming() || e.PrevCombate || s == Situacion.Lanzo || e.C.InAttack() || ((Object)(object)e.Ai != (Object)null && (Object)(object)((BaseAI)e.Ai).GetTargetCreature() != (Object)null) || Presas.EnPeligro(e.C, 20f) || Time.time - e.FinCombateEn < 8f) { return; } Player val = (((Object)(object)e.Saludable != (Object)null) ? e.Saludable : lider); if ((Object)(object)val == (Object)null) { CompaneroNpc comp = e.Comp; if ((Object)(object)comp != (Object)null && comp.LiderId != 0L) { val = comp.Lider; } } if (!((Object)(object)val == (Object)null) && s != Situacion.Noche && s != Situacion.Lluvia && s != Situacion.Nieve && s != Situacion.Bioma) { Vector3 val2 = ((Component)val).transform.position - ((Component)e.C).transform.position; val2.y = 0f; if (((Vector3)(ref val2)).sqrMagnitude > 0.01f && ((Vector3)(ref val2)).sqrMagnitude < 225f) { e.C.SetLookDir(((Vector3)(ref val2)).normalized, 0f); } } } private static bool HayOyentes(Vector3 pos) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) List<Player> allPlayers = Player.GetAllPlayers(); for (int i = 0; i < allPlayers.Count; i++) { if ((Object)(object)allPlayers[i] != (Object)null && Vector3.Distance(((Component)allPlayers[i]).transform.position, pos) < 35f) { return true; } } return false; } private static int Enemigos(Character c, float radio) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) int num = 0; Vector3 position = ((Component)c).transform.position; List<Character> allCharacters = Character.GetAllCharacters(); for (int i = 0; i < allCharacters.Count; i++) { Character val = allCharacters[i]; if (!((Object)(object)val == (Object)null) && !((Object)(object)val == (Object)(object)c) && !val.IsDead() && !(Vector3.Distance(((Component)val).transform.position, position) > radio) && BaseAI.IsEnemy(c, val)) { num++; } } return num; } private static bool Decir(Estado e, Situacion s, string matiz, string arg, float t, bool mezclar = false) { string text = PerfilesDialogo.Elegir(e.Perfil, s, matiz, t, mezclar); if (text == null) { return false; } int prioridad = DialogosRules.Defs[(int)s].Prioridad; e.UltimoDicho = t; if ((Object)(object)e.Comp != (Object)null && e.Comp.LiderId != 0L) { UltimoGrupo[e.Comp.LiderId] = t; } if (prioridad < 70) { _ultimoGlobal = t; } Pendientes.Add(new Pendiente { Quien = e, Clave = text, Arg = (arg ?? ""), Prioridad = prioridad, Sit = s, En = t + DialogosRules.Reaccion(prioridad >= 70, Random.value) }); return true; } private static void Soltar(float t) { //IL_007a: Unknown result type (might be due to invalid IL or missing references) for (int num = Pendientes.Count - 1; num >= 0; num--) { Pendiente pendiente = Pendientes[num]; if (!(t < pendiente.En)) { Pendientes.RemoveAt(num); Estado quien = pendiente.Quien; if (!((Object)(object)quien.C == (Object)null) && !quien.C.IsDead() && !((Object)(object)quien.Nview == (Object)null) && quien.Nview.IsValid()) { Enviar(quien.Nview.GetZDO().m_uid, pendiente.Clave, pendiente.Arg, pendiente.Prioridad); Gesto(quien, pendiente.Sit); } } } } private static string GestoDe(Situacion s) { switch (s) { case Situacion.Reencuentro: case Situacion.Saludo: case Situacion.VuelveLider: return "wave"; case Situacion.JefeVencido: return "cheer"; case Situacion.Seguir: case Situacion.FinCombate: case Situacion.Construir: case Situacion.EquipoNuevo: return "thumbsup"; case Situacion.Jefe: case Situacion.Muchos: case Situacion.Combate: return "challenge"; case Situacion.Broma: return "laugh"; case Situacion.Respuesta: case Situacion.Recuerdo: return "shrug"; case Situacion.Bioma: case Situacion.Anecdota: case Situacion.Mazmorra: return "point"; case Situacion.Confianza: return "bow"; case Situacion.Ayuda: case Situacion.LiderHerido: return "comehere"; case Situacion.LiderMuerto: case Situacion.AliadoMuerto: case Situacion.FinDuro: return "despair"; case Situacion.Esperar: return "nonono"; default: return null; } } private static void Gesto(Estado e, Situacion s) { //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) string text = GestoDe(s); Character val = e?.C; if ((Object)(object)val != (Object)null && !PersonalidadNpc.PermiteGesto(val, text)) { text = null; } if (text == null || (Object)(object)val == (Object)null || val.IsDead() || val.InAttack() || val.IsSwimming() || !val.IsOnGround() || Presas.EnPeligro(val, 24f) || ((Object)(object)e.Comp != (Object)null && e.Comp.Sentado)) { return; } if (s != Situacion.Combate && s != Situacion.Jefe && s != Situacion.Muchos) { Vector3 velocity = val.GetVelocity(); if (((Vector3)(ref velocity)).magnitude > 2.5f) { return; } } ZSyncAnimation component = ((Component)val).GetComponent<ZSyncAnimation>(); if (!((Object)(object)component == (Object)null)) { component.SetTrigger("emote_" + text); } } private static bool Ocupado() { if (!InventoryGui.IsVisible() && !Menu.IsVisible() && !Minimap.IsOpen() && !TextInput.IsVisible() && !Console.IsVisible()) { if ((Object)(object)Chat.instance != (Object)null) { return Chat.instance.HasFocus(); } return false; } return true; } private static int Equipo(Player p) { //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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Invalid comparison between Unknown and I4 //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Invalid comparison between Unknown and I4 //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Invalid comparison between Unknown and I4 //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Invalid comparison between Unknown and I4 Inventory inventory = ((Humanoid)p).GetInventory(); if (inventory == null) { return 0; } int num = 17; List<ItemData> equippedItems = inventory.GetEquippedItems(); for (int i = 0; i < equippedItems.Count; i++) { ItemData val = equippedItems[i]; ItemType itemType = val.m_shared.m_itemType; if ((int)itemType == 6 || (int)itemType == 7 || (int)itemType == 11 || (int)itemType == 17) { num = num * 31 + StringExtensionMethods.GetStableHashCode(val.m_shared.m_name); } } if (num != 17) { return num; } return 0; } private static void Recordar(MemoriaCompanero m, out string matiz, out string arg) { matiz = null; arg = ""; Recuerdos.Clear(); List<string> list = m.Jefes(); if (list.Count > 0) { Recuerdos.Add("jefe"); } if (m.Dias >= 3) { Recuerdos.Add("dias"); } if (m.Salvo >= 3) { Recuerdos.Add("salvo"); } if (m.Casi >= 1) { Recuerdos.Add("casi"); } if (Recuerdos.Count != 0) { matiz = Recuerdos[Random.Range(0, Recuerdos.Count)]; CultureInfo invariantCulture = CultureInfo.InvariantCulture; if (matiz == "jefe") { arg = list[Random.Range(0, list.Count)]; } else if (matiz == "dias") { arg = m.Dias.ToString(invariantCulture); } else if (matiz == "salvo") { arg = m.Salvo.ToString(invariantCulture); } } } private static void PedirRespuesta(Estado quien, float t) { //IL_00c2: 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) if ((Object)(object)quien.Comp == (Object)null || quien.Comp.LiderId == 0L || Random.value > 0.3f) { return; } for (int i = 0; i < Lista.Count; i++) { Estado estado = Lista[i]; if (estado != quien && !((Object)(object)estado.C == (Object)null) && !((Object)(object)estado.Comp == (Object)null) && estado.Comp.LiderId == quien.Comp.LiderId && estado.Comp.Siguiendo && !((Object)(object)estado.Nview == (Object)null) && estado.Nview.IsValid() && estado.Nview.IsOwner() && !(Vector3.Distance(((Component)estado.C).transform.position, ((Component)quien.C).transform.position) > 12f)) { Respuestas.Add(new Respuesta { Quien = estado, Bromista = quien.Perfil, En = t + 2.5f }); break; } } } private static void Responder(float t) { for (int num = Respuestas.Count - 1; num >= 0; num--) { Respuesta respuesta = Respuestas[num]; if (!(t < respuesta.En)) { Respuestas.RemoveAt(num); Estado quien = respuesta.Quien; if (!((Object)(object)quien.C == (Object)null) && !quien.C.IsDead() && !((Object)(object)quien.Nview == (Object)null) && quien.Nview.IsValid() && quien.Nview.IsOwner() && !(t - quien.UltimoDicho < 2f)) { Decir(quien, Situacion.Respuesta, (respuesta.Bromista != quien.Perfil) ? respuesta.Bromista : null, "", t); } } } } private static void Enviar(ZDOID npc, string clave, string arg, int prioridad) { //IL_0044: 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) if (ZRoutedRpc.instance != null) { ZRoutedRpc.instance.InvokeRoutedRPC(0L, "MT_DialogoDecir", new object[4] { npc, clave, arg ?? "", prioridad }); } else { Recibir(0L, npc, clave, arg ?? "", prioridad); } } private static void Recibir(long remitente, ZDOID npc, string clave, string arg, int prioridad) { //IL_0082: 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_011e: 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_0178: 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_01b6: Unknown result type (might be due to invalid IL or missing references) if (!MTDialogosPlugin.Activo.Value || (Object)(object)ZNetScene.instance == (Object)null || (Object)(object)Chat.instance == (Object)null || string.IsNullOrEmpty(clave) || !clave.StartsWith("dialogo_")) { return; } arg = ((arg == null) ? "" : arg.Replace("<", "").Replace(">", "")); if (arg.Length > 64) { arg = arg.Substring(0, 64); } GameObject val = ZNetScene.instance.FindInstance(npc); if ((Object)(object)val == (Object)null) { return; } string text = ((arg.Length > 0) ? Tr.Get(clave, new object[1] { arg.StartsWith("$") ? Tr.Localize(arg) : arg }) : Tr.Get(clave)); if (text == clave) { return; } Character component = val.GetComponent<Character>(); string text2 = (((Object)(object)component != (Object)null) ? component.GetHoverName() : ""); bool flag = prioridad >= 70; float num = (((Object)(object)component != (Object)null) ? (component.GetTopPoint().y - val.transform.position.y + 0.9f) : 2.6f); float num2 = DialogosRules.Duracion(text.Length) * MTDialogosPlugin.Duracion.Value; bool flag2 = MTDialogosPlugin.Grande.Value || (flag && MTDialogosPlugin.GrandeUrgente.Value); Chat.instance.SetNpcText(val, Vector3.up * num, MTDialogosPlugin.Distancia.Value, num2, text2, text, flag2); Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { return; } float num3 = Vector3.Distance(((Component)localPlayer).transform.position, val.transform.position); if (MTDialogosPlugin.UrgenteEnPantalla.Value && flag && num3 < 30f) { CompaneroNpc val2 = (((Object)(object)component != (Object)null) ? Companeros.De(component) : null); if ((Object)(object)val2 != (Object)null && val2.LiderId == localPlayer.GetPlayerID()) { ((Character)localPlayer).Message((MessageType)1, "<color=#E8C872>" + text2 + "</color>: " + text, 0, (Sprite)null, false); } } if (MTDialogosPlugin.EnChat.Value && num3 < MTDialogosPlugin.Distancia.Value) { ((Terminal)Chat.instance).AddString("<color=#E8C872>" + text2 + "</color>: " + text); } } internal static void RegistrarRpc() { Estados.Clear(); Lista.Clear(); Mudos.Clear(); Respuestas.Clear(); Pendientes.Clear(); UltimoGrupo.Clear(); PerfilesDialogo.Reiniciar(); if (ZRoutedRpc.instance != null) { ZRoutedRpc.instance.Register<ZDOID, string, string, int>("MT_DialogoDecir", (Method<ZDOID, string, string, int>)Recibir); } } } [HarmonyPatch(typeof(ZNet), "Awake")] internal static class DialogosRpcPatch { private static void Postfix() { DirectorDialogos.RegistrarRpc(); } } [HarmonyPatch(typeof(Character), "OnDeath")] internal static class DialogosBajaPatch { private static void Prefix(Character __instance) { if (!((Object)(object)__instance == (Object)null) && MTDialogosPlugin.Activo.Value) { DirectorDialogos.AlMorir(__instance); } } } public sealed class MemoriaCompanero { private static readonly int HLider = StringExtensionMethods.GetStableHashCode("mt_dlg_lider"); private static readonly int HDesde = StringExtensionMethods.GetStableHashCode("mt_dlg_desde"); private static readonly int HJefes = StringExtensionMethods.GetStableHashCode("mt_dlg_jefes"); private static readonly int HSalvo = StringExtensionMethods.GetStableHashCode("mt_dlg_salvo"); private static readonly int HCasi = StringExtensionMethods.GetStableHashCode("mt_dlg_casi"); private static readonly int HCombates = StringExtensionMethods.GetStableHashCode("mt_dlg_combates"); private static readonly int HConfianza = StringExtensionMethods.GetStableHashCode("mt_dlg_conf"); private readonly ZDO _zdo; public int Dias => Math.Max(0, Cronica.Dia() - _zdo.GetInt(HDesde, Cronica.Dia())); public int Salvo => _zdo.GetInt(HSalvo, 0); public int Casi => _zdo.GetInt(HCasi, 0); public int Combates => _zdo.GetInt(HCombates, 0); public int ConfianzaDicha => _zdo.GetInt(HConfianza, 0); public int Confianza => DialogosRules.Confianza(Dias, Combates, Jefes().Count, Salvo); private MemoriaCompanero(ZDO zdo) { _zdo = zdo; } public static MemoriaCompanero De(ZNetView nview, long lider) { ZDO val = (((Object)(object)nview != (Object)null && nview.IsValid()) ? nview.GetZDO() : null); if (val == null || lider == 0L) { return null; } if (val.GetLong(HLider, 0L) != lider && nview.IsOwner()) { val.Set(HLider, lider); val.Set(HDesde, Cronica.Dia(), false); val.Set(HJefes, ""); val.Set(HSalvo, 0, false); val.Set(HCasi, 0, false); val.Set(HCombates, 0, false); val.Set(HConfianza, 0, false); } if (val.GetLong(HLider, 0L) != lider) { return null; } return new MemoriaCompanero(val); } public List<string> Jefes() { List<string> list = new List<string>(); string text = _zdo.GetString(HJefes, ""); if (string.IsNullOrEmpty(text)) { return list; } string[] array = text.Split(','); foreach (string text2 in array) { if (text2.Length > 0 && !list.Contains(text2)) { list.Add(text2); } } return list; } public void SumarSalvo() { _zdo.Set(HSalvo, Salvo + 1, false); } public void SumarCasi() { _zdo.Set(HCasi, Casi + 1, false); } public void SumarCombate() { _zdo.Set(HCombates, Combates + 1, false); } public void Confio(int nivel) { _zdo.Set(HConfianza, nivel, false); } public void Jefe(string nombre) { if (!string.IsNullOrEmpty(nombre) && nombre.IndexOf(',') < 0) { List<string> list = Jefes(); if (!list.Contains(nombre)) { list.Add(nombre); _zdo.Set(HJefes, string.Join(",", list.ToArray())); } } } } [BepInPlugin("bryanrf.mushoku.dialogos", "MT Diálogos", "1.18.10")] [BepInDependency("mushokutensei.core", "2.99.21")] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] public sealed class MTDialogosPlugin : BaseUnityPlugin { public const string Guid = "bryanrf.mushoku.dialogos"; public const string Version = "1.18.10"; internal static ManualLogSource Log; internal static ConfigEntry<bool> Activo; internal static ConfigEntry<bool> EnChat; internal static ConfigEntry<bool> Grande; internal static ConfigEntry<bool> GrandeUrgente; internal static ConfigEntry<bool> UrgenteEnPantalla; internal static ConfigEntry<float> Charla; internal static ConfigEntry<float> Duracion; internal static ConfigEntry<float> Distancia; private void Awake() { //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Expected O, but got Unknown //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; Tr.Load(typeof(MTDialogosPlugin).Assembly, Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location)); Activo = ((BaseUnityPlugin)this).Config.Bind<bool>("Dialogues", "Enabled", true, "Companions and neutral NPCs show lines of text above their heads according to what happens (healing, retreat, asking for help, jokes, greetings). Text only, no audio."); Charla = ((BaseUnityPlugin)this).Config.Bind<float>("Dialogues", "Chattiness", 0.7f, new ConfigDescription("How much they talk. 0 = only important lines (healing, retreat, help), 0.7 = default (calm, now and then), 1 = chatty, 2 = very chatty.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 2f), Array.Empty<object>())); EnChat = ((BaseUnityPlugin)this).Config.Bind<bool>("Dialogues", "ShowInChat", false, "Also copy the lines of nearby NPCs to the chat window."); Grande = ((BaseUnityPlugin)this).Config.Bind<bool>("Dialogues", "LargeText", false, "Large text above the NPC's head. false = the same bubble Valheim's traders use (with the NPC's name on top)."); GrandeUrgente = ((BaseUnityPlugin)this).Config.Bind<bool>("Dialogues", "LargeUrgent", true, "Urgent lines (healing, retreat, asking for help, a boss…) use large text so they stand out in a fight; the rest use the normal bubble."); Duracion = ((BaseUnityPlugin)this).Config.Bind<float>("Dialogues", "TextDuration", 1.2f, new ConfigDescription("How long the text stays above the head, as a multiplier (1 = 3 to 7 seconds depending on length).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 3f), Array.Empty<object>())); Distancia = ((BaseUnityPlugin)this).Config.Bind<float>("Dialogues", "TextDistance", 25f, new ConfigDescription("Up to how many meters away the text above the head can be seen.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(10f, 80f), Array.Empty<object>())); UrgenteEnPantalla = ((BaseUnityPlugin)this).Config.Bind<bool>("Dialogues", "UrgentOnScreen", false, "Also show urgent lines (healing, retreat, asking for help, a boss…) at the top left of the screen of the NPC's leader. Off by default: only above the head."); CommandManager.Instance.AddConsoleCommand((ConsoleCommand)(object)new DialogosCommand()); ((Component)this).gameObject.AddComponent<DirectorDialogos>(); ((Component)this).gameObject.AddComponent<RuedaConversacion>(); OpcionesAnimales.Registrar(); VentanasEsc.Registrar((Func<bool>)(() => RuedaConversacion.Abierta), (Action)RuedaConversacion.Cerrar); CapturaRaton.Registrar((Func<bool>)(() => RuedaConversacion.Abierta)); Parches.Aplicar("bryanrf.mushoku.dialogos", typeof(MTDialogosPlugin).Assembly, ((BaseUnityPlugin)this).Logger); ((BaseUnityPlugin)this).Logger.LogInfo((object)"MT Diálogos 1.18.10 cargado"); } } public sealed class PerfilDialogo { public readonly string Id; public readonly string[] Fuentes; public PerfilDialogo(string id, params string[] fuentes) { Id = id; Fuentes = ((fuentes.Length != 0) ? fuentes : new string[1] { id }); } } public interface IReconocedorPerfil { string Reconocer(Character c, string prefab); } internal sealed class PorPrefab : IReconocedorPerfil { private readonly Dictionary<string, string> _mapa; public PorPrefab(Dictionary<string, string> mapa) { _mapa = mapa; } public string Reconocer(Character c, string prefab) { if (!_mapa.TryGetValue(prefab, out var value)) { return null; } return value; } } internal sealed class PorOficio : IReconocedorPerfil { public string Reconocer(Character c, string prefab) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected I4, but got Unknown MochilaNpc component = ((Component)c).GetComponent<MochilaNpc>(); if ((Object)(object)component == (Object)null) { return null; } Oficio oficio = component.Oficio; switch ((int)oficio) { case 5: return "-"; case 3: return "maestro"; case 0: case 1: case 2: return "guardia"; case 7: return "aldeano"; case 6: return "gen"; default: return "gen"; } } } internal sealed class PorCompanero : IReconocedorPerfil { public string Reconocer(Character c, string prefab) { if (!((Object)(object)((Component)c).GetComponent<CompaneroNpc>() != (Object)null)) { return null; } return "gen"; } } public static class PerfilesDialogo { public const string Generico = "gen"; public const string Mudo = "-"; private static readonly Dictionary<string, PerfilDialogo> Perfiles; private static readonly List<IReconocedorPerfil> Reglas; private static readonly Dictionary<string, BolsaFrases> Bolsas; private static readonly Func<double> Azar; private static DiccionarioFrases _diccionario; public static DiccionarioFrases Diccionario { get { if (_diccionario != null) { return _diccionario; } HashSet<string> hashSet = new HashSet<string>(); foreach (PerfilDialogo value in Perfiles.Values) { string[] fuentes = value.Fuentes; foreach (string item in fuentes) { hashSet.Add(item); } } _diccionario = DiccionarioFrases.Construir(Tr.Catalog.Keys("English", "dialogo_"), hashSet); ManualLogSource log = MTDialogosPlugin.Log; if (log != null) { log.LogInfo((object)("MT Diálogos: " + _diccionario.Total + " frases, " + _diccionario.Rechazadas.Count + " claves apartadas (mt_dialogos para verlas).")); } return _diccionario; } } public static ICollection<string> Ids => Perfiles.Keys; static PerfilesDialogo() { Perfiles = new Dictionary<string, PerfilDialogo>(); Reglas = new List<IReconocedorPerfil>(); Bolsas = new Dictionary<string, BolsaFrases>(); Azar = () => Random.value; Registrar(new PerfilDialogo("gen")); Registrar(new PerfilDialogo("orsted")); Registrar(new PerfilDialogo("maestro", "maestro", "gen")); Registrar(new PerfilDialogo("guardia", "guardia", "gen")); Reconocedor(new PorPrefab(new Dictionary<string, string> { { "MT_Orsted", "orsted" }, { "MT_Kalman", "maestro" }, { "MT_Guardia_Infanteria", "guardia" }, { "MT_Guardia_Arquero", "guardia" }, { "MT_Guardia_Capitan", "guardia" } })); Reconocedor(new PorOficio()); Reconocedor(new PorCompanero()); } public static void Registrar(PerfilDialogo perfil) { Perfiles[perfil.Id] = perfil; Reiniciar(); } public static void Reconocedor(IReconocedorPerfil regla, bool primero = false) { if (primero) { Reglas.Insert(0, regla); } else { Reglas.Add(regla); } } public static string De(Character c) { if ((Object)(object)c == (Object)null || c is Player) { return null; } string prefabName = Utils.GetPrefabName(((Component)c).gameObject); for (int i = 0; i < Reglas.Count; i++) { string text = Reglas[i].Reconocer(c, prefabName); if (text != null) { if (!(text == "-") && Perfiles.ContainsKey(text)) { return text; } return null; } } return null; } public static string Elegir(string perfil, Situacion s, string matiz, float ahora, bool mezclar = false) { bool puedeRepetir = DialogosRules.Defs[(int)s].Prioridad >= 70; if (matiz != null && (!mezclar || !(Random.value < 0.4f))) { string text = Bolsa(perfil, s, matiz).Sacar(ahora, puedeRepetir, Azar); if (text != null) { return text; } } return Bolsa(perfil, s, null).Sacar(ahora, puedeRepetir, Azar); } private static BolsaFrases Bolsa(string perfil, Situacion s, string matiz) { string[] obj = new string[5] { perfil, "|", null, null, null }; int num = (int)s; obj[2] = num.ToString(); obj[3] = "|"; obj[4] = matiz; string key = string.Concat(obj); if (Bolsas.TryGetValue(key, out var value)) { return value; } if (!Perfiles.TryGetValue(perfil, out var value2)) { value2 = Perfiles["gen"]; } value = new BolsaFrases(Diccionario.De(value2.Fuentes, s, matiz)); Bolsas[key] = value; return value; } public static void Reiniciar() { Bolsas.Clear(); _diccionario = null; } } } namespace MT.Dialogos.Rueda { internal static class OpcionesAnimales { private static readonly Color Verde = new Color(0.6f, 0.9f, 0.55f); internal static void Registrar() { ConversacionNpc.Registrar(Opciones, 50); } private static void Opciones(Character npc, Player p, List<RuedaOpcion> lista) { //IL_0089: 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_010f: Unknown result type (might be due to invalid IL or missing references) CompaneroNpc component = ((Component)npc).GetComponent<CompaneroNpc>(); if (!((Object)(object)component == (Object)null) && component.LiderId != 0L && component.LiderId == p.GetPlayerID()) { bool respeta = DomaNpc.Respeta(npc); lista.Add(Con(ConversacionNpc.Opcion(Tr.Get(respeta ? "core_doma_respect_stop" : "core_doma_respect"), Tr.Get(respeta ? "core_doma_respect_stop_d" : "core_doma_respect_d"), delegate(Player j) { DomaNpc.Respetar(j, !respeta); }, Verde, disponible: true, null, null, enMas: false, "ordenes"), "TrophyBoar")); lista.Add(Con(ConversacionNpc.Opcion(Tr.Get("core_doma_food"), Tr.Get("core_doma_food_d"), delegate { DomaNpc.Alimentar(npc); }, Verde, disponible: true, null, null, enMas: false, "ordenes"), "RawMeat")); lista.Add(Con(ConversacionNpc.Opcion(Tr.Get("core_doma_fire"), Tr.Get("core_doma_fire_d"), delegate { DomaNpc.AvivarFuego(npc); }, Verde, disponible: true, null, null, enMas: false, "ordenes"), "Wood")); } } private static RuedaOpcion Con(RuedaOpcion o, string objeto) { object obj; if (!((Object)(object)ObjectDB.instance != (Object)null)) { obj = null; } else { GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(objeto); obj = ((itemPrefab != null) ? itemPrefab.GetComponent<ItemDrop>() : null); } ItemDrop val = (ItemDrop)obj; if ((Object)(object)val != (Object)null) { o.IconoId = null; o.Icono = val.m_itemData.GetIcon(); } return o; } } internal static class PanelConversacion { private sealed class Presentacion { public GUIContent Nombre; public GUIContent Detalle; public Sprite Icono; } private const float Ancho = 440f; private const float Cabecera = 132f; private const float Pie = 112f; private const float AltoFila = 50f; private const float Margen = 18f; private static readonly Color FondoArriba = new Color(0.085f, 0.065f, 0.045f, 0.95f); private static readonly Color FondoAbajo = new Color(0.045f, 0.035f, 0.028f, 0.95f); private static readonly Color Bronce = new Color(0.62f, 0.48f, 0.3f, 0.85f); private static readonly Color Oro = new Color(0.93f, 0.76f, 0.47f); private static readonly Color Texto = new Color(0.96f, 0.94f, 0.88f); private static readonly Color Suave = new Color(0.86f, 0.83f, 0.76f); private static readonly Color Secundario = new Color(0.62f, 0.6f, 0.56f); private static readonly Color Brillo = new Color(0.93f, 0.7f, 0.36f, 0.3f); private static readonly Dictionary<RuedaOpcion, Presentacion> Contenido = new Dictionary<RuedaOpcion, Presentacion>(); private static GUIContent _nombre; private static GUIContent _cargo; private static GUIContent _volver; private static readonly GUIContent Titulo = new GUIContent(); private static Sprite _insignia; private static readonly GUIContent Flecha = new GUIContent("›"); private static readonly GUIContent ContinuacionArriba = new GUIContent("↑"); private static readonly GUIContent ContinuacionAbajo = new GUIContent("↓"); private static readonly GUIContent TeclaE = new GUIContent("E"); private static readonly GUIContent TeclaFlechas = new GUIContent("↑↓"); private static readonly GUIContent TeclaEsc = new GUIContent("Esc"); private static readonly GUIContent TeclaAtras = new GUIContent("←"); private static GUIContent _elegir; private static GUIContent _navegar; private static GUIContent _salir; private static GUIContent _atras; private static GUIStyle _estilo; private static FichaNpc _ficha; private static Texture2D _vertical; private static Texture2D _horizontal; private static Texture2D _centro; private static bool _arteCargado; public static void Preparar(Character npc, List<RuedaOpcion> opciones) { //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Expected O, but got Unknown //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Expected O, but got Unknown //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Expected O, but got Unknown //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Expected O, but got Unknown //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Expected O, but got Unknown //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Expected O, but got Unknown Contenido.Clear(); _ficha = ((Component)npc).GetComponent<FichaNpc>(); if (!_arteCargado) { _arteCargado = true; _vertical = Degradado(1, 64, (float i) => new Color(1f, 1f, 1f, 1f - i)); _horizontal = Degradado(64, 1, (float i) => new Color(1f, 1f, 1f, 1f - i)); _centro = Degradado(64, 1, (float i) => new Color(1f, 1f, 1f, 1f - Mathf.Abs(i * 2f - 1f))); } _nombre = new GUIContent(npc.GetHoverName()); string text = FichaNpc.CargoDe(npc); _cargo = (string.IsNullOrEmpty(text) ? ((GUIContent)null) : new GUIContent(text)); _insignia = InsigniaNpc.De(npc); _volver = new GUIContent(Tr.Get("conversacion_volver")); _elegir = new GUIContent(Tr.Get("conversacion_k_elegir")); _navegar = new GUIContent(Tr.Get("conversacion_k_navegar")); _salir = new GUIContent(Tr.Get("conversacion_k_salir")); _atras = new GUIContent(Tr.Get("conversacion_k_volver")); Guardar(opciones); } public static void Guardar(List<RuedaOpcion> opciones) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected O, but got Unknown foreach (RuedaOpcion opcione in opciones) { if (!Contenido.ContainsKey(opcione)) { Contenido.Add(opcione, new Presentacion { Nombre = new GUIContent(opcione.Nombre), Detalle = new GUIContent(string.IsNullOrEmpty(opcione.Estado) ? (opcione.Detalle ?? "") : opcione.Estado), Icono = (string.IsNullOrEmpty(opcione.IconoId) ? opcione.Icono : Arte.Icono("rueda_" + opcione.IconoId)) }); if (opcione.Hijos != null) { Guardar(opcione.Hijos); } } } } public static Rect Caja(int cantidad) { //IL_00a1: Unknown result type (might be due to invalid IL or missing references) float scale = MTGui.Scale; float num = Mathf.Min(440f * scale, (float)Screen.width - 32f * scale); float num2 = Mathf.Max(50f * scale, (float)Screen.height - 292f * scale); int num3 = Mathf.Max(1, Mathf.Min(cantidad, Mathf.FloorToInt(num2 / (50f * scale)))); float num4 = (244f + (float)num3 * 50f + 8f) * scale; float num5 = Mathf.Max(16f * scale, ((float)Screen.height - num4) * 0.5f); return new Rect((float)Screen.width - num - 32f * scale, num5, num, num4); } public static int Capacidad(Rect caja) { return Mathf.Max(1, Mathf.FloorToInt((((Rect)(ref caja)).height / MTGui.Scale - 132f - 112f - 8f) / 50f + 0.01f)); } public static Rect Volver(Rect caja) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) return new Rect(((Rect)(ref caja)).x + 108f * MTGui.Scale, ((Rect)(ref caja)).y + 58f * MTGui.Scale, ((Rect)(ref caja)).width - 126f * MTGui.Scale, 28f * MTGui.Scale); } public static Rect Fila(Rect caja, int indice) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) return new Rect(((Rect)(ref caja)).x + 8f * MTGui.Scale, ((Rect)(ref caja)).y + (136f + (float)indice * 50f) * MTGui.Scale, ((Rect)(ref caja)).width - 16f * MTGui.Scale, 46f * MTGui.Scale); } public static int BajoCursor(Rect caja, Vector2 raton, int inicio, int cantidad) { //IL_0000: 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_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_001d: Unknown result type (might be due to invalid IL or missing references) int num = Mathf.Min(Capacidad(caja), cantidad - inicio); for (int i = 0; i < num; i++) { Rect val = Fila(caja, i); if (((Rect)(ref val)).Contains(raton)) { return inicio + i; } } return -1; } public static void Dibujar(List<RuedaOpcion> opciones, int marcada, int inicio, bool submenu, string titulo, float abiertaEn) { //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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: 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_004a: 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_007c: 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_00cb: 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_0141: 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_0128: 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) Rect caja = Caja(opciones.Count); float scale = MTGui.Scale; float num = Mathf.Clamp01((Time.unscaledTime - abiertaEn) / 0.18f); float alpha = 1f - (1f - num) * (1f - num); Color color = GUI.color; Panel(caja, alpha); CabeceraNpc(caja, submenu, titulo, alpha); int num2 = Mathf.Min(Capacidad(caja), opciones.Count - inicio); for (int i = 0; i < num2; i++) { int num3 = inicio + i; Fila(opciones[num3], Fila(caja, i), num3 == marcada, alpha); } if (inicio > 0) { Rotulo(new Rect(((Rect)(ref caja)).xMax - 26f * scale, ((Rect)(ref caja)).y + 118f * scale, 16f * scale, 14f * scale), ContinuacionArriba, 10, Oro, alpha, negrita: false, (TextAnchor)4); } float num4 = ((Rect)(ref caja)).yMax - 112f * scale; if (inicio + num2 < opciones.Count) { Rotulo(new Rect(((Rect)(ref caja)).xMax - 26f * scale, num4 - 12f * scale, 16f * scale, 14f * scale), ContinuacionAbajo, 10, Oro, alpha, negrita: false, (TextAnchor)4); } PieDetalle(caja, num4, opciones, marcada, submenu, alpha); GUI.color = color; } private static void Panel(Rect caja, float alpha) { //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_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_0023: 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_0072: 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_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_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_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_00f8: 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_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_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_0162: 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) float scale = MTGui.Scale; Rellenar(caja, FondoAbajo, alpha); Textura(caja, _vertical, FondoArriba, alpha); Marco(caja, new Color(Bronce.r, Bronce.g, Bronce.b, 0.45f), alpha); float num = 14f * scale; float num2 = 2f * scale; Rellenar(new Rect(((Rect)(ref caja)).x, ((Rect)(ref caja)).y, num, num2), Bronce, alpha); Rellenar(new Rect(((Rect)(ref caja)).x, ((Rect)(ref caja)).y, num2, num), Bronce, alpha); Rellenar(new Rect(((Rect)(ref caja)).xMax - num, ((Rect)(ref caja)).y, num, num2), Bronce, alpha); Rellenar(new Rect(((Rect)(ref caja)).xMax - num2, ((Rect)(ref caja)).y, num2, num), Bronce, alpha); Rellenar(new Rect(((Rect)(ref caja)).x, ((Rect)(ref caja)).yMax - num2, num, num2), Bronce, alpha); Rellenar(new Rect(((Rect)(ref caja)).x, ((Rect)(ref caja)).yMax - num, num2, num), Bronce, alpha); Rellenar(new Rect(((Rect)(ref caja)).xMax - num, ((Rect)(ref caja)).yMax - num2, num, num2), Bronce, alpha); Rellenar(new Rect(((Rect)(ref caja)).xMax - num2, ((Rect)(ref caja)).yMax - num, num2, num), Bronce, alpha); } private static void CabeceraNpc(Rect caja, bool submenu, string titulo, float alpha) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0069: 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_008e: 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_00df: 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_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0116: 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_0123: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: 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_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_02db: 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_023c: 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) //IL_0298: Unknown result type (might be due to invalid IL or missing references) float scale = MTGui.Scale; Rect val = default(Rect); ((Rect)(ref val))..ctor(((Rect)(ref caja)).x + 18f * scale, ((Rect)(ref caja)).y + 18f * scale, 76f * scale, 94f * scale); Rellenar(val, new Color(0f, 0f, 0f, 0.6f), alpha); GUI.color = new Color(1f, 1f, 1f, alpha); if ((Object)(object)RetratoNpc.Textura != (Object)null) { GUI.DrawTexture(val, RetratoNpc.Textura, (ScaleMode)1, false); } Marco(val, Bronce, alpha); float num = ((Rect)(ref caja)).x + 108f * scale; float num2 = ((Rect)(ref caja)).width - 126f * scale; RotuloEnLinea(new Rect(num, ((Rect)(ref caja)).y + 20f * scale, num2, 34f * scale), _nombre, 22, 15, Texto, alpha); if (submenu) { Titulo.text = "‹ " + (string.IsNullOrEmpty(titulo) ? _volver.text : titulo); Rotulo(Volver(caja), Titulo, 16, Oro, alpha, negrita: true, (TextAnchor)3); } else if (_cargo != null || (Object)(object)_insignia != (Object)null) { float num3 = num; if ((Object)(object)_insignia != (Object)null) { MTGui.Icon(new Rect(num3, ((Rect)(ref caja)).y + 60f * scale, 22f * scale, 22f * scale), _insignia, alpha); num3 += 28f * scale; } if (_cargo != null) { RotuloEnLinea(new Rect(num3, ((Rect)(ref caja)).y + 56f * scale, ((Rect)(ref caja)).xMax - 18f * scale - num3, 30f * scale), _cargo, 14, 11, Oro, alpha); } } if (!submenu && (Object)(object)_ficha != (Object)null && _ficha.ExperienciaObjetivo > 0) { Rect caja2 = default(Rect); ((Rect)(ref caja2))..ctor(num, ((Rect)(ref caja)).y + 96f * scale, num2, 5f * scale); Rellenar(caja2, new Color(0f, 0f, 0f, 0.55f), alpha); float num4 = Mathf.Clamp01((float)Mathf.Max(0, _ficha.ExperienciaActual) / (float)_ficha.ExperienciaObjetivo); if (num4 > 0f) { Rellenar(new Rect(((Rect)(ref caja2)).x, ((Rect)(ref caja2)).y, ((Rect)(ref caja2)).width * num4, ((Rect)(ref caja2)).height), Oro, alpha); } } Textura(new Rect(((Rect)(ref caja)).x + 18f * scale, ((Rect)(ref caja)).y + 128f * scale, ((Rect)(ref caja)).width - 36f * scale, scale), _centro, Bronce, alpha); } private static void Fila(RuedaOpcion opcion, Rect fila, bool elegida, float alpha) { //IL_002e: 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_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_008a: 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_00f3: 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_0125: 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_00ec: 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_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0177: 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_01a1: 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) float scale = MTGui.Scale; Presentacion presentacion = Contenido[opcion]; bool num = opcion.Hijos != null && opcion.Hijos.Count > 0; if (elegida) { Textura(fila, _horizontal, Brillo, alpha); Rellenar(new Rect(((Rect)(ref fila)).x, ((Rect)(ref fila)).y, 3f * scale, ((Rect)(ref fila)).height), Oro, alpha); } if ((Object)(object)presentacion.Icono != (Object)null) { MTGui.Icon(new Rect(((Rect)(ref fila)).x + 16f * scale, ((Rect)(ref fila)).center.y - 13f * scale, 26f * scale, 26f * scale), presentacion.Icono, alpha * ((!opcion.Disponible) ? 0.4f : (elegida ? 1f : 0.8f))); } Rotulo(color: (!opcion.Disponible) ? Secundario : (elegida ? Texto : Suave), caja: new Rect(((Rect)(ref fila)).x + 54f * scale, ((Rect)(ref fila)).y, ((Rect)(ref fila)).width - 100f * scale, ((Rect)(ref fila)).height), texto: presentacion.Nombre, tamano: 17, alpha: alpha, negrita: elegida, alineacion: (TextAnchor)3); if (num) { Rotulo(new Rect(((Rect)(ref fila)).xMax - 30f * scale, ((Rect)(ref fila)).y, 20f * scale, ((Rect)(ref fila)).height), Flecha, 22, elegida ? Oro : Secundario, alpha, negrita: true, (TextAnchor)4); } else if (elegida && opcion.Disponible) { Tecla(new Rect(((Rect)(ref fila)).xMax - 36f * scale, ((Rect)(ref fila)).center.y - 11f * scale, 24f * scale, 22f * scale), TeclaE, alpha); } } private static void PieDetalle(Rect caja, float pieY, List<RuedaOpcion> opciones, int marcada, bool submenu, float alpha) { //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_0077: 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_00a2: Unknown result type (might be due to invalid IL or missing references) float scale = MTGui.Scale; Textura(new Rect(((Rect)(ref caja)).x + 18f * scale, pieY, ((Rect)(ref caja)).width - 36f * scale, scale), _centro, Bronce, alpha); if (marcada >= 0 && marcada < opciones.Count) { Rotulo(new Rect(((Rect)(ref caja)).x + 18f * scale, pieY + 8f * scale, ((Rect)(ref caja)).width - 36f * scale, 62f * scale), Contenido[opciones[marcada]].Detalle, 14, opciones[marcada].Disponible ? Suave : MTGui.Rojo, alpha, negrita: false, (TextAnchor)0); } float y = ((Rect)(ref caja)).yMax - 32f * scale; float x = ((Rect)(ref caja)).x + 18f * scale; x = Ayuda(x, y, TeclaE, _elegir, alpha); x = Ayuda(x, y, TeclaFlechas, _navegar, alpha); if (submenu) { x = Ayuda(x, y, TeclaAtras, _atras, alpha); } Ayuda(x, y, TeclaEsc, _salir, alpha); } private static float Ayuda(float x, float y, GUIContent tecla, GUIContent accion, float alpha) { //IL_001b: 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_0058: 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_0087: Unknown result type (might be due to invalid IL or missing references) float scale = MTGui.Scale; Estilo(12, negrita: true); float num = Mathf.Max(22f * scale, _estilo.CalcSize(tecla).x + 12f * scale); Tecla(new Rect(x, y, num, 20f * scale), tecla, alpha); Estilo(13, negrita: false); float x2 = _estilo.CalcSize(accion).x; Rotulo(new Rect(x + num + 6f * scale, y, x2 + 4f * scale, 20f * scale), accion, 13, Secundario, alpha, negrita: false, (TextAnchor)3); return x + num + x2 + 22f * scale; } private static void Tecla(Rect r, GUIContent texto, float alpha) { //IL_0000: 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_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_0030: Unknown result type (might be due to invalid IL or missing references) Rellenar(r, new Color(0f, 0f, 0f, 0.55f), alpha);
plugins/MT.Hud/MT.Hud.dll
Decompiled a day 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.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Jotunn.Utils; using MT.Core; using MT.Core.Barra; using MT.Core.I18n; using MT.Core.Interfaz; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; 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.Hud")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+f72fd27a1cef3fefa2078e5313c902bbcd510c4b")] [assembly: AssemblyProduct("MT.Hud")] [assembly: AssemblyTitle("MT.Hud")] [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.Hud { internal static class ConfigNombres { public static readonly string[] Tabla = new string[40] { "Interfaz", "MostrarHud", "Interface", "ShowHud", "Interfaz", "ReemplazarValheim", "Interface", "ReplaceValheim", "Interfaz", "HudCompleta", "Interface", "FullHud", "Interfaz", "NumerosEnBarras", "Interface", "NumbersOnBars", "Interfaz", "Escala", "Interface", "Scale", "Interfaz", "EscalaBarra", "Interface", "BarScale", "Interfaz", "EscalaEstados", "Interface", "StatusScale", "Interfaz", "Esquineras", "Interface", "Corners", "Interfaz", "EstiloBarrasV2", "Interface", "BarStyleV2", "Interfaz", "OcultarAyudasCombate", "Interface", "HideCombatHints" }; } [BepInPlugin("mushokutensei.hud", "MT HUD", "1.7.17")] [BepInDependency("mushokutensei.core", "2.88.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] public sealed class MTHudPlugin : BaseUnityPlugin { public const string Guid = "mushokutensei.hud"; public const string Version = "1.7.17"; internal static ManualLogSource Log; internal static ConfigEntry<string> EstiloBarras; internal static ConfigEntry<bool> Esquineras; internal static ConfigEntry<bool> ReemplazarValheim; internal static ConfigEntry<bool> HudCompleta; internal static ConfigEntry<bool> Numeros; internal static ConfigEntry<bool> OcultarAyudasCombate; internal static ConfigEntry<bool> Mostrar; internal static ConfigEntry<float> Escala; internal static ConfigEntry<float> EscalaBarra; internal static ConfigEntry<float> EscalaEstados; private void Awake() { //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Expected O, but got Unknown //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Expected O, but got Unknown //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Expected O, but got Unknown //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Expected O, but got Unknown ConfigMigracion.Migrar(((BaseUnityPlugin)this).Config, ConfigNombres.Tabla); Log = ((BaseUnityPlugin)this).Logger; Mostrar = ((BaseUnityPlugin)this).Config.Bind<bool>("Interface", "ShowHud", true, "Show the Mushoku Tensei HUD. false = only Valheim's own HUD: no skill row, tōki bar or slot marks (skills still work with 1–8, the Q wheel and the P window). Live: mt_cfg set ShowHud false"); ReemplazarValheim = ((BaseUnityPlugin)this).Config.Bind<bool>("Interface", "ReplaceValheim", false, "true = Mushoku Tensei's own health, stamina, mana and tōki bars replace Valheim's (the rest of the HUD stays like Valheim). false = Valheim's bars."); HudCompleta = ((BaseUnityPlugin)this).Config.Bind<bool>("Interface", "FullHud", false, "«Full» profile: also hides Valheim's food, status and hotbar and draws Mushoku Tensei's own (skill bar with items, hands, Step and Mantle cards)."); Numeros = ((BaseUnityPlugin)this).Config.Bind<bool>("Interface", "NumbersOnBars", true, "Show the numbers (current / max) inside the resource bars."); Escala = ((BaseUnityPlugin)this).Config.Bind<float>("Interface", "Scale", 1f, new ConfigDescription("HUD size (on top of the resolution scaling).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 2f), Array.Empty<object>())); EscalaBarra = ((BaseUnityPlugin)this).Config.Bind<float>("Interface", "BarScale", 1f, new ConfigDescription("Size of the top-left skill bar (1–8, Alt items, hands, Step and Mantle). 1 = fill the space up to the compass; lower = smaller. Live: mt_cfg set BarScale 0.8", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 2f), Array.Empty<object>())); EscalaEstados = ((BaseUnityPlugin)this).Config.Bind<float>("Interface", "StatusScale", 1.4f, new ConfigDescription("Size of the active status icons (top right), on top of Scale. 1 = as before.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.6f, 2.5f), Array.Empty<object>())); Esquineras = ((BaseUnityPlugin)this).Config.Bind<bool>("Interface", "Corners", false, "Show the carved wooden corner pieces at the bottom corners. Live: mt_cfg set Corners true"); EstiloBarras = ((BaseUnityPlugin)this).Config.Bind<string>("Interface", "BarStyleV2", "Simple", new ConfigDescription("Frame of the health/stamina/mana/tōki bars: Simple (painted fill and particles in a plain dark rectangle), Piedra (Nordic stone) or Bronce (bronze). Restart the game to apply.", (AcceptableValueBase)(object)new AcceptableValueList<string>(new string[3] { "Simple", "Piedra", "Bronce" }), Array.Empty<object>())); OcultarAyudasCombate = ((BaseUnityPlugin)this).Config.Bind<bool>("Interface", "HideCombatHints", true, "With own bars (ReplaceValheim) or the full profile, hide Valheim's combat key hints at the bottom («Attack Mouse-1…»), which cover the 1–8 bar."); Hud.Activo = true; ((Component)this).gameObject.AddComponent<VisualizadorHud>(); Parches.Aplicar("mushokutensei.hud", typeof(MTHudPlugin).Assembly, ((BaseUnityPlugin)this).Logger); ((BaseUnityPlugin)this).Logger.LogInfo((object)"MT HUD 1.7.17 cargado"); } private void OnDestroy() { Hud.Activo = false; } } [HarmonyPatch(typeof(KeyHints), "UpdateHints")] internal static class OcultarAyudasCombatePatch { private static readonly FieldRef<KeyHints, GameObject> Combate = AccessTools.FieldRefAccess<KeyHints, GameObject>("m_combatHints"); private static void Postfix(KeyHints __instance) { if ((MTHudPlugin.HudCompleta.Value || MTHudPlugin.ReemplazarValheim.Value) && MTHudPlugin.OcultarAyudasCombate.Value) { GameObject val = Combate.Invoke(__instance); if ((Object)(object)val != (Object)null && val.activeSelf) { val.SetActive(false); } } } } internal static class SpritesHud { private static readonly Dictionary<string, Sprite> Cache = new Dictionary<string, Sprite>(); private static Sprite _blanco; private static readonly int[] LimitesParticula = new int[5] { 0, 313, 627, 940, 1254 }; private static Sprite _bordeRedondeado; private static Sprite _bordeElegido; public static Sprite BordeRedondeado { get { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown //IL_013f: 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_016e: 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) if ((Object)(object)_bordeRedondeado != (Object)null) { return _bordeRedondeado; } Texture2D val = new Texture2D(32, 32, (TextureFormat)4, false) { hideFlags = (HideFlags)61, wrapMode = (TextureWrapMode)1 }; Color32[] array = (Color32[])(object)new Color32[1024]; for (int i = 0; i < 32; i++) { for (int j = 0; j < 32; j++) { float num = Mathf.Clamp((float)j + 0.5f, 7f, 25f); float num2 = Mathf.Clamp((float)i + 0.5f, 7f, 25f); float num3 = Mathf.Sqrt(((float)j + 0.5f - num) * ((float)j + 0.5f - num) + ((float)i + 0.5f - num2) * ((float)i + 0.5f - num2)) - 7f; float num4 = Mathf.Clamp01(0.5f - num3); float num5 = Mathf.Clamp01(num3 + 2f + 0.5f); array[i * 32 + j] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)(255f * num4 * num5)); } } val.SetPixels32(array); val.Apply(); _bordeRedondeado = Sprite.Create(val, new Rect(0f, 0f, 32f, 32f), new Vector2(0.5f, 0.5f), 100f, 0u, (SpriteMeshType)0, new Vector4(10f, 10f, 10f, 10f)); ((Object)_bordeRedondeado).hideFlags = (HideFlags)61; return _bordeRedondeado; } } public static Sprite BordeElegido { get { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown //IL_017b: 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_01aa: 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) if ((Object)(object)_bordeElegido != (Object)null) { return _bordeElegido; } Texture2D val = new Texture2D(48, 48, (TextureFormat)4, false) { hideFlags = (HideFlags)61, wrapMode = (TextureWrapMode)1 }; Color32[] array = (Color32[])(object)new Color32[2304]; float num = 15f; float num2 = 33f; for (int i = 0; i < 48; i++) { for (int j = 0; j < 48; j++) { float num3 = Mathf.Clamp((float)j + 0.5f, num, num2); float num4 = Mathf.Clamp((float)i + 0.5f, num, num2); float num5 = Mathf.Sqrt(((float)j + 0.5f - num3) * ((float)j + 0.5f - num3) + ((float)i + 0.5f - num4) * ((float)i + 0.5f - num4)) - 9f; float num6 = Mathf.Clamp01(0.5f - num5) * Mathf.Clamp01(num5 + 4f + 0.5f); float num7 = ((num5 > 0f) ? (Mathf.Clamp01(1f - num5 / 5f) * 0.45f) : 0f); array[i * 48 + j] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)(255f * Mathf.Max(num6, num7))); } } val.SetPixels32(array); val.Apply(false, true); _bordeElegido = Sprite.Create(val, new Rect(0f, 0f, 48f, 48f), new Vector2(0.5f, 0.5f), 100f, 0u, (SpriteMeshType)0, new Vector4(18f, 18f, 18f, 18f)); ((Object)_bordeElegido).hideFlags = (HideFlags)61; return _bordeElegido; } } public static Sprite Blanco { get { //IL_0017: 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_0024: 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_0031: 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_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown if ((Object)(object)_blanco != (Object)null) { return _blanco; } Texture2D val = new Texture2D(1, 1, (TextureFormat)4, false) { hideFlags = (HideFlags)61 }; val.SetPixel(0, 0, Color.white); val.Apply(); _blanco = Sprite.Create(val, new Rect(0f, 0f, 1f, 1f), new Vector2(0.5f, 0.5f), 100f); ((Object)_blanco).hideFlags = (HideFlags)61; return _blanco; } } public static Sprite Nordico(string pieza) { //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Unknown result type (might be due to invalid IL or missing references) string text = "nordico_" + pieza; if (Cache.TryGetValue(text, out var value)) { return value; } Sprite val = Obtener("hud_nordic_valheim", 0f, opcional: true); if ((Object)(object)val == (Object)null) { val = Obtener("hud_nordic_atlas", 0f, opcional: true); } if ((Object)(object)val == (Object)null) { return null; } Rect val2 = default(Rect); switch (pieza) { case "estamina": ((Rect)(ref val2))..ctor(16f, 84f, 740f, 114f); break; case "vida": ((Rect)(ref val2))..ctor(776f, 84f, 744f, 114f); break; case "toki": ((Rect)(ref val2))..ctor(16f, 230f, 740f, 114f); break; case "mana": ((Rect)(ref val2))..ctor(776f, 230f, 744f, 114f); break; case "casilla": ((Rect)(ref val2))..ctor(46f, 380f, 200f, 194f); break; case "placa": ((Rect)(ref val2))..ctor(406f, 445f, 720f, 114f); break; case "izquierda": ((Rect)(ref val2))..ctor(21f, 581f, 330f, 397f); break; case "derecha": ((Rect)(ref val2))..ctor(378f, 581f, 331f, 396f); break; case "barra": ((Rect)(ref val2))..ctor(714f, 811f, 803f, 133f); break; default: return null; } ((Rect)(ref val2)).y = (float)((Texture)val.texture).height - ((Rect)(ref val2)).y - ((Rect)(ref val2)).height; value = Sprite.Create(val.texture, val2, new Vector2(0.5f, 0.5f), 100f, 0u, (SpriteMeshType)0); ((Object)value).name = text; ((Object)value).hideFlags = (HideFlags)61; Cache[text] = value; return value; } public static Sprite Barra(string pieza) { //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_0272: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) string text = "barra_" + pieza; if (Cache.TryGetValue(text, out var value)) { return value; } Sprite val = Obtener("hud_bars_v1"); if ((Object)(object)val == (Object)null) { return null; } Vector4 zero = Vector4.zero; Rect r = default(Rect); switch (pieza) { case "marco": ((Rect)(ref r))..ctor(35f, 122f, 732f, 157f); ((Vector4)(ref zero))..ctor(89f, 39f, 90f, 38f); break; case "fondo": ((Rect)(ref r))..ctor(830f, 162f, 642f, 79f); break; case "vida": ((Rect)(ref r))..ctor(54f, 384f, 660f, 72f); break; case "estamina": ((Rect)(ref r))..ctor(822f, 384f, 660f, 72f); break; case "toki": ((Rect)(ref r))..ctor(54f, 608f, 660f, 70f); break; case "mana": ((Rect)(ref r))..ctor(822f, 608f, 660f, 70f); break; case "fuego": ((Rect)(ref r))..ctor(39f, 748f, 714f, 212f); break; case "chispas": ((Rect)(ref r))..ctor(805f, 779f, 685f, 179f); break; default: return null; } return Cache[text] = Recorte(val.texture, r, text, zero); } public static Sprite Pieza(string atlas, float original, float x, float y, float w, float h, Vector4 borde = default(Vector4)) { //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) string text = atlas + "_" + x + "_" + y; if (Cache.TryGetValue(text, out var value)) { return value; } Sprite val = Obtener(atlas, 0f, opcional: true); if ((Object)(object)val == (Object)null) { Cache[text] = null; return null; } float num = (float)((Texture)val.texture).width / original; Rect r = default(Rect); ((Rect)(ref r))..ctor(x * num, y * num, w * num, h * num); return Cache[text] = Recorte(val.texture, r, text, borde * num); } public static Sprite Particula(int fila, int columna) { //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) string text = "particula_" + fila + "_" + columna; if (Cache.TryGetValue(text, out var value)) { return value; } Sprite val = Obtener("hud_particles_v1"); if ((Object)(object)val == (Object)null) { return null; } int num = LimitesParticula[columna]; int num2 = LimitesParticula[fila]; Rect r = default(Rect); ((Rect)(ref r))..ctor((float)num, (float)num2, (float)(LimitesParticula[columna + 1] - num), (float)(LimitesParticula[fila + 1] - num2)); return Cache[text] = Recorte(val.texture, r, text, Vector4.zero); } private static Sprite Recorte(Texture2D t, Rect r, string nombre, Vector4 borde) { //IL_001f: 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_0036: Unknown result type (might be due to invalid IL or missing references) ((Rect)(ref r)).y = (float)((Texture)t).height - ((Rect)(ref r)).y - ((Rect)(ref r)).height; Sprite obj = Sprite.Create(t, r, new Vector2(0.5f, 0.5f), 100f, 0u, (SpriteMeshType)0, borde); ((Object)obj).name = nombre; ((Object)obj).hideFlags = (HideFlags)61; return obj; } public unsafe static Sprite ObtenerConBorde(string nombre, Vector4 borde) { //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_004f: 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_006a: Unknown result type (might be due to invalid IL or missing references) Vector4 val = borde; string text = nombre + "#" + ((object)(*(Vector4*)(&val))/*cast due to .constrained prefix*/).ToString(); if (Cache.TryGetValue(text, out var value)) { return value; } Sprite val2 = Obtener(nombre, 0f, opcional: true); value = (Cache[text] = (((Object)(object)val2 == (Object)null) ? null : Sprite.Create(val2.texture, val2.rect, new Vector2(0.5f, 0.5f), 100f, 0u, (SpriteMeshType)0, borde))); if ((Object)(object)value != (Object)null) { ((Object)value).name = text; ((Object)value).hideFlags = (HideFlags)61; } return value; } public static Sprite Obtener(string nombre, float borde = 0f, bool opcional = false) { //IL_009a: 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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Expected O, but got Unknown //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_018e: 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_0155: 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_01be: 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) if (Cache.TryGetValue(nombre, out var value)) { return value; } Cache[nombre] = null; using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("MT.Hud.Assets." + nombre + ".png"); if (stream == null) { if (!opcional) { ManualLogSource log = MTHudPlugin.Log; if (log != null) { log.LogWarning((object)("MT HUD: falta el sprite " + nombre + " (se usa un sustituto)")); } } return null; } byte[] array = new byte[(int)stream.Length]; int num; for (int i = 0; i < array.Length; i += num) { num = stream.Read(array, i, array.Length - i); if (num <= 0) { break; } } Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false) { hideFlags = (HideFlags)61, wrapMode = (TextureWrapMode)1 }; if (!ImageConversion.LoadImage(val, array)) { Object.Destroy((Object)(object)val); return null; } float num2 = Mathf.Min(borde, (float)Mathf.Min(((Texture)val).width, ((Texture)val).height) / 2f - 1f); Rect val2 = ((nombre == "hud_resource_ornate") ? new Rect(0f, (float)((Texture)val).height * 0.3f, (float)((Texture)val).width, (float)((Texture)val).height * 0.38f) : ((nombre == "hud_group_ornate") ? new Rect(0f, (float)((Texture)val).height * 0.12f, (float)((Texture)val).width, (float)((Texture)val).height * 0.88f) : new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height))); value = Sprite.Create(val, val2, new Vector2(0.5f, 0.5f), 100f, 0u, (SpriteMeshType)0, (Vector4)((num2 > 0f) ? new Vector4(num2, num2, num2, num2) : Vector4.zero)); ((Object)value).name = nombre; ((Object)value).hideFlags = (HideFlags)61; Cache[nombre] = value; return value; } } internal sealed class VisualizadorHud : MonoBehaviour { private sealed class AccessTools_Desbloqueos { private readonly FieldRef<MessageHud, List<GameObject>> _campo = AccessTools.FieldRefAccess<MessageHud, List<GameObject>>("m_unlockMessages"); public List<GameObject> De(MessageHud mh) { try { return _campo.Invoke(mh); } catch (Exception) { return null; } } } private struct EstiloTexto { public TMP_FontAsset Fuente; public Material Material; public Color Color; public float Contorno; public FontStyles Estilo; } private const float RefrescoCada = 0.1f; private const int Barras = 4; private const float Margen = 20f; private const float AnchoRecurso = 410f; private const float AltoRecurso = 58f; private const float PasoRecurso = 58f; private static readonly Rect Hueco = new Rect(25f, 14f, 360f, 30f); private const float LadoComida = 48f; private const float PasoComida = 116f; private const float LadoEstado = 46f; private const float PasoEstado = 60f; private const float Lado = 60f; private const float Hueco8 = 8f; private const float Separacion = 24f; private const float AlturaBarra = 125f; private const float AnchoHechizo = 420f; private const float AltoHechizo = 140f; private const float PasoCasilla = 84f; private const float HuecoCasilla = 52f; private const float BajoMarco = 11f; private const float AltoMarco = 74f; private const float CajaObjeto = 40f; private const float BajoRotulo = 75f; private const float XCaja = 24f; private const float YCaja = -59f; private const float HuecoCaja = 34f; private const float KMarco = 1f; private bool _conMarco; private const float YRecursos = 14f; private const float AnchoLado = 118f; private static readonly Color TinteArtes = new Color(1f, 0.82f, 0.45f); private static readonly Color TeclaArteVacia = new Color(0.85f, 0.7f, 0.45f); private static readonly Color FondoArtes = new Color(1f, 0.72f, 0.3f, 0.14f); private static readonly Color BordeArtes = new Color(1f, 0.75f, 0.35f, 0.85f); private static readonly Color FondoValheim = new Color(0.7f, 0.7f, 0.7f, 0.08f); private static readonly Color BordeValheim = new Color(0.65f, 0.65f, 0.65f, 0.6f); private static readonly Color Oscuro = new Color(0.05f, 0.04f, 0.03f, 0.62f); private readonly EstadoHud _estado = new EstadoHud(); private readonly Stopwatch _reloj = new Stopwatch(); private readonly List<GameObject> _ocultos = new List<GameObject>(); private Canvas _canvas; private RectTransform _muelle; private RectTransform _arribaIzq; private const float AltoArriba = 285f; private const float LadoMano = 84f; private const float HuecoMano = 14f; private const float LadoFila = 84f; private float _escalaBarraAplicada = -1f; private float _escalaEstadosAplicada = -1f; private bool _esquinerasAplicadas; private int _cambiosVistos; private float _anchoCanvas; private float _altoCanvas; private float _escalaAplicada = -1f; private RectTransform _izquierda; private RectTransform _derecha; private RectTransform _abajoIzq; private RectTransform _barra; private RectTransform _hechizo; private RectTransform _contador; private GameObject _paso; private GameObject _manto; private GameObject _grupoArtes; private GameObject _grupoValheim; private GameObject _grupoTodo; private GameObject _adornoIzq; private GameObject _adornoDer; private readonly GameObject[] _filas = (GameObject[])(object)new GameObject[4]; private readonly Image[] _rellenos = (Image[])(object)new Image[4]; private static readonly string[] PiezaRecurso = new string[4] { "vida", "estamina", "mana", "toki" }; private const float BordeMarcoX = 28f; private const float BordeMarcoY = 12f; private const float AltoEfecto = 30f; private const int ParticulasPorFila = 10; private bool _barrasV1; private readonly Image[] _brillos = (Image[])(object)new Image[4]; private readonly Image[] _cresta = (Image[])(object)new Image[4]; private readonly RectTransform[] _mascaras = (RectTransform[])(object)new RectTransform[4]; private readonly Image[][] _particulas = new Image[4][]; private readonly float[][] _vidaParticula = new float[4][]; private readonly float[][] _duraParticula = new float[4][]; private readonly Vector2[][] _origenParticula = new Vector2[4][]; private readonly Vector2[][] _derivaParticula = new Vector2[4][]; private readonly float[] _fraccion = new float[4]; private readonly float[] _fraccionAntes = new float[4]; private readonly float[] _emitir = new float[4]; private readonly float[] _pulso = new float[4]; private readonly bool[] _brilla = new bool[4]; private readonly Text[] _cifras = (Text[])(object)new Text[4]; private readonly Text[] _nombres = (Text[])(object)new Text[4]; private readonly GameObject[] _comidas = (GameObject[])(object)new GameObject[8]; private readonly Image[] _comidaIconos = (Image[])(object)new Image[8]; private readonly Text[] _comidaTextos = (Text[])(object)new Text[8]; private readonly Image[] _comidaTiempo = (Image[])(object)new Image[8]; private RectTransform _filaEsperas; private RectTransform _filaEstados; private readonly GameObject[] _esperas = (GameObject[])(object)new GameObject[6]; private readonly Image[] _esperaIconos = (Image[])(object)new Image[6]; private readonly Image[] _esperaRadial = (Image[])(object)new Image[6]; private readonly Text[] _esperaTextos = (Text[])(object)new Text[6]; private readonly GameObject[] _estados = (GameObject[])(object)new GameObject[14]; private readonly Image[] _estadoMarcos = (Image[])(object)new Image[14]; private readonly Image[] _estadoIconos = (Image[])(object)new Image[14]; private readonly Text[] _estadoTextos = (Text[])(object)new Text[14]; private readonly GameObject[] _casillas = (GameObject[])(object)new GameObject[8]; private readonly Image[] _marcos = (Image[])(object)new Image[8]; private readonly Image[] _iconos = (Image[])(object)new Image[8]; private readonly Image[] _objetos = (Image[])(object)new Image[8]; private readonly Image[] _objetosFondo = (Image[])(object)new Image[8]; private readonly Text[] _altTexto = (Text[])(object)new Text[8]; private readonly Image[] _esperasCasilla = (Image[])(object)new Image[8]; private readonly Image[] _destellos = (Image[])(object)new Image[8]; private readonly Image[] _cargadas = (Image[])(object)new Image[8]; private readonly Image[] _conflictos = (Image[])(object)new Image[8]; private readonly Text[] _teclas = (Text[])(object)new Text[8]; private readonly Text[] _cantidades = (Text[])(object)new Text[8]; private readonly Text[] _ratones = (Text[])(object)new Text[8]; private readonly Image[] _equipGrande = (Image[])(object)new Image[8]; private readonly Image[] _equipPeque = (Image[])(object)new Image[8]; private readonly Image[] _noDisponible = (Image[])(object)new Image[8]; private readonly Text[] _cantObjeto = (Text[])(object)new Text[8]; private readonly GameObject[] _cola = (GameObject[])(object)new GameObject[4]; private readonly Image[] _colaIconos = (Image[])(object)new Image[4]; private readonly Text[] _colaTextos = (Text[])(object)new Text[4]; private GameObject _manos; private readonly Image[] _manoIcono = (Image[])(object)new Image[2]; private readonly Image[] _manoDur = (Image[])(object)new Image[2]; private readonly Text[] _manoVacia = (Text[])(object)new Text[2]; private readonly Image[] _manoFondo = (Image[])(object)new Image[2]; private Image _mantoIcono; private Image _mantoCarga; private Image _mantoBrillo; private Image _mantoReloj; private Text _mantoTecla; private Text _mantoTiempo; private Sprite _mantoSprite; private Sprite _mantoApagarSprite; private Sprite _mantoFatigaSprite; private Image _mantoFondo; private Image _pasoIcono; private Image _pasoEnfriamiento; private Image _hechizoIcono; private Image _hechizoProgreso; private GameObject _hechizoBarra; private GameObject _hechizoDetalle; private Text _rotuloArtes; private Text _ayudaBarra; private Text _rotuloEstados; private GameObject _ayudaFondo; private string _rotuloBase; private Text _rotuloValheim; private Text _rotuloTodo; private Text _hechizoNombre; private Text _hechizoEscuela; private Text _hechizoCoste; private Text _hechizoEstado; private Text _hechizoDano; private Text _hechizoDescripcion; private Text _hechizoTipoEspera; private Text _contadorTexto; private Text _pasoTecla; private Text _pasoTiempo; private float _refresco; private int _ultimoLayout = -1; private Sprite _slot; private Sprite _slotActiva; private Sprite _slotApagada; private Sprite _espera; private Sprite _rellenoRecurso; private Sprite _marcoRecursos; private Sprite _marcoComida; private Sprite _cargada; private Sprite _conflicto; private Sprite _grupoArtesSprite; private Sprite _grupoValheimSprite; private Sprite _rotuloSprite; private Sprite _estadoSprite; private Sprite _panelHechizo; private Sprite _barraHechizo; private Sprite _pocion; private Sprite _placa; private Sprite _pasoSprite; private Sprite _pasoMkSprite; private bool _oculto; private static readonly FieldInfo CampoTextoMensaje = typeof(MessageHud).GetField("m_messageText"); private static readonly FieldInfo CampoIconoMensaje = typeof(MessageHud).GetField("m_messageIcon"); private MessageHud _mensajesMovidos; private static readonly AccessTools_Desbloqueos Desbloqueos = new AccessTools_Desbloqueos(); private readonly HashSet<int> _desbloqueosMovidos = new HashSet<int>(); private readonly Vector3[] _esquinas = (Vector3[])(object)new Vector3[4]; private int _reemplazoAplicado = -1; private Image _fondoHechizo; private Sprite _fondoHechizoArte; private Sprite _detalleMarcoArte; private bool? _estiloValheim; private bool _libro; private readonly int[] _comidaSeg = new int[8] { -1, -1, -1, -1, -1, -1, -1, -1 }; private float _avisoLento; private Image _hechizoModo; private Text _hechizoTecla; private static readonly Color Tinta = new Color(0.22f, 0.13f, 0.06f); private const float AnchoLibro = 480f; private const float AltoLibro = 165f; private Text _libroDescripcion; private GameObject _preparada; private Image _preparadaIcono; private Text _preparadaTexto; private Text _preparadaSub; private Text _preparadaTitulo; private const float AnchoPreparada = 330f; private const float AltoPreparada = 64f; private int _preparadaN = -1; private string _preparadaNombre; private string _preparadaComo; private RectTransform _mira; private Image _miraRelleno; private const float AnchoMira = 150f; private const float AltoMira = 6f; private static readonly string[] ClaveRecurso = new string[4] { "hud_res_health", "hud_res_stamina", "hud_res_mana", "hud_res_toki" }; private Sprite _pasoAnilloAzul; private static Sprite _anilloBlanco; private readonly bool[] _altGrande = new bool[8]; private bool _piedraBarra; private GameObject _panelPiedra; private bool _altAntes; private static readonly string[] CamposValheim = new string[5] { "m_healthPanel", "m_staminaBar2Root", "m_eitrBarRoot", "m_foodBarRoot", "m_statusEffectListRoot" }; private static FieldInfo[] _campos; private bool _ocultosSoloBarras; private const string AtlasCasillas = "hud_hotbar_states"; private const string AtlasTarjetas = "hud_utility_cards"; private const string AtlasMagia = "hud_magic_panels"; private const string AtlasPiedra = "hud_stone_frame_backplate"; private const float Ancho1536 = 1536f; private const float Ancho2172 = 2172f; private const float CasW = 322f; private const float CasH = 310f; private const float CasHx = 58f; private const float CasHy = 55f; private const float CasHw = 206f; private const float CasHh = 198f; private const string AtlasBarraPiedra = "hud_hotbar_stone"; private const float BpX0 = 28f; private const float BpY0 = 106f; private const float BpW = 2002f; private const float BpH = 578f; private const float BpK = 0.36073178f; private const float BpHuecoX = 126f; private const float BpHuecoW = 175f; private const float BpArribaAbajo = 373f; private const float BpArribaH = 165f; private const float BpAbajoAbajo = 606f; private const float BpAbajoH = 162f; private const float BpPestanaX = 158f; private const float BpPestanaW = 108f; private const float BpPestanaArriba = 110f; private const float BpPestanaAbajo = 185f; private const float BpAltX = 160f; private const float BpAltW = 125f; private const float BpAltArriba = 398f; private const float BpAltAbajo = 432f; private const float AltoTarjeta = 104f; private static readonly Vector4 BordeTarjeta = new Vector4(80f, 80f, 80f, 80f); private const float PiedraMult = 6f; private string _descripcionMedida; private float _altoDetalleMedido = 112f; private Image _detalleFondo; private Image _detalleMarco; private const int VhSlots = 10; private const int VhPaso = 8; private const int VhManto = 9; private const float VhHuecoUtil = 18f; private HotkeyBar _vhBarra; private RectTransform _vhFila; private CanvasGroup _vhFilaGrupo; private CanvasGroup _vhBarraGrupo; private readonly GameObject[] _vhCasilla = (GameObject[])(object)new GameObject[10]; private readonly Image[] _vhIcono = (Image[])(object)new Image[10]; private readonly Image[] _vhEspera = (Image[])(object)new Image[10]; private readonly TMP_Text[] _vhTecla = (TMP_Text[])(object)new TMP_Text[10]; private readonly TMP_Text[] _vhCant = (TMP_Text[])(object)new TMP_Text[10]; private readonly GameObject[] _vhEquipado = (GameObject[])(object)new GameObject[10]; private readonly Image[] _vhModo = (Image[])(object)new Image[10]; private readonly Image[] _vhMarcaToki = (Image[])(object)new Image[10]; private readonly Image[] _vhMarco = (Image[])(object)new Image[10]; private readonly Image[] _vhCargada = (Image[])(object)new Image[10]; private const float VhLadoModo = 28f; private const float VhLadoToki = 22f; private const float VhSobraMarco = 0f; private Color _vhColorTeclaJuego = Color.white; private float _vhContornoTeclaJuego; private static readonly Color VhPergamino = new Color(0.86f, 0.76f, 0.58f, 0.92f); private static readonly Color VhTinta = new Color(0.2f, 0.12f, 0.06f); private static readonly Color VhMarcoNormal = new Color(0.2f, 0.12f, 0.06f, 0.85f); private static readonly Color VhMarcoPreparada = new Color(1f, 0.78f, 0.25f); private TMP_Text _vhAyuda; private float _vhEspacio = 70f; private RectTransform _vhToki; private RectTransform _vhEitr; private GuiBar _vhTokiRapida; private GuiBar _vhTokiLenta; private TMP_Text _vhTokiTexto; private CanvasGroup _vhTokiGrupo; private float _vhTokiOculta; private float _vhTokiAlfa; private static readonly FieldRef<GuiBar, float> AnchoGuiBar = AccessTools.FieldRefAccess<GuiBar, float>("m_width"); private static readonly Color TokiColor = new Color(1f, 0.52f, 0.1f); private static readonly Color TokiLento = new Color(1f, 0.82f, 0.5f, 0.85f); private static readonly Color VhPergaminoEquipado = new Color(1f, 0.84f, 0.42f, 1f); private static readonly Color OroElegido = new Color(1f, 0.8f, 0.27f, 1f); private readonly string[] _vhTeclaPuesta = new string[8]; private readonly Dictionary<int, ColorBlock> _vhColoresOriginales = new Dictionary<int, ColorBlock>(); private TMP_FontAsset _vhFuente; private Material _vhMaterial; private Material _vhMaterialTiempo; private Color _vhColorNombre = Color.white; private Color _vhColorTiempo = new Color(1f, 0.6f, 0.2f); private bool _vhFuenteBuscada; private bool _vhFilaRotulada; private readonly Dictionary<int, EstiloTexto> _vhEstiloOriginal = new Dictionary<int, EstiloTexto>(); private TMP_FontAsset _vhFuenteTecla; private bool _vhFuenteTeclaBuscada; private readonly bool[] _vhConArte = new bool[8]; private static readonly string[] AltN = new string[8] { "<size=75%>Alt + 1</size>", "<size=75%>Alt + 2</size>", "<size=75%>Alt + 3</size>", "<size=75%>Alt + 4</size>", "<size=75%>Alt + 5</size>", "<size=75%>Alt + 6</size>", "<size=75%>Alt + 7</size>", "<size=75%>Alt + 8</size>" }; private static readonly string[] NumN = new string[8] { "1", "2", "3", "4", "5", "6", "7", "8" }; private RectTransform _vhMensaje; private Vector2 _vhMensajeOriginal; private Vector2 _vhIconoOriginal; private RectTransform _vhIconoMensaje; private readonly Vector3[] _vhEsquinas = (Vector3[])(object)new Vector3[4]; private const string NombreMarcoBarra = "MT_BarFrame"; private const string NombreMarcoComida = "MT_FoodFrame"; private const string NombreMarcoEstado = "MT_StatusFrame"; private static readonly Vector4 BordeMarcoBarra = new Vector4(89f, 39f, 90f, 38f); private const float HuecoMarcoBarra = 80f; private static readonly Color ColorMarcoEstado = new Color(0.93f, 0.82f, 0.6f); private static readonly Color ColorLinea = new Color(0.2f, 0.12f, 0.06f, 0.85f); private const float GrosorMarcoBarra = 0.55f; private const float GrosorMarcoVida = 0.45f; private const string NombreMarcoVida = "MT_LifeFrame"; private static readonly Vector4 BordeMarcoVida = new Vector4(59f, 115f, 58f, 107f); private const float HuecoMarcoVida = 43f; private static float AnchoBarra => 648f; private static float XRecursosIzq => (0f - AnchoBarra) / 2f - 26f - 118f - 10f - 410f; private static float XRecursosDer => AnchoBarra / 2f + 26f + 118f + 10f; private static float ExtraDerecha => 20f; private static float AnchoArriba => AnchoBarra + 2f * ExtraDerecha; private static Sprite CasArte => SpritesHud.Pieza("hud_hotbar_states", 1536f, 38f, 38f, 322f, 310f); private static Sprite CasArteSel => SpritesHud.Pieza("hud_hotbar_states", 1536f, 416f, 38f, 326f, 314f); private static Sprite CasObjeto => SpritesHud.Pieza("hud_hotbar_states", 1536f, 802f, 38f, 324f, 310f); private static Sprite CasObjetoSel => SpritesHud.Pieza("hud_hotbar_states", 1536f, 1184f, 38f, 322f, 310f); private static Sprite CasApagada => SpritesHud.Pieza("hud_hotbar_states", 1536f, 416f, 394f, 328f, 308f); private static Sprite EsquinasEquipado => SpritesHud.Pieza("hud_hotbar_states", 1536f, 1190f, 396f, 312f, 310f); private static Sprite PlacaAlt => SpritesHud.Pieza("hud_hotbar_states", 1536f, 394f, 792f, 390f, 134f); private static Sprite MarcaNoDisponible => SpritesHud.Pieza("hud_hotbar_states", 1536f, 1276f, 796f, 136f, 134f); private static bool HayCasillas => (Object)(object)CasArte != (Object)null; private static Sprite BarraPiedra => SpritesHud.Obtener("hud_hotbar_stone", 0f, opcional: true); private static Sprite Tarjeta => SpritesHud.Pieza("hud_utility_cards", 1536f, 28f, 54f, 348f, 506f, BordeTarjeta); private static Sprite TarjetaManto => SpritesHud.Pieza("hud_utility_cards", 1536f, 408f, 54f, 344f, 508f, BordeTarjeta); private static Sprite TarjetaMano => SpritesHud.Pieza("hud_utility_cards", 1536f, 790f, 54f, 344f, 508f, BordeTarjeta); private static Sprite AnilloFondo => SpritesHud.Pieza("hud_utility_cards", 1536f, 14f, 582f, 360f, 368f); private static Sprite AnilloAzul => SpritesHud.Pieza("hud_utility_cards", 1536f, 398f, 582f, 360f, 368f); private static Sprite AnilloNaranja => SpritesHud.Pieza("hud_utility_cards", 1536f, 782f, 582f, 364f, 368f); private static Sprite CarrilCarga => SpritesHud.Pieza("hud_utility_cards", 1536f, 1162f, 634f, 360f, 76f, new Vector4(42f, 24f, 42f, 21f)); private static Sprite RellenoCarga => SpritesHud.Pieza("hud_utility_cards", 1536f, 1230f, 744f, 220f, 12f); private static bool HayTarjetas { get { if ((Object)(object)Tarjeta != (Object)null) { return (Object)(object)AnilloFondo != (Object)null; } return false; } } private static Sprite PanelResumen => SpritesHud.Pieza("hud_magic_panels", 1536f, 18f, 122f, 736f, 332f, new Vector4(72f, 72f, 72f, 72f)); private static Sprite PanelMarco => SpritesHud.Pieza("hud_magic_panels", 1536f, 18f, 598f, 738f, 336f, new Vector4(72f, 72f, 72f, 72f)); private static Sprite CarrilProgreso => SpritesHud.Pieza("hud_magic_panels", 1536f, 800f, 712f, 706f, 62f, new Vector4(60f, 20f, 60f, 20f)); private static Sprite RellenoProgreso => SpritesHud.Pieza("hud_magic_panels", 1536f, 866f, 812f, 578f, 12f); private static Sprite PiedraMarco => SpritesHud.Pieza("hud_stone_frame_backplate", 2172f, 0f, 235f, 1080f, 245f, new Vector4(132f, 65f, 132f, 73f)); private static Sprite PiedraFondo => SpritesHud.Pieza("hud_stone_frame_backplate", 2172f, 1100f, 280f, 1065f, 175f, new Vector4(40f, 40f, 40f, 40f)); private static float XCasilla(int i) { return (float)i * 84f; } private void Update() { if ((Object)(object)_canvas == (Object)null) { Crear(); } if (Time.unscaledDeltaTime > 0.5f && (Object)(object)Player.m_localPlayer != (Object)null) { MTHudPlugin.Log.LogDebug((object)string.Format("Tirón de {0:0.00} s (arma: {1})", Time.unscaledDeltaTime, ((Humanoid)Player.m_localPlayer).GetCurrentWeapon()?.m_shared.m_name ?? "-")); } if (!MTHudPlugin.Mostrar.Value) { if (((Behaviour)_canvas).enabled) { ((Behaviour)_canvas).enabled = false; } if (!_oculto) { _oculto = true; ActivarValheim(ver: false); RestaurarValheim(); } return; } if (_oculto) { _oculto = false; _refresco = 0f; } Aplicar(MTHudPlugin.Escala.Value); Player localPlayer = Player.m_localPlayer; bool flag = (Object)(object)localPlayer != (Object)null && !((Character)localPlayer).IsDead() && (Object)(object)Hud.instance != (Object)null && Hud.instance.IsVisible() && !Hud.IsUserHidden() && !Menu.IsVisible() && !InventoryGui.IsVisible() && !Minimap.IsOpen(); if (((Behaviour)_canvas).enabled != flag) { ((Behaviour)_canvas).enabled = flag; } if (!flag) { return; } bool value = MTHudPlugin.HudCompleta.Value; bool flag2 = value || MTHudPlugin.ReemplazarValheim.Value; _refresco -= Time.unscaledDeltaTime; bool flag3 = BarraArtes.AltHeld(); if (flag3 != _altAntes) { _altAntes = flag3; if (HayIntercambio()) { Tono.Clic(flag3); } _refresco = 0f; } AnimarBarras(); if (Hud.Cambios != _cambiosVistos) { _cambiosVistos = Hud.Cambios; _refresco = 0f; } if (_refresco > 0f) { Destellos(); return; } _refresco = 0.1f; if (value) { OcultarValheim(soloBarras: false); MensajesBajoBrujula(); DesbloqueosBajoBarra(); } else if (flag2) { OcultarValheim(soloBarras: true); } else { RestaurarValheim(); } _reloj.Reset(); _reloj.Start(); Hud.Llenar(localPlayer, _estado); long elapsedMilliseconds = _reloj.ElapsedMilliseconds; Pintar(value, flag2); if (_reloj.ElapsedMilliseconds > 40) { _refresco = Mathf.Min(1f, 0.1f + (float)_reloj.ElapsedMilliseconds * 0.004f); if (Time.unscaledTime > _avisoLento) { _avisoLento = Time.unscaledTime + 5f; MTHudPlugin.Log.LogWarning((object)$"HUD lento: llenar {elapsedMilliseconds} ms, total {_reloj.ElapsedMilliseconds} ms"); } } } private void DesbloqueosBajoBarra() { //IL_0089: Unknown result type (might be due to invalid IL or missing references) MessageHud instance = MessageHud.instance; List<GameObject> list = (((Object)(object)instance != (Object)null) ? Desbloqueos.De(instance) : null); if (list == null || (Object)(object)_barra == (Object)null) { return; } for (int i = 0; i < list.Count; i++) { GameObject val = list[i]; if (!((Object)(object)val == (Object)null) && _desbloqueosMovidos.Add(((Object)val).GetInstanceID())) { ((RectTransform)((!((Object)(object)_panelPiedra != (Object)null) || !_panelPiedra.activeInHierarchy) ? ((object)_barra) : ((object)(RectTransform)_panelPiedra.transform))).GetWorldCorners(_esquinas); Transform transform = val.transform; BajarDesbloqueo((RectTransform)(object)((transform is RectTransform) ? transform : null), i, _esquinas[0].y); } } if (_desbloqueosMovidos.Count > 64) { _desbloqueosMovidos.Clear(); } } private void BajarDesbloqueo(RectTransform rt, int hueco, float suelo) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_006e: 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_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) if (!((Object)(object)rt == (Object)null) && !(((Transform)rt).lossyScale.y <= 0f)) { rt.GetWorldCorners(_esquinas); float num = (float)(((Object)(object)MessageHud.instance != (Object)null) ? MessageHud.instance.m_maxUnlockMsgSpace : 110) * ((Transform)rt).lossyScale.y; float num2 = _esquinas[1].y + (float)hueco * num; if (num2 > suelo) { rt.anchoredPosition -= new Vector2(0f, (num2 - suelo + 8f) / ((Transform)rt).lossyScale.y); } } } private void MensajesBajoBrujula() { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown //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_0093: 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_009c: 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_00a4: 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_00bc: 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_0164: 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_016a: 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_0173: 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_017b: 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) MessageHud instance = MessageHud.instance; if ((Object)(object)instance == (Object)null || (Object)(object)instance == (Object)(object)_mensajesMovidos) { return; } _mensajesMovidos = instance; try { object? obj = CampoTextoMensaje?.GetValue(instance); Component val = (Component)((obj is Component) ? obj : null); if ((Object)(object)val == (Object)null) { return; } Canvas componentInParent = val.GetComponentInParent<Canvas>(); Canvas val2 = ((componentInParent != null) ? componentInParent.rootCanvas : null); RectTransform val3 = (RectTransform)val.transform; if ((Object)(object)val2 != (Object)null) { ((Transform)val3).SetParent(((Component)val2).transform, false); } Vector2 val4 = (val3.pivot = new Vector2(0.5f, 1f)); Vector2 anchorMin = (val3.anchorMax = val4); val3.anchorMin = anchorMin; val3.sizeDelta = new Vector2(900f, val3.sizeDelta.y); val3.anchoredPosition = new Vector2(0f, -100f); PropertyInfo property = ((object)val).GetType().GetProperty("alignment"); if (property != null) { property.SetValue(val, Enum.Parse(property.PropertyType, "Top"), null); } object? obj2 = CampoIconoMensaje?.GetValue(instance); Image val7 = (Image)((obj2 is Image) ? obj2 : null); if ((Object)(object)val7 != (Object)null) { RectTransform rectTransform = ((Graphic)val7).rectTransform; if ((Object)(object)val2 != (Object)null) { ((Transform)rectTransform).SetParent(((Component)val2).transform, false); } val4 = (rectTransform.pivot = new Vector2(0.5f, 1f)); anchorMin = (rectTransform.anchorMax = val4); rectTransform.anchorMin = anchorMin; rectTransform.anchoredPosition = new Vector2(-480f, -100f); } } catch (Exception ex) { ManualLogSource log = MTHudPlugin.Log; if (log != null) { log.LogWarning((object)("MT HUD: no se pudieron mover los avisos: " + ex.Message)); } } } private void OnDestroy() { RestaurarValheim(); if ((Object)(object)_canvas != (Object)null) { Object.Destroy((Object)(object)((Component)_canvas).gameObject); } } private void Crear() { //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Expected O, but got Unknown //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Expected O, but got Unknown //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: 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_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_0329: 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) _slot = SpritesHud.Nordico("casilla"); _slotActiva = SpritesHud.Nordico("casilla"); _slotApagada = SpritesHud.Nordico("casilla"); _espera = SpritesHud.Obtener("hud_cooldown_fill"); _rellenoRecurso = SpritesHud.Obtener("hud_resource_fill"); _marcoRecursos = SpritesHud.Obtener("hud_resource_ornate", 0f, opcional: true); _marcoComida = SpritesHud.Nordico("casilla"); _cargada = SpritesHud.Obtener("hud_charged_mark"); _conflicto = SpritesHud.Obtener("hud_conflict_mark"); _grupoArtesSprite = SpritesHud.Obtener("hud_group_ornate", 0f, opcional: true); _grupoValheimSprite = SpritesHud.Obtener("hud_group_frame_valheim", 40f, opcional: true); _rotuloSprite = SpritesHud.Nordico("placa"); _estadoSprite = SpritesHud.Nordico("casilla"); _panelHechizo = SpritesHud.Obtener("hud_spell_nordic", 100f); _barraHechizo = SpritesHud.Obtener("hud_cast_bar_frame", 14f, opcional: true); _pocion = SpritesHud.Obtener("hud_potion_slot", 0f, opcional: true) ?? _marcoComida; _placa = SpritesHud.Obtener("hud_counter_plate", 24f, opcional: true); _pasoSprite = SpritesHud.Obtener("hud_step_icon", 0f, opcional: true); _pasoMkSprite = SpritesHud.Obtener("hud_step_mk_icon", 0f, opcional: true); _mantoSprite = SpritesHud.Obtener("hud_mantle_icon", 0f, opcional: true); _mantoApagarSprite = SpritesHud.Obtener("hud_manto_apagar", 0f, opcional: true); _mantoFatigaSprite = SpritesHud.Obtener("hud_manto_fatiga", 0f, opcional: true); GameObject val = new GameObject("MT HUD Canvas"); Object.DontDestroyOnLoad((Object)(object)val); _canvas = val.AddComponent<Canvas>(); _canvas.renderMode = (RenderMode)0; _canvas.sortingOrder = 50; CanvasScaler obj = val.AddComponent<CanvasScaler>(); obj.uiScaleMode = (ScaleMode)1; obj.referenceResolution = new Vector2(1760f, 990f); obj.screenMatchMode = (ScreenMatchMode)1; obj.matchWidthOrHeight = 1f; RectTransform padre = (RectTransform)val.transform; _muelle = Rt(Nodo("HUD_NordicDock", (Transform)(object)padre, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), Vector2.zero, Vector2.zero)); CrearIzquierda(_muelle); CrearBarra(_muelle); CrearHechizo(_muelle); CrearPreparada(_muelle); CrearContador(padre); CrearMira(padre); CrearPaso(_muelle); _arribaIzq = Rt(Nodo("HUD_TopLeftDock", (Transform)(object)padre, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(20f, -20f), new Vector2(AnchoArriba, 285f))); _arribaIzq.pivot = new Vector2(0f, 1f); _arribaIzq.anchoredPosition = new Vector2(20f, -20f); ((Transform)_barra).SetParent((Transform)(object)_arribaIzq, false); Aplicar(MTHudPlugin.Escala.Value); } private static int Perfil() { if (!MTHudPlugin.HudCompleta.Value) { return MTHudPlugin.ReemplazarValheim.Value ? 1 : 0; } return 2; } private void EstiloHechizo(bool valheim) { //IL_00d0: 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_013d: 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) if (_estiloValheim != valheim && !((Object)(object)_fondoHechizo == (Object)null)) { if (!_estiloValheim.HasValue) { _fondoHechizoArte = _fondoHechizo.sprite; _detalleMarcoArte = (((Object)(object)_detalleMarco != (Object)null) ? _detalleMarco.sprite : null); } _estiloValheim = valheim; bool flag = (Object)(object)_fondoHechizoArte != (Object)null; _fondoHechizo.sprite = (flag ? _fondoHechizoArte : SpritesHud.Blanco); _fondoHechizo.type = (Type)0; ((Graphic)_fondoHechizo).color = (Color)(flag ? Color.white : new Color(0f, 0f, 0f, 0.55f)); if ((Object)(object)_detalleMarco != (Object)null) { ((Behaviour)_detalleMarco).enabled = !valheim; } if ((Object)(object)_detalleFondo != (Object)null) { ((Graphic)_detalleFondo).color = (valheim ? new Color(0f, 0f, 0f, 0.55f) : new Color(0.06f, 0.045f, 0.03f, 0.92f)); } } } private void Aplicar(float escala) { //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_0015: 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_0181: 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_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_0221: 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_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02f0: Unknown result type (might be due to invalid IL or missing references) //IL_0315: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_035f: 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_03a2: Unknown result type (might be due to invalid IL or missing references) //IL_03c6: Unknown result type (might be due to invalid IL or missing references) //IL_03f1: Unknown result type (might be due to invalid IL or missing references) //IL_043e: Unknown result type (might be due to invalid IL or missing references) //IL_0429: Unknown result type (might be due to invalid IL or missing references) Rect rect = ((RectTransform)((Component)_canvas).transform).rect; if (((Rect)(ref rect)).width <= 0f || ((Rect)(ref rect)).height <= 0f) { return; } float num = ((MTHudPlugin.EscalaBarra != null) ? MTHudPlugin.EscalaBarra.Value : 1f); float num2 = ((MTHudPlugin.EscalaEstados != null) ? MTHudPlugin.EscalaEstados.Value : 1f); if (_anchoCanvas != ((Rect)(ref rect)).width || _altoCanvas != ((Rect)(ref rect)).height || _escalaAplicada != escala || _escalaBarraAplicada != num || _escalaEstadosAplicada != num2 || _esquinerasAplicadas != MTHudPlugin.Esquineras.Value || _reemplazoAplicado != Perfil()) { _reemplazoAplicado = Perfil(); _esquinerasAplicadas = MTHudPlugin.Esquineras.Value; _anchoCanvas = ((Rect)(ref rect)).width; _altoCanvas = ((Rect)(ref rect)).height; _escalaAplicada = escala; _escalaBarraAplicada = num; _escalaEstadosAplicada = num2; float num3 = Mathf.Min(Mathf.Clamp(escala, 0.5f, 2f) * 0.85f, ((Rect)(ref rect)).width / 1760f); ((Transform)_muelle).localScale = new Vector3(num3, num3, 1f); float num4 = Mathf.Min(num3, ((Rect)(ref rect)).width / 1050f); float num5 = num4 * Mathf.Clamp(num2, 0.6f, 2.5f); ((Transform)_filaEstados).localScale = new Vector3(num5, num5, 1f); ((Transform)_contador).localScale = new Vector3(num4, num4, 1f); RectTransform obj = Rt(_adornoIzq); RectTransform obj2 = Rt(_adornoDer); Vector3 localScale = default(Vector3); ((Vector3)(ref localScale))..ctor(num3, num3, 1f); ((Transform)obj2).localScale = localScale; ((Transform)obj).localScale = localScale; float num6 = AnchoBarra + 20f + ExtraDerecha; float num7 = (((Rect)(ref rect)).width * 0.36f - 12f) / num6 * Mathf.Clamp(num, 0.5f, 1f); ((Transform)_arribaIzq).localScale = new Vector3(num7, num7, 1f); float num8 = 199f; _arribaIzq.anchoredPosition = new Vector2(10f - (ExtraDerecha - 20f) * num7, (285f - num8) * num7 - 4f); float num9 = ((Rect)(ref rect)).width / 2f / num3; float num10 = (MTHudPlugin.Esquineras.Value ? 144.8f : 16f); float num11 = 0f - num9 + num10; float num12 = num9 - num10 - 410f; _izquierda.anchoredPosition = new Vector2(num11, 14f); _derecha.anchoredPosition = new Vector2(num12, 14f); float num13 = 156f; float num14 = num11 + 30f; Rt(_paso).anchoredPosition = new Vector2(num14, num13); Rt(_manto).anchoredPosition = new Vector2(num14 + 84f + 14f, num13); Rt(_manos).anchoredPosition = new Vector2(num14 + 196f, num13); Rt(_ayudaFondo).anchoredPosition = new Vector2(num11 + 20f, num13 + 104f + 6f); _abajoIzq.anchoredPosition = new Vector2(num11 + 20f, num13 + 104f + 32f); _hechizo.anchoredPosition = new Vector2(num12 + 410f, 138f); if (Perfil() == 0) { _hechizo.anchoredPosition = new Vector2(num12 + 410f, 106f); } bool flag = Perfil() == 1; if (flag) { _abajoIzq.anchoredPosition = new Vector2(num11 - 8f, 154f); } for (int i = 0; i < _comidas.Length; i++) { Rt(_comidas[i]).anchoredPosition = (flag ? new Vector2(0f, (float)i * 56f) : new Vector2((float)(i % 3) * 116f, (float)(-(i / 3)) * 50f)); } } } private static bool EsDerecha(int fila) { if (fila != 0) { return fila == 2; } return true; } private void CrearIzquierda(RectTransform padre) { //IL_0017: 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_0035: 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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0087: 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_00bb: 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_00df: 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_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Expected O, but got Unknown //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0129: 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_0162: 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_0168: 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_017b: 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_0199: 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_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: 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_0246: 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_025f: Unknown result type (might be due to invalid IL or missing references) //IL_08f0: Unknown result type (might be due to invalid IL or missing references) //IL_08f5: Unknown result type (might be due to invalid IL or missing references) //IL_0911: Unknown result type (might be due to invalid IL or missing references) //IL_0920: Unknown result type (might be due to invalid IL or missing references) //IL_094a: Unknown result type (might be due to invalid IL or missing references) //IL_0959: Unknown result type (might be due to invalid IL or missing references) //IL_095f: Unknown result type (might be due to invalid IL or missing references) //IL_09a1: Unknown result type (might be due to invalid IL or missing references) //IL_09b5: Unknown result type (might be due to invalid IL or missing references) //IL_09d8: Unknown result type (might be due to invalid IL or missing references) //IL_09e7: Unknown result type (might be due to invalid IL or missing references) //IL_09ef: Unknown result type (might be due to invalid IL or missing references) //IL_0a13: Unknown result type (might be due to invalid IL or missing references) //IL_0a22: Unknown result type (might be due to invalid IL or missing references) //IL_0a2c: Unknown result type (might be due to invalid IL or missing references) //IL_0a8a: Unknown result type (might be due to invalid IL or missing references) //IL_0a8f: Unknown result type (might be due to invalid IL or missing references) //IL_0a94: Unknown result type (might be due to invalid IL or missing references) //IL_0aa3: Unknown result type (might be due to invalid IL or missing references) //IL_0ad2: Unknown result type (might be due to invalid IL or missing references) //IL_0ad7: Unknown result type (might be due to invalid IL or missing references) //IL_0aea: Unknown result type (might be due to invalid IL or missing references) //IL_0af9: Unknown result type (might be due to invalid IL or missing references) //IL_0b1b: Unknown result type (might be due to invalid IL or missing references) //IL_0b2a: Unknown result type (might be due to invalid IL or missing references) //IL_0c67: Unknown result type (might be due to invalid IL or missing references) //IL_0c76: Unknown result type (might be due to invalid IL or missing references) //IL_0c85: Unknown result type (might be due to invalid IL or missing references) //IL_0c94: Unknown result type (might be due to invalid IL or missing references) //IL_0cb8: Unknown result type (might be due to invalid IL or missing references) //IL_0cd8: Unknown result type (might be due to invalid IL or missing references) //IL_0ce7: Unknown result type (might be due to invalid IL or missing references) //IL_0cef: Unknown result type (might be due to invalid IL or missing references) //IL_0b4a: Unknown result type (might be due to invalid IL or missing references) //IL_0b43: Unknown result type (might be due to invalid IL or missing references) //IL_0b6e: Unknown result type (might be due to invalid IL or missing references) //IL_0b7d: Unknown result type (might be due to invalid IL or missing references) //IL_0b83: Unknown result type (might be due to invalid IL or missing references) //IL_0bb6: Unknown result type (might be due to invalid IL or missing references) //IL_0bc5: Unknown result type (might be due to invalid IL or missing references) //IL_0d2e: Unknown result type (might be due to invalid IL or missing references) //IL_0d33: Unknown result type (might be due to invalid IL or missing references) //IL_0d56: Unknown result type (might be due to invalid IL or missing references) //IL_0d65: Unknown result type (might be due to invalid IL or missing references) //IL_0bed: Unknown result type (might be due to invalid IL or missing references) //IL_0c15: Unknown result type (might be due to invalid IL or missing references) //IL_0c24: Unknown result type (might be due to invalid IL or missing references) //IL_0c2c: Unknown result type (might be due to invalid IL or missing references) //IL_0dcb: Unknown result type (might be due to invalid IL or missing references) //IL_0dda: Unknown result type (might be due to invalid IL or missing references) //IL_0de4: Unknown result type (might be due to invalid IL or missing references) //IL_0e08: Unknown result type (might be due to invalid IL or missing references) //IL_0e17: Unknown result type (might be due to invalid IL or missing references) //IL_0e21: Unknown result type (might be due to invalid IL or missing references) //IL_0d9d: Unknown result type (might be due to invalid IL or missing references) //IL_0dac: Unknown result type (might be due to invalid IL or missing references) //IL_0db7: Unknown result type (might be due to invalid IL or missing references) //IL_0e45: Unknown result type (might be due to invalid IL or missing references) //IL_0e54: Unknown result type (might be due to invalid IL or missing references) //IL_0e5a: Unknown result type (might be due to invalid IL or missing references) //IL_0e8d: Unknown result type (might be due to invalid IL or missing references) //IL_0e9c: Unknown result type (might be due to invalid IL or missing references) //IL_0ea4: Unknown result type (might be due to invalid IL or missing references) //IL_0313: Unknown result type (might be due to invalid IL or missing references) //IL_0318: Unknown result type (might be due to invalid IL or missing references) //IL_031c: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_0326: 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_0348: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Unknown result type (might be due to invalid IL or missing references) //IL_0368: Unknown result type (might be due to invalid IL or missing references) //IL_036c: Unknown result type (might be due to invalid IL or missing references) //IL_0371: Unknown result type (might be due to invalid IL or missing references) //IL_0376: Unknown result type (might be due to invalid IL or missing references) //IL_037a: Unknown result type (might be due to invalid IL or missing references) //IL_0384: Unknown result type (might be due to invalid IL or missing references) //IL_0438: Unknown result type (might be due to invalid IL or missing references) //IL_043d: Unknown result type (might be due to invalid IL or missing references) //IL_0441: Unknown result type (might be due to invalid IL or missing references) //IL_0446: Unknown result type (might be due to invalid IL or missing references) //IL_044b: Unknown result type (might be due to invalid IL or missing references) //IL_044f: 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_03ee: Unknown result type (might be due to invalid IL or missing references) //IL_03f2: Unknown result type (might be due to invalid IL or missing references) //IL_03f7: Unknown result type (might be due to invalid IL or missing references) //IL_03fc: Unknown result type (might be due to invalid IL or missing references) //IL_0400: Unknown result type (might be due to invalid IL or missing references) //IL_041e: Unknown result type (might be due to invalid IL or missing references) //IL_03af: 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_03b8: Unknown result type (might be due to invalid IL or missing references) //IL_03bd: Unknown result type (might be due to invalid IL or missing references) //IL_03c2: Unknown result type (might be due to invalid IL or missing references) //IL_03c6: Unknown result type (might be due to invalid IL or missing references) //IL_03d5: Unknown result type (might be due to invalid IL or missing references) //IL_046b: Unknown result type (might be due to invalid IL or missing references) //IL_04b2: Unknown result type (might be due to invalid IL or missing references) //IL_04b7: Unknown result type (might be due to invalid IL or missing references) //IL_04bb: Unknown result type (might be due to invalid IL or missing references) //IL_04c0: Unknown result type (might be due to invalid IL or missing references) //IL_04c5: Unknown result type (might be due to invalid IL or missing references) //IL_04c9: Unknown result type (might be due to invalid IL or missing references) //IL_04f2: Unknown result type (might be due to invalid IL or missing references) //IL_0501: Unknown result type (might be due to invalid IL or missing references) //IL_0506: Unknown result type (might be due to invalid IL or missing references) //IL_050a: Unknown result type (might be due to invalid IL or missing references) //IL_0519: Unknown result type (might be due to invalid IL or missing references) //IL_051e: Unknown result type (might be due to invalid IL or missing references) //IL_0523: Unknown result type (might be due to invalid IL or missing references) //IL_0528: Unknown result type (might be due to invalid IL or missing references) //IL_052c: Unknown result type (might be due to invalid IL or missing references) //IL_053b: Unknown result type (might be due to invalid IL or missing references) //IL_0540: Unknown result type (might be due to invalid IL or missing references) //IL_055e: Unknown result type (might be due to invalid IL or missing references) //IL_06f1: Unknown result type (might be due to invalid IL or missing references) //IL_0700: Unknown result type (might be due to invalid IL or missing references) //IL_070e: Unknown result type (might be due to invalid IL or missing references) //IL_0683: Unknown result type (might be due to invalid IL or missing references) //IL_0688: Unknown result type (might be due to invalid IL or missing references) //IL_068c: Unknown result type (might be due to invalid IL or missing references) //IL_069b: Unknown result type (might be due to invalid IL or missing references) //IL_06a0: Unknown result type (might be due to invalid IL or missing references) //IL_06a5: Unknown result type (might be due to invalid IL or missing references) //IL_06aa: Unknown result type (might be due to invalid IL or missing references) //IL_06ae: Unknown result type (might be due to invalid IL or missing references) //IL_06bd: Unknown result type (might be due to invalid IL or missing references) //IL_06c2: Unknown result type (might be due to invalid IL or missing references) //IL_06e0: Unknown result type (might be due to invalid IL or missing references) //IL_05e0: Unknown result type (might be due to invalid IL or missing references) //IL_05e5: Unknown result type (might be due to invalid IL or missing references) //IL_05e9: Unknown result type (might be due to invalid IL or missing references) //IL_05f8: Unknown result type (might be due to invalid IL or missing references) //IL_0602: Unknown result type (might be due to invalid IL or missing references) //IL_0607: Unknown result type (might be due to invalid IL or missing references) //IL_060c: Unknown result type (might be due to invalid IL or missing references) //IL_0611: Unknown result type (might be due to invalid IL or missing references) //IL_0615: Unknown result type (might be due to invalid IL or missing references) //IL_0624: Unknown result type (might be due to invalid IL or missing references) //IL_062e: Unknown result type (might be due to invalid IL or missing references) //IL_0633: Unknown result type (might be due to invalid IL or missing references) //IL_063d: Unknown result type (might be due to invalid IL or missing references) //IL_057f: Unknown result type (might be due to invalid IL or missing references) //IL_0584: Unknown result type (might be due to invalid IL or missing references) //IL_0588: Unknown result type (might be due to invalid IL or missing references) //IL_0597: Unknown result type (might be due to invalid IL or missing references) //IL_059c: Unknown result type (might be due to invalid IL or missing references) //IL_05a1: Unknown result type (might be due to invalid IL or missing references) //IL_05a6: Unknown result type (might be due to invalid IL or missing references) //IL_05aa: Unknown result type (might be due to invalid IL or missing references) //IL_05b9: Unknown result type (might be due to invalid IL or missing references) //IL_05be: Unknown result type (might be due to invalid IL or missing references) //IL_05cd: Unknown result type (might be due to invalid IL or missing references) //IL_0753: Unknown result type (might be due to invalid IL or missing references) //IL_0758: Unknown result type (might be due to invalid IL or missing references) //IL_073d: Unknown result type (might be due to invalid IL or missing references) //IL_0742: Unknown result type (might be due to invalid IL or missing references) //IL_0767: Unknown result type (might be due to invalid IL or missing references) //IL_076c: Unknown result type (might be due to invalid IL or missing references) //IL_0775: Unknown result type (might be due to invalid IL or missing references) //IL_077f: Unknown result type (might be due to invalid IL or missing references) //IL_0784: Unknown result type (might be due to invalid IL or missing references) //IL_078d: Unknown result type (might be due to invalid IL or missing references) //IL_07ab: Unknown result type (might be due to invalid IL or missing references) //IL_080d: Unknown result type (might be due to invalid IL or missing references) //IL_0821: Unknown result type (might be due to invalid IL or missing references) //IL_0848: Unknown result type (might be due to invalid IL or missing references) //IL_084d: Unknown result type (might be due to invalid IL or missing references) //IL_0856: Unknown result type (might be due to invalid IL or missing references) //IL_0860: Unknown result type (might be due to invalid IL or missing references) //IL_0865: Unknown result type (might be due to invalid IL or missing references) //IL_086e: Unknown result type (might be due to invalid IL or missing references) //IL_0876: Unknown result type (might be due to invalid IL or missing references) //IL_08a9: Unknown result type (might be due to invalid IL or missing references) //IL_08bd: Unknown result type (might be due to invalid IL or missing references) _ = AnchoBarra; _izquierda = Rt(Nodo("HUD_ResourcesLeft", (Transform)(object)padre, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(XRecursosIzq, 14f), new Vector2(410f, 116f))); _derecha = Rt(Nodo("HUD_ResourcesRight", (Transform)(object)padre, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(XRecursosDer, 14f), new Vector2(410f, 116f))); _abajoIzq = Rt(Nodo("HUD_FoodColumn", (Transform)(object)padre, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(XRecursosIzq + 20f, 160f), new Vector2(348f, 144f))); RectTransform padre2 = (RectTransform)((Component)_canvas).transform; _adornoIzq = ((Component)Imagen("HUD_LeftCarving", (Transform)(object)padre2, Vector2.zero, new Vector2(181f, 218f), SpritesHud.Nordico("izquierda"), Color.white)).gameObject; RectTransform obj = Rt(_adornoIzq); Vector2 anchorMin = (Rt(_adornoIzq).anchorMax = Vector2.zero); obj.anchorMin = anchorMin; _adornoDer = ((Component)Imagen("HUD_RightCarving", (Transform)(object)padre2, Vector2.zero, new Vector2(182f, 218f), SpritesHud.Nordico("derecha"), Color.white)).gameObject; RectTransform obj2 = Rt(_adornoDer); RectTransform obj3 = Rt(_adornoDer); RectTransform obj4 = Rt(_adornoDer); Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(1f, 0f); obj4.pivot = val; anchorMin = (obj3.anchorMax = val); obj2.anchorMin = anchorMin; string[] array = new string[4] { "vida", "estamina", "mana", "toki" }; for (int i = 0; i < 4; i++) { _filas[i] = Nodo("HUD_ResourceRow", (Transform)(object)(EsDerecha(i) ? _derecha : _izquierda), Vector2.zero, Vector2.zero, Vector2.zero, new Vector2(410f, 58f)); Transform transform = _filas[i].transform; Sprite val3 = SpritesHud.Barra(PiezaRecurso[i]); bool flag = (Object)(object)val3 != (Object)null && (Object)(object)SpritesHud.Barra("marco") != (Object)null; bool num = flag && (MTHudPlugin.EstiloBarras == null || MTHudPlugin.EstiloBarras.Value == "Simple"); bool flag2 = !num && flag && MTHudPlugin.EstiloBarras.Value == "Piedra" && (Object)(object)PiedraMarco != (Object)null && (Object)(object)PiedraFondo != (Object)null; Rect hueco; if (num) { hueco = Hueco; Vector2 position = ((Rect)(ref hueco)).position; hueco = Hueco; Imagen("HUD_ResourceBackground", transform, position, ((Rect)(ref hueco)).size, SpritesHud.Blanco, new Color(0f, 0f, 0f, 0.85f)); } else if (flag2) { hueco = Hueco; Vector2 position2 = ((Rect)(ref hueco)).position; hueco = Hueco; Image obj5 = Imagen("HUD_ResourceBackground", transform, position2, ((Rect)(ref hueco)).size, PiedraFondo, Color.white); obj5.type = (Type)1; obj5.pixelsPerUnitMultiplier = 3.5f; } else if (flag) { hueco = Hueco; Vector2 position3 = ((Rect)(ref hueco)).position; hueco = Hueco; Imagen("HUD_ResourceBackground", transform, position3, ((Rect)(ref hueco)).size, SpritesHud.Barra("fondo"), Color.white); } else { hueco = Hueco; Vector2 position4 = ((Rect)(ref hueco)).position; hueco = Hueco; Imagen("HUD_ResourceBackground", transform, position4, ((Rect)(ref hueco)).size, SpritesHud.Blanco, new Color(0f, 0f, 0f, 0.7f)); } Image[] rellenos = _rellenos; int num2 = i; hueco = Hueco; Vector2 position5 = ((Rect)(ref hueco)).position; hueco = Hueco; rellenos[num2] = Imagen("HUD_ResourceFill", transform, position5, ((Rect)(ref hueco)).size, flag ? val3 : (_rellenoRecurso ?? SpritesHud.Blanco), Color.white); _rellenos[i].type = (Type)3; _rellenos[i].fillMethod = (FillMethod)0; _rellenos[i].fillOrigin = 0; Image[] brillos = _brillos; int num3 = i; hueco = Hueco; Vector2 position6 = ((Rect)(ref hueco)).position; hueco = Hueco; brillos[num3] = Imagen("HUD_ResourceShine", transform, position6, ((Rect)(ref hueco)).size, SpritesHud.Blanco, new Color(1f, 1f, 1f, flag ? 0f : 0.12f)); if (num) { hueco = Hueco; Vector2 pos = ((Rect)(ref hueco)).position - new Vector2(2f, 2f); hueco = Hueco; Borde(transform, pos, ((Rect)(ref hueco)).size + new Vector2(4f, 4f), 2f, new Color(0.16f, 0.09f, 0.04f, 1f)); } else if (flag) { Image obj6; if (!flag2) { hueco = Hueco; Vector2 pos2 = ((Rect)(ref hueco)).position - new Vector2(28f, 12f); hueco = Hueco; obj6 = Imagen("HUD_ResourceFrame", transform, pos2, ((Rect)(ref hueco)).size + new Vector2(56f, 24f), SpritesHud.Barra("marco"), Color.white); } else { hueco = Hueco; Vector2 pos3 = ((Rect)(ref hueco)).position - new Vector2(132f, 65f) / 6f; hueco = Hueco; obj6 = Imagen("HUD_ResourceFrame", transform, pos3, ((Rect)(ref hueco)).size + new Vector2(264f, 138f) / 6f, PiedraMarco, Color.white); } obj6.type = (Type)1; obj6.pixelsPerUnitMultiplier = (flag2 ? 4f : 3.2f); CrearEfectoBarra(i, transform, cresta: true); } else { if ((Object)(object)_marcoRecursos == (Object)null) { hueco = Hueco; Vector2 pos4 = ((Rect)(ref hueco)).position - new Vector2(3f, 3f); hueco = Hueco; Borde(transform, pos4, ((Rect)(ref hueco)).size + new Vector2(6f, 6f), 3f, new Color(0.25f, 0.18f, 0.1f, 1f)); } Imagen("HUD_ResourceFrame", transform, Vector2.zero, new Vector2(410f, 58f), SpritesHud.Nordico(array[i]), Color.white); } _barrasV1 = flag; bool flag3 = EsDerecha(i); Text[] nombres = _nombres; int num4 = i; float num5; if (!flag3) { hueco = Hueco; num5 = ((Rect)(ref hueco)).xMax - 100f; } else { hueco = Hueco; num5 = ((Rect)(ref hueco)).x + 8f; } hueco = Hueco; Vector2 pos5 = new Vector2(num5, ((Rect)(ref hueco)).y); hueco = Hueco; nombres[num4] = Texto("HUD_ResourceName", transform, pos5, new Vector2(92f, ((Rect)(ref hueco)).height), (TextAnchor)(flag3 ? 3 : 5), 17, new Color(1f, 0.94f, 0.76f)); _nombres[i].resizeTextForBestFit = true; _nombres[i].resizeTextMinSize = 11; _nombres[i].resizeTextMaxSize = 17; Outline obj7 = ((Component)_nombres[i]).gameObject.AddComponent<Outline>(); ((Shadow)obj7).effectColor = new Color(0f, 0f, 0f, 0.95f); ((Shadow)obj7).effectDistance = new Vector2(1.6f, -1.6f); Text[] cifras = _cifras; int num6 = i; float num7 = (flag3 ? 112 : 140); hueco = Hueco; Vector2 pos6 = new Vector2(num7, ((Rect)(ref hueco)).y); hueco = Hueco; cifras[num6] = Texto("HUD_ResourceLabel", transform, pos6, new Vector2(148f, ((Rect)(ref hueco)).height), (TextAnchor)4, 15, Color.white); Outline obj8 = ((Component)_cifras[i]).gameObject.AddComponent<Outline>(); ((Shadow)obj8).effectColor = new Color(0f, 0f, 0f, 0.95f); ((Shadow)obj8).effectDistance = new Vector2(1.4f, -1.4f); } for (int j = 0; j < _comidas.Length; j++) { _comidas[j] = Nodo("HUD_FoodSlot", (Transform)(object)_abajoIzq, Vector2.zero, Vector2.zero, new Vector2((float)(j % 3) * 116f, (float)(-(j / 3)) * 50f), new Vector2(110f, 48f)); Transform transform2 = _comidas[j].transform; _comidaIconos[j] = Imagen("HUD_FoodIcon", transform2, Vector2.zero, new Vector2(48f, 48f), null, Color.white); _comidaIconos[j].preserveAspect = true; Shadow obj9 = ((Component)_comidaIconos[j]).gameObject.AddComponent<Shadow>(); obj9.effectColor = new Color(0f, 0f, 0f, 0.6f); obj9.effectDistance = new Vector2(1.5f, -1.5f); _comidaTextos[j] = Texto("HUD_FoodTimer", transform2, new Vector2(52f, 12f), new Vector2(56f, 24f), (TextAnchor)3, 16, Color.white); _comidaTiempo[j] = Imagen("HUD_FoodTime", transform2, new Vector2(52f, 6f), new Vector2(50f, 4f), SpritesHud.Blanco, Color.white); _comidaTiempo[j].type = (Type)3; _comidaTiempo[j].fillMethod = (FillMethod)0; ((Component)_comidaTiempo[j]).gameObject.SetActive(false); } _filaEsperas = Rt(Nodo("HUD_PotionCooldowns", (Transform)(object)_abajoIzq, Vector2.zero, Vector2.zero, Vector2.zero, new Vector2(696f, 48f))); for (int k = 0; k < _esperas.Length; k++) { _esperas[k] = Nodo("HUD_PotionSlot", (Transform)(object)_filaEsperas, Vector2.zero, Vector2.zero, new Vector2((float)k * 54f, 0f), new Vector2(48f, 48f)); Transform transform3 = _esperas[k].transform; Imagen("HUD_PotionFrame", transform3, Vector2.zero, new Vector2(48f, 48f), _pocion, ((Object)(object)_pocion != (Object)null) ? Color.white : Oscuro); _esperaIconos[k] = Imagen("HUD_PotionIcon", transform3, new Vector2(7f, 7f), new Vector2(24f, 24f), null, Color.white); _esperaIconos[k].preserveAspect = true; _esperaRadial[k] = Imagen("HUD_PotionCooldown", transform3, new Vector2(7f, 7f), new Vector2(34f, 34f), _espera ?? SpritesHud.Blanco, new Color(0f, 0f, 0f, 0.6f)); Radial(_esperaRadial[k]); _esperaTextos[k] = Texto("HUD_PotionSeconds", transform3, Vector2.zero, new Vector2(48f, 48f), (TextAnchor)4, 15, Color.white); } _filaEstados = Rt(Nodo("HUD_StatusRow", ((Transform)_muelle).parent, new Vector2(1f, 1f), new Vector2(1f, 1f), new Vector2(-230f, -28f), new Vector2(420f, 70f))); _filaEstados.pivot = new Vector2(1f, 1f); _rotuloEstados = Texto("HUD_StatusHeading", (Transform)(object)_filaEstados, new Vector2(0f, 51f), new Vector2(406f, 16f), (TextAnchor)5, 10, MTGui.Gris); _rotuloEstados.text = Tr.Get("hud_status_active"); for (int l = 0; l < _estados.Length; l++) { _estados[l] = Nodo("HUD_StatusSlot", (Transform)(object)_filaEstados, Vector2.zero, Vector2.zero, new Vector2((float)(6 - l % 7) * 60f, 10f - (float)(l / 7) * 76f), new Vector2(46f, 46f)); Transform transform4 = _estados[l].transform; if ((Object)(object)_estadoSprite != (Object)null) { _estadoMarcos[l] = Imagen("HUD_StatusFrame", transform4, Vector2.zero, new Vector2(46f, 46f), _estadoSprite, Color.white); } else { Imagen("HUD_StatusBack", transform4, Vector2.zero, new Vector2(46f, 46f), SpritesHud.Blanco, Oscuro); _estadoMarcos[l] = Imagen("HUD_StatusEdge", transform4, new Vector2(0f, -3f), new Vector2(46f, 3f), SpritesHud.Blanco, Color.white); } _estadoIconos[l] = Imagen("HUD_StatusIcon", transform4, new Vector2(4f, 4f), new Vector2(38f, 38f), null, Color.white); _estadoIconos[l].preserveAspect = true; _estadoTextos[l] = Texto("HUD_StatusTime", transform4, new Vector2(-6f, -16f), new Vector2(58f, 14f), (TextAnchor)4, 13, Color.white); } } private void CrearBarra(RectTransform padre) { //IL_0017: 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_0038: 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_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_009e: 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_00d5: 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_0112: 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_0147: 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_016b: 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_01a4: 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_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_022d: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_0276: 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_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_08aa: Unknown result type (might be due to invalid IL or missing references) //IL_08af: Unknown result type (might be due to invalid IL or missing references) //IL_08c6: Unknown result type (might be due to invalid IL or missing references) //IL_08d5: Unknown result type (might be due to invalid IL or missing references) //IL_08f3: Unknown result type (might be due to invalid IL or missing references) //IL_0902: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_0922: Unknown result type (might be due to invalid IL or missing references) //IL_091b: 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_0350: Unknown result type (might be due to invalid IL or missing references) //IL_0356: Unknown result type (might be due to invalid IL or missing references) //IL_0387: Unknown result type (might be due to invalid IL or missing references) //IL_0396: Unknown result type (might be due to invalid IL or missing references) //IL_031a: Unknown result type (might be due to invalid IL or missing references) //IL_0952: Unknown result type (might be due to invalid IL or missing references) //IL_0961: Unknown result type (might be due to invalid IL or missing references) //IL_0967: Unknown result type (might be due to invalid IL or missing references) //IL_09a6: Unknown result type (might be due to invalid IL or missing references) //IL_09b5: Unknown result type (might be due to invalid IL or missing references) //IL_09bd: Unknown result type (might be due to invalid IL or missing references) //IL_03be: Unknown result type (might be due to invalid IL or missing references) //IL_03ee: Unknown result type (might be due to invalid IL or missing references) //IL_03fd: Unknown result type (might be due to invalid IL or missing references) //IL_041b: Unknown result type (might be due to invalid IL or missing references) //IL_043e: Unknown result type (might be due to invalid IL or missing references) //IL_044d: Unknown result type (might be due to invalid IL or missing references) //IL_049f: Unknown result type (might be due to invalid IL or missing references) //IL_0498: Unknown result type (might be due to invalid IL or missing references) //IL_04ef: Unknown result type (might be due to invalid IL or missing references) //IL_04fe: Unknown result type (might be due to invalid IL or missing references) //IL_0504: Unknown result type (might be due to invalid IL or missing references) //IL_0535: Unknown result type (might be due to invalid IL or missing references) //IL_0544: Unknown result type (might be due to invalid IL or missing references) //IL_054f: Unknown result type (might be due to invalid IL or missing references) //IL_0568: Unknown result type (might be due to invalid IL or missing references) //IL_056d: Unknown result type (might be due to invalid IL or missing references) //IL_0577: Unknown result type (might be due to invalid IL or missing references) //IL_0599: Unknown result type (might be due to invalid IL or missing references) //IL_05b6: Unknown result type (might be due to invalid IL or missing references) //IL_05bb: Unknown result type (might be due to invalid IL or missing references) //IL_05c5: Unknown result type (might be due to invalid IL or missing references) //IL_05e7: Unknown result type (might be due to invalid IL or missing references) //IL_060e: Unknown result type (might be due to invalid IL or missing references) //IL_061d: Unknown result type (might be due to invalid IL or missing references) //IL_063b: Unknown result type (might be due to invalid IL or missing references) //IL_066c: Unknown result type (might be due to invalid IL or missing references) //IL_067b: Unknown result type (might be due to invalid IL or missing references) //IL_0683: Unknown result type (might be due to invalid IL or missing references) //IL_06a6: Unknown result type (might be due to invalid IL or missing references) //IL_06b5: Unknown result type (might be due to invalid IL or missing references) //IL_06c0: Unknown result type (might be due to invalid IL or missing references) //IL_04c8: Unknown result type (might be due to invalid IL or missing references) //IL_072d: Unknown result type (might be due to invalid IL or missing references) //IL_073c: Unknown result type (might be due to invalid IL or missing references) //IL_0753: Unknown result type (might be due to invalid IL or missing references) //IL_0799: Unknown result type (might be due to invalid IL or missing references) //IL_07a8: Unknown result type (might be due to invalid IL or missing references) //IL_07bf: Unknown result type (might be due to invalid IL or missing references) //IL_07e2: Unknown result type (might be due to invalid IL or missing references) //IL_07f1: Unknown result type (might be due to invalid IL or missing references) //IL_07f9: Unknown result type (might be due to invalid IL or missing references) //IL_081c: Unknown result type (might be due to invalid IL or missing references) //IL_082b: Unknown result type (might be due to invalid IL or missing references) //IL_0833: Unknown result type (might be due to invalid IL or missing references) //IL_06f1: Unknown result type (might be due to invalid IL or missing references) //IL_0700: Unknown result type (might be due to invalid IL or missing references) //IL_070a: Unknown result type (might be due to invalid IL or missing references) float anchoBarra = AnchoBarra; _barra = Rt(Nodo("HUD_UnifiedHotbar", (Transform)(object)padre, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2((0f - anchoBarra) / 2f, 125f), new Vector2(anchoBarra, 150f))); float ancho = XCasilla(3) + 60f; _conMarco = false; _rotuloBase = Tr.Get("hud_group_arts"); _grupoArtes = Grupo("HUD_GroupArts", 0f, ancho, _grupoArtesSprite, FondoArtes, BordeArtes, _rotuloBase, MTGui.Oro, out _rotuloArtes); _grupoTodo = Grupo("HUD_GroupAll", 0f, anchoBarra, _grupoArtesSprite, FondoArtes, BordeArtes, "", MTGui.Oro, out _rotuloTodo); _grupoValheim = Grupo("HUD_GroupValheim", XCasilla(4), ancho, _grupoValheimSprite, FondoValheim, BordeValheim, Tr.Get("hud_group_valheim"), MTGui.Gris, out _rotuloValheim); _ayudaFondo = Nodo("HUD_BarHelp", (Transform)(object)padre, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(XRecursosIzq + 20f, 134f), new Vector2(640f, 22f)); _ayudaBarra = Texto("HUD_BarHelpText", _ayudaFondo.transform, new Vector2(8f, 2f), new Vector2(624f, 18f), (TextAnchor)3, 12, MTGui.Texto); _piedraBarra = MTHudPlugin.EstiloBarras != null && MTHudPlugin.EstiloBarras.Value == "Piedra" && (Object)(object)BarraPiedra != (Object)null; for (int i = 0; i < 8; i++) { float num = XCasilla(i); _casillas[i] = Nodo("HUD_HotbarSlot_" + (i + 1), (Transform)(object)_barra, Vector2.zero, Vector2.zero, new Vector2(num, 0f), new Vector2(60f, 60f)); Transform transform = _casillas[i].transform; Imagen("HUD_SlotBack", transform, new Vector2(4f, 4f), new Vector2(52f, 52f), SpritesHud.Blanco, new Color(0.04f, 0.035f, 0.03f, 0.78f)); _marcos[i] = Imagen("HUD_SlotFrame", transform, Vector2.zero, new Vector2(60f, 60f), HayCasillas ? CasArte : _slot, (HayCasillas || (Object)(object)_slot != (Object)null) ? Color.white : Oscuro); if (HayCasillas) { ColocarMarcoCasilla(((Graphic)_marcos[i]).rectTransform, new Vector2(4f, 4f), 52f); } _iconos[i] = Imagen("HUD_ArtIcon", transform, new Vector2(9f, 9f), new Vector2(42f, 42f), null, Color.white); _iconos[i].preserveAspect = true; _esperasCasilla[i] = Imagen("HUD_CooldownFill", transform, new Vector2(10f, 10f), new Vector2(40f, 40f), _espera ?? SpritesHud.Blanco, new Color(0f, 0f, 0f, 0.65f)); Radial(_esperasCasilla[i]); _destellos[i] = Imagen("HUD_FailFlash", transform, new Vector2(10f, 10f), new Vector2(40f, 40f), SpritesHud.Blanco, new Color(1f, 0.2f, 0.15f, 0f)); _objetosFondo[i] = Imagen("HUD_ValheimItemBox", transform, new Vector2(24f, -59f), new Vector2(40f, 40f), HayCasillas ? CasObjeto : (_slot ?? SpritesHud.Blanco), (Color)((HayCasillas || (Object)(object)_slot != (Object)null) ? Color.white : new Color(0.05f, 0.05f, 0.05f, 0.9f))); if (HayCasillas) { ColocarMarcoCasilla(((Graphic)_objetosFondo[i]).rectTransform, new Vector2(27f, -56f), 34f); } _objetos[i] = Imagen("HUD_ValheimItemIcon", transform, new Vector2(28f, -55f), new Vector2(32f, 32f), null, Color.white); _objetos[i].preserveAspect = true; _cargadas[i] = Imagen("HUD_ChargedMark", transform, new Ve
plugins/MT.Mk/MT.Mk.dll
Decompiled a day ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; 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; using MT.Core.Commands; using MT.Core.Diario; using MT.Core.Economia; using MT.Core.Especialidades; using MT.Core.I18n; using MT.Core.Touki; using MT.Core.Vfx; using MT.Magia; using MT.Mk; 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.Mk")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+f72fd27a1cef3fefa2078e5313c902bbcd510c4b")] [assembly: AssemblyProduct("MT.Mk")] [assembly: AssemblyTitle("MT.Mk")] [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.Mk { internal static class MkConfig { public const string Seccion = "Mk-I Armor"; internal static ConfigEntry<float> MultiplicadorDanoCanon; public static void Enlazar(ConfigFile cfg) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_02d4: 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_02f2: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Unknown result type (might be due to invalid IL or missing references) //IL_06d4: Unknown result type (might be due to invalid IL or missing references) //IL_0702: Unknown result type (might be due to invalid IL or missing references) //IL_074f: Unknown result type (might be due to invalid IL or missing references) //IL_077d: Unknown result type (might be due to invalid IL or missing references) MultiplicadorDanoCanon = cfg.Bind<float>("Mk-I Armor", "CannonDamageMultiplier", 0.7f, new ConfigDescription("Damage multiplier for Mk-I Cannon bullets, including already crafted cannons.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 2f), Array.Empty<object>())); MTMagiaPlugin.Mk1DesgasteGolpe = cfg.Bind<float>("Mk-I Armor", "WearPerHit", 0.04f, "Durability the Mk-I loses per point of damage taken (0.04 = gentle wear in long battles)."); if (MTMagiaPlugin.Mk1DesgasteGolpe.Value > 0.1f) { MTMagiaPlugin.Mk1DesgasteGolpe.Value = 0.04f; } MTMagiaPlugin.Mk1CalorBalas = cfg.Bind<float>("Mk-I Armor", "BulletHeat", 25f, "Consecutive Mk-I Cannon shots before it overheats."); if (MTMagiaPlugin.Mk1CalorBalas.Value < 20f) { MTMagiaPlugin.Mk1CalorBalas.Value = 25f; } MTMagiaPlugin.Mk1CalorEspera = cfg.Bind<float>("Mk-I Armor", "HeatCooldown", 2f, "Seconds the Mk-I Cannon cannot fire when overheated."); if (MTMagiaPlugin.Mk1CalorEspera.Value > 2.5f) { MTMagiaPlugin.Mk1CalorEspera.Value = 2f; } MTMagiaPlugin.Mk1Cadencia = cfg.Bind<float>("Mk-I Armor", "CannonFireRate", 0.15f, "Seconds between Mk-I Cannon bullets while holding attack."); if (MTMagiaPlugin.Mk1Cadencia.Value >= 0.2f) { MTMagiaPlugin.Mk1Cadencia.Value = 0.15f; } MTMagiaPlugin.Mk1DanoCaida = cfg.Bind<float>("Mk-I Armor", "FallDamage", 40f, "Blunt damage of the landing hit with the Mk-I on, per second of fall (up to 3 s)."); MTMagiaPlugin.Mk1MasDano = cfg.Bind<float>("Mk-I Armor", "ExtraDamagePerPiece", 0.15f, "With the armor on: +damage to everything (physical and magic) per Mk-I piece worn (full armor counts as 3 pieces = +45 %)."); if (MTMagiaPlugin.Mk1MasDano.Value < 0.1f) { MTMagiaPlugin.Mk1MasDano.Value = 0.15f; } MTMagiaPlugin.Mk1VidaPorPieza = cfg.Bind<float>("Mk-I Armor", "HealthPerPiece", 30f, "With the armor on: +max health per Mk-I piece worn (full armor counts as 3 pieces = +90)."); MTMagiaPlugin.Mk1EscudoManoEscala = cfg.Bind<float>("Mk-I Armor", "HandShieldScale", 1.2f, "Mk-I Shield size in hand, relative to the game's tower shield."); if (Mathf.Approximately(MTMagiaPlugin.Mk1EscudoManoEscala.Value, 1.6f) || Mathf.Approximately(MTMagiaPlugin.Mk1EscudoManoEscala.Value, 1.25f) || Mathf.Approximately(MTMagiaPlugin.Mk1EscudoManoEscala.Value, 1f)) { MTMagiaPlugin.Mk1EscudoManoEscala.Value = 1.2f; } MTMagiaPlugin.Mk1EscudoModelo = cfg.Bind<int>("Mk-I Armor", "ShieldModel", 2, "Mk-I Shield model: 2 (escudo2.blend, versión definitiva)."); MTMagiaPlugin.Mk1EscudoManoVoltear = cfg.Bind<bool>("Mk-I Armor", "HandShieldFlip", true, "Flip the Mk-I Shield (face outward, not toward the arm)."); MTMagiaPlugin.Mk1EscudoManoSeparacion = cfg.Bind<float>("Mk-I Armor", "HandShieldOffset", -0.09f, "Meters the Mk-I Shield is pushed outward from the arm (so the arm doesn't clip through)."); if (Mathf.Approximately(MTMagiaPlugin.Mk1EscudoManoSeparacion.Value, 0.15f)) { MTMagiaPlugin.Mk1EscudoManoSeparacion.Value = -0.09f; } MTMagiaPlugin.Mk1EscudoManoAltura = cfg.Bind<float>("Mk-I Armor", "HandShieldHeight", 0f, "Meters the Mk-I Shield is shifted up/down along the arm."); MTMagiaPlugin.Mk1EscudoManoGiro = cfg.Bind<Vector3>("Mk-I Armor", "HandShieldRotation", new Vector3(15f, 0f, 0f), "Extra rotation of the Mk-I Shield in hand (degrees X, Y, Z)."); if (MTMagiaPlugin.Mk1EscudoManoGiro.Value == Vector3.zero) { MTMagiaPlugin.Mk1EscudoManoGiro.Value = new Vector3(15f, 0f, 0f); } MTMagiaPlugin.Mk1ConArmaduraEscala = cfg.Bind<float>("Mk-I Armor", "ShieldAndCannonWithArmor", 1.3f, "With the Mk-I Armor on, the shield and cannon grow by this (to match the armor)."); MTMagiaPlugin.Mk1Esqueleto = cfg.Bind<bool>("Mk-I Armor", "SkinnedBody", true, "Use the body as a single mesh skinned to your bones (Models/mk1_cuerpo.obj). false = loose plates."); MTMagiaPlugin.Mk1Tamano = cfg.Bind<float>("Mk-I Armor", "SizeWithMk1", 1.4f, "With the Mk-I Cuirass the player grows to the armor's height (in the novel it is 2.3 m: 1.28 × 1.8 m)."); MTMagiaPlugin.Mk1Salto = cfg.Bind<float>("Mk-I Armor", "ManaJump", 1.7f, "With mana, jumping is multiplied by this."); MTMagiaPlugin.Mk1Carrera = cfg.Bind<float>("Mk-I Armor", "ManaRun", 1.3f, "With mana, running is this much faster."); MTMagiaPlugin.Mk1RegenVida = cfg.Bind<float>("Mk-I Armor", "HealthRegen", 0.5f, "Health per second regenerated by the active Mk-I."); MTMagiaPlugin.Mk1Nado = cfg.Bind<float>("Mk-I Armor", "Swim", 2.5f, "Swim speed multiplier with the Mk-I on."); MTMagiaPlugin.Mk1DisrupcionEspera = cfg.Bind<float>("Mk-I Armor", "DisruptionCooldown", 1.5f, "Mk-I Shield: seconds between magic disruptions (cancel a projectile)."); if (MTMagiaPlugin.Mk1DisrupcionEspera.Value > 2f) { MTMagiaPlugin.Mk1DisrupcionEspera.Value = 1.5f; } MTMagiaPlugin.Mk1DisrupcionMana = cfg.Bind<float>("Mk-I Armor", "DisruptionMana", 5f, "Mk-I Shield: mana each passive disruption costs."); if (MTMagiaPlugin.Mk1DisrupcionMana.Value > 10f) { MTMagiaPlugin.Mk1DisrupcionMana.Value = 5f; } MTMagiaPlugin.Mk1DisrupcionDesgaste = cfg.Bind<float>("Mk-I Armor", "DisruptionWear", 0.01f, "Mk-I Shield: fraction of max durability lost per disruption."); if (MTMagiaPlugin.Mk1DisrupcionDesgaste.Value > 0.02f) { MTMagiaPlugin.Mk1DisrupcionDesgaste.Value = 0.01f; } MTMagiaPlugin.Mk1Durabilidad = cfg.Bind<float>("Mk-I Armor", "Durability", 3500f, "Durability of the Mk-I Magic Armor (repaired for free at the forge)."); if (MTMagiaPlugin.Mk1Durabilidad.Value < 3000f) { MTMagiaPlugin.Mk1Durabilidad.Value = 3500f; } MTMagiaPlugin.Mk1DesgasteSegundo = cfg.Bind<float>("Mk-I Armor", "WearPerSecond", 0f, "Durability the Mk-I loses per second while on (0 = disabled, only wears down from combat damage)."); if (MTMagiaPlugin.Mk1DesgasteSegundo.Value <= 0.67f) { MTMagiaPlugin.Mk1DesgasteSegundo.Value = 0f; } MTMagiaPlugin.Mk1CanonDurabilidad = cfg.Bind<float>("Mk-I Armor", "CannonDurability", 1500f, "Durability of the Mk-I Cannon (repaired for free at the forge)."); if (MTMagiaPlugin.Mk1CanonDurabilidad.Value < 1200f) { MTMagiaPlugin.Mk1CanonDurabilidad.Value = 1500f; } MTMagiaPlugin.Mk1CanonDesgaste = cfg.Bind<float>("Mk-I Armor", "CannonWearPerShot", 3f, "Durability the Mk-I Cannon loses per firing cycle (extra barrels increase wear)."); if (MTMagiaPlugin.Mk1CanonDesgaste.Value <= 0.1f) { MTMagiaPlugin.Mk1CanonDesgaste.Value = 3f; } MTMagiaPlugin.Mk1CanonVolumen = cfg.Bind<bool>("Mk-I Armor", "CannonSound", true, "Mk-I Cannon firing sound (reuses one from the game)."); MTMagiaPlugin.Mk1Camara = cfg.Bind<float>("Mk-I Armor", "Camera", 1.45f, "With the Mk-I on, the camera rises and pulls back by this (the character is bigger and blocked the aim)."); MTMagiaPlugin.Mk1CaidaMinima = cfg.Bind<float>("Mk-I Armor", "MinFall", 2.5f, "Fall height (m) from which the camera shakes and some dust appears on landing, with or without armor (with the Mk-I, also a heavy sound and a hit to enemies). A normal jump does not."); MTMagiaPlugin.Mk1TemblorPaso = cfg.Bind<float>("Mk-I Armor", "StepShake", 0.8f, "Camera shake strength on each step with the Mk-I (0 = none). Console: mt_mk1_shake <step> [fall]."); MTMagiaPlugin.Mk1TemblorCaida = cfg.Bind<float>("Mk-I Armor", "FallShake", 0.4f, "Shake strength on landing, per unit of impact (0 = none)."); MTMagiaPlugin.Mk1Temblor = cfg.Bind<bool>("Mk-I Armor", "FootstepsShake", true, "Each step shakes the camera and raises dust; on landing, a strong hit."); MTMagiaPlugin.Mk1VelocidadBala = cfg.Bind<float>("Mk-I Armor", "BulletSpeed", 75f, "Speed (m/s) of Mk-I Cannon bullets (they fly straight, no gravity)."); if (MTMagiaPlugin.Mk1VelocidadBala.Value < 65f) { MTMagiaPlugin.Mk1VelocidadBala.Value = 75f; } MTMagiaPlugin.Mk1TamanoBala = cfg.Bind<float>("Mk-I Armor", "BulletSize", 0.75f, "Size of Mk-I Cannon bullets (1 = like the Stone Bullet)."); MTMagiaPlugin.Mk1EscudoGiro = cfg.Bind<Vector3>("Mk-I Armor", "ShieldRotation", new Vector3(0f, -90f, 0f), "Shield rotation on the forearm (degrees X, Y, Z). Y rotates around the arm."); MTMagiaPlugin.Mk1EscudoPos = cfg.Bind<Vector3>("Mk-I Armor", "ShieldPosition", new Vector3(-0.12f, 0.35f, 0f), "Shield offset (m): X out from the arm, Y toward the elbow, Z forward."); MTMagiaPlugin.Mk1EscudoEscala = cfg.Bind<float>("Mk-I Armor", "ShieldScale", 0.85f, "Shield size."); MTMagiaPlugin.Mk1CanonGiro = cfg.Bind<Vector3>("Mk-I Armor", "CannonRotation", new Vector3(0f, 0f, 0f), "Cannon rotation on the forearm (degrees X, Y, Z)."); MTMagiaPlugin.Mk1CanonPos = cfg.Bind<Vector3>("Mk-I Armor", "CannonPosition", new Vector3(0.1f, 0.05f, 0f), "Cannon offset (m): X out from the arm, Y toward the elbow, Z forward."); MTMagiaPlugin.Mk1CanonEscala = cfg.Bind<float>("Mk-I Armor", "CannonSize", 1f, "Size of the Mk-I Cannon on the forearm."); if (Mathf.Approximately(MTMagiaPlugin.Mk1CanonEscala.Value, 1.25f)) { MTMagiaPlugin.Mk1CanonEscala.Value = 1f; } MTMagiaPlugin.Mk1Armadura = cfg.Bind<float>("Mk-I Armor", "Armor", 52f, "Base armor of the Mk-I (+4 per upgrade level)."); MTMagiaPlugin.Mk1ManaSegundo = cfg.Bind<float>("Mk-I Armor", "ManaPerSecond", 0.5f, "Mana the Mk-I spends every second while worn."); if (MTMagiaPlugin.Mk1ManaSegundo.Value > 1f) { MTMagiaPlugin.Mk1ManaSegundo.Value = 0.5f; } MTMagiaPlugin.Mk1Reduccion = cfg.Bind<float>("Mk-I Armor", "DamageReduction", 0.25f, "With mana: physical damage taken is reduced by this (0.25 = −25 %), on top of armor."); MTMagiaPlugin.Mk1ManaDisparo = cfg.Bind<float>("Mk-I Armor", "ManaPerShot", 4f, "Mana per Mk-I Cannon bullet."); MTMagiaPlugin.Mk1BloqueoEscudo = cfg.Bind<float>("Mk-I Armor", "ShieldBlock", 100f, "Block power of the Mk-I Shield (+8 per upgrade)."); MTMagiaPlugin.Mk1DanoBala = cfg.Bind<float>("Mk-I Armor", "BulletDamage", 130f, "Base damage per Mk-I Cannon bullet (+20 per upgrade, +1 % per elemental magic level)."); if (MTMagiaPlugin.Mk1DanoBala.Value < 110f) { MTMagiaPlugin.Mk1DanoBala.Value = 130f; } MTMagiaPlugin.Mk1Escala = cfg.Bind<float>("Mk-I Armor", "Scale", 1f, "Size of the Mk-I plates; 1 fits their joints to the player's skeleton."); } } [BepInPlugin("mushokutensei.mk", "MT Mk", "1.1.4")] [BepInDependency("mushokutensei.core", "2.99.87")] [BepInDependency("mushokutensei.magia", "3.19.7")] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] public class MTMkPlugin : BaseUnityPlugin { public const string Guid = "mushokutensei.mk"; public const string Version = "1.1.4"; private void Awake() { //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Expected O, but got Unknown //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Expected O, but got Unknown //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Expected O, but got Unknown //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Expected O, but got Unknown //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Expected O, but got Unknown //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Expected O, but got Unknown string text = (MkPuente.Dir = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location)); Tr.Load(typeof(MTMkPlugin).Assembly, text); PluginInfo value; BaseUnityPlugin val = (Chainloader.PluginInfos.TryGetValue("mushokutensei.magia", out value) ? value.Instance : null); if ((Object)(object)val != (Object)null) { ConfigMigracion.Mover(val.Config, ((BaseUnityPlugin)this).Config, "Mk-I Armor"); } MkConfig.Enlazar(((BaseUnityPlugin)this).Config); PrefabManager.OnVanillaPrefabsAvailable += ArmaduraMk1.Register; Topes.Mk1Encendida = (Player p) => ArmaduraMk1.Powered && ArmaduraMk1.Worn(p); MkPuente.Puesta = ArmaduraMk1.Worn; MkPuente.Canon = ArmaduraMk1.HoldsCanon; MkPuente.Expulsion = ExpulsionMk.Activa; MkPuente.CanonCalor = Mk1Canon.Nivel; MkPuente.CanonRecalentado = () => Mk1Canon.Recalentado; ((Component)this).gameObject.AddComponent<ArmaduraMk1Ctrl>(); ((Component)this).gameObject.AddComponent<MkToukiRegen>(); CommandManager.Instance.AddConsoleCommand((ConsoleCommand)new AliasCommand("mt_mk1_reload", "Reload the Mk-I model and textures from Models/ without restarting the game", (ConsoleCommand)(object)new Mk1RecargarCommand())); CommandManager.Instance.AddConsoleCommand((ConsoleCommand)(object)new Mk1ReiniciarCommand()); CommandManager.Instance.AddConsoleCommand((ConsoleCommand)(object)new Mk1EscudoModeloCommand()); CommandManager.Instance.AddConsoleCommand((ConsoleCommand)(object)new Mk1CascoCommand()); CommandManager.Instance.AddConsoleCommand((ConsoleCommand)new AliasCommand("mt_mk1_shake", "mt_mk1_shake <step> [fall] — Mk-I camera shake (0 = none; default 0.8 and 0.6)", (ConsoleCommand)(object)new Mk1TemblorCommand())); CommandManager.Instance.AddConsoleCommand((ConsoleCommand)new AliasCommand("mt_mk1_arms", "mt_mk1_arms <degrees> — close (+) or open (−) the Mk-I arms; 0 = as the model", (ConsoleCommand)(object)new Mk1BrazosCommand())); CommandManager.Instance.AddConsoleCommand((ConsoleCommand)new AliasCommand("mt_mk1_cannon", "mt_mk1_cannon <size> [x y z] [rotX rotY rotZ] — Mk-I cannon on the forearm (x: out of the arm, y: to the elbow, z: forward; default 1 0.1 0.05 0 0 0 0)", (ConsoleCommand)(object)new Mk1CanonCommand())); CommandManager.Instance.AddConsoleCommand((ConsoleCommand)new AliasCommand("mt_mk1_shield", "mt_mk1_shield <size> [offset] [flip 0|1] [rotX rotY rotZ] [height] — Mk-I shield in hand (default 1.2 -0.09 1 15 0 0 0)", (ConsoleCommand)(object)new Mk1EscudoCommand())); CommandManager.Instance.AddConsoleCommand((ConsoleCommand)new AliasCommand("mt_mk1_camera", "mt_mk1_camera <factor> — camera height/distance with the Mk-I (1 = as without armor; default 1.45)", (ConsoleCommand)(object)new Mk1CamaraCommand())); Parches.Aplicar("mushokutensei.mk", ((object)this).GetType().Assembly, ((BaseUnityPlugin)this).Logger); ((BaseUnityPlugin)this).Logger.LogInfo((object)"MT Mk 1.1.4 cargado"); } } } namespace MT.Magia { public static class ArmaduraMk1 { public class Modelo { public Mesh Mesh; public Material[] Mats; } public const string PrefabMk2 = "MT_ArmaduraMk2"; 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>[] 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; public const string NombreEscudoMano = "MT_Mk1_escudo_mano"; public const string NombreCanonSoporte = "MT_Mk1_canon_soporte"; private static readonly float[] ManaPorRango = new float[7] { 1f, 0.92f, 0.84f, 0.76f, 0.68f, 0.6f, 0.5f }; private static Dictionary<string, Modelo> _cache; public static string ArchivoEscudo => "escudo2"; 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(); RegistrarArmaduraMk2(); RegistrarEscudo(); RegistrarCanon(); Mk1Canon.EscucharBajas(); ValorObjeto.Fijar("MT_ArmaduraMk1", 2200f); ValorObjeto.Fijar("MT_ArmaduraMk2", 1400f); ValorObjeto.Fijar("MT_EscudoMk1", 1000f); ValorObjeto.Fijar("MT_CanonMk1", 1100f); } 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 //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0116: 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_0123: Unknown result type (might be due to invalid IL or missing references) 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_damageModifiers = new List<DamageModPair>(shared.m_damageModifiers ?? new List<DamageModPair>()) { new DamageModPair { m_type = (DamageType)64, m_modifier = (DamageModifier)5 } }; 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" }, 1.9f); ItemManager.Instance.AddItem(val2); } } private static void RegistrarArmaduraMk2() { //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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Expected O, but got Unknown //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Expected O, but got Unknown //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Expected O, but got Unknown //IL_012c: 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_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_014c: 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_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_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0179: 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_0186: 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_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: 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) if (!((Object)(object)PrefabManager.Instance.GetPrefab("ArmorBronzeChest") == (Object)null)) { ItemConfig val = new ItemConfig(); val.Name = Tr.Token("magia_armadura_mk2"); val.Description = Tr.Token("magia_armadura_mk2_d"); val.Icon = MTMagiaPlugin.Icon("armadura_mk2"); val.CraftingStation = CraftingStations.Forge; val.MinStationLevel = 3; val.Requirements = (RequirementConfig[])(object)new RequirementConfig[4] { new RequirementConfig("MT_ArmaduraMk1", 1, 0, true), new RequirementConfig("BlackMetal", 20, 10, true), new RequirementConfig("Crystal", 10, 5, true), new RequirementConfig("SurtlingCore", 5, 2, true) }; CustomItem val2 = new CustomItem("MT_ArmaduraMk2", "ArmorBronzeChest", val); SharedData shared = val2.ItemDrop.m_itemData.m_shared; shared.m_armor = (MTMagiaPlugin.Mk1Armadura.Value + 28f) * 1.25f; shared.m_armorPerLevel = 4f; shared.m_weight = 60f; shared.m_movementModifier = 0f; shared.m_maxQuality = 3; shared.m_damageModifiers = new List<DamageModPair>(shared.m_damageModifiers ?? new List<DamageModPair>()) { new DamageModPair { m_type = (DamageType)64, m_modifier = (DamageModifier)5 }, new DamageModPair { m_type = (DamageType)32, m_modifier = (DamageModifier)1 }, new DamageModPair { m_type = (DamageType)256, m_modifier = (DamageModifier)1 }, new DamageModPair { m_type = (DamageType)128, m_modifier = (DamageModifier)1 } }; shared.m_useDurability = true; shared.m_canBeReparied = true; shared.m_maxDurability = MTMagiaPlugin.Mk1Durabilidad.Value * 1.5f; shared.m_durabilityPerLevel = MTMagiaPlugin.Mk1Durabilidad.Value * 0.35f; HideVisual(val2.ItemPrefab); EnElSuelo(val2.ItemPrefab, new string[3] { "mk2:casco", "mk2:torso", "mk2:piernas" }, 1.8f); 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_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Expected O, but got Unknown //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Expected O, but got Unknown //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Expected O, but got Unknown //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0149: 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_015f: 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_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_017f: Unknown result type (might be due to invalid IL or missing references) //IL_018c: 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_0199: 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_01af: 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_01bc: 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_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) 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[4] { new RequirementConfig("BlackMetal", 15, 5, true), new RequirementConfig("Iron", 15, 5, true), new RequirementConfig("Crystal", 0, 3, true), new RequirementConfig("SurtlingCore", 0, 1, 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 = 8f; shared.m_deflectionForce = 80f; shared.m_weight = 18f; shared.m_movementModifier = 0f; shared.m_damageModifiers = new List<DamageModPair>(shared.m_damageModifiers ?? new List<DamageModPair>()) { new DamageModPair { m_type = (DamageType)32, m_modifier = (DamageModifier)1 }, new DamageModPair { m_type = (DamageType)64, m_modifier = (DamageModifier)1 }, new DamageModPair { m_type = (DamageType)128, m_modifier = (DamageModifier)1 }, new DamageModPair { m_type = (DamageType)256, m_modifier = (DamageModifier)1 }, new DamageModPair { m_type = (DamageType)512, m_modifier = (DamageModifier)3 } }; shared.m_maxDurability *= 3f; shared.m_durabilityPerLevel *= 3f; 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_006e: 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) //IL_0085: 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_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0119: 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_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_013a: 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_00d0: 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_00b7: 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.BodyDe(piezas[0]); Bounds? val3 = null; foreach (string text in piezas) { Mesh val4 = Mk1Skin.RestingMesh(text, 75f); 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 CanonParaSoporte(GameObject prefab) { //IL_006a: 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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0087: 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_0090: 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_00d5: 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_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_012e: 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_014a: 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_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_016a: 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_017b: 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_0183: 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_0189: 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_0193: 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_0100: 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_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) Transform val = prefab.transform.Find("attach"); Modelo modelo = Piece("canon"); if ((Object)(object)val == (Object)null || (Object)(object)modelo.Mesh == (Object)null) { return; } MeshFilter val2 = null; MeshFilter[] componentsInChildren = ((Component)val).GetComponentsInChildren<MeshFilter>(true); foreach (MeshFilter val3 in componentsInChildren) { if (!((Object)(object)val3.sharedMesh != (Object)null)) { continue; } if (!((Object)(object)val2 == (Object)null)) { Bounds bounds = val3.sharedMesh.bounds; Vector3 size = ((Bounds)(ref bounds)).size; float sqrMagnitude = ((Vector3)(ref size)).sqrMagnitude; bounds = val2.sharedMesh.bounds; size = ((Bounds)(ref bounds)).size; if (!(sqrMagnitude > ((Vector3)(ref size)).sqrMagnitude)) { continue; } } val2 = val3; } Transform val4 = (((Object)(object)val2 != (Object)null) ? ((Component)val2).transform : val); Ejes(modelo.Mesh, out var c, out var ax, out var len); Quaternion val5 = Quaternion.identity; Vector3 c2 = Vector3.zero; if ((Object)(object)val2 != (Object)null) { Ejes(val2.sharedMesh, out c2, out var ax2, out var _); val5 = Quaternion.FromToRotation(ax[0], ax2[0]); } float num = 0.9f / Mathf.Max(0.01f, len[0]) / Mathf.Max(0.0001f, val4.lossyScale.x); GameObject val6 = new GameObject("MT_Mk1_canon_soporte"); val6.transform.SetParent(val4, false); val6.transform.localRotation = val5; val6.transform.localScale = Vector3.one * num; val6.transform.localPosition = c2 - val5 * (c * num); val6.AddComponent<MeshFilter>().sharedMesh = modelo.Mesh; MeshRenderer obj = val6.AddComponent<MeshRenderer>(); ((Renderer)obj).sharedMaterials = modelo.Mats; ((Renderer)obj).enabled = false; } 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_0363: Unknown result type (might be due to invalid IL or missing references) //IL_0368: Unknown result type (might be due to invalid IL or missing references) //IL_037f: Unknown result type (might be due to invalid IL or missing references) //IL_0391: Unknown result type (might be due to invalid IL or missing references) //IL_0397: Unknown result type (might be due to invalid IL or missing references) //IL_0398: Unknown result type (might be due to invalid IL or missing references) //IL_039a: Unknown result type (might be due to invalid IL or missing references) //IL_039e: Unknown result type (might be due to invalid IL or missing references) //IL_03a3: Unknown result type (might be due to invalid IL or missing references) //IL_03a8: 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_03b1: Unknown result type (might be due to invalid IL or missing references) //IL_03b6: Unknown result type (might be due to invalid IL or missing references) //IL_03bb: 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_03c4: 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_03df: 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); Vector3 val8 = ax[0]; float num3 = MTMagiaPlugin.Mk1EscudoManoAltura.Value / Mathf.Max(0.01f, ((Component)val).transform.lossyScale.x); val6.transform.localPosition = c - val5 * (c2 * num) + val7 * num2 + val8 * num3; 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) ? Campos.InstanciaIzquierda.Invoke(component) : 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_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Expected O, but got Unknown //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Expected O, but got Unknown //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: 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_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0149: 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_017b: 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) 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[4] { new RequirementConfig("BlackMetal", 20, 5, true), new RequirementConfig("Iron", 10, 5, true), new RequirementConfig("SurtlingCore", 5, 2, true), new RequirementConfig("Crystal", 0, 3, 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 * 0.5f, m_pierce = MTMagiaPlugin.Mk1DanoBala.Value * 0.5f, m_fire = MTMagiaPlugin.Mk1DanoBala.Value * 0.2f }; shared.m_damagesPerLevel = new DamageTypes { m_blunt = 8f, m_pierce = 8f, m_fire = 3f }; shared.m_attack.m_attackEitr = 0f; shared.m_attackStatusEffect = null; shared.m_secondaryAttack.m_attackEitr = 0f; shared.m_weight = 12f; shared.m_maxQuality = 4; shared.m_useDurability = true; shared.m_canBeReparied = true; shared.m_maxDurability = MTMagiaPlugin.Mk1CanonDurabilidad.Value; shared.m_durabilityPerLevel = MTMagiaPlugin.Mk1CanonDurabilidad.Value * 0.5f; HideVisual(val2.ItemPrefab); CanonEnSuelo(val2.ItemPrefab); CanonParaSoporte(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) { if ((Object)(object)p == (Object)null) { return null; } return (ItemData)(field switch { "m_chestItem" => Campos.Pecho.Invoke((Humanoid)(object)p), "m_rightItem" => Campos.ManoDerecha.Invoke((Humanoid)(object)p), "m_leftItem" => Campos.ManoIzquierda.Invoke((Humanoid)(object)p), _ => Traverse.Create((object)p).Field(field).GetValue<ItemData>(), }); } public static bool Worn(Player p) { return Actual(p) != null; } public static float FactorMana(Player p) { int num = (((Object)(object)p != (Object)null) ? Mathf.Clamp(Escuelas.Rank(p, (Escuela)3), 0, ManaPorRango.Length - 1) : 0); return ManaPorRango[num]; } public static bool WornMk1(Player p) { return Actual(p) == VarianteMk.Mk1; } public static VarianteMk Actual(Player p) { if ((Object)(object)p == (Object)null) { return null; } ItemData it = Slot(p, "m_chestItem"); if (Is(it, "MT_ArmaduraMk1")) { return VarianteMk.Mk1; } if (Is(it, "MT_ArmaduraMk2")) { return VarianteMk.Mk2; } return null; } public static float Mult(Player p, float valorMk1) { return Actual(p)?.Mult(valorMk1) ?? 1f; } public static float Fuerza(Player p) { return Actual(p)?.Fuerza ?? 0f; } public static float Tamano(Player p) { VarianteMk varianteMk = Actual(p); return MTMagiaPlugin.Mk1Tamano.Value * (varianteMk?.Escala ?? 1f); } 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 = MkPuente.Modelo("mk1_" + ((name == "escudo") ? ArchivoEscudo : name) + ".obj"); List<string> list = default(List<string>); Mesh val = ObjModel.Load(text, ref list); 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 = ((name == "escudo") ? Mk1Material.Escudo() : ((name == "canon") ? Mk1Material.Canon() : 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] = (list[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 _escudo = new Conjunto(); private readonly Conjunto _canon = new Conjunto(); private Player _for; 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 static readonly HumanBodyBones[][] BrazoApuntar = new HumanBodyBones[2][] { (HumanBodyBones[])(object)new HumanBodyBones[2] { (HumanBodyBones)14, (HumanBodyBones)16 }, (HumanBodyBones[])(object)new HumanBodyBones[2] { (HumanBodyBones)16, (HumanBodyBones)18 } }; internal static bool Saltando; 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 static readonly MaterialPropertyBlock _mpbCanon = new MaterialPropertyBlock(); private static readonly int IdColor = Shader.PropertyToID("_Color"); private static readonly int IdEmision = Shader.PropertyToID("_EmissionColor"); private Renderer[] _canonRs; private Transform _canonRsDe; private float _calorPuesto = -1f; private Light _luzCalor; private Light _luzNoche; private const float LuzNocheIntensidad = 0.9f; private const float LuzNocheAlcance = 7f; private void OnDisable() { Clear(_escudo); Clear(_canon); RestoreAnimator(); CanonPiece = null; ArmaduraMk1.Powered = false; } private void RestoreAnimator() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_animator != (Object)null && !Montada(Player.m_localPlayer)) { _animator.cullingMode = _originalCulling; } _animator = null; } private void Canon(Player p) { //IL_00a3: 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_00da: 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_00cd: 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_00e4: 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_00ea: 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_00ff: 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_010e: 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_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_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_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0149: 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_0150: 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) _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) { return; } _nextShot = Time.time + MTMagiaPlugin.Mk1Cadencia.Value; if (Mk1Canon.Calor(p)) { 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_003d: 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_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_0206: 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_00fe: 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) GameCamera instance = GameCamera.instance; if (!((Object)(object)instance == (Object)null) && puesta != _camara) { 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>(); VarianteMk varianteMk = ArmaduraMk1.Actual(Player.m_localPlayer); float num = (CamaraAplicada = MTMagiaPlugin.Mk1Camara.Value * (varianteMk?.Escala ?? 1f)); float num2 = 0.55f * num; float num3 = 0.35f * num; val.Field("m_3rdOffset").SetValue((object)new Vector3(_off3.x * num + num2, _off3.y * num + num3, _off3.z)); val.Field("m_3rdCombatOffset").SetValue((object)new Vector3(_offCombate.x * num + num2, _offCombate.y * num + num3, _offCombate.z)); val.Field("m_minDistance").SetValue((object)(_minD * num * 1.25f)); val.Field("m_maxDistance").SetValue((object)(_maxD * num * 1.25f)); float value = val.Field("m_distance").GetValue<float>(); val.Field("m_distance").SetValue((object)Mathf.Max(value * num * 1.25f, _minD * num * 1.25f)); _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 * 1.25f), _minD, _maxD)); _camara = false; } } } private void LateUpdate() { //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_0120: 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_0131: 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_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_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0164: 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) Player localPlayer = Player.m_localPlayer; if (CamaraReaplicar) { CamaraReaplicar = false; Camara(puesta: false); } Camara((Object)(object)localPlayer != (Object)null && !((Character)localPlayer).IsDead() && Montada(localPlayer)); if ((Object)(object)localPlayer != (Object)null && ArmaduraMk1.Powered && ((Character)localPlayer).m_swimSpeed != _nadoPuesto) { VarianteMk varianteMk = ArmaduraMk1.Actual(localPlayer); ((Character)localPlayer).m_swimSpeed = ((Character)localPlayer).m_swimSpeed * ((varianteMk != null && varianteMk.Nado >= 0f) ? varianteMk.Nado : ArmaduraMk1.Mult(localPlayer, 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[][] brazoApuntar = BrazoApuntar; foreach (HumanBodyBones[] array in brazoApuntar) { Transform boneTransform = val.GetBoneTransform(array[0]); Transform boneTransform2 = val.GetBoneTransform(array[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; VisualMk.RehacerTodos(); } if ((Object)(object)localPlayer != (Object)(object)_for) { Clear(_escudo); Clear(_canon); RestoreAnimator(); _for = localPlayer; } bool flag = (Object)(object)localPlayer != (Object)null && !((Character)localPlayer).IsDead(); VarianteMk varianteMk = (flag ? ArmaduraMk1.Actual(localPlayer) : null); bool flag2 = varianteMk != null; if (flag2 && Escuelas.Rank(localPlayer, (Escuela)3) < varianteMk.RangoTierra) { ((Humanoid)localPlayer).UnequipItem(ArmaduraMk1.Slot(localPlayer, "m_chestItem"), true); ((Character)localPlayer).Message((MessageType)2, Tr.Get(varianteMk.ClaveRango), 0, (Sprite)null, false); flag2 = false; } if (flag2 && varianteMk.Diaria && !Mk1Diaria.PuedeEncender(localPlayer)) { ((Humanoid)localPlayer).UnequipItem(ArmaduraMk1.Slot(localPlayer, "m_chestItem"), true); ((Character)localPlayer).Message((MessageType)2, Tr.Get("magia_mk1_cooldown"), 0, (Sprite)null, false); flag2 = false; } if (flag) { ExpulsionMk.Tick(localPlayer, flag2); } if (ArmaduraMk1.Worn(localPlayer) != _canonConArmadura) { _canonConArmadura = ArmaduraMk1.Worn(localPlayer); CanonReaplicar = true; } if (CanonReaplicar) { CanonReaplicar = false; Clear(_canon); } Keep(localPlayer, _canon, flag && ArmaduraMk1.HoldsCanon(localPlayer), ArmaduraMk1.PiezaCanon); EscudoVisible(localPlayer); LuzNocturna(localPlayer, flag2); CanonPiece = (_canon.Built ? _canon.Pieces[0].transform : null); CanonRojo(); Canon(localPlayer); if (!_escudo.Built && !_canon.Built) { RestoreAnimator(); } if (flag) { Pisadas(localPlayer, flag2); } if (!flag2 || !Montada(localPlayer)) { ArmaduraMk1.Powered = false; return; } float num = MTMagiaPlugin.Mk1ManaSegundo.Value * varianteMk.Mana * ArmaduraMk1.FactorMana(localPlayer) * Time.deltaTime; bool powered = ArmaduraMk1.Powered; ArmaduraMk1.Powered = localPlayer.GetEitr() > num + 0.5f; ItemData val = ArmaduraMk1.Slot(localPlayer, "m_chestItem"); if (ArmaduraMk1.Powered && val != null) { if (MTMagiaPlugin.Mk1DesgasteSegundo.Value > 0f) { val.m_durability = Mathf.Max(0f, val.m_durability - MTMagiaPlugin.Mk1DesgasteSegundo.Value * Time.deltaTime); } if (val.m_durability <= 0f) { ArmaduraMk1.Powered = false; VisualMk.De(localPlayer)?.Desmontar(); ((Humanoid)localPlayer).UnequipItem(val, true); ExpulsionMk.AlRomperse(localPlayer); ((Character)localPlayer).Message((MessageType)2, Tr.Get(varianteMk.ClaveRota), 0, (Sprite)null, false); Cronica.AnotarUnaVez(localPlayer, "mk1_rota", "cronica_mk1_broken", Array.Empty<string>()); return; } } if (ArmaduraMk1.Powered) { if (!powered) { Cronica.AnotarUnaVez(localPlayer, "mk1_encendida", "cronica_mk1_powered", Array.Empty<string>()); } ((Character)localPlayer).UseEitr(num); if (((Character)localPlayer).GetHealth() < ((Character)localPlayer).GetMaxHealth()) { ((Character)localPlayer).Heal(MTMagiaPlugin.Mk1RegenVida.Value * varianteMk.Fuerza * Time.deltaTime, false); } } else { ArmaduraMk1.Powered = false; VisualMk.De(localPlayer)?.Desmontar(); ((Humanoid)localPlayer).UnequipItem(ArmaduraMk1.Slot(localPlayer, "m_chestItem"), true); ((Character)localPlayer).Message((MessageType)2, Tr.Get(varianteMk.ClaveSinMana), 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_0196: 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_019d: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: 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_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: 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_016e: 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_020a: 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) 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 && Saltando) { 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; Saltando = false; 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_0041: 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_0044: 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) float num = Mathf.Clamp(aire, 0.5f, 3f); float num2 = 1.8f + num * 0.8f; DamageTypes val = new DamageTypes { m_blunt = MTMagiaPlugin.Mk1DanoCaida.Value * num * ArmaduraMk1.Fuerza(p) }; foreach (Character item in Fx.EnemiesInRadius(p, pos, num2)) { if ((Object)(object)item != (Object)null && !item.IsDead()) { Fx.Damage(p, item, val, (SkillType)9, 25f * num, 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_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_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_0039: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_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_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0079: 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_0091: 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_00a9: 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_00b7: 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: Expected O, but got Unknown Particulas.Spawn(pos + Vector3.up * 0.1f, new 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 }, (Transform)null); } 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_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_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) 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) ? Campos.InstanciaIzquierda.Invoke(component) : 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 = ArmaduraMk1.ColocarEscudo(val, soloVisibles: false, ArmaduraMk1.ConArmadura(p)); MTMagiaPlugin.Log.LogInfo((object)("Mk-I: escudo en la mano sin nuestro modelo; " + (flag2 ? "añadido" : "NO se pudo añadir"))); componentsInChildren = val.GetComponentsInChildren<MeshRenderer>(true); foreach (MeshRenderer val4 in componentsInChildren) { if (((Object)val4).name == "MT_Mk1_escudo_mano") { val2 = val4; } } } if ((Object)(object)val2 != (Object)null) { ((Renderer)val2).enabled = true; ((Component)val2).gameObject.SetActive(true); ManualLogSource log = MTMagiaPlugin.Log; object arg = ((Component)val2).gameObject.activeInHierarchy; Bounds bounds = ((Renderer)val2).bounds; log.LogInfo((object)($"Mk-I: escudo en la mano: activo={arg}, tamaño={((Bounds)(ref bounds)).size}, " + $"escala={((Component)val2).transform.lossyScale}, capa={((Component)val2).gameObject.layer}, padre={((Object)((Component)val2).transform.parent).name}, instancia={((Object)val).name}")); } else { MTMagiaPlugin.Log.LogWarning((object)("Mk-I: el escudo en la mano no tiene dónde poner el modelo (instancia " + ((Object)val).name + ")")); } } private static void Paso(Player p, Vector3 pos, float fuerza) { //IL_0041: 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_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_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_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_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_0099: 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_00af: 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_00c7: 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_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might
plugins/MT.Monstruos/MT.Monstruos.dll
Decompiled a day 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.Bootstrap; using BepInEx.Configuration; using HarmonyLib; using Jotunn.Utils; using MT.Core; using MT.Core.I18n; using MT.Core.Npc; 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.Monstruos")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+f72fd27a1cef3fefa2078e5313c902bbcd510c4b")] [assembly: AssemblyProduct("MT.Monstruos")] [assembly: AssemblyTitle("MT.Monstruos")] [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.Monstruos { [HarmonyPatch(typeof(Character), "RPC_Damage")] public static class AguanteGrupoPatch { private const float Radio = 30f; private static void Prefix(Character __instance, HitData hit) { //IL_0021: 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) if (hit == null || !MonstruosConfig.AguanteGrupo.Value || __instance.IsPlayer() || __instance.IsTamed() || (int)__instance.m_faction == 0 || (Object)(object)Companeros.De(__instance) != (Object)null) { return; } int num = Companeros.Cerca(((Component)__instance).transform.position, 30f); if (num != 0) { float num2 = AguanteGrupoRules.Factor(num, MonstruosConfig.AguantePorCompanero.Value, MonstruosConfig.AguanteTope.Value); if (num2 < 1f) { ((DamageTypes)(ref hit.m_damage)).Modify(num2); } } } } public static class AguanteGrupoRules { public static float Factor(int companeros, float porCompanero, int tope) { int num = Math.Max(0, Math.Min(companeros, Math.Max(0, tope))); float num2 = Math.Max(0f, porCompanero); return 1f / (1f + num2 * (float)num); } } public static class MiniJefeRules { public const int RangoMax = 3; private static readonly int[] NivelPorRango = new int[4] { 1, 2, 3, 3 }; public const int Avisos = 6; public const int Relevos = 3; private static readonly float[] Escala = new float[4] { 1f, 1.4f, 1.7f, 2f }; private static readonly float[] Vida = new float[4] { 1f, 6f, 8f, 10f }; private static readonly float[] Dano = new float[4] { 1f, 1.5f, 2f, 2.5f }; public const float TopeGolpe = 0.35f; private static readonly float[] Velocidad = new float[4] { 1f, 1.15f, 1.3f, 1.45f }; private static readonly float[] VelocidadAtaque = new float[4] { 1f, 1.15f, 1.25f, 1.4f }; public const float FuriaVida = 0.4f; public const float FuriaVelocidad = 1.2f; private static readonly string[] Color = new string[4] { "#FFFFFF", "#6FB8FF", "#C77DFF", "#FFB347" }; public const float BonoVidaPorNivel = 0.3f; public const float BonoDanoPorNivel = 0f; public const float DistanciaMinima = 40f; public const float RelevoMin = 45f; public const float RelevoMax = 60f; public const int ManadaMax = 6; public const float ManadaRadioMin = 3f; public const float ManadaRadioMax = 8f; public static int NivelValheim(int rango) { return NivelPorRango[Rango(rango)]; } public static float VidaEstrellas(int nivel) { return Math.Max(1, nivel); } public static float DanoEstrellas(int nivel) { return 1f + 0.5f * (float)Math.Max(0, nivel - 1); } public static float Nivel(float nivel) { return Math.Max(0f, Math.Min(100f, nivel)); } public static int RangoPorNivel(float nivelJugador) { float num = Nivel(nivelJugador); if (!(num < 35f)) { if (!(num < 70f)) { return 3; } return 2; } return 1; } public static int Rango(int r) { return Math.Max(1, Math.Min(3, r)); } public static bool PuedeSer(bool jefe, bool domado, bool jugador) { if (!jefe && !domado) { return !jugador; } return false; } public static bool PermitidoAqui(float distanciaJugador, int miniJefesEnRadio) { if (distanciaJugador >= 40f) { return miniJefesEnRadio == 0; } return false; } public static bool Tirada(float tirada, float probabilidad) { return tirada < Math.Max(0f, Math.Min(1f, probabilidad)); } public static float FactorEscala(int rango) { return Escala[Rango(rango)]; } public static float FactorVida(int rango, float nivelJugador) { return Vida[Rango(rango)] * (1f + 0.3f * Nivel(nivelJugador) / 100f); } public static float FactorDano(int rango, float nivelJugador) { return Dano[Rango(rango)] * (1f + 0f * Nivel(nivelJugador) / 100f); } public static float ExtraVida(int rango, int nivel, float nivelJugador) { return FactorVida(rango, nivelJugador) / VidaEstrellas(nivel); } public static float ExtraDano(int rango, int nivel, float nivelJugador) { return Math.Max(1f, FactorDano(rango, nivelJugador) / DanoEstrellas(nivel)); } public static float DanoConTope(float danoBase, float danoMultiplicado, float vidaMaxVictima) { if (vidaMaxVictima <= 0f) { return danoMultiplicado; } return Math.Max(danoBase, Math.Min(danoMultiplicado, 0.35f * vidaMaxVictima)); } public static float FactorVelocidad(int rango) { return Velocidad[Rango(rango)]; } public static float FactorAtaque(int rango, bool furia) { return VelocidadAtaque[Rango(rango)] * (furia ? 1.2f : 1f); } public static bool Furia(float vida, float vidaMax) { if (vidaMax > 0f) { return vida / vidaMax < 0.4f; } return false; } public static string ColorRango(int rango) { return Color[Rango(rango)]; } public static int BotinExtra(int rango) { return Rango(rango); } public static bool Relevo(int generacion, int maxRelevos, float tirada, float probabilidad) { if (generacion < Math.Max(0, Math.Min(2, maxRelevos))) { return Tirada(tirada, probabilidad); } return false; } public static int TamanoManada(int rango, int extra) { return Math.Max(0, Math.Min(6, Rango(rango) + 1 + extra)); } public static int RangoRelevo(int rango) { return Rango(rango + 1); } } [DefaultExecutionOrder(10000)] public class MiniJefe : MonoBehaviour { public const string ZDecidido = "mt_mj_dec"; public const string ZRango = "mt_mj_rango"; public const string ZNivel = "mt_mj_nivel"; public const string ZGen = "mt_mj_gen"; public const string ZVida = "mt_mj_vida"; public const string ZSubdito = "mt_mj_subdito"; public const string ZNivelJugador = "mt_nivel_poder"; public const float RadioNivel = 120f; private static readonly Dictionary<Character, MiniJefe> Vivos = new Dictionary<Character, MiniJefe>(); public int Rango; public float NivelJugador; public int Generacion; private Character _c; private bool _muerto; private float _escala = 1f; private Vector3 _puesta; private float _vel = 1f; private float _walk; private float _run; private float _speed; private float _animPuesta = -1f; private float _animBase = 1f; private float _sigFuria; private bool _furia; private Animator _anim; private string _nombreBase; private string _nombre; public int Nivel { get { if (!((Object)(object)_c != (Object)null)) { return 1; } return _c.GetLevel(); } } private void AplicarEscala() { //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_006d: 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_0041: 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_0055: 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_0061: Unknown result type (might be due to invalid IL or missing references) if (_puesta == Vector3.zero) { GameObject val = (((Object)(object)ZNetScene.instance != (Object)null) ? ZNetScene.instance.GetPrefab(Utils.GetPrefabName(((Component)this).gameObject)) : null); Vector3 val2 = (((Object)(object)val != (Object)null) ? val.transform.localScale : Vector3.one); _puesta = val2 * _escala; } ((Component)this).transform.localScale = _puesta; } private void LateUpdate() { //IL_0006: 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) if (((Component)this).transform.localScale != _puesta) { AplicarEscala(); } } private void PonerVelocidad(float k) { _c.m_walkSpeed = _walk * k; _c.m_runSpeed = _run * k; _c.m_speed = _speed * k; } private void Update() { if ((Object)(object)_c == (Object)null) { return; } if (Time.time >= _sigFuria) { _sigFuria = Time.time + 0.5f; bool flag = MiniJefeRules.Furia(_c.GetHealth(), _c.GetMaxHealth()); if (flag != _furia) { _furia = flag; PonerVelocidad(_vel * (flag ? 1.2f : 1f)); if ((Object)(object)_anim != (Object)null && _animBase > 0f) { _animPuesta = _animBase * MiniJefeRules.FactorAtaque(Rango, _furia); _anim.speed = _animPuesta; } } } if ((Object)(object)_anim == (Object)null || _c.IsDead()) { return; } float speed = _anim.speed; if (!(_animPuesta >= 0f) || !Mathf.Approximately(speed, _animPuesta)) { if (_animPuesta < 0f || !Mathf.Approximately(speed, _animPuesta)) { _animBase = speed; } if (_animBase <= 0f) { _animPuesta = speed; return; } _animPuesta = _animBase * MiniJefeRules.FactorAtaque(Rango, _furia); _anim.speed = _animPuesta; } } private void Inteligencia() { BaseAI component = ((Component)this).GetComponent<BaseAI>(); if (!((Object)(object)component == (Object)null)) { Traverse t = Traverse.Create((object)component); Mult(t, "m_viewRange", 1.6f); Mult(t, "m_hearRange", 1.6f); Poner(t, "m_viewAngle", 150f); Poner(t, "m_afraidOfFire", valor: false); Poner(t, "m_avoidFire", valor: false); if (component is MonsterAI) { Poner(t, "m_fleeIfLowHealth", 0f); Poner(t, "m_fleeIfNotAlerted", valor: false); Poner(t, "m_fleeIfHurtWhenTargetCantBeReached", valor: false); Poner(t, "m_enableHuntPlayer", valor: true); Poner(t, "m_circulateWhileCharging", valor: true); Mult(t, "m_maxChaseDistance", 2f); Poner(t, "m_attackPlayerObjects", valor: true); } } } private static void Poner<T>(Traverse t, string campo, T valor) { Traverse val = t.Field(campo); if (val.FieldExists()) { val.SetValue((object)valor); } } private static void Mult(Traverse t, string campo, float k) { Traverse val = t.Field(campo); if (val.FieldExists() && val.GetValueType() == typeof(float)) { val.SetValue((object)(val.GetValue<float>() * k)); } } public static MiniJefe De(Character c) { if (!((Object)(object)c != (Object)null) || !Vivos.TryGetValue(c, out var value)) { return null; } return value; } public static void Vigilar(Character c) { if (!((Object)(object)c == (Object)null) && !c.IsPlayer() && !((Object)(object)((Component)c).GetComponent<MiniJefe>() != (Object)null)) { ((Component)c).gameObject.AddComponent<MiniJefe>(); } } private void Start() { _c = ((Component)this).GetComponent<Character>(); ZNetView component = ((Component)this).GetComponent<ZNetView>(); ZDO val = (((Object)(object)component != (Object)null) ? component.GetZDO() : null); if ((Object)(object)_c == (Object)null || val == null) { Object.Destroy((Object)(object)this); return; } if (component.IsOwner() && !val.GetBool("mt_mj_dec", false)) { Decidir(val); } Rango = val.GetInt("mt_mj_rango", 0); if (Rango <= 0) { Object.Destroy((Object)(object)this); return; } if (NuncaJefe()) { Object.Destroy((Object)(object)this); return; } NivelJugador = val.GetFloat("mt_mj_nivel", 0f); Generacion = val.GetInt("mt_mj_gen", 0); _escala = MiniJefeRules.FactorEscala(Rango); AplicarEscala(); _vel = MiniJefeRules.FactorVelocidad(Rango); _walk = _c.m_walkSpeed; _run = _c.m_runSpeed; _speed = _c.m_speed; PonerVelocidad(_vel); Character c = _c; c.m_turnSpeed *= _vel; Character c2 = _c; c2.m_runTurnSpeed *= _vel; _anim = ((Component)this).GetComponentInChildren<Animator>(); Inteligencia(); Vivos[_c] = this; if (component.IsOwner()) { float num = val.GetFloat("mt_mj_vida", 0f); if (num <= 0f) { num = _c.GetMaxHealth() * MiniJefeRules.ExtraVida(Rango, _c.GetLevel(), NivelJugador); val.Set("mt_mj_vida", num); _c.SetMaxHealth(num); _c.SetHealth(num); } else { _c.SetMaxHealth(num); } } } private void OnDestroy() { if (_c != null) { Vivos.Remove(_c); } } public string NombreCacheado(string baseName) { if (_nombre == null || baseName != _nombreBase) { _nombreBase = baseName; _nombre = Nombre(baseName, Rango); } return _nombre; } private bool NuncaJefe() { if (!MonstruosConfig.Excluida(Utils.GetPrefabName(((Component)this).gameObject))) { return Presas.Inofensivo(_c); } return true; } private void Decidir(ZDO zdo) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: 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) zdo.Set("mt_mj_dec", true); if (MonstruosConfig.Activo.Value && MiniJefeRules.PuedeSer(_c.IsBoss(), _c.IsTamed(), _c.IsPlayer()) && (int)_c.m_faction != 0 && !_c.m_flying && !_c.InInterior() && !NuncaJefe() && MiniJefeRules.Tirada(Random.value, MonstruosConfig.Probabilidad.Value) && MiniJefeRules.PermitidoAqui(DistanciaJugador(((Component)this).transform.position), EnRadio(((Component)this).transform.position, MonstruosConfig.Radio.Value))) { float num = NivelJugadorCerca(((Component)this).transform.position); int num2 = MiniJefeRules.RangoPorNivel(num); _c.SetLevel(MiniJefeRules.NivelValheim(num2)); zdo.Set("mt_mj_rango", num2); zdo.Set("mt_mj_nivel", num); zdo.Set("mt_mj_gen", 0); Manada(((Component)this).gameObject, num2); Avisar("mj_aparece", 6, _c, num2); } } public static float NivelJugadorCerca(Vector3 pos) { //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) float num = 0f; foreach (Player allPlayer in Player.GetAllPlayers()) { if (!((Object)(object)allPlayer == (Object)null) && !(Vector3.Distance(((Component)allPlayer).transform.position, pos) > 120f)) { ZNetView component = ((Component)allPlayer).GetComponent<ZNetView>(); ZDO val = (((Object)(object)component != (Object)null) ? component.GetZDO() : null); num = Mathf.Max(num, (val != null) ? val.GetFloat("mt_nivel_poder", 0f) : 0f); if ((Object)(object)allPlayer == (Object)(object)Player.m_localPlayer) { num = Mathf.Max(num, NivelPropio(allPlayer)); } } } return MiniJefeRules.Nivel(num); } public static float NivelPropio(Player p) { //IL_0006: 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_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) float num = 0f; if ((int)MTSkills.Dominio != 0) { num = Mathf.Max(num, ((Character)p).GetSkillLevel(MTSkills.Dominio)); } if ((int)MTSkills.Reserva != 0) { num = Mathf.Max(num, ((Character)p).GetSkillLevel(MTSkills.Reserva)); } return num; } private static void Manada(GameObject jefe, int rango) { //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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: 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_00ad: 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_0102: Unknown result type (might be due to invalid IL or missing references) if (!MonstruosConfig.Manada.Value || (Object)(object)ZNetScene.instance == (Object)null) { return; } GameObject prefab = ZNetScene.instance.GetPrefab(Utils.GetPrefabName(jefe)); if ((Object)(object)prefab == (Object)null) { return; } int num = MiniJefeRules.TamanoManada(rango, MonstruosConfig.ManadaExtra.Value); float num2 = default(float); for (int i = 0; i < num; i++) { Vector2 insideUnitCircle = Random.insideUnitCircle; Vector2 val = ((Vector2)(ref insideUnitCircle)).normalized * Random.Range(3f, 8f); Vector3 val2 = jefe.transform.position + new Vector3(val.x, 0f, val.y); if (!((Object)(object)ZoneSystem.instance == (Object)null) && ZoneSystem.instance.GetSolidHeight(val2, ref num2, 1000) && !(num2 < ZoneSystem.instance.m_waterLevel + 0.3f)) { val2.y = num2 + 0.3f; GameObject obj = Object.Instantiate<GameObject>(prefab, val2, Quaternion.Euler(0f, Random.Range(0f, 360f), 0f)); ZNetView component = obj.GetComponent<ZNetView>(); ZDO val3 = (((Object)(object)component != (Object)null) ? component.GetZDO() : null); if (val3 != null) { val3.Set("mt_mj_dec", true); val3.Set("mt_mj_subdito", true); } Character component2 = obj.GetComponent<Character>(); if ((Object)(object)component2 != (Object)null) { component2.SetLevel(Random.Range(1, 3)); } } } } public static float DistanciaJugador(Vector3 pos) { //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_0031: 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) float num = float.MaxValue; foreach (Player allPlayer in Player.GetAllPlayers()) { if ((Object)(object)allPlayer != (Object)null) { float num2 = num; Vector3 val = ((Component)allPlayer).transform.position - pos; num = Mathf.Min(num2, ((Vector3)(ref val)).sqrMagnitude); } } return Mathf.Sqrt(num); } public static int EnRadio(Vector3 pos, float radio) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) int num = 0; float num2 = radio * radio; foreach (KeyValuePair<Character, MiniJefe> vivo in Vivos) { if ((Object)(object)vivo.Key != (Object)null && !vivo.Key.IsDead()) { Vector3 val = ((Component)vivo.Key).transform.position - pos; if (((Vector3)(ref val)).sqrMagnitude <= num2) { num++; } } } return num; } private static bool PuntoRelevo(Vector3 cerca, out Vector3 punto) { //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_001f: 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_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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_0048: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: 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_00c7: 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_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_00ec: 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_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) punto = cerca; Player localPlayer = Player.m_localPlayer; Vector3 val = (((Object)(object)localPlayer != (Object)null) ? ((Component)localPlayer).transform.position : cerca); Vector3 val2 = -(((Object)(object)GameCamera.instance != (Object)null) ? ((Component)GameCamera.instance).transform.forward : (((Object)(object)localPlayer != (Object)null) ? ((Component)localPlayer).transform.forward : Vector3.forward)); val2.y = 0f; if (((Vector3)(ref val2)).sqrMagnitude < 0.01f) { val2 = Vector3.back; } ((Vector3)(ref val2)).Normalize(); float num3 = default(float); for (int i = 0; i < 10; i++) { float num = Random.Range(-70f, 70f); float num2 = Random.Range(45f, 60f); Vector3 val3 = val + Quaternion.Euler(0f, num, 0f) * val2 * num2; if (!((Object)(object)ZoneSystem.instance == (Object)null) && ZoneSystem.instance.GetSolidHeight(val3, ref num3, 1000) && !(num3 < ZoneSystem.instance.m_waterLevel + 0.5f)) { val3.y = num3 + 0.5f; if (!(DistanciaJugador(val3) < 40f)) { punto = val3; return true; } } } return false; } public static string Nombre(string baseName, int rango) { return "<color=" + MiniJefeRules.ColorRango(rango) + ">" + Tr.Get("mj_nombre_" + MiniJefeRules.Rango(rango), new object[1] { baseName }) + "</color>"; } private static void Avisar(string prefijo, int frases, Character c, int rango) { //IL_0022: 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) Player localPlayer = Player.m_localPlayer; if (!((Object)(object)localPlayer == (Object)null) && !((Object)(object)MessageHud.instance == (Object)null) && !(Vector3.Distance(((Component)localPlayer).transform.position, ((Component)c).transform.position) > 80f)) { MessageHud.instance.ShowMessage((MessageType)2, Tr.Get(prefijo + "_" + Random.Range(1, frases + 1), new object[1] { Nombre(Tr.Localize(c.m_name), rango) }), 0, (Sprite)null, false, true); } } public void AlMorir() { //IL_0084: 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_0118: Unknown result type (might be due to invalid IL or missing references) if (_muerto) { return; } _muerto = true; ZNetView component = ((Component)this).GetComponent<ZNetView>(); if ((Object)(object)component == (Object)null || !component.IsOwner() || !MiniJefeRules.Relevo(Generacion, MonstruosConfig.MaxRelevos.Value, Random.value, MonstruosConfig.ProbabilidadRelevo.Value) || (Object)(object)ZNetScene.instance == (Object)null) { return; } GameObject prefab = ZNetScene.instance.GetPrefab(Utils.GetPrefabName(((Component)this).gameObject)); if (!((Object)(object)prefab == (Object)null) && PuntoRelevo(((Component)this).transform.position, out var punto)) { GameObject val = Object.Instantiate<GameObject>(prefab, punto, Quaternion.identity); Character component2 = val.GetComponent<Character>(); ZDO val2 = (((Object)(object)val.GetComponent<ZNetView>() != (Object)null) ? val.GetComponent<ZNetView>().GetZDO() : null); if (!((Object)(object)component2 == (Object)null) && val2 != null) { int num = MiniJefeRules.RangoRelevo(Rango); component2.SetLevel(MiniJefeRules.NivelValheim(num)); val2.Set("mt_mj_dec", true); val2.Set("mt_mj_rango", num); val2.Set("mt_mj_nivel", Mathf.Max(NivelJugador, NivelJugadorCerca(punto))); val2.Set("mt_mj_gen", Generacion + 1); Vigilar(component2); Manada(val, num); Avisar("mj_relevo", 3, component2, num); } } } } public class NivelPoderPublicador : MonoBehaviour { private float _siguiente; private void Update() { if (Time.time < _siguiente) { return; } _siguiente = Time.time + 5f; Player localPlayer = Player.m_localPlayer; ZNetView val = (((Object)(object)localPlayer != (Object)null) ? ((Component)localPlayer).GetComponent<ZNetView>() : null); ZDO val2 = (((Object)(object)val != (Object)null && val.IsOwner()) ? val.GetZDO() : null); if (val2 != null) { float num = Mathf.Floor(MiniJefe.NivelPropio(localPlayer)); if (!Mathf.Approximately(val2.GetFloat("mt_nivel_poder", -1f), num)) { val2.Set("mt_nivel_poder", num); } } } } [HarmonyPatch(typeof(Character), "Awake")] internal static class MiniJefeAwake { private static void Postfix(Character __instance) { MiniJefe.Vigilar(__instance); } } [HarmonyPatch(typeof(Character), "Damage")] internal static class MiniJefeDano { private static void Prefix(Character __instance, HitData hit) { if (hit == null) { return; } MiniJefe miniJefe = MiniJefe.De(hit.GetAttacker()); if ((Object)(object)miniJefe == (Object)null) { return; } float totalDamage = hit.GetTotalDamage(); hit.ApplyModifier(MiniJefeRules.ExtraDano(miniJefe.Rango, miniJefe.Nivel, miniJefe.NivelJugador)); Player val = (Player)(object)((__instance is Player) ? __instance : null); if (val != null && totalDamage > 0f) { float totalDamage2 = hit.GetTotalDamage(); float num = MiniJefeRules.DanoConTope(totalDamage, totalDamage2, ((Character)val).GetMaxHealth()); if (num < totalDamage2) { ((DamageTypes)(ref hit.m_damage)).Modify(num / totalDamage2); } } } } [HarmonyPatch(typeof(Character), "GetHoverName")] internal static class MiniJefeNombre { private static void Postfix(Character __instance, ref string __result) { MiniJefe miniJefe = MiniJefe.De(__instance); if ((Object)(object)miniJefe != (Object)null) { __result = miniJefe.NombreCacheado(__result); } } } [HarmonyPatch(typeof(Character), "OnDeath")] internal static class MiniJefeMuerte { private static void Prefix(Character __instance) { MiniJefe miniJefe = MiniJefe.De(__instance); if ((Object)(object)miniJefe != (Object)null) { miniJefe.AlMorir(); } } } [HarmonyPatch(typeof(CharacterDrop), "GenerateDropList")] internal static class MiniJefeBotin { private static void Postfix(CharacterDrop __instance, List<KeyValuePair<GameObject, int>> __result) { if (__result == null) { return; } MiniJefe miniJefe = MiniJefe.De(((Component)__instance).GetComponent<Character>()); if (!((Object)(object)miniJefe == (Object)null)) { int num = MiniJefeRules.BotinExtra(miniJefe.Rango); for (int i = 0; i < __result.Count; i++) { __result[i] = new KeyValuePair<GameObject, int>(__result[i].Key, __result[i].Value * (1 + num)); } } } } public static class MonstruosConfig { public static ConfigEntry<bool> Activo; public static ConfigEntry<bool> Manada; public static ConfigEntry<bool> AguanteGrupo; public static ConfigEntry<float> AguantePorCompanero; public static ConfigEntry<int> AguanteTope; public static ConfigEntry<float> Probabilidad; public static ConfigEntry<float> ProbabilidadRelevo; public static ConfigEntry<float> Radio; public static ConfigEntry<int> MaxRelevos; public static ConfigEntry<int> ManadaExtra; public static ConfigEntry<string> Excluidas; private static HashSet<string> _excluidas = new HashSet<string>(StringComparer.OrdinalIgnoreCase); public const string Seccion = "Mini Bosses"; private static readonly string[] PrefijosFijos = new string[1] { "Dverger" }; private static ConfigDescription Admin(string texto, AcceptableValueBase rango = null) { //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_0017: Expected O, but got Unknown //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown return new ConfigDescription(texto, rango, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } }); } public static void Bind(ConfigFile cfg) { Activo = cfg.Bind<bool>("Mini Bosses", "Enabled", true, Admin("A creature that spawns away from players can become a mini boss (max stars, bigger, more health and damage, scaled to the tōki/mana level of the strongest player nearby). Never right in front of you.")); Probabilidad = cfg.Bind<float>("Mini Bosses", "Chance", 0.15f, Admin("Chance that a spawning creature becomes a mini boss (0.15 = 15 %), if there is no other mini boss in Radius.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f))); Radio = cfg.Bind<float>("Mini Bosses", "Radius", 100f, Admin("Only one mini boss alive within this many meters.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(20f, 500f))); ProbabilidadRelevo = cfg.Bind<float>("Mini Bosses", "ReplacementChance", 0.4f, Admin("When a mini boss dies, chance that another one (one rank higher) comes.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f))); Manada = cfg.Bind<bool>("Mini Bosses", "Pack", true, Admin("Mini bosses come with a pack of their own kind (Elite 2, Champion 3, Lord 4).")); ManadaExtra = cfg.Bind<int>("Mini Bosses", "PackExtra", 0, Admin("Extra pack members (negative = fewer). Max 6 in total.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(-4, 4))); MaxRelevos = cfg.Bind<int>("Mini Bosses", "MaxReplacements", 2, Admin("How many mini bosses can come one after another after the first one dies.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 2))); Excluidas = cfg.Bind<string>("Mini Bosses", "Excluded", "Seagal,Crow,Chicken,Hen,Hare,Fish1,Fish2,Fish3,Leech,Bat", Admin("Creature prefabs (comma separated) that never become mini bosses. Flying creatures, tamed ones, companions, dungeon creatures and Dvergr are always excluded.")); AguanteGrupo = cfg.Bind<bool>("Party Toughness", "Enabled", true, Admin("Wild creatures get tougher when NPC companions are nearby (Valheim already does this for players, not for companions).")); AguantePorCompanero = cfg.Bind<float>("Party Toughness", "PerCompanion", 0.5f, Admin("Each companion within 30 m counts as this much of an extra player: damage taken is divided by (1 + this × companions). 0.5 = half a player.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 2f))); AguanteTope = cfg.Bind<int>("Party Toughness", "MaxCompanions", 5, Admin("Most companions counted.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10))); Leer(); Excluidas.SettingChanged += delegate { Leer(); }; } private static void Leer() { HashSet<string> hashSet = new HashSet<string>(StringComparer.OrdinalIgnoreCase); string[] array = (Excluidas.Value ?? "").Split(','); foreach (string text in array) { if (text.Trim().Length > 0) { hashSet.Add(text.Trim()); } } _excluidas = hashSet; } public static bool Excluida(string prefab) { if (prefab == null) { return false; } for (int i = 0; i < PrefijosFijos.Length; i++) { if (prefab.StartsWith(PrefijosFijos[i], StringComparison.OrdinalIgnoreCase)) { return true; } } return _excluidas.Contains(prefab); } } [BepInPlugin("mushokutensei.monstruos", "MT Monstruos", "1.1.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency("mushokutensei.core", "2.99.26")] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] public sealed class MTMonstruosPlugin : BaseUnityPlugin { public const string Guid = "mushokutensei.monstruos"; public const string Version = "1.1.0"; private void Awake() { Tr.Load(typeof(MTMonstruosPlugin).Assembly, Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location)); if (Chainloader.PluginInfos.TryGetValue("mushokutensei.core", out var value) && (Object)(object)value.Instance != (Object)null) { ConfigMigracion.Mover(value.Instance.Config, ((BaseUnityPlugin)this).Config, "Mini Bosses"); } MonstruosConfig.Bind(((BaseUnityPlugin)this).Config); ((Component)this).gameObject.AddComponent<NivelPoderPublicador>(); Parches.Aplicar("mushokutensei.monstruos", typeof(MTMonstruosPlugin).Assembly, ((BaseUnityPlugin)this).Logger); ((BaseUnityPlugin)this).Logger.LogInfo((object)"MT Monstruos 1.1.0 cargado"); } } }
plugins/MT.Ojos/MT.Ojos.dll
Decompiled a day 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; using MT.Core.Diario; using MT.Core.Economia; 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.Ojos")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+f72fd27a1cef3fefa2078e5313c902bbcd510c4b")] [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); } } internal static class ConfigNombres { public static readonly string[] Tabla = new string[132] { "Prevision", "Adelanto", "Foresight", "Lead", "Prevision", "VelocidadSilueta", "Foresight", "SilhouetteSpeed", "Prevision", "OpacidadFantasmaTenue", "Foresight", "FaintGhostOpacity", "Prevision", "ColorSilueta", "Foresight", "SilhouetteColor", "Prevision", "MaxSiluetas", "Foresight", "MaxSilhouettes", "Prevision", "MarcaSueloArea", "Foresight", "AreaGroundMark", "Prevision", "ManaPorGolpe", "Foresight", "ManaPerHit", "Prevision", "DistanciaObjetivo", "Foresight", "TargetDistance", "Prevision", "DistanciaCerca", "Foresight", "NearDistance", "VistaLejana", "Aumento", "Far Sight", "Zoom", "VistaLejana", "AumentoMaximo", "Far Sight", "MaxZoom", "VistaLejana", "ManaPorSegundo", "Far Sight", "ManaPerSecond", "VistaLejana", "VelocidadAlMirar", "Far Sight", "LookSpeed", "VistaLejana", "AumentoArco", "Far Sight", "BowZoom", "VistaLejana", "Telemetro", "Far Sight", "Rangefinder", "Visual", "ColorPrevision", "Visual", "ForesightColor", "Visual", "ColorVistaLejana", "Visual", "FarSightColor", "Visual", "ColorIdentificacion", "Visual", "IdentificationColor", "Visual", "LlamasOjos", "Visual", "EyeFlames", "Visual", "TamanoBrillo", "Visual", "GlowSize", "Identificacion", "Altura", "Identification", "Height", "Identificacion", "Distancia", "Identification", "Distance", "Prevision", "VelocidadEnemigoAtacandoV2", "Foresight", "EnemyAttackingSpeedV2", "Prevision", "VelocidadJefeMenorAtacando", "Foresight", "MinibossAttackingSpeed", "Prevision", "VelocidadJefeAtacandoV2", "Foresight", "BossAttackingSpeedV2", "Prevision", "ManaPorRalentizar", "Foresight", "ManaPerSlow", "Desgaste", "Durabilidad", "Wear", "Durability", "Desgaste", "IdentificacionPorSegundoV2", "Wear", "IdentificationPerSecondV2", "Desgaste", "VistaLejanaPorSegundoV2", "Wear", "FarSightPerSecondV2", "Desgaste", "PrevisionPorGolpeV2", "Wear", "ForesightPerHitV2", "Desgaste", "SoloLlevarloPorSegundoV2", "Wear", "JustWearingPerSecondV2", "Botin", "Multiplicador", "Loot", "Multiplier", "Teclas", "VistaLejana", "Keys", "FarSight" }; } 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_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02af: 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"; Component[] componentsInChildren; for (int i = 0; i < 3; i++) { 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); } continue; } try { Object.DestroyImmediate((Object)(object)val2); } catch (Exception ex) { AvisoUnaVez.Log("Fantasma:92", ex); } } } componentsInChildren = val.GetComponentsInChildren<Component>(true); foreach (Component val3 in componentsInChildren) { if ((Object)(object)val3 == (Object)null || EsConservado(val3)) { continue; } Collider val4 = (Collider)(object)((val3 is Collider) ? val3 : null); if (val4 != null) { val4.enabled = false; val4.isTrigger = true; continue; } Rigidbody val5 = (Rigidbody)(object)((val3 is Rigidbody) ? val3 : null); if (val5 != null) { val5.isKinematic = true; val5.detectCollisions = false; continue; } AudioSource val6 = (AudioSource)(object)((val3 is AudioSource) ? val3 : null); if (val6 != null) { val6.mute = true; ((Behaviour)val6).enabled = false; continue; } Light val7 = (Light)(object)((val3 is Light) ? val3 : null); if (val7 != null) { ((Behaviour)val7).enabled = false; continue; } Behaviour val8 = (Behaviour)(object)((val3 is Behaviour) ? val3 : null); if (val8 != null) { val8.enabled = false; } } Material val9 = Transparente.Nuevo(Color.clear); if ((Object)(object)val9 == (Object)null) { Object.Destroy((Object)(object)val); return null; } int num = 0; Renderer[] componentsInChildren2 = val.GetComponentsInChildren<Renderer>(true); foreach (Renderer val10 in componentsInChildren2) { if (!(val10 is ParticleSystemRenderer)) { val10.shadowCastingMode = (ShadowCastingMode)0; val10.receiveShadows = false; Material[] array = (Material[])(object)new Material[val10.sharedMaterials.Length]; for (int k = 0; k < array.Length; k++) { array[k] = val9; } val10.sharedMaterials = array; SkinnedMeshRenderer val11 = (SkinnedMeshRenderer)(object)((val10 is SkinnedMeshRenderer) ? val10 : null); if (val11 != null) { val11.updateWhenOffscreen = true; } num++; } } if (num == 0) { Object.Destroy((Object)(object)val); Object.Destroy((Object)(object)val9); return null; } Animator component = val.GetComponent<Animator>(); component.applyRootMotion = false; component.fireEvents = false; component.cullingMode = (AnimatorCullingMode)0; GameObject val12 = new GameObject("MT_Fantasma_" + key); val12.SetActive(false); Fantasma fantasma = val12.AddComponent<Fantasma>(); fantasma._key = key; fantasma._mat = val9; fantasma._anim = component; fantasma._copia = val.transform; val.transform.SetParent(val12.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_0030: 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; Transparente.Tinte(_mat, 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_008c: 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; Transparente.Tinte(_mat, 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 RaycastHit[] _golpes = (RaycastHit[])(object)new RaycastHit[64]; private static readonly Color Violeta = new Color(0.72f, 0.45f, 1f); private GUIStyle _halo; private float _desdeObjetivo; private Component _ultimo; private readonly List<string> _lineas = new List<string>(); private string _nombre; 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_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) 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" }); } int num = Physics.SphereCastNonAlloc(val.position, 0.25f, val.forward, _golpes, MTOjosPlugin.IdentDistancia.Value * (VistaLejana.Mirando ? 3f : 1f), _mask); Component result = null; float num2 = float.MaxValue; float num3 = float.MaxValue; for (int i = 0; i < num; i++) { RaycastHit val2 = _golpes[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) { num3 = Mathf.Min(num3, ((RaycastHit)(ref val2)).distance); } } else if (Valido(componentInParent) && ((RaycastHit)(ref val2)).distance < num2) { num2 = ((RaycastHit)(ref val2)).distance; result = componentInParent; } } if (!(num2 < num3)) { return null; } return result; } private static Font Norse() { return Fuentes.Norse(); } private void LateUpdate() { Circulo.Actualizar(null, 0f); } private void OnGUI() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Invalid comparison between Unknown and I4 //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_007e: 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_0091: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_00bc: 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_00d7: Expected O, but got Unknown //IL_00e2: 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_024d: 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) ((MonoBehaviour)this).useGUILayout = false; if ((int)Event.current.type != 7 || !Valido(_objetivo) || (Object)(object)Player.m_localPlayer == (Object)null || ((Character)Player.m_localPlayer).IsDead() || Hud.IsUserHidden() || !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)_objetivo != (Object)(object)_ultimo) { _ultimo = _objetivo; _desdeObjetivo = Time.time; _nombre = Nombre(_objetivo); _siguienteDatos = 0f; } bool num = Time.time >= _siguienteDatos; if (num) { _siguienteDatos = Time.time + 0.25f; _lecturas = Lecturas(_objetivo).ToArray(); } float num2 = Mathf.Clamp((float)Screen.height / 900f, 0.8f, 1.6f); GUIStyle estilo2 = _estilo; GUIStyle sombra2 = _sombra; int num3 = (_halo.fontSize = Mathf.RoundToInt((((Object)(object)Norse() != (Object)null) ? 19f : 16f) * num2 / 2f) * 2); int fontSize = (sombra2.fontSize = num3); estilo2.fontSize = fontSize; List<string> lineas = _lineas; if (num || lineas.Count == 0) { float num6 = Vector3.Distance(((Component)Player.m_localPlayer).transform.position, _objetivo.transform.position); lineas.Clear(); if (!string.IsNullOrEmpty(_nombre)) { lineas.Add("<color=#FFC857>" + _nombre + "</color>"); } lineas.Add("<color=#FFE49B>" + Principal(_objetivo) + "</color>"); lineas.Add($"<color=#9CE8F1>{num6:0} m</color>"); lineas.AddRange(_lecturas); } float num7 = 22f * num2; float num8 = 40f * num2; float num9 = (float)Screen.height * 0.2f; float num10 = Time.time - _desdeObjetivo; for (int i = 0; i < lineas.Count; i++) { float num11 = Mathf.Clamp01((num10 - (float)i * 0.06f) / 0.2f) * _alfa; if (!(num11 <= 0f)) { float num12 = (1f - num11) * -12f * num2; Linea(lineas[i], num8 + num12, num9 + (float)i * num7, num7, num11, i, num2); } } } 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)Texturas.Punto()); 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 Nombre(Component objetivo) { string text = null; try { Component obj = ((objetivo is Hoverable) ? objetivo : null); text = ((obj != null) ? ((Hoverable)obj).GetHoverName() : null); } catch { text = null; } if (string.IsNullOrEmpty(text)) { ItemDrop val = (ItemDrop)(object)((objetivo is ItemDrop) ? objetivo : null); if (val != null) { text = val.m_itemData.m_shared.m_name; } } if (string.IsNullOrEmpty(text)) { return null; } text = Etiquetas.Replace(Tr.Localize(text), "").Trim(); Character val2 = (Character)(object)((objetivo is Character) ? objetivo : null); if (val2 != null && val2.GetLevel() > 1) { text = text + " " + new string('★', val2.GetLevel() - 1); } return text; } 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", "2.2.6")] [BepInDependency("mushokutensei.core", "2.88.0")] [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 = "2.2.6"; 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> PrevRalentizarElite; public static ConfigEntry<float> PrevRalentizarJefe; public static ConfigEntry<float> PrevManaRalentizar; public static ConfigEntry<float> DesgasteEquipadoPorSegundo; public static ConfigEntry<float> BotinMultiplicador; public static ConfigEntry<float> DiametroOjo; private void Awake() { //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Expected O, but got Unknown //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Expected O, but got Unknown //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Expected O, but got Unknown //IL_012b: 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_016b: Expected O, but got Unknown //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Expected O, but got Unknown //IL_0308: Unknown result type (might be due to invalid IL or missing references) //IL_033b: Unknown result type (might be due to invalid IL or missing references) //IL_036e: Unknown result type (might be due to invalid IL or missing references) //IL_03d0: Unknown result type (might be due to invalid IL or missing references) //IL_03da: Expected O, but got Unknown //IL_0455: Unknown result type (might be due to invalid IL or missing references) //IL_045f: Expected O, but got Unknown //IL_0492: Unknown result type (might be due to invalid IL or missing references) //IL_049c: Expected O, but got Unknown //IL_04cf: Unknown result type (might be due to invalid IL or missing references) //IL_04d9: Expected O, but got Unknown //IL_05c0: Unknown result type (might be due to invalid IL or missing references) //IL_05ca: Expected O, but got Unknown //IL_05fd: Unknown result type (might be due to invalid IL or missing references) //IL_0607: Expected O, but got Unknown //IL_0632: Unknown result type (might be due to invalid IL or missing references) //IL_0639: Invalid comparison between Unknown and I4 //IL_0640: Unknown result type (might be due to invalid IL or missing references) //IL_0647: Invalid comparison between Unknown and I4 //IL_0675: Unknown result type (might be due to invalid IL or missing references) //IL_067a: Unknown result type (might be due to invalid IL or missing references) //IL_0682: Unknown result type (might be due to invalid IL or missing references) //IL_068d: Unknown result type (might be due to invalid IL or missing references) //IL_0698: Unknown result type (might be due to invalid IL or missing references) //IL_06a3: Unknown result type (might be due to invalid IL or missing references) //IL_06cd: Expected O, but got Unknown ConfigMigracion.Migrar(((BaseUnityPlugin)this).Config, ConfigNombres.Tabla); 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>("Foresight", "Lead", 0.3f, new ConfigDescription("Seconds the silhouette starts ahead of the enemy.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 0.8f), Array.Empty<object>())); PrevVelocidad = ((BaseUnityPlugin)this).Config.Bind<float>("Foresight", "SilhouetteSpeed", 1.6f, new ConfigDescription("The silhouette animation runs faster: it finishes the hit before the real enemy.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 3f), Array.Empty<object>())); PrevOpacidad = ((BaseUnityPlugin)this).Config.Bind<float>("Foresight", "FaintGhostOpacity", 0.14f, new ConfigDescription("Silhouette opacity (new key: the old OpacidadSilueta=0.55 and OpacidadFantasma=0.28 covered too much).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.03f, 0.9f), Array.Empty<object>())); PrevColor = ((BaseUnityPlugin)this).Config.Bind<Color>("Foresight", "SilhouetteColor", new Color(1f, 0.78f, 0.15f), "Silhouette color (gold, like the eye; change it if you are colorblind)."); PrevMaxSiluetas = ((BaseUnityPlugin)this).Config.Bind<int>("Foresight", "MaxSilhouettes", 3, new ConfigDescription("Silhouettes at once (the closest ones).", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 6), Array.Empty<object>())); PrevMarcaSuelo = ((BaseUnityPlugin)this).Config.Bind<bool>("Foresight", "AreaGroundMark", false, "Besides the silhouette, a ground marker for area attacks and creatures that cannot be copied."); PrevManaPorGolpe = ((BaseUnityPlugin)this).Config.Bind<float>("Foresight", "ManaPerHit", 1f, "Mana per foreseen hit (automatic while you wear the eye)."); PrevDistObjetivo = ((BaseUnityPlugin)this).Config.Bind<float>("Foresight", "TargetDistance", 20f, "Max distance of enemies targeting you."); PrevDistCerca = ((BaseUnityPlugin)this).Config.Bind<float>("Foresight", "NearDistance", 8f, "Max distance of enemies looking at you (even if their target is unknown)."); ZoomMin = ((BaseUnityPlugin)this).Config.Bind<float>("Far Sight", "Zoom", 4f, "Zoom when pressing the key."); ZoomMax = ((BaseUnityPlugin)this).Config.Bind<float>("Far Sight", "MaxZoom", 12f, "Max zoom with the mouse wheel."); ZoomManaPorSegundo = ((BaseUnityPlugin)this).Config.Bind<float>("Far Sight", "ManaPerSecond", 0.25f, "Mana per second while zooming."); ZoomVelocidadMover = ((BaseUnityPlugin)this).Config.Bind<float>("Far Sight", "LookSpeed", 0.75f, "Movement speed multiplier while zooming."); ZoomArco = ((BaseUnityPlugin)this).Config.Bind<float>("Far Sight", "BowZoom", 2.5f, new ConfigDescription("Automatic zoom when drawing the bow with the eye on (1 = no zoom). With the key, full zoom.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 6f), Array.Empty<object>())); ZoomTelemetro = ((BaseUnityPlugin)this).Config.Bind<bool>("Far Sight", "Rangefinder", true, "While looking: distance in meters and name of what you aim at, under the crosshair."); ColorPrevision = ((BaseUnityPlugin)this).Config.Bind<Color>("Visual", "ForesightColor", new Color(1f, 0.72f, 0.08f), "Eye glow color with Foresight (mt_eye color foresight r g b)."); ColorVistaLejana = ((BaseUnityPlugin)this).Config.Bind<Color>("Visual", "FarSightColor", new Color(1f, 0.12f, 0.4f), "Eye glow color with Far Sight."); ColorIdentificacion = ((BaseUnityPlugin)this).Config.Bind<Color>("Visual", "IdentificationColor", new Color(0.65f, 0.3f, 1f), "Eye glow color with Identification."); BrilloOjos = ((BaseUnityPlugin)this).Config.Bind<bool>("Visual", "EyeFlames", false, "Your eye lights up in the color of the equipped magic eye, with small flames like tōki."); DiametroOjo = ((BaseUnityPlugin)this).Config.Bind<float>("Visual", "GlowSize", 0.04f, new ConfigDescription("Size of the eye flames on the head (0.04 = normal; mt_eye size).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.005f, 0.3f), Array.Empty<object>())); IdentAltura = ((BaseUnityPlugin)this).Config.Bind<float>("Identification", "Height", 0.35f, "Meters above the creature's head where the text starts (just under its game health bar)."); IdentDistancia = ((BaseUnityPlugin)this).Config.Bind<float>("Identification", "Distance", 60f, "Max distance to identify creatures, loot, harvestable resources and visible ore veins."); PrevRalentizar = ((BaseUnityPlugin)this).Config.Bind<float>("Foresight", "EnemyAttackingSpeedV2", 0.65f, new ConfigDescription("Enemy animation speed while attacking (1 = normal, 0.65 = 35 % slower). Only on the enemy you foresaw.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.3f, 1f), Array.Empty<object>())); PrevRalentizarElite = ((BaseUnityPlugin)this).Config.Bind<float>("Foresight", "MinibossAttackingSpeed", 0.8f, new ConfigDescription("Same for minor bosses (2+ star enemies or very high health): 0.8 = 20 % slower.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.3f, 1f), Array.Empty<object>())); PrevRalentizarJefe = ((BaseUnityPlugin)this).Config.Bind<float>("Foresight", "BossAttackingSpeedV2", 0.85f, new ConfigDescription("Same for great bosses: 0.85 = 15 % slower.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.3f, 1f), Array.Empty<object>())); PrevManaRalentizar = ((BaseUnityPlugin)this).Config.Bind<float>("Foresight", "ManaPerSlow", 3f, "Extra mana each time Foresight slows an enemy (no mana: only the ghost)."); DurabilidadMax = ((BaseUnityPlugin)this).Config.Bind<float>("Wear", "Durability", 100f, "Eye durability (+50 % per upgrade level). Repaired at their station."); DesgasteIdentificacion = ((BaseUnityPlugin)this).Config.Bind<float>("Wear", "IdentificationPerSecondV2", 0.2f, "Wear per second identifying a creature (100 → ~8 min aiming)."); DesgasteVistaLejana = ((BaseUnityPlugin)this).Config.Bind<float>("Wear", "FarSightPerSecondV2", 0.6f, "Wear per second of zoom (100 → ~3 min looking)."); DesgastePrevision = ((BaseUnityPlugin)this).Config.Bind<float>("Wear", "ForesightPerHitV2", 1f, "Wear per foreseen hit (100 → 100 hits)."); DesgasteEquipadoPorSegundo = ((BaseUnityPlugin)this).Config.Bind<float>("Wear", "JustWearingPerSecondV2", 0.004f, new ConfigDescription("Wear just for wearing the eye (0.004 → 100 in ~7 h of play).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); BotinMultiplicador = ((BaseUnityPlugin)this).Config.Bind<float>("Loot", "Multiplier", 1f, new ConfigDescription("Multiplies the chance of eyes dropping from creatures and bosses (0 = craft only).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 5f), Array.Empty<object>())); TeclaZoom = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Keys", "FarSight", (KeyCode)118, "Hold to use the Far Sight Eye (only with the eye equipped)."); if ((int)TeclaZoom.Value == 122 || (int)TeclaZoom.Value == 121) { TeclaZoom.Value = (KeyCode)118; } PrefabManager.OnVanillaPrefabsAvailable += Ojos.Registrar; try { GuiaInicio.Registrar(new PasoGuia { Orden = 40, TituloKey = "guia_eye", TextoKey = "guia_eye_d", Receta = "MT_OjoIdentificacion", Hecho = (Player p) => GuiaInicio.Fabricado(p, "MT_OjoIdentificacion") }); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("MT Ojos: guía: " + ex)); } Desgaste.Init(); ((Component)this).gameObject.AddComponent<DesgasteEquipado>(); ((Component)this).gameObject.AddComponent<VistaLejana>(); AtaqueSeguro.OcupadoAProposito.Add((Player p) => VistaLejana.Mirando && !VistaLejana.EsArco(p)); ((Component)this).gameObject.AddComponent<Prevision>(); ((Component)this).gameObject.AddComponent<Identificacion>(); ((Component)this).gameObject.AddComponent<OjoFrente>(); CommandManager.Instance.AddConsoleCommand((ConsoleCommand)(object)new OjoCommand()); Parches.Aplicar("mushokutensei.ojos", ((object)this).GetType().Assembly, ((BaseUnityPlugin)this).Logger); ((BaseUnityPlugin)this).Logger.LogInfo((object)"MT Ojos 2.2.6 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_02ff: Unknown result type (might be due to invalid IL or missing references) //IL_0304: Unknown result type (might be due to invalid IL or missing references) //IL_0312: 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_020f: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_027b: 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('/'); 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_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Expected O, but got Unknown //IL_0148: 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_020f: 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_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0258: 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++) { Shader val = Shader.Find("Custom/Piece") ?? Shader.Find("Custom/Lit") ?? Shader.Find("Sprites/Default"); Material val2 = ((!((Object)(object)template != (Object)null)) ? ((!((Object)(object)val != (Object)null)) ? ((Material)null) : new Material(val)) : new Material(template)); if ((Object)(object)val2 == (Object)null) { continue; } ((Object)val2).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 (val2.HasProperty("_MainTex")) { val2.SetTexture("_MainTex", (Texture)(object)Texture2D.whiteTexture); } if (val2.HasProperty("_BumpMap")) { val2.SetTexture("_BumpMap", (Texture)null); } if (val2.HasProperty("_Color")) { val2.SetColor("_Color", dictionary.TryGetValue(text2, out var value2) ? value2 : Color.gray); } if (dictionary2.TryGetValue(text2, out var value3) && ((Color)(ref value3)).maxColorComponent > 0.01f && val2.HasProperty("_EmissionColor")) { val2.EnableKeyword("_EMISSION"); val2.SetColor("_EmissionColor", value3 * 1.5f); } array3[j] = val2; } 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 class OjoFrente : MonoBehaviour { public const float Radio = 35f; private static readonly FieldRef<VisEquipment, string> Amuleto = AccessTools.FieldRefAccess<VisEquipment, string>("m_trinketItem"); private readonly Dictionary<Player, GameObject> _gemas = new Dictionary<Player, GameObject>(); private readonly List<Player> _quitar = new List<Player>(); private float _siguiente; private static Mesh _malla; private static Material _mat; private void Update() { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer != (Object)null && !((Character)localPlayer).IsDead() && Ojos.FrenteEquipado) { TercerOjo.Pasivo(localPlayer, 35f); } if (Time.time < _siguiente) { return; } _siguiente = Time.time + 0.5f; foreach (Player allPlayer in Player.GetAllPlayers()) { if ((Object)(object)allPlayer == (Object)null) { continue; } VisEquipment component = ((Component)allPlayer).GetComponent<VisEquipment>(); bool flag = (Object)(object)component != (Object)null && !((Character)allPlayer).IsDead() && Amuleto.Invoke(component) == "MT_OjoFrente"; _gemas.TryGetValue(allPlayer, out var value); if (flag && (Object)(object)value == (Object)null) { value = Gema(allPlayer); if ((Object)(object)value != (Object)null) { _gemas[allPlayer] = value; } } else if (!flag && (Object)(object)value != (Object)null) { Object.Destroy((Object)(object)value); _gemas.Remove(allPlayer); } } _quitar.Clear(); foreach (KeyValuePair<Player, GameObject> gema in _gemas) { if ((Object)(object)gema.Key == (Object)null || (Object)(object)gema.Value == (Object)null) { _quitar.Add(gema.Key); } } foreach (Player item in _quitar) { if (_gemas.TryGetValue(item, out var value2) && (Object)(object)value2 != (Object)null) { Object.Destroy((Object)(object)value2); } _gemas.Remove(item); } } private static GameObject Gema(Player p) { //IL_009a: 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_00ac: 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_00cb: 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_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_0102: 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_013d: Expected O, but got Unknown SkinnedMeshRenderer val = ((Component)p).GetComponent<VisEquipment>()?.m_bodyModel; if ((Object)(object)val == (Object)null || val.bones == null) { return null; } Transform val2 = null; Transform[] bones = val.bones; foreach (Transform val3 in bones) { if ((Object)(object)val3 != (Object)null && (((Object)val3).name == "Head" || ((Object)val3).name.EndsWith(":Head") || ((Object)val3).name.EndsWith("_Head"))) { val2 = val3; break; } } if ((Object)(object)val2 == (Object)null) { return null; } GameObject val4 = new GameObject("MT_OjoFrente"); val4.transform.SetParent(val2, false); val4.transform.localPosition = new Vector3(0f, 0.17f, 0.11f); val4.transform.localRotation = Quaternion.identity; val4.AddComponent<MeshFilter>().sharedMesh = Malla(); MeshRenderer obj = val4.AddComponent<MeshRenderer>(); ((Renderer)obj).sharedMaterial = Material(); ((Renderer)obj).shadowCastingMode = (ShadowCastingMode)0; Light obj2 = LucesMagicas.Registrar(val4.AddComponent<Light>()); obj2.color = new Color(1f, 0.15f, 0.1f); obj2.range = 0.6f; obj2.intensity = 1.2f; return val4; } private static Mesh Malla() { //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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_00cf: 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_00df: 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_00f2: Expected O, but got Unknown if ((Object)(object)_malla != (Object)null) { return _malla; } Vector3[] vertices = (Vector3[])(object)new Vector3[6] { new Vector3(-0.018f, 0.0108f, 0f), new Vector3(0.018f, 0.0108f, 0f), new Vector3(0f, -0.018f, 0f), new Vector3(-0.018f, 0.0108f, 0.006f), new Vector3(0.018f, 0.0108f, 0.006f), new Vector3(0f, -0.018f, 0.006f) }; int[] triangles = new int[24] { 3, 5, 4, 0, 1, 2, 0, 3, 4, 0, 4, 1, 1, 4, 5, 1, 5, 2, 2, 5, 3, 2, 3, 0 }; _malla = new Mesh { name = "MT_GemaFrente", vertices = vertices, triangles = triangles }; _malla.RecalculateNormals(); _malla.RecalculateBounds(); return _malla; } private static Material Material() { //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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown //IL_0088: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_mat != (Object)null) { return _mat; } _mat = new Material(Shader.Find("Standard") ?? Shader.Find("Sprites/Default")) { color = new Color(0.85f, 0.05f, 0.05f) }; if (_mat.HasProperty("_EmissionColor")) { _mat.EnableKeyword("_EMISSION"); _mat.SetColor("_EmissionColor", new Color(1.6f, 0.12f, 0.08f)); } if (_mat.HasProperty("_Glossiness")) { _mat.SetFloat("_Glossiness", 0.9f); } return _mat; } } public static class Ojos { public const string Prevision = "MT_OjoPrevision"; public const string VistaLejana = "MT_OjoVistaLejana"; public const string Identificacion = "MT_OjoIdentificacion"; public const string Frente = "MT_OjoFrente"; private static bool _frente; 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 bool FrenteEquipado { get { Refrescar(); return _frente; } } 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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Expected O, but got Unknown //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: 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_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Expected O, but got Unknown //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Expected O, but got Unknown //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Expected O, but got Unknown //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Expected O, but got Unknown //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Expected O, but got Unknown //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Expected O, but got Unknown //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Expected O, but got Unknown //IL_01e5: Unknown result type (might be due to invalid IL or missing references) try { Crear("MT_OjoIdentificacion", Tr.Token("ojos_ojo_identificacion"), Tr.Token("ojos_ojo_identificacion_d") + "\n\n" + Tr.Token("ojos_ojo_identificacion_fuente"), "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") + "\n\n" + Tr.Token("ojos_ojo_vista_lejana_fuente"), "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") + "\n\n" + Tr.Token("ojos_ojo_prevision_fuente"), "ojo_prevision", "Ruby", CraftingStations.Forge, 3, new RequirementConfig("Silver", 4, 0, true), new RequirementConfig("Crystal", 3, 0, true), new RequirementConfig("TrophyHatchling", 1, 0, true)); Crear("MT_OjoFrente", Tr.Token("ojos_ojo_frente"), Tr.Token("ojos_ojo_frente_d") + "\n\n" + Tr.Token("ojos_ojo_frente_fuente"), "ojo_frente", "Ruby", CraftingStations.Forge, 2, new RequirementConfig("Ruby", 1, 0, true), new RequirementConfig("Silver", 2, 0, true), new RequirementConfig("GreydwarfEye", 5, 0, true)).m_itemType = (ItemType)24; ValorObjeto.Fijar("MT_OjoIdentificacion", 300f); ValorObjeto.Fijar("MT_OjoVistaLejana", 600f); ValorObjeto.Fijar("MT_OjoPrevision", 1200f); ValorObjeto.Fijar("MT_OjoFrente", 800f); } finally { PrefabManager.OnVanillaPrefabsAvailable -= Registrar; } } private static SharedData 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 = nu
plugins/MT.Potencias/MT.Potencias.dll
Decompiled a day 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.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Managers; using Jotunn.Utils; using MT.Comercio; using MT.Core; using MT.Core.Companions; using MT.Core.Diario; using MT.Core.Duelos; using MT.Core.Economia; using MT.Core.I18n; using MT.Core.Mapa; using MT.Core.Modelos; using MT.Core.Npc; using MT.Core.Registro; using MT.Core.Rueda; using MT.Core.UI; using MT.Core.Vfx; using MT.Dialogos.Rueda; using MT.Potencias.Components; using MT.Potencias.Core; using MT.Potencias.Creatures; using MT.Potencias.Ranking; using Microsoft.CodeAnalysis; using Splatform; 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.Potencias")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+f72fd27a1cef3fefa2078e5313c902bbcd510c4b")] [assembly: AssemblyProduct("MT.Potencias")] [assembly: AssemblyTitle("MT.Potencias")] [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.Potencias { public class OrstedCapaCommand : ConsoleCommand { private const float Radio = 60f; private static readonly FieldInfo Colisiones = AccessTools.Field(typeof(VisEquipment), "m_clothColliders"); public override string Name => "mt_orsted_capa"; public override bool IsCheat => true; public override string Help => "Diagnose Orsted's Feather cape collisions (he always wears it): cloth colliders on the player and on Orsted."; public override void Run(string[] args) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { return; } Humanoid val = Buscar(((Component)localPlayer).transform.position); if ((Object)(object)val == (Object)null) { Console instance = Console.instance; if (instance != null) { instance.Print("No Orsted within " + 60f + " m."); } } else { Diagnostico(localPlayer, val); } } private static void Diagnostico(Player p, Humanoid orsted) { Informe("Player", (Character)(object)p); Informe("Orsted", (Character)(object)orsted); } private static void Informe(string quien, Character c) { VisEquipment component = ((Component)c).GetComponent<VisEquipment>(); IList list = (((Object)(object)component != (Object)null && Colisiones != null) ? (Colisiones.GetValue(component) as IList) : null); if (list == null) { Console instance = Console.instance; if (instance != null) { instance.Print(quien + ": no cloth collider list."); } return; } int num = 0; int num2 = 0; int num3 = 0; string text = ""; foreach (object item in list) { Component val = (Component)((item is Component) ? item : null); if ((Object)(object)val == (Object)null) { num3++; } else if (val.transform.IsChildOf(((Component)c).transform)) { num++; if (text.Length == 0) { text = ((Object)val.transform).name; } } else { num2++; } } Console instance2 = Console.instance; if (instance2 != null) { instance2.Print(quien + ": " + list.Count + " cloth colliders — own body " + num + ", from another object " + num2 + ", missing " + num3 + ((text.Length > 0) ? (" (e.g. on bone " + text + ")") : "") + "."); } } private static Humanoid Buscar(Vector3 desde) { //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_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) Humanoid result = null; float num = 3600f; foreach (Character allCharacter in Character.GetAllCharacters()) { Humanoid val = (Humanoid)(object)((allCharacter is Humanoid) ? allCharacter : null); if (val != null && !allCharacter.IsDead() && ((Object)((Component)allCharacter).gameObject).name.StartsWith("MT_Orsted")) { Vector3 val2 = ((Component)allCharacter).transform.position - desde; float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; if (sqrMagnitude < num) { num = sqrMagnitude; result = val; } } } return result; } } public static class Iconos { private static readonly Dictionary<string, Sprite> Cache = new Dictionary<string, Sprite>(); public static Sprite Get(string nombre) { if (Cache.TryGetValue(nombre, out var value)) { return value; } return Cache[nombre] = Cargar(nombre); } private static Sprite Cargar(string nombre) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown //IL_00f2: 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) try { using Stream stream = typeof(Iconos).Assembly.GetManifestResourceStream("Icons/" + nombre + ".png"); using MemoryStream memoryStream = new MemoryStream(); if (stream == null) { Debug.LogWarning((object)("[MT.Potencias] Falta el icono " + nombre)); return null; } stream.CopyTo(memoryStream); Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false) { wrapMode = (TextureWrapMode)1, filterMode = (FilterMode)1 }; if (!(bool)Type.GetType("UnityEngine.ImageConversion, UnityEngine.ImageConversionModule", throwOnError: true).GetMethod("LoadImage", new Type[3] { typeof(Texture2D), typeof(byte[]), typeof(bool) }).Invoke(null, new object[3] { val, memoryStream.ToArray(), false })) { Object.Destroy((Object)(object)val); return null; } Sprite obj = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), 100f); ((Object)obj).name = nombre; return obj; } catch (Exception ex) { Debug.LogWarning((object)("[MT.Potencias] No se pudo cargar el icono " + nombre + ": " + ex.Message)); return null; } } } [NetworkCompatibility(/*Could not decode attribute arguments.*/)] [BepInPlugin("bryanrf.mushoku.potencias", "MT Potencias (7 Grandes Potencias)", "1.29.9")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency("mushokutensei.core", "2.99.66")] [BepInDependency("bryanrf.mushoku.dialogos", "1.18.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class MTPotenciasPlugin : BaseUnityPlugin { [CompilerGenerated] private static class <>O { public static Proveedor <0>__Conversacion; } public const string Guid = "bryanrf.mushoku.potencias"; public const string Name = "MT Potencias (7 Grandes Potencias)"; public const string Version = "1.29.9"; internal const string GuidComercio = "mushokutensei.comercio"; public static ConfigEntry<float> OrstedHealth; public static ConfigEntry<float> OrstedDamageMult; public static ConfigEntry<bool> SpawnAsAlly; public static ConfigEntry<string> OrstedJefe; public static ConfigEntry<float> OrstedProbCamino; private void Awake() { //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_0054: Expected O, but got Unknown //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown //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_0093: Expected O, but got Unknown //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Expected O, but got Unknown //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_00ce: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown //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: Expected O, but got Unknown //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Expected O, but got Unknown //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_015a: Expected O, but got Unknown //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Expected O, but got Unknown //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) //IL_017a: 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_0194: Expected O, but got Unknown //IL_01a9: 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_01b4: Expected O, but got Unknown Tr.Load(typeof(MTPotenciasPlugin).Assembly, Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location)); OrstedHealth = ((BaseUnityPlugin)this).Config.Bind<float>("Orsted", "BaseHealth", 5000f, new ConfigDescription("Dragon God max health.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); OrstedDamageMult = ((BaseUnityPlugin)this).Config.Bind<float>("Orsted", "DamageMultiplier", 1.5f, new ConfigDescription("Multiplier for his strikes and projectiles.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); SpawnAsAlly = ((BaseUnityPlugin)this).Config.Bind<bool>("Orsted", "SpawnAsAlly", false, new ConfigDescription("If true, he spawns already allied (guarding).", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); OrstedJefe = ((BaseUnityPlugin)this).Config.Bind<string>("Orsted", "RequiredBoss", "defeated_dragon", new ConfigDescription("Global key of the boss that must be defeated before the rumor and the encounters (defeated_eikthyr, defeated_gdking, defeated_bonemass, defeated_dragon, defeated_goblinking, defeated_queen).", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); OrstedProbCamino = ((BaseUnityPlugin)this).Config.Bind<float>("Orsted", "RoadEncounterChance", 0.002f, new ConfigDescription("Chance every 5 s of meeting him on the road (Mountain, Plains, Mistlands) once the rumor has started.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 0.1f), new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); GameObject val = new GameObject("MT_Potencias_Pool"); val.AddComponent<PotenciaPool>(); val.AddComponent<ColocadorMonolitos>(); val.AddComponent<VentanaMonumento>(); val.AddComponent<EncuentrosOrsted>(); Object.DontDestroyOnLoad((Object)val); OrstedVfx.Registrar(); object obj = <>O.<0>__Conversacion; if (obj == null) { Proveedor val2 = PotenciaBrain.Conversacion; <>O.<0>__Conversacion = val2; obj = (object)val2; } ConversacionNpc.Registrar((Proveedor)obj, 0); if (Modulos.Instalado((Modulo)11)) { TiendaPotencias.Activar(); } Parches.Aplicar("bryanrf.mushoku.potencias", typeof(MTPotenciasPlugin).Assembly, ((BaseUnityPlugin)this).Logger); RegisterConsoleCommands(); PrefabManager.OnVanillaPrefabsAvailable += OnPrefabsAvailable; Debug.Log((object)"[MT.Potencias] MT Potencias (7 Grandes Potencias) v1.29.9 cargado (spawn MT_Orsted)."); } private void RegisterConsoleCommands() { CommandManager.Instance.AddConsoleCommand((ConsoleCommand)(object)new PotenciasConsoleCommand()); CommandManager.Instance.AddConsoleCommand((ConsoleCommand)(object)new OrstedDebugCommand()); CommandManager.Instance.AddConsoleCommand((ConsoleCommand)(object)new OrstedCapaCommand()); } private void OnPrefabsAvailable() { PrefabManager.OnVanillaPrefabsAvailable -= OnPrefabsAvailable; OrstedCreature.Register(); AleksanderKalman.Register(); MonumentoPotencias.Register(); } } public class PotenciasConsoleCommand : ConsoleCommand { public override string Name => "potencias"; public override string Help => "Shows the Seven Great Powers monument for this world"; public override void Run(string[] args) { string text = RankingPotencias.ObtenerTablaRanking(); Console instance = Console.instance; if (instance != null) { instance.Print(text); } Chat instance2 = Chat.instance; if (instance2 != null) { ((Terminal)instance2).AddString(text); } } } public class OrstedDebugCommand : ConsoleCommand { public override string Name => "mt_orsted_debug"; public override string Help => "Toggle: show over Orsted's head (and in the console) what he decides and why"; public override void Run(string[] args) { PotenciaBrain.Depurar = !PotenciaBrain.Depurar; Console instance = Console.instance; if (instance != null) { instance.Print("Orsted debug: " + (PotenciaBrain.Depurar ? "ON" : "OFF")); } } } } namespace MT.Potencias.Ranking { public static class RankingPotencias { public const int Puestos = 7; private const string Prefijo = "mt_rank_"; public static string Titulo(int rango) { return Tr.Get("potencias_title_" + rango); } public static string PortadorPorDefecto(int rango) { return rango switch { 1 => Tr.Get("potencias_holder_1"), 2 => Tr.Get("potencias_orsted_name"), 3 => Tr.Get("potencias_holder_3"), 4 => Tr.Get("potencias_holder_4"), 5 => Tr.Get("potencias_holder_5"), 6 => Tr.Get("potencias_holder_6"), 7 => Tr.Get("potencias_holder_7"), _ => null, }; } public static bool Reclamado(int rango) { string portador; int dia; return Leer(rango, out portador, out dia); } public static bool ReclamadoPorJugador(int rango) { string portador; int dia; return LeerClave(rango, out portador, out dia); } public static bool LeerClave(int rango, out string portador, out int dia) { portador = null; dia = 0; string text = default(string); if ((Object)(object)ZoneSystem.instance == (Object)null || !ZoneSystem.instance.GetGlobalKey("mt_rank_" + rango, ref text) || string.IsNullOrEmpty(text)) { return false; } int num = text.LastIndexOf('_'); if (num <= 0) { return false; } portador = DeHex(text.Substring(0, num)); int.TryParse(text.Substring(num + 1), out dia); return !string.IsNullOrEmpty(portador); } public static bool Leer(int rango, out string portador, out int dia) { if (LeerClave(rango, out portador, out dia)) { return true; } string text = PortadorPorDefecto(rango); if (!string.IsNullOrEmpty(text)) { portador = text; dia = 1; return true; } portador = null; dia = 0; return false; } public static void RegistrarDerrota(int rango, Character vencedor) { if (rango >= 1 && rango <= 7 && !((Object)(object)vencedor == (Object)null) && !((Object)(object)ZoneSystem.instance == (Object)null)) { string hoverName = vencedor.GetHoverName(); int num = ((!((Object)(object)EnvMan.instance != (Object)null)) ? 1 : EnvMan.instance.GetDay()); ZoneSystem.instance.SetGlobalKey("mt_rank_" + rango + " " + AHex(hoverName) + "_" + num); string text = Tr.Get("potencias_rank_announce", new object[4] { hoverName, rango, Titulo(rango), num }); Chat instance = Chat.instance; if (instance != null) { instance.SendText((Type)2, text); } Debug.Log((object)("[MT.Potencias] " + text)); } } public static string ObtenerTablaRanking() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("<color=gold>" + Tr.Get("potencias_rank_header") + "</color>"); for (int i = 1; i <= 7; i++) { string text; if (LeerClave(i, out var portador, out var dia)) { text = "<color=#55ff55>" + portador + "</color> " + Tr.Get("potencias_rank_day", new object[1] { dia }); } else { string text2 = PortadorPorDefecto(i); text = (string.IsNullOrEmpty(text2) ? ("<color=#999999>" + Tr.Get("potencias_rank_unclaimed") + "</color>") : ("<color=#88ccff>" + text2 + "</color> " + Tr.Get("potencias_rank_default"))); } stringBuilder.AppendLine("#" + i + " " + Titulo(i) + " — " + text); } return stringBuilder.ToString(); } private static string AHex(string s) { byte[] bytes = Encoding.UTF8.GetBytes(s ?? ""); StringBuilder stringBuilder = new StringBuilder(bytes.Length * 2); byte[] array = bytes; foreach (byte b in array) { stringBuilder.Append(b.ToString("x2")); } return stringBuilder.ToString(); } private static string DeHex(string hex) { if (hex.Length % 2 != 0) { return null; } byte[] array = new byte[hex.Length / 2]; for (int i = 0; i < array.Length; i++) { if (!byte.TryParse(hex.Substring(i * 2, 2), NumberStyles.HexNumber, null, out array[i])) { return null; } } return Encoding.UTF8.GetString(array); } } } namespace MT.Potencias.Patches { [HarmonyPatch] internal static class ArmaduraVisualPotenciaPatch { private static IEnumerable<MethodBase> TargetMethods() { string[] array = new string[8] { "SetChestEquipped", "SetLegEquipped", "SetHelmetEquipped", "SetShoulderEquipped", "SetUtilityEquipped", "SetTrinketEquipped", "SetHairEquipped", "SetBeardEquipped" }; foreach (string text in array) { MethodInfo methodInfo = AccessTools.Method(typeof(VisEquipment), text, (Type[])null, (Type[])null); if (methodInfo != null) { yield return methodInfo; } } } private static void Prefix(VisEquipment __instance, ref int hash, MethodBase __originalMethod) { if (!((Object)(object)((Component)__instance).GetComponent<PotenciaModeloPropio>() == (Object)null)) { if (__originalMethod.Name == "SetShoulderEquipped" && (Object)(object)((Component)__instance).GetComponent<CapaOrsted>() != (Object)null) { hash = StringExtensionMethods.GetStableHashCode("CapeFeather"); } else { hash = 0; } } } } [HarmonyPatch(typeof(VisEquipment), "UpdateEquipmentVisuals")] internal static class CuerpoVisualPotenciaPatch { private static void Postfix(VisEquipment __instance) { if ((Object)(object)__instance.m_bodyModel != (Object)null && (Object)(object)((Component)__instance).GetComponent<PotenciaModeloPropio>() != (Object)null) { ((Renderer)__instance.m_bodyModel).enabled = false; } } } public static class ConstruccionesPatches { [HarmonyPatch(typeof(BaseAI), "FindClosestStaticPriorityTarget")] public static class BaseAI_StaticPriority_Patch { private static bool Prefix(BaseAI __instance, ref StaticTarget __result) { if ((Object)(object)__instance != (Object)null && EsOrsted(((Component)__instance).GetComponent<Character>())) { __result = null; return false; } return true; } } [HarmonyPatch(typeof(BaseAI), "FindRandomStaticTarget", new Type[] { typeof(float) })] public static class BaseAI_RandomStatic_Patch { private static bool Prefix(BaseAI __instance, ref StaticTarget __result) { if ((Object)(object)__instance != (Object)null && EsOrsted(((Component)__instance).GetComponent<Character>())) { __result = null; return false; } return true; } } [HarmonyPatch(typeof(WearNTear), "Damage")] public static class WearNTear_Damage_Patch { private static bool Prefix(WearNTear __instance, HitData hit) { if (hit != null && EsOrsted(hit.GetAttacker())) { return false; } return true; } } [HarmonyPatch(typeof(WearNTear), "RPC_Damage", new Type[] { typeof(long), typeof(HitData) })] public static class WearNTear_RPC_Damage_Patch { private static bool Prefix(WearNTear __instance, long sender, HitData hit) { if (hit != null && EsOrsted(hit.GetAttacker())) { return false; } return true; } } [HarmonyPatch(typeof(Destructible), "Damage")] public static class Destructible_Damage_Patch { private static bool Prefix(Destructible __instance, HitData hit) { if (hit != null && EsOrsted(hit.GetAttacker()) && (Object)(object)__instance != (Object)null && ((Object)(object)((Component)__instance).GetComponent<Piece>() != (Object)null || (Object)(object)((Component)__instance).GetComponentInParent<Piece>() != (Object)null)) { return false; } return true; } } [HarmonyPatch(typeof(Destructible), "RPC_Damage", new Type[] { typeof(long), typeof(HitData) })] public static class Destructible_RPC_Damage_Patch { private static bool Prefix(Destructible __instance, long sender, HitData hit) { if (hit != null && EsOrsted(hit.GetAttacker()) && (Object)(object)__instance != (Object)null && ((Object)(object)((Component)__instance).GetComponent<Piece>() != (Object)null || (Object)(object)((Component)__instance).GetComponentInParent<Piece>() != (Object)null)) { return false; } return true; } } private static bool EsOrsted(Character c) { if ((Object)(object)c == (Object)null) { return false; } if (!((Object)c).name.StartsWith("MT_Orsted")) { return (Object)(object)((Component)c).GetComponent<PotenciaBrain>() != (Object)null; } return true; } } public static class FuegoAliadoPatches { public static bool EsOrsted(Character c, out PotenciaBrain brain) { brain = null; if ((Object)(object)c == (Object)null) { return false; } brain = ((Component)c).GetComponent<PotenciaBrain>(); if (!((Object)(object)brain != (Object)null)) { return ((Object)c).name.StartsWith("MT_Orsted"); } return true; } public static bool EsAliado(Character c) { if (EsOrsted(c, out var brain) && (Object)(object)brain != (Object)null) { return brain.CurrentOrder != PotenciaBrain.AllyOrder.Hostile; } return false; } public static bool EsCombateAliado(Character atacante, Character victima) { return CompanionRelationships.PreventDamage(atacante, victima); } } [HarmonyPatch(typeof(MonsterAI), "DoAttack")] public static class RecitadoPatches { private static bool Prefix(MonsterAI __instance, ref bool __result) { PotenciaBrain component = ((Component)__instance).GetComponent<PotenciaBrain>(); if ((Object)(object)component == (Object)null || !component.Recitando) { return true; } __result = false; return false; } } } namespace MT.Potencias.Creatures { public class CapaOrsted : MonoBehaviour { public const string Capa = "CapeFeather"; public const string NombreItemCapa = "$item_cape_feather"; private Humanoid _humanoid; private ZNetView _nview; private float _siguienteRevision; private void Awake() { _humanoid = ((Component)this).GetComponent<Humanoid>(); _nview = ((Component)this).GetComponent<ZNetView>(); MochilaNpc component = ((Component)this).GetComponent<MochilaNpc>(); if ((Object)(object)component != (Object)null) { component.PermiteCambiarCapa = false; } } private void Start() { AsegurarCapaFeather(); } private void Update() { if (!(Time.time < _siguienteRevision)) { _siguienteRevision = Time.time + 2f; AsegurarCapaFeather(); } } public static bool EsCapaFeather(ItemData item) { if (item == null) { return false; } if ((Object)(object)item.m_dropPrefab != (Object)null && ((Object)item.m_dropPrefab).name == "CapeFeather") { return true; } if (item.m_shared != null) { if (!(item.m_shared.m_name == "$item_cape_feather")) { return item.m_shared.m_name == "CapeFeather"; } return true; } return false; } public void AsegurarCapaFeather() { //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Invalid comparison between Unknown and I4 if ((Object)(object)_humanoid == (Object)null || ((Character)_humanoid).IsDead() || ((Object)(object)_nview != (Object)null && _nview.IsValid() && !_nview.IsOwner())) { return; } Inventory inventory = _humanoid.GetInventory(); if (inventory == null) { return; } List<ItemData> allItems = inventory.GetAllItems(); for (int num = allItems.Count - 1; num >= 0; num--) { ItemData val = allItems[num]; if (val.m_shared != null && (int)val.m_shared.m_itemType == 17 && !EsCapaFeather(val)) { if (val.m_equipped) { _humanoid.UnequipItem(val, false); } inventory.RemoveItem(val); } } ItemData val2 = null; for (int i = 0; i < allItems.Count; i++) { ItemData val3 = allItems[i]; if (EsCapaFeather(val3)) { val2 = val3; break; } } if (val2 == null) { val2 = inventory.AddItem("CapeFeather", 1, 1, 0, 0L, "", false, false); } if (val2 != null && !val2.m_equipped) { _humanoid.EquipItem(val2, false); } } } [HarmonyPatch(typeof(Humanoid), "EquipItem")] internal static class OrstedEquipCapePatch { private static bool Prefix(Humanoid __instance, ItemData item, ref bool __result) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Invalid comparison between Unknown and I4 if ((Object)(object)__instance == (Object)null || item == null) { return true; } if ((Object)(object)((Component)__instance).GetComponent<CapaOrsted>() == (Object)null) { return true; } if (item.m_shared != null && (int)item.m_shared.m_itemType == 17 && !CapaOrsted.EsCapaFeather(item)) { __result = false; return false; } return true; } } [HarmonyPatch(typeof(Humanoid), "UnequipItem")] internal static class OrstedUnequipCapePatch { private static bool Prefix(Humanoid __instance, ItemData item) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Invalid comparison between Unknown and I4 if ((Object)(object)__instance == (Object)null || item == null) { return true; } if ((Object)(object)((Component)__instance).GetComponent<CapaOrsted>() == (Object)null) { return true; } if (item.m_shared != null && (int)item.m_shared.m_itemType == 17) { return false; } return true; } } internal static class HundirBajoCapa { private const float Hundir = 0.03f; private const float MiraAtras = 0.15f; private const float MiraArriba = 0.55f; private static readonly HashSet<string> Huesos = new HashSet<string> { "Spine2", "Neck", "LeftShoulder", "RightShoulder", "LeftArm", "RightArm" }; public static int Aplicar(Mesh malla, Transform[] huesos, Vector3 adelante, Vector3 arriba, float escala) { //IL_009a: 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_00ba: 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_00bd: 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_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)malla == (Object)null || huesos == null) { return 0; } Vector3[] vertices = malla.vertices; Vector3[] normals = malla.normals; BoneWeight[] boneWeights = malla.boneWeights; if (normals.Length != vertices.Length || boneWeights.Length != vertices.Length) { return 0; } bool[] array = new bool[huesos.Length]; for (int i = 0; i < huesos.Length; i++) { array[i] = (Object)(object)huesos[i] != (Object)null && Huesos.Contains(RigCuerpo.Limpio(((Object)huesos[i]).name)); } float num = 0.03f / Mathf.Max(0.0001f, escala); int num2 = 0; for (int j = 0; j < vertices.Length; j++) { float num3 = Peso(boneWeights[j], array); if (!(num3 <= 0f)) { Vector3 val = normals[j]; if (Vector3.Dot(val, -adelante) > 0.15f || Vector3.Dot(val, arriba) > 0.55f) { ref Vector3 reference = ref vertices[j]; reference -= val * (num * num3); num2++; } } } malla.vertices = vertices; malla.RecalculateBounds(); return num2; } private static float Peso(BoneWeight w, bool[] marcados) { float num = 0f; if (Ok(((BoneWeight)(ref w)).boneIndex0, marcados)) { num += ((BoneWeight)(ref w)).weight0; } if (Ok(((BoneWeight)(ref w)).boneIndex1, marcados)) { num += ((BoneWeight)(ref w)).weight1; } if (Ok(((BoneWeight)(ref w)).boneIndex2, marcados)) { num += ((BoneWeight)(ref w)).weight2; } if (Ok(((BoneWeight)(ref w)).boneIndex3, marcados)) { num += ((BoneWeight)(ref w)).weight3; } return Mathf.Clamp01(num); } private static bool Ok(int i, bool[] marcados) { if (i >= 0 && i < marcados.Length) { return marcados[i]; } return false; } } public static class OrstedCreature { public const string PrefabName = "MT_Orsted"; public static void Register() { //IL_0038: 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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Expected O, but got Unknown //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Expected O, but got Unknown //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Expected O, but got Unknown //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Expected O, but got Unknown //IL_0387: Unknown result type (might be due to invalid IL or missing references) string text = (((Object)(object)PrefabManager.Instance.GetPrefab("Skeleton") != (Object)null) ? "Skeleton" : "Draugr"); if ((Object)(object)PrefabManager.Instance.GetPrefab(text) == (Object)null) { return; } CreatureConfig val = new CreatureConfig { Name = Tr.Token("potencias_orsted_name"), Faction = (Faction)8, Group = "PotenciasMundiales" }; CustomCreature val2 = new CustomCreature("MT_Orsted", text, val); GameObject prefab = val2.Prefab; bool flag = CuerpoHumano.Aplicar(prefab); if (!flag) { Debug.LogError((object)"[MT.Potencias] Orsted: no se pudo preparar el esqueleto humano; se conserva el cuerpo base."); } Humanoid component = prefab.GetComponent<Humanoid>(); if ((Object)(object)component != (Object)null) { ((Character)component).m_name = Tr.Token("potencias_orsted_name"); ((Character)component).m_health = MTPotenciasPlugin.OrstedHealth.Value; ((Character)component).m_speed = 6f; ((Character)component).m_runSpeed = 12f; ((Character)component).m_boss = false; ((Character)component).m_bossEvent = ""; component.m_randomShield = (GameObject[])(object)new GameObject[0]; component.m_randomSets = (ItemSet[])(object)new ItemSet[0]; component.m_randomArmor = (GameObject[])(object)new GameObject[0]; component.m_randomItems = (RandomItem[])(object)new RandomItem[0]; GameObject val3 = PrefabManager.Instance.GetPrefab("SwordMistwalker") ?? PrefabManager.Instance.GetPrefab("SwordSilver") ?? PrefabManager.Instance.GetPrefab("SwordBlackmetal"); if ((Object)(object)val3 != (Object)null) { GameObject prefab2 = PrefabManager.Instance.GetPrefab("CapeFeather"); component.m_defaultItems = (GameObject[])(object)((!((Object)(object)prefab2 != (Object)null)) ? new GameObject[1] { val3 } : new GameObject[2] { val3, prefab2 }); component.m_randomWeapon = (GameObject[])(object)new GameObject[0]; } } MonsterAI component2 = prefab.GetComponent<MonsterAI>(); if ((Object)(object)component2 != (Object)null) { component2.m_attackPlayerObjects = false; ((BaseAI)component2).m_idleSound = new EffectList(); ((BaseAI)component2).m_alertedEffects = new EffectList(); component2.m_wakeupEffects = new EffectList(); component2.m_sleepEffects = new EffectList(); } GameObject prefab3 = PrefabManager.Instance.GetPrefab("Player"); Humanoid val4 = (((Object)(object)prefab3 != (Object)null) ? prefab3.GetComponent<Humanoid>() : null); if ((Object)(object)component != (Object)null && (Object)(object)val4 != (Object)null) { component.m_unarmedWeapon = val4.m_unarmedWeapon; ((Character)component).m_hitEffects = ((Character)val4).m_hitEffects; ((Character)component).m_critHitEffects = ((Character)val4).m_critHitEffects; ((Character)component).m_backstabHitEffects = ((Character)val4).m_backstabHitEffects; ((Character)component).m_deathEffects = ((Character)val4).m_deathEffects; ((Character)component).m_jumpEffects = ((Character)val4).m_jumpEffects; component.m_equipEffects = val4.m_equipEffects; component.m_pickupEffects = val4.m_pickupEffects; component.m_dropEffects = val4.m_dropEffects; Animator componentInChildren = prefab.GetComponentInChildren<Animator>(true); Animator componentInChildren2 = prefab3.GetComponentInChildren<Animator>(true); if ((Object)(object)componentInChildren != (Object)null && (Object)(object)componentInChildren2 != (Object)null) { componentInChildren.runtimeAnimatorController = componentInChildren2.runtimeAnimatorController; } FootStep componentInChildren3 = prefab.GetComponentInChildren<FootStep>(true); FootStep componentInChildren4 = prefab3.GetComponentInChildren<FootStep>(true); if ((Object)(object)componentInChildren3 != (Object)null && (Object)(object)componentInChildren4 != (Object)null) { componentInChildren3.m_effects = componentInChildren4.m_effects; } } if (flag && OrstedSkin.Apply(prefab) && (Object)(object)prefab.GetComponent<PotenciaModeloPropio>() == (Object)null) { prefab.AddComponent<PotenciaModeloPropio>(); } if ((Object)(object)prefab.GetComponent<CapaOrsted>() == (Object)null) { prefab.AddComponent<CapaOrsted>(); } if ((Object)(object)prefab.GetComponent<PotenciaBrain>() == (Object)null) { prefab.AddComponent<PotenciaBrain>(); } if ((Object)(object)prefab.GetComponent<MochilaNpc>() == (Object)null) { MochilaNpc obj = prefab.AddComponent<MochilaNpc>(); obj.Oficio = (Oficio)3; obj.EquipoAutomatico = false; obj.OroInicial = 500; obj.PermiteCambiarCapa = false; } CreatureManager.Instance.AddCreature(val2); Debug.Log((object)"[MT.Potencias] Criatura 'MT_Orsted' registrada con éxito. Invocable vía 'spawn MT_Orsted'."); } } public static class OrstedSkin { private class Junta { public string Name; public string Parent; public Vector3 Pos; } private class Rig { public bool Valheim; public List<Junta> Juntas = new List<Junta>(); public string[] Bones; public Vector3[] V; public Vector3[] N; public Vector2[] UV; public BoneWeight[] W; public int[] T; } private static readonly string[] Piezas = new string[3] { "casco", "torso", "piernas" }; public static string ModelDir => Path.Combine(Path.GetDirectoryName(typeof(OrstedSkin).Assembly.Location), "Models"); public static bool Apply(GameObject prefab) { //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: 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_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Expected O, but got Unknown //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_03b6: Unknown result type (might be due to invalid IL or missing references) //IL_03bb: Unknown result type (might be due to invalid IL or missing references) //IL_03c0: Unknown result type (might be due to invalid IL or missing references) //IL_03c4: Unknown result type (might be due to invalid IL or missing references) //IL_03c9: Unknown result type (might be due to invalid IL or missing references) //IL_03cd: Unknown result type (might be due to invalid IL or missing references) //IL_03d2: Unknown result type (might be due to invalid IL or missing references) //IL_03d7: Unknown result type (might be due to invalid IL or missing references) //IL_03db: Unknown result type (might be due to invalid IL or missing references) //IL_03e0: Unknown result type (might be due to invalid IL or missing references) //IL_0400: Unknown result type (might be due to invalid IL or missing references) //IL_0402: Unknown result type (might be due to invalid IL or missing references) //IL_0405: Unknown result type (might be due to invalid IL or missing references) SkinnedMeshRenderer val = Cuerpo(prefab); if ((Object)(object)val == (Object)null || (Object)(object)val.sharedMesh == (Object)null || val.bones == null) { Debug.LogWarning((object)"[MT.Potencias] Orsted: el Draugr no tiene cuerpo con huesos; queda con su aspecto"); return false; } Matrix4x4[] bindposes = val.sharedMesh.bindposes; if (bindposes == null || bindposes.Length != val.bones.Length) { return false; } Transform transform = prefab.transform; Transform transform2 = ((Component)val).transform; Dictionary<string, int> dictionary = new Dictionary<string, int>(); Vector3[] array = (Vector3[])(object)new Vector3[bindposes.Length]; for (int i = 0; i < bindposes.Length; i++) { if (!((Object)(object)val.bones[i] == (Object)null)) { string key = Limpio(((Object)val.bones[i]).name); if (!dictionary.ContainsKey(key)) { dictionary[key] = i; } int num = i; Matrix4x4 inverse = ((Matrix4x4)(ref bindposes[i])).inverse; array[num] = transform.InverseTransformPoint(transform2.TransformPoint(Vector4.op_Implicit(((Matrix4x4)(ref inverse)).GetColumn(3)))); } } List<Rig> list = new List<Rig>(); Rig rig = Load("modelo"); if (rig != null) { list.Add(rig); } else { string[] array2 = new string[3] { "casco", "torso", "piernas" }; for (int j = 0; j < array2.Length; j++) { Rig rig2 = Load(array2[j]); if (rig2 != null) { list.Add(rig2); } } } if (list.Count == 0) { Debug.LogWarning((object)"[MT.Potencias] Orsted: faltan Models/orsted_*_rig.txt(.gz)"); return false; } Texture2D val2 = Textura(); Dictionary<string, int> dictionary2 = Alias(dictionary); if (!dictionary2.ContainsKey("Hips") || !dictionary2.ContainsKey("Head")) { Debug.LogWarning((object)("[MT.Potencias] Orsted: no encuentro Hips/Head. Huesos: " + string.Join(", ", new List<string>(dictionary.Keys).ToArray()))); return false; } Material val3 = new Material(((Renderer)val).sharedMaterial); if ((Object)(object)val2 != (Object)null) { val3.mainTexture = (Texture)(object)val2; if (val3.HasProperty("_BumpMap")) { val3.SetTexture("_BumpMap", (Texture)null); } } if (val3.HasProperty("_Color")) { val3.color = Color.white; } List<Mesh> list2 = new List<Mesh>(); foreach (Rig item in list) { Mesh val4 = (item.Valheim ? SobreCuerpo(item, val) : Pegar(item, dictionary, dictionary2, array, transform, transform2, bindposes)); if ((Object)(object)val4 != (Object)null && val4.vertexCount > 0 && val4.triangles.Length != 0) { list2.Add(val4); } } if (list2.Count == 0) { Debug.LogError((object)"[MT.Potencias] Orsted: el rig no produjo una malla válida; se conserva el cuerpo humano base."); Object.Destroy((Object)(object)val3); return false; } Renderer[] componentsInChildren = prefab.GetComponentsInChildren<Renderer>(true); foreach (Renderer val5 in componentsInChildren) { if (!((Object)val5).name.StartsWith("MT_")) { val5.enabled = false; } } LevelEffects componentInChildren = prefab.GetComponentInChildren<LevelEffects>(true); if ((Object)(object)componentInChildren != (Object)null) { Object.DestroyImmediate((Object)(object)componentInChildren, true); } ParticleSystem[] componentsInChildren2 = prefab.GetComponentsInChildren<ParticleSystem>(true); foreach (ParticleSystem val6 in componentsInChildren2) { if (!((Object)val6).name.StartsWith("MT_")) { val6.Stop(); Object.DestroyImmediate((Object)(object)((Component)val6).gameObject, true); } } Light[] componentsInChildren3 = prefab.GetComponentsInChildren<Light>(true); foreach (Light val7 in componentsInChildren3) { if (!((Object)val7).name.StartsWith("MT_")) { Object.DestroyImmediate((Object)(object)((Component)val7).gameObject, true); } } int num2 = 0; int num3 = 0; List<SkinnedMeshRenderer> list3 = new List<SkinnedMeshRenderer>(list2.Count); Vector3 val8 = transform2.InverseTransformDirection(transform.forward); Vector3 normalized = ((Vector3)(ref val8)).normalized; val8 = transform2.InverseTransformDirection(transform.up); Vector3 normalized2 = ((Vector3)(ref val8)).normalized; foreach (Mesh item2 in list2) { num3 += HundirBajoCapa.Aplicar(item2, val.bones, normalized, normalized2, transform2.lossyScale.x); } foreach (Mesh item3 in list2) { GameObject val9 = RigCuerpo.Montar(val, item3, val3, "MT_Orsted_Modelo", ((Component)val).gameObject.layer, false); SkinnedMeshRenderer val10 = (((Object)(object)val9 != (Object)null) ? val9.GetComponent<SkinnedMeshRenderer>() : null); if ((Object)(object)val10 != (Object)null) { list3.Add(val10); } num2 += item3.vertexCount; } int num4 = EnvolventeTela.AgregarBrazos(prefab, val.bones); int num5 = EnvolventeTela.Ajustar(prefab, (IList<SkinnedMeshRenderer>)list3); Debug.Log((object)$"[MT.Potencias] Orsted: modelo propio pegado al esqueleto humanoide ({num2} vértices, {num3} bajo la capa, {num4} cápsulas de brazos, {num5} cápsulas de capa ajustadas)"); return num2 > 0; } private static SkinnedMeshRenderer Cuerpo(GameObject prefab) { SkinnedMeshRenderer val = prefab.GetComponent<VisEquipment>()?.m_bodyModel; if ((Object)(object)val != (Object)null) { return val; } SkinnedMeshRenderer val2 = null; SkinnedMeshRenderer[] componentsInChildren = prefab.GetComponentsInChildren<SkinnedMeshRenderer>(true); foreach (SkinnedMeshRenderer val3 in componentsInChildren) { if (val3.bones != null && ((Object)(object)val2 == (Object)null || val3.bones.Length > val2.bones.Length)) { val2 = val3; } } return val2; } private static string Limpio(string n) { return RigCuerpo.Limpio(n); } private static Mesh SobreCuerpo(Rig d, SkinnedMeshRenderer body) { //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_0018: Expected O, but got Unknown Mesh val = new Mesh { name = "MT_Orsted", indexFormat = (IndexFormat)1 }; val.vertices = d.V; val.normals = d.N; val.uv = d.UV; val.triangles = d.T; val.boneWeights = d.W; string text = default(string); Mesh val2 = RigCuerpo.SobreCuerpo(body, d.Bones, val, true, ref text); Object.Destroy((Object)(object)val); if ((Object)(object)val2 == (Object)null) { Debug.LogError((object)("[MT.Potencias] Orsted: " + text)); } else { ((Object)val2).name = "MT_Orsted"; } return val2; } private static Dictionary<string, int> Alias(Dictionary<string, int> idx) { Dictionary<string, int> a = new Dictionary<string, int>(); Pon("Hips", new string[3] { "Hips", "Pelvis", "Root" }); Pon("Spine", new string[2] { "Spine", "Spine0" }); Pon("Spine1", new string[1] { "Spine1" }); Pon("Spine2", new string[3] { "Spine2", "Chest", "UpperChest" }); Pon("Neck", new string[1] { "Neck" }); Pon("Head", new string[1] { "Head" }); string[] array = new string[2] { "Left", "Right" }; foreach (string text in array) { Pon(text + "Shoulder", new string[3] { text + "Shoulder", text + "_Shoulder", text + " Clavicle" }); Pon(text + "Arm", new string[3] { text + "Arm", text + "_UpperArm", text + "UpperArm" }); Pon(text + "ForeArm", new string[3] { text + "ForeArm", text + "_LowerArm", text + "LowerArm" }); Pon(text + "Hand", new string[2] { text + "Hand", text + "_Hand" }); Pon(text + "UpLeg", new string[3] { text + "UpLeg", text + "_UpperLeg", text + "UpperLeg" }); Pon(text + "Leg", new string[3] { text + "Leg", text + "_LowerLeg", text + "LowerLeg" }); Pon(text + "Foot", new string[2] { text + "Foot", text + "_Foot" }); Pon(text + "ToeBase", new string[4] { text + "ToeBase", text + "_Toes", text + "Toes", text + "Toe_End" }); } foreach (KeyValuePair<string, int> item in idx) { if (!a.ContainsKey(item.Key)) { a[item.Key] = item.Value; } } return a; int Busca(params string[] c) { foreach (string b in c) { foreach (KeyValuePair<string, int> item2 in idx) { if (string.Equals(item2.Key, b, StringComparison.OrdinalIgnoreCase)) { return item2.Value; } } } return -1; } void Pon(string mk, params string[] c) { int num = Busca(c); if (num >= 0) { a[mk] = num; } } } private static Mesh Pegar(Rig d, Dictionary<string, int> idx, Dictionary<string, int> alias, Vector3[] rest, Transform root, Transform bt, Matrix4x4[] binds) { //IL_03a5: Unknown result type (might be due to invalid IL or missing references) //IL_03aa: Unknown result type (might be due to invalid IL or missing references) //IL_040c: Unknown result type (might be due to invalid IL or missing references) //IL_0417: Unknown result type (might be due to invalid IL or missing references) //IL_041c: Unknown result type (might be due to invalid IL or missing references) //IL_041e: Unknown result type (might be due to invalid IL or missing references) //IL_0423: Unknown result type (might be due to invalid IL or missing references) //IL_0425: Unknown result type (might be due to invalid IL or missing references) //IL_042a: Unknown result type (might be due to invalid IL or missing references) //IL_06c1: Unknown result type (might be due to invalid IL or missing references) //IL_06c6: Unknown result type (might be due to invalid IL or missing references) //IL_06d1: Unknown result type (might be due to invalid IL or missing references) //IL_06d8: Unknown result type (might be due to invalid IL or missing references) //IL_06e0: Unknown result type (might be due to invalid IL or missing references) //IL_06e8: Unknown result type (might be due to invalid IL or missing references) //IL_06f4: Unknown result type (might be due to invalid IL or missing references) //IL_0700: Unknown result type (might be due to invalid IL or missing references) //IL_0708: Unknown result type (might be due to invalid IL or missing references) //IL_0710: Unknown result type (might be due to invalid IL or missing references) //IL_0716: Unknown result type (might be due to invalid IL or missing references) //IL_071d: Expected O, but got Unknown //IL_0301: 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_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_0311: Unknown result type (might be due to invalid IL or missing references) //IL_0325: 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_0337: Unknown result type (might be due to invalid IL or missing references) //IL_033c: Unknown result type (might be due to invalid IL or missing references) //IL_05aa: Unknown result type (might be due to invalid IL or missing references) //IL_05ae: Unknown result type (might be due to invalid IL or missing references) //IL_05b3: Unknown result type (might be due to invalid IL or missing references) //IL_05b8: Unknown result type (might be due to invalid IL or missing references) //IL_05bd: Unknown result type (might be due to invalid IL or missing references) //IL_05cc: Unknown result type (might be due to invalid IL or missing references) //IL_05d1: Unknown result type (might be due to invalid IL or missing references) //IL_05d6: Unknown result type (might be due to invalid IL or missing references) //IL_05db: Unknown result type (might be due to invalid IL or missing references) //IL_05df: Unknown result type (might be due to invalid IL or missing references) //IL_05e4: Unknown result type (might be due to invalid IL or missing references) //IL_0568: Unknown result type (might be due to invalid IL or missing references) //IL_056a: Unknown result type (might be due to invalid IL or missing references) //IL_057b: Unknown result type (might be due to invalid IL or missing references) //IL_0580: Unknown result type (might be due to invalid IL or missing references) //IL_048b: Unknown result type (might be due to invalid IL or missing references) //IL_0491: Unknown result type (might be due to invalid IL or missing references) //IL_049a: Unknown result type (might be due to invalid IL or missing references) //IL_049f: Unknown result type (might be due to invalid IL or missing references) //IL_04a5: Unknown result type (might be due to invalid IL or missing references) //IL_04aa: Unknown result type (might be due to invalid IL or missing references) //IL_04af: Unknown result type (might be due to invalid IL or missing references) //IL_04b4: Unknown result type (might be due to invalid IL or missing references) //IL_04be: Unknown result type (might be due to invalid IL or missing references) //IL_04c3: Unknown result type (might be due to invalid IL or missing references) //IL_04c8: Unknown result type (might be due to invalid IL or missing references) //IL_04ca: Unknown result type (might be due to invalid IL or missing references) //IL_04d0: Unknown result type (might be due to invalid IL or missing references) //IL_04dd: Unknown result type (might be due to invalid IL or missing references) //IL_04e2: Unknown result type (might be due to invalid IL or missing references) //IL_04ec: Unknown result type (might be due to invalid IL or missing references) //IL_04f1: Unknown result type (might be due to invalid IL or missing references) //IL_04f6: Unknown result type (might be due to invalid IL or missing references) //IL_0611: Unknown result type (might be due to invalid IL or missing references) //IL_06ab: Unknown result type (might be due to invalid IL or missing references) //IL_06ad: Unknown result type (might be due to invalid IL or missing references) Dictionary<string, Junta> J = new Dictionary<string, Junta>(); foreach (Junta junta in d.Juntas) { J[junta.Name] = junta; } float num = float.MaxValue; string[] array = new string[4] { "LeftFoot", "RightFoot", "LeftToeBase", "RightToeBase" }; foreach (string key in array) { if (alias.TryGetValue(key, out var value)) { num = Mathf.Min(num, rest[value].y); } } if (num == float.MaxValue) { num = 0f; } float num2 = (J.ContainsKey("LeftFoot") ? J["LeftFoot"].Pos.y : 0f); float num3 = (J.ContainsKey("Head") ? J["Head"].Pos.y : 0.9f); float s = (rest[alias["Head"]].y - num) / Mathf.Max(0.1f, num3 - num2); Dictionary<string, List<string>> hijos = new Dictionary<string, List<string>>(); foreach (Junta junta2 in d.Juntas) { if (alias.ContainsKey(junta2.Name)) { if (!hijos.ContainsKey(junta2.Parent)) { hijos[junta2.Parent] = new List<string>(); } hijos[junta2.Parent].Add(junta2.Name); } } int num4 = d.Bones.Length; int[] array2 = new int[num4]; Vector3[] array3 = (Vector3[])(object)new Vector3[num4]; Vector3[] array4 = (Vector3[])(object)new Vector3[num4]; Quaternion[] array5 = (Quaternion[])(object)new Quaternion[num4]; for (int j = 0; j < num4; j++) { string text = Limpio(d.Bones[j]); string text2 = ((J.ContainsKey(text) && alias.ContainsKey(text)) ? text : (J.ContainsKey(text) ? Pivote(text) : "Hips")); if (!J.ContainsKey(text2) || !alias.ContainsKey(text2)) { text2 = "Hips"; } array2[j] = alias[text2]; array3[j] = (J.ContainsKey(text2) ? (J[text2].Pos * s) : Vector3.zero); array4[j] = rest[array2[j]]; array5[j] = RotOf(text2); } int num5 = d.V.Length; Vector3[] array6 = (Vector3[])(object)new Vector3[num5]; Vector3[] array7 = (Vector3[])(object)new Vector3[num5]; BoneWeight[] array8 = (BoneWeight[])(object)new BoneWeight[num5]; int[] array9 = new int[4]; float[] array10 = new float[4]; int[] array11 = new int[4]; float[] array12 = new float[4]; for (int k = 0; k < num5; k++) { BoneWeight val = d.W[k]; array9[0] = ((BoneWeight)(ref val)).boneIndex0; array9[1] = ((BoneWeight)(ref val)).boneIndex1; array9[2] = ((BoneWeight)(ref val)).boneIndex2; array9[3] = ((BoneWeight)(ref val)).boneIndex3; array10[0] = ((BoneWeight)(ref val)).weight0; array10[1] = ((BoneWeight)(ref val)).weight1; array10[2] = ((BoneWeight)(ref val)).weight2; array10[3] = ((BoneWeight)(ref val)).weight3; Vector3 val2 = d.V[k] * s; Vector3 val3 = Vector3.zero; Vector3 val4 = Vector3.zero; float num6 = 0f; int num7 = 0; for (int l = 0; l < 4; l++) { array11[l] = 0; array12[l] = 0f; } for (int m = 0; m < 4; m++) { if (array10[m] <= 0f || array9[m] < 0 || array9[m] >= num4) { continue; } int num8 = array9[m]; val3 += (array4[num8] + array5[num8] * (val2 - array3[num8])) * array10[m]; val4 += array5[num8] * d.N[k] * array10[m]; num6 += array10[m]; int num9 = array2[num8]; int num10 = -1; for (int n = 0; n < num7; n++) { if (array11[n] == num9) { num10 = n; } } if (num10 < 0) { num10 = num7++; array11[num10] = num9; } array12[num10] += array10[m]; } if (num6 <= 0f) { val3 = val2; num6 = 1f; val4 = d.N[k]; array11[0] = alias["Hips"]; array12[0] = 1f; num7 = 1; } array6[k] = bt.InverseTransformPoint(root.TransformPoint(val3 / num6)); int num11 = k; Vector3 val5 = bt.InverseTransformDirection(root.TransformDirection(((Vector3)(ref val4)).normalized)); array7[num11] = ((Vector3)(ref val5)).normalized; float num12 = 0f; for (int num13 = 0; num13 < num7; num13++) { num12 += array12[num13]; } int num14 = k; BoneWeight val6 = default(BoneWeight); ((BoneWeight)(ref val6)).boneIndex0 = array11[0]; ((BoneWeight)(ref val6)).weight0 = ((num7 > 0) ? (array12[0] / num12) : 0f); ((BoneWeight)(ref val6)).boneIndex1 = array11[1]; ((BoneWeight)(ref val6)).weight1 = ((num7 > 1) ? (array12[1] / num12) : 0f); ((BoneWeight)(ref val6)).boneIndex2 = array11[2]; ((BoneWeight)(ref val6)).weight2 = ((num7 > 2) ? (array12[2] / num12) : 0f); ((BoneWeight)(ref val6)).boneIndex3 = array11[3]; ((BoneWeight)(ref val6)).weight3 = ((num7 > 3) ? (array12[3] / num12) : 0f); array8[num14] = val6; } Mesh val7 = new Mesh { name = "MT_Orsted", indexFormat = (IndexFormat)1, vertices = array6, normals = array7, uv = d.UV, triangles = d.T, boneWeights = array8, bindposes = binds }; val7.RecalculateBounds(); val7.RecalculateTangents(); return val7; string Pivote(string name) { int num15 = 0; while (name != null && name != "-" && num15 < 64) { if (alias.ContainsKey(name) && J.ContainsKey(name)) { return name; } name = (J.TryGetValue(name, out var value2) ? value2.Parent : null); num15++; } return "Hips"; } Quaternion RotOf(string name) { //IL_0107: 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_005a: 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_006a: 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_0088: 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_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_00c7: 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_00ca: Unknown result type (might be due to invalid IL or missing references) int num15 = 0; while (name != null && name != "-" && num15 < 16) { if (hijos.TryGetValue(name, out var value2) && value2.Count == 1 && alias.ContainsKey(name)) { Vector3 val8 = (J[value2[0]].Pos - J[name].Pos) * s; Vector3 val9 = rest[alias[value2[0]]] - rest[alias[name]]; if (((Vector3)(ref val8)).sqrMagnitude > 1E-08f && ((Vector3)(ref val9)).sqrMagnitude > 1E-08f) { return Quaternion.FromToRotation(val8, val9); } } name = (J.TryGetValue(name, out var value3) ? value3.Parent : null); num15++; } return Quaternion.identity; } } private static Rig Load(string pieza) { //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0196: 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_0207: 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_0235: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) string text = Path.Combine(ModelDir, "orsted_" + pieza + "_rig.txt"); if (!File.Exists(text + ".gz") && !File.Exists(text)) { return null; } CultureInfo ci = CultureInfo.InvariantCulture; Rig rig = new Rig(); List<string> list = new List<string>(); List<Vector3> list2 = new List<Vector3>(); List<Vector3> list3 = new List<Vector3>(); List<Vector2> list4 = new List<Vector2>(); List<BoneWeight> list5 = new List<BoneWeight>(); List<int> list6 = new List<int>(); foreach (string item2 in RigTexto.Lineas(text)) { string[] p; if (item2.Length >= 2) { p = item2.Split(' '); if (p[0] == "POSE") { rig.Valheim = p.Length > 1 && p[1] == "valheim"; } else if (p[0] == "B") { list.Add(p[1]); } else if (p[0] == "J") { rig.Juntas.Add(new Junta { Name = p[1], Parent = p[2], Pos = new Vector3(float.Parse(p[3], ci), float.Parse(p[4], ci), float.Parse(p[5], ci)) }); } else if (p[0] == "V") { list2.Add(new Vector3(F(1), F(2), F(3))); list3.Add(new Vector3(F(4), F(5), F(6))); list4.Add(new Vector2(F(7), F(8))); BoneWeight item = default(BoneWeight); ((BoneWeight)(ref item)).boneIndex0 = int.Parse(p[9]); ((BoneWeight)(ref item)).weight0 = F(10); ((BoneWeight)(ref item)).boneIndex1 = int.Parse(p[11]); ((BoneWeight)(ref item)).weight1 = F(12); ((BoneWeight)(ref item)).boneIndex2 = int.Parse(p[13]); ((BoneWeight)(ref item)).weight2 = F(14); ((BoneWeight)(ref item)).boneIndex3 = int.Parse(p[15]); ((BoneWeight)(ref item)).weight3 = F(16); list5.Add(item); } else if (p[0] == "T") { list6.Add(int.Parse(p[1])); list6.Add(int.Parse(p[2])); list6.Add(int.Parse(p[3])); } } float F(int i) { return float.Parse(p[i], ci); } } rig.Bones = list.ToArray(); rig.V = list2.ToArray(); rig.N = list3.ToArray(); rig.UV = list4.ToArray(); rig.W = list5.ToArray(); rig.T = list6.ToArray(); if (rig.V.Length == 0 || rig.T.Length == 0 || rig.Bones.Length == 0) { Debug.LogError((object)("[MT.Potencias] Orsted: rig vacío o inválido: " + text)); return null; } return rig; } private static Texture2D Textura() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown string path = Path.Combine(ModelDir, "orsted_cuerpo_color.png"); if (!File.Exists(path)) { return null; } Texture2D val = new Texture2D(2, 2, (TextureFormat)4, true); if (!ImageConversion.LoadImage(val, File.ReadAllBytes(path))) { return null; } ((Object)val).name = "MT_Orsted_Color"; return val; } } } namespace MT.Potencias.Core { public class PotenciaPool : MonoBehaviour { private const int Previos = 6; private readonly Dictionary<PrimitiveType, Queue<GameObject>> _libres = new Dictionary<PrimitiveType, Queue<GameObject>>(); private readonly Dictionary<GameObject, PrimitiveType> _tipo = new Dictionary<GameObject, PrimitiveType>(); private MaterialPropertyBlock _mpb; private Material _mat; private static readonly int ColorId = Shader.PropertyToID("_Color"); public static PotenciaPool Instance { get; private set; } private void Awake() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown //IL_007b: 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_0093: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Instance != (Object)null && (Object)(object)Instance != (Object)(object)this) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } Instance = this; _mpb = new MaterialPropertyBlock(); _mat = new Material(Shader.Find("Sprites/Default") ?? Shader.Find("Standard")) { name = "MT_Potencias_Fx" }; PrimitiveType[] array = (PrimitiveType[])(object)new PrimitiveType[3] { (PrimitiveType)2, default(PrimitiveType), (PrimitiveType)3 }; foreach (PrimitiveType val in array) { _libres[val] = new Queue<GameObject>(); for (int j = 0; j < 6; j++) { Devolver(Crear(val)); } } } private unsafe GameObject Crear(PrimitiveType t) { //IL_0000: 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) GameObject val = GameObject.CreatePrimitive(t); ((Object)val).name = "MT_PotenciaFx_" + ((object)(*(PrimitiveType*)(&t))/*cast due to .constrained prefix*/).ToString(); Collider component = val.GetComponent<Collider>(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } MeshRenderer component2 = val.GetComponent<MeshRenderer>(); ((Renderer)component2).sharedMaterial = _mat; ((Renderer)component2).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)component2).receiveShadows = false; _tipo[val] = t; return val; } private void Devolver(GameObject go) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)go == (Object)null)) { go.SetActive(false); go.transform.SetParent(((Component)this).transform, false); _libres[_tipo[go]].Enqueue(go); } } private GameObject Sacar(PrimitiveType t, Vector3 pos, Quaternion rot, Vector3 escala, Color color) { //IL_0006: 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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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) Queue<GameObject> queue = _libres[t]; GameObject obj = ((queue.Count > 0) ? queue.Dequeue() : Crear(t)); obj.transform.SetParent((Transform)null, false); obj.transform.SetPositionAndRotation(pos, rot); obj.transform.localScale = escala; _mpb.SetColor(ColorId, color); ((Renderer)obj.GetComponent<MeshRenderer>()).SetPropertyBlock(_mpb); obj.SetActive(true); return obj; } public void Destello(PrimitiveType t, Vector3 pos, Quaternion rot, Vector3 escala, Color color, float segundos) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: 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_0006: 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_000f: Unknown result type (might be due to invalid IL or missing references) ((MonoBehaviour)this).StartCoroutine(Mantener(Sacar(t, pos, rot, escala, color), color, segundos)); } private IEnumerator Mantener(GameObject go, Color color, float segundos) { //IL_0015: 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) float t = 0f; MeshRenderer mr = go.GetComponent<MeshRenderer>(); while (t < segundos && go.activeSelf) { t += Time.deltaTime; float num = ((t / Mathf.Max(0.01f, segundos) < 0.66f) ? color.a : (color.a * (0.5f + 0.5f * Mathf.Abs(Mathf.Sin(t * 25f))))); _mpb.SetColor(ColorId, new Color(color.r, color.g, color.b, num)); ((Renderer)mr).SetPropertyBlock(_mpb); yield return null; } Devolver(go); } public void Onda(Vector3 pos, float radio, Color color, float segundos) { //IL_0004: 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_000a: 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_0019: 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) ((MonoBehaviour)this).StartCoroutine(Crecer(Sacar((PrimitiveType)0, pos, Quaternion.identity, Vector3.one * 0.2f, color), radio, color, segundos)); } private IEnumerator Crecer(GameObject go, float radio, Color color, float segundos) { //IL_001c: 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) MeshRenderer mr = go.GetComponent<MeshRenderer>(); for (float t = 0f; t < segundos; t += Time.deltaTime) { float num = t / segundos; go.transform.localScale = Vector3.one * Mathf.Lerp(0.2f, radio * 2f, num); _mpb.SetColor(ColorId, new Color(color.r, color.g, color.b, color.a * (1f - num))); ((Renderer)mr).SetPropertyBlock(_mpb); yield return null; } Devolver(go); } public void Bala(Vector3 desde, Vector3 hasta, float velocidad, float tamano, Color color) { //IL_0004: 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_000a: 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_0016: 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_001e: Unknown result type (might be due to invalid IL or missing references) ((MonoBehaviour)this).StartCoroutine(Viajar(Sacar((PrimitiveType)0, desde, Quaternion.identity, Vector3.one * tamano, color), desde, hasta, velocidad)); } private IEnumerator Viajar(GameObject go, Vector3 desde, Vector3 hasta, float velocidad) { //IL_0015: 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_001c: 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) float dur = Vector3.Distance(desde, hasta) / Mathf.Max(1f, velocidad); for (float t = 0f; t < dur; t += Time.deltaTime) { go.transform.position = Vector3.Lerp(desde, hasta, t / dur); yield return null; } Devolver(go); } public void Corrutina(IEnumerator c) { ((MonoBehaviour)this).StartCoroutine(c); } } } namespace MT.Potencias.Components { public class AleksanderKalman : MonoBehaviour, Interactable, Hoverable, IDuelableNPC, ICompanionEntity, ICompanionEntity, ICompanionLocomotion, ICompanionLocomotion { public enum AllyOrder { Guard, Follow, Duel } public const string PrefabName = "MT_Kalman"; public const int RangoKalman = 7; private const string ZdoOrden = "mt_kalman_orden"; private const string ZdoLider = "mt_kalman_lider"; private const string ZdoVencido = "mt_kalman_vencido"; private Character _character; private MonsterAI _ai; private ZNetView _nview; private CompaneroNpc _comp; private Player _retador; private ITienda _tienda; private bool _tiendaBuscada; public string DuelistName => Tr.Get("potencias_kalman_name"); public Character CharacterInstance => _character; public bool IsInDuel { get; private set; } public string CompanionId => "MT_Kalman"; public string CompanionName => Tr.Get("potencias_kalman_name"); public bool IsAllied => CurrentOrder != AllyOrder.Duel; public Player Leader => ObtenerLider(); public Vector3 Position => ((Component)this).transform.position; public AllyOrder CurrentOrder { get; private set; } private ITienda Tienda { get { if (!_tiendaBuscada) { _tienda = ((Component)this).GetComponent<ITienda>(); _tiendaBuscada = true; } return _tienda; } } public static event Action<AleksanderKalman> AlPreparar; private void Awake() { _character = ((Component)this).GetComponent<Character>(); _ai = ((Component)this).GetComponent<MonsterAI>(); _nview = ((Component)this).GetComponent<ZNetView>(); _comp = ((Component)this).GetComponent<CompaneroNpc>() ?? ((Component)this).gameObject.AddComponent<CompaneroNpc>(); _comp.TierBase = 4; _comp.Correa = 30f; AleksanderKalman.AlPreparar?.Invoke(this); FichaNpc.De(((Component)this).gameObject).Cargo = Tr.Get("potencias_cargo", new object[2] { 7, RankingPotencias.Titulo(7) }); if ((Object)(object)_ai != (Object)null) { ((BaseAI)_ai).m_viewRange = 35f; ((BaseAI)_ai).m_hearRange = 35f; _ai.m_attackPlayerObjects = false; } LeerEstado(); } private ZDO Zdo() { if (!((Object)(object)_nview != (Object)null) || !_nview.IsValid()) { return null; } return _nview.GetZDO(); } private void LeerEstado() { //IL_003e: 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) ZDO val = Zdo(); if (val == null) { return; } AllyOrder allyOrder = (CurrentOrder = (AllyOrder)Mathf.Clamp(val.GetInt("mt_kalman_orden", 0), 0, 2)); if (allyOrder == AllyOrder.Duel) { _character.m_faction = (Faction)8; return; } _character.m_faction = (Faction)0; if ((Object)(object)_ai != (Object)null && _nview.IsOwner() && allyOrder != AllyOrder.Follow) { _ai.SetFollowTarget((GameObject)null); } } private Player ObtenerLider() { if (!((Object)(object)_comp != (Object)null)) { return null; } return _comp.Lider; } private void MigrarLiderAntiguo() { //IL_0027: 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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) ZDO val = Zdo(); if (val != null && _comp.LiderId == 0L && CurrentOrder != AllyOrder.Duel) { ZDOID zDOID = val.GetZDOID("mt_kalman_lider"); GameObject val2 = ((zDOID != ZDOID.None && (Object)(object)ZNetScene.instance != (Object)null) ? ZNetScene.instance.FindInstance(zDOID) : null); Player val3 = (((Object)(object)val2 != (Object)null) ? val2.GetComponent<Player>() : null); if ((Object)(object)val3 != (Object)null) { _comp.Migrar(val3.GetPlayerID(), CurrentOrder == AllyOrder.Follow); } } } private void Update() { if ((Object)(object)_character == (Object)null || _character.IsDead() || !((Object)(object)_nview != (Object)null) || !_nview.IsOwner() || CurrentOrder != AllyOrder.Follow) { return; } if (_comp.LiderId == 0L) { MigrarLiderAntiguo(); } else if (!_comp.Siguiendo) { ZDO val = Zdo(); if (val != null) { val.Set("mt_kalman_orden", 0); } LeerEstado(); } } public void UpdateFollowing(Player lider, float deltaTime) { } public bool CanChallenge(Player challenger, out string motivoRechazo) { motivoRechazo = null; if ((Object)(object)challenger == (Object)null) { return false; } if (IsInDuel) { motivoRechazo = Tr.Get("duelo_already_active"); return false; } return true; } public void StartDuel(Player challenger) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) IsInDuel = true; _retador = challenger; CurrentOrder = AllyOrder.Duel; _character.m_faction = (Faction)8; if ((Object)(object)_ai != (Object)null) { Campos.ObjetivoIA.Invoke(_ai) = (Character)(object)challenger; Campos.Alertar((BaseAI)(object)_ai, true); } } public void ConcludeDuel(bool playerWon) { IsInDuel = false; ZDO val = Zdo(); if (playerWon) { if (val != null) { val.Set("mt_kalman_vencido", true); } Player val2 = (((Object)(object)_retador != (Object)null) ? _retador : Player.m_localPlayer); RankingPotencias.RegistrarDerrota(7, (Character)(object)val2); Cronica.AnotarUnaVez(val2, "kalman.defeated", "cronica_kalman_defeated", Array.Empty<string>()); Chat instance = Chat.instance; if (instance != null) { instance.SendText((Type)2, Tr.Get("potencias_kalman_defeated_announce", new object[1] { ((Character)val2).GetHoverName() })); } } _retador = null; CurrentOrder = AllyOrder.Guard; if (val != null) { val.Set("mt_kalman_orden", 0); } LeerEstado(); } public bool FueVencidoPorJugador() { ZDO val = Zdo(); if (val == null || !val.GetBool("mt_kalman_vencido", false)) { return RankingPotencias.ReclamadoPorJugador(7); } return true; } public bool Interact(Humanoid user, bool hold, bool alt) { if (!hold) { Player val = (Player)(object)((user is Player) ? user : null); if (val != null) { if (!FueVencidoPorJugador()) { if (IsInDuel) { return false; } if (CanChallenge(val, out var motivoRechazo)) { DuelArena.StartDuel(val, (IDuelableNPC)(object)this); return true; } ((Character)val).Message((MessageType)2, motivoRechazo, 0, (Sprite)null, false); return false; } if (alt) { if (Tienda != null) { return Tienda.Abrir(val); } return false; } if (!_comp.PuedeMandar(val)) { ((Character)val).Message((MessageType)2, _comp.MotivoAjeno(), 0, (Sprite)null, false); return false; } if (CurrentOrder == AllyOrder.Guard) { string text = default(string); if (!_comp.Seguir(val, ref text)) { ((Character)val).Message((MessageType)2, text, 0, (Sprite)null, false); return false; } CambiarOrden(val, AllyOrder.Follow); ((Character)val).Message((MessageType)2, Tr.Get("potencias_kalman_follow", new object[1] { DuelistName }), 0, (Sprite)null, false); } else { _comp.Esperar(val); CambiarOrden(val, AllyOrder.Guard); ((Character)val).Message((MessageType)2, Tr.Get("potencias_kalman_guard", new object[1] { DuelistName }), 0, (Sprite)null, false); } return true; } } return false; } private void CambiarOrden(Player jugador, AllyOrder nueva) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) ZDO val = Zdo(); if (val != null) { if (!_nview.IsOwner()) { _nview.ClaimOwnership(); } val.Set("mt_kalman_orden", (int)nueva); val.Set("mt_kalman_lider", ((Character)jugador).GetZDOID()); LeerEstado(); } } public bool UseItem(Humanoid user, ItemData item) { if (FueVencidoPorJugador()) { Player val = (Player)(object)((user is Player) ? user : null); if (val != null) { MochilaNpc component = ((Component)this).GetComponent<MochilaNpc>(); if (component != null) { return component.Recibir(val, item); } } } return false; } public string GetHoverText() { string text = DuelistName + " (" + RankingPotencias.Titulo(7) + ")"; if (!FueVencidoPorJugador()) { return text + "\n[<color=yellow><b>" + TeclasHover.Usar + "</b></color>] " + Tr.Get("potencias_hover_challenge"); } string text2 = ((CurrentOrder == AllyOrder.Follow) ? Tr.Get("potencias_cmd_follow") : Tr.Get("potencias_cmd_guard")); string text3 = text + " — " + text2 + "\n[<color=yellow><b>" + TeclasHover.Usar + "</b></color>] " + Tr.Get("potencias_hover_order"); if (Tienda != null) { return text3 + "\n[<color=yellow><b>L.Shift + " + TeclasHover.Usar + "</b></color>] " + Tr.Get("com_trade_action"); } return text3; } public string GetHoverName() { return DuelistName; } public float GetHoverOffset() { return 1.5f; } public static void Register() { //IL_0038: 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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown string text = (((Object)(object)PrefabManager.Instance.GetPrefab("Skeleton") != (Object)null) ? "Skeleton" : "Draugr"); if ((Object)(object)PrefabManager.Instance.GetPrefab(text) == (Object)null) { return; } CreatureConfig val = new CreatureConfig { Name = Tr.Token("potencias_kalman_name"), Faction = (Faction)8, Group = "PotenciasMundiales" }; CustomCreature val2 = new CustomCreature("MT_Kalman", text, val); GameObject prefab = val2.Prefab; Humanoid component = prefab.GetComponent<Humanoid>(); if ((Object)(object)component != (Object)null) { ((Character)component).m_name = Tr.Token("potencias_kalman_name"); ((Character)component).m_health = 2500f; ((Character)component).m_speed = 5.5f; ((Character)component).m_runSpeed = 10.5f; ((Character)component).m_boss = true; GameObject val3 = PrefabManager.Instance.GetPrefab("SwordBlackmetal") ?? PrefabManager.Instance.GetPrefab("SwordIron"); if ((Object)(object)val3 != (Object)null) { component.m_defaultItems = (GameObject[])(object)new GameObject[1] { val3 }; component.m_randomWeapon = (GameObject[])(object)new GameObject[1] { val3 }; } component.m_randomShield = (GameObject[])(object)new GameObject[0]; } if ((Object)(object)prefab.GetComponent<AleksanderKalman>() == (Object)null) { prefab.AddComponent<AleksanderKalman>(); Humanizar.Aplicar(prefab, (Oficio)3, false, false, 200, 0); } CreatureManager.Instance.AddCreature(val2); Debug.Log((object)"[MT.Potencias] Maestro 'MT_Kalman' registrado (Rango #7 Dios del Norte)."); } } public class SituacionCombate { public Character Yo; public Character Objetivo; public float Distancia; public bool ObjetivoAtacando; public bool ObjetivoADistancia; public bool ObjetivoBloqueando; public int Fase; public bool Visible; public float Agresividad { get { if (Fase != 3) { if (Fase != 2) { return 1f; } return 1.2f; } return 1.5f; } } } public interface IAtaquePotencia { string Nombre { get; } float Espera { get; } float Recitado { get; } float Puntuar(SituacionCombate s); void Ejecutar(PotenciaBrain cerebro, SituacionCombate s); } public static class GolpesPotencia { private static readonly Collider[] Buffer = (Collider[])(object)new Collider[64]; private static readonly HashSet<Character> Vistos = new HashSet<Character>(); public static int Area(Character yo, Vector3 centro, float radio, float contundente, float corte, float fuego, float empuje, float tambaleo) { //IL_003b: 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_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_00fc: 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_0109: 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_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_011d: 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_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0130: 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_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Expected O, but got Unknown //IL_00c7: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)yo == (Object)null || yo.IsDead()) { return 0; } float value = MTPotenciasPlugin.OrstedDamageMult.Value; PotenciaBrain component = ((Component)yo).GetComponent<PotenciaBrain>(); bool flag = (Object)(object)component != (Object)null && component.CurrentOrder != PotenciaBrain.AllyOrder.Hostile; int num = Physics.OverlapSphereNonAlloc(centro, radio, Buffer); int num2 = 0; Vistos.Clear(); for (int i = 0; i < num; i++) { Character val = (((Object)(object)Buffer[i] != (Object)null) ? ((Component)Buffer[i]).GetComponentInParent<Character>() : null); if (!((Object)(object)val == (Object)null) && !((Object)(object)val == (Object)(object)yo) && !val.IsDead() && Vistos.Add(val) && (!flag || (!(val is Player) && (int)val.m_faction != 0 && !val.IsTamed())) && BaseAI.IsEnemy(yo, val)) { HitData val2 = new HitData { m_point = val.GetCenterPoint() }; Vector3 val3 = ((Component)val).transform.position - centro; val2.m_dir = ((Vector3)(ref val3)).normalized; val2.m_pushForce = empuje; val2.m_staggerMultiplier = tambaleo; val2.m_damage = new DamageTypes { m_blunt = contundente * value, m_slash = corte * value, m_fire = fuego * value }; HitData val4 = val2; val4.SetAttacker(yo); val.Damage(val4); num2++; } } Vistos.Clear(); return num2; } public static void Blandir(Character yo, Character objetivo) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Invalid comparison between Unknown and I4 //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Invalid comparison between Unknown and I4 Humanoid val = (Humanoid)(object)((yo is Humanoid) ? yo : null); if (val != null && !((Character)val).IsDead() && !((Character)val).IsSwimming()) { ItemData currentWeapon = val.GetCurrentWeapon(); if (currentWeapon == null || (int)currentWeapon.m_shared.m_skillType == 1 || (int)currentWeapon.m_shared.m_skillType == 11) { ((Character)val).StartAttack(objetivo, false); } } } public static Vector3 Suelo(Vector3 p) { //IL_0024: 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) float y = default(float); if ((Object)(object)ZoneSystem.instance != (Object)null && ZoneSystem.instance.GetGroundHeight(p, ref y)) { p.y = y; } return p; } } public class GolpeTelegrafiado : IAtaquePotencia { public string Nombre => "Golpe del Dragón"; public float Espera => 4f; public float Recitado => 0f; public float Puntuar(SituacionCombate s) { if (!(s.Distancia <= 6f)) { return 0f; } return 3f; } public void Ejecutar(PotenciaBrain cerebro, SituacionCombate s) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: 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_0082: Unknown result type (might be due to invalid IL or missing references) Vector3 centro = GolpesPotencia.Suelo(((Component)s.Objetivo).transform.position); float segundos = ((s.Fase == 3) ? 0.8f : 1.1f); if (!PoderesNpc.Area(cerebro.Personaje, ((Component)cerebro).transform.position + Vector3.up, 1.4f, (FormaAreaNpc)3)) { OrstedVfx.Circulo(centro, 4f, segundos); } cerebro.Despues(segundos, delegate { //IL_0027: 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_0061: 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_0083: 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_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) GolpesPotencia.Blandir(cerebro.Personaje, s.Objetivo); GolpesPotencia.Area(cerebro.Personaje, centro, 4f, 70f, 50f, 0f, 120f, 2f); if (!PoderesNpc.Area(cerebro.Personaje, centro + Vector3.up * 0.5f, 4f, (FormaAreaNpc)0)) { OrstedVfx.Onda(centro + Vector3.up * 0.5f, 4f, dorada: true); } }); } } public class TajoVolador : IAtaquePotencia { private const float Largo = 16f; private const float Ancho = 2.4f; public string Nombre => "Tajo Volador"; public float Espera => 5f; public float Recitado => 0f; public float Puntuar(SituacionCombate s) { if (!(s.Distancia > 3f) || !(s.Distancia <= 7f)) { return 0f; } return 2.5f * s.Agresividad; } public void Ejecutar(PotenciaBrain cerebro, SituacionCombate s) { //IL_004c: 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_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) //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_0090: 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_009c: 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_00ac: 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_00bd: 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) Character yo = cerebro.Personaje; if (PoderesNpc.Tajo(yo, s.Objetivo, MTPotenciasPlugin.OrstedDamageMult.Value)) { GolpesPotencia.Blandir(yo, s.Objetivo); return; } Vector3 val = ((Component)s.Objetivo).transform.position - ((Component)yo).transform.position; val.y = 0f; ((Vector3)(ref val)).Normalize(); Vector3 desde = GolpesPotencia.Suelo(((Component)yo).transform.position); Vector3 hasta = GolpesPotencia.Suelo(desde + val * 16f); OrstedVfx.Linea(desde, hasta, 2.4f, 0.9f); cerebro.Mirar(val); cerebro.Despues(0.9f, delegate { //IL_000b: 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_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_0028: 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_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_006a: 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_0074: Unknown result type (might be due to invalid IL or missing references) for (int i = 1; i <= 6; i++) { GolpesPotencia.Area(yo, Vector3.Lerp(desde, hasta, (float)i / 6f) + Vector3.up, 1.44f, 0f, 75f, 0f, 60f, 1.5f); } OrstedVfx.Bala(desde + Vector3.up, hasta + Vector3.up, 45f); }); } } public class BalaDePiedra : IAtaquePotencia { public string Nombre => "Bala de Piedra"; public float Espera => 3f; public float Recitado => 0.8f; public float Puntuar(SituacionCombate s) { if (!(s.Distancia > 8f) || !(s.Distancia <= 35f)) { return 0f; } if (!s.ObjetivoADistancia) { return 2.5f; } return 3.5f; } public void Ejecutar(PotenciaBrain cerebro, SituacionCombate s) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) Character yo = cerebro.Personaje; if (!PoderesNpc.LanzarHechizo("bala_piedra", yo, s.Objetivo, MTPotenciasPlugin.OrstedDamageMult.Value)) { Vector3 val = yo.GetCenterPoint() + ((Component)yo).transform.forward; Vector3 hasta = s.Objetivo.GetCenterPoint(); OrstedVfx.Bala(val, hasta, 40f); cerebro.Despues(Vector3.Distance(val, hasta) / 40f, delegate { //IL_0007: Unknown result type (might be due to invalid IL or missing references) GolpesPotencia.Area(yo, hasta, 1.2f, 55f, 0f, 0f, 50f, 1f); }); } } } public class HechizoCompartido : IAtaquePotencia { private readonly string _id; public string Id => _id; public string Nombre => Tr.Get("magia_spell_" + _id); public float Espera { get; } public float Recitado => 0.8f; public HechizoCompartido(string id, float espera) { _id = id; Espera = espera; } public float Puntuar(SituacionCombate s) { if (PoderesNpc.Hechizos == null || !(s.Distancia > 6f) || !(s.Distancia <= 30f)) { return 0f; } return 3f; } public void Ejecutar(PotenciaBrain cerebro, SituacionCombate s) { PoderesNpc.LanzarHechizo(_id, cerebro.Personaje, s.Objetivo, MTPotenciasPlugin.OrstedDamageMult.Value); } } public class PasoRapido : IAtaquePotencia { public string Nombre => "Paso Rápido"; public float Espera => 6f; public float Recitado => 0f; public float Puntuar(SituacionCombate s) { if (!(s.Distancia > 7f) || !(s.Distancia <= 25f)) { return 0f; } if (!s.ObjetivoADistancia) { return 1.5f; } return 4f; } public void Ejecutar(PotenciaBrain cerebro, SituacionCombate s) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0034: 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_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) Vector3 val = ((Component)s.Objetivo).transform.position - ((Component)cerebro).transform.position; val.y = 0f; cerebro.Desplazar(((Component)cerebro).transform.position + ((Vector3)(ref val)).normalized * (((Vector3)(ref val)).magnitude - 2.5f)); } } public class Contraataque : IAtaquePotencia { public string Nombre => "Contraataque"; public float Espera => 3f; public float Recitado => 0f; public float Puntuar(SituacionCombate s) { return 0f; } public void Ejecutar(PotenciaBrain cerebro, SituacionCombate s) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: 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) Vector3 centro = GolpesPotencia.Suelo(((Component)s.Objetivo).transform.position); if (PoderesNpc.Tecnicas == null) { OrstedVfx.Circulo(centro, 2.2f, 0.45f); } cerebro.Despues(0.45f, delegate { //IL_0027: 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_0061: 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) GolpesPotencia.Blandir(cerebro.Personaje, s.Objetivo); GolpesPotencia.Area(cerebro.Personaje, centro, 2.2f, 40f, 40f, 0f, 80f, 3f); PoderesNpc.Area(cerebro.Personaje, centro + Vector3.up * 0.4f, 2.2f, (FormaAreaNpc)1); }); } } public class EspadaDiosDragon : IAtaquePotencia
plugins/MT.Teletransporte/MT.Teletransporte.dll
Decompiled a day 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; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Managers; using Jotunn.Utils; using MT.Core; using MT.Core.Economia; using MT.Core.I18n; using MT.Core.Mapa; using MT.Core.Modelos; using MT.Core.Npc; using MT.Core.Planos; using MT.Core.Registro; using MT.Core.UI; using MT.Core.Viaje; 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.Teletransporte")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+f72fd27a1cef3fefa2078e5313c902bbcd510c4b")] [assembly: AssemblyProduct("MT.Teletransporte")] [assembly: AssemblyTitle("MT.Teletransporte")] [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.Teletransporte { public interface IFondoVacio { float DuracionEntrada { get; } float DuracionSalida { get; } bool TieneEfectosPropios { get; } void DibujarViaje(Rect pantalla, float zoom, float tiempo); void DibujarSalida(Rect pantalla, float tiempoSalida, float tiempoViaje); } public static class FondosVacio { public static IFondoVacio Elegir() { IFondoVacio fondoVacio = FondoVideo.Cargar(); return fondoVacio ?? FondoImagen.Cargar("vacio_blanco"); } public static Rect Recorte(Rect celda, float aspectoCelda, Rect pantalla, float zoom) { //IL_0081: Unknown result type (might be due to invalid IL or missing references) float num = ((Rect)(ref pantalla)).width / Mathf.Max(1f, ((Rect)(ref pantalla)).height); float num2 = ((Rect)(ref celda)).width; float num3 = ((Rect)(ref celda)).height; if (num > aspectoCelda) { num3 *= aspectoCelda / num; } else { num2 *= num / aspectoCelda; } zoom = Mathf.Max(1f, zoom); num2 /= zoom; num3 /= zoom; return new Rect(((Rect)(ref celda)).x + (((Rect)(ref celda)).width - num2) / 2f, ((Rect)(ref celda)).y + (((Rect)(ref celda)).height - num3) / 2f, num2, num3); } } public sealed class FondoImagen : IFondoVacio { private readonly Texture2D _textura; public float DuracionEntrada => 0f; public float DuracionSalida => 0f; public bool TieneEfectosPropios => false; private FondoImagen(Texture2D textura) { _textura = textura; } public static FondoImagen Cargar(string icono) { Sprite val = Iconos.Get(icono); if (!((Object)(object)val != (Object)null)) { return null; } return new FondoImagen(val.texture); } public void DibujarViaje(Rect pantalla, float zoom, float tiempo) { //IL_0014: 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_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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) Rect val = FondosVacio.Recorte(new Rect(0f, 0f, 1f, 1f), (float)((Texture)_textura).width / (float)((Texture)_textura).height, pantalla, zoom); GUI.DrawTextureWithTexCoords(pantalla, (Texture)(object)_textura, val, true); } public void DibujarSalida(Rect pantalla, float tiempoSalida, float tiempoViaje) { } } public sealed class FondoVideo : IFondoVacio { private const float FundidoSalida = 0.3f; private readonly ClipAnimado _entrada; private readonly ClipAnimado _viaje; private readonly ClipAnimado _salida; public float DuracionEntrada { get { if (_entrada == null) { return 0f; } return _entrada.Duracion; } } public float DuracionSalida { get { if (_salida == null) { return 0f; } return _salida.Duracion; } } public bool TieneEfectosPropios => true; private FondoVideo(ClipAnimado entrada, ClipAnimado viaje, ClipAnimado salida) { _entrada = entrada; _viaje = viaje; _salida = salida; } public static FondoVideo Cargar() { ClipAnimado clipAnimado = ClipAnimado.Cargar("vacio_viaje"); if (clipAnimado == null) { return null; } return new FondoVideo(ClipAnimado.Cargar("vacio_entrada"), clipAnimado, ClipAnimado.Cargar("vacio_salida")); } public void DibujarViaje(Rect pantalla, float zoom, float tiempo) { //IL_001e: 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) if (tiempo < DuracionEntrada) { _entrada.Dibujar(pantalla, tiempo, bucle: false); } else { _viaje.Dibujar(pantalla, tiempo - DuracionEntrada, bucle: true); } } public void DibujarSalida(Rect pantalla, float tiempoSalida, float tiempoViaje) { //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_0033: 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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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_0065: 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) if (_salida != null) { float num = Mathf.Clamp01(tiempoSalida / 0.3f); Color color = GUI.color; if (num < 1f) { DibujarViaje(pantalla, 1f, tiempoViaje + tiempoSalida); } GUI.color = new Color(color.r, color.g, color.b, color.a * num); _salida.Dibujar(pantalla, tiempoSalida, bucle: false); GUI.color = color; } } } public sealed class ClipAnimado { private readonly Texture2D _hoja; private readonly int _fotogramas; private readonly int _columnas; private readonly int _filas; private readonly float _fps; private readonly float _aspecto; public float Duracion => (float)_fotogramas / _fps; private ClipAnimado(Texture2D hoja, int fotogramas, int columnas, int filas, float fps) { _hoja = hoja; _fotogramas = fotogramas; _columnas = columnas; _filas = filas; _fps = fps; _aspecto = (float)((Texture)hoja).width / (float)columnas / ((float)((Texture)hoja).height / (float)filas); } public static ClipAnimado Cargar(string nombre) { byte[] array = Iconos.Bytes("Anim/" + nombre + ".txt"); if (array == null) { return null; } int result = 0; int result2 = 0; int result3 = 0; float result4 = 12f; string text = "png"; string[] array2 = Encoding.UTF8.GetString(array).Split('\n'); foreach (string text2 in array2) { int num = text2.IndexOf('='); if (num > 0) { string text3 = text2.Substring(0, num).Trim(); string text4 = text2.Substring(num + 1).Trim(); switch (text3) { case "fotogramas": int.TryParse(text4, NumberStyles.Integer, CultureInfo.InvariantCulture, out result); break; case "columnas": int.TryParse(text4, NumberStyles.Integer, CultureInfo.InvariantCulture, out result2); break; case "filas": int.TryParse(text4, NumberStyles.Integer, CultureInfo.InvariantCulture, out result3); break; case "fps": float.TryParse(text4, NumberStyles.Float, CultureInfo.InvariantCulture, out result4); break; case "formato": text = ((text4 == "jpg") ? "jpg" : "png"); break; } } } if (result2 <= 0 || result3 <= 0 || result <= 0 || result > result2 * result3 || float.IsNaN(result4) || result4 <= 0f) { Debug.LogWarning((object)("[MT.Teletransporte] Clip del vacío «" + nombre + "» con datos no válidos; no se usa.")); return null; } Texture2D val = Iconos.Textura("Anim/" + nombre + "." + text); if ((Object)(object)val == (Object)null) { return null; } Comprimir(val); return new ClipAnimado(val, result, result2, result3, Mathf.Min(result4, 60f)); } private static void Comprimir(Texture2D hoja) { if (((Texture)hoja).width % 4 != 0 || ((Texture)hoja).height % 4 != 0) { return; } try { hoja.Compress(false); hoja.Apply(false, true); } catch (Exception ex) { Debug.LogWarning((object)("[MT.Teletransporte] No se pudo comprimir la hoja del vacío: " + ex.Message)); } } public void Dibujar(Rect pantalla, float tiempo, bool bucle) { //IL_00bc: 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_00cb: 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) int num = (int)(Mathf.Max(0f, tiempo) * _fps); num = (bucle ? (num % _fotogramas) : Mathf.Min(num, _fotogramas - 1)); int num2 = num % _columnas; int num3 = num / _columnas; float num4 = 0.5f / (float)((Texture)_hoja).width; float num5 = 0.5f / (float)((Texture)_hoja).height; Rect celda = default(Rect); ((Rect)(ref celda))..ctor((float)num2 / (float)_columnas + num4, 1f - (float)(num3 + 1) / (float)_filas + num5, 1f / (float)_columnas - 2f * num4, 1f / (float)_filas - 2f * num5); GUI.DrawTextureWithTexCoords(pantalla, (Texture)(object)_hoja, FondosVacio.Recorte(celda, _aspecto, pantalla, 1f), true); } } public class VacioTeleport : MonoBehaviour { private enum Fase { Nada, Carga, Vacio, Salida, Llegada } private const float Carga = 1.4f; private const float Destello = 0.25f; private const float DestelloFuera = 0.3f; private const float VacioMinimo = 2.2f; private const float Blanco = 0.35f; private const float Revelar = 1.3f; private const float Bandas = 0.11f; private static Fase _fase = Fase.Nada; private static float _t0; private static float _faseT0; private static Action _teletransportar; private static Texture2D _borde; private static Texture2D _mota; private static IFondoVacio _fondo; private static bool _fondoBuscado; private static readonly Vector3[] Motas = (Vector3[])(object)new Vector3[110]; private static readonly Vector2[] Capas = (Vector2[])(object)new Vector2[7]; private static float _recorrido; private static float _ultimo; private static float _tiempoViaje; private static AudioSource _fuente; private static AudioClip _clip; private static float _volumenJuego = 1f; public static bool Activo => _fase != Fase.Nada; public static float BrilloCirculo { get; private set; } private static float EnFase => Time.unscaledTime - _faseT0; private static float DuracionEntrada { get { if (_fondo == null) { return 0f; } return _fondo.DuracionEntrada; } } private static float DuracionSalida { get { if (_fondo == null) { return 0f; } return _fondo.DuracionSalida; } } private static bool FondoConEfectos { get { if (_fondo != null) { return _fondo.TieneEfectosPropios; } return false; } } public static void Viajar(Action teletransportar) { //IL_0083: 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_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) if (!Activo) { _teletransportar = teletransportar; BuscarFondo(); _volumenJuego = AudioListener.volume; _fase = Fase.Carga; _t0 = (_faseT0 = Time.unscaledTime); for (int i = 0; i < Motas.Length; i++) { Motas[i] = new Vector3(Random.value, Random.value, (i % 3 == 0) ? Random.Range(0.75f, 1f) : ((i % 3 == 1) ? Random.Range(0.4f, 0.7f) : Random.Range(0.15f, 0.35f))); } for (int j = 0; j < Capas.Length; j++) { Capas[j] = new Vector2(Random.value, Random.Range(0.3f, 1f)); } _recorrido = 0f; _ultimo = Time.unscaledTime; } } public static void Iniciar() { Viajar(null); } private static void Pasar(Fase f) { _fase = f; _faseT0 = Time.unscaledTime; } private static void BuscarFondo() { if (!_fondoBuscado) { _fondoBuscado = true; _fondo = FondosVacio.Elegir(); } } private static void TerminarVacio() { _tiempoViaje = EnFase; if (DuracionSalida > 0f) { Pasar(Fase.Salida); } else { Llegar(); } } private static void Llegar() { Pasar(Fase.Llegada); BrilloCirculo = 1f; } private void Update() { if (Activo) { PantallaLimpia.Empezar(); } else { PantallaLimpia.Terminar(); } if (!Activo) { BrilloCirculo = Mathf.MoveTowards(BrilloCirculo, 0f, Time.unscaledDeltaTime); return; } Player localPlayer = Player.m_localPlayer; switch (_fase) { case Fase.Carga: BrilloCirculo = Mathf.Clamp01(EnFase / 1.4f); if (EnFase >= 1.4f) { try { _teletransportar?.Invoke(); } catch (Exception ex) { Debug.LogWarning((object)("[MT.Teletransporte] Viaje: " + ex.Message)); } Pasar(Fase.Vacio); } break; case Fase.Vacio: BrilloCirculo = 0f; if ((!((Object)(object)localPlayer != (Object)null) || !((Character)localPlayer).IsTeleporting()) && EnFase >= DuracionEntrada + 2.2f) { TerminarVacio(); } break; case Fase.Salida: if (EnFase >= DuracionSalida) { Llegar(); } break; case Fase.Llegada: BrilloCirculo = Mathf.Clamp01(1f - EnFase / 1.65f); if (EnFase >= 1.65f) { _fase = Fase.Nada; if (localPlayer != null) { ((Character)localPlayer).Message((MessageType)2, Tr.Get("tele_circulo_teleport_success"), 0, (Sprite)null, false); } } break; } float num = Silencio(); if ((Object)(object)_fuente == (Object)null) { _fuente = ((Component)this).gameObject.AddComponent<AudioSource>(); _fuente.ignoreListenerVolume = true; _fuente.spatialBlend = 0f; _fuente.loop = true; _fuente.playOnAwake = false; } if ((Object)(object)_clip == (Object)null) { _clip = CrearSonido(); } if (Activo) { if (!_fuente.isPlaying) { _fuente.clip = _clip; _fuente.Play(); } _fuente.volume = 0.55f * num; AudioListener.volume = Mathf.Lerp(_volumenJuego, 0f, num); } else { _fuente.Stop(); AudioListener.volume = _volumenJuego; } } private static float Silencio() { switch (_fase) { case Fase.Carga: return Mathf.Clamp01(EnFase / 1.4f); case Fase.Vacio: case Fase.Salida: return 1f; case Fase.Llegada: return Mathf.Clamp01(1f - (EnFase - 0.35f) / 1.3f); default: return 0f; } } public static void ReiniciarCinematica() { if (Activo) { AudioListener.volume = _volumenJuego; _fase = Fase.Nada; } PantallaLimpia.Terminar(); } private void OnDisable() { ReiniciarCinematica(); } private void OnGUI() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Invalid comparison between Unknown and I4 //IL_0048: 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_00a9: 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_012b: Unknown result type (might be due to invalid IL or missing references) //IL_018b: 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_0201: Unknown result type (might be due to invalid IL or missing references) //IL_020b: 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_023d: Unknown result type (might be due to invalid IL or missing references) //IL_024f: 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_011b: 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_017b: 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) ((MonoBehaviour)this).useGUILayout = false; if (!Activo || (int)Event.current.type != 7) { return; } GUI.depth = -2000; Preparar(); Rect val = default(Rect); ((Rect)(ref val))..ctor(0f, 0f, (float)Screen.width, (float)Screen.height); Color color = GUI.color; float unscaledTime = Time.unscaledTime; switch (_fase) { case Fase.Carga: { float num2 = Mathf.Clamp01(EnFase / 1.4f); GUI.color = new Color(1f, 1f, 1f, Mathf.SmoothStep(0f, 1f, num2)); GUI.DrawTexture(val, (Texture)(object)_borde, (ScaleMode)0, true); DibujarMotas(num2 * 0.9f, subirDesdeAbajo: true, 0.25f + 0.6f * num2); float num3 = Mathf.Clamp01((EnFase - 1.15f) / 0.25f); if (num3 > 0f) { GUI.color = new Color(1f, 1f, 1f, num3); GUI.DrawTexture(val, (Texture)(object)Texture2D.whiteTexture); } break; } case Fase.Vacio: { DibujarVacio(val, 1f, unscaledTime, EnFase); float num4 = 1f - Mathf.Clamp01(EnFase / 0.3f); if (num4 > 0f) { GUI.color = new Color(1f, 1f, 1f, num4); GUI.DrawTexture(val, (Texture)(object)Texture2D.whiteTexture); } break; } case Fase.Salida: GUI.color = Color.white; GUI.DrawTexture(val, (Texture)(object)Texture2D.whiteTexture); _fondo?.DibujarSalida(val, EnFase, _tiempoViaje); break; case Fase.Llegada: { float num = Mathf.Clamp01((EnFase - 0.35f) / 1.3f); GUI.color = new Color(1f, 1f, 1f, 1f - Mathf.SmoothStep(0f, 1f, num)); GUI.DrawTexture(val, (Texture)(object)Texture2D.whiteTexture); GUI.color = new Color(1f, 1f, 1f, (1f - num) * 0.8f); GUI.DrawTexture(val, (Texture)(object)_borde, (ScaleMode)0, true); break; } } DibujarBandasCine(); GUI.color = color; } private static void DibujarBandasCine() { //IL_0084: 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_00c2: Unknown result type (might be due to invalid IL or missing references) float num = _fase switch { Fase.Carga => Mathf.SmoothStep(0f, 1f, Mathf.Clamp01(EnFase / 0.5f)), Fase.Llegada => 1f - Mathf.SmoothStep(0f, 1f, Mathf.Clamp01((EnFase - 0.35f - 0.52f) / 0.78000003f)), _ => 1f, }; float num2 = (float)Screen.height * 0.11f * num; if (!(num2 <= 0.5f)) { GUI.color = Color.black; GUI.DrawTexture(new Rect(0f, 0f, (float)Screen.width, num2), (Texture)(object)Texture2D.whiteTexture); GUI.DrawTexture(new Rect(0f, (float)Screen.height - num2, (float)Screen.width, num2), (Texture)(object)Texture2D.whiteTexture); } } private static float VelocidadCaida() { float num = Mathf.SmoothStep(0.15f, 1f, Mathf.Clamp01(EnFase / 1.2f)); Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer != (Object)null && !((Character)localPlayer).IsTeleporting() && EnFase >= 1.6f) { num *= 0.4f; } return num; } private static void DibujarVacio(Rect pantalla, float a, float ahora, float tiempo) { //IL_003a: 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_005a: 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_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: 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_0106: 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_012f: 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) float num = VelocidadCaida(); _recorrido += num * Mathf.Min(0.1f, ahora - _ultimo); _ultimo = ahora; GUI.color = new Color(1f, 1f, 1f, a); GUI.DrawTexture(pantalla, (Texture)(object)Texture2D.whiteTexture); _fondo?.DibujarViaje(pantalla, 1f + Mathf.Min(0.18f, _recorrido * 0.05f), tiempo); if (!FondoConEfectos) { GUI.color = new Color(0.82f, 0.84f, 0.88f, a * 0.45f); GUI.DrawTexture(pantalla, (Texture)(object)_borde, (ScaleMode)0, true); float num2 = (float)Screen.height / 1080f; for (int i = 0; i < Capas.Length; i++) { Vector2 val = Capas[i]; float num3 = Mathf.Repeat(val.x - _recorrido * 0.35f * val.y, 1.2f) - 0.1f; float num4 = (30f + 60f * val.y) * num2; GUI.color = new Color(0.86f, 0.9f, 0.97f, a * 0.16f * val.y); GUI.DrawTexture(new Rect(0f, num3 * (float)Screen.height - num4 / 2f, (float)Screen.width, num4), (Texture)(object)_borde, (ScaleMode)0, true); } DibujarMotas(a, subirDesdeAbajo: false, num); } } private static void DibujarMotas(float a, bool subirDesdeAbajo, float velocidad) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003a: 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) //IL_0046: 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_013d: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) float unscaledTime = Time.unscaledTime; float num = (float)Screen.height / 1080f; float num2 = Mathf.Sin(unscaledTime * 0.7f) * 0.012f; for (int i = 0; i < Motas.Length; i++) { Vector3 val = Motas[i]; float z = val.z; float num3 = (subirDesdeAbajo ? (1f - Mathf.Repeat(val.y + (unscaledTime - _t0) * (0.1f + 0.4f * z) * velocidad, 1f) * 0.6f) : Mathf.Repeat(val.y - _recorrido * (0.08f + 0.55f * z), 1f)); float num4 = val.x + num2 * (0.5f + z) + Mathf.Sin(unscaledTime * 0.5f + (float)i) * 0.004f; float num5 = (2.5f + 7f * z) * num; float num6 = num5 * (1f + velocidad * z * 3.5f); float num7 = (0.18f + 0.4f * z) * (0.75f + 0.25f * Mathf.Sin(unscaledTime * 3f * z + (float)i * 1.7f)); GUI.color = new Color(0.8f, 0.86f, 0.98f, a * num7); GUI.DrawTexture(new Rect(num4 * (float)Screen.width - num5 / 2f, num3 * (float)Screen.height - num6 / 2f, num5, num6), (Texture)(object)_mota, (ScaleMode)0, true); } } private static AudioClip CrearSonido() { int num = 352800; float[] array = new float[num]; float[] array2 = new float[5] { 110f, 164.81f, 220f, 277.18f, 329.63f }; Random random = new Random(7); float num2 = 0f; for (int i = 0; i < num; i++) { float num3 = (float)i / 44100f; float num4 = 0f; for (int j = 0; j < array2.Length; j++) { num4 += Mathf.Sin((float)Math.PI * 2f * array2[j] * num3) * (0.22f - (float)j * 0.03f) * (0.75f + 0.25f * Mathf.Sin((float)Math.PI * 2f * (0.11f + (float)j * 0.03f) * num3)); } float num5 = (float)(random.NextDouble() * 2.0 - 1.0); num2 += (num5 - num2) * 0.015f; float num6 = num2 * (0.6f + 0.4f * Mathf.Sin((float)Math.PI / 4f * num3)); array[i] = Mathf.Clamp(num4 * 0.5f + num6 * 0.9f, -1f, 1f); } AudioClip obj = AudioClip.Create("MT_Vacio", num, 1, 44100, false); obj.SetData(array, 0); return obj; } private static void Preparar() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown //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_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Expected O, but got Unknown //IL_00b5: 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) BuscarFondo(); if ((Object)(object)_borde == (Object)null) { _borde = new Texture2D(128, 128, (TextureFormat)4, false) { wrapMode = (TextureWrapMode)1, hideFlags = (HideFlags)61 }; for (int i = 0; i < 128; i++) { for (int j = 0; j < 128; j++) { float num = ((float)j + 0.5f) / 128f - 0.5f; float num2 = ((float)i + 0.5f) / 128f - 0.5f; float num3 = Mathf.Sqrt(num * num + num2 * num2) / 0.707f; _borde.SetPixel(j, i, new Color(1f, 1f, 1f, Mathf.SmoothStep(0f, 1f, Mathf.InverseLerp(0.45f, 1f, num3)))); } } _borde.Apply(); } if (!((Object)(object)_mota == (Object)null)) { return; } _mota = new Texture2D(32, 32, (TextureFormat)4, false) { wrapMode = (TextureWrapMode)1, hideFlags = (HideFlags)61 }; for (int k = 0; k < 32; k++) { for (int l = 0; l < 32; l++) { float num4 = ((float)l + 0.5f) / 32f - 0.5f; float num5 = ((float)k + 0.5f) / 32f - 0.5f; float num6 = Mathf.Sqrt(num4 * num4 + num5 * num5) * 2f; _mota.SetPixel(l, k, new Color(1f, 1f, 1f, Mathf.Clamp01(1f - num6) * Mathf.Clamp01(1f - num6))); } } _mota.Apply(); } } public class LuzRespira : MonoBehaviour { public float Base = 2.2f; public float Amplitud = 0.8f; public float Velocidad = 1.2f; private Light _luz; private float _fase; private float _rango; private void Awake() { _luz = ((Component)this).GetComponent<Light>(); _fase = Random.value * 6f; if ((Object)(object)_luz != (Object)null) { _rango = _luz.range; } } private void Update() { //IL_004f: 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_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) if ((Object)(object)_luz == (Object)null) { return; } if (!((Behaviour)_luz).enabled) { ((Behaviour)_luz).enabled = true; } float num = 0f; Player localPlayer = Player.m_localPlayer; if (VacioTeleport.BrilloCirculo > 0f && (Object)(object)localPlayer != (Object)null) { Vector3 val = ((Component)localPlayer).transform.position - ((Component)this).transform.position; if (((Vector3)(ref val)).sqrMagnitude < 64f) { num = VacioTeleport.BrilloCirculo; } } _luz.intensity = (Base + Amplitud * Mathf.Sin(Time.time * Velocidad + _fase)) * (1f + 4f * num); _luz.range = _rango * (1f + 0.8f * num); } } [HarmonyPatch(typeof(Hud), "UpdateBlackScreen")] public static class HudSinTunelPatch { private static readonly FieldRef<Hud, CanvasGroup> Pantalla = AccessTools.FieldRefAccess<Hud, CanvasGroup>("m_loadingScreen"); private static readonly FieldRef<Hud, GameObject> Tunel = AccessTools.FieldRefAccess<Hud, GameObject>("m_teleportingProgress"); private static bool Prefix(Hud __instance) { if (!VacioTeleport.Activo) { return true; } CanvasGroup val = Pantalla.Invoke(__instance); if ((Object)(object)val != (Object)null) { val.alpha = 0f; } GameObject val2 = Tunel.Invoke(__instance); if ((Object)(object)val2 != (Object)null && val2.activeSelf) { val2.SetActive(false); } return false; } } [HarmonyPatch(typeof(Player), "TakeInput")] public static class JugadorQuietoPatch { private static void Postfix(ref bool __result) { if (VacioTeleport.Activo) { __result = false; } } } [HarmonyPatch(typeof(Player), "OnDeath")] public static class VacioMuertePatch { private static void Prefix(Player __instance) { if ((Object)(object)__instance == (Object)(object)Player.m_localPlayer) { VacioTeleport.ReiniciarCinematica(); } } } [HarmonyPatch(typeof(Player), "OnSpawned")] public static class VacioSpawnPatch { private static void Postfix(Player __instance) { if ((Object)(object)__instance == (Object)(object)Player.m_localPlayer) { VacioTeleport.ReiniciarCinematica(); } } } public static class Iconos { private static readonly IconosEmbebidos Recursos = new IconosEmbebidos(typeof(Iconos).Assembly, "MT.Teletransporte"); public static Sprite Get(string nombre) { return Recursos.Get(nombre); } public static Texture2D Textura(string recurso) { return Recursos.Textura(recurso); } public static byte[] Bytes(string recurso) { return Recursos.Bytes(recurso); } } public static class ModeloCirculo { private const string Nombre = "circulo_teletransporte"; public const float Diametro = 4f; private static readonly Color Runas = new Color(0.45f, 0.85f, 1f); public static bool Aplicar(GameObject prefab) { //IL_0030: 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_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_0057: 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_006f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)ModeloEmbebido.PonerEnPieza(typeof(ModeloCirculo).Assembly, prefab, "circulo_teletransporte", 4f, false, false) == (Object)null) { return false; } GameObject val = new GameObject("MT_Circulo_Luz"); val.transform.SetParent(prefab.transform, false); val.transform.localPosition = Vector3.up * 0.8f; Light obj = val.AddComponent<Light>(); obj.type = (LightType)2; obj.color = Runas; obj.range = 9f; obj.intensity = 2.2f; obj.shadows = (LightShadows)0; val.AddComponent<LuzRespira>(); return true; } public static bool PonerEnObjeto(GameObject prefab, string nombre) { return (Object)(object)ModeloEmbebido.PonerEnObjeto(typeof(ModeloCirculo).Assembly, prefab, nombre) != (Object)null; } } [NetworkCompatibility(/*Could not decode attribute arguments.*/)] [BepInPlugin("mushokutensei.teletransporte", "MT Teletransporte", "1.5.11")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency("mushokutensei.core", "2.99.67")] public class MTTeletransportePlugin : BaseUnityPlugin { public const string Guid = "mushokutensei.teletransporte"; public const string Name = "MT Teletransporte"; public const string Version = "1.5.11"; public static ConfigEntry<bool> CirculoConstruible; public static ConfigEntry<bool> CirculosEnElMundo; public static ConfigEntry<int> PrecioPergamino; private void Awake() { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Expected O, but got Unknown CirculoConstruible = ((BaseUnityPlugin)this).Config.Bind<bool>("Circles", "Buildable", true, "Teleport circle in the hammer (testing). false = only the ancient circles of the world and guild camps. Restart to apply."); CirculosEnElMundo = ((BaseUnityPlugin)this).Config.Bind<bool>("Circles", "AncientCirclesInWorld", true, "Place ancient teleport circles across the world (dry flat land only, never sea or water). Server decides."); PrecioPergamino = ((BaseUnityPlugin)this).Config.Bind<int>("Scroll", "TraderPrice", 60, new ConfigDescription("Gold price of the teleport scroll at Valheim traders (Haldor, Hildir...).", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 999), Array.Empty<object>())); Tr.Load(typeof(MTTeletransportePlugin).Assembly, Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location)); ((Component)this).gameObject.AddComponent<VacioTeleport>(); ((Component)this).gameObject.AddComponent<VentanaDestinosCirculo>(); ((Component)this).gameObject.AddComponent<ColocadorCirculos>(); Circulos.RegistrarBuscador((Func<Vector3, float, ICirculoMundo>)CirculoTeletransporte.Cercano); Parches.Aplicar("mushokutensei.teletransporte", typeof(MTTeletransportePlugin).Assembly, ((BaseUnityPlugin)this).Logger); PrefabManager.OnVanillaPrefabsAvailable += OnPrefabsAvailable; CommandManager.Instance.AddConsoleCommand((ConsoleCommand)(object)new CirculoTpCommand()); CommandManager.Instance.AddConsoleCommand((ConsoleCommand)(object)new CirculosCommand()); Debug.Log((object)"[MT.Teletransporte] MT Teletransporte v1.5.11 cargado."); } private void OnPrefabsAvailable() { PrefabManager.OnVanillaPrefabsAvailable -= OnPrefabsAvailable; RegistroCirculos.Registrar(CirculoConstruible.Value); PergaminoTeletransporte.Register(); } } public class CirculoTpCommand : ConsoleCommand { public override string Name => "mt_circulo_tp"; public override bool IsCheat => true; public override string Help => "Travel (with your party) to the first activated teleport circle"; public override void Run(string[] args) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { return; } List<DestinoCirculo> list = RedCirculos.ObtenerDestinos(localPlayer, ((Component)localPlayer).transform.position); if (list.Count == 0) { Console instance = Console.instance; if (instance != null) { instance.Print("No activated teleport circles."); } } else { ViajeGrupo.Viajar(localPlayer, list[0].GetSpawnPoint(), list[0].Rotacion); } } } public class ColocadorCirculos : MonoBehaviour { private const float Cada = 10f; private const float DistanciaSitio = 120f; private const float RadioBase = 30f; private float _siguiente; private long? _cachedWorld; private readonly HashSet<long> _vacias = new HashSet<long>(); private readonly List<Vector3> _posiciones = new List<Vector3>(16); private readonly List<Vector3> _sitios = new List<Vector3>(32); public static readonly RequisitosSitio Requisitos = new RequisitosSitio { Bioma = (Biome b) => (int)b == 1 || (int)b == 8 || (int)b == 2 || (int)b == 4 || (int)b == 16 || (int)b == 512, Huella = 7f, SobreAguaCentro = 3f, SobreAguaBorde = 2f, Desnivel = 1.5f }; private void Update() { //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) if (Time.time < _siguiente) { return; } _siguiente = Time.time + 10f; ConfigEntry<bool> circulosEnElMundo = MTTeletransportePlugin.CirculosEnElMundo; if (circulosEnElMundo != null && !circulosEnElMundo.Value) { return; } ZNet instance = ZNet.instance; if ((Object)(object)instance == (Object)null || !instance.IsServer() || (Object)(object)ZoneSystem.instance == (Object)null || (Object)(object)ZNetScene.instance == (Object)null || WorldGenerator.instance == null) { return; } _posiciones.Clear(); if ((Object)(object)Player.m_localPlayer != (Object)null) { _posiciones.Add(((Component)Player.m_localPlayer).transform.position); } List<ZNetPeer> peers = instance.GetPeers(); for (int i = 0; i < peers.Count; i++) { if (peers[i] != null) { _posiciones.Add(peers[i].m_refPos); } } long worldUID = instance.GetWorldUID(); if (_cachedWorld != worldUID) { _vacias.Clear(); _cachedWorld = worldUID; } for (int j = 0; j < _posiciones.Count; j++) { Revisar(worldUID, _posiciones[j]); } } private void Revisar(long mundo, Vector3 jugador) { //IL_0000: 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_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) int num = RedCirculosRules.Celda(CeldasRules.Zona(jugador.x)); int num2 = RedCirculosRules.Celda(CeldasRules.Zona(jugador.z)); ReviewCell(mundo, jugador, num, num2); if (!RedCirculosRules.EsInicio(num, num2) && num >= -1 && num <= 1 && num2 >= -1 && num2 <= 1) { ReviewCell(mundo, jugador, 0, 0); } } private void ReviewCell(long mundo, Vector3 jugador, int cx, int cy) { //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0084: 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_0091: 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_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_00b3: 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_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) long num = ((long)cx << 32) ^ (uint)cy; if (_vacias.Contains(num)) { return; } string text = RedCirculosRules.ClaveCelda(cx, cy); if (ZoneSystem.instance.GetGlobalKey(text)) { return; } if (!RedCirculosRules.TieneCirculo(mundo, cx, cy)) { _vacias.Add(num); return; } Sitios(mundo, cx, cy, _sitios); if (_sitios.Count == 0) { _vacias.Add(num); return; } for (int i = 0; i < _sitios.Count; i++) { Vector3 val = _sitios[i]; Vector2 val2 = new Vector2(jugador.x - val.x, jugador.z - val.z); if (!(((Vector2)(ref val2)).sqrMagnitude > 14400f) && !SitiosTerreno.HayBase(val, 30f) && !Location.IsInsideNoBuildLocation(val) && !EscudoGremio.Protege(val)) { if (Poner(val, mundo, cx, cy, num)) { ZoneSystem.instance.SetGlobalKey(text); } break; } } } public static void Sitios(long mundo, int cx, int cy, List<Vector3> lista) { lista.Clear(); RedCirculosRules.ZonaElegida(mundo, cx, cy, out var zx, out var zy); SitiosTerreno.Probar(zx, zy, 2, 10f, Requisitos, lista); for (int i = -1; i <= 1; i++) { if (lista.Count != 0) { break; } for (int j = -1; j <= 1; j++) { if (lista.Count != 0) { break; } if (i != 0 || j != 0) { SitiosTerreno.Probar(zx + i, zy + j, 1, 20f, Requisitos, lista); } } } } private static bool Poner(Vector3 sitio, long mundo, int cx, int cy, long celda) { //IL_0122: 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_0139: 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_0148: 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_0037: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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) float num = (float)((mundo ^ celda) & 0xFFFF) % 360f; List<PiezaPlano> list = RuinasCirculo.Preparar(mundo, cx, cy, RedCirculosRules.EsDelGremio(mundo, cx, cy)); if (list != null) { for (int i = 0; i < list.Count; i++) { GameObject prefab = ZNetScene.instance.GetPrefab(list[i].Nombre); if ((Object)(object)prefab == (Object)null || (Object)(object)prefab.GetComponent<ZNetView>() == (Object)null) { return false; } } float num2 = PlanoRules.Radio(list); SitiosTerreno.Alisar(sitio, num2 + 0.5f, num2 + 6f, 0f); int num4 = default(int); int num3 = Planos.Colocar(list, sitio, num, 0L, false, true, ref num4); if (num4 != 0 || num3 < list.Count) { return false; } Debug.Log((object)("[MT.Teletransporte] Círculo antiguo con ruina en " + ((Vector3)(ref sitio)).ToString("0") + " (" + num3 + " piezas).")); return true; } GameObject prefab2 = ZNetScene.instance.GetPrefab("MT_CirculoAntiguo"); if ((Object)(object)prefab2 == (Object)null || (Object)(object)prefab2.GetComponent<ZNetView>() == (Object)null) { return false; } SitiosTerreno.Alisar(sitio, 3.2f, 9f, 2.6f); GameObject val = Object.Instantiate<GameObject>(prefab2, sitio + Vector3.up * 0.05f, Quaternion.Euler(0f, num, 0f)); ZNetView val2 = (((Object)(object)val != (Object)null) ? val.GetComponent<ZNetView>() : null); if ((Object)(object)val2 == (Object)null || !val2.IsValid()) { return false; } Debug.Log((object)("[MT.Teletransporte] Círculo antiguo en " + ((Vector3)(ref sitio)).ToString("0") + ".")); return true; } } public class CirculosCommand : ConsoleCommand { public override string Name => "mt_circulos"; public override string Help => "Ancient teleport circles: whether your 1 km cell has one and where"; public override void Run(string[] args) { //IL_002e: 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_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_00e7: 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) Player localPlayer = Player.m_localPlayer; if (!((Object)(object)localPlayer == (Object)null) && !((Object)(object)ZNet.instance == (Object)null)) { long worldUID = ZNet.instance.GetWorldUID(); int cx = RedCirculosRules.Celda(CeldasRules.Zona(((Component)localPlayer).transform.position.x)); int cy = RedCirculosRules.Celda(CeldasRules.Zona(((Component)localPlayer).transform.position.z)); List<Vector3> list = new List<Vector3>(); bool num = RedCirculosRules.TieneCirculo(worldUID, cx, cy); if (num) { ColocadorCirculos.Sitios(worldUID, cx, cy, list); } bool flag = (Object)(object)ZoneSystem.instance != (Object)null && ZoneSystem.instance.GetGlobalKey(RedCirculosRules.ClaveCelda(cx, cy)); string text = ((!num) ? "no circle (try a neighbouring cell)" : ((list.Count == 0) ? "no circle: no dry flat ground in that zone" : ("circle near " + list[0].x.ToString("0") + ", " + list[0].z.ToString("0") + (RedCirculosRules.EsDelGremio(worldUID, cx, cy) ? " (guild)" : " (free)") + (flag ? " - placed" : " - not placed yet: get close")))); Console.instance.Print("Cell " + cx + "," + cy + ": " + text); } } } public static class RedCirculosRules { public const int ZonasPorCelda = 16; public const int UnaDeCada = 5; public const int GremioDeCadaDiez = 4; private const int SalCelda = 11; private const int SalZona = 12; private const int SalDueno = 13; private const int SalNombre = 14; private const int Margen = 2; public static readonly string[] Runas = new string[24] { "Fehu", "Uruz", "Thurisaz", "Ansuz", "Raidho", "Kenaz", "Gebo", "Wunjo", "Hagalaz", "Naudiz", "Isa", "Jera", "Eihwaz", "Perthro", "Algiz", "Sowilo", "Tiwaz", "Berkano", "Ehwaz", "Mannaz", "Laguz", "Ingwaz", "Dagaz", "Othala" }; public const int PiedrasQuitadasDeCada100 = 15; public const float AlturaPiedraSuelta = 0.5f; public static int Celda(int zona) { return CeldasRules.Celda(zona, 16); } public static bool EsInicio(int cx, int cy) { if (cx == 0) { return cy == 0; } return false; } public static bool TieneCirculo(long mundo, int cx, int cy) { if (!EsInicio(cx, cy)) { return CeldasRules.Toca(mundo, cx, cy, 11, 5); } return true; } public static void ZonaElegida(long mundo, int cx, int cy, out int zx, out int zy) { CeldasRules.Zona(mundo, cx, cy, 12, 16, 2, ref zx, ref zy); if (EsInicio(cx, cy)) { ulong num = CeldasRules.Mezcla(mundo, cx, cy, 12); int num2 = 3 + (int)(num % 3); int num3 = (int)((num >> 8) % 4); zx = num3 switch { 1 => -num2, 0 => num2, _ => (int)((num >> 16) % 3) - 1, }; zy = num3 switch { 3 => -num2, 2 => num2, _ => (int)((num >> 24) % 3) - 1, }; } } public static bool EsDelGremio(long mundo, int cx, int cy) { if (!EsInicio(cx, cy)) { return CeldasRules.Mezcla(mundo, cx, cy, 13) % 10 < 4; } return false; } public static string Runa(long mundo, int cx, int cy) { return Runas[(uint)(CeldasRules.Mezcla(mundo, cx, cy, 14) % (ulong)Runas.Length)]; } public static int Ruina(long mundo, int cx, int cy, int cuantas) { if (cuantas > 0) { return (int)(CeldasRules.Mezcla(mundo, cx, cy, 15) % (ulong)cuantas); } return -1; } public static bool QuitarPiedra(long mundo, int cx, int cy, int indice, float alturaPieza) { if (alturaPieza > 0.5f) { return CeldasRules.Mezcla(mundo, cx, cy, 1000 + indice) % 100 < 15; } return false; } public static string ClaveCelda(int cx, int cy) { return "mt_circulo_c_" + cx + "_" + cy; } } public static class RuinasCirculo { private const string Templo = "templo"; private static readonly CatalogoPlanos Catalogo = new CatalogoPlanos(typeof(RuinasCirculo).Assembly, "PlanosCirculos", "circulos"); public static List<PiezaPlano> Preparar(long mundo, int cx, int cy, bool delGremio) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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_005f: 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) List<int> list = Candidatos(delGremio); int num = RedCirculosRules.Ruina(mundo, cx, cy, list.Count); List<PiezaPlano> list2 = ((num >= 0) ? Catalogo.Cargar(list[num]) : null); if (list2 == null) { return null; } bool flag = false; for (int num2 = list2.Count - 1; num2 >= 0; num2--) { PiezaPlano val = list2[num2]; if (val.Nombre == "MT_PortalGremio" || val.Nombre == "MT_CirculoAntiguo") { val.Nombre = "MT_CirculoAntiguo"; list2[num2] = val; flag = true; } else if (!delGremio && RedCirculosRules.QuitarPiedra(mundo, cx, cy, num2, val.Py)) { list2.RemoveAt(num2); } } if (!flag) { return null; } return list2; } private static List<int> Candidatos(bool delGremio) { List<string> list = Catalogo.Nombres(); List<int> list2 = new List<int>(); for (int i = 0; i < list.Count; i++) { if (list[i].ToLowerInvariant().Contains("templo") == delGremio) { list2.Add(i); } } if (list2.Count == 0) { for (int j = 0; j < list.Count; j++) { list2.Add(j); } } return list2; } } [HarmonyPatch(typeof(Trader), "Start")] public static class PergaminoEnMercaderes { private static void Postfix(Trader __instance) { //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_0094: 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_00c2: Expected O, but got Unknown if ((Object)(object)__instance == (Object)null || (Object)(object)ObjectDB.instance == (Object)null) { return; } GameObject itemPrefab = ObjectDB.instance.GetItemPrefab("MT_PergaminoGremio"); ItemDrop val = (((Object)(object)itemPrefab != (Object)null) ? itemPrefab.GetComponent<ItemDrop>() : null); if ((Object)(object)val == (Object)null) { return; } for (int i = 0; i < __instance.m_items.Count; i++) { if ((Object)(object)__instance.m_items[i]?.m_prefab == (Object)(object)val) { return; } } __instance.m_items.Add(new TradeItem { m_prefab = val, m_stack = 1, m_price = Mathf.Max(1, MTTeletransportePlugin.PrecioPergamino?.Value ?? 60), m_requiredGlobalKey = "" }); } } public static class PergaminoTeletransporte { public const string PrefabName = "MT_PergaminoGremio"; private const string NameKey = "tele_pergamino"; public static bool Es(ItemData item) { if (item != null) { GameObject dropPrefab = item.m_dropPrefab; if (!(((dropPrefab != null) ? ((Object)dropPrefab).name : null) == "MT_PergaminoGremio")) { if (item.m_shared != null) { return item.m_shared.m_name == Tr.Token("tele_pergamino"); } return false; } return true; } return false; } private static void PonerModelo(GameObject prefab) { ModeloCirculo.PonerEnObjeto(prefab, "pergamino_teletransporte"); } public static bool Usar(Player player, ItemData item, Inventory inv) { if ((Object)(object)player == (Object)null || (Object)(object)player != (Object)(object)Player.m_localPlayer) { return false; } if (RedCirculos.ObtenerDestinos(player).Count == 0) { ((Character)player).Message((MessageType)2, Tr.Get("tele_pergamino_no_destinations"), 0, (Sprite)null, false); return false; } VentanaDestinosCirculo.Abrir(VentanaDestinosCirculo.ModoApertura.Pergamino, item, inv); return true; } public static void Register() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown //IL_0076: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)PrefabManager.Instance.GetPrefab("Resin") == (Object)null)) { CustomItem val = new CustomItem("MT_PergaminoGremio", "Resin", new ItemConfig { Name = Tr.Token("tele_pergamino"), Description = Tr.Token("tele_pergamino_d"), Icon = Iconos.Get("pergamino_teletransporte"), Amount = 1 }); SharedData shared = val.ItemDrop.m_itemData.m_shared; shared.m_itemType = (ItemType)2; shared.m_maxStackSize = 10; shared.m_weight = 0.2f; PonerModelo(val.ItemPrefab); ItemManager.Instance.AddItem(val); ValorObjeto.Fijar("MT_PergaminoGremio", (float)MTTeletransportePlugin.PrecioPergamino.Value); } } } [HarmonyPatch(typeof(Humanoid), "UseItem")] public static class PergaminoTeletransporteUsoPatch { private static bool Prefix(Humanoid __instance, Inventory __0, ItemData __1) { if (__1 == null || !PergaminoTeletransporte.Es(__1)) { return true; } Player val = (Player)(object)((__instance is Player) ? __instance : null); if (val == null || (Object)(object)val != (Object)(object)Player.m_localPlayer) { return false; } PergaminoTeletransporte.Usar(val, __1, __0 ?? ((Humanoid)val).GetInventory()); return false; } } public class CirculoTeletransporte : MonoBehaviour, Interactable, Hoverable, ICirculoMundo { private const string ZdoDueno = "mt_circulo_dueno"; private const string ZdoVendedor = "mt_circulo_vendedor"; private const float RadioMismoCirculo = 6f; public bool Antiguo; private static readonly List<CirculoTeletransporte> Cargados = new List<CirculoTeletransporte>(); private ZNetView _nview; private Piece _pieza; private const string ZdoAnunciado = "mt_circulo_anunciado"; public Vector3 Posicion => ((Component)this).transform.position; public bool DelMundo => Antiguo; public long Vendedor { get { ZDO obj = Zdo(); if (obj == null) { return 0L; } return obj.GetLong("mt_circulo_vendedor", 0L); } } public DuenoCirculo Dueno { get { //IL_0035: Unknown result type (might be due to invalid IL or missing references) ZDO obj = Zdo(); int num = ((obj != null) ? obj.GetInt("mt_circulo_dueno", -1) : (-1)); if (num < 0 || !Enum.IsDefined(typeof(DuenoCirculo), num)) { return DuenoAlAparecer(); } return (DuenoCirculo)num; } } private void Awake() { _nview = ((Component)this).GetComponent<ZNetView>(); _pieza = ((Component)this).GetComponent<Piece>(); WearNTear component = ((Component)this).GetComponent<WearNTear>(); if ((Object)(object)component != (Object)null) { component.m_onDestroyed = (Action)Delegate.Combine(component.m_onDestroyed, new Action(AlRomperse)); } } private void OnEnable() { if (!Cargados.Contains(this)) { Cargados.Add(this); } } private void OnDisable() { Cargados.Remove(this); } private void Start() { //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) FijarDuenoInicial(); Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer != (Object)null) { RedCirculos.ActualizarDueno(localPlayer, ((Component)this).transform.position, Dueno, Vendedor); } } private void FijarDuenoInicial() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected I4, but got Unknown ZDO val = Zdo(); if (val != null && _nview.IsOwner() && val.GetInt("mt_circulo_dueno", -1) < 0) { val.Set("mt_circulo_dueno", (int)DuenoAlAparecer()); } } private DuenoCirculo DuenoAlAparecer() { if (Antiguo) { Celda(out var cx, out var cy); if (RedCirculosRules.EsDelGremio(Mundo(), cx, cy)) { return (DuenoCirculo)2; } return (DuenoCirculo)1; } if (EsDeCampamento()) { return (DuenoCirculo)2; } return (DuenoCirculo)0; } private void AlRomperse() { //IL_0001: 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) if ((int)Dueno == 0) { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer != (Object)null) { RedCirculos.Olvidar(localPlayer, ((Component)this).transform.position, 4f); } } } public bool ActivadoPor(Player p) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) return RedCirculos.Activado(p, ((Component)this).transform.position); } public bool Vender(Player vendedor) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Invalid comparison between Unknown and I4 //IL_0058: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)vendedor == (Object)null || !Antiguo || (int)Dueno != 1 || !ActivadoPor(vendedor)) { return false; } if (!Reclamar()) { return false; } ZDO obj = Zdo(); obj.Set("mt_circulo_dueno", 2); obj.Set("mt_circulo_vendedor", vendedor.GetPlayerID()); RedCirculos.ActualizarDueno(vendedor, ((Component)this).transform.position, (DuenoCirculo)2, vendedor.GetPlayerID()); return true; } public bool Liberar(long vendedor) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Invalid comparison between Unknown and I4 //IL_005b: Unknown result type (might be due to invalid IL or missing references) if (!Antiguo || (int)Dueno != 2 || vendedor == 0L || Vendedor != vendedor || !Reclamar()) { return false; } ZDO obj = Zdo(); obj.Set("mt_circulo_dueno", 1); obj.Set("mt_circulo_vendedor", 0L); Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer != (Object)null) { RedCirculos.ActualizarDueno(localPlayer, ((Component)this).transform.position, (DuenoCirculo)1, 0L); } return true; } public static ICirculoMundo Cercano(Vector3 pos, float radio) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_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) CirculoTeletransporte result = null; float num = radio * radio; for (int i = 0; i < Cargados.Count; i++) { CirculoTeletransporte circuloTeletransporte = Cargados[i]; if (!((Object)(object)circuloTeletransporte == (Object)null)) { Vector3 val = ((Component)circuloTeletransporte).transform.position - pos; float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude; if (sqrMagnitude <= num) { num = sqrMagnitude; result = circuloTeletransporte; } } } return (ICirculoMundo)(object)result; } public bool Interact(Humanoid user, bool hold, bool alt) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (!hold) { Player val = (Player)(object)((user is Player) ? user : null); if (val != null) { if (!ActivadoPor(val)) { Activar(val); return true; } if (RedCirculos.ObtenerDestinos(val, ((Component)this).transform.position).Count == 0) { ((Character)val).Message((MessageType)2, Tr.Get("tele_circulo_no_destinations"), 0, (Sprite)null, false); return false; } VentanaDestinosCirculo.Abrir(VentanaDestinosCirculo.ModoApertura.Circulo); return true; } } return false; } private void Activar(Player p) { //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_0036: 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_0078: Unknown result type (might be due to invalid IL or missing references) string nombrePersonalizado = null; if (Antiguo) { Celda(out var cx, out var cy); nombrePersonalizado = Tr.Get("tele_circulo_nombre_runa", new object[2] { RedCirculosRules.Runa(Mundo(), cx, cy), RedCirculos.ObtenerNombreBioma(RedCirculos.ObtenerBioma(((Component)this).transform.position)) }); } RedCirculos.Registrar(p, ((Component)this).transform.position, ((Component)this).transform.rotation, EsDeCampamento() && !Antiguo, Dueno, Vendedor, nombrePersonalizado); if (Antiguo) { AnunciarDescubrimiento(p); } } private void AnunciarDescubrimiento(Player p) { //IL_0051: 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_0062: 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_007e: 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) ZNetView component = ((Component)this).GetComponent<ZNetView>(); if (!((Object)(object)component == (Object)null) && component.IsValid() && !component.GetZDO().GetBool("mt_circulo_anunciado", false)) { if (!component.IsOwner()) { component.ClaimOwnership(); } component.GetZDO().Set("mt_circulo_anunciado", true); Vector3 position = ((Component)this).transform.position; CultureInfo invariantCulture = CultureInfo.InvariantCulture; Noticias.Pedir("circulo", ((object)RedCirculos.ObtenerBioma(position)/*cast due to .constrained prefix*/).ToString(), Mathf.RoundToInt(position.x).ToString(invariantCulture) + ":" + Mathf.RoundToInt(position.z).ToString(invariantCulture) + ":" + p.GetPlayerName()); } } public bool UseItem(Humanoid user, ItemData item) { if (item != null && PergaminoTeletransporte.Es(item)) { Player val = (Player)(object)((user is Player) ? user : null); if (val != null) { return PergaminoTeletransporte.Usar(val, item, ((Humanoid)val).GetInventory()); } } return false; } public string GetHoverText() { //IL_0027: 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) Player localPlayer = Player.m_localPlayer; string text = "[<color=yellow><b>" + TeclasHover.Usar + "</b></color>] "; string text2 = Tr.Get("tele_circulo_name"); string text3 = TextoDueno(Dueno, Vendedor, localPlayer); if (text3.Length > 0) { text2 = text2 + "\n" + text3; } if ((Object)(object)localPlayer == (Object)null || !ActivadoPor(localPlayer)) { return text2 + "\n<color=#FF9900>" + Tr.Get("tele_circulo_sin_activar") + "</color>\n" + text + Tr.Get("tele_circulo_activar"); } int count = RedCirculos.ObtenerDestinos(localPlayer, ((Component)this).transform.position).Count; return text2 + "\n<color=#00FFCC>" + count + " " + Tr.Get("tele_circulo_destinations_active") + "</color>\n" + text + Tr.Get("tele_circulo_open_menu"); } public static string TextoDueno(DuenoCirculo dueno, long vendedor, Player p) { //IL_0007: 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 if (Circulos.Peaje == null || (int)dueno == 0) { return ""; } if ((int)dueno == 1) { return "<color=#9FD38A>" + Tr.Get("tele_dueno_libre") + "</color>"; } if ((Object)(object)p != (Object)null && vendedor != 0L && vendedor == p.GetPlayerID()) { return "<color=#FFD24A>" + Tr.Get("tele_dueno_vendido_tuyo") + "</color>"; } return "<color=#FFD24A>" + Tr.Get("tele_dueno_gremio") + "</color>"; } public string GetHoverName() { return Tr.Get("tele_circulo_name"); } public float GetHoverOffset() { return 2f; } private ZDO Zdo() { if (!((Object)(object)_nview != (Object)null) || !_nview.IsValid()) { return null; } return _nview.GetZDO(); } private bool Reclamar() { if (Zdo() == null) { return false; } if (!_nview.IsOwner()) { _nview.ClaimOwnership(); } return _nview.IsOwner(); } private bool EsDeCampamento() { if (!Antiguo) { if (!((Object)(object)_pieza == (Object)null)) { return _pieza.GetCreator() == 0; } return true; } return false; } private void Celda(out int cx, out int cy) { //IL_0007: 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) cx = RedCirculosRules.Celda(CeldasRules.Zona(((Component)this).transform.position.x)); cy = RedCirculosRules.Celda(CeldasRules.Zona(((Component)this).transform.position.z)); } private static long Mundo() { if (!((Object)(object)ZNet.instance != (Object)null)) { return 0L; } return ZNet.instance.GetWorldUID(); } } public static class RegistroCirculos { private const string TipoMapa = "gremio_circulo"; public static void Registrar(bool construible) { GameObject prefab = PrefabManager.Instance.GetPrefab("stone_floor_2x2"); if ((Object)(object)prefab == (Object)null) { Debug.LogWarning((object)"[MT.Teletransporte] Falta stone_floor_2x2: no hay círculos."); return; } LugaresMapa.Registrar("gremio_circulo", (Func<Sprite>)(() => Iconos.Get("mapa_circulo")), "tele_circulo_name", "tele_circulo_mapa", (Func<Player, Vector3, bool>)RedCirculos.Activado); if (construible) { RegistrarConstruible(prefab); } else { RegistrarSinMartillo("MT_PortalGremio", prefab); } RegistrarAntiguo(); } private static void RegistrarConstruible(GameObject basePrefab) { //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_0015: 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_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Expected O, but got Unknown //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Expected O, but got Unknown //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Expected O, but got Unknown PieceConfig val = new PieceConfig { Name = Tr.Token("tele_circulo_name"), Description = Tr.Token("tele_circulo_desc"), Icon = Iconos.Get("portal_gremio"), PieceTable = "_HammerPieceTable", Category = ((object)(PieceCategory)0/*cast due to .constrained prefix*/).ToString() }; val.AddRequirement(new RequirementConfig("Stone", 20, 0, true)); val.AddRequirement(new RequirementConfig("FineWood", 20, 0, true)); val.AddRequirement(new RequirementConfig("GreydwarfEye", 10, 0, true)); val.AddRequirement(new RequirementConfig("SurtlingCore", 2, 0, true)); CustomPiece val2 = new CustomPiece("MT_PortalGremio", ((Object)basePrefab).name, val); if (!((Object)(object)val2.PiecePrefab == (Object)null)) { Preparar(val2.PiecePrefab, antiguo: false); PieceManager.Instance.AddPiece(val2); } } private static void RegistrarSinMartillo(string nombre, GameObject basePrefab) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown GameObject val = PrefabManager.Instance.CreateClonedPrefab(nombre, basePrefab); if (!((Object)(object)val == (Object)null)) { Piece component = val.GetComponent<Piece>(); if ((Object)(object)component != (Object)null) { component.m_name = Tr.Token("tele_circulo_name"); component.m_description = Tr.Token("tele_circulo_desc"); } Preparar(val, antiguo: false); PrefabManager.Instance.AddPrefab(new CustomPrefab(val, true)); } } private static void RegistrarAntiguo() { //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Expected O, but got Unknown GameObject prefab = PrefabManager.Instance.GetPrefab("stone_floor_2x2"); GameObject val = PrefabManager.Instance.CreateClonedPrefab("MT_CirculoAntiguo", prefab); if (!((Object)(object)val == (Object)null)) { WearNTear component = val.GetComponent<WearNTear>(); if ((Object)(object)component != (Object)null) { Object.DestroyImmediate((Object)(object)component); } Piece component2 = val.GetComponent<Piece>(); if ((Object)(object)component2 != (Object)null) { component2.m_name = Tr.Token("tele_circulo_name"); component2.m_description = Tr.Token("tele_circulo_desc"); component2.m_canBeRemoved = false; } Preparar(val, antiguo: true); PrefabManager.Instance.AddPrefab(new CustomPrefab(val, true)); } } private static void Preparar(GameObject go, bool antiguo) { TeleportWorld component = go.GetComponent<TeleportWorld>(); if ((Object)(object)component != (Object)null) { Object.DestroyImmediate((Object)(object)component); } ModeloCirculo.Aplicar(go); go.AddComponent<LugarMarcable>().Tipo = "gremio_circulo"; (go.GetComponent<CirculoTeletransporte>() ?? go.AddComponent<CirculoTeletransporte>()).Antiguo = antiguo; } } public class DestinoCirculo { public string Id; public Vector3 Posicion; public Quaternion Rotacion; public string Nombre; public Biome Bioma; public bool EsCampamento; public DuenoCirculo Dueno; public long Vendedor; public Vector3 GetSpawnPoint() { //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_0010: 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 Posicion + Vector3.up * 0.3f; } } public static class RedCirculos { public const string ClaveCustomData = "MT.Gremio.Circulos"; private const string ClaveCoreLugares = "MT.Core.Lugares"; private const string ClaveMigrado = "MT.Gremio.Circulos.migrado"; private const float DistanciaMismoCirculo = 6f; private static readonly List<DestinoCirculo> _destinosEnMemoria = new List<DestinoCirculo>(); private static string _ultimoCacheTexto = null; public static List<DestinoCirculo> ObtenerDestinos(Player p, Vector3? excluirCercaDe = null, float radioExcluir = 6f) { //IL_0038: 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_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) List<DestinoCirculo> list = new List<DestinoCirculo>(); if ((Object)(object)p == (Object)null) { return list; } AsegurarCargado(p); float num = radioExcluir * radioExcluir; for (int i = 0; i < _destinosEnMemoria.Count; i++) { DestinoCirculo destinoCirculo = _destinosEnMemoria[i]; if (destinoCirculo == null) { continue; } if (excluirCercaDe.HasValue) { Vector3 val = destinoCirculo.Posicion - excluirCercaDe.Value; val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude < num) { continue; } } list.Add(destinoCirculo); } return list; } public static bool Activado(Player p, Vector3 pos) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return Buscar(p, pos) != null; } private static DestinoCirculo Buscar(Player p, Vector3 pos) { //IL_0037: 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_0042: 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) if ((Object)(object)p == (Object)null) { return null; } AsegurarCargado(p); for (int i = 0; i < _destinosEnMemoria.Count; i++) { DestinoCirculo destinoCirculo = _destinosEnMemoria[i]; if (Vector2.Distance(new Vector2(destinoCirculo.Posicion.x, destinoCirculo.Posicion.z), new Vector2(pos.x, pos.z)) < 6f) { return destinoCirculo; } } return null; } public static void ActualizarDueno(Player p, Vector3 pos, DuenoCirculo dueno, long vendedor) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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) DestinoCirculo destinoCirculo = Buscar(p, pos); if (destinoCirculo != null && (destinoCirculo.Dueno != dueno || destinoCirculo.Vendedor != vendedor)) { destinoCirculo.Dueno = dueno; destinoCirculo.Vendedor = vendedor; Guardar(p); } } public static bool Registrar(Player p, Vector3 pos, Quaternion rot, bool esCampamento, DuenoCirculo dueno, long vendedor, string nombrePersonalizado = null) { //IL_0011: 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_0090: 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_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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_0065: 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_00a0: 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) //IL_0121: 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_0128: 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_0136: 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_0145: 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_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_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: 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_00ce: 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_00ff: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)p == (Object)null) { return false; } AsegurarCargado(p); string text = GenerarId(pos); DestinoCirculo destinoCirculo = null; for (int i = 0; i < _destinosEnMemoria.Count; i++) { DestinoCirculo destinoCirculo2 = _destinosEnMemoria[i]; if (destinoCirculo2.Id == text || Vector2.Distance(new Vector2(destinoCirculo2.Posicion.x, destinoCirculo2.Posicion.z), new Vector2(pos.x, pos.z)) < 6f) { destinoCirculo = destinoCirculo2; break; } } Biome bioma = ObtenerBioma(pos); string nombre = ((!string.IsNullOrEmpty(nombrePersonalizado)) ? nombrePersonalizado : GenerarNombrePorDefecto(pos, bioma, esCampamento)); if (destinoCirculo != null) { destinoCirculo.Posicion = pos; destinoCirculo.Rotacion = rot; destinoCirculo.Bioma = bioma; destinoCirculo.EsCampamento = esCampamento; destinoCirculo.Dueno = dueno; destinoCirculo.Vendedor = vendedor; if (!string.IsNullOrEmpty(nombrePersonalizado)) { destinoCirculo.Nombre = nombre; } else if (esCampamento && EsNombreCampamentoGenerico(destinoCirculo.Nombre)) { destinoCirculo.Nombre = GenerarNombrePorDefecto(pos, bioma, esCampamento: true); } Guardar(p); return false; } DestinoCirculo destinoCirculo3 = new DestinoCirculo { Id = text, Posicion = pos, Rotacion = rot, Nombre = nombre, Bioma = bioma, EsCampamento = esCampamento, Dueno = dueno, Vendedor = vendedor }; _destinosEnMemoria.Add(destinoCirculo3); Guardar(p); ((Character)p).Message((MessageType)1, Tr.Get("tele_circulo_discovered", new object[1] { destinoCirculo3.Nombre }), 0, (Sprite)null, false); return true; } public static bool Olvidar(Player p, Vector3 pos, float radio = 6f) { //IL_0031: 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_0037: 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) if ((Object)(object)p == (Object)null) { return false; } AsegurarCargado(p); float num = radio * radio; int num2 = 0; for (int num3 = _destinosEnMemoria.Count - 1; num3 >= 0; num3--) { Vector3 val = _destinosEnMemoria[num3].Posicion - pos; val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude < num) { _destinosEnMemoria.RemoveAt(num3); num2++; } } if (num2 > 0) { Guardar(p); return true; } return false; } private static void AsegurarCargado(Player p) { if ((Object)(object)p == (Object)null) { return; } string value = null; p.m_customData.TryGetValue("MT.Gremio.Circulos", out value); if (_ultimoCacheTexto == value && _destinosEnMemoria.Count > 0) { return; } _destinosEnMemoria.Clear(); _ultimoCacheTexto = value; if (!string.IsNullOrEmpty(value)) { string[] array = value.Split(';'); for (int i = 0; i < array.Length; i++) { DestinoCirculo destinoCirculo = Deserializar(array[i]); if (destinoCirculo != null) { _destinosEnMemoria.Add(destinoCirculo); } } } if (!p.m_customData.ContainsKey("MT.Gremio.Circulos.migrado")) { MigrarDesdeCoreLugares(p); p.m_customData["MT.Gremio.Circulos.migrado"] = "1"; } } private static void MigrarDesdeCoreLugares(Player p) { //IL_0139: 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_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_0159: 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_0168: 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) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)p == (Object)null || !p.m_customData.TryGetValue("MT.Core.Lugares", out var value) || string.IsNullOrEmpty(value)) { return; } bool flag = false; string[] array = value.Split(';'); Vector3 val = default(Vector3); for (int i = 0; i < array.Length; i++) { string[] array2 = array[i].Split('|'); if (array2.Length != 3 || array2[0] != "gremio_circulo" || !int.TryParse(array2[1], NumberStyles.Integer, CultureInfo.InvariantCulture, out var result) || !int.TryParse(array2[2], NumberStyles.Integer, CultureInfo.InvariantCulture, out var result2)) { continue; } bool flag2 = false; for (int j = 0; j < _destinosEnMemoria.Count; j++) { if (Mathf.Abs(_destinosEnMemoria[j].Posicion.x - (float)result) < 6f && Mathf.Abs(_destinosEnMemoria[j].Posicion.z - (float)result2) < 6f) { flag2 = true; break; } } if (!flag2) { float num = ((WorldGenerator.instance != null) ? WorldGenerator.instance.GetHeight((float)result, (float)result2) : 30f); ((Vector3)(ref val))..ctor((float)result, num + 0.3f, (float)result2); Biome bioma = ObtenerBioma(val); string nombre = GenerarNombrePorDefecto(val, bioma, esCampamento: true); _destinosEnMemoria.Add(new DestinoCirculo { Id = GenerarId(val), Posicion = val, Rotacion = Quaternion.identity, Nombre = nombre, Bioma = bioma, EsCampamento = true, Dueno = (DuenoCirculo)2 }); flag = true; } } if (flag) { Guardar(p); } } private static void Guardar(Player p) { if ((Object)(object)p == (Object)null) { return; } StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < _destinosEnMemoria.Count; i++) { DestinoCirculo destinoCirculo = _destinosEnMemoria[i]; if (destinoCirculo != null) { if (stringBuilder.Length > 0) { stringBuilder.Append(';'); } stringBuilder.Append(Serializar(destinoCirculo)); } } string value = (_ultimoCacheTexto = stringBuilder.ToString()); p.m_customData["MT.Gremio.Circulos"] = value; } private static string GenerarId(Vector3 pos) { //IL_0000: 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) return Mathf.RoundToInt(pos.x).ToString(CultureInfo.InvariantCulture) + "_" + Mathf.RoundToInt(pos.z).ToString(CultureInfo.InvariantCulture); } private static string Serializar(DestinoCirculo d) { //IL_005b: 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_0078: Expected I4, but got Unknown //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Expected I4, but got Unknown return string.Format(CultureInfo.InvariantCulture, "{0}|{1:F2}|{2:F2}|{3:F2}|{4:F1}|{5}|{6}|{7}|{8}|{9}", d.Id, d.Posicion.x, d.Posicion.y, d.Posicion.z, ((Quaternion)(ref d.Rotacion)).eulerAngles.y, (int)d.Bioma, d.EsCampamento ? 1 : 0, (d.Nombre ?? string.Empty).Replace("|", "/").Replace(";", ","), (int)d.Dueno, d.Vendedor); } private static DestinoCirculo Deserializar(string s) { //IL_008d: 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_0104: 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_00c2: 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_0120: 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_0137: 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_0155: 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) if (string.IsNullOrEmpty(s)) { return null; } string[] array = s.Split('|'); if (array.Length < 7) { return null; } try { string id = array[0]; float num = float.Parse(array[1], CultureInfo.InvariantCulture); float num2 = float.Parse(array[2], CultureInfo.InvariantCulture); float num3 = float.Parse(array[3], CultureInfo.InvariantCulture); float num4 = float.Parse(array[4], CultureInfo.InvariantCulture); int num5 = int.Parse(array[5], CultureInfo.InvariantCulture); bool flag = array[6] == "1"; string text = ((array.Length >= 8) ? array[7] : null); DuenoCirculo dueno = (DuenoCirculo)(flag ? 2 : 0); if (array.Length >= 10 && int.TryParse(array[8], NumberStyles.Integer, CultureInfo.InvariantCulture, out var result) && Enum.IsDefined(typeof(DuenoCirculo), result)) { dueno = (DuenoCirculo)result; } long result2 = 0L; if (array.Length >= 10) { long.TryParse(array[9], NumberStyles.Integer, CultureInfo.InvariantCulture, out result2); } Biome bioma = (Biome)num5; Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(num, num2, num3); if (string.IsNullOrEmpty(text) || (flag && EsNombreCampamentoGenerico(text))) { text = GenerarNombrePorDefecto(val, bioma, flag); } return new DestinoCirculo { Id = id, Posicion = val, Rotacion = Quaternion.Euler(0f, num4, 0f), Nombre = text, Bioma = bioma, EsCampamento = flag, Dueno = dueno, Vendedor = result2 }; } catch { return null; } } public static string GenerarNombrePorDefecto(Vector3 pos, Biome bioma, bool esCampamento) { //IL_0006: 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) string text = (esCampamento ? Circulos.NombreLugar(pos) : null); if (string.IsNullOrEmpty(text)) { return Tr.Get("tele_circulo_nombre_bioma", new object[1] { ObtenerNombreBioma(bioma) }); } return text; } private static bool EsNombreCampamentoGenerico(string nombre) { if (string.IsNullOrEmpty(nombre)) { return true; } if (!nombre.StartsWith("Campamento del Gremio") && !nombre.StartsWith("Guild Camp") && !nombre.StartsWith("Camp de la guilde") && !nombre.StartsWith("Gildenlager") && !nombre.StartsWith("Accampamento della gilda") && !nombre.StartsWith("Acampamento da Guilda") && !nombre.StartsWith("Obóz gildii") && !nombre.StartsWith("Лагерь гильдии") && !nombre.StartsWith("Табір гільдії") && !nombre.StartsWith("Lonca Kampı") && !nombre.Contains("の野営地") && !nombre.Contains("の拠点") && !nombre.Contains("길드 캠프") && !nombre.Contains("公会营地")) { return nombre.Contains("公會營地"); } return true; } public static Biome ObtenerBioma(Vector3 pos) { //IL_000c: 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_001e: Unknown result type (might be due to invalid IL or missing references) if (WorldGenerator.instance != null) { return WorldGenerator.instance.GetBiome(pos.x, pos.z, 0.02f, false); } return (Biome)0; } public unsafe static string ObtenerNombreBioma(Biome bioma) { string text = Tr.Localize("$biome_" + ((object)(*(Biome*)(&bioma))/*cast due to .constrained prefix*/).ToString().ToLowerInvariant()); if (!string.IsNullOrEmpty(text) && !text.StartsWith("$")) { return text; } return ((object)(*(Biome*)(&bioma))/*cast due to .constrained prefix*/).ToString(); } public static Color ColorBioma(Biome bioma) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected I4, but got Unknown //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Invalid comparison between Unknown and I4 //IL_0057: 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_00f0: 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_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Invalid comparison between Unknown and I4 //IL_00ea: 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_0041: Invalid comparison between Unknown and I4 //IL_006c: 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_0024: Invalid comparison between Unknown and I4 //IL_00c0: 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) if ((int)bioma <= 16) { switch (bioma - 1) { default: if ((int)bioma != 8) { if ((int)bioma != 16) { break; } return new Color(1f, 0.85f, 0.35f); } return new Color(0.3f, 0.85f, 0.9f); case 0: return new Color(0.6f, 0.9f, 0.4f); case 1: return new Color(0.85f, 0.65f, 0.3f); case 3: return new Color(0.85f, 0.95f, 1f); case 2: break; } } else { if ((int)bioma == 32) { return new Color(1f, 0.4f, 0.25f); } if ((int)bioma == 64) { return new Color(0.6f, 0.85f, 1f); } if ((int)bioma == 512) { return new Color(0.75f, 0.5f, 1f); } } return MTGui.Oro; } } public static class ViajeGrupo { private const float RadioCorro = 2.5f; private static readonly List<Character> _companeros = new List<Character>(); public static bool Viajar(Player player, Vector3 destino, Quaternion rotacion) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: 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_0057: 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) if ((Object)(object)player == (Object)null) { return false; } if ((Object)(object)player == (Object)(object)Player.m_localPlayer) { VacioTeleport.Viajar(delegate { //IL_0007: 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) Saltar(player, destino, rotacion); }); return true; } Saltar(player, destino, rotacion); return true; } private static void Saltar(Player player, Vector3 destino, Quaternion rotacion) { //IL_0020: 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_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0091: 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) if ((Object)(object)player == (Object)null) { return; } _companeros.Clear(); Companeros.Siguiendo(player, _companeros); ((Character)player).TeleportTo(destino, rotacion, true); float num = 360f / (float)Mathf.Max(1, _companeros.Count); for (int i = 0; i < _companeros.Count; i++) { Character val = _companeros[i]; if (!((Object)(object)val == (Object)null) && ((Component)val).gameObject.activeInHierarchy) { Vector3 val2 = Quaternion.Euler(0f, num * (float)i, 0f) * Vector3.forward * 2.5f; Mover(val, destino + val2, rotacion); } } Chat instance = Chat.instance; if (instance != null) { ((Terminal)instance).AddString("<color=#00FFFF>" + Tr.Get("tele_circulo_teleport_party") + "</color>"); } } private static void Mover(Character character, Vector3 pos, Quaternion rot) { //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) //IL_0038: 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_0040: 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_0063: 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_0097: Unknown result type (might be due to invalid IL or missing references) ZNetView component = ((Component)character).GetComponent<ZNetView>(); if ((Object)(object)component != (Object)null && component.IsValid() && !component.IsOwner()) { component.ClaimOwnership(); } Vector3 position = ((Component)character).transform.position; ((Component)character).transform.position = pos; LlegadaNpc.Acudir(character, position, pos); ((Component)character).transform.rotation = rot; Rigidbody component2 = ((Component)character).GetComponent<Rigidbody>(); if ((Object)(object)component2 != (Object)null) { component2.position = pos; } if ((Object)(object)component != (Object)null && component.IsValid()) { ZDO zDO = component.GetZDO(); if (zDO != null) { zDO.SetPosition(pos); } ZDO zDO2 = component.GetZDO(); if (zDO2 != null) { zDO2.SetRotation(rot); } } } } internal static class FichaDestino { private static readonly Color Runa = new Color(0.45f, 0.85f, 1f, 1f); private static readonly Color Verde = new Color(0.62f, 0.83f, 0.54f); private static Sprite _pergamino; public static bool Dibujar(Rect zona, float s, DestinoCirculo d, int tarifa, bool pergamino, string motivo, Vector3 desde, Player p, out bool verMapa) { //IL_001e: 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_007c: 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_00c0: 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_00f5: 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_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_0135: 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_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: 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_028a: 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_02d2: Unknown result type (might be due to invalid IL or missing references) verMapa = false; float y = ((Rect)(ref zona)).y; float num = 64f * s; MTGui.Icon(new Rect(((Rect)(ref zona)).x, y, num, num), Iconos.Get("mapa_circulo") ?? Iconos.Get("portal_gremio"), 1f); MTGui.LabelWrap(new Rect(((Rect)(ref zona)).x + num + 12f * s, y, ((Rect)(ref zona)).width - num - 12f * s, 40f * s), d.Nombre, 20, MTGui.Oro, (TextAnchor)3, true); MTGui.Label(new Rect(((Rect)(ref zona)).x + num + 12f * s, y + 40f * s, ((Rect)(ref zona)).width - num - 12f * s, 22f * s), RedCirculos.ObtenerNombreBioma(d.Bioma), 14, RedCirculos.ColorBioma(d.Bioma), (TextAnchor)3, false); y += num + 16f * s; Vector2 val = new Vector2(d.Posicion.x - desde.x, d.Posicion.z - desde.z); float magnitude = ((Vector2)(ref val)).magnitude; Dato(new Rect(((Rect)(ref zona)).x, y, ((Rect)(ref zona)).width, 26f * s), Tr.Get("tele_ficha_distancia"), (magnitude >= 1000f) ? $"{magnitude / 1000f:F1} km" : $"{magnitude:0} m"); y += 30f * s; string text = CirculoTeletransporte.TextoDueno(d.Dueno, d.Vendedor, p); if (text.Length > 0) { Dato(new Rect(((Rect)(ref zona)).x, y, ((Rect)(ref zona)).widt
plugins/MT.Touki/MT.Touki.dll
Decompiled a day agousing System; using System.Collections; 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.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Jotunn.Configs; using Jotunn.Managers; using Jotunn.Utils; using MT.Core; using MT.Core.Barra; using MT.Core.Diario; using MT.Core.Especialidades; using MT.Core.Habilidades; using MT.Core.I18n; using MT.Core.Interfaz; using MT.Core.Mana; using MT.Core.Npc; using MT.Core.Touki; using MT.Core.Vfx; using MT.Paso; 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.Touki")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+f72fd27a1cef3fefa2078e5313c902bbcd510c4b")] [assembly: AssemblyProduct("MT.Touki")] [assembly: AssemblyTitle("MT.Touki")] [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.Paso { public static class PasoNpc { public static void Rastro(Character c, Vector3 desde, Vector3 hasta) { //IL_0012: 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_002c: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)c == (Object)null) && !c.IsDead()) { PolvoPaso.Soltar(desde); if (MTPasoPlugin.Afterimages.Value) { Afterimage.SpawnTrail(c, desde, hasta, MTPasoPlugin.AfterimageColor.Value); } } } } public class Afterimage : MonoBehaviour { private const float FadeSeconds = 0.35f; private const int Copies = 3; private const int MaxVivas = 9; private static int _vivas; 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(Character p, Vector3 start, Vector3 end, Color color) { //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_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_0031: 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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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_004e: 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) if (FindShader() && _vivas + 3 <= 9) { SkinnedMeshRenderer[] componentsInChildren = ((Component)p).GetComponentsInChildren<SkinnedMeshRenderer>(); Vector3 val = ((Component)p).transform.position - start; for (int i = 0; i < 3; i++) { Vector3 rootPos = Vector3.Lerp(start, end, (float)i / 3f) + val; Spawn(componentsInChildren, ((Component)p).transform, rootPos, color * new Color(1f, 1f, 1f, 1f - (float)i / 3f)); } } } 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_0031: 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_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown //IL_0091: 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_00a8: 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_00bb: 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_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_00dd: 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_00ec: 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_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Expected O, but got Unknown GameObject val = new GameObject("MT_Afterimage"); val.transform.SetPositionAndRotation(rootPos, root.rotation); Afterimage afterimage = val.AddComponent<Afterimage>(); _vivas++; 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); _vivas--; } } } 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 Campos.Cuerpo.Invoke((Character)(object)p); } 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_0011: Unknown result type (might be due to invalid IL or missing references) Campos.AlturaMaxAire.Invoke((Character)(object)p) = ((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); PolvoPaso.Soltar(((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); PolvoPaso.Soltar(((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((Character)(object)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); } } public static class PolvoPaso { public static void Soltar(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); } } } internal static class ConfigNombres { public static readonly string[] Tabla = new string[44] { "Visual", "ImagenesResiduales", "Visual", "Afterimages", "Visual", "ColorSiluetas", "Visual", "SilhouetteColor", "Visual", "LineasVelocidad", "Visual", "SpeedLines", "Juego", "PasoSinMantoPermitido", "Gameplay", "StepWithoutMantleAllowed", "Enfriamiento", "EsperaNv4", "Cooldown", "CooldownLv4", "Enfriamiento", "EsperaNv10", "Cooldown", "CooldownLv10", "Enfriamiento", "RompeDistancia", "Cooldown", "BreakDistance", "Cansancio", "Ventana", "Fatigue", "Window", "Cansancio", "CostePorSeguido", "Fatigue", "CostPerChain", "Cansancio", "EsperaPorSeguido", "Fatigue", "CooldownPerChain", "Cansancio", "MaxSeguidos", "Fatigue", "MaxChain" }; } public sealed class HabilidadPaso : Habilidad { public static readonly HabilidadPaso Instancia = new HabilidadPaso(); private PasoRules.Pago _pago = PasoRules.Pago.Toki; private int _nivel = 4; private int _serie; private int _seguidosAlUsar; private float _ultimoUso = -999f; public override string Familia => "paso"; public override string Nombre => Tr.Get("paso_name"); public override string Descripcion => Tr.Get("paso_desc"); public override Sprite Icono => null; private static int Seguidos() { return PasoRules.Seguidos(Time.time, Instancia._ultimoUso, Instancia._serie, MTPasoPlugin.CansancioVentana.Value); } private static float CosteAhora(int nivel, Player p = null) { return PasoController.Coste(nivel) * PasoRules.MultCoste(Seguidos(), MTPasoPlugin.CansancioCoste.Value) * (((Object)(object)p != (Object)null) ? CaminoAfinidad.MultCostePaso(p) : 1f); } private HabilidadPaso() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) base.Clave = "paso_toki"; base.Activacion = (Activacion)1; base.Color = new Color(0.35f, 0.75f, 1f); } public override bool Conoce(Player p) { if ((Object)(object)p != (Object)null) { if (!Topes.Mk1(p)) { if (CaminoAfinidad.PermitePaso(p)) { if (ToukiRules.Level(p) < 1) { return !ToukiRules.ModInstalado; } return true; } return false; } return true; } return false; } public override float CosteToki(Player p) { if (!((Object)(object)p != (Object)null)) { return PasoController.Coste(1); } return CosteAhora(ToukiRules.NivelRequisitos(p), p); } protected override string TextoEspera(int segundos) { return Tr.Get("paso_cooldown", new object[1] { segundos }); } protected override string AvisoEspera(int segundos) { return null; } protected override bool Requisitos(Player p) { if (!((Habilidad)this).Conoce(p)) { if (CaminoAfinidad.EsMagoSinToki(p)) { Habilidad.Avisar(p, Tr.Get("paso_disabled_by_mage_path")); } else { Habilidad.Avisar(p, Tr.Get("paso_need_toki_level_4")); } return false; } if (PasoRules.Agotado(Seguidos(), MTPasoPlugin.CansancioMax.Value)) { float num = MTPasoPlugin.CansancioVentana.Value - (Time.time - _ultimoUso); Habilidad.Avisar(p, Tr.Get("paso_exhausted", new object[1] { Mathf.CeilToInt(Mathf.Max(1f, num)) })); return false; } if ((Object)(object)PasoController.Instance == (Object)null || PasoController.Activo || ((Character)p).IsAttached() || ((Character)p).IsTeleporting() || (Object)(object)Campos.Cuerpo.Invoke((Character)(object)p) == (Object)null) { return false; } return !Movilidad.AvisarSiBloqueada(p); } protected override bool PuedeAhora(Player p) { return PasoController.Instance.PuedeEnAire(p); } protected override bool QueCobrar(Player p, out Pago pago, out string porque) { //IL_0001: 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_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) pago = default(Pago); porque = null; bool flag = Topes.Mk1(p); float num = CosteAhora(ToukiRules.NivelRequisitos(p), p); bool flag2 = !flag && Manto.Active && Manto.Charge >= num * Manto.CostMultiplier(p); bool estaminaAlcanza = !flag && !flag2 && (MTPasoPlugin.SinManto.Value || (!CaminoAfinidad.EsMagoSinToki(p) && ToukiRules.Apagado(p))) && ((Character)p).HaveStamina(num * 2f); PasoRules.Pago pago2 = PasoRules.Elegir(flag, Manto.Active, flag2, p.GetEitr() >= 15f, estaminaAlcanza); if (pago2 == PasoRules.Pago.Nada) { porque = Tr.Get((!flag && !Manto.Active && !MTPasoPlugin.SinManto.Value && !ToukiRules.Apagado(p)) ? "paso_activate_toki_mantle_f1" : "paso_no_strength"); return false; } pago = new Pago { Toki = (pago2 == PasoRules.Pago.Toki), Mana = (pago2 == PasoRules.Pago.Mk1) }; return true; } protected override void Cobrar(Player p, Pago pago) { //IL_000d: 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) _nivel = ToukiRules.NivelRequisitos(p); _pago = (pago.Mana ? PasoRules.Pago.Mk1 : (pago.Toki ? PasoRules.Pago.Toki : PasoRules.Pago.Estamina)); float num = CosteAhora(_nivel, p); _seguidosAlUsar = Seguidos(); _serie = _seguidosAlUsar + 1; _ultimoUso = Time.time; if (_pago == PasoRules.Pago.Mk1) { ((Character)p).UseEitr(15f); } else if (_pago == PasoRules.Pago.Toki) { Manto.Spend(p, num, true); } else { ((Character)p).UseStamina(num * 2f); } } public override float EnfriamientoPara(Player p) { //IL_004c: 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) if ((Object)(object)p == (Object)null) { return 0f; } float num = PasoController.DuracionDe(_nivel, _pago); if (_pago == PasoRules.Pago.Mk1) { return 30f; } float num2 = PasoController.EsperaDe(_nivel); if (_nivel >= 7 && PasoController.EnemigoDelante(p, ((Component)p).transform.position, PasoController.Direccion(p))) { num2 *= MTPasoPlugin.RompeDistancia.Value; } return num + num2 + PasoRules.EsperaExtra(_seguidosAlUsar, MTPasoPlugin.CansancioEspera.Value); } protected override void AlPagar(Player p, bool conToki) { if (conToki) { Manto.TrainDominio(p, 1f); } } public override void Lanzar(Player p, bool conToki, Projectile flecha) { PasoController.Instance?.Dash(p, _nivel, _pago); } } public class PasoController : MonoBehaviour { private const float InvulnerableSeconds = 0.15f; private static float _cooldownUntil; private static float _cooldownTotal; private bool _usadoEnAire; public const float Velocidad = 16f; public const float DuracionMk1 = 5f; public const float CosteMk1 = 15f; public const float EsperaTotalMk = 30f; public static readonly Color ColorMk = new Color(0.95f, 0.97f, 1f, 0.8f); public static readonly Color SiluetaMk = new Color(0.95f, 0.97f, 1f, 0.18f); private PasoRules.Pago _pagoActual; private Vector3 _rastro; private float _siguienteRastro; private int _decimas = -1; private string _textoEspera; internal static PasoController Instance { get; private set; } public static float LastDashTime => Movilidad.UltimoPaso; public static bool Invulnerable => Time.time - LastDashTime < 0.15f; public static float Espera { get { if (!(_cooldownTotal <= 0f) && !(_cooldownUntil - Time.time < -1.2f)) { return Mathf.Clamp01((_cooldownUntil - Time.time) / _cooldownTotal); } return -1f; } } public static float SegundosRestantes { get { if (!(_cooldownTotal <= 0f)) { return Mathf.Max(0f, _cooldownUntil - Time.time); } return 0f; } } public static float ActivoHasta { get; private set; } = -1f; public static bool Activo => Time.time < ActivoHasta; private static float Duracion(int l) { return Mathf.Lerp(1.4f, 5f, Mathf.Clamp01((float)(l - 1) / 9f)); } internal static float Coste(int l) { return Mathf.Lerp(10f, 15f, Mathf.Clamp01((float)(l - 1) / 9f)); } internal static float EsperaDe(int l) { return Mathf.Lerp(MTPasoPlugin.EsperaNv4.Value, MTPasoPlugin.EsperaNv10.Value, Mathf.Clamp01((float)(Mathf.Max(4, l) - 4) / 6f)); } internal static float DuracionDe(int l, PasoRules.Pago pago) { if (pago != PasoRules.Pago.Mk1) { return Duracion(l) * ((pago == PasoRules.Pago.Estamina) ? 0.6f : 1f); } return 5f; } public static void MarkDash() { Movilidad.MarcarPaso(); } public static void Cortar() { ActivoHasta = -1f; } private void Awake() { Instance = this; } 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() && CanTakeInput() && MTKeys.Down(MTKeys.Paso)) { ((Habilidad)HabilidadPaso.Instancia).Usar(localPlayer); } } internal bool PuedeEnAire(Player p) { int num; if (!((Character)p).IsOnGround()) { num = ((!((Character)p).IsSwimming()) ? 1 : 0); if (num != 0) { goto IL_001e; } } else { num = 0; } _usadoEnAire = false; goto IL_001e; IL_001e: if (num == 0 || !_usadoEnAire) { return true; } ((Character)p).Message((MessageType)1, Tr.Get("paso_air_used"), 0, (Sprite)null, false); return false; } private void OnGUI() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Invalid comparison between Unknown and I4 //IL_014a: 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_00a6: 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_0124: 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) ((MonoBehaviour)this).useGUILayout = false; if (Hud.Activo || (int)Event.current.type != 7 || (Object)(object)Player.m_localPlayer == (Object)null || (Object)(object)Hud.instance == (Object)null || Menu.IsVisible() || _cooldownTotal <= 0f) { return; } float num = _cooldownUntil - Time.time; if (num < -1.2f) { return; } float scale = MTGui.Scale; float num2 = 300f * scale; float num3 = 6f * scale; float num4 = (float)Screen.width * 0.5f - num2 / 2f; float num5 = 70f * scale; if (num > 0f) { MTGui.Bar(new Rect(num4, num5, num2, num3), 1f - num / _cooldownTotal, MTGui.Texto); int num6 = Mathf.CeilToInt(num * 10f); if (num6 != _decimas || _textoEspera == null) { _decimas = num6; _textoEspera = string.Format(Tr.Get("paso_cooldown"), ((float)num6 / 10f).ToString("0.0")); } MTGui.Label(new Rect(num4, num5 + num3, num2, 18f * scale), _textoEspera, 13, MTGui.Texto, (TextAnchor)1, false); } else { MTGui.Label(new Rect(num4, num5, num2, 18f * scale), Tr.Get("paso_ready"), 14, MTGui.Oro, (TextAnchor)1, true); } } internal static bool EnemigoDelante(Player p, Vector3 desde, Vector3 dir) { //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_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_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) foreach (Character allCharacter in Character.GetAllCharacters()) { if (!((Object)(object)allCharacter == (Object)null) && !((Object)(object)allCharacter == (Object)(object)p) && !allCharacter.IsDead() && BaseAI.IsEnemy((Character)(object)p, allCharacter)) { Vector3 val = ((Component)allCharacter).transform.position - desde; val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude < 225f && Vector3.Dot(((Vector3)(ref val)).normalized, dir) > 0.7f) { return true; } } } return false; } 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; } internal void Dash(Player p, int level, PasoRules.Pago pago) { //IL_005a: 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) bool num = !((Character)p).IsOnGround() && !((Character)p).IsSwimming(); Desplazamiento.Empezar("paso_toki", (Action)Cortar); ActivoHasta = Time.time + DuracionDe(level, pago); _pagoActual = pago; _rastro = ((Component)p).transform.position; _siguienteRastro = Time.time + 0.1f; if (num) { _usadoEnAire = true; } Movilidad.MarcarPaso(); _cooldownTotal = Esperas.Restante(p, (Habilidad)(object)HabilidadPaso.Instancia); _cooldownUntil = Time.time + _cooldownTotal; } public static Vector3 Direccion(Player p) { //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_0045: 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_0036: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Campos.DirMovimiento.Invoke((Character)(object)p); val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { val = ((Component)p).transform.forward; val.y = 0f; } return ((Vector3)(ref val)).normalized; } private void LateUpdate() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0091: 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_004d: 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_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: 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_007e: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null || !Activo || Time.time < _siguienteRastro) { return; } _siguienteRastro = Time.time + 0.1f; Vector3 position = ((Component)localPlayer).transform.position; Vector3 val; if (MTPasoPlugin.Afterimages.Value) { val = position - _rastro; if (((Vector3)(ref val)).sqrMagnitude > 4f) { Afterimage.SpawnTrail((Character)(object)localPlayer, _rastro, position, (_pagoActual == PasoRules.Pago.Mk1) ? SiluetaMk : MTPasoPlugin.AfterimageColor.Value); } } val = position - _rastro; if (((Vector3)(ref val)).sqrMagnitude > 4f || !MTPasoPlugin.Afterimages.Value) { _rastro = position; } } } [HarmonyPatch(typeof(Character), "UpdateWalking")] public static class PasoMovimientoPatch { private static void Postfix(Character __instance) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0044: 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_0055: 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_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) if (PasoController.Activo && !((Object)(object)__instance != (Object)(object)Player.m_localPlayer)) { Player val = (Player)__instance; Rigidbody val2 = Campos.Cuerpo.Invoke((Character)(object)val); if (!((Object)(object)val2 == (Object)null) && !((Character)val).IsAttached() && !((Character)val).IsDead()) { Vector3 val3 = PasoController.Direccion(val) * 16f; val2.linearVelocity = new Vector3(val3.x, val2.linearVelocity.y, val3.z); } } } } [HarmonyPatch(typeof(Character), "RPC_Damage")] [HarmonyPriority(800)] public static class DashInvulnerablePatch { private static bool Prefix(Character __instance) { if ((Object)(object)__instance == (Object)(object)Player.m_localPlayer) { return !PasoController.Invulnerable; } return true; } } public static class MTPasoPlugin { public const string Guid = "mushokutensei.paso"; public const string Version = "2.8.0"; public const string ButtonName = "MT_Paso"; public static ConfigEntry<bool> Afterimages; public static ConfigEntry<Color> AfterimageColor; public static ConfigEntry<bool> LineasVelocidad; public static ConfigEntry<bool> SinManto; public static ConfigEntry<float> EsperaNv4; public static ConfigEntry<float> EsperaNv10; public static ConfigEntry<float> RompeDistancia; public static ConfigEntry<float> CansancioVentana; public static ConfigEntry<float> CansancioCoste; public static ConfigEntry<float> CansancioEspera; public static ConfigEntry<int> CansancioMax; public static bool PluginViejoInstalado => Chainloader.PluginInfos.ContainsKey("mushokutensei.paso"); public static void Iniciar(BaseUnityPlugin core) { //IL_0082: 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_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Expected O, but got Unknown //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Expected O, but got Unknown //IL_01d0: 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_01dd: Expected O, but got Unknown //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Expected O, but got Unknown //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_020b: 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_021f: Expected O, but got Unknown //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_0251: 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_0283: Expected O, but got Unknown if (PluginViejoInstalado) { MTCorePlugin.Log.LogWarning((object)"MT Paso ya va dentro de MT Touki: borra la carpeta BepInEx/plugins/MT.Paso. Mientras exista, se usa la vieja."); return; } ConfigFile cfg = core.Config; RedVfx.Visual(typeof(PasoNpc), "Rastro", (Func<object[], bool>)null, Array.Empty<Type>()); Afterimages = cfg.Bind<bool>("Visual", "Afterimages", true, "Draw afterimage silhouettes during the Tōki Step."); AfterimageColor = cfg.Bind<Color>("Visual", "SilhouetteColor", new Color(0.35f, 0.75f, 1f, 0.24f), "Silhouette color (alpha is transparency). Blue, like the Step icon."); LineasVelocidad = cfg.Bind<bool>("Visual", "SpeedLines", true, "Speed lines on the character when running with the tōki mantle and during the Step."); SinManto = cfg.Bind<bool>("Gameplay", "StepWithoutMantleAllowed", false, new ConfigDescription("true = without the tōki mantle on, the Dash still works at 60 % duration paying stamina. false (default) = no mantle, no Dash (MK-I still works).", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); EsperaNv4 = Admin("Cooldown", "CooldownLv4", 15f, "Seconds of cooldown after the Dash ends, at tōki Lv 4 (counts from the end of the Dash)."); EsperaNv10 = Admin("Cooldown", "CooldownLv10", 10f, "Seconds of cooldown after the Dash ends, at tōki Lv 10 (levels in between, linear)."); RompeDistancia = Admin("Cooldown", "BreakDistance", 0.7f, "Tōki Lv 7+: dashing at an enemy within 15 m multiplies the cooldown by this (0.7 = −30 %)."); CansancioVentana = Admin("Fatigue", "Window", 30f, "A Dash within these seconds of the previous one counts as «in a row». Without dashing for this long, fatigue resets."); CansancioCoste = Admin("Fatigue", "CostPerChain", 0.5f, "Extra tōki cost per Dash in a row (0.5: 2nd ×1.5, 3rd ×2)."); CansancioEspera = Admin("Fatigue", "CooldownPerChain", 5f, "Extra cooldown seconds per Dash in a row (5: 2nd +5 s, 3rd +10 s)."); CansancioMax = cfg.Bind<int>("Fatigue", "MaxChain", 3, new ConfigDescription("Dashes in a row before the body gives out: no more Dash until the window passes. 0 = no limit.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); MigrarCfgViejo(); InputManager.Instance.AddButton("mushokutensei.paso", new ButtonConfig { Name = "MT_Paso", Key = (KeyCode)102, ActiveInCustomGUI = false }); ((Component)core).gameObject.AddComponent<PasoController>(); Catalogo.Registrar((Habilidad)(object)HabilidadPaso.Instancia); ((Component)core).gameObject.AddComponent<VelocidadLineas>(); Hud.Registrar(new ProveedorHud { Id = "paso", Prioridad = 20, Llenar = delegate(Player p, EstadoHud e) { //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) e.PasoVisible = ((Habilidad)HabilidadPaso.Instancia).Conoce(p) && (Manto.Active || Topes.Mk1(p) || SinManto.Value || ToukiRules.Apagado(p) || PasoController.Espera > 0f); e.PasoEspera = (e.PasoVisible ? PasoController.Espera : (-1f)); e.PasoSegundos = (e.PasoVisible ? PasoController.SegundosRestantes : 0f); if (e.PasoVisible && Topes.Mk1(p)) { ItemData obj = Campos.Pecho.Invoke((Humanoid)(object)p); e.PasoIcono = ((obj != null) ? obj.GetIcon() : null); e.PasoColor = PasoController.ColorMk; } } }); MTCorePlugin.Log.LogInfo((object)"Paso de Tōki 2.8.0 (dentro de MT Touki)"); ConfigEntry<float> Admin(string sub, string clave, float valor, string texto) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown return cfg.Bind<float>(sub, clave, valor, new ConfigDescription(texto, (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); } } private static void MigrarCfgViejo() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown string text = Path.Combine(Paths.ConfigPath, "mushokutensei.paso.cfg"); if (!File.Exists(text)) { return; } try { ConfigFile viejo = new ConfigFile(text, false); ConfigMigracion.Migrar(viejo, ConfigNombres.Tabla); Copiar<bool>(Afterimages, "Visual"); Copiar<Color>(AfterimageColor, "Visual"); Copiar<bool>(LineasVelocidad, "Visual"); Copiar<bool>(SinManto, "Gameplay"); Copiar<float>(EsperaNv4, "Cooldown"); Copiar<float>(EsperaNv10, "Cooldown"); Copiar<float>(RompeDistancia, "Cooldown"); Copiar<float>(CansancioVentana, "Fatigue"); Copiar<float>(CansancioCoste, "Fatigue"); Copiar<float>(CansancioEspera, "Fatigue"); Copiar<int>(CansancioMax, "Fatigue"); File.Move(text, text + ".migrado"); MTCorePlugin.Log.LogInfo((object)("Configuración de MT Paso copiada a MT Touki (" + text + " → .migrado).")); void Copiar<T>(ConfigEntry<T> nuevo, string seccion) { ConfigEntry<T> val = viejo.Bind<T>(seccion, ((ConfigEntryBase)nuevo).Definition.Key, nuevo.Value, (ConfigDescription)null); nuevo.Value = val.Value; } } catch (Exception ex) { MTCorePlugin.Log.LogWarning((object)("No se pudo copiar la configuración de MT Paso: " + ex.Message)); } } } internal sealed class PasoNpcTouki : IPasoNpc { public void Rastro(Character actor, Vector3 desde, Vector3 hasta) { //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) PasoNpc.Rastro(actor, desde, hasta); } } public static class PasoRules { public enum Pago { Nada, Mk1, Toki, Estamina } public const float DuracionSinManto = 0.6f; public const float EstaminaPorToki = 2f; public static Pago Elegir(bool mk1, bool mantoActivo, bool tokiAlcanza, bool manaAlcanzaMk1, bool estaminaAlcanza) { if (mk1) { if (!manaAlcanzaMk1) { return Pago.Nada; } return Pago.Mk1; } if (mantoActivo && tokiAlcanza) { return Pago.Toki; } if (!estaminaAlcanza) { return Pago.Nada; } return Pago.Estamina; } public static int Seguidos(float ahora, float ultimoUso, int serie, float ventana) { if (!(ahora - ultimoUso < ventana)) { return 0; } return serie; } public static bool Agotado(int seguidos, int max) { if (max > 0) { return seguidos >= max; } return false; } public static float MultCoste(int seguidos, float porSeguido) { return 1f + (float)seguidos * porSeguido; } public static float EsperaExtra(int seguidos, float porSeguido) { return (float)seguidos * porSeguido; } } public class VelocidadLineas : MonoBehaviour { private class Trazo { public LineRenderer Lr; public Vector3 Inicio; public Vector3 Dir; public float Edad = -1f; public float Largo; public float Ancho; public Color Color; } private const int Max = 28; private const float Vida = 0.28f; private readonly Trazo[] _trazos = new Trazo[28]; private Material _mat; private float _proximo; private float _rafagaHasta; private float _ultimoPaso = -1f; private Vector3 _lastPos; private Vector3 _vel; private bool _hasLast; private static readonly Color Blanco = new Color(1f, 0.97f, 0.92f, 1f); private static readonly Color Cian = new Color(0.25f, 0.75f, 1f, 1f); private void Crear() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Expected O, but got Unknown //IL_0027: 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_003d: 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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown //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) _mat = new Material(Shader.Find("Sprites/Default")); AnimationCurve widthCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[2] { new Keyframe(0f, 0.022f), new Keyframe(1f, 0.002f) }); for (int i = 0; i < 28; i++) { GameObject val = new GameObject("MT_LineaVelocidad"); val.transform.SetParent(((Component)this).transform, false); LineRenderer val2 = val.AddComponent<LineRenderer>(); ((Renderer)val2).sharedMaterial = _mat; val2.useWorldSpace = true; ((Renderer)val2).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)val2).receiveShadows = false; val2.numCapVertices = 1; val2.widthCurve = widthCurve; val2.positionCount = 2; ((Renderer)val2).enabled = false; _trazos[i] = new Trazo { Lr = val2 }; } } private void Update() { //IL_0051: 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_0067: 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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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_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_010f: 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_01cd: 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_01d2: 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) Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null || ((Character)localPlayer).IsDead() || !MTPasoPlugin.LineasVelocidad.Value) { Apagar(); _hasLast = false; return; } if ((Object)(object)_mat == (Object)null) { Crear(); } float deltaTime = Time.deltaTime; Vector3 position = ((Component)localPlayer).transform.position; Vector3 val = ((_hasLast && deltaTime > 0f) ? ((position - _lastPos) / deltaTime) : Vector3.zero); _lastPos = position; _hasLast = true; val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude < 2500f) { _vel = Vector3.Lerp(_vel, val, Mathf.Clamp01(deltaTime * 10f)); } if (PasoController.LastDashTime != _ultimoPaso && Time.time - PasoController.LastDashTime < 0.1f) { _ultimoPaso = PasoController.LastDashTime; _rafagaHasta = Time.time + 0.35f; for (int i = 0; i < 12; i++) { Lanzar(localPlayer, ((Component)localPlayer).transform.forward, 1.6f, 2.6f); } } float magnitude = ((Vector3)(ref _vel)).magnitude; bool num = Manto.Active && ((Character)localPlayer).IsRunning() && magnitude > 4f && ((Character)localPlayer).IsOnGround(); bool flag = Time.time < _rafagaHasta; if (num || flag) { _proximo -= deltaTime; if (_proximo <= 0f) { _proximo = (flag ? 0.015f : Random.Range(0.04f, 0.07f)); Vector3 adelante = ((magnitude > 0.5f) ? (_vel / magnitude) : ((Component)localPlayer).transform.forward); Lanzar(localPlayer, adelante, flag ? 1.2f : 0.6f, flag ? 2f : 1.2f); } } for (int j = 0; j < 28; j++) { Animar(_trazos[j], deltaTime); } } private void Lanzar(Player p, Vector3 adelante, float largoMin, float largoMax) { //IL_0038: 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_0043: 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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_00b9: 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: 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_00d3: 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_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_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_0136: 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_013b: Unknown result type (might be due to invalid IL or missing references) Trazo trazo = null; for (int i = 0; i < 28; i++) { if (_trazos[i].Edad < 0f) { trazo = _trazos[i]; break; } } if (trazo != null) { Vector3 val = Vector3.Cross(Vector3.up, adelante); Vector3 normalized = ((Vector3)(ref val)).normalized; float num = Random.Range(0f, (float)Math.PI * 2f); float num2 = Random.Range(0.35f, 0.7f); trazo.Inicio = ((Component)p).transform.position + Vector3.up * Random.Range(0.25f, 1.75f) + normalized * Mathf.Cos(num) * num2 + Vector3.up * Mathf.Sin(num) * num2 * 0.25f + adelante * Random.Range(-0.2f, 0.4f); trazo.Dir = -adelante; trazo.Largo = Random.Range(largoMin, largoMax); trazo.Ancho = Random.Range(0.6f, 1.2f); trazo.Color = ((Time.time < _rafagaHasta) ? Cian : Blanco); trazo.Edad = 0f; trazo.Lr.widthMultiplier = trazo.Ancho; ((Renderer)trazo.Lr).enabled = true; } } private static void Animar(Trazo tr, float dt) { //IL_0063: 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_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_0086: 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_009b: 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_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_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_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_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) if (!(tr.Edad < 0f)) { tr.Edad += dt; float num = tr.Edad / 0.28f; if (num >= 1f) { tr.Edad = -1f; ((Renderer)tr.Lr).enabled = false; return; } float num2 = tr.Largo * Mathf.Min(1f, num * 3f); Vector3 val = tr.Inicio + tr.Dir * (tr.Largo * 0.6f * num); tr.Lr.SetPosition(0, val); tr.Lr.SetPosition(1, val + tr.Dir * num2); float a = Mathf.Clamp01((1f - num) / 0.5f) * 0.8f; Color color = tr.Color; color.a = a; Color endColor = color; endColor.a = 0f; tr.Lr.startColor = color; tr.Lr.endColor = endColor; } } private void Apagar() { if ((Object)(object)_mat == (Object)null) { return; } for (int i = 0; i < 28; i++) { if (_trazos[i].Edad >= 0f) { _trazos[i].Edad = -1f; ((Renderer)_trazos[i].Lr).enabled = false; } } } } } namespace MT.Touki { [BepInPlugin("mushokutensei.touki", "MT Touki", "1.2.3")] [BepInDependency("mushokutensei.core", "2.90.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] public class MTToukiPlugin : BaseUnityPlugin { public const string Version = "1.2.3"; private void Awake() { MantoController.RegisterInput(); ((Component)this).gameObject.AddComponent<MantoController>(); GritoAgonico.Registrar(); ((Component)this).gameObject.AddComponent<GritoRevisor>(); ArteTercerOjo.Registrar(); MTPasoPlugin.Iniciar((BaseUnityPlugin)(object)this); PoderesNpc.Registrar((IPasoNpc)(object)new PasoNpcTouki()); Parches.Aplicar("mushokutensei.touki", ((object)this).GetType().Assembly, ((BaseUnityPlugin)this).Logger); ((BaseUnityPlugin)this).Logger.LogInfo((object)"MT Touki 1.2.3 cargado"); } } } namespace MT.Core.Touki { public sealed class ArteTercerOjo : Habilidad { public const string Id = "tercer_ojo"; private const string KeyAprendido = "MT.Core.TercerOjoAprendido"; public static readonly ArteTercerOjo Instancia = new ArteTercerOjo(); private static Sprite _icono; private static bool _iconoProbado; public override string Familia => "core"; public override string Nombre => Tr.Get("core_third_eye"); public override string Descripcion => Tr.Get("core_third_eye_d"); public override Sprite Icono => IconoOjo(); public static void Registrar() { ArtesUniversales.Registrar("tercer_ojo", (Habilidad)(object)Instancia); } public static void Revisar(Player p) { //IL_0052: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)p == (Object)null) && !p.m_customData.ContainsKey("MT.Core.TercerOjoAprendido") && ((Habilidad)Instancia).Conoce(p)) { p.m_customData["MT.Core.TercerOjoAprendido"] = "1"; ((Character)p).Message((MessageType)2, Tr.Get("core_third_eye_learned", new object[1] { MTKeys.Rueda.Value }), 0, (Sprite)null, false); Cronica.Anotar(p, "cronica_third_eye_learned", Array.Empty<string>()); } } private ArteTercerOjo() { //IL_0013: 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_0036: 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) base.Clave = "tercer_ojo"; base.Activacion = (Activacion)1; base.Toki = 10f; base.Mana = 15f; base.ModoToki = (ModoToki)2; base.Color = TercerOjo.Rojo; } public override string Detalle(Player p) { return Tr.Get("core_third_eye_cost", new object[3] { 10f, 15f, TercerOjoRules.Espera(GritoAgonico.Nivel(p)) }); } public override bool Conoce(Player p) { return TercerOjoRules.Conoce(GritoAgonico.Nivel(p)); } public override float EnfriamientoPara(Player p) { return TercerOjoRules.Espera(GritoAgonico.Nivel(p)); } protected override string TextoSinMana() { return Tr.Get("core_third_eye_no_strength"); } protected override string AvisoEspera(int segundos) { return null; } public override void Lanzar(Player p, bool conToki, Projectile flecha) { TercerOjo.Abrir(p, GritoAgonico.Nivel(p)); } private static Sprite IconoOjo() { if (_iconoProbado) { return _icono; } _iconoProbado = true; if (!string.IsNullOrEmpty(Arte.Dir)) { _icono = MTSkills.LoadIcon(Arte.Dir, "tercer_ojo"); } return _icono; } } [HarmonyPatch(typeof(Character), "Damage")] public static class OutgoingDamagePatch { private static void Prefix(Character __instance, HitData hit) { //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Invalid comparison between Unknown and I4 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, true) > 0f)) { num3 += (float)num * ToukiRules.Intensidad() * num4 * CoreConfig.DanoPorNivel.Value; num3 += num4 * CoreConfig.DanoPorRangoEspada.Value * (float)(Especialidades.RangoEspada?.Invoke(localPlayer) ?? 0); Manto.TrainDominio(localPlayer, CoreConfig.DominioPorGolpe.Value); } if ((int)hit.m_skill == 11 && EsPunoDesnudo(localPlayer)) { hit.m_damage.m_blunt += (float)num * (1.5f + 0.035f * ((Character)localPlayer).GetSkillLevel((SkillType)11)); } float num5 = 1f + num3 * num2 * Ritmo.PoderDano(localPlayer); hit.m_damage.m_blunt *= num5; hit.m_damage.m_slash *= num5; hit.m_damage.m_pierce *= num5; } } private static bool EsPunoDesnudo(Player p) { ItemData currentWeapon = ((Humanoid)p).GetCurrentWeapon(); if (currentWeapon != null) { if ((Object)(object)((Humanoid)p).m_unarmedWeapon != (Object)null) { return currentWeapon == ((Humanoid)p).m_unarmedWeapon.m_itemData; } return false; } return true; } 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(object __instance, 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) { return; } float num2 = ((__instance is WearNTear) ? Mathf.Clamp01(CoreConfig.TokiConstrucciones.Value) : 1f); if (!(num2 <= 0f)) { float num3 = hit.m_damage.m_blunt + hit.m_damage.m_slash + hit.m_damage.m_pierce; if (num3 > 0f) { float num4 = Mathf.Min(1f, CoreConfig.TalarBase.Value + (float)num * CoreConfig.TalarPorNivel.Value) * num2; hit.m_damage.m_chop = Mathf.Max(hit.m_damage.m_chop, num3 * num4); hit.m_damage.m_pickaxe = Mathf.Max(hit.m_damage.m_pickaxe, num3 * num4); hit.m_toolTier = (short)Mathf.Max((int)hit.m_toolTier, 1 + num / 2); } float num5 = Manto.Factor(localPlayer); if (!(num5 <= 0f) && (!Manto.Active || !(Manto.Spend(localPlayer, CoreConfig.CostoGolpe.Value * 0.5f, true) <= 0f))) { float num6 = 1f + (float)num * num5 * CoreConfig.DanoObjetosPorNivel.Value * num2; hit.m_damage.m_chop *= num6; hit.m_damage.m_pickaxe *= num6; hit.m_damage.m_blunt *= num6; hit.m_damage.m_slash *= num6; hit.m_damage.m_pierce *= num6; } } } } [HarmonyPatch(typeof(Character), "RPC_Damage")] public static class IncomingDamagePatch { private static readonly Stopwatch Reloj = new Stopwatch(); private static int _gcAntes; private static float _avisoLento; private static void Postfix(Character __instance, HitData hit) { if (Reloj.IsRunning && !((Object)(object)__instance != (Object)(object)Player.m_localPlayer)) { Reloj.Stop(); long elapsedMilliseconds = Reloj.ElapsedMilliseconds; if (elapsedMilliseconds > 15 && Time.unscaledTime > _avisoLento) { _avisoLento = Time.unscaledTime + 5f; MTCorePlugin.Log.LogWarning((object)("Golpe lento (" + ((hit != null) ? ((object)Unsafe.As<HitType, HitType>(ref hit.m_hitType)/*cast due to .constrained prefix*/).ToString() : "?") + "): " + elapsedMilliseconds + " ms" + ((GC.CollectionCount(0) != _gcAntes) ? " · hubo limpieza de memoria (GC)" : " · sin GC"))); } } } private static void Prefix(Character __instance, HitData hit, bool __runOriginal) { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Invalid comparison between Unknown and I4 //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Invalid comparison between Unknown and I4 //IL_0096: 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) if ((Object)(object)__instance == (Object)(object)Player.m_localPlayer) { _gcAntes = GC.CollectionCount(0); Reloj.Reset(); Reloj.Start(); } if (!__runOriginal) { return; } 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 - ToukiRules.Fuerza(num) * CoreConfig.DurezaPorNivel.Value); hit.m_damage.m_blunt *= num2; hit.m_damage.m_slash *= num2; hit.m_damage.m_pierce *= num2; float num3 = Mathf.Clamp01(1f - ToukiRules.Fuerza(num) * CoreConfig.ResistenciaMagicaPorNivel.Value); hit.m_damage.m_fire *= num3; hit.m_damage.m_frost *= num3; hit.m_damage.m_lightning *= num3; hit.m_damage.m_poison *= num3; hit.m_damage.m_spirit *= num3; if (flag) { ((DamageTypes)(ref hit.m_damage)).Modify(Mathf.Clamp01(1f - ToukiRules.Fuerza(num) * CoreConfig.SorpresaPorNivel.Value)); } float num4 = hit.m_damage.m_blunt + hit.m_damage.m_slash + hit.m_damage.m_pierce; float num5 = hit.m_damage.m_fire + hit.m_damage.m_frost + hit.m_damage.m_lightning + hit.m_damage.m_poison + hit.m_damage.m_spirit; float num6 = num4 + num5; if (num6 <= 0f) { return; } float num7 = 0f; if (Manto.Active) { float num8 = num6 * ToukiRules.Fuerza(num) * CoreConfig.AmortiguarPorNivel.Value; num7 = Manto.Spend(localPlayer, num8, true) / Manto.CostMultiplier(localPlayer); if (num7 < num8) { num7 += PayFromBlue(localPlayer, num8 - num7); } } else if (Manto.Factor(localPlayer) > 0f) { num7 = PayFromBlue(localPlayer, num6 * ToukiRules.Fuerza(num) * CoreConfig.AmortiguarPorNivel.Value * Manto.Factor(localPlayer)); } else if (flag && Manto.TryReflex(localPlayer)) { num7 = PayFromBlue(localPlayer, num6 * ToukiRules.Fuerza(num) * CoreConfig.AmortiguarPorNivel.Value); ((Character)localPlayer).Message((MessageType)1, Tr.Get("core_toki_reflex"), 0, (Sprite)null, false); } if (!(num7 <= 0f)) { Hitos.Add(localPlayer, (Hito)2, num7); if (flag && num6 - num7 < ((Character)localPlayer).GetHealth()) { Hitos.Add(localPlayer, (Hito)0, 1f); } float num9 = Mathf.Clamp01(num7 / num6); float num10 = 1f - num9; hit.m_damage.m_blunt *= num10; hit.m_damage.m_slash *= num10; hit.m_damage.m_pierce *= num10; hit.m_damage.m_fire *= num10; hit.m_damage.m_frost *= num10; hit.m_damage.m_lightning *= num10; hit.m_damage.m_poison *= num10; hit.m_damage.m_spirit *= num10; Manto.TrainDominio(localPlayer, num7 * 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, 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)2, 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)0, 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, 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) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) __state = null; if ((int)CoreConfig.Muerte.Value != 0) { 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) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Invalid comparison between Unknown and I4 if (__state == null) { return; } float num = (((int)CoreConfig.Muerte.Value == 2) ? 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_0001: Unknown result type (might be due to invalid IL or missing references) return Campos.Skill(skills, type); } } public sealed class GritoAgonico : Habilidad { public const string Id = "grito_agonico"; private const string KeyAprendido = "MT.Core.GritoAprendido"; public static readonly GritoAgonico Instancia = new GritoAgonico(); private static Sprite _icono; private static bool _iconoProbado; public override string Familia => "core"; public override string Nombre => Tr.Get("core_shout"); public override string Descripcion => Tr.Get("core_shout_d"); public override Sprite Icono => IconoGrito(); private GritoAgonico() { //IL_0013: 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_0036: 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) base.Clave = "grito_agonico"; base.Activacion = (Activacion)1; base.Toki = 15f; base.Mana = 25f; base.ModoToki = (ModoToki)2; base.Color = MTGui.Naranja; } public static float Nivel(Player p) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)p == (Object)null)) { return GritoRules.Nivel(ToukiRules.Level(p), ((Character)p).GetSkillLevel(MTSkills.Control)); } return 0f; } public override string Detalle(Player p) { return Tr.Get("core_shout_cost", new object[3] { 15f, 25f, GritoRules.Espera(Nivel(p)) }); } public override bool Conoce(Player p) { return GritoRules.Conoce(Nivel(p)); } public override float EnfriamientoPara(Player p) { return GritoRules.Espera(Nivel(p)); } protected override string TextoSinMana() { return Tr.Get("core_shout_no_strength"); } protected override string AvisoEspera(int segundos) { return null; } private static Sprite IconoGrito() { if (_iconoProbado) { return _icono; } _iconoProbado = true; if (!string.IsNullOrEmpty(Arte.Dir)) { _icono = MTSkills.LoadIcon(Arte.Dir, "grito_agonico"); } return _icono; } public static void Registrar() { ArtesUniversales.Registrar("grito_agonico", (Habilidad)(object)Instancia); } public static void Revisar(Player p) { //IL_0052: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)p == (Object)null) && !p.m_customData.ContainsKey("MT.Core.GritoAprendido") && ((Habilidad)Instancia).Conoce(p)) { p.m_customData["MT.Core.GritoAprendido"] = "1"; ((Character)p).Message((MessageType)2, Tr.Get("core_shout_learned", new object[1] { MTKeys.Rueda.Value }), 0, (Sprite)null, false); Cronica.Anotar(p, "cronica_shout_learned", Array.Empty<string>()); } } public override void Lanzar(Player p, bool conToki, Projectile flecha) { //IL_0012: 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_0043: 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_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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) float num = Nivel(p); RugidoToki.Gesto(p); RugidoToki.EstallarColor(((Component)p).transform.position, 1.8f, new Color(0.3f, 0.95f, 0.78f)); float num2 = GritoRules.Radio(num); float duracion = GritoRules.Duracion(num); Vector3 centerPoint = ((Character)p).GetCenterPoint(); OndaRadial.Emitir(centerPoint, new Color(0.3f, 0.95f, 0.78f), num2, 0.65f); ((MonoBehaviour)p).StartCoroutine(Alcanzar(p, centerPoint, num2, duracion)); } private static IEnumerator Alcanzar(Player p, Vector3 pos, float radio, float duracion) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) HashSet<Character> tocados = new HashSet<Character>(); float edad = 0f; while (edad < 0.65f && !((Object)(object)p == (Object)null) && !((Character)p).IsDead()) { edad = Mathf.Min(0.65f, edad + Time.deltaTime); float num = GritoRules.FrenteOnda(radio, edad); foreach (Character allCharacter in Character.GetAllCharacters()) { if ((Object)(object)allCharacter == (Object)null || (Object)(object)allCharacter == (Object)(object)p || allCharacter.IsDead() || allCharacter.IsTamed() || tocados.Contains(allCharacter) || !BaseAI.IsEnemy((Character)(object)p, allCharacter)) { continue; } Vector3 val = allCharacter.GetCenterPoint() - pos; if (!(((Vector3)(ref val)).sqrMagnitude > num * num)) { tocados.Add(allCharacter); allCharacter.Stagger((((Vector3)(ref val)).sqrMagnitude > 0.01f) ? ((Vector3)(ref val)).normalized : ((Component)p).transform.forward); SEMan sEMan = allCharacter.GetSEMan(); if (sEMan != null) { sEMan.AddStatusEffect(SE_Sobrecogido.Hash, true, 0, duracion, (short)(-1)); } } } yield return null; } } } public class GritoRevisor : MonoBehaviour { private float _t; private void Update() { _t -= Time.deltaTime; if (!(_t > 0f)) { _t = 2f; GritoAgonico.Revisar(Player.m_localPlayer); ArteTercerOjo.Revisar(Player.m_localPlayer); } } } public class MantoController : MonoBehaviour { public const string ButtonName = "MT_Manto"; private const float HoldToTurnOff = 0.6f; private float _pressTime = -1f; private bool _handledHold; private float _runXpTimer; private float _mantoSeconds; private int _lastLevel = -1; private static readonly FieldRef<Player, float> RegenStamina = AccessTools.FieldRefAccess<Player, float>("m_staminaRegenTimer"); private static readonly FieldRef<Player, float> RegenEitr = AccessTools.FieldRefAccess<Player, float>("m_eitrRegenTimer"); private int _nivel = -1; private int _carga = -1; private int _tope = -1; private string _titulo; private string _cifras; private string _idioma; public static void RegisterInput() { //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_001a: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown //IL_0037: Unknown result type (might be due to invalid IL or missing references) InputManager.Instance.AddButton("mushokutensei.core", new ButtonConfig { Name = "MT_Manto", Key = (KeyCode)((MTKeys.Manto == null || (int)MTKeys.Manto.Value == 0) ? 98 : ((int)MTKeys.Manto.Value)), ActiveInCustomGUI = false }); } private static bool CanTakeInput() { if ((Object)(object)Player.m_localPlayer != (Object)null && !((Character)Player.m_localPlayer).IsDead() && ((Object)(object)Chat.instance == (Object)null || !Chat.instance.HasFocus()) && !Console.IsVisible() && !Menu.IsVisible() && !InventoryGui.IsVisible() && !TextInput.IsVisible()) { return !Minimap.IsOpen(); } return false; } private void Update() { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { Manto.ResetForNewSession(); return; } if (ToukiRules.Apagado(localPlayer)) { if (Manto.Active) { Manto.TurnOff(localPlayer, true); } if (((Character)localPlayer).GetSEMan().HaveStatusEffect(SE_ToukiPasivo.Hash)) { SE_ToukiPasivo.Remove(localPlayer); } return; } if (((Character)localPlayer).IsDead()) { Manto.TurnOff(localPlayer, true); return; } if (Manto.Active && CoreConfig.RegenConManto.Value) { RegenStamina.Invoke(localPlayer) = 0f; RegenEitr.Invoke(localPlayer) = 0f; } HandleInput(localPlayer); int num = ToukiRules.Level(localPlayer); if (num != _lastLevel) { _lastLevel = num; Hitos.AnnounceAll(localPlayer); EventosCore.NivelToki(localPlayer, num); } Upkeep(localPlayer); } private void HandleInput(Player p) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) if (!CanTakeInput()) { _pressTime = -1f; Manto.Apagando = 0f; return; } if (MTKeys.Down(MTKeys.Manto) || ((int)MTKeys.MantoAlt.Value != 0 && MTKeys.Down(MTKeys.MantoAlt))) { _pressTime = Time.time; _handledHold = false; } if (_pressTime >= 0f && !_handledHold && (MTKeys.Held(MTKeys.Manto) || ((int)MTKeys.MantoAlt.Value != 0 && MTKeys.Held(MTKeys.MantoAlt))) && Time.time - _pressTime >= 0.6f) { _handledHold = true; Manto.TurnOff(p, false); } if (MTKeys.Up(MTKeys.Manto) || ((int)MTKeys.MantoAlt.Value != 0 && MTKeys.Up(MTKeys.MantoAlt))) { if (_pressTime >= 0f && !_handledHold) { Manto.ChargeUp(p); } _pressTime = -1f; } Manto.Apagando = ((_pressTime >= 0f && !_handledHold && Manto.Active) ? Mathf.Clamp01((Time.time - _pressTime) / 0.6f) : 0f); } private void Upkeep(Player p) { if (!Manto.Active) { return; } Manto.TickOleada(p); _mantoSeconds += Time.deltaTime; if (_mantoSeconds >= 5f) { Hitos.Add(p, (Hito)1, _mantoSeconds); _mantoSeconds = 0f; } bool flag = ((Character)p).IsRunning() && ((Character)p).IsOnGround(); float num = Manto.GastoPorSegundo(p, flag && !Esfuerzo.EnCombate); Manto.Spend(p, num * Time.deltaTime, flag); if (flag) { _runXpTimer += Time.deltaTime; if (_runXpTimer >= 1f) { _runXpTimer = 0f; Manto.TrainDominio(p, 0.1f); } } } private void OnGUI() { //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: 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_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: 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_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0223: 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) ((MonoBehaviour)this).useGUILayout = false; if (Hud.Activo) { return; } Player localPlayer = Player.m_localPlayer; if (!((Object)(object)localPlayer == (Object)null) && !((Object)(object)Hud.instance == (Object)null) && !Menu.IsVisible() && ToukiState.IsAwakened(localPlayer) && (Manto.Active || !(Manto.Charge <= 0f))) { float scale = MTGui.Scale; float num = Mathf.Max(Manto.MaxCharge(localPlayer), 0.01f); float num2 = 300f * scale; float num3 = 12f * scale; float num4 = (float)Screen.width * CoreConfig.BarraX.Value - num2 / 2f; float num5 = (float)Screen.height * CoreConfig.BarraY.Value; float num6 = Manto.Charge / num; Color val = ((num6 < 0.2f) ? Color.Lerp(MTGui.Naranja, MTGui.Rojo, Mathf.PingPong(Time.time * 3f, 1f)) : MTGui.Naranja); MTGui.Bar(new Rect(num4, num5, num2, num3), num6, val); int num7 = ToukiRules.Level(localPlayer); int num8 = Mathf.RoundToInt(Manto.Charge); int num9 = Mathf.RoundToInt(num); if (num7 != _nivel || _titulo == null || _idioma != Tr.Current) { _idioma = Tr.Current; _nivel = num7; _cifras = null; _titulo = Tr.Get("core_toki_mantle") + " · " + Tr.Get("core_lv") + " " + num7; } if (num8 != _carga || num9 != _tope || _cifras == null) { _carga = num8; _tope = num9; _cifras = num8 + " / " + num9; } MTGui.Label(new Rect(num4, num5 - 22f * scale, num2, 20f * scale), _titulo, 15, MTGui.Oro, (TextAnchor)6, true); MTGui.Label(new Rect(num4, num5 - 22f * scale, num2, 20f * scale), _cifras, 14, MTGui.Texto, (TextAnchor)8, false); } } } [HarmonyPatch(typeof(Character), "RPC_Damage")] public static class RompeHechizosPatch { private static void Prefix(Character __instance, HitData hit, bool __runOriginal) { if (!__runOriginal) { return; } Player localPlayer = Player.m_localPlayer; if (!((Object)(object)localPlayer == (Object)null) && !((Object)(object)__instance != (Object)(object)localPlayer) && hit != null && Manto.Active) { int num = ToukiRules.Level(localPlayer); if (num >= 1) { float num2 = 1f - Mathf.Min(0.3f, 0.03f * (float)num); hit.m_damage.m_fire *= num2; hit.m_damage.m_frost *= num2; hit.m_damage.m_lightning *= num2; hit.m_damage.m_poison *= num2; hit.m_damage.m_spirit *= num2; } } } } [HarmonyPatch(typeof(Character), "ApplyDamage")] public static class CrisisPatch { private static void Postfix(Character __instance) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown if (!((Object)(object)__instance != (Object)(object)Player.m_localPlayer) && !__instance.IsDead() && __instance.GetHealthPercentage() < CoreConfig.VidaCrisis.Value) { ToukiState.RollOnCrisis((Player)__instance); } } } [HarmonyPatch(typeof(Character), "OnDeath")] public static class PruebaYagluthPatch { private static void Prefix(Character __instance) { //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) Player localPlayer = Player.m_localPlayer; if (!((Object)(object)localPlayer == (Object)null) && !((Object)(object)__instance == (Object)null) && ((Object)((Component)__instance).gameObject).name.StartsWith("GoblinKing") && Manto.Active && Vector3.Distance(((Component)localPlayer).transform.position, ((Component)__instance).transform.position) < 60f) { localPlayer.m_customData["MT.Core.Toki.PruebaYagluth"] = "1"; } } } [HarmonyPatch(typeof(Player), "OnSpawned")] public static class SpawnPatch { private static bool _calentado; private static void Postfix(Player __instance) { if (!((Object)(object)__instance != (Object)(object)Player.m_localPlayer)) { if (!_calentado) { _calentado = true; ((MonoBehaviour)__instance).StartCoroutine(MTBundle.Calentar()); } Talento.Roll(__instance); ToukiState.RollBirthTalent(__instance); SE_Talento.Apply(__instance); if (ToukiState.IsAwakened(__instance)) { SE_ToukiPasivo.Apply(__instance); } } } } }